summaryrefslogtreecommitdiff
path: root/shell/ev-bookmark-action.c
diff options
context:
space:
mode:
authorinfirit <[email protected]>2014-12-09 22:51:45 +0100
committerinfirit <[email protected]>2014-12-09 23:02:29 +0100
commitb48d2fec7ea33c23363eec02dfd350c4f5602982 (patch)
tree0a5a49f0c999adbb0e8a0a6caf3d756a00df1e27 /shell/ev-bookmark-action.c
parent88ade34349d37acc1fedf4433a1ffd9010e5cf7d (diff)
downloadatril-b48d2fec7ea33c23363eec02dfd350c4f5602982.tar.bz2
atril-b48d2fec7ea33c23363eec02dfd350c4f5602982.tar.xz
shell: Add bookmarks menu to add and show internal bookmarks
Taken from evince commit: f7eb83a4ad43b1b30af202eb8f33f3057c2a51c5 From: Carlos Garcia Campos <[email protected]>
Diffstat (limited to 'shell/ev-bookmark-action.c')
-rw-r--r--shell/ev-bookmark-action.c105
1 files changed, 105 insertions, 0 deletions
diff --git a/shell/ev-bookmark-action.c b/shell/ev-bookmark-action.c
new file mode 100644
index 00000000..3689d7aa
--- /dev/null
+++ b/shell/ev-bookmark-action.c
@@ -0,0 +1,105 @@
+/* ev-bookmark-action.c
+ * this file is part of evince, a gnome document viewer
+ *
+ * Copyright (C) 2010 Carlos Garcia Campos <[email protected]>
+ *
+ * Evince is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Evince is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+
+#include "ev-bookmark-action.h"
+
+enum {
+ PROP_0,
+ PROP_PAGE
+};
+
+struct _EvBookmarkAction {
+ GtkAction base;
+
+ guint page;
+};
+
+struct _EvBookmarkActionClass {
+ GtkActionClass base_class;
+};
+
+G_DEFINE_TYPE (EvBookmarkAction, ev_bookmark_action, GTK_TYPE_ACTION)
+
+static void
+ev_bookmark_action_init (EvBookmarkAction *action)
+{
+}
+
+static void
+ev_bookmark_action_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ EvBookmarkAction *action = EV_BOOKMARK_ACTION (object);
+
+ switch (prop_id) {
+ case PROP_PAGE:
+ action->page = g_value_get_uint (value);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ }
+}
+
+static void
+ev_bookmark_action_class_init (EvBookmarkActionClass *klass)
+{
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+
+ gobject_class->set_property = ev_bookmark_action_set_property;
+
+ g_object_class_install_property (gobject_class,
+ PROP_PAGE,
+ g_param_spec_uint ("page",
+ "Page",
+ "The bookmark page",
+ 0, G_MAXUINT, 0,
+ G_PARAM_CONSTRUCT_ONLY | G_PARAM_WRITABLE));
+}
+
+GtkAction *
+ev_bookmark_action_new (EvBookmark *bookmark)
+{
+ GtkAction *action;
+ gchar *name;
+
+ g_return_val_if_fail (bookmark->title != NULL, NULL);
+
+ name = g_strdup_printf ("EvBookmark%u", bookmark->page);
+ action = GTK_ACTION (g_object_new (EV_TYPE_BOOKMARK_ACTION,
+ "name", name,
+ "label", bookmark->title,
+ "page", bookmark->page,
+ NULL));
+ g_free (name);
+
+ return action;
+}
+
+guint
+ev_bookmark_action_get_page (EvBookmarkAction *action)
+{
+ g_return_val_if_fail (EV_IS_BOOKMARK_ACTION (action), 0);
+
+ return action->page;
+}