]> www.fi.muni.cz Git - evince.git/commitdiff
Open links in new window when clicking with middle button.
authorCarlos Garcia Campos <carlosgc@gnome.org>
Sun, 28 Jan 2007 16:43:22 +0000 (16:43 +0000)
committerCarlos Garcia Campos <carlosgc@src.gnome.org>
Sun, 28 Jan 2007 16:43:22 +0000 (16:43 +0000)
2007-01-28  Carlos Garcia Campos  <carlosgc@gnome.org>
* shell/ev-window.c: (view_external_link_cb):
* shell/ev-view.c: (ev_view_button_release_event):
Open links in new window when clicking with middle button.

svn path=/trunk/; revision=2263

ChangeLog
shell/ev-view.c
shell/ev-window.c

index 151262c98e878421ceb11740fb19cfd827996f4c..9c4d6b473f4bfdc90bdc601099bdd3fcd01ac096 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2007-01-28  Carlos Garcia Campos  <carlosgc@gnome.org>
+
+       * shell/ev-window.c: (view_external_link_cb):
+       * shell/ev-view.c: (ev_view_button_release_event):
+
+       Open links in new window when clicking with middle button. 
+
 2007-01-28  Nickolay V. Shmyrev  <nshmyrev@yandex.ru>
 
        * shell/ev-navigation-action.c: (new_history_menu_item):
index 7275fb643b37bdf323ebaf26065b00cd8312aba9..b722785ea4027d370a599169b21ec4e0ebe1f3d8 100644 (file)
@@ -2314,7 +2314,7 @@ ev_view_button_release_event (GtkWidget      *widget,
                ev_view_set_cursor (view, EV_VIEW_CURSOR_NORMAL);
        }
 
-       if (view->document && view->pressed_button == 1) {
+       if (view->document && view->pressed_button != 3) {
                link = ev_view_get_link_at_location (view, event->x, event->y);
        } else {
                link = NULL;
@@ -2343,7 +2343,23 @@ ev_view_button_release_event (GtkWidget      *widget,
                
                view->selection_info.in_drag = FALSE;
        } else if (link) {
-               ev_view_handle_link (view, link);
+               if (event->button == 2) {
+                       EvLinkAction    *action;
+                       EvLinkActionType type;
+
+                       action = ev_link_get_action (link);
+                       if (!action)
+                               return FALSE;
+
+                       type = ev_link_action_get_action_type (action);
+                       if (type == EV_LINK_ACTION_TYPE_GOTO_DEST) {
+                               g_signal_emit (view,
+                                              signals[SIGNAL_EXTERNAL_LINK],
+                                              0, action);
+                       }
+               } else {
+                       ev_view_handle_link (view, link);
+               }
        } else if (view->presentation) {
                switch (event->button) {
                        case 1:
index 1d36a12b911158e6de38a8dacf8d77a10c58ae00..8e414a57e46a77bf77f3427a34e485da1e4fadfd 100644 (file)
@@ -4350,6 +4350,16 @@ static void
 view_external_link_cb (EvView *view, EvLinkAction *action, EvWindow *window)
 {
        switch (ev_link_action_get_action_type (action)) {
+               case EV_LINK_ACTION_TYPE_GOTO_DEST: {
+                       EvLinkDest *dest;
+                       
+                       dest = ev_link_action_get_dest (action);
+                       if (!dest)
+                               return;
+
+                       ev_window_cmd_file_open_copy_at_dest (window, dest);
+               }
+                       break;
                case EV_LINK_ACTION_TYPE_EXTERNAL_URI:
                        launch_external_uri (window, action);
                        break;