Mercurial > pidgin
changeset 15774:f3ebd1c17c7b
change icon on resize
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Tue, 06 Mar 2007 00:06:58 +0000 |
parents | 037c51958cc6 |
children | b5c4de70577d |
files | pidgin/gtkdocklet-x11.c |
diffstat | 1 files changed, 15 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/pidgin/gtkdocklet-x11.c Mon Mar 05 21:39:55 2007 +0000 +++ b/pidgin/gtkdocklet-x11.c Tue Mar 06 00:06:58 2007 +0000 @@ -40,6 +40,8 @@ static GtkTooltips *tooltips = NULL; static GdkPixbuf *blank_icon = NULL; static int embed_timeout = 0; +static DockletStatus icon_status = 0; +static int docklet_height = 0; /* protos */ static void docklet_x11_create(void); @@ -117,13 +119,23 @@ if(icon_name) { int icon_size; - GtkAllocation alloc = GTK_WIDGET(docklet)->allocation; - if (alloc.height < 22) + if (docklet_height < 22) icon_size = gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL); else icon_size = gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_SMALL); + gtk_image_set_from_stock(GTK_IMAGE(image), icon_name, icon_size); } + icon_status = icon; +} + +static void +docklet_x11_resize_icon(GtkWidget *widget) +{ + if (docklet_height == widget->allocation.height) + return; + docklet_height = widget->allocation.height; + docklet_x11_update_icon(icon_status); } static void @@ -241,8 +253,8 @@ g_signal_connect(G_OBJECT(docklet), "embedded", G_CALLBACK(docklet_x11_embedded_cb), NULL); g_signal_connect(G_OBJECT(docklet), "destroy", G_CALLBACK(docklet_x11_destroyed_cb), NULL); + g_signal_connect(G_OBJECT(docklet), "size-allocate", G_CALLBACK(docklet_x11_resize_icon), NULL); g_signal_connect(G_OBJECT(box), "button-release-event", G_CALLBACK(docklet_x11_clicked_cb), NULL); - gtk_container_add(GTK_CONTAINER(box), image); gtk_container_add(GTK_CONTAINER(docklet), box);