Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
authorCarlos Garcia Campos <carlosgc@gnome.org>2006-05-04 08:24:19 (GMT)
committer Carlos Garcia Campos <carlosgc@src.gnome.org>2006-05-04 08:24:19 (GMT)
commitfdf6ceaeede339118ddc2d389ba60be8e3bae9c1 (patch)
treec9fd3fa8641dc887248dae7e75c3a2f4cdebce00 /shell
parentcbb0117c2cd79100c000ab0cb85ddde421478280 (diff)
Add support for Named Action links
2006-05-03 Carlos Garcia Campos <carlosgc@gnome.org> * backend/ev-link-action.[ch]: * pdf/ev-poppler.cc: (ev_link_from_action): * shell/ev-view-private.h: * shell/ev-view.c: (ev_view_handle_link), (tip_from_action_named): * shell/ev-window.c: (do_action_named), (view_external_link_cb): Add support for Named Action links
Diffstat (limited to 'shell')
-rw-r--r--shell/ev-view-private.h2
-rw-r--r--shell/ev-view.c26
-rw-r--r--shell/ev-window.c26
3 files changed, 53 insertions, 1 deletions
diff --git a/shell/ev-view-private.h b/shell/ev-view-private.h
index 1d09cb3..a53fe54 100644
--- a/shell/ev-view-private.h
+++ b/shell/ev-view-private.h
@@ -129,7 +129,7 @@ struct _EvViewClass {
gboolean horizontal);
void (*zoom_invalid) (EvView *view);
void (*external_link) (EvView *view,
- EvLink *link);
+ EvLinkAction *action);
void (*popup_menu) (EvView *view,
EvLink *link);
};
diff --git a/shell/ev-view.c b/shell/ev-view.c
index 0380e22..e3f07dc 100644
--- a/shell/ev-view.c
+++ b/shell/ev-view.c
@@ -1289,6 +1289,7 @@ ev_view_handle_link (EvView *view, EvLink *link)
case EV_LINK_ACTION_TYPE_GOTO_REMOTE:
case EV_LINK_ACTION_TYPE_EXTERNAL_URI:
case EV_LINK_ACTION_TYPE_LAUNCH:
+ case EV_LINK_ACTION_TYPE_NAMED:
g_signal_emit (view, signals[SIGNAL_EXTERNAL_LINK], 0, action);
break;
}
@@ -1327,6 +1328,28 @@ page_label_from_dest (EvView *view, EvLinkDest *dest)
}
static char *
+tip_from_action_named (EvLinkAction *action)
+{
+ const gchar *name = ev_link_action_get_name (action);
+
+ if (g_ascii_strcasecmp (name, "FirstPage") == 0) {
+ return g_strdup (_("Got to fisrt page"));
+ } else if (g_ascii_strcasecmp (name, "PrevPage") == 0) {
+ return g_strdup (_("Got to previuos page"));
+ } else if (g_ascii_strcasecmp (name, "NextPage") == 0) {
+ return g_strdup (_("Got to next page"));
+ } else if (g_ascii_strcasecmp (name, "LastPage") == 0) {
+ return g_strdup (_("Got to last page"));
+ } else if (g_ascii_strcasecmp (name, "GoToPage") == 0) {
+ return g_strdup (_("Got to page"));
+ } else if (g_ascii_strcasecmp (name, "Find") == 0) {
+ return g_strdup (_("Find"));
+ }
+
+ return NULL;
+}
+
+static char *
tip_from_link (EvView *view, EvLink *link)
{
EvLinkAction *action;
@@ -1367,6 +1390,9 @@ tip_from_link (EvView *view, EvLink *link)
msg = g_strdup_printf (_("Launch %s"),
ev_link_action_get_filename (action));
break;
+ case EV_LINK_ACTION_TYPE_NAMED:
+ msg = tip_from_action_named (action);
+ break;
default:
if (title)
msg = g_strdup (title);
diff --git a/shell/ev-window.c b/shell/ev-window.c
index 2fad47b..c04801a 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -3320,6 +3320,29 @@ open_remote_link (EvWindow *window, EvLinkAction *action)
}
static void
+do_action_named (EvWindow *window, EvLinkAction *action)
+{
+ const gchar *name = ev_link_action_get_name (action);
+
+ if (g_ascii_strcasecmp (name, "FirstPage") == 0) {
+ ev_window_cmd_go_first_page (NULL, window);
+ } else if (g_ascii_strcasecmp (name, "PrevPage") == 0) {
+ ev_window_cmd_go_previous_page (NULL, window);
+ } else if (g_ascii_strcasecmp (name, "NextPage") == 0) {
+ ev_window_cmd_go_next_page (NULL, window);
+ } else if (g_ascii_strcasecmp (name, "LastPage") == 0) {
+ ev_window_cmd_go_last_page (NULL, window);
+ } else if (g_ascii_strcasecmp (name, "GoToPage") == 0) {
+ ev_window_cmd_focus_page_selector (NULL, window);
+ } else if (g_ascii_strcasecmp (name, "Find") == 0) {
+ ev_window_cmd_edit_find (NULL, window);
+ } else {
+ g_warning ("Unimplemented named action: %s, please post a bug report with a testcase.",
+ name);
+ }
+}
+
+static void
view_external_link_cb (EvView *view, EvLinkAction *action, EvWindow *window)
{
switch (ev_link_action_get_action_type (action)) {
@@ -3332,6 +3355,9 @@ view_external_link_cb (EvView *view, EvLinkAction *action, EvWindow *window)
case EV_LINK_ACTION_TYPE_GOTO_REMOTE:
open_remote_link (window, action);
break;
+ case EV_LINK_ACTION_TYPE_NAMED:
+ do_action_named (window, action);
+ break;
default:
g_assert_not_reached ();
}