[gnome-search-tool] Port gnome-search-tool to GSettings
- From: Marek KaÅÃk <mkasik src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-search-tool] Port gnome-search-tool to GSettings
- Date: Mon, 6 Aug 2012 08:23:31 +0000 (UTC)
commit e70bc86ed2f4953d6f0469a3c3009e99265dd984
Author: Marek Kasik <mkasik redhat com>
Date: Mon Jul 30 16:13:40 2012 +0200
Port gnome-search-tool to GSettings
This commit migrates gnome-search-tool from GConf2 to GSettings.
It adds new key "search-history" which is a dictionary where values
are lists of strings and removes getting of nautilus key "date-format"
because it was removed from nautilus.
This commit also contains conversion file gnome-search-tool.convert for data
conversion (#632429).
configure.ac | 13 +-
data/Makefile.am | 26 +-
data/gnome-search-tool.convert | 27 ++
data/gnome-search-tool.schemas.in | 393 --------------------
data/org.gnome.gnome-search-tool.gschema.xml.in | 117 ++++++
help/C/gnome-search-tool.xml | 18 +-
libgnomeui-deprecated/gsearchtool-entry.c | 135 +++++---
src/gsearchtool-callbacks.c | 47 ++-
src/gsearchtool-callbacks.h | 5 +-
src/gsearchtool-support.c | 437 ++++++-----------------
src/gsearchtool-support.h | 34 --
src/gsearchtool.c | 161 +++++----
src/gsearchtool.h | 17 +-
13 files changed, 485 insertions(+), 945 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 74d2498..ccda962 100644
--- a/configure.ac
+++ b/configure.ac
@@ -38,15 +38,9 @@ LT_INIT([disable-static])
AC_CACHE_SAVE
GLIB_GSETTINGS
-AM_GCONF_SOURCE_2
GNOME_DOC_INIT
-AC_PATH_PROG(GCONFTOOL, [gconftool-2], [no])
-AS_IF([test "x$GCONFTOOL" = "xno"],
- [AC_MSG_ERROR([gconftool-2 executable not found in your path - should be installed with GConf])]
-)
-
dnl strftime extension checks
msg_strftime=no
@@ -89,13 +83,14 @@ AS_IF([test x$withval != x],
AC_SUBST(GREP_COMMAND)
GLIB_MIN_VERSION=2.30.0
+GIO_MIN_VERSION=2.30.0
GTK_MIN_VERSION=3.0.0
PKG_CHECK_MODULES(GSEARCHTOOL,
- gio-unix-2.0
+ gio-unix-2.0 >= $GIO_MIN_VERSION
+ gio-2.0 >= $GIO_MIN_VERSION
glib-2.0 >= $GLIB_MIN_VERSION
- gtk+-3.0 >= $GTK_MIN_VERSION
- gconf-2.0)
+ gtk+-3.0 >= $GTK_MIN_VERSION)
AC_CONFIG_FILES([
Makefile
diff --git a/data/Makefile.am b/data/Makefile.am
index c20cfc4..ea1ad81 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -3,10 +3,14 @@ icon_DATA = thumbnail_frame.png
man_MANS = gnome-search-tool.1
-schemadir = $(GCONF_SCHEMA_FILE_DIR)
-schema_in_file = gnome-search-tool.schemas.in
-schema_DATA = $(schema_in_file:.schemas.in=.schemas)
@INTLTOOL_SCHEMAS_RULE@
+ INTLTOOL_XML_NOMERGE_RULE@
+
+gsettings_SCHEMAS = org.gnome.gnome-search-tool.gschema.xml
+ GSETTINGS_RULES@
+
+gsettingsconvertdir = $(datadir)/GConf/gsettings
+gsettingsconvert_DATA = gnome-search-tool.convert
Utilitiesdir = $(datadir)/applications
Utilities_in_files = gnome-search-tool.desktop.in
@@ -16,22 +20,14 @@ Utilities_DATA = $(Utilities_in_files:.desktop.in=.desktop)
EXTRA_DIST = \
$(icon_DATA) \
$(man_MANS) \
- $(schema_in_file) \
+ org.gnome.gnome-search-tool.gschema.xml.in \
$(Utilities_in_files) \
- $(Utilities_DATA)
-
-if GCONF_SCHEMAS_INSTALL
-install-data-local:
- if test -z "$(DESTDIR)" ; then \
- GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) $(GCONFTOOL) --makefile-install-rule $(top_builddir)/data/$(schema_DATA) ; \
- fi
-else
-install-data-local:
-endif
+ $(Utilities_DATA) \
+ gnome-search-tool.convert
CLEANFILES = \
gnome-search-tool.desktop \
- $(schema_DATA)
+ $(gsettings_SCHEMAS)
disthook:
cd $(distdir) ; rm -f $(CLEANFILES)
diff --git a/data/gnome-search-tool.convert b/data/gnome-search-tool.convert
new file mode 100644
index 0000000..8046f0b
--- /dev/null
+++ b/data/gnome-search-tool.convert
@@ -0,0 +1,27 @@
+[org.gnome.gnome-search-tool]
+show-additional-options=/apps/gnome-search-tool/show_additional_options
+disable-quick-search=/apps/gnome-search-tool/disable_quick_search
+quick-search-excluded-paths=/apps/gnome-search-tool/quick_search_excluded_paths
+disable-quick-search-second-scan=/apps/gnome-search-tool/disable_quick_search_second-scan
+quick-search-second-scan-excluded-paths=/apps/gnome-search-tool/quick_search_second_scan_excluded_paths
+columns-order=/apps/gnome-search-tool/columns_order
+default-window-width=/apps/gnome-search-tool/default_window_width
+default-window-height=/apps/gnome-search-tool/default_window_height
+default-window-maximized=/apps/gnome-search-tool/default_window_maximized
+look-in-folder=/apps/gnome-search-tool/look_in_folder
+
+[org.gnome.gnome-search-tool.select]
+contains-the-text=/apps/gnome-search-tool/select/contains_the_text
+date-modified-less-than=/apps/gnome-search-tool/select/date_modified_less_than
+date-modified-more-than=/apps/gnome-search-tool/select/date_modified_more_than
+size-at-least=/apps/gnome-search-tool/select/size_at_least
+size-at-most=/apps/gnome-search-tool/select/size_at_most
+file-is-empty=/apps/gnome-search-tool/select/file_is_empty
+owned-by-user=/apps/gnome-search-tool/select/owned_by_user
+owned-by-group=/apps/gnome-search-tool/select/owned_by_group
+owner-is-unrecognized=/apps/gnome-search-tool/select/owner_is_unrecognized
+name-does-not-contain=/apps/gnome-search-tool/select/name_does_not_contain
+name-matches-regular-expression=/apps/gnome-search-tool/select/name_matches_regular_expression
+show-hidden-files-and-folders=/apps/gnome-search-tool/select/show_hidden_files_and_folders
+follow-symbolic-links=/apps/gnome-search-tool/select/follow_symbolic_links
+exclude-other-filesystems=/apps/gnome-search-tool/select/exclude_other_filesystems
diff --git a/data/org.gnome.gnome-search-tool.gschema.xml.in b/data/org.gnome.gnome-search-tool.gschema.xml.in
new file mode 100644
index 0000000..b471c2e
--- /dev/null
+++ b/data/org.gnome.gnome-search-tool.gschema.xml.in
@@ -0,0 +1,117 @@
+<schemalist>
+ <schema id="org.gnome.gnome-search-tool" path="/org/gnome/gnome-search-tool/">
+ <key name="search-history" type="a{sas}">
+ <default>[ ]</default>
+ <summary>Search history</summary>
+ <description>This key defines the items which were searched for in the past.</description>
+ </key>
+ <key name="show-additional-options" type="b">
+ <default>false</default>
+ <summary>Show Additional Options</summary>
+ </key>
+ <key name="disable-quick-search" type="b">
+ <default>false</default>
+ <summary>Disable Quick Search</summary>
+ <description>This key determines if the search tool disables the use of the locate command when performing simple file name searches.</description>
+ </key>
+ <key name="quick-search-excluded-paths" type="as">
+ <default>[ '/mnt/*', '/media/*', '/dev/*', '/tmp/*', '/proc/*', '/var/*' ]</default>
+ <summary>Quick Search Excluded Paths</summary>
+ <description>This key defines the paths the search tool will exclude from a quick search. The wildcards '*' and '?' are supported. The default values are /mnt/*, /media/*, /dev/*, /tmp/*, /proc/*, and /var/*.</description>
+ </key>
+ <key name="disable-quick-search-second-scan" type="b">
+ <default>false</default>
+ <summary>Disable Quick Search Second Scan</summary>
+ <description>This key determines if the search tool disables the use of the find command after performing a quick search.</description>
+ </key>
+ <key name="quick-search-second-scan-excluded-paths" type="as">
+ <default>[ '/' ]</default>
+ <summary>Quick Search Second Scan Excluded Paths</summary>
+ <description>This key defines the paths the search tool will exclude from a second scan when performing a quick search. The second scan uses the find command to search for files. The purpose of the second scan is to find files that have not been indexed. The wildcards '*' and '?' are supported. The default value is /.</description>
+ </key>
+ <key name="columns-order" type="ai">
+ <default>[ 0 ]</default>
+ <summary>Search Result Columns Order</summary>
+ <description>This key defines the order of the columns in the search results. This key should not be modified by the user.</description>
+ </key>
+ <key name="default-window-width" type="i">
+ <default>-1</default>
+ <summary>Default Window Width</summary>
+ <description>This key defines the window width, and it's used to remember the size of the search tool between sessions. Setting it to -1 will make the search tool use the default width.</description>
+ </key>
+ <key name="default-window-height" type="i">
+ <default>-1</default>
+ <summary>Default Window Height</summary>
+ <description>This key defines the window height, and it's used to remember the size of the search tool between sessions. Setting it to -1 will make the search tool use the default height.</description>
+ </key>
+ <key name="default-window-maximized" type="b">
+ <default>false</default>
+ <summary>Default Window Maximized</summary>
+ <description>This key determines if the search tool window starts in a maximized state.</description>
+ </key>
+ <key name="look-in-folder" type="s">
+ <default>''</default>
+ <summary>Look in Folder</summary>
+ <description>This key defines the default value of the "Look in Folder" widget.</description>
+ </key>
+ <child name="select" schema="org.gnome.gnome-search-tool.select"/>
+ </schema>
+ <schema id="org.gnome.gnome-search-tool.select" path="/org/gnome/gnome-search-tool/select/">
+ <key name="contains-the-text" type="b">
+ <default>true</default>
+ <description>This key determines if the "Contains the text" search option is selected when the search tool is started.</description>
+ </key>
+ <key name="date-modified-less-than" type="b">
+ <default>false</default>
+ <description>This key determines if the "Date modified less than" search option is selected when the search tool is started.</description>
+ </key>
+ <key name="date-modified-more-than" type="b">
+ <default>false</default>
+ <description>This key determines if the "Date modified more than" search option is selected when the search tool is started.</description>
+ </key>
+ <key name="size-at-least" type="b">
+ <default>false</default>
+ <description>This key determines if the "Size at least" search option is selected when the search tool is started.</description>
+ </key>
+ <key name="size-at-most" type="b">
+ <default>false</default>
+ <description>This key determines if the "Size at most" search option is selected when the search tool is started.</description>
+ </key>
+ <key name="file-is-empty" type="b">
+ <default>false</default>
+ <description>This key determines if the "File is empty" search option is selected when the search tool is started.</description>
+ </key>
+ <key name="owned-by-user" type="b">
+ <default>false</default>
+ <description>This key determines if the "Owned by user" search option is selected when the search tool is started.</description>
+ </key>
+ <key name="owned-by-group" type="b">
+ <default>false</default>
+ <description>This key determines if the "Owned by group" search option is selected when the search tool is started.</description>
+ </key>
+ <key name="owner-is-unrecognized" type="b">
+ <default>false</default>
+ <description>This key determines if the "Owner is unrecognized" search option is selected when the search tool is started.</description>
+ </key>
+ <key name="name-does-not-contain" type="b">
+ <default>false</default>
+ <description>This key determines if the "Name does not contain" search option is selected when the search tool is started.</description>
+ </key>
+ <key name="name-matches-regular-expression" type="b">
+ <default>false</default>
+ <description>This key determines if the "Name matches regular expression" search option is selected when the search tool is started.</description>
+ </key>
+ <key name="show-hidden-files-and-folders" type="b">
+ <default>false</default>
+ <description>This key determines if the "Show hidden files and folders" search option is selected when the search tool is started.</description>
+ </key>
+ <key name="follow-symbolic-links" type="b">
+ <default>false</default>
+ <description>This key determines if the "Follow symbolic links" search option is selected when the search tool is started.</description>
+ </key>
+ <key name="exclude-other-filesystems" type="b">
+ <default>false</default>
+ <description>This key determines if the "Exclude other filesystems" search option is selected when the search tool is started.</description>
+ </key>
+ </schema>
+</schemalist>
diff --git a/help/C/gnome-search-tool.xml b/help/C/gnome-search-tool.xml
index 6cf8721..970797f 100644
--- a/help/C/gnome-search-tool.xml
+++ b/help/C/gnome-search-tool.xml
@@ -476,57 +476,57 @@
<!-- ============= Settings ============================== -->
- <sect1 id="gsearchtool-settings-gconf-keys">
+ <sect1 id="gsearchtool-settings-gsettings-keys">
<title>Settings</title>
- <para><application>&app;</application> provides gconf keys to modify some of its behavior. The gconf values can be changed by starting the <application>Configuration Editor</application> in the following ways:
+ <para><application>&app;</application> provides gsettings keys to modify some of its behavior. The gsettings values can be changed by starting the <application>Configuration Editor</application> in the following ways:
</para>
<variablelist>
<varlistentry>
<term><guimenu>Applications</guimenu> menu</term>
<listitem>
- <para>Choose <menuchoice><guisubmenu>System Tools</guisubmenu><guimenuitem>Configuration Editor</guimenuitem></menuchoice>. </para>
+ <para>Choose <menuchoice><guisubmenu>System Tools</guisubmenu><guimenuitem>dconf Editor</guimenuitem></menuchoice>. </para>
</listitem>
</varlistentry>
<varlistentry>
<term>Command line</term>
<listitem>
- <para>Execute the following command: <command>gconf-editor</command></para>
+ <para>Execute the following command: <command>dconf-editor</command></para>
</listitem>
</varlistentry>
</variablelist>
<sect2 id="gsearchtool-disablequicksearch">
<title>Disable Quick Search</title>
- <para>Key name: /apps/gnome-search-tool/disable_quick_search</para>
+ <para>Key name: org.gnome.gnome-search-tool.disable-quick-search</para>
<para>Default value: false</para>
<para><application>&app;</application> speeds up file name searches by using the <command>locate</command> command. <command>Locate</command> provides a secure way to index and quickly search for file names. Because <command>locate</command> relies on a file index, the <guilabel>Search results</guilabel> list may not always be up to date.</para>
</sect2>
<sect2 id="gsearchtool-disablesecondscan">
<title>Disable Quick Search Second Scan</title>
- <para>Key name: /apps/gnome-search-tool/disable_quick_search_second_scan</para>
+ <para>Key name: org.gnome.gnome-search-tool.disable-quick-search-second-scan</para>
<para>Default value: false</para>
<para>After completing a quick search, <application>&app;</application> will perform a thorough search using the <command>find</command> command. The purpose of this second scan is to find files that have not been indexed. Files that match the search criteria are added to the <guilabel>Search results</guilabel> list keeping the list up to date.</para>
</sect2>
<sect2 id="gsearchtool-quicksearchexclude">
<title>Quick Search Excluded Paths</title>
- <para>Key name: /apps/gnome-search-tool/quick_search_excluded_paths</para>
+ <para>Key name: org.gnome.gnome-search-tool.quick-search-excluded-paths</para>
<para>Default values: [/mnt/*,/media/*,/dev/*,/tmp/*,/proc/*,/var/*]</para>
<para><application>&app;</application> will not perform a quick search for paths defined by this key. File name searches in the defined paths will use the <command>find</command> command. The wildcards '*' and '?' are supported.</para>
</sect2>
<sect2 id="gsearchtool-secondscanexclude">
<title>Quick Search Second Scan Excluded Paths</title>
- <para>Key name: /apps/gnome-search-tool/quick_search_second_scan_excluded_paths</para>
+ <para>Key name: org.gnome.gnome-search-tool.quick-search-second-scan-excluded-paths</para>
<para>Default values: [/]</para>
<para><application>&app;</application> will not perform a second scan after a quick search for the paths defined by this key. Quick searches in the defined paths will not be followed by a thorough search using the <command>find</command> command. The wildcards '*' and '?' are supported.</para>
</sect2>
<sect2 id="gsearchtool-showoptions">
<title>Show Additional Options</title>
- <para>Key name: /apps/gnome-search-tool/show_additional_options</para>
+ <para>Key name: org.gnome.gnome-search-tool.show-additional-options</para>
<para>Default value: false</para>
<para>This key determines if the <guilabel>Select more options</guilabel> section is expanded when <application>&app;</application> is started.</para>
</sect2>
diff --git a/libgnomeui-deprecated/gsearchtool-entry.c b/libgnomeui-deprecated/gsearchtool-entry.c
index 4b7ed86..6772c24 100644
--- a/libgnomeui-deprecated/gsearchtool-entry.c
+++ b/libgnomeui-deprecated/gsearchtool-entry.c
@@ -34,7 +34,6 @@
#include <string.h>
#include <glib/gi18n.h>
#include <gtk/gtk.h>
-#include <gconf/gconf-client.h>
#include "gsearchtool-entry.h"
@@ -57,7 +56,7 @@ struct _GsearchHistoryEntryPrivate
GtkEntryCompletion *completion;
- GConfClient *gconf_client;
+ GSettings *settings;
};
G_DEFINE_TYPE (GsearchHistoryEntry, gsearch_history_entry, GTK_TYPE_COMBO_BOX)
@@ -129,10 +128,10 @@ gsearch_history_entry_finalize (GObject *object)
g_free (priv->history_id);
- if (priv->gconf_client != NULL)
+ if (priv->settings != NULL)
{
- g_object_unref (G_OBJECT (priv->gconf_client));
- priv->gconf_client = NULL;
+ g_object_unref (G_OBJECT (priv->settings));
+ priv->settings = NULL;
}
G_OBJECT_CLASS (gsearch_history_entry_parent_class)->finalize (object);
@@ -188,23 +187,7 @@ get_history_store (GsearchHistoryEntry *entry)
static char *
get_history_key (GsearchHistoryEntry *entry)
{
- gchar *tmp;
- gchar *key;
-
- /*
- * Store the data under /apps/gnome-settings/
- * like the old GnomeEntry did
- */
-
- tmp = gconf_escape_key (entry->priv->history_id, -1);
- key = g_strconcat ("/apps/gnome-settings/",
- "gnome-search-tool",
- "/history-",
- tmp,
- NULL);
- g_free (tmp);
-
- return key;
+ return g_strdup (entry->priv->history_id);
}
static GSList *
@@ -241,22 +224,52 @@ get_history_list (GsearchHistoryEntry *entry)
static void
gsearch_history_entry_save_history (GsearchHistoryEntry *entry)
{
- GSList *gconf_items;
+ GVariant *history;
+ GSList *items;
gchar *key;
+ GVariantBuilder item_builder;
+ GVariantBuilder history_builder;
+ GVariantIter *iter;
+ GVariant *item;
+ GVariant *history_list;
+ GSList *list_iter;
+ gchar *history_key;
g_return_if_fail (GSEARCH_IS_HISTORY_ENTRY (entry));
- gconf_items = get_history_list (entry);
+ items = get_history_list (entry);
key = get_history_key (entry);
- gconf_client_set_list (entry->priv->gconf_client,
- key,
- GCONF_VALUE_STRING,
- gconf_items,
- NULL);
-
- g_slist_foreach (gconf_items, (GFunc) g_free, NULL);
- g_slist_free (gconf_items);
+ history = g_settings_get_value (entry->priv->settings,
+ "search-history");
+
+ g_variant_builder_init (&item_builder, G_VARIANT_TYPE ("as"));
+ for (list_iter = items; list_iter; list_iter = list_iter->next)
+ g_variant_builder_add (&item_builder, "s", (gchar *) list_iter->data);
+
+ g_variant_builder_init (&history_builder, G_VARIANT_TYPE ("a{sas}"));
+ g_variant_builder_add (&history_builder, "{sas}", key, &item_builder);
+
+ if (history) {
+ g_variant_get (history, "a{sas}", &iter);
+ while ((item = g_variant_iter_next_value (iter))) {
+ g_variant_get (item, "{s as}", &history_key, &history_list);
+ if (g_strcmp0 (history_key, key) != 0)
+ g_variant_builder_add (&history_builder, "{s as}", history_key, history_list);
+ g_free (history_key);
+ g_variant_unref (history_list);
+ g_variant_unref (item);
+ }
+ g_variant_iter_free (iter);
+ g_variant_unref (history);
+ }
+
+ g_settings_set_value (entry->priv->settings,
+ "search-history",
+ g_variant_new ("a{sas}", &history_builder));
+
+ g_slist_foreach (items, (GFunc) g_free, NULL);
+ g_slist_free (items);
g_free (key);
}
@@ -377,9 +390,9 @@ gsearch_history_entry_append_text (GsearchHistoryEntry *entry,
static void
gsearch_history_entry_load_history (GsearchHistoryEntry *entry)
{
- GSList *gconf_items, *l;
GtkListStore *store;
GtkTreeIter iter;
+ GVariant *history;
gchar *key;
gint i;
@@ -388,27 +401,45 @@ gsearch_history_entry_load_history (GsearchHistoryEntry *entry)
store = get_history_store (entry);
key = get_history_key (entry);
- gconf_items = gconf_client_get_list (entry->priv->gconf_client,
- key,
- GCONF_VALUE_STRING,
- NULL);
+ history = g_settings_get_value (entry->priv->settings,
+ "search-history");
gtk_list_store_clear (store);
- for (l = gconf_items, i = 0;
- l != NULL && i < entry->priv->history_length;
- l = l->next, i++)
- {
- gtk_list_store_append (store, &iter);
- gtk_list_store_set (store,
- &iter,
- 0,
- l->data,
- -1);
- }
-
- g_slist_foreach (gconf_items, (GFunc) g_free, NULL);
- g_slist_free (gconf_items);
+ if (history) {
+ GVariantIter *history_iter, *history_subiter;
+ GVariant *history_item, *history_subitem;
+ gchar *history_key;
+ gchar *text;
+
+ g_variant_get (history, "a{sas}", &history_iter);
+
+ while ((history_item = g_variant_iter_next_value (history_iter))) {
+ i = 0;
+ g_variant_get (history_item, "{sas}", &history_key, &history_subiter);
+
+ if (g_strcmp0 (history_key, key) == 0) {
+ while ((history_subitem = g_variant_iter_next_value (history_subiter)) &&
+ i < entry->priv->history_length) {
+ g_variant_get (history_subitem, "s", &text);
+ gtk_list_store_append (store, &iter);
+ gtk_list_store_set (store,
+ &iter,
+ 0,
+ text,
+ -1);
+ g_free (text);
+ g_variant_unref (history_subitem);
+ i++;
+ }
+ }
+ g_free (history_key);
+ g_variant_iter_free (history_subiter);
+ g_variant_unref (history_item);
+ }
+ g_variant_iter_free (history_iter);
+ g_variant_unref (history);
+ }
g_free (key);
}
@@ -438,7 +469,7 @@ gsearch_history_entry_init (GsearchHistoryEntry *entry)
priv->completion = NULL;
- priv->gconf_client = gconf_client_get_default ();
+ priv->settings = g_settings_new ("org.gnome.gnome-search-tool");
}
void
diff --git a/src/gsearchtool-callbacks.c b/src/gsearchtool-callbacks.c
index 6660e3c..9b45093 100644
--- a/src/gsearchtool-callbacks.c
+++ b/src/gsearchtool-callbacks.c
@@ -58,12 +58,15 @@ store_window_state_and_geometry (GSearchWindow *gsearch)
gsearch->window_width = MAX (gsearch->window_width, MINIMUM_WINDOW_WIDTH);
gsearch->window_height = MAX (gsearch->window_height, MINIMUM_WINDOW_HEIGHT);
- gsearchtool_gconf_set_int ("/apps/gnome-search-tool/default_window_width",
- gsearch->window_width);
- gsearchtool_gconf_set_int ("/apps/gnome-search-tool/default_window_height",
- gsearch->window_height);
- gsearchtool_gconf_set_boolean ("/apps/gnome-search-tool/default_window_maximized",
- gsearch->is_window_maximized);
+ g_settings_set_int (gsearch->gnome_search_tool_settings,
+ "default-window-width",
+ gsearch->window_width);
+ g_settings_set_int (gsearch->gnome_search_tool_settings,
+ "default-window-height",
+ gsearch->window_height);
+ g_settings_set_boolean (gsearch->gnome_search_tool_settings,
+ "default-window-maximized",
+ gsearch->is_window_maximized);
}
static void
@@ -272,7 +275,7 @@ remove_constraint_cb (GtkWidget * widget,
g_list_remove (gsearch->available_options_selected_list, constraint);
set_constraint_selected_state (gsearch, constraint->constraint_id, FALSE);
- set_constraint_gconf_boolean (constraint->constraint_id, FALSE);
+ set_constraint_gsettings_boolean (constraint->constraint_id, FALSE);
g_slice_free (GSearchConstraint, constraint);
g_list_free (list);
}
@@ -322,7 +325,7 @@ look_in_folder_changed_cb (GtkWidget * widget,
value = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (gsearch->look_in_folder_button));
if (value != NULL) {
- gsearchtool_gconf_set_string ("/apps/gnome-search-tool/look_in_folder", value);
+ g_settings_set_string (gsearch->gnome_search_tool_settings, "look-in-folder", value);
}
g_free (value);
}
@@ -1847,40 +1850,48 @@ disable_quick_search_cb (GtkWidget * dialog,
gint response,
gpointer data)
{
+ GSearchWindow * gsearch = data;
+
gtk_widget_destroy (GTK_WIDGET (dialog));
if (response == GTK_RESPONSE_OK) {
- gsearchtool_gconf_set_boolean ("/apps/gnome-search-tool/disable_quick_search", TRUE);
+ g_settings_set_boolean (gsearch->gnome_search_tool_settings, "disable-quick-search", TRUE);
}
}
void
-single_click_to_activate_key_changed_cb (GConfClient * client,
- guint cnxn_id,
- GConfEntry * entry,
+single_click_to_activate_key_changed_cb (GSettings * settings,
+ gchar * key,
gpointer user_data)
{
GSearchWindow * gsearch = user_data;
- GConfValue * value;
-
- value = gconf_entry_get_value (entry);
+ gchar * value;
- g_return_if_fail (value->type == GCONF_VALUE_STRING);
+ value = g_settings_get_string (settings, key);
gsearch->is_search_results_single_click_to_activate =
- (strncmp (gconf_value_get_string (value), "single", 6) == 0) ? TRUE : FALSE;
+ (strncmp (value, "single", 6) == 0) ? TRUE : FALSE;
+
+ g_free (value);
}
void
columns_changed_cb (GtkTreeView * treeview,
gpointer user_data)
{
+ GVariantBuilder array_builder;
+ GSearchWindow * gsearch = user_data;
GSList * order;
+ GSList * iter;
order = gsearchtool_get_columns_order (treeview);
+ g_variant_builder_init (&array_builder, G_VARIANT_TYPE ("ai"));
+ for (iter = order; iter; iter = iter->next)
+ g_variant_builder_add (&array_builder, "i", GPOINTER_TO_INT (iter->data));
+
if (g_slist_length (order) == NUM_VISIBLE_COLUMNS) {
- gsearchtool_gconf_set_list ("/apps/gnome-search-tool/columns_order", order, GCONF_VALUE_INT);
+ g_settings_set_value (gsearch->gnome_search_tool_settings, "columns-order", g_variant_new ("ai", &array_builder));
}
g_slist_free (order);
}
diff --git a/src/gsearchtool-callbacks.h b/src/gsearchtool-callbacks.h
index 191cc94..ed69970 100644
--- a/src/gsearchtool-callbacks.h
+++ b/src/gsearchtool-callbacks.h
@@ -162,9 +162,8 @@ disable_quick_search_cb (GtkWidget * dialog,
gint response,
gpointer data);
void
-single_click_to_activate_key_changed_cb (GConfClient * client,
- guint cnxn_id,
- GConfEntry * entry,
+single_click_to_activate_key_changed_cb (GSettings * settings,
+ gchar * key,
gpointer user_data);
void
columns_changed_cb (GtkTreeView * treeview,
diff --git a/src/gsearchtool-support.c b/src/gsearchtool-support.c
index d393b45..83aa138 100644
--- a/src/gsearchtool-support.c
+++ b/src/gsearchtool-support.c
@@ -53,252 +53,6 @@ GtkTreeViewColumn *
gsearchtool_gtk_tree_view_get_column_with_sort_column_id (GtkTreeView * treeview,
gint id);
-/* START OF THE GCONF FUNCTIONS */
-
-static gboolean
-gsearchtool_gconf_handle_error (GError ** error)
-{
- if (error != NULL) {
- if (*error != NULL) {
- g_warning (_("GConf error:\n %s"), (*error)->message);
- g_error_free (*error);
- *error = NULL;
- return TRUE;
- }
- }
- return FALSE;
-}
-
-static GConfClient *
-gsearchtool_gconf_client_get_global (void)
-{
- static GConfClient * global_gconf_client = NULL;
-
- /* Initialize gconf if needed */
- if (!gconf_is_initialized ()) {
- char *argv[] = { "gsearchtool-preferences", NULL };
- GError *error = NULL;
-
- if (!gconf_init (1, argv, &error)) {
- if (gsearchtool_gconf_handle_error (&error)) {
- return NULL;
- }
- }
- }
-
- if (global_gconf_client == NULL) {
- global_gconf_client = gconf_client_get_default ();
- }
-
- return global_gconf_client;
-}
-
-char *
-gsearchtool_gconf_get_string (const gchar * key)
-{
- GConfClient * client;
- GError * error = NULL;
- gchar * result;
-
- g_return_val_if_fail (key != NULL, NULL);
-
- client = gsearchtool_gconf_client_get_global ();
- g_return_val_if_fail (client != NULL, NULL);
-
- result = gconf_client_get_string (client, key, &error);
-
- if (gsearchtool_gconf_handle_error (&error)) {
- result = g_strdup ("");
- }
-
- return result;
-}
-
-void
-gsearchtool_gconf_set_string (const gchar * key,
- const gchar * value)
-{
- GConfClient * client;
- GError * error = NULL;
-
- g_return_if_fail (key != NULL);
-
- client = gsearchtool_gconf_client_get_global ();
- g_return_if_fail (client != NULL);
-
- gconf_client_set_string (client, key, value, &error);
-
- gsearchtool_gconf_handle_error (&error);
-
-}
-
-GSList *
-gsearchtool_gconf_get_list (const gchar * key,
- GConfValueType list_type)
-{
- GConfClient * client;
- GError * error = NULL;
- GSList * result;
-
- g_return_val_if_fail (key != NULL, FALSE);
-
- client = gsearchtool_gconf_client_get_global ();
- g_return_val_if_fail (client != NULL, NULL);
-
- result = gconf_client_get_list (client, key, list_type, &error);
-
- if (gsearchtool_gconf_handle_error (&error)) {
- result = NULL;
- }
-
- return result;
-}
-
-void
-gsearchtool_gconf_set_list (const gchar * key,
- GSList * list,
- GConfValueType list_type)
-{
- GConfClient * client;
- GError * error = NULL;
-
- g_return_if_fail (key != NULL);
-
- client = gsearchtool_gconf_client_get_global ();
- g_return_if_fail (client != NULL);
-
- gconf_client_set_list (client, key, list_type, list, &error);
-
- gsearchtool_gconf_handle_error (&error);
-}
-
-gint
-gsearchtool_gconf_get_int (const gchar * key)
-{
- GConfClient * client;
- GError * error = NULL;
- gint result;
-
- g_return_val_if_fail (key != NULL, FALSE);
-
- client = gsearchtool_gconf_client_get_global ();
- g_return_val_if_fail (client != NULL, FALSE);
-
- result = gconf_client_get_int (client, key, &error);
-
- if (gsearchtool_gconf_handle_error (&error)) {
- result = 0;
- }
-
- return result;
-}
-
-void
-gsearchtool_gconf_set_int (const gchar * key,
- const gint value)
-{
- GConfClient * client;
- GError * error = NULL;
-
- g_return_if_fail (key != NULL);
-
- client = gsearchtool_gconf_client_get_global ();
- g_return_if_fail (client != NULL);
-
- gconf_client_set_int (client, key, value, &error);
-
- gsearchtool_gconf_handle_error (&error);
-}
-
-gboolean
-gsearchtool_gconf_get_boolean (const gchar * key)
-{
- GConfClient * client;
- GError * error = NULL;
- gboolean result;
-
- g_return_val_if_fail (key != NULL, FALSE);
-
- client = gsearchtool_gconf_client_get_global ();
- g_return_val_if_fail (client != NULL, FALSE);
-
- result = gconf_client_get_bool (client, key, &error);
-
- if (gsearchtool_gconf_handle_error (&error)) {
- result = FALSE;
- }
-
- return result;
-}
-
-void
-gsearchtool_gconf_set_boolean (const gchar * key,
- const gboolean flag)
-{
- GConfClient * client;
- GError * error = NULL;
-
- g_return_if_fail (key != NULL);
-
- client = gsearchtool_gconf_client_get_global ();
- g_return_if_fail (client != NULL);
-
- gconf_client_set_bool (client, key, flag, &error);
-
- gsearchtool_gconf_handle_error (&error);
-}
-
-void
-gsearchtool_gconf_add_dir (const gchar * dir)
-{
- GConfClient * client;
- GError * error = NULL;
-
- g_return_if_fail (dir != NULL);
-
- client = gsearchtool_gconf_client_get_global ();
- g_return_if_fail (client != NULL);
-
- gconf_client_add_dir (client,
- dir,
- GCONF_CLIENT_PRELOAD_RECURSIVE,
- &error);
-
- gsearchtool_gconf_handle_error (&error);
-}
-
-void
-gsearchtool_gconf_watch_key (const gchar * dir,
- const gchar * key,
- GConfClientNotifyFunc callback,
- gpointer user_data)
-{
- GConfClient * client;
- GError * error = NULL;
-
- g_return_if_fail (key != NULL);
- g_return_if_fail (dir != NULL);
-
- client = gsearchtool_gconf_client_get_global ();
- g_return_if_fail (client != NULL);
-
- gconf_client_add_dir (client,
- dir,
- GCONF_CLIENT_PRELOAD_NONE,
- &error);
-
- gsearchtool_gconf_handle_error (&error);
-
- gconf_client_notify_add (client,
- key,
- callback,
- user_data,
- NULL,
- &error);
-
- gsearchtool_gconf_handle_error (&error);
-}
-
/* START OF GENERIC GNOME-SEARCH-TOOL FUNCTIONS */
gboolean
@@ -334,10 +88,13 @@ is_path_hidden (const gchar * path)
gboolean
is_quick_search_excluded_path (const gchar * path)
{
- GSList * exclude_path_list;
- GSList * tmp_list;
+ GSettings * settings;
+ gchar ** exclude_path_list;
gchar * dir;
gboolean results = FALSE;
+ gint i;
+
+ settings = g_settings_new ("org.gnome.gnome-search-tool");
dir = g_strdup (path);
@@ -355,65 +112,66 @@ is_quick_search_excluded_path (const gchar * path)
g_free (dir);
/* Check path against the Quick-Search-Excluded-Paths list. */
- exclude_path_list = gsearchtool_gconf_get_list ("/apps/gnome-search-tool/quick_search_excluded_paths",
- GCONF_VALUE_STRING);
+ exclude_path_list = g_settings_get_strv (settings, "quick-search-excluded-paths");
- for (tmp_list = exclude_path_list; tmp_list; tmp_list = tmp_list->next) {
+ if (exclude_path_list) {
+ for (i = 0; exclude_path_list[i]; i++) {
- /* Skip empty or null values. */
- if ((tmp_list->data == NULL) || (strlen (tmp_list->data) == 0)) {
- continue;
- }
+ /* Skip empty or null values. */
+ if (strlen (exclude_path_list[i]) == 0) {
+ continue;
+ }
- dir = g_strdup (tmp_list->data);
+ dir = g_strdup (exclude_path_list[i]);
- /* Wild-card comparisons. */
- if (g_strstr_len (dir, strlen (dir), "*") != NULL) {
+ /* Wild-card comparisons. */
+ if (g_strstr_len (dir, strlen (dir), "*") != NULL) {
- if (g_pattern_match_simple (dir, path) == TRUE) {
+ if (g_pattern_match_simple (dir, path) == TRUE) {
- results = TRUE;
- g_free (dir);
- break;
+ results = TRUE;
+ g_free (dir);
+ break;
+ }
}
- }
- /* Non-wild-card comparisons. */
- else {
- /* Add a trailing G_DIR_SEPARATOR. */
- if (g_str_has_suffix (dir, G_DIR_SEPARATOR_S) == FALSE) {
+ /* Non-wild-card comparisons. */
+ else {
+ /* Add a trailing G_DIR_SEPARATOR. */
+ if (g_str_has_suffix (dir, G_DIR_SEPARATOR_S) == FALSE) {
- gchar *tmp;
+ gchar *tmp;
- tmp = dir;
- dir = g_strconcat (dir, G_DIR_SEPARATOR_S, NULL);
- g_free (tmp);
- }
+ tmp = dir;
+ dir = g_strconcat (dir, G_DIR_SEPARATOR_S, NULL);
+ g_free (tmp);
+ }
- if (strcmp (path, dir) == 0) {
+ if (strcmp (path, dir) == 0) {
- results = TRUE;
- g_free (dir);
- break;
+ results = TRUE;
+ g_free (dir);
+ break;
+ }
}
+ g_free (dir);
}
- g_free (dir);
+ g_strfreev (exclude_path_list);
}
- for (tmp_list = exclude_path_list; tmp_list; tmp_list = tmp_list->next) {
- g_free (tmp_list->data);
- }
- g_slist_free (exclude_path_list);
-
+ g_object_unref (settings);
return results;
}
gboolean
is_second_scan_excluded_path (const gchar * path)
{
- GSList * exclude_path_list;
- GSList * tmp_list;
+ GSettings * settings;
+ gchar ** exclude_path_list;
gchar * dir;
gboolean results = FALSE;
+ gint i;
+
+ settings = g_settings_new ("org.gnome.gnome-search-tool");
dir = g_strdup (path);
@@ -431,55 +189,53 @@ is_second_scan_excluded_path (const gchar * path)
g_free (dir);
/* Check path against the Quick-Search-Excluded-Paths list. */
- exclude_path_list = gsearchtool_gconf_get_list ("/apps/gnome-search-tool/quick_search_second_scan_excluded_paths",
- GCONF_VALUE_STRING);
+ exclude_path_list = g_settings_get_strv (settings, "quick-search-second-scan-excluded-paths");
- for (tmp_list = exclude_path_list; tmp_list; tmp_list = tmp_list->next) {
+ if (exclude_path_list) {
+ for (i = 0; exclude_path_list[i]; i++) {
- /* Skip empty or null values. */
- if ((tmp_list->data == NULL) || (strlen (tmp_list->data) == 0)) {
- continue;
- }
+ /* Skip empty or null values. */
+ if (strlen (exclude_path_list[i]) == 0) {
+ continue;
+ }
- dir = g_strdup (tmp_list->data);
+ dir = g_strdup (exclude_path_list[i]);
- /* Wild-card comparisons. */
- if (g_strstr_len (dir, strlen (dir), "*") != NULL) {
+ /* Wild-card comparisons. */
+ if (g_strstr_len (dir, strlen (dir), "*") != NULL) {
- if (g_pattern_match_simple (dir, path) == TRUE) {
+ if (g_pattern_match_simple (dir, path) == TRUE) {
- results = TRUE;
- g_free (dir);
- break;
+ results = TRUE;
+ g_free (dir);
+ break;
+ }
}
- }
- /* Non-wild-card comparisons. */
- else {
- /* Add a trailing G_DIR_SEPARATOR. */
- if (g_str_has_suffix (dir, G_DIR_SEPARATOR_S) == FALSE) {
+ /* Non-wild-card comparisons. */
+ else {
+ /* Add a trailing G_DIR_SEPARATOR. */
+ if (g_str_has_suffix (dir, G_DIR_SEPARATOR_S) == FALSE) {
- gchar *tmp;
+ gchar *tmp;
- tmp = dir;
- dir = g_strconcat (dir, G_DIR_SEPARATOR_S, NULL);
- g_free (tmp);
- }
+ tmp = dir;
+ dir = g_strconcat (dir, G_DIR_SEPARATOR_S, NULL);
+ g_free (tmp);
+ }
- if (strcmp (path, dir) == 0) {
+ if (strcmp (path, dir) == 0) {
- results = TRUE;
- g_free (dir);
- break;
+ results = TRUE;
+ g_free (dir);
+ break;
+ }
}
+ g_free (dir);
}
- g_free (dir);
- }
-
- for (tmp_list = exclude_path_list; tmp_list; tmp_list = tmp_list->next) {
- g_free (tmp_list->data);
+ g_strfreev (exclude_path_list);
}
- g_slist_free (exclude_path_list);
+ g_object_unref (settings);
return results;
}
@@ -1435,35 +1191,47 @@ void
gsearchtool_set_columns_order (GtkTreeView * treeview)
{
GtkTreeViewColumn * last = NULL;
- GSList * order;
- GSList * it;
+ GSettings * settings;
+ GVariant * value;
- order = gsearchtool_gconf_get_list ("/apps/gnome-search-tool/columns_order", GCONF_VALUE_INT);
+ settings = g_settings_new ("org.gnome.gnome-search-tool");
- for (it = order; it; it = it->next) {
+ value = g_settings_get_value (settings, "columns-order");
- GtkTreeViewColumn * cur;
- gint id;
+ if (value) {
+ GVariantIter *iter;
+ GVariant *item;
+
+ g_variant_get (value, "ai", &iter);
+
+ while ((item = g_variant_iter_next_value (iter))) {
+ GtkTreeViewColumn * cur;
+ gint id;
- id = GPOINTER_TO_INT (it->data);
+ g_variant_get (item, "i", &id);
- if (id >= 0 && id < NUM_COLUMNS) {
+ if (id >= 0 && id < NUM_COLUMNS) {
- cur = gsearchtool_gtk_tree_view_get_column_with_sort_column_id (treeview, id);
+ cur = gsearchtool_gtk_tree_view_get_column_with_sort_column_id (treeview, id);
- if (cur && cur != last) {
- gtk_tree_view_move_column_after (treeview, cur, last);
- last = cur;
+ if (cur && cur != last) {
+ gtk_tree_view_move_column_after (treeview, cur, last);
+ last = cur;
+ }
}
+ g_variant_unref (item);
}
+ g_variant_iter_free (iter);
+ g_variant_unref (value);
}
- g_slist_free (order);
+ g_object_unref (settings);
}
void
gsearchtool_get_stored_window_geometry (gint * width,
gint * height)
{
+ GSettings * settings;
gint saved_width;
gint saved_height;
@@ -1471,8 +1239,10 @@ gsearchtool_get_stored_window_geometry (gint * width,
return;
}
- saved_width = gsearchtool_gconf_get_int ("/apps/gnome-search-tool/default_window_width");
- saved_height = gsearchtool_gconf_get_int ("/apps/gnome-search-tool/default_window_height");
+ settings = g_settings_new ("org.gnome.gnome-search-tool");
+
+ saved_width = g_settings_get_int (settings, "default-window-width");
+ saved_height = g_settings_get_int (settings, "default-window-height");
if (saved_width == -1) {
saved_width = DEFAULT_WINDOW_WIDTH;
@@ -1484,6 +1254,7 @@ gsearchtool_get_stored_window_geometry (gint * width,
*width = MAX (saved_width, MINIMUM_WINDOW_WIDTH);
*height = MAX (saved_height, MINIMUM_WINDOW_HEIGHT);
+ g_object_unref (settings);
}
/* START OF NAUTILUS/EEL FUNCTIONS: USED FOR HANDLING OF DUPLICATE FILENAMES */
diff --git a/src/gsearchtool-support.h b/src/gsearchtool-support.h
index e6f6ebf..f9f2009 100644
--- a/src/gsearchtool-support.h
+++ b/src/gsearchtool-support.h
@@ -38,40 +38,6 @@ extern "C" {
#define ICON_SIZE 24
gboolean
-gsearchtool_gconf_get_boolean (const gchar * key);
-
-void
-gsearchtool_gconf_set_boolean (const gchar * key,
- const gboolean flag);
-gint
-gsearchtool_gconf_get_int (const gchar * key);
-
-void
-gsearchtool_gconf_set_int (const gchar * key,
- const gint value);
-char *
-gsearchtool_gconf_get_string (const gchar * key);
-
-void
-gsearchtool_gconf_set_string (const gchar * key,
- const gchar * value);
-
-GSList *
-gsearchtool_gconf_get_list (const gchar * key,
- GConfValueType list_type);
-void
-gsearchtool_gconf_set_list (const gchar * key,
- GSList * list,
- GConfValueType list_type);
-void
-gsearchtool_gconf_add_dir (const gchar * dir);
-
-void
-gsearchtool_gconf_watch_key (const gchar * dir,
- const gchar * key,
- GConfClientNotifyFunc callback,
- gpointer user_data);
-gboolean
is_path_hidden (const gchar * path);
gboolean
diff --git a/src/gsearchtool.c b/src/gsearchtool.c
index ae7fdc8..ffdfadd 100644
--- a/src/gsearchtool.c
+++ b/src/gsearchtool.c
@@ -507,7 +507,7 @@ start_animation (GSearchWindow * gsearch, gboolean first_pass)
gtk_window_set_title (GTK_WINDOW (gsearch->window), title);
gtk_label_set_text (GTK_LABEL (gsearch->files_found_label), "");
- if (gsearchtool_gconf_get_boolean ("/desktop/gnome/interface/enable_animations")) {
+ if (g_settings_get_boolean (gsearch->gnome_desktop_interface_settings, "enable-animations")) {
gtk_spinner_start (GTK_SPINNER (gsearch->progress_spinner));
gtk_widget_show (gsearch->progress_spinner);
}
@@ -650,23 +650,27 @@ build_search_command (GSearchWindow * gsearch,
if (gsearch->command_details->is_command_first_pass == TRUE) {
gchar * locate;
- gchar * show_thumbnails_string;
+ NautilusSpeedTradeoff show_thumbnails_enum;
gboolean disable_quick_search;
locate = g_find_program_in_path ("locate");
- disable_quick_search = gsearchtool_gconf_get_boolean ("/apps/gnome-search-tool/disable_quick_search");
- gsearch->command_details->is_command_second_pass_enabled = !gsearchtool_gconf_get_boolean ("/apps/gnome-search-tool/disable_quick_search_second_scan");
+ disable_quick_search = g_settings_get_boolean (gsearch->gnome_search_tool_settings, "disable-quick-search");
+ gsearch->command_details->is_command_second_pass_enabled = !g_settings_get_boolean (gsearch->gnome_search_tool_settings, "disable-quick-search-second-scan");
+
+ show_thumbnails_enum = g_settings_get_enum (gsearch->nautilus_settings, "show-image-thumbnails");
+ if (show_thumbnails_enum == SPEED_TRADEOFF_ALWAYS ||
+ show_thumbnails_enum == SPEED_TRADEOFF_LOCAL_ONLY) {
+ GVariant * value;
+ guint64 size_limit = 10485760;
- show_thumbnails_string = gsearchtool_gconf_get_string ("/apps/nautilus/preferences/show_image_thumbnails");
- if ((show_thumbnails_string != NULL) &&
- ((strcmp (show_thumbnails_string, "always") == 0) ||
- (strcmp (show_thumbnails_string, "local_only") == 0))) {
gsearch->show_thumbnails = TRUE;
- gsearch->show_thumbnails_file_size_limit = gsearchtool_gconf_get_int ("/apps/nautilus/preferences/thumbnail_limit");
- }
- else if (show_thumbnails_string == NULL) { /* FIXME: Nautilus 3.0 uses dconf -- for now fallback to the defaults. */
- gsearch->show_thumbnails = TRUE;
- gsearch->show_thumbnails_file_size_limit = 10485760;
+
+ value = g_settings_get_value (gsearch->nautilus_settings, "thumbnail-limit");
+ if (value) {
+ size_limit = g_variant_get_uint64 (value);
+ g_variant_unref (value);
+ }
+ gsearch->show_thumbnails_file_size_limit = size_limit;
}
else {
gsearch->show_thumbnails = FALSE;
@@ -692,7 +696,6 @@ build_search_command (GSearchWindow * gsearch,
file_is_named_escaped);
}
g_free (locate);
- g_free (show_thumbnails_string);
}
else {
g_string_append_printf (command, "find \"%s\" %s \"%s\" -print",
@@ -1154,71 +1157,76 @@ set_constraint_selected_state (GSearchWindow * gsearch,
}
void
-set_constraint_gconf_boolean (gint constraint_id,
- gboolean flag)
+set_constraint_gsettings_boolean (gint constraint_id,
+ gboolean flag)
{
+ GSettings * select_settings;
+
+ select_settings = g_settings_new ("org.gnome.gnome-search-tool.select");
+
switch (constraint_id) {
case SEARCH_CONSTRAINT_CONTAINS_THE_TEXT:
- gsearchtool_gconf_set_boolean ("/apps/gnome-search-tool/select/contains_the_text",
- flag);
+ g_settings_set_boolean (select_settings, "contains-the-text",
+ flag);
break;
case SEARCH_CONSTRAINT_DATE_MODIFIED_BEFORE:
- gsearchtool_gconf_set_boolean ("/apps/gnome-search-tool/select/date_modified_less_than",
- flag);
+ g_settings_set_boolean (select_settings, "date-modified-less-than",
+ flag);
break;
case SEARCH_CONSTRAINT_DATE_MODIFIED_AFTER:
- gsearchtool_gconf_set_boolean ("/apps/gnome-search-tool/select/date_modified_more_than",
- flag);
+ g_settings_set_boolean (select_settings, "date-modified-more-than",
+ flag);
break;
case SEARCH_CONSTRAINT_SIZE_IS_MORE_THAN:
- gsearchtool_gconf_set_boolean ("/apps/gnome-search-tool/select/size_at_least",
- flag);
+ g_settings_set_boolean (select_settings, "size-at-least",
+ flag);
break;
case SEARCH_CONSTRAINT_SIZE_IS_LESS_THAN:
- gsearchtool_gconf_set_boolean ("/apps/gnome-search-tool/select/size_at_most",
- flag);
+ g_settings_set_boolean (select_settings, "size-at-most",
+ flag);
break;
case SEARCH_CONSTRAINT_FILE_IS_EMPTY:
- gsearchtool_gconf_set_boolean ("/apps/gnome-search-tool/select/file_is_empty",
- flag);
+ g_settings_set_boolean (select_settings, "file-is-empty",
+ flag);
break;
case SEARCH_CONSTRAINT_OWNED_BY_USER:
- gsearchtool_gconf_set_boolean ("/apps/gnome-search-tool/select/owned_by_user",
- flag);
+ g_settings_set_boolean (select_settings, "owned-by-user",
+ flag);
break;
case SEARCH_CONSTRAINT_OWNED_BY_GROUP:
- gsearchtool_gconf_set_boolean ("/apps/gnome-search-tool/select/owned_by_group",
- flag);
+ g_settings_set_boolean (select_settings, "owned-by-group",
+ flag);
break;
case SEARCH_CONSTRAINT_OWNER_IS_UNRECOGNIZED:
- gsearchtool_gconf_set_boolean ("/apps/gnome-search-tool/select/owner_is_unrecognized",
- flag);
+ g_settings_set_boolean (select_settings, "owner-is-unrecognized",
+ flag);
break;
case SEARCH_CONSTRAINT_FILE_IS_NOT_NAMED:
- gsearchtool_gconf_set_boolean ("/apps/gnome-search-tool/select/name_does_not_contain",
- flag);
+ g_settings_set_boolean (select_settings, "name-does-not-contain",
+ flag);
break;
case SEARCH_CONSTRAINT_FILE_MATCHES_REGULAR_EXPRESSION:
- gsearchtool_gconf_set_boolean ("/apps/gnome-search-tool/select/name_matches_regular_expression",
- flag);
+ g_settings_set_boolean (select_settings, "name-matches-regular-expression",
+ flag);
break;
case SEARCH_CONSTRAINT_SHOW_HIDDEN_FILES_AND_FOLDERS:
- gsearchtool_gconf_set_boolean ("/apps/gnome-search-tool/select/show_hidden_files_and_folders",
- flag);
+ g_settings_set_boolean (select_settings, "show-hidden-files-and-folders",
+ flag);
break;
case SEARCH_CONSTRAINT_FOLLOW_SYMBOLIC_LINKS:
- gsearchtool_gconf_set_boolean ("/apps/gnome-search-tool/select/follow_symbolic_links",
- flag);
+ g_settings_set_boolean (select_settings, "follow-symbolic-links",
+ flag);
break;
case SEARCH_CONSTRAINT_SEARCH_OTHER_FILESYSTEMS:
- gsearchtool_gconf_set_boolean ("/apps/gnome-search-tool/select/exclude_other_filesystems",
- flag);
+ g_settings_set_boolean (select_settings, "exclude-other-filesystems",
+ flag);
break;
default:
break;
}
+ g_object_unref (select_settings);
}
/*
@@ -1878,8 +1886,8 @@ spawn_search_command (GSearchWindow * gsearch,
gsearch->search_results_pixbuf_hash_table = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
gsearch->search_results_filename_hash_table = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
- /* Get value of nautilus date_format key */
- gsearch->search_results_date_format_string = gsearchtool_gconf_get_string ("/apps/nautilus/preferences/date_format");
+ /* Use default value of nautilus date_format key before it was removed */
+ gsearch->search_results_date_format_string = g_strdup ("locale");
gtk_tree_view_scroll_to_point (GTK_TREE_VIEW (gsearch->search_results_tree_view), 0, 0);
gtk_tree_model_foreach (GTK_TREE_MODEL (gsearch->search_results_list_store),
@@ -2073,7 +2081,7 @@ add_constraint (GSearchWindow * gsearch,
constraint->constraint_id = constraint_id;
set_constraint_info_defaults (constraint);
- set_constraint_gconf_boolean (constraint->constraint_id, TRUE);
+ set_constraint_gsettings_boolean (constraint->constraint_id, TRUE);
widget = create_constraint_box (gsearch, constraint, value);
gtk_box_pack_start (GTK_BOX (gsearch->available_options_vbox), widget, FALSE, FALSE, 0);
@@ -2617,70 +2625,68 @@ set_clone_command (GSearchWindow * gsearch,
}
static void
-handle_gconf_settings (GSearchWindow * gsearch)
+handle_gsettings_settings (GSearchWindow * gsearch)
{
- gsearchtool_gconf_add_dir ("/apps/gnome-search-tool");
-
- if (gsearchtool_gconf_get_boolean ("/apps/gnome-search-tool/show_additional_options")) {
+ if (g_settings_get_boolean (gsearch->gnome_search_tool_settings, "show-additional-options")) {
if (gtk_widget_get_visible (gsearch->available_options_vbox) == FALSE) {
gtk_expander_set_expanded (GTK_EXPANDER (gsearch->show_more_options_expander), TRUE);
gtk_widget_show (gsearch->available_options_vbox);
}
}
- if (gsearchtool_gconf_get_boolean ("/apps/gnome-search-tool/select/contains_the_text")) {
+ if (g_settings_get_boolean (gsearch->gnome_search_tool_select_settings, "contains-the-text")) {
add_constraint (gsearch, SEARCH_CONSTRAINT_CONTAINS_THE_TEXT, "", FALSE);
}
- if (gsearchtool_gconf_get_boolean ("/apps/gnome-search-tool/select/date_modified_less_than")) {
+ if (g_settings_get_boolean (gsearch->gnome_search_tool_select_settings, "date-modified-less-than")) {
add_constraint (gsearch, SEARCH_CONSTRAINT_DATE_MODIFIED_BEFORE, "", FALSE);
}
- if (gsearchtool_gconf_get_boolean ("/apps/gnome-search-tool/select/date_modified_more_than")) {
+ if (g_settings_get_boolean (gsearch->gnome_search_tool_select_settings, "date-modified-more-than")) {
add_constraint (gsearch, SEARCH_CONSTRAINT_DATE_MODIFIED_AFTER, "", FALSE);
}
- if (gsearchtool_gconf_get_boolean ("/apps/gnome-search-tool/select/size_at_least")) {
+ if (g_settings_get_boolean (gsearch->gnome_search_tool_select_settings, "size-at-least")) {
add_constraint (gsearch, SEARCH_CONSTRAINT_SIZE_IS_MORE_THAN, "", FALSE);
}
- if (gsearchtool_gconf_get_boolean ("/apps/gnome-search-tool/select/size_at_most")) {
+ if (g_settings_get_boolean (gsearch->gnome_search_tool_select_settings, "size-at-most")) {
add_constraint (gsearch, SEARCH_CONSTRAINT_SIZE_IS_LESS_THAN, "", FALSE);
}
- if (gsearchtool_gconf_get_boolean ("/apps/gnome-search-tool/select/file_is_empty")) {
+ if (g_settings_get_boolean (gsearch->gnome_search_tool_select_settings, "file-is-empty")) {
add_constraint (gsearch, SEARCH_CONSTRAINT_FILE_IS_EMPTY, NULL, FALSE);
}
- if (gsearchtool_gconf_get_boolean ("/apps/gnome-search-tool/select/owned_by_user")) {
+ if (g_settings_get_boolean (gsearch->gnome_search_tool_select_settings, "owned-by-user")) {
add_constraint (gsearch, SEARCH_CONSTRAINT_OWNED_BY_USER, "", FALSE);
}
- if (gsearchtool_gconf_get_boolean ("/apps/gnome-search-tool/select/owned_by_group")) {
+ if (g_settings_get_boolean (gsearch->gnome_search_tool_select_settings, "owned-by-group")) {
add_constraint (gsearch, SEARCH_CONSTRAINT_OWNED_BY_GROUP, "", FALSE);
}
- if (gsearchtool_gconf_get_boolean ("/apps/gnome-search-tool/select/owner_is_unrecognized")) {
+ if (g_settings_get_boolean (gsearch->gnome_search_tool_select_settings, "owner-is-unrecognized")) {
add_constraint (gsearch, SEARCH_CONSTRAINT_OWNER_IS_UNRECOGNIZED, NULL, FALSE);
}
- if (gsearchtool_gconf_get_boolean ("/apps/gnome-search-tool/select/name_does_not_contain")) {
+ if (g_settings_get_boolean (gsearch->gnome_search_tool_select_settings, "name-does-not-contain")) {
add_constraint (gsearch, SEARCH_CONSTRAINT_FILE_IS_NOT_NAMED, "", FALSE);
}
- if (gsearchtool_gconf_get_boolean ("/apps/gnome-search-tool/select/name_matches_regular_expression")) {
+ if (g_settings_get_boolean (gsearch->gnome_search_tool_select_settings, "name-matches-regular-expression")) {
add_constraint (gsearch, SEARCH_CONSTRAINT_FILE_MATCHES_REGULAR_EXPRESSION, "", FALSE);
}
- if (gsearchtool_gconf_get_boolean ("/apps/gnome-search-tool/select/show_hidden_files_and_folders")) {
+ if (g_settings_get_boolean (gsearch->gnome_search_tool_select_settings, "show-hidden-files-and-folders")) {
add_constraint (gsearch, SEARCH_CONSTRAINT_SHOW_HIDDEN_FILES_AND_FOLDERS, NULL, FALSE);
}
- if (gsearchtool_gconf_get_boolean ("/apps/gnome-search-tool/select/follow_symbolic_links")) {
+ if (g_settings_get_boolean (gsearch->gnome_search_tool_select_settings, "follow-symbolic-links")) {
add_constraint (gsearch, SEARCH_CONSTRAINT_FOLLOW_SYMBOLIC_LINKS, NULL, FALSE);
}
- if (gsearchtool_gconf_get_boolean ("/apps/gnome-search-tool/select/exclude_other_filesystems")) {
+ if (g_settings_get_boolean (gsearch->gnome_search_tool_select_settings, "exclude-other-filesystems")) {
add_constraint (gsearch, SEARCH_CONSTRAINT_SEARCH_OTHER_FILESYSTEMS, NULL, FALSE);
}
}
@@ -2708,8 +2714,13 @@ gsearch_app_create (GSearchWindow * gsearch)
GtkWidget * button;
GtkWidget * container;
+ gsearch->gnome_search_tool_settings = g_settings_new ("org.gnome.gnome-search-tool");
+ gsearch->gnome_search_tool_select_settings = g_settings_new ("org.gnome.gnome-search-tool.select");
+ gsearch->gnome_desktop_interface_settings = g_settings_new ("org.gnome.desktop.interface");
+ gsearch->nautilus_settings = g_settings_new ("org.gnome.nautilus.preferences");
+
gsearch->window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gsearch->is_window_maximized = gsearchtool_gconf_get_boolean ("/apps/gnome-search-tool/default_window_maximized");
+ gsearch->is_window_maximized = g_settings_get_boolean (gsearch->gnome_search_tool_settings, "default-window-maximized");
g_signal_connect (G_OBJECT (gsearch->window), "size-allocate",
G_CALLBACK (gsearch_window_size_allocate),
gsearch);
@@ -2782,7 +2793,7 @@ gsearch_app_create (GSearchWindow * gsearch)
add_atk_namedesc (GTK_WIDGET (gsearch->look_in_folder_button), _("Look in folder"), _("Select the folder or device from which you want to begin the search."));
}
- locale_string = gsearchtool_gconf_get_string ("/apps/gnome-search-tool/look_in_folder");
+ locale_string = g_settings_get_string (gsearch->gnome_search_tool_settings, "look-in-folder");
if ((g_file_test (locale_string, G_FILE_TEST_EXISTS) == FALSE) ||
(g_file_test (locale_string, G_FILE_TEST_IS_DIR) == FALSE)) {
@@ -2919,13 +2930,13 @@ gsearch_window_get_type (void)
}
static void
-gsearchtool_setup_gconf_notifications (GSearchWindow * gsearch)
+gsearchtool_setup_gsettings_notifications (GSearchWindow * gsearch)
{
gchar * click_to_activate_pref;
/* Get value of nautilus click behavior (single or double click to activate items) */
- click_to_activate_pref = gsearchtool_gconf_get_string ("/apps/nautilus/preferences/click_policy");
+ click_to_activate_pref = g_settings_get_string (gsearch->nautilus_settings, "click-policy");
if (click_to_activate_pref == NULL) {
gsearch->is_search_results_single_click_to_activate = FALSE;
@@ -2935,10 +2946,10 @@ gsearchtool_setup_gconf_notifications (GSearchWindow * gsearch)
gsearch->is_search_results_single_click_to_activate =
(strncmp (click_to_activate_pref, "single", 6) == 0) ? TRUE : FALSE;
- gsearchtool_gconf_watch_key ("/apps/nautilus/preferences",
- "/apps/nautilus/preferences/click_policy",
- (GConfClientNotifyFunc) single_click_to_activate_key_changed_cb,
- gsearch);
+ g_signal_connect (gsearch->nautilus_settings,
+ "changed::click-policy",
+ G_CALLBACK (single_click_to_activate_key_changed_cb),
+ gsearch);
g_free (click_to_activate_pref);
}
@@ -3005,10 +3016,10 @@ main (int argc,
gtk_widget_show (gsearch->window);
- gsearchtool_setup_gconf_notifications (gsearch);
+ gsearchtool_setup_gsettings_notifications (gsearch);
if (handle_goption_args (gsearch) == FALSE) {
- handle_gconf_settings (gsearch);
+ handle_gsettings_settings (gsearch);
}
gtk_main ();
diff --git a/src/gsearchtool.h b/src/gsearchtool.h
index ecd6781..b56e6ed 100644
--- a/src/gsearchtool.h
+++ b/src/gsearchtool.h
@@ -34,8 +34,6 @@ extern "C" {
#endif
#include <gtk/gtk.h>
-#include <gconf/gconf.h>
-#include <gconf/gconf-client.h>
#define GSEARCH_TYPE_WINDOW gsearch_window_get_type()
#define GSEARCH_WINDOW(obj) \
@@ -66,6 +64,12 @@ typedef enum {
} GSearchCommandStatus;
typedef enum {
+ SPEED_TRADEOFF_ALWAYS = 0,
+ SPEED_TRADEOFF_LOCAL_ONLY,
+ SPEED_TRADEOFF_NEVER
+} NautilusSpeedTradeoff;
+
+typedef enum {
COLUMN_ICON,
COLUMN_NAME,
COLUMN_RELATIVE_PATH,
@@ -139,6 +143,11 @@ struct _GSearchWindow {
gchar * save_results_as_default_filename;
+ GSettings * gnome_search_tool_settings;
+ GSettings * gnome_search_tool_select_settings;
+ GSettings * gnome_desktop_interface_settings;
+ GSettings * nautilus_settings;
+
GSearchCommandDetails * command_details;
};
@@ -198,8 +207,8 @@ void
remove_constraint (gint constraint_id);
void
-set_constraint_gconf_boolean (gint constraint_id,
- gboolean flag);
+set_constraint_gsettings_boolean (gint constraint_id,
+ gboolean flag);
void
set_constraint_selected_state (GSearchWindow * gsearch,
gint constraint_id,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]