From 07d195c96103ab490f97f5bf914c9f6e6a748612 Mon Sep 17 00:00:00 2001 From: Felix Riemann Date: Mon, 25 Jun 2007 14:41:06 +0000 Subject: Make named drag-icons toolbar-sized like the others. Part of bug #450590. 2007-06-25 Felix Riemann * lib/egg/egg-toolbar-editor.c: (event_box_realize_cb): Make named drag-icons toolbar-sized like the others. Part of bug #450590. svn path=/trunk/; revision=7096 --- ChangeLog | 6 ++++++ lib/egg/egg-toolbar-editor.c | 26 +++++++++++++++++++++++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 35a3975db..610a84dfa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2007-06-25 Felix Riemann + + * lib/egg/egg-toolbar-editor.c: (event_box_realize_cb): + Make named drag-icons toolbar-sized like the others. + Part of bug #450590. + 2007-06-24 Felix Riemann * lib/egg/egg-toolbar-editor.c: (editor_create_item_from_name): diff --git a/lib/egg/egg-toolbar-editor.c b/lib/egg/egg-toolbar-editor.c index b08a97b26..5660408a2 100644 --- a/lib/egg/egg-toolbar-editor.c +++ b/lib/egg/egg-toolbar-editor.c @@ -362,6 +362,7 @@ event_box_realize_cb (GtkWidget *widget, GtkImage *icon) { gchar *stock_id; GdkPixbuf *pixbuf; + gtk_image_get_stock (icon, &stock_id, NULL); pixbuf = gtk_widget_render_icon (widget, stock_id, GTK_ICON_SIZE_LARGE_TOOLBAR, NULL); @@ -371,9 +372,32 @@ event_box_realize_cb (GtkWidget *widget, GtkImage *icon) else if (type == GTK_IMAGE_ICON_NAME) { const gchar *icon_name; + GdkScreen *screen; + GtkIconTheme *icon_theme; + GtkSettings *settings; + gint width, height; + GdkPixbuf *pixbuf; gtk_image_get_icon_name (icon, &icon_name, NULL); - gtk_drag_source_set_icon_name (widget, icon_name); + screen = gtk_widget_get_screen (widget); + icon_theme = gtk_icon_theme_get_for_screen (screen); + settings = gtk_settings_get_for_screen (screen); + + if (!gtk_icon_size_lookup_for_settings (settings, + GTK_ICON_SIZE_LARGE_TOOLBAR, + &width, &height)) + { + width = height = 24; + } + + pixbuf = gtk_icon_theme_load_icon (icon_theme, icon_name, + MIN (width, height), 0, NULL); + if (G_UNLIKELY (!pixbuf)) + return; + + gtk_drag_source_set_icon_pixbuf (widget, pixbuf); + g_object_unref (pixbuf); + } else if (type == GTK_IMAGE_PIXBUF) { -- cgit v1.2.3