diff options
author | Rupert Swarbrick <rswarbrick@gmail.com> | 2010-12-16 23:52:30 +0000 |
---|---|---|
committer | Shaun McCance <shaunm@gnome.org> | 2010-12-20 10:45:24 -0500 |
commit | fab59cda8b3020609de63bb30b986f649d25a8f2 (patch) | |
tree | 602e7c35e1ecd739ac3107bf6b9d022bc63be565 | |
parent | d006a0c00fc421e7794f85b9aac9a7d8e13e101e (diff) | |
download | yelp-fab59cda8b3020609de63bb30b986f649d25a8f2.tar.gz |
Port yelp-application.c to the bookmarks interface properly.
-rw-r--r-- | src/yelp-application.c | 15 | ||||
-rw-r--r-- | src/yelp-application.h | 7 | ||||
-rw-r--r-- | 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 90d16596..0921d163 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 98839e9c..35ccbdea 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 76a39f01..5a7a2d19 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); |