]> www.fi.muni.cz Git - evince.git/commitdiff
Update context menu for internal links. Fix for the bug #325066
authorNickolay V. Shmyrev <nshmyrev@src.gnome.org>
Tue, 27 Dec 2005 23:21:06 +0000 (23:21 +0000)
committerNickolay V. Shmyrev <nshmyrev@src.gnome.org>
Tue, 27 Dec 2005 23:21:06 +0000 (23:21 +0000)
ChangeLog
data/evince-ui.xml
shell/ev-window.c

index 1adab92c98ffc1ea7aac173c8a6008bea6c4c7ea..44f695d141d64c52c85b6cbd4478b262b1ecaa79 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2005-12-28  Nickolay V. Shmyrev  <nshmyrev@yandex.ru>
+
+       * data/evince-ui.xml:
+       * shell/ev-window.c: (view_menu_popup_cb),
+       (ev_popup_cmd_open_link), (ev_window_init):
+       
+       Update context menu for internal links. Fix for the bug
+       #325066.
+
 2005-12-28  Nickolay V. Shmyrev  <nshmyrev@yandex.ru>
 
        * shell/ev-view.c: (ev_view_popup_menu), (ev_view_class_init):
index ae293678360f1fe778ce4f1354f8cf81e66daeaf..768b8f82caba4f84fc59268ea5a9521996c4f080 100644 (file)
   </menubar>
 
   <popup name="DocumentPopup" action="PopupAction">
+    <menuitem name="OpenLink" action="OpenLink"/>
+    <menuitem name="CopyLinkAddress" action="CopyLinkAddress"/>
+    <menuitem name="GoLink" action="GoLink"/>
+    <separator/>
     <menuitem name="GoPreviousPage" action="GoPreviousPage"/>
     <menuitem name="GoNextPage" action="GoNextPage"/>
     <menuitem name="ViewReload" action="ViewReload"/>
     <menuitem name="EditSelectAllPopup" action="EditSelectAll"/>
   </popup>
 
-  <popup name="ExternalLinkPopup" action="PopupAction">
-    <menuitem name="OpenLink" action="OpenLink"/>
-    <menuitem name="CopyLinkAddress" action="CopyLinkAddress"/>
-  </popup>
-
   <accelerator name="PageDownAccel" action="PageDown"/>
   <accelerator name="PageUpAccel" action="PageUp"/>
   <accelerator name="GoBackwardFastAccel" action="GoBackwardFast"/>
index 74915613e46eb8eb341976b49ba21546b595bde2..8d3601b5f6c7678495037a0ec2a87a1380ea7614 100644 (file)
@@ -124,7 +124,6 @@ struct _EvWindowPrivate {
        
        /* Popup link */
        GtkWidget *popup;
-       GtkWidget *link_popup;
        EvLink    *link;
 
        /* Document */
@@ -2623,6 +2622,9 @@ view_menu_popup_cb (EvView         *view,
                    EvWindow       *ev_window)
 {
        GtkWidget *popup;
+       gboolean   show_external = FALSE;
+       gboolean   show_internal = FALSE;
+       GtkAction *action;
        
        if (ev_window->priv->link)
                g_object_unref (ev_window->priv->link);
@@ -2631,12 +2633,37 @@ view_menu_popup_cb (EvView         *view,
        else    
                ev_window->priv->link = NULL;
 
-       if (ev_window->priv->link &&
-                (ev_link_get_link_type (ev_window->priv->link) == EV_LINK_TYPE_EXTERNAL_URI)) {
-               popup = ev_window->priv->link_popup;
-       } else {
-               popup = ev_window->priv->popup;
-       }
+       popup = ev_window->priv->popup;
+
+       if (ev_window->priv->link) 
+               switch (ev_link_get_link_type (ev_window->priv->link)) {
+                       case EV_LINK_TYPE_PAGE:
+                       case EV_LINK_TYPE_PAGE_FIT:
+                       case EV_LINK_TYPE_PAGE_FITH:
+                       case EV_LINK_TYPE_PAGE_FITV:
+                       case EV_LINK_TYPE_PAGE_FITR:
+                       case EV_LINK_TYPE_PAGE_XYZ:
+                               show_internal = TRUE;
+                               break;
+                       case EV_LINK_TYPE_EXTERNAL_URI:
+                       case EV_LINK_TYPE_LAUNCH:       
+                               show_external = TRUE;
+                               break;
+                       default:
+                               break;
+               }
+       
+       action = gtk_action_group_get_action (ev_window->priv->popups_action_group,
+                                             "OpenLink");
+       gtk_action_set_visible (action, show_external);
+
+       action = gtk_action_group_get_action (ev_window->priv->popups_action_group,
+                                             "CopyLinkAddress");
+       gtk_action_set_visible (action, show_external);
+
+       action = gtk_action_group_get_action (ev_window->priv->popups_action_group,
+                                             "GoLink");
+       gtk_action_set_visible (action, show_internal);
 
        gtk_menu_popup (GTK_MENU (popup), NULL, NULL,
                        NULL, NULL,
@@ -3035,6 +3062,8 @@ static const GtkActionEntry popups_entries [] = {
        /* Links */
        { "OpenLink", GTK_STOCK_OPEN, N_("_Open Link"), NULL,
          NULL, G_CALLBACK (ev_popup_cmd_open_link) },
+       { "GoLink", GTK_STOCK_GO_FORWARD, N_("_Go To"), NULL,
+         NULL, G_CALLBACK (ev_popup_cmd_open_link) },
        { "CopyLinkAddress", NULL, N_("_Copy Link Address"), NULL,
          NULL,
          G_CALLBACK (ev_popup_cmd_copy_link_address) },
@@ -3360,7 +3389,7 @@ view_external_link_cb (EvView *view, EvLink *link, EvWindow *window)
 static void
 ev_popup_cmd_open_link (GtkAction *action, EvWindow *window)
 {
-       launch_external_uri (window, window->priv->link);
+       ev_view_goto_link (EV_VIEW (window->priv->view), window->priv->link);
 }
 
 static void
@@ -3613,8 +3642,6 @@ ev_window_init (EvWindow *ev_window)
                          ev_window);
 
        /* Popups */
-       ev_window->priv->link_popup = gtk_ui_manager_get_widget (ev_window->priv->ui_manager,
-                                                               "/ExternalLinkPopup");
        ev_window->priv->popup = gtk_ui_manager_get_widget (ev_window->priv->ui_manager,
                                                           "/DocumentPopup");
        ev_window->priv->link = NULL;