Update Nepali translation
[yelp.git] / libyelp / yelp-bookmarks.c
blob3ca9d1e25b53597ae3e57cb372205a41f0efc0d0
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * Copyright (C) 2010 Shaun McCance <shaunm@gnome.org>
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation; either version 2 of the
8 * License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
15 * You should have received a copy of the GNU General Public
16 * License along with this program; if not, see <http://www.gnu.org/licenses/>.
18 * Author: Shaun McCance <shaunm@gnome.org>
21 #include "yelp-bookmarks.h"
23 enum {
24 BOOKMARKS_CHANGED,
25 LAST_SIGNAL
27 static gint signals[LAST_SIGNAL] = { 0 };
29 G_DEFINE_INTERFACE (YelpBookmarks, yelp_bookmarks, G_TYPE_OBJECT)
31 static void
32 yelp_bookmarks_default_init (YelpBookmarksInterface *iface)
34 signals[BOOKMARKS_CHANGED] =
35 g_signal_new ("bookmarks-changed",
36 G_TYPE_FROM_INTERFACE (iface),
37 G_SIGNAL_RUN_LAST,
38 0, NULL, NULL,
39 g_cclosure_marshal_VOID__STRING,
40 G_TYPE_NONE, 1, G_TYPE_STRING);
43 void
44 yelp_bookmarks_add_bookmark (YelpBookmarks *bookmarks,
45 const gchar *doc_uri,
46 const gchar *page_id,
47 const gchar *icon,
48 const gchar *title)
50 YelpBookmarksInterface *iface;
52 g_return_if_fail (YELP_IS_BOOKMARKS (bookmarks));
54 iface = YELP_BOOKMARKS_GET_INTERFACE (bookmarks);
56 if (iface->add_bookmark)
57 (* iface->add_bookmark) (bookmarks,
58 doc_uri, page_id,
59 icon, title);
62 void
63 yelp_bookmarks_remove_bookmark (YelpBookmarks *bookmarks,
64 const gchar *doc_uri,
65 const gchar *page_id)
67 YelpBookmarksInterface *iface;
69 g_return_if_fail (YELP_IS_BOOKMARKS (bookmarks));
71 iface = YELP_BOOKMARKS_GET_INTERFACE (bookmarks);
73 if (iface->remove_bookmark)
74 (* iface->remove_bookmark) (bookmarks, doc_uri, page_id);
77 gboolean
78 yelp_bookmarks_is_bookmarked (YelpBookmarks *bookmarks,
79 const gchar *doc_uri,
80 const gchar *page_id)
82 YelpBookmarksInterface *iface;
84 g_return_val_if_fail (YELP_IS_BOOKMARKS (bookmarks), FALSE);
86 iface = YELP_BOOKMARKS_GET_INTERFACE (bookmarks);
88 if (iface->is_bookmarked)
89 return (* iface->is_bookmarked) (bookmarks, doc_uri, page_id);
90 else
91 return FALSE;