changeset 11686:0914f135760a

[gaim-migrate @ 13972] This fixes the dancing conversation dialog when the typing icon appears and disappears with a relatively small system font. Additionally, it does less widget creation and destruction by creating a persistent GtkImage widget in the menubar which is merely painted with the appropriate stock icon. The most straightforward way I saw to solve this was add a "blank" menu icon to the stock icon system. committer: Tailor Script <tailor@pidgin.im>
author Ethan Blanton <elb@pidgin.im>
date Mon, 17 Oct 2005 20:48:46 +0000
parents d309a383ebf7
children 941aa045f9f6
files pixmaps/Makefile.am pixmaps/menu-blank.png src/gtkconv.c src/gtkstock.c src/gtkstock.h
diffstat 5 files changed, 19 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/pixmaps/Makefile.am	Mon Oct 17 20:33:35 2005 +0000
+++ b/pixmaps/Makefile.am	Mon Oct 17 20:48:46 2005 +0000
@@ -20,6 +20,7 @@
 		insert-link-small.png		\
 		insert-smiley-small.png		\
 		logo.png			\
+                menu-blank.png			\
 		msgpend.png			\
 		msgunread.png			\
 		offline.png			\
@@ -77,7 +78,7 @@
 gaimiconpix_DATA = away.png connect.png msgpend.png offline.png online.png msgunread.png info.png
 
 gaimdistpixdir = $(datadir)/pixmaps/gaim
-gaimdistpix_DATA = logo.png tb_drag_arrow_down.xpm tb_drag_arrow_left.xpm tb_drag_arrow_right.xpm tb_drag_arrow_up.xpm typed.png typing.png status-online.png status-offline.png status-away.png status-invisible.png status-typing0.png status-typing1.png status-typing2.png status-typing3.png status-connect0.png status-connect1.png status-connect2.png status-connect3.png
+gaimdistpix_DATA = logo.png menu-blank.png tb_drag_arrow_down.xpm tb_drag_arrow_left.xpm tb_drag_arrow_right.xpm tb_drag_arrow_up.xpm typed.png typing.png status-online.png status-offline.png status-away.png status-invisible.png status-typing0.png status-typing1.png status-typing2.png status-typing3.png status-connect0.png status-connect1.png status-connect2.png status-connect3.png
 
 distpixmapdir = $(datadir)/pixmaps
 distpixmap_DATA = gaim.png
Binary file pixmaps/menu-blank.png has changed
--- a/src/gtkconv.c	Mon Oct 17 20:33:35 2005 +0000
+++ b/src/gtkconv.c	Mon Oct 17 20:48:46 2005 +0000
@@ -2510,6 +2510,12 @@
 	                      win->menu.tray);
 	gtk_widget_show(win->menu.tray);
 
+	win->menu.typing_icon = gtk_image_new_from_stock(GAIM_STOCK_MENU_ICON_BLANK,
+							 GTK_ICON_SIZE_MENU);
+	gtk_widget_show(win->menu.typing_icon);
+	gaim_gtk_menu_tray_append(GAIM_GTK_MENU_TRAY(win->menu.tray),
+				  win->menu.typing_icon);
+
 	gtk_widget_show(win->menu.menubar);
 
 	return win->menu.menubar;
@@ -2564,26 +2570,21 @@
 	if(gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM)
 		im = GAIM_CONV_IM(conv);
 
-	if(gtkwin->menu.typing_icon) {
-		gtk_widget_destroy(gtkwin->menu.typing_icon);
-		gtkwin->menu.typing_icon = NULL;
-	}
 	if(im && gaim_conv_im_get_typing_state(im) == GAIM_TYPING) {
-		gtkwin->menu.typing_icon = gtk_image_new_from_stock(GAIM_STOCK_TYPING,
-															GTK_ICON_SIZE_MENU);
+		gtk_image_set_from_stock(gtkwin->menu.typing_icon, GAIM_STOCK_TYPING,
+					 GTK_ICON_SIZE_MENU);
 		gtk_tooltips_set_tip(gtkconv->tooltips, gtkwin->menu.typing_icon,
 				_("User is typing..."), NULL);
 	} else if(im && gaim_conv_im_get_typing_state(im) == GAIM_TYPED) {
-		gtkwin->menu.typing_icon = gtk_image_new_from_stock(GAIM_STOCK_TYPED,
-															GTK_ICON_SIZE_MENU);
+		gtk_image_set_from_stock(gtkwin->menu.typing_icon, GAIM_STOCK_TYPED,
+					 GTK_ICON_SIZE_MENU);
 		gtk_tooltips_set_tip(gtkconv->tooltips, gtkwin->menu.typing_icon,
 				_("User has typed something and paused"), NULL);
-	}
-
-	if(gtkwin->menu.typing_icon) {
-		gtk_widget_show(gtkwin->menu.typing_icon);
-		gaim_gtk_menu_tray_append(GAIM_GTK_MENU_TRAY(gtkwin->menu.tray),
-								  gtkwin->menu.typing_icon);
+	} else {
+		gtk_image_set_from_stock(gtkwin->menu.typing_icon, GAIM_STOCK_MENU_ICON_BLANK,
+					 GTK_ICON_SIZE_MENU);
+		gtk_tooltips_set_tip(gtkconv->tooltips, gtkwin->menu.typing_icon,
+				     "", NULL);
 	}
 }
 
--- a/src/gtkstock.c	Mon Oct 17 20:33:35 2005 +0000
+++ b/src/gtkstock.c	Mon Oct 17 20:48:46 2005 +0000
@@ -80,6 +80,7 @@
 	{ GAIM_STOCK_INVITE,          NULL,      GTK_STOCK_JUMP_TO          },
 	{ GAIM_STOCK_LINK,            "buttons", "insert-link-small.png"    },
 	{ GAIM_STOCK_LOGO,            "gaim",    "logo.png"                 },
+	{ GAIM_STOCK_MENU_ICON_BLANK, "gaim",    "menu-blank.png"           },
 	{ GAIM_STOCK_MODIFY,          NULL,      GTK_STOCK_PREFERENCES      },
 #if GTK_CHECK_VERSION(2,6,0)
 	{ GAIM_STOCK_PAUSE,           NULL,      GTK_STOCK_MEDIA_PAUSE      },
--- a/src/gtkstock.h	Mon Oct 17 20:33:35 2005 +0000
+++ b/src/gtkstock.h	Mon Oct 17 20:48:46 2005 +0000
@@ -62,6 +62,7 @@
 #define GAIM_STOCK_INVITE          "gaim-invite"
 #define GAIM_STOCK_LINK            "gaim-link"
 #define GAIM_STOCK_LOGO            "gaim-logo"
+#define GAIM_STOCK_MENU_ICON_BLANK "gaim-menu-icon-blank"
 #define GAIM_STOCK_MODIFY          "gaim-modify"
 #define GAIM_STOCK_OPEN_MAIL       "gaim-stock-open-mail"
 #define GAIM_STOCK_PAUSE           "gaim-pause"