1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
/* ev-bookmark-action.c
 *  this file is part of evince, a gnome document viewer
 *
 * Copyright (C) 2010 Carlos Garcia Campos  <carlosgc@gnome.org>
 *
 * 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 {
        CtkAction base;

        guint     page;
};

struct _EvBookmarkActionClass {
        CtkActionClass base_class;
};

G_DEFINE_TYPE (EvBookmarkAction, ev_bookmark_action, CTK_TYPE_ACTION)<--- There is an unknown macro here somewhere. Configuration is required. If G_DEFINE_TYPE is a macro then please configure it.

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));
}

CtkAction *
ev_bookmark_action_new (EvBookmark *bookmark)
{
        CtkAction *action;
        gchar *name;

        g_return_val_if_fail (bookmark->title != NULL, NULL);

        name = g_strdup_printf ("EvBookmark%u", bookmark->page);
        action = CTK_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;
}