mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-10 19:00:08 +00:00
Make it possible to overrule the gtk-menu-images setting.
2008-11-02 Matthias Clasen <mclasen@redhat.com> * gtk/gtkimagemenuitem.c: Make it possible to overrule the gtk-menu-images setting. * gtk/gtkaction.c (connect_proxy): Show the image before adding it to the image menu item. svn path=/trunk/; revision=21751
This commit is contained in:
parent
2b9ac5df0b
commit
cbc5d3e33d
@ -1,3 +1,11 @@
|
||||
2008-11-02 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* gtk/gtkimagemenuitem.c: Make it possible to overrule the
|
||||
gtk-menu-images setting.
|
||||
|
||||
* gtk/gtkaction.c (connect_proxy): Show the image before adding
|
||||
it to the image menu item.
|
||||
|
||||
2008-11-01 Tor Lillqvist <tml@novell.com>
|
||||
|
||||
Bug 558278 - Crash when calling a callback set by
|
||||
|
@ -749,9 +749,9 @@ connect_proxy (GtkAction *action,
|
||||
if (!image)
|
||||
{
|
||||
image = gtk_image_new ();
|
||||
gtk_widget_show (image);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (proxy),
|
||||
image);
|
||||
gtk_widget_show (image);
|
||||
}
|
||||
|
||||
if (action->private_data->stock_id &&
|
||||
|
@ -42,6 +42,7 @@ static void gtk_image_menu_item_size_request (GtkWidget *widget,
|
||||
GtkRequisition *requisition);
|
||||
static void gtk_image_menu_item_size_allocate (GtkWidget *widget,
|
||||
GtkAllocation *allocation);
|
||||
static void gtk_image_menu_item_map (GtkWidget *widget);
|
||||
static void gtk_image_menu_item_remove (GtkContainer *container,
|
||||
GtkWidget *child);
|
||||
static void gtk_image_menu_item_toggle_size_request (GtkMenuItem *menu_item,
|
||||
@ -85,6 +86,7 @@ gtk_image_menu_item_class_init (GtkImageMenuItemClass *klass)
|
||||
widget_class->screen_changed = gtk_image_menu_item_screen_changed;
|
||||
widget_class->size_request = gtk_image_menu_item_size_request;
|
||||
widget_class->size_allocate = gtk_image_menu_item_size_allocate;
|
||||
widget_class->map = gtk_image_menu_item_map;
|
||||
|
||||
container_class->forall = gtk_image_menu_item_forall;
|
||||
container_class->remove = gtk_image_menu_item_remove;
|
||||
@ -171,6 +173,19 @@ show_image (GtkImageMenuItem *image_menu_item)
|
||||
return show;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_image_menu_item_map (GtkWidget *widget)
|
||||
{
|
||||
GtkImageMenuItem *image_menu_item = GTK_IMAGE_MENU_ITEM (widget);
|
||||
|
||||
GTK_WIDGET_CLASS (gtk_image_menu_item_parent_class)->map (widget);
|
||||
|
||||
if (image_menu_item->image)
|
||||
g_object_set (image_menu_item->image,
|
||||
"visible", show_image (image_menu_item),
|
||||
NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_image_menu_item_destroy (GtkObject *object)
|
||||
{
|
||||
@ -197,7 +212,7 @@ gtk_image_menu_item_toggle_size_request (GtkMenuItem *menu_item,
|
||||
|
||||
*requisition = 0;
|
||||
|
||||
if (image_menu_item->image && show_image (image_menu_item))
|
||||
if (image_menu_item->image && GTK_WIDGET_VISIBLE (image_menu_item->image))
|
||||
{
|
||||
GtkRequisition image_requisition;
|
||||
guint toggle_spacing;
|
||||
@ -238,9 +253,7 @@ gtk_image_menu_item_size_request (GtkWidget *widget,
|
||||
|
||||
image_menu_item = GTK_IMAGE_MENU_ITEM (widget);
|
||||
|
||||
if (image_menu_item->image &&
|
||||
GTK_WIDGET_VISIBLE (image_menu_item->image) &&
|
||||
show_image (image_menu_item))
|
||||
if (image_menu_item->image && GTK_WIDGET_VISIBLE (image_menu_item->image))
|
||||
{
|
||||
GtkRequisition child_requisition;
|
||||
|
||||
@ -284,7 +297,7 @@ gtk_image_menu_item_size_allocate (GtkWidget *widget,
|
||||
|
||||
GTK_WIDGET_CLASS (gtk_image_menu_item_parent_class)->size_allocate (widget, allocation);
|
||||
|
||||
if (image_menu_item->image && show_image (image_menu_item))
|
||||
if (image_menu_item->image && GTK_WIDGET_VISIBLE (image_menu_item->image))
|
||||
{
|
||||
gint x, y, offset;
|
||||
GtkRequisition child_requisition;
|
||||
@ -486,7 +499,6 @@ gtk_image_menu_item_new_from_stock (const gchar *stock_id,
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
|
||||
}
|
||||
|
||||
gtk_widget_show (image);
|
||||
return item;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user