1 /* ev-bookmark-action.c
2 * this file is part of evince, a gnome document viewer
4 * Copyright (C) 2010 Carlos Garcia Campos <carlosgc@gnome.org>
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.
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.
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.
23 #include "ev-bookmark-action.h"
30 struct _EvBookmarkAction {
36 struct _EvBookmarkActionClass {
37 GtkActionClass base_class;
40 G_DEFINE_TYPE (EvBookmarkAction, ev_bookmark_action, GTK_TYPE_ACTION)
43 ev_bookmark_action_init (EvBookmarkAction *action)
48 ev_bookmark_action_set_property (GObject *object,
53 EvBookmarkAction *action = EV_BOOKMARK_ACTION (object);
57 action->page = g_value_get_uint (value);
60 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
65 ev_bookmark_action_class_init (EvBookmarkActionClass *klass)
67 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
69 gobject_class->set_property = ev_bookmark_action_set_property;
71 g_object_class_install_property (gobject_class,
73 g_param_spec_uint ("page",
77 G_PARAM_CONSTRUCT_ONLY | G_PARAM_WRITABLE));
81 ev_bookmark_action_new (EvBookmark *bookmark)
86 g_return_val_if_fail (bookmark->title != NULL, NULL);
88 name = g_strdup_printf ("EvBookmark%u", bookmark->page);
89 action = GTK_ACTION (g_object_new (EV_TYPE_BOOKMARK_ACTION,
91 "label", bookmark->title,
92 "page", bookmark->page,
100 ev_bookmark_action_get_page (EvBookmarkAction *action)
102 g_return_val_if_fail (EV_IS_BOOKMARK_ACTION (action), 0);