Evince
Evince is a document viewer capable of displaying multiple and single page document formats like PDF and Postscript.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
ev-bookmark-action.c
Go to the documentation of this file.
1 /* ev-bookmark-action.c
2  * this file is part of evince, a gnome document viewer
3  *
4  * Copyright (C) 2010 Carlos Garcia Campos <carlosgc@gnome.org>
5  *
6  * Evince is free software; you can redistribute it and/or modify it
7  * under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * Evince is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19  */
20 
21 #include "config.h"
22 
23 #include "ev-bookmark-action.h"
24 
25 enum {
28 };
29 
31  GtkAction base;
32 
33  guint page;
34 };
35 
37  GtkActionClass base_class;
38 };
39 
40 G_DEFINE_TYPE (EvBookmarkAction, ev_bookmark_action, GTK_TYPE_ACTION)
41 
42 static void
44 {
45 }
46 
47 static void
49  guint prop_id,
50  const GValue *value,
51  GParamSpec *pspec)
52 {
53  EvBookmarkAction *action = EV_BOOKMARK_ACTION (object);
54 
55  switch (prop_id) {
56  case PROP_PAGE:
57  action->page = g_value_get_uint (value);
58  break;
59  default:
60  G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
61  }
62 }
63 
64 static void
66 {
67  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
68 
69  gobject_class->set_property = ev_bookmark_action_set_property;
70 
71  g_object_class_install_property (gobject_class,
72  PROP_PAGE,
73  g_param_spec_uint ("page",
74  "Page",
75  "The bookmark page",
76  0, G_MAXUINT, 0,
77  G_PARAM_CONSTRUCT_ONLY | G_PARAM_WRITABLE |
78  G_PARAM_STATIC_STRINGS));
79 }
80 
81 GtkAction *
83 {
84  GtkAction *action;
85  gchar *name;
86 
87  g_return_val_if_fail (bookmark->title != NULL, NULL);
88 
89  name = g_strdup_printf ("EvBookmark%u", bookmark->page);
90  action = GTK_ACTION (g_object_new (EV_TYPE_BOOKMARK_ACTION,
91  "name", name,
92  "label", bookmark->title,
93  "page", bookmark->page,
94  NULL));
95  g_free (name);
96 
97  return action;
98 }
99 
100 guint
102 {
103  g_return_val_if_fail (EV_IS_BOOKMARK_ACTION (action), 0);
104 
105  return action->page;
106 }