Commit 60530b8a authored by Martin Baulig's avatar Martin Baulig Committed by Martin Baulig

Renamed gtk_image_menu_item_add_icon() to gtk_image_menu_item_set_icon()

2001-04-28  Martin Baulig  <baulig@suse.de>

	* gtk/gtkimagemenuitem.[ch]: Renamed gtk_image_menu_item_add_icon()
	to gtk_image_menu_item_set_icon() and made it work if there's already
	an image.
	(gtk_image_menu_item_new): This function doesn't take any arguments anymore.
	(gtk_image_menu_item_new_with_label): New function.
parent 8be15042
2001-04-28 Martin Baulig <baulig@suse.de>
* gtk/gtkimagemenuitem.[ch]: Renamed gtk_image_menu_item_add_icon()
to gtk_image_menu_item_set_icon() and made it work if there's already
an image.
(gtk_image_menu_item_new): This function doesn't take any arguments anymore.
(gtk_image_menu_item_new_with_label): New function.
Thu May 17 16:20:04 2001 Jonathan Blandford <jrb@redhat.com>
* demos/gtk-demo/main.c (fontify): It's the worlds ugliest
......
2001-04-28 Martin Baulig <baulig@suse.de>
* gtk/gtkimagemenuitem.[ch]: Renamed gtk_image_menu_item_add_icon()
to gtk_image_menu_item_set_icon() and made it work if there's already
an image.
(gtk_image_menu_item_new): This function doesn't take any arguments anymore.
(gtk_image_menu_item_new_with_label): New function.
Thu May 17 16:20:04 2001 Jonathan Blandford <jrb@redhat.com>
* demos/gtk-demo/main.c (fontify): It's the worlds ugliest
......
2001-04-28 Martin Baulig <baulig@suse.de>
* gtk/gtkimagemenuitem.[ch]: Renamed gtk_image_menu_item_add_icon()
to gtk_image_menu_item_set_icon() and made it work if there's already
an image.
(gtk_image_menu_item_new): This function doesn't take any arguments anymore.
(gtk_image_menu_item_new_with_label): New function.
Thu May 17 16:20:04 2001 Jonathan Blandford <jrb@redhat.com>
* demos/gtk-demo/main.c (fontify): It's the worlds ugliest
......
2001-04-28 Martin Baulig <baulig@suse.de>
* gtk/gtkimagemenuitem.[ch]: Renamed gtk_image_menu_item_add_icon()
to gtk_image_menu_item_set_icon() and made it work if there's already
an image.
(gtk_image_menu_item_new): This function doesn't take any arguments anymore.
(gtk_image_menu_item_new_with_label): New function.
Thu May 17 16:20:04 2001 Jonathan Blandford <jrb@redhat.com>
* demos/gtk-demo/main.c (fontify): It's the worlds ugliest
......
2001-04-28 Martin Baulig <baulig@suse.de>
* gtk/gtkimagemenuitem.[ch]: Renamed gtk_image_menu_item_add_icon()
to gtk_image_menu_item_set_icon() and made it work if there's already
an image.
(gtk_image_menu_item_new): This function doesn't take any arguments anymore.
(gtk_image_menu_item_new_with_label): New function.
Thu May 17 16:20:04 2001 Jonathan Blandford <jrb@redhat.com>
* demos/gtk-demo/main.c (fontify): It's the worlds ugliest
......
2001-04-28 Martin Baulig <baulig@suse.de>
* gtk/gtkimagemenuitem.[ch]: Renamed gtk_image_menu_item_add_icon()
to gtk_image_menu_item_set_icon() and made it work if there's already
an image.
(gtk_image_menu_item_new): This function doesn't take any arguments anymore.
(gtk_image_menu_item_new_with_label): New function.
Thu May 17 16:20:04 2001 Jonathan Blandford <jrb@redhat.com>
* demos/gtk-demo/main.c (fontify): It's the worlds ugliest
......
2001-04-28 Martin Baulig <baulig@suse.de>
* gtk/gtkimagemenuitem.[ch]: Renamed gtk_image_menu_item_add_icon()
to gtk_image_menu_item_set_icon() and made it work if there's already
an image.
(gtk_image_menu_item_new): This function doesn't take any arguments anymore.
(gtk_image_menu_item_new_with_label): New function.
Thu May 17 16:20:04 2001 Jonathan Blandford <jrb@redhat.com>
* demos/gtk-demo/main.c (fontify): It's the worlds ugliest
......
......@@ -149,22 +149,11 @@ gtk_image_menu_item_set_property (GObject *object,
{
case PROP_IMAGE:
{
GtkWidget *child;
child = (GtkWidget*) g_value_get_object (value);
if (child != image_menu_item->image)
{
if (image_menu_item->image)
gtk_container_remove (GTK_CONTAINER (image_menu_item),
image_menu_item->image);
if (child)
{
gtk_image_menu_item_add_image (image_menu_item,
child);
}
}
GtkWidget *image;
image = (GtkWidget*) g_value_get_object (value);
gtk_image_menu_item_set_image (image_menu_item, image);
}
break;
default:
......@@ -339,8 +328,13 @@ gtk_image_menu_item_forall (GtkContainer *container,
}
GtkWidget*
gtk_image_menu_item_new (GtkWidget *widget,
const gchar *label)
gtk_image_menu_item_new (void)
{
return g_object_new (GTK_TYPE_IMAGE_MENU_ITEM, NULL);
}
GtkWidget*
gtk_image_menu_item_new_with_label (const gchar *label)
{
GtkImageMenuItem *image_menu_item;
GtkWidget *accel_label;
......@@ -356,9 +350,6 @@ gtk_image_menu_item_new (GtkWidget *widget,
GTK_WIDGET (image_menu_item));
gtk_widget_show (accel_label);
if (widget)
gtk_image_menu_item_add_image (image_menu_item, widget);
return GTK_WIDGET(image_menu_item);
}
......@@ -376,7 +367,9 @@ gtk_image_menu_item_new_from_stock (const gchar *stock_id,
if (gtk_stock_lookup (stock_id, &stock_item))
{
item = gtk_image_menu_item_new (image, stock_item.label);
item = gtk_image_menu_item_new_with_label (stock_item.label);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
if (stock_item.keyval && accel_group)
gtk_widget_add_accelerator (item,
......@@ -387,33 +380,47 @@ gtk_image_menu_item_new_from_stock (const gchar *stock_id,
GTK_ACCEL_VISIBLE);
}
else
item = gtk_image_menu_item_new (image, stock_id);
{
item = gtk_image_menu_item_new_with_label (stock_id);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
}
gtk_widget_show (image);
return item;
}
void
gtk_image_menu_item_add_image (GtkImageMenuItem *image_menu_item,
GtkWidget *child)
gtk_image_menu_item_set_image (GtkImageMenuItem *image_menu_item,
GtkWidget *image)
{
g_return_if_fail (GTK_IS_IMAGE_MENU_ITEM (image_menu_item));
g_return_if_fail (image_menu_item->image == NULL);
gtk_widget_set_parent (child, GTK_WIDGET (image_menu_item));
image_menu_item->image = child;
if (image == image_menu_item->image)
return;
if (image_menu_item->image)
gtk_container_remove (GTK_CONTAINER (image_menu_item),
image_menu_item->image);
image_menu_item->image = image;
if (image == NULL)
return;
gtk_widget_set_parent (image, GTK_WIDGET (image_menu_item));
g_object_notify (G_OBJECT (image_menu_item), "image");
if (GTK_WIDGET_REALIZED (child->parent))
gtk_widget_realize (child);
if (GTK_WIDGET_REALIZED (image->parent))
gtk_widget_realize (image);
if (GTK_WIDGET_VISIBLE (child->parent) && GTK_WIDGET_VISIBLE (child))
if (GTK_WIDGET_VISIBLE (image->parent) && GTK_WIDGET_VISIBLE (image))
{
if (GTK_WIDGET_MAPPED (child->parent))
gtk_widget_map (child);
if (GTK_WIDGET_MAPPED (image->parent))
gtk_widget_map (image);
gtk_widget_queue_resize (child);
gtk_widget_queue_resize (image);
}
}
......
......@@ -63,12 +63,12 @@ struct _GtkImageMenuItemClass
GtkType gtk_image_menu_item_get_type (void) G_GNUC_CONST;
GtkWidget* gtk_image_menu_item_new (GtkWidget *widget,
const gchar *label);
GtkWidget* gtk_image_menu_item_new (void);
GtkWidget* gtk_image_menu_item_new_with_label (const gchar *label);
GtkWidget* gtk_image_menu_item_new_from_stock (const gchar *stock_id,
GtkAccelGroup *accel_group);
void gtk_image_menu_item_add_image (GtkImageMenuItem *image_menu_item,
GtkWidget *child);
void gtk_image_menu_item_set_image (GtkImageMenuItem *image_menu_item,
GtkWidget *image);
GtkWidget* gtk_image_menu_item_get_image (GtkImageMenuItem *image_menu_item);
#ifdef __cplusplus
......
......@@ -1242,7 +1242,7 @@ gtk_item_factory_create_item (GtkItemFactory *ifactory,
image = gtk_image_new_from_pixbuf (pixbuf);
if (image)
gtk_image_menu_item_add_image (GTK_IMAGE_MENU_ITEM (widget), image);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (widget), image);
if (pixbuf)
g_object_unref (G_OBJECT (pixbuf));
......@@ -1251,7 +1251,7 @@ gtk_item_factory_create_item (GtkItemFactory *ifactory,
{
image = gtk_image_new_from_stock (entry->extra_data, GTK_ICON_SIZE_MENU);
if (image)
gtk_image_menu_item_add_image (GTK_IMAGE_MENU_ITEM (widget), image);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (widget), image);
if (gtk_stock_lookup (entry->extra_data, &stock_item))
{
......
......@@ -2771,7 +2771,8 @@ create_menu (gint depth, gint length, gboolean tearoff)
image = gtk_image_new_from_stock (GTK_STOCK_OPEN,
GTK_ICON_SIZE_MENU);
gtk_widget_show (image);
menuitem = gtk_image_menu_item_new (image, "Image item");
menuitem = gtk_image_menu_item_new_with_label ("Image item");
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menuitem), image);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
gtk_widget_show (menuitem);
......@@ -2858,7 +2859,8 @@ create_menus (void)
image = gtk_image_new_from_stock (GTK_STOCK_HELP,
GTK_ICON_SIZE_MENU);
gtk_widget_show (image);
menuitem = gtk_image_menu_item_new (image, "Help");
menuitem = gtk_image_menu_item_new_with_label ("Help");
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menuitem), image);
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), create_menu (4, 5, TRUE));
gtk_menu_item_right_justify (GTK_MENU_ITEM (menuitem));
gtk_menu_bar_append (GTK_MENU_BAR (menubar), menuitem);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment