aboutsummaryrefslogtreecommitdiffstats
path: root/src/bookmarks
diff options
context:
space:
mode:
authorDiego Escalante Urrelo <descalante@igalia.com>2010-07-25 07:59:55 +0800
committerXan Lopez <xan@gnome.org>2010-10-08 17:09:11 +0800
commit5df7af9e3041102a5f5601d60faa11c38b48de75 (patch)
treefe0306b87e0874a8541a082fe844f4a487331161 /src/bookmarks
parent60d08f64c2466ce8eda20d832239ec6defc9ef06 (diff)
downloadgsoc2013-epiphany-5df7af9e3041102a5f5601d60faa11c38b48de75.tar
gsoc2013-epiphany-5df7af9e3041102a5f5601d60faa11c38b48de75.tar.gz
gsoc2013-epiphany-5df7af9e3041102a5f5601d60faa11c38b48de75.tar.bz2
gsoc2013-epiphany-5df7af9e3041102a5f5601d60faa11c38b48de75.tar.lz
gsoc2013-epiphany-5df7af9e3041102a5f5601d60faa11c38b48de75.tar.xz
gsoc2013-epiphany-5df7af9e3041102a5f5601d60faa11c38b48de75.tar.zst
gsoc2013-epiphany-5df7af9e3041102a5f5601d60faa11c38b48de75.zip
gsettings: port epiphany to gsettings
Adds our own schemas, a migration file and removes old gconf API and files. Bug #624485
Diffstat (limited to 'src/bookmarks')
-rw-r--r--src/bookmarks/ephy-bookmark-properties.c6
-rw-r--r--src/bookmarks/ephy-bookmarks-editor.c126
-rw-r--r--src/bookmarks/ephy-bookmarks-import.c18
-rw-r--r--src/bookmarks/ephy-bookmarks-ui.c7
-rw-r--r--src/bookmarks/ephy-bookmarks.c31
5 files changed, 54 insertions, 134 deletions
diff --git a/src/bookmarks/ephy-bookmark-properties.c b/src/bookmarks/ephy-bookmark-properties.c
index b681f21e4..c566678a7 100644
--- a/src/bookmarks/ephy-bookmark-properties.c
+++ b/src/bookmarks/ephy-bookmark-properties.c
@@ -34,8 +34,7 @@
#include "ephy-gui.h"
#include "ephy-dnd.h"
#include "ephy-prefs.h"
-
-#include "eel-gconf-extensions.h"
+#include "ephy-settings.h"
#include <glib/gi18n.h>
#include <gtk/gtk.h>
@@ -523,7 +522,8 @@ ephy_bookmark_properties_constructor (GType type,
EPHY_STATE_WINDOW_SAVE_SIZE);
}
/* Lockdown */
- lockdown = eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_BOOKMARK_EDITING);
+ lockdown = g_settings_get_boolean (EPHY_SETTINGS_LOCKDOWN,
+ EPHY_PREFS_LOCKDOWN_BOOKMARK_EDITING);
update_window_title (properties);
content_area = gtk_dialog_get_content_area (dialog);
diff --git a/src/bookmarks/ephy-bookmarks-editor.c b/src/bookmarks/ephy-bookmarks-editor.c
index 2f81b8c6a..32a25caa1 100644
--- a/src/bookmarks/ephy-bookmarks-editor.c
+++ b/src/bookmarks/ephy-bookmarks-editor.c
@@ -34,6 +34,7 @@
#include "ephy-node-view.h"
#include "ephy-window.h"
#include "ephy-dnd.h"
+#include "ephy-settings.h"
#include "ephy-shell.h"
#include "ephy-session.h"
#include "ephy-file-helpers.h"
@@ -45,7 +46,6 @@
#include "ephy-stock-icons.h"
#include "ephy-search-entry.h"
#include "ephy-favicon-cache.h"
-#include "eel-gconf-extensions.h"
#include "ephy-debug.h"
#include "egg-toolbars-model.h"
#include "ephy-prefs.h"
@@ -126,8 +126,6 @@ static void cmd_help_contents (GtkAction *action,
#define EPHY_BOOKMARKS_EDITOR_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_BOOKMARKS_EDITOR, EphyBookmarksEditorPrivate))
-#define CONF_BOOKMARKS_VIEW_DETAILS "/apps/epiphany/dialogs/bookmarks_view_details"
-
#define RESERVED_STRING N_("Remove from this topic")
struct _EphyBookmarksEditorPrivate
@@ -216,22 +214,11 @@ static const GtkToggleActionEntry ephy_bookmark_toggle_entries [] = {
{ "ShowOnToolbar", NULL, N_("_Show on Toolbar"), NULL,
N_("Show the selected bookmark on a toolbar"),
G_CALLBACK (cmd_toolbar), FALSE },
-};
-
-enum
-{
- VIEW_TITLE,
- VIEW_TITLE_AND_ADDRESS
-};
-
-static const GtkRadioActionEntry ephy_bookmark_radio_entries [] =
-{
/* View Menu */
{ "ViewTitle", NULL, N_("_Title"), NULL,
- N_("Show only the title column"), VIEW_TITLE },
- { "ViewTitleAddress", NULL, N_("T_itle and Address"), NULL,
- N_("Show both the title and address columns"),
- VIEW_TITLE_AND_ADDRESS }
+ N_("Show the title column"), NULL, TRUE },
+ { "ViewAddress", NULL, N_("Address"), NULL,
+ N_("Show the address column"), NULL, FALSE }
};
G_DEFINE_TYPE (EphyBookmarksEditor, ephy_bookmarks_editor, GTK_TYPE_WINDOW)
@@ -1117,50 +1104,6 @@ cmd_help_contents (GtkAction *action,
}
static void
-set_columns_visibility (EphyBookmarksEditor *editor, int value)
-{
- switch (value)
- {
- case VIEW_TITLE:
- gtk_tree_view_column_set_visible (editor->priv->title_col, TRUE);
- gtk_tree_view_column_set_visible (editor->priv->address_col, FALSE);
- break;
- case VIEW_TITLE_AND_ADDRESS:
- gtk_tree_view_column_set_visible (editor->priv->title_col, TRUE);
- gtk_tree_view_column_set_visible (editor->priv->address_col, TRUE);
- break;
- }
-}
-
-static void
-cmd_view_columns (GtkAction *action,
- GtkRadioAction *current,
- EphyBookmarksEditor *editor)
-{
- int value;
- GSList *svalues = NULL;
-
- g_return_if_fail (EPHY_IS_BOOKMARKS_EDITOR (editor));
-
- value = gtk_radio_action_get_current_value (current);
- set_columns_visibility (editor, value);
-
- switch (value)
- {
- case VIEW_TITLE:
- svalues = g_slist_append (svalues, (gpointer)"title");
- break;
- case VIEW_TITLE_AND_ADDRESS:
- svalues = g_slist_append (svalues, (gpointer)"title");
- svalues = g_slist_append (svalues, (gpointer)"address");
- break;
- }
-
- eel_gconf_set_string_list (CONF_BOOKMARKS_VIEW_DETAILS, svalues);
- g_slist_free (svalues);
-}
-
-static void
ephy_bookmarks_editor_show (GtkWidget *widget)
{
EphyBookmarksEditor *editor = EPHY_BOOKMARKS_EDITOR (widget);
@@ -1699,31 +1642,6 @@ provide_keyword_uri (EphyNode *node, GValue *value, gpointer data)
g_free (uri);
}
-static int
-get_details_value (EphyBookmarksEditor *editor)
-{
- int value;
- GSList *svalues;
-
- svalues = eel_gconf_get_string_list (CONF_BOOKMARKS_VIEW_DETAILS);
-
- if (svalues &&
- g_slist_find_custom (svalues, "title", (GCompareFunc)strcmp) &&
- g_slist_find_custom (svalues, "address", (GCompareFunc)strcmp))
- {
- value = VIEW_TITLE_AND_ADDRESS;
- }
- else
- {
- value = VIEW_TITLE;
- }
-
- g_slist_foreach (svalues, (GFunc) g_free, NULL);
- g_slist_free (svalues);
-
- return value;
-}
-
static void
ephy_bookmarks_editor_construct (EphyBookmarksEditor *editor)
{
@@ -1735,7 +1653,7 @@ ephy_bookmarks_editor_construct (EphyBookmarksEditor *editor)
GtkUIManager *ui_merge;
GtkActionGroup *action_group;
GtkAction *action;
- int col_id, url_col_id, title_col_id, details_value;
+ int col_id, url_col_id, title_col_id;
ephy_gui_ensure_window_group (GTK_WINDOW (editor));
@@ -1758,13 +1676,6 @@ ephy_bookmarks_editor_construct (EphyBookmarksEditor *editor)
gtk_action_group_add_toggle_actions (action_group, ephy_bookmark_toggle_entries,
G_N_ELEMENTS (ephy_bookmark_toggle_entries), editor);
- details_value = get_details_value (editor);
- gtk_action_group_add_radio_actions (action_group,
- ephy_bookmark_radio_entries,
- G_N_ELEMENTS (ephy_bookmark_radio_entries),
- details_value,
- G_CALLBACK (cmd_view_columns),
- editor);
gtk_ui_manager_insert_action_group (ui_merge,
action_group, 0);
gtk_ui_manager_add_ui_from_file (ui_merge,
@@ -1901,6 +1812,27 @@ ephy_bookmarks_editor_construct (EphyBookmarksEditor *editor)
gtk_container_add (GTK_CONTAINER (scrolled_window), bm_view);
gtk_widget_show (bm_view);
editor->priv->bm_view = bm_view;
+
+ action = gtk_action_group_get_action (action_group, "ViewTitle");
+ g_settings_bind (EPHY_SETTINGS_STATE,
+ EPHY_PREFS_STATE_BOOKMARKS_VIEW_TITLE,
+ action, "active",
+ G_SETTINGS_BIND_DEFAULT);
+ g_settings_bind (EPHY_SETTINGS_STATE,
+ EPHY_PREFS_STATE_BOOKMARKS_VIEW_TITLE,
+ editor->priv->title_col, "visible",
+ G_SETTINGS_BIND_DEFAULT);
+
+ action = gtk_action_group_get_action (action_group, "ViewAddress");
+ g_settings_bind (EPHY_SETTINGS_STATE,
+ EPHY_PREFS_STATE_BOOKMARKS_VIEW_ADDRESS,
+ action, "active",
+ G_SETTINGS_BIND_DEFAULT);
+ g_settings_bind (EPHY_SETTINGS_STATE,
+ EPHY_PREFS_STATE_BOOKMARKS_VIEW_ADDRESS,
+ editor->priv->address_col, "visible",
+ G_SETTINGS_BIND_DEFAULT);
+
g_signal_connect (G_OBJECT (bm_view),
"key_press_event",
G_CALLBACK (key_pressed_cb),
@@ -1931,12 +1863,12 @@ ephy_bookmarks_editor_construct (EphyBookmarksEditor *editor)
"bookmarks_paned",
130);
- set_columns_visibility (editor, details_value);
-
/* Lockdown settings */
action = gtk_action_group_get_action (action_group, "Export");
gtk_action_set_sensitive (action,
- eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_SAVE_TO_DISK) == FALSE);
+ g_settings_get_boolean
+ (EPHY_SETTINGS_LOCKDOWN,
+ EPHY_PREFS_LOCKDOWN_SAVE_TO_DISK) == FALSE);
}
void
diff --git a/src/bookmarks/ephy-bookmarks-import.c b/src/bookmarks/ephy-bookmarks-import.c
index 1efdb71de..f6ed781cb 100644
--- a/src/bookmarks/ephy-bookmarks-import.c
+++ b/src/bookmarks/ephy-bookmarks-import.c
@@ -32,8 +32,7 @@
#include "ephy-bookmarks-import.h"
#include "ephy-debug.h"
#include "ephy-prefs.h"
-
-#include "eel-gconf-extensions.h"
+#include "ephy-settings.h"
/**
* NSItemType: netscape bookmark item type
@@ -73,7 +72,9 @@ ephy_bookmarks_import (EphyBookmarks *bookmarks,
GFile *file;
GFileInfo *file_info;
- if (eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_BOOKMARK_EDITING)) return FALSE;
+ if (g_settings_get_boolean (EPHY_SETTINGS_LOCKDOWN,
+ EPHY_PREFS_LOCKDOWN_BOOKMARK_EDITING))
+ return FALSE;
g_return_val_if_fail (filename != NULL, FALSE);
@@ -712,7 +713,9 @@ ephy_bookmarks_import_mozilla (EphyBookmarks *bookmarks,
char *parsedname;
GList *folders = NULL;
- if (eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_BOOKMARK_EDITING)) return FALSE;
+ if (g_settings_get_boolean (EPHY_SETTINGS_LOCKDOWN,
+ EPHY_PREFS_LOCKDOWN_BOOKMARK_EDITING))
+ return FALSE;
name = g_string_new (NULL);
url = g_string_new (NULL);
@@ -792,7 +795,9 @@ ephy_bookmarks_import_xbel (EphyBookmarks *bookmarks,
xmlTextReaderPtr reader;
int ret;
- if (eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_BOOKMARK_EDITING)) return FALSE;
+ if (g_settings_get_boolean (EPHY_SETTINGS_LOCKDOWN,
+ EPHY_PREFS_LOCKDOWN_BOOKMARK_EDITING))
+ return FALSE;
if (g_file_test (filename, G_FILE_TEST_EXISTS) == FALSE)
{
@@ -969,7 +974,8 @@ ephy_bookmarks_import_rdf (EphyBookmarks *bookmarks,
xmlNodePtr child;
xmlNodePtr root;
- if (eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_BOOKMARK_EDITING)) return FALSE;
+ if (g_settings_get_boolean (EPHY_SETTINGS_LOCKDOWN,
+ EPHY_PREFS_LOCKDOWN_BOOKMARK_EDITING))
if (g_file_test (filename, G_FILE_TEST_EXISTS) == FALSE)
return FALSE;
diff --git a/src/bookmarks/ephy-bookmarks-ui.c b/src/bookmarks/ephy-bookmarks-ui.c
index 91479db85..1f97eddb3 100644
--- a/src/bookmarks/ephy-bookmarks-ui.c
+++ b/src/bookmarks/ephy-bookmarks-ui.c
@@ -20,7 +20,6 @@
#include "config.h"
-#include "eel-gconf-extensions.h"
#include "ephy-bookmarks.h"
#include "ephy-bookmarks-ui.h"
#include "ephy-bookmarks-menu.h"
@@ -36,6 +35,7 @@
#include "ephy-node-common.h"
#include "ephy-link.h"
#include "ephy-dnd.h"
+#include "ephy-embed-shell.h"
#include "ephy-history.h"
#include "ephy-shell.h"
#include "ephy-string.h"
@@ -44,6 +44,7 @@
#include "ephy-gui.h"
#include "ephy-stock-icons.h"
#include "ephy-prefs.h"
+#include "ephy-settings.h"
#include "egg-editable-toolbar.h"
#include <string.h>
@@ -434,7 +435,9 @@ ephy_bookmarks_ui_add_bookmark (GtkWindow *parent,
EphyNode *bookmark;
GtkWidget *dialog;
- if (eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_BOOKMARK_EDITING)) return;
+ if (g_settings_get_boolean (EPHY_SETTINGS_LOCKDOWN,
+ EPHY_PREFS_LOCKDOWN_BOOKMARK_EDITING))
+ return;
bookmarks = ephy_shell_get_bookmarks (ephy_shell_get_default ());
bookmark = ephy_bookmarks_add (bookmarks, title, location);
diff --git a/src/bookmarks/ephy-bookmarks.c b/src/bookmarks/ephy-bookmarks.c
index 507426978..43c1ad9d9 100644
--- a/src/bookmarks/ephy-bookmarks.c
+++ b/src/bookmarks/ephy-bookmarks.c
@@ -34,12 +34,11 @@
#include "ephy-bookmarks-import.h"
#include "ephy-bookmark-properties.h"
#include "ephy-prefs.h"
+#include "ephy-settings.h"
#include "ephy-marshal.h"
#include "ephy-signal-accumulator.h"
#include "ephy-stock-icons.h"
-#include "eel-gconf-extensions.h"
-
#include <string.h>
#include <glib/gi18n.h>
#include <gtk/gtk.h>
@@ -82,7 +81,6 @@ struct _EphyBookmarksPrivate
EphyNode *smartbookmarks;
EphyNode *lower_fav;
double lower_score;
- guint disable_bookmark_editing_notifier_id;
#ifdef ENABLE_ZEROCONF
/* Local sites */
@@ -630,14 +628,6 @@ topics_removed_cb (EphyNode *node,
}
static void
-update_bookmark_editing (EphyBookmarks *eb)
-{
- g_object_set (G_OBJECT (eb->priv->db),
- "immutable", eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_BOOKMARK_EDITING),
- NULL);
-}
-
-static void
fix_hierarchy_topic (EphyBookmarks *eb,
EphyNode *topic)
{
@@ -693,15 +683,6 @@ fix_hierarchy (EphyBookmarks *eb)
}
static void
-disable_bookmark_editing_notifier (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- EphyBookmarks *eb)
-{
- update_bookmark_editing (eb);
-}
-
-static void
backup_file (const char *original_filename, const char *extension)
{
char *template, *backup_filename;
@@ -1339,10 +1320,10 @@ ephy_bookmarks_init (EphyBookmarks *eb)
fix_hierarchy (eb);
- eb->priv->disable_bookmark_editing_notifier_id = eel_gconf_notification_add
- (CONF_LOCKDOWN_DISABLE_BOOKMARK_EDITING,
- (GConfClientNotifyFunc)disable_bookmark_editing_notifier, eb);
- update_bookmark_editing (eb);
+ g_settings_bind (EPHY_SETTINGS_LOCKDOWN,
+ EPHY_PREFS_LOCKDOWN_BOOKMARK_EDITING,
+ eb->priv->db, "immutable",
+ G_SETTINGS_BIND_GET);
ephy_setup_history_notifiers (eb);
ephy_bookmarks_update_favorites (eb);
@@ -1354,8 +1335,6 @@ ephy_bookmarks_finalize (GObject *object)
EphyBookmarks *eb = EPHY_BOOKMARKS (object);
EphyBookmarksPrivate *priv = eb->priv;
- eel_gconf_notification_remove (priv->disable_bookmark_editing_notifier_id);
-
if (priv->save_timeout_id != 0)
{
g_source_remove (priv->save_timeout_id);