summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libview/ev-view-presentation.c44
-rw-r--r--shell/ev-window.c15
2 files changed, 47 insertions, 12 deletions
diff --git a/libview/ev-view-presentation.c b/libview/ev-view-presentation.c
index 0309d5e9..f30ef806 100644
--- a/libview/ev-view-presentation.c
+++ b/libview/ev-view-presentation.c
@@ -46,6 +46,7 @@ enum {
enum {
CHANGE_PAGE,
FINISHED,
+ SIGNAL_EXTERNAL_LINK,
N_SIGNALS
};
@@ -98,9 +99,11 @@ struct _EvViewPresentationClass
GtkWidgetClass base_class;
/* signals */
- void (* change_page) (EvViewPresentation *pview,
- GtkScrollType scroll);
- void (* finished) (EvViewPresentation *pview);
+ void (* change_page) (EvViewPresentation *pview,
+ GtkScrollType scroll);
+ void (* finished) (EvViewPresentation *pview);
+ void (* external_link) (EvViewPresentation *pview,
+ EvLinkAction *action);
};
static guint signals[N_SIGNALS] = { 0 };
@@ -739,6 +742,9 @@ ev_view_presentation_link_is_supported (EvViewPresentation *pview,
case EV_LINK_ACTION_TYPE_GOTO_DEST:
return ev_link_action_get_dest (action) != NULL;
case EV_LINK_ACTION_TYPE_NAMED:
+ case EV_LINK_ACTION_TYPE_GOTO_REMOTE:
+ case EV_LINK_ACTION_TYPE_EXTERNAL_URI:
+ case EV_LINK_ACTION_TYPE_LAUNCH:
return TRUE;
default:
return FALSE;
@@ -797,14 +803,15 @@ ev_view_presentation_get_link_at_location (EvViewPresentation *pview,
}
static void
-ev_vew_presentation_goto_link_dest (EvViewPresentation *pview,
- EvLink *link)
+ev_vew_presentation_handle_link (EvViewPresentation *pview,
+ EvLink *link)
{
EvLinkAction *action;
action = ev_link_get_action (link);
- if (ev_link_action_get_action_type (action) == EV_LINK_ACTION_TYPE_NAMED) {
+ switch (ev_link_action_get_action_type (action)) {
+ case EV_LINK_ACTION_TYPE_NAMED: {
const gchar *name = ev_link_action_get_name (action);
if (g_ascii_strcasecmp (name, "FirstPage") == 0) {
@@ -819,7 +826,10 @@ ev_vew_presentation_goto_link_dest (EvViewPresentation *pview,
n_pages = ev_document_get_n_pages (pview->document);
ev_view_presentation_update_current_page (pview, n_pages - 1);
}
- } else {
+ }
+ break;
+
+ case EV_LINK_ACTION_TYPE_GOTO_DEST: {
EvLinkDest *dest;
gint page;
@@ -827,6 +837,15 @@ ev_vew_presentation_goto_link_dest (EvViewPresentation *pview,
page = ev_document_links_get_dest_page (EV_DOCUMENT_LINKS (pview->document), dest);
ev_view_presentation_update_current_page (pview, page);
}
+ break;
+ case EV_LINK_ACTION_TYPE_GOTO_REMOTE:
+ case EV_LINK_ACTION_TYPE_EXTERNAL_URI:
+ case EV_LINK_ACTION_TYPE_LAUNCH:
+ g_signal_emit (pview, signals[SIGNAL_EXTERNAL_LINK], 0, action);
+ break;
+ default:
+ break;
+ }
}
/* Cursors */
@@ -1224,7 +1243,7 @@ ev_view_presentation_button_release_event (GtkWidget *widget,
event->x,
event->y);
if (link)
- ev_vew_presentation_goto_link_dest (pview, link);
+ ev_vew_presentation_handle_link (pview, link);
else
ev_view_presentation_next_page (pview);
}
@@ -1528,6 +1547,15 @@ ev_view_presentation_class_init (EvViewPresentationClass *klass)
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0,
G_TYPE_NONE);
+ signals[SIGNAL_EXTERNAL_LINK] =
+ g_signal_new ("external-link",
+ G_TYPE_FROM_CLASS (gobject_class),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (EvViewPresentationClass, external_link),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__OBJECT,
+ G_TYPE_NONE, 1,
+ G_TYPE_OBJECT);
binding_set = gtk_binding_set_by_class (klass);
add_change_page_binding_keypad (binding_set, GDK_Left, 0, GTK_SCROLL_PAGE_BACKWARD);
diff --git a/shell/ev-window.c b/shell/ev-window.c
index 58985c03..111cf5a9 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -343,6 +343,9 @@ static void ev_window_cmd_edit_find (GtkAction *actio
static void find_bar_search_changed_cb (EggFindBar *find_bar,
GParamSpec *param,
EvWindow *ev_window);
+static void view_external_link_cb (EvWindow *window,
+ EvLinkAction *action);
+
static void ev_window_load_file_remote (EvWindow *ev_window,
GFile *source_file);
static void ev_window_media_player_key_pressed (EvWindow *window,
@@ -4059,6 +4062,10 @@ ev_window_run_presentation (EvWindow *window)
G_CALLBACK (ev_window_view_presentation_finished),
window);
+ g_signal_connect_swapped (window->priv->presentation_view, "external-link",
+ G_CALLBACK (view_external_link_cb),
+ window);
+
gtk_box_pack_start (GTK_BOX (window->priv->main_box),
window->priv->presentation_view,
TRUE, TRUE, 0);
@@ -6394,7 +6401,7 @@ do_action_named (EvWindow *window, EvLinkAction *action)
}
static void
-view_external_link_cb (EvView *view, EvLinkAction *action, EvWindow *window)
+view_external_link_cb (EvWindow *window, EvLinkAction *action)
{
switch (ev_link_action_get_action_type (action)) {
case EV_LINK_ACTION_TYPE_GOTO_DEST: {
@@ -7334,9 +7341,9 @@ ev_window_init (EvWindow *ev_window)
g_signal_connect_object (ev_window->priv->view, "focus_out_event",
G_CALLBACK (view_actions_focus_out_cb),
ev_window, 0);
- g_signal_connect_object (ev_window->priv->view, "external-link",
- G_CALLBACK (view_external_link_cb),
- ev_window, 0);
+ g_signal_connect_swapped (ev_window->priv->view, "external-link",
+ G_CALLBACK (view_external_link_cb),
+ ev_window);
g_signal_connect_object (ev_window->priv->view, "handle-link",
G_CALLBACK (view_handle_link_cb),
ev_window, 0);