diff options
author | Crispin Flowerday <gnome@flowerday.cx> | 2004-05-22 18:46:37 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2004-05-22 18:46:37 +0800 |
commit | 2f3549b038f5dfab747c4aa104d2135fb1ae7f96 (patch) | |
tree | 2662da8d40ebe38eb0ac6e6ede2ec0615363c6bb /lib | |
parent | 3295e6a3df41e3e94d01c4c62f597b9bf6a2f213 (diff) | |
download | gsoc2013-epiphany-2f3549b038f5dfab747c4aa104d2135fb1ae7f96.tar gsoc2013-epiphany-2f3549b038f5dfab747c4aa104d2135fb1ae7f96.tar.gz gsoc2013-epiphany-2f3549b038f5dfab747c4aa104d2135fb1ae7f96.tar.bz2 gsoc2013-epiphany-2f3549b038f5dfab747c4aa104d2135fb1ae7f96.tar.lz gsoc2013-epiphany-2f3549b038f5dfab747c4aa104d2135fb1ae7f96.tar.xz gsoc2013-epiphany-2f3549b038f5dfab747c4aa104d2135fb1ae7f96.tar.zst gsoc2013-epiphany-2f3549b038f5dfab747c4aa104d2135fb1ae7f96.zip |
Set the drag icon on realize, otherwise the current icon theme isn't used,
2004-05-22 Crispin Flowerday <gnome@flowerday.cx>
* libegg/toolbareditor/egg-toolbar-editor.c
(event_box_realize_cb), (editor_create_item):
Set the drag icon on
realize, otherwise the current icon theme isn't used, and it falls
back to the default theme.
Diffstat (limited to 'lib')
-rwxr-xr-x | lib/egg/egg-toolbar-editor.c | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/lib/egg/egg-toolbar-editor.c b/lib/egg/egg-toolbar-editor.c index 93b0a7928..031bb118a 100755 --- a/lib/egg/egg-toolbar-editor.c +++ b/lib/egg/egg-toolbar-editor.c @@ -419,9 +419,28 @@ set_drag_cursor (GtkWidget *widget) } static void -event_box_realize_cb (GtkWidget *widget) +event_box_realize_cb (GtkWidget *widget, GtkImage *icon) { - set_drag_cursor (widget); + GtkImageType type; + + set_drag_cursor (widget); + + type = gtk_image_get_storage_type (icon); + if (type == GTK_IMAGE_STOCK) + { + 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); + gtk_drag_source_set_icon_pixbuf (widget, pixbuf); + g_object_unref (pixbuf); + } + else if (type == GTK_IMAGE_PIXBUF) + { + GdkPixbuf *pixbuf = gtk_image_get_pixbuf (icon); + gtk_drag_source_set_icon_pixbuf (widget, pixbuf); + } } static GtkWidget * @@ -434,7 +453,6 @@ editor_create_item (EggToolbarEditor *editor, GtkWidget *vbox; GtkWidget *label; gchar *label_no_mnemonic = NULL; - GtkImageType type; event_box = gtk_event_box_new (); gtk_event_box_set_visible_window (GTK_EVENT_BOX (event_box), FALSE); @@ -447,7 +465,7 @@ editor_create_item (EggToolbarEditor *editor, g_signal_connect (event_box, "drag_data_delete", G_CALLBACK (editor_drag_data_delete_cb), editor); g_signal_connect_after (event_box, "realize", - G_CALLBACK (event_box_realize_cb), NULL); + G_CALLBACK (event_box_realize_cb), icon); if (action == GDK_ACTION_MOVE) { @@ -457,23 +475,6 @@ editor_create_item (EggToolbarEditor *editor, G_CALLBACK (drag_end_cb), NULL); } - type = gtk_image_get_storage_type (icon); - if (type == GTK_IMAGE_STOCK) - { - gchar *stock_id; - GdkPixbuf *pixbuf; - gtk_image_get_stock (icon, &stock_id, NULL); - pixbuf = gtk_widget_render_icon (event_box, stock_id, - GTK_ICON_SIZE_LARGE_TOOLBAR, NULL); - gtk_drag_source_set_icon_pixbuf (event_box, pixbuf); - g_object_unref (pixbuf); - } - else if (type == GTK_IMAGE_PIXBUF) - { - GdkPixbuf *pixbuf = gtk_image_get_pixbuf (icon); - gtk_drag_source_set_icon_pixbuf (event_box, pixbuf); - } - vbox = gtk_vbox_new (0, FALSE); gtk_widget_show (vbox); gtk_container_add (GTK_CONTAINER (event_box), vbox); |