[yelp] Port yelp-application.c to the bookmarks interface properly.
- From: Shaun McCance <shaunm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [yelp] Port yelp-application.c to the bookmarks interface properly.
- Date: Mon, 20 Dec 2010 15:47:48 +0000 (UTC)
commit fab59cda8b3020609de63bb30b986f649d25a8f2
Author: Rupert Swarbrick <rswarbrick gmail com>
Date: Thu Dec 16 23:52:30 2010 +0000
Port yelp-application.c to the bookmarks interface properly.
src/yelp-application.c | 15 +++++++++------
src/yelp-application.h | 7 ++++---
src/yelp-window.c | 16 +++++++++++-----
3 files changed, 24 insertions(+), 14 deletions(-)
---
diff --git a/src/yelp-application.c b/src/yelp-application.c
index 90d1659..0921d16 100644
--- a/src/yelp-application.c
+++ b/src/yelp-application.c
@@ -629,13 +629,14 @@ application_maybe_quit (YelpApplication *app)
/******************************************************************************/
void
-yelp_application_add_bookmark (YelpApplication *app,
+yelp_application_add_bookmark (YelpBookmarks *bookmarks,
const gchar *doc_uri,
const gchar *page_id,
const gchar *icon,
const gchar *title)
{
GSettings *settings;
+ YelpApplication *app = YELP_APPLICATION (bookmarks);
settings = application_get_doc_settings (app, doc_uri);
@@ -666,11 +667,12 @@ yelp_application_add_bookmark (YelpApplication *app,
}
void
-yelp_application_remove_bookmark (YelpApplication *app,
+yelp_application_remove_bookmark (YelpBookmarks *bookmarks,
const gchar *doc_uri,
const gchar *page_id)
{
GSettings *settings;
+ YelpApplication *app = YELP_APPLICATION (bookmarks);
settings = application_get_doc_settings (app, doc_uri);
@@ -691,21 +693,22 @@ yelp_application_remove_bookmark (YelpApplication *app,
}
gboolean
-yelp_application_is_bookmarked (YelpApplication *app,
+yelp_application_is_bookmarked (YelpBookmarks *bookmarks,
const gchar *doc_uri,
const gchar *page_id)
{
- GVariant *bookmarks;
+ GVariant *stored_bookmarks;
GVariantIter *iter;
gboolean ret = FALSE;
gchar *this_id = NULL;
GSettings *settings;
+ YelpApplication *app = YELP_APPLICATION (bookmarks);
settings = application_get_doc_settings (app, doc_uri);
if (settings == NULL)
return FALSE;
- bookmarks = g_settings_get_value (settings, "bookmarks");
+ stored_bookmarks = g_settings_get_value (settings, "bookmarks");
g_settings_get (settings, "bookmarks", "a(sss)", &iter);
while (g_variant_iter_loop (iter, "(&s&s&s)", &this_id, NULL, NULL)) {
if (g_str_equal (page_id, this_id)) {
@@ -715,7 +718,7 @@ yelp_application_is_bookmarked (YelpApplication *app,
}
g_variant_iter_free (iter);
- g_variant_unref (bookmarks);
+ g_variant_unref (stored_bookmarks);
return ret;
}
diff --git a/src/yelp-application.h b/src/yelp-application.h
index 98839e9..35ccbde 100644
--- a/src/yelp-application.h
+++ b/src/yelp-application.h
@@ -26,6 +26,7 @@
#include <glib-object.h>
#include "yelp-uri.h"
+#include "yelp-bookmarks.h"
#define YELP_TYPE_APPLICATION (yelp_application_get_type ())
#define YELP_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), YELP_TYPE_APPLICATION, YelpApplication))
@@ -60,15 +61,15 @@ void yelp_application_new_window (YelpApplication *app,
void yelp_application_new_window_uri (YelpApplication *app,
YelpUri *uri);
GtkActionGroup * yelp_application_get_action_group (YelpApplication *app);
-void yelp_application_add_bookmark (YelpApplication *app,
+void yelp_application_add_bookmark (YelpBookmarks *bookmarks,
const gchar *doc_uri,
const gchar *page_id,
const gchar *icon,
const gchar *title);
-void yelp_application_remove_bookmark (YelpApplication *app,
+void yelp_application_remove_bookmark (YelpBookmarks *bookmarks,
const gchar *doc_uri,
const gchar *page_id);
-gboolean yelp_application_is_bookmarked (YelpApplication *app,
+gboolean yelp_application_is_bookmarked (YelpBookmarks *bookmarks,
const gchar *doc_uri,
const gchar *page_id);
void yelp_application_update_bookmarks (YelpApplication *app,
diff --git a/src/yelp-window.c b/src/yelp-window.c
index 76a39f0..5a7a2d1 100644
--- a/src/yelp-window.c
+++ b/src/yelp-window.c
@@ -768,7 +768,8 @@ window_add_bookmark (GtkAction *action,
"page-title", &title,
NULL);
doc_uri = yelp_uri_get_document_uri (uri);
- yelp_application_add_bookmark (priv->application, doc_uri, page_id, icon, title);
+ yelp_application_add_bookmark (YELP_BOOKMARKS (priv->application),
+ doc_uri, page_id, icon, title);
g_free (doc_uri);
g_free (page_id);
g_free (icon);
@@ -993,9 +994,10 @@ window_set_bookmark_action (YelpWindow *window)
goto done;
}
doc_uri = yelp_uri_get_document_uri (uri);
- gtk_action_set_sensitive (action,
- !yelp_application_is_bookmarked (priv->application,
- doc_uri, page_id));
+ gtk_action_set_sensitive (
+ action,
+ !yelp_application_is_bookmarked (YELP_BOOKMARKS (priv->application),
+ doc_uri, page_id));
done:
g_free (page_id);
g_free (doc_uri);
@@ -1757,7 +1759,11 @@ bookmark_remove (YelpWindow *window)
-1);
g_object_get (priv->view, "yelp-uri", &uri, NULL);
doc_uri = yelp_uri_get_document_uri (uri);
- yelp_application_remove_bookmark (priv->application, doc_uri, page_id);
+
+ yelp_application_remove_bookmark (
+ YELP_BOOKMARKS (priv->application),
+ doc_uri, page_id);
+
g_object_unref (uri);
g_free (doc_uri);
g_free (page_id);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]