changeset 11787:c9188d3eb9d3

[gaim-migrate @ 14078] GtkMenuTray now set's it's minimum height to the height of GTK_ICON_SIZE_MENU. This removes the need for the blank menu item which ended up leaving an empty space when other items were added. committer: Tailor Script <tailor@pidgin.im>
author Gary Kramlich <grim@reaperworld.com>
date Mon, 24 Oct 2005 03:37:31 +0000
parents 2c8216659a84
children 12d093e3a580
files pixmaps/Makefile.am pixmaps/menu-blank.png src/gtkconv.c src/gtkmenutray.c src/gtkstock.c src/gtkstock.h
diffstat 6 files changed, 36 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/pixmaps/Makefile.am	Mon Oct 24 03:31:44 2005 +0000
+++ b/pixmaps/Makefile.am	Mon Oct 24 03:37:31 2005 +0000
@@ -20,7 +20,6 @@
 		insert-link-small.png		\
 		insert-smiley-small.png		\
 		logo.png			\
-                menu-blank.png			\
 		msgpend.png			\
 		msgunread.png			\
 		offline.png			\
@@ -78,7 +77,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 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
+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
 
 distpixmapdir = $(datadir)/pixmaps
 distpixmap_DATA = gaim.png
Binary file pixmaps/menu-blank.png has changed
--- a/src/gtkconv.c	Mon Oct 24 03:31:44 2005 +0000
+++ b/src/gtkconv.c	Mon Oct 24 03:37:31 2005 +0000
@@ -2514,12 +2514,6 @@
 	                      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;
@@ -2574,24 +2568,27 @@
 	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) {
-		gtk_image_set_from_stock(GTK_IMAGE(gtkwin->menu.typing_icon),
-					 GAIM_STOCK_TYPING,
-					 GTK_ICON_SIZE_MENU);
+		gtkwin->menu.typing_icon =
+			gtk_image_new_from_stock(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) {
-		gtk_image_set_from_stock(GTK_IMAGE(gtkwin->menu.typing_icon),
-					 GAIM_STOCK_TYPED,
-					 GTK_ICON_SIZE_MENU);
+		gtkwin->menu.typing_icon =
+			gtk_image_new_from_stock(GAIM_STOCK_TYPED, GTK_ICON_SIZE_MENU);
 		gtk_tooltips_set_tip(gtkconv->tooltips, gtkwin->menu.typing_icon,
 				_("User has typed something and paused"), NULL);
-	} else {
-		gtk_image_set_from_stock(GTK_IMAGE(gtkwin->menu.typing_icon),
-					 GAIM_STOCK_MENU_ICON_BLANK,
-					 GTK_ICON_SIZE_MENU);
-		gtk_tooltips_set_tip(gtkconv->tooltips, gtkwin->menu.typing_icon,
-				     "", 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);
 	}
 }
 
--- a/src/gtkmenutray.c	Mon Oct 24 03:31:44 2005 +0000
+++ b/src/gtkmenutray.c	Mon Oct 24 03:37:31 2005 +0000
@@ -19,6 +19,9 @@
  */
 #include "gtkmenutray.h"
 
+#include <gtk/gtkiconfactory.h>
+#include <gtk/gtkversion.h>
+
 /******************************************************************************
  * Enums
  *****************************************************************************/
@@ -117,11 +120,28 @@
 
 static void
 gaim_gtk_menu_tray_init(GaimGtkMenuTray *menu_tray) {
+	GtkWidget *widget = GTK_WIDGET(menu_tray);
+	GtkSettings *settings;
+	gint height = -1;
+
 	gtk_menu_item_set_right_justified(GTK_MENU_ITEM(menu_tray), TRUE);
 	
 	if(!GTK_IS_WIDGET(menu_tray->tray))
 		menu_tray->tray = gtk_hbox_new(FALSE, 0);
 
+#if GTK_CHECK_VERSION(2,2,0)
+	settings =
+		gtk_settings_get_for_screen(gtk_widget_get_screen(widget));
+#else
+	settings = gtk_settings_get_default();
+#endif
+
+	if(gtk_icon_size_lookup_for_settings(settings, GTK_ICON_SIZE_MENU,
+										 NULL, &height))
+	{
+		gtk_widget_set_size_request(widget, -1, height);
+	}
+
 	gtk_container_add(GTK_CONTAINER(menu_tray), menu_tray->tray);
 
 	gtk_widget_show(menu_tray->tray);
--- a/src/gtkstock.c	Mon Oct 24 03:31:44 2005 +0000
+++ b/src/gtkstock.c	Mon Oct 24 03:37:31 2005 +0000
@@ -80,7 +80,6 @@
 	{ 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 24 03:31:44 2005 +0000
+++ b/src/gtkstock.h	Mon Oct 24 03:37:31 2005 +0000
@@ -62,7 +62,6 @@
 #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"