gtranslator r3689 - trunk/src



Author: icq
Date: Mon Sep 22 09:43:06 2008
New Revision: 3689
URL: http://svn.gnome.org/viewvc/gtranslator?rev=3689&view=rev

Log:
Squashed commit of the following:

commit 3332d2c1e3f7148a65d1b81b24a2232e239a92b7
Author: Ignacio Casal Quinteiro <nacho resa gmail com>
Date:   Tue Aug 12 15:01:22 2008 +0200

    2008-08-12  Ignacio Casal Quinteiro  <nacho resa gmail com>

    	* window.c (menu_item_select_cb), (menu_item_deselect_cb),
    	(connect_proxy_cb), (disconnect_proxy_cb),
    	(gtranslator_window_draw):
    	Now the menuitem tooltips are showed in the statusbar.

Modified:
   trunk/src/ChangeLog
   trunk/src/window.c

Modified: trunk/src/window.c
==============================================================================
--- trunk/src/window.c	(original)
+++ trunk/src/window.c	Mon Sep 22 09:43:06 2008
@@ -1173,6 +1173,63 @@
 }
 
 static void
+menu_item_select_cb (GtkMenuItem *proxy,
+		     GtranslatorWindow *window)
+{
+	GtkAction *action;
+	char *message;
+
+	action = g_object_get_data (G_OBJECT (proxy),  "gtk-action");
+	g_return_if_fail (action != NULL);
+
+	g_object_get (G_OBJECT (action), "tooltip", &message, NULL);
+	if (message)
+	{
+		gtranslator_statusbar_push_default (GTR_STATUSBAR (window->priv->statusbar),
+						    message);
+		g_free (message);
+	}
+}
+
+static void
+menu_item_deselect_cb (GtkMenuItem *proxy,
+                       GtranslatorWindow *window)
+{
+	gtranslator_statusbar_pop_default (GTR_STATUSBAR (window->priv->statusbar));
+}
+
+static void
+connect_proxy_cb (GtkUIManager *manager,
+                  GtkAction *action,
+                  GtkWidget *proxy,
+                  GtranslatorWindow *window)
+{
+	if (GTK_IS_MENU_ITEM (proxy))
+	{
+		g_signal_connect (proxy, "select",
+				  G_CALLBACK (menu_item_select_cb), window);
+		g_signal_connect (proxy, "deselect",
+				  G_CALLBACK (menu_item_deselect_cb), window);
+	}
+}
+
+static void
+disconnect_proxy_cb (GtkUIManager *manager,
+                     GtkAction *action,
+                     GtkWidget *proxy,
+                     GtranslatorWindow *window)
+{
+	if (GTK_IS_MENU_ITEM (proxy))
+	{
+		g_signal_handlers_disconnect_by_func
+			(proxy, G_CALLBACK (menu_item_select_cb), window);
+		g_signal_handlers_disconnect_by_func
+			(proxy, G_CALLBACK (menu_item_deselect_cb), window);
+	}
+}
+
+
+static void
 side_pane_visibility_changed (GtkWidget		*side_pane,
 			      GtranslatorWindow *window)
 {
@@ -1243,6 +1300,16 @@
 		g_error_free (error);
 	}
 	
+	/* show tooltips in the statusbar */
+	g_signal_connect (priv->ui_manager,
+			  "connect_proxy",
+			  G_CALLBACK (connect_proxy_cb),
+			  window);
+	g_signal_connect (priv->ui_manager,
+			  "disconnect_proxy",
+			  G_CALLBACK (disconnect_proxy_cb),
+			  window);
+	
 	priv->menubar =	 gtk_ui_manager_get_widget (priv->ui_manager,
 							   "/MainMenu");
 	gtk_box_pack_start (GTK_BOX (priv->main_box),



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]