]> www.fi.muni.cz Git - evince.git/commitdiff
Correctly show menu and fix crash when navigaton action is out of toolbar
authorNickolay V. Shmyrev <nshmyrev@yandex.ru>
Tue, 30 Jan 2007 18:55:12 +0000 (18:55 +0000)
committerNickolay V. Shmyrev <nshmyrev@src.gnome.org>
Tue, 30 Jan 2007 18:55:12 +0000 (18:55 +0000)
2007-01-30  Nickolay V. Shmyrev  <nshmyrev@yandex.ru>

* shell/ev-navigation-action.c: (connect_proxy),
(create_menu_item), (ev_navigation_action_class_init):

Correctly show menu and fix crash when navigaton
action is out of toolbar visible area.

svn path=/trunk/; revision=2278

ChangeLog
shell/ev-navigation-action.c

index 3a68a035ffcf59847c6a69d8a2eb2bc912b4b497..770568bc60d0842bfcdba4b476cd57a55968bb08 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2007-01-30  Nickolay V. Shmyrev  <nshmyrev@yandex.ru>
+
+       * shell/ev-navigation-action.c: (connect_proxy),
+       (create_menu_item), (ev_navigation_action_class_init):
+       
+       Correctly show menu and fix crash when navigaton 
+       action is out of toolbar visible area.
+
 2007-01-30  Nickolay V. Shmyrev  <nshmyrev@yandex.ru>
 
        * data/Makefile.am:
index c87940a64236a5477bf8c35c5fd7d37d4b581a26..c4f6191773e10d59ba2ac46cf3a335a1afbabc82 100644 (file)
@@ -166,12 +166,14 @@ connect_proxy (GtkAction *action, GtkWidget *proxy)
 {
        GtkWidget *menu;
 
-       /* set dummy menu so the arrow gets sensitive */
-       menu = gtk_menu_new ();
-       ev_navigation_action_widget_set_menu (EV_NAVIGATION_ACTION_WIDGET (proxy), menu);
+       if (EV_IS_NAVIGATION_ACTION (proxy)) {
+               /* set dummy menu so the arrow gets sensitive */
+               menu = gtk_menu_new ();
+               ev_navigation_action_widget_set_menu (EV_NAVIGATION_ACTION_WIDGET (proxy), menu);
 
-       g_signal_connect (proxy, "show-menu",
-                         G_CALLBACK (menu_activated_cb), action);
+               g_signal_connect (proxy, "show-menu",
+                                 G_CALLBACK (menu_activated_cb), action);
+       }
 
        GTK_ACTION_CLASS (ev_navigation_action_parent_class)->connect_proxy (action, proxy);
 }
@@ -187,6 +189,23 @@ create_tool_item (GtkAction *action)
        return GTK_WIDGET (proxy);
 }
 
+static GtkWidget *
+create_menu_item (GtkAction *action)
+{
+       GtkWidget *menu;
+       GtkWidget *menu_item;
+
+       menu = build_menu (EV_NAVIGATION_ACTION (action));
+
+        menu_item = GTK_ACTION_CLASS (ev_navigation_action_parent_class)->create_menu_item (action);
+
+       gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu_item), menu);
+
+       gtk_widget_show (menu_item);
+       
+       return menu_item;
+}
+
 static void
 ev_navigation_action_init (EvNavigationAction *action)
 {
@@ -217,6 +236,7 @@ ev_navigation_action_class_init (EvNavigationActionClass *class)
        action_class->toolbar_item_type = GTK_TYPE_TOOL_ITEM;
        action_class->create_tool_item = create_tool_item;
        action_class->connect_proxy = connect_proxy;
+       action_class->create_menu_item = create_menu_item;
 
        widget_signals[WIDGET_ACTIVATE_LINK] = g_signal_new ("activate_link",
                                               G_OBJECT_CLASS_TYPE (object_class),