diff options
author | Stefano Karapetsas <[email protected]> | 2013-01-04 02:52:49 -0800 |
---|---|---|
committer | Stefano Karapetsas <[email protected]> | 2013-01-04 02:52:49 -0800 |
commit | 4c9c8d23685d45020a42cd21f88786444e318661 (patch) | |
tree | 7ec02d49920a01c01b0607dc2c8b3bada11a0bc1 | |
parent | a97efe514b474d2646246e98624b2a9ee38d688e (diff) | |
parent | f4133f57ea4b265e9db1065c7a3b9f33bb5bb5c8 (diff) | |
download | mate-utils-4c9c8d23685d45020a42cd21f88786444e318661.tar.bz2 mate-utils-4c9c8d23685d45020a42cd21f88786444e318661.tar.xz |
Merge pull request #17 from bhull2010/master
Port mate-search-tool to Gsettings
-rw-r--r-- | gsearchtool/Makefile.am | 42 | ||||
-rw-r--r-- | gsearchtool/gsearchtool-callbacks.c | 55 | ||||
-rw-r--r-- | gsearchtool/gsearchtool-callbacks.h | 5 | ||||
-rw-r--r-- | gsearchtool/gsearchtool-support.c | 480 | ||||
-rw-r--r-- | gsearchtool/gsearchtool-support.h | 36 | ||||
-rw-r--r-- | gsearchtool/gsearchtool.c | 218 | ||||
-rw-r--r-- | gsearchtool/gsearchtool.h | 27 | ||||
-rw-r--r-- | gsearchtool/help/C/mate-search-tool.xml | 18 | ||||
-rw-r--r-- | gsearchtool/libmateui-deprecated/Makefile.am | 25 | ||||
-rw-r--r-- | gsearchtool/libmateui-deprecated/gsearchtool-entry.c | 143 | ||||
-rw-r--r-- | gsearchtool/mate-search-tool.convert | 27 | ||||
-rw-r--r-- | gsearchtool/mate-search-tool.schemas.in | 393 | ||||
-rw-r--r-- | gsearchtool/org.mate.search-tool.gschema.xml.in | 117 | ||||
-rw-r--r-- | po/POTFILES.in | 6 |
14 files changed, 593 insertions, 999 deletions
diff --git a/gsearchtool/Makefile.am b/gsearchtool/Makefile.am index 77c66581..4431cb02 100644 --- a/gsearchtool/Makefile.am +++ b/gsearchtool/Makefile.am @@ -3,8 +3,6 @@ Utilitiesdir = $(datadir)/applications SUBDIRS = data help libmateui-deprecated INCLUDES = \ - $(MATE_UTILS_CFLAGS) \ - $(GIO_UNIX_CFLAGS) \ -I$(srcdir)/libmateui-deprecated \ -I$(top_srcdir)/libeggsmclient \ -DG_DISABLE_DEPRECATED \ @@ -18,10 +16,16 @@ libeggsmclient_LIB = $(top_builddir)/libeggsmclient/libeggsmclient.la bin_PROGRAMS = mate-search-tool -schemadir = $(MATECONF_SCHEMA_FILE_DIR) -schema_in_file = mate-search-tool.schemas.in -schema_DATA = $(schema_in_file:.schemas.in=.schemas) -@INTLTOOL_SCHEMAS_RULE@ +gsettingsschema_in_files = org.mate.search-tool.gschema.xml.in +gsettings_SCHEMAS = $(gsettingsschema_in_files:.xml.in=.xml) +.PRECIOUS: $(gsettings_SCHEMAS) + +@INTLTOOL_XML_NOMERGE_RULE@ + +@GSETTINGS_RULES@ + +convertdir = $(datadir)/MateConf/gsettings +convert_DATA = mate-search-tool.convert mate_search_tool_SOURCES = \ gsearchtool-support.c \ @@ -31,9 +35,17 @@ mate_search_tool_SOURCES = \ gsearchtool.c \ gsearchtool.h +mate_search_tool_CFLAGS = \ + $(GLIB_CFLAGS) \ + $(GIO_CFLAGS) \ + $(GIO_UNIX_CFLAGS) \ + $(GTK_CFLAGS) + mate_search_tool_LDADD = \ - $(MATE_UTILS_LIBS) \ - $(GIO_UNIX_LIBS) \ + $(GLIB_LIBS) \ + $(GIO_LIBS) \ + $(GIO_UNIX_LIBS) \ + $(GTK_LIBS) \ $(libmateui_deprecated_LIB) \ $(libeggsmclient_LIB) @@ -46,21 +58,13 @@ Utilities_DATA = $(Utilities_in_files:.desktop.in=.desktop) EXTRA_DIST = \ $(Utilities_in_files) \ $(Utilities_DATA) \ - $(schema_in_file) \ + $(gsettingsschema_in_files) \ $(man_MANS) -if MATECONF_SCHEMAS_INSTALL -install-data-local: - if test -z "$(DESTDIR)" ; then \ - MATECONF_CONFIG_SOURCE=$(MATECONF_SCHEMA_CONFIG_SOURCE) $(MATECONFTOOL) --makefile-install-rule $(top_builddir)/gsearchtool/$(schema_DATA) ; \ - fi -else -install-data-local: -endif - CLEANFILES = \ mate-search-tool.desktop \ - $(schema_DATA) + $(convert_DATA) \ + $(gsettings_SCHEMAS) disthook: cd $(distdir) ; rm -f $(CLEANFILES) diff --git a/gsearchtool/gsearchtool-callbacks.c b/gsearchtool/gsearchtool-callbacks.c index 7dc270a7..cbaea560 100644 --- a/gsearchtool/gsearchtool-callbacks.c +++ b/gsearchtool/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_mateconf_set_int ("/apps/mate-search-tool/default_window_width", - gsearch->window_width); - gsearchtool_mateconf_set_int ("/apps/mate-search-tool/default_window_height", - gsearch->window_height); - gsearchtool_mateconf_set_boolean ("/apps/mate-search-tool/default_window_maximized", - gsearch->is_window_maximized); + g_settings_set_int (gsearch->mate_search_tool_settings, + "default-window-width", + gsearch->window_width); + g_settings_set_int (gsearch->mate_search_tool_settings, + "default-window-height", + gsearch->window_height); + g_settings_set_boolean (gsearch->mate_search_tool_settings, + "default-window-maximized", + gsearch->is_window_maximized); } static void @@ -270,13 +273,13 @@ remove_constraint_cb (GtkWidget * widget, &gsearch->window_geometry, GDK_HINT_MIN_SIZE); - gtk_container_remove (GTK_CONTAINER (gsearch->available_options_vbox), widget->parent); + gtk_container_remove (GTK_CONTAINER (gsearch->available_options_vbox), gtk_widget_get_parent (widget)); gsearch->available_options_selected_list = g_list_remove (gsearch->available_options_selected_list, constraint); set_constraint_selected_state (gsearch, constraint->constraint_id, FALSE); - set_constraint_mateconf_boolean (constraint->constraint_id, FALSE); + set_constraint_gsettings_boolean (constraint->constraint_id, FALSE); g_slice_free (GSearchConstraint, constraint); g_list_free (list); } @@ -326,7 +329,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_mateconf_set_string ("/apps/mate-search-tool/look_in_folder", value); + g_settings_set_string (gsearch->mate_search_tool_settings, "look-in-folder", value); } g_free (value); } @@ -493,7 +496,7 @@ open_file_cb (GtkMenuItem * action, if (!no_files_found) { GAppInfo * app = NULL; - if (GTK_IS_OBJECT (action)) { + if (GTK_IS_MENU_ITEM (action)) { app = g_object_get_data (G_OBJECT (action), "app"); } @@ -1073,6 +1076,7 @@ build_popup_menu_for_file (GSearchWindow * gsearch, /* Popup menu item: Open with (default) */ str = g_strdup_printf (_("_Open with %s"), g_app_info_get_name (list->data)); new1 = gtk_image_menu_item_new_with_mnemonic (str); + g_free (str); gtk_widget_show (new1); g_object_set_data_full (G_OBJECT (new1), "app", (GAppInfo *)list->data, @@ -1112,6 +1116,7 @@ build_popup_menu_for_file (GSearchWindow * gsearch, } new1 = gtk_image_menu_item_new_with_mnemonic (str); + g_free (str); gtk_widget_show (new1); g_object_set_data_full (G_OBJECT (new1), "app", (GAppInfo *)list->data, @@ -1579,7 +1584,7 @@ drag_file_cb (GtkWidget * widget, uri_list = g_strconcat (uri_list, "\n", tmp_uri, NULL); } gtk_selection_data_set (selection_data, - selection_data->target, + gtk_selection_data_get_target (selection_data), 8, (guchar *) uri_list, strlen (uri_list)); @@ -1889,40 +1894,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_mateconf_set_boolean ("/apps/mate-search-tool/disable_quick_search", TRUE); + g_settings_set_boolean (gsearch->mate_search_tool_settings, "disable-quick-search", TRUE); } } void -single_click_to_activate_key_changed_cb (MateConfClient * client, - guint cnxn_id, - MateConfEntry * entry, +single_click_to_activate_key_changed_cb (GSettings * settings, + gchar * key, gpointer user_data) { GSearchWindow * gsearch = user_data; - MateConfValue * value; - - value = mateconf_entry_get_value (entry); + gchar * value; - g_return_if_fail (value->type == MATECONF_VALUE_STRING); + value = g_settings_get_string (settings, key); gsearch->is_search_results_single_click_to_activate = - (strncmp (mateconf_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_mateconf_set_list ("/apps/mate-search-tool/columns_order", order, MATECONF_VALUE_INT); + g_settings_set_value (gsearch->mate_search_tool_settings, "columns-order", g_variant_new ("ai", &array_builder)); } g_slist_free (order); } diff --git a/gsearchtool/gsearchtool-callbacks.h b/gsearchtool/gsearchtool-callbacks.h index 42b9abb3..b3adfcb3 100644 --- a/gsearchtool/gsearchtool-callbacks.h +++ b/gsearchtool/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 (MateConfClient * client, - guint cnxn_id, - MateConfEntry * entry, +single_click_to_activate_key_changed_cb (GSettings * settings, + gchar * key, gpointer user_data); void columns_changed_cb (GtkTreeView * treeview, diff --git a/gsearchtool/gsearchtool-support.c b/gsearchtool/gsearchtool-support.c index 95a8599f..6d368a2d 100644 --- a/gsearchtool/gsearchtool-support.c +++ b/gsearchtool/gsearchtool-support.c @@ -46,259 +46,11 @@ #define C_STANDARD_NUMERIC_STRFTIME_CHARACTERS "dHIjmMSUwWyY" #define SUS_EXTENDED_STRFTIME_MODIFIERS "EO" #define BINARY_EXEC_MIME_TYPE "application/x-executable" -#define GSEARCH_DATE_FORMAT_LOCALE "locale" -#define GSEARCH_DATE_FORMAT_ISO "iso" GtkTreeViewColumn * gsearchtool_gtk_tree_view_get_column_with_sort_column_id (GtkTreeView * treeview, gint id); -/* START OF THE MATECONF FUNCTIONS */ - -static gboolean -gsearchtool_mateconf_handle_error (GError ** error) -{ - if (error != NULL) { - if (*error != NULL) { - g_warning (_("MateConf error:\n %s"), (*error)->message); - g_error_free (*error); - *error = NULL; - return TRUE; - } - } - return FALSE; -} - -static MateConfClient * -gsearchtool_mateconf_client_get_global (void) -{ - static MateConfClient * global_mateconf_client = NULL; - - /* Initialize mateconf if needed */ - if (!mateconf_is_initialized ()) { - char *argv[] = { "gsearchtool-preferences", NULL }; - GError *error = NULL; - - if (!mateconf_init (1, argv, &error)) { - if (gsearchtool_mateconf_handle_error (&error)) { - return NULL; - } - } - } - - if (global_mateconf_client == NULL) { - global_mateconf_client = mateconf_client_get_default (); - } - - return global_mateconf_client; -} - -char * -gsearchtool_mateconf_get_string (const gchar * key) -{ - MateConfClient * client; - GError * error = NULL; - gchar * result; - - g_return_val_if_fail (key != NULL, NULL); - - client = gsearchtool_mateconf_client_get_global (); - g_return_val_if_fail (client != NULL, NULL); - - result = mateconf_client_get_string (client, key, &error); - - if (gsearchtool_mateconf_handle_error (&error)) { - result = g_strdup (""); - } - - return result; -} - -void -gsearchtool_mateconf_set_string (const gchar * key, - const gchar * value) -{ - MateConfClient * client; - GError * error = NULL; - - g_return_if_fail (key != NULL); - - client = gsearchtool_mateconf_client_get_global (); - g_return_if_fail (client != NULL); - - mateconf_client_set_string (client, key, value, &error); - - gsearchtool_mateconf_handle_error (&error); - -} - -GSList * -gsearchtool_mateconf_get_list (const gchar * key, - MateConfValueType list_type) -{ - MateConfClient * client; - GError * error = NULL; - GSList * result; - - g_return_val_if_fail (key != NULL, FALSE); - - client = gsearchtool_mateconf_client_get_global (); - g_return_val_if_fail (client != NULL, NULL); - - result = mateconf_client_get_list (client, key, list_type, &error); - - if (gsearchtool_mateconf_handle_error (&error)) { - result = NULL; - } - - return result; -} - -void -gsearchtool_mateconf_set_list (const gchar * key, - GSList * list, - MateConfValueType list_type) -{ - MateConfClient * client; - GError * error = NULL; - - g_return_if_fail (key != NULL); - - client = gsearchtool_mateconf_client_get_global (); - g_return_if_fail (client != NULL); - - mateconf_client_set_list (client, key, list_type, list, &error); - - gsearchtool_mateconf_handle_error (&error); -} - -gint -gsearchtool_mateconf_get_int (const gchar * key) -{ - MateConfClient * client; - GError * error = NULL; - gint result; - - g_return_val_if_fail (key != NULL, FALSE); - - client = gsearchtool_mateconf_client_get_global (); - g_return_val_if_fail (client != NULL, FALSE); - - result = mateconf_client_get_int (client, key, &error); - - if (gsearchtool_mateconf_handle_error (&error)) { - result = 0; - } - - return result; -} - -void -gsearchtool_mateconf_set_int (const gchar * key, - const gint value) -{ - MateConfClient * client; - GError * error = NULL; - - g_return_if_fail (key != NULL); - - client = gsearchtool_mateconf_client_get_global (); - g_return_if_fail (client != NULL); - - mateconf_client_set_int (client, key, value, &error); - - gsearchtool_mateconf_handle_error (&error); -} - -gboolean -gsearchtool_mateconf_get_boolean (const gchar * key) -{ - MateConfClient * client; - GError * error = NULL; - gboolean result; - - g_return_val_if_fail (key != NULL, FALSE); - - client = gsearchtool_mateconf_client_get_global (); - g_return_val_if_fail (client != NULL, FALSE); - - result = mateconf_client_get_bool (client, key, &error); - - if (gsearchtool_mateconf_handle_error (&error)) { - result = FALSE; - } - - return result; -} - -void -gsearchtool_mateconf_set_boolean (const gchar * key, - const gboolean flag) -{ - MateConfClient * client; - GError * error = NULL; - - g_return_if_fail (key != NULL); - - client = gsearchtool_mateconf_client_get_global (); - g_return_if_fail (client != NULL); - - mateconf_client_set_bool (client, key, flag, &error); - - gsearchtool_mateconf_handle_error (&error); -} - -void -gsearchtool_mateconf_add_dir (const gchar * dir) -{ - MateConfClient * client; - GError * error = NULL; - - g_return_if_fail (dir != NULL); - - client = gsearchtool_mateconf_client_get_global (); - g_return_if_fail (client != NULL); - - mateconf_client_add_dir (client, - dir, - MATECONF_CLIENT_PRELOAD_RECURSIVE, - &error); - - gsearchtool_mateconf_handle_error (&error); -} - -void -gsearchtool_mateconf_watch_key (const gchar * dir, - const gchar * key, - MateConfClientNotifyFunc callback, - gpointer user_data) -{ - MateConfClient * client; - GError * error = NULL; - - g_return_if_fail (key != NULL); - g_return_if_fail (dir != NULL); - - client = gsearchtool_mateconf_client_get_global (); - g_return_if_fail (client != NULL); - - mateconf_client_add_dir (client, - dir, - MATECONF_CLIENT_PRELOAD_NONE, - &error); - - gsearchtool_mateconf_handle_error (&error); - - mateconf_client_notify_add (client, - key, - callback, - user_data, - NULL, - &error); - - gsearchtool_mateconf_handle_error (&error); -} - /* START OF GENERIC MATE-SEARCH-TOOL FUNCTIONS */ gboolean @@ -334,10 +86,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.mate.search-tool"); dir = g_strdup (path); @@ -355,65 +110,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_mateconf_get_list ("/apps/mate-search-tool/quick_search_excluded_paths", - MATECONF_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.mate.search-tool"); dir = g_strdup (path); @@ -431,55 +187,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_mateconf_get_list ("/apps/mate-search-tool/quick_search_second_scan_excluded_paths", - MATECONF_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); + 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; } @@ -622,7 +376,7 @@ backslash_special_characters (const gchar * string) if (*string == '\\') { g_string_append(gs, "\\\\"); } - if (*string == '-') { + else if (*string == '-') { g_string_append(gs, "\\-"); } else { @@ -654,7 +408,7 @@ remove_mnemonic_character (const gchar * string) } gchar * -get_readable_date (const gchar * format_string, +get_readable_date (const CajaDateFormat date_format_enum, const time_t file_time_raw) { struct tm * file_time; @@ -666,13 +420,11 @@ get_readable_date (const gchar * format_string, file_time = localtime (&file_time_raw); - /* Base format of date column on caja date_format key */ - if (format_string != NULL) { - if (strcmp(format_string, GSEARCH_DATE_FORMAT_LOCALE) == 0) { - return gsearchtool_strdup_strftime ("%c", file_time); - } else if (strcmp (format_string, GSEARCH_DATE_FORMAT_ISO) == 0) { - return gsearchtool_strdup_strftime ("%Y-%m-%d %H:%M:%S", file_time); - } + /* Base format of date column on caja date-format key */ + if (date_format_enum == CAJA_DATE_FORMAT_LOCALE) { + return gsearchtool_strdup_strftime ("%c", file_time); + } else if (date_format_enum == CAJA_DATE_FORMAT_ISO) { + return gsearchtool_strdup_strftime ("%Y-%m-%d %H:%M:%S", file_time); } file_date = g_date_new_dmy (file_time->tm_mday, @@ -898,36 +650,31 @@ get_file_type_description (const gchar * file, return desc; } -static gchar* gsearchtool_pixmap_file(const gchar* partial_path) +static gchar * +gsearchtool_pixmap_file (const gchar * partial_path) { - gchar* path; + gchar * path; path = g_build_filename(DATADIR "/pixmaps/mate-search-tool", partial_path, NULL); - - if (g_file_test(path, G_FILE_TEST_EXISTS)) - { + if (g_file_test(path, G_FILE_TEST_EXISTS)){ return path; } - - g_free(path); - + g_free (path); return NULL; } -static GdkPixbuf* gsearchtool_load_thumbnail_frame(void) +static GdkPixbuf * +gsearchtool_load_thumbnail_frame (void) { - GdkPixbuf* pixbuf = NULL; - gchar* image_path; + GdkPixbuf * pixbuf = NULL; + gchar * image_path; image_path = gsearchtool_pixmap_file("thumbnail_frame.png"); - if (image_path != NULL) - { + if (image_path != NULL){ pixbuf = gdk_pixbuf_new_from_file(image_path, NULL); } - g_free(image_path); - return pixbuf; } @@ -1433,35 +1180,47 @@ void gsearchtool_set_columns_order (GtkTreeView * treeview) { GtkTreeViewColumn * last = NULL; - GSList * order; - GSList * it; + GSettings * settings; + GVariant * value; - order = gsearchtool_mateconf_get_list ("/apps/mate-search-tool/columns_order", MATECONF_VALUE_INT); + settings = g_settings_new ("org.mate.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; @@ -1469,8 +1228,10 @@ gsearchtool_get_stored_window_geometry (gint * width, return; } - saved_width = gsearchtool_mateconf_get_int ("/apps/mate-search-tool/default_window_width"); - saved_height = gsearchtool_mateconf_get_int ("/apps/mate-search-tool/default_window_height"); + settings = g_settings_new ("org.mate.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; @@ -1482,6 +1243,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 CAJA/EEL FUNCTIONS: USED FOR HANDLING OF DUPLICATE FILENAMES */ diff --git a/gsearchtool/gsearchtool-support.h b/gsearchtool/gsearchtool-support.h index 68c19cab..ce22e38c 100644 --- a/gsearchtool/gsearchtool-support.h +++ b/gsearchtool/gsearchtool-support.h @@ -38,40 +38,6 @@ extern "C" { #define ICON_SIZE 24 gboolean -gsearchtool_mateconf_get_boolean (const gchar * key); - -void -gsearchtool_mateconf_set_boolean (const gchar * key, - const gboolean flag); -gint -gsearchtool_mateconf_get_int (const gchar * key); - -void -gsearchtool_mateconf_set_int (const gchar * key, - const gint value); -char * -gsearchtool_mateconf_get_string (const gchar * key); - -void -gsearchtool_mateconf_set_string (const gchar * key, - const gchar * value); - -GSList * -gsearchtool_mateconf_get_list (const gchar * key, - MateConfValueType list_type); -void -gsearchtool_mateconf_set_list (const gchar * key, - GSList * list, - MateConfValueType list_type); -void -gsearchtool_mateconf_add_dir (const gchar * dir); - -void -gsearchtool_mateconf_watch_key (const gchar * dir, - const gchar * key, - MateConfClientNotifyFunc callback, - gpointer user_data); -gboolean is_path_hidden (const gchar * path); gboolean @@ -102,7 +68,7 @@ gchar * remove_mnemonic_character (const gchar * string); gchar * -get_readable_date (const gchar * format_string, +get_readable_date (const CajaDateFormat date_format_enum, const time_t file_time_raw); gchar * gsearchtool_strdup_strftime (const gchar * format, diff --git a/gsearchtool/gsearchtool.c b/gsearchtool/gsearchtool.c index f67f4538..24a11810 100644 --- a/gsearchtool/gsearchtool.c +++ b/gsearchtool/gsearchtool.c @@ -44,6 +44,7 @@ #include <glib/gi18n.h> #include <gdk/gdk.h> #include <gio/gio.h> +#include <locale.h> #include "gsearchtool.h" #include "gsearchtool-callbacks.h" @@ -511,7 +512,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_mateconf_get_boolean ("/desktop/mate/interface/enable_animations")) { + if (g_settings_get_boolean (gsearch->mate_desktop_interface_settings, "enable-animations")) { gtk_spinner_start (GTK_SPINNER (gsearch->progress_spinner)); gtk_widget_show (gsearch->progress_spinner); } @@ -636,7 +637,6 @@ build_search_command (GSearchWindow * gsearch, command = g_string_new (""); gsearch->command_details->is_command_show_hidden_files_enabled = FALSE; gsearch->command_details->name_contains_regex_string = NULL; - gsearch->search_results_date_format_string = NULL; gsearch->command_details->name_contains_pattern_string = NULL; gsearch->command_details->is_command_first_pass = first_pass; @@ -654,19 +654,35 @@ build_search_command (GSearchWindow * gsearch, if (gsearch->command_details->is_command_first_pass == TRUE) { gchar * locate; - gchar * show_thumbnails_string; + CajaSpeedTradeoff show_thumbnails_enum; gboolean disable_quick_search; locate = g_find_program_in_path ("locate"); - disable_quick_search = gsearchtool_mateconf_get_boolean ("/apps/mate-search-tool/disable_quick_search"); - gsearch->command_details->is_command_second_pass_enabled = !gsearchtool_mateconf_get_boolean ("/apps/mate-search-tool/disable_quick_search_second_scan"); - - show_thumbnails_string = gsearchtool_mateconf_get_string ("/apps/caja/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_mateconf_get_int ("/apps/caja/preferences/thumbnail_limit"); + disable_quick_search = g_settings_get_boolean (gsearch->mate_search_tool_settings, "disable-quick-search"); + gsearch->command_details->is_command_second_pass_enabled = !g_settings_get_boolean (gsearch->mate_search_tool_settings, "disable-quick-search-second-scan"); + + /* Use caja settings for thumbnails if caja is installed, else fall back to the caja default */ + if (gsearch->caja_schema_exists) { + show_thumbnails_enum = g_settings_get_enum (gsearch->caja_settings, "show-image-thumbnails"); + } else { + show_thumbnails_enum = SPEED_TRADEOFF_LOCAL_ONLY; + } + + if (show_thumbnails_enum == SPEED_TRADEOFF_ALWAYS || + show_thumbnails_enum == SPEED_TRADEOFF_LOCAL_ONLY) { + GVariant * value; + guint64 size_limit = 10485760; + + if (gsearch->caja_schema_exists) { + value = g_settings_get_value (gsearch->caja_settings, "thumbnail-limit"); + if (value) { + size_limit = g_variant_get_uint64 (value); + g_variant_unref (value); + } + } + + gsearch->show_thumbnails = TRUE; + gsearch->show_thumbnails_file_size_limit = size_limit; } else { gsearch->show_thumbnails = FALSE; @@ -692,7 +708,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", @@ -865,7 +880,7 @@ add_file_to_search_results (const gchar * file, #endif g_file_info_get_modification_time (file_info, &time_val); - readable_date = get_readable_date (gsearch->search_results_date_format_string, time_val.tv_sec); + readable_date = get_readable_date (gsearch->search_results_date_format, time_val.tv_sec); base_name = g_path_get_basename (file); dir_name = g_path_get_dirname (file); @@ -1158,71 +1173,76 @@ set_constraint_selected_state (GSearchWindow * gsearch, } void -set_constraint_mateconf_boolean (gint constraint_id, - gboolean flag) +set_constraint_gsettings_boolean (gint constraint_id, + gboolean flag) { + GSettings * select_settings; + + select_settings = g_settings_new ("org.mate.search-tool.select"); + switch (constraint_id) { case SEARCH_CONSTRAINT_CONTAINS_THE_TEXT: - gsearchtool_mateconf_set_boolean ("/apps/mate-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_mateconf_set_boolean ("/apps/mate-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_mateconf_set_boolean ("/apps/mate-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_mateconf_set_boolean ("/apps/mate-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_mateconf_set_boolean ("/apps/mate-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_mateconf_set_boolean ("/apps/mate-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_mateconf_set_boolean ("/apps/mate-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_mateconf_set_boolean ("/apps/mate-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_mateconf_set_boolean ("/apps/mate-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_mateconf_set_boolean ("/apps/mate-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_mateconf_set_boolean ("/apps/mate-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_mateconf_set_boolean ("/apps/mate-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_mateconf_set_boolean ("/apps/mate-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_mateconf_set_boolean ("/apps/mate-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); } /* @@ -1297,12 +1317,12 @@ gsearch_setup_goption_descriptions (void) for (j = 0; GSearchOptionTemplates[j].type != SEARCH_CONSTRAINT_TYPE_NONE; j++) { if (GSearchOptionTemplates[j].type != SEARCH_CONSTRAINT_TYPE_SEPARATOR) { - gchar *text = remove_mnemonic_character (GSearchOptionTemplates[j].desc); + gchar *text = remove_mnemonic_character (_(GSearchOptionTemplates[j].desc)); if (GSearchOptionTemplates[j].type == SEARCH_CONSTRAINT_TYPE_BOOLEAN) { - GSearchGOptionEntries[i++].description = g_strdup_printf (_("Select the \"%s\" search option"), _(text)); + GSearchGOptionEntries[i++].description = g_strdup_printf (_("Select the \"%s\" search option"), text); } else { - GSearchGOptionEntries[i++].description = g_strdup_printf (_("Select and set the \"%s\" search option"), _(text)); + GSearchGOptionEntries[i++].description = g_strdup_printf (_("Select and set the \"%s\" search option"), text); } g_free (text); } @@ -1587,7 +1607,6 @@ handle_search_command_stdout_io (GIOChannel * ioc, /* Free these strings now because they are reassign values during the second pass. */ g_free (gsearch->command_details->name_contains_pattern_string); g_free (gsearch->command_details->name_contains_regex_string); - g_free (gsearch->search_results_date_format_string); command = build_search_command (gsearch, FALSE); if (command != NULL) { @@ -1608,7 +1627,6 @@ handle_search_command_stdout_io (GIOChannel * ioc, /* Free the gchar fields of search_command structure. */ g_free (gsearch->command_details->name_contains_pattern_string); g_free (gsearch->command_details->name_contains_regex_string); - g_free (gsearch->search_results_date_format_string); } return FALSE; @@ -1737,7 +1755,7 @@ handle_search_command_stderr_io (GIOChannel * ioc, label = gtk_label_new (error_msgs->str); gtk_container_add (GTK_CONTAINER (expander), label); - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), hbox, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), hbox, FALSE, FALSE, 0); gtk_widget_show_all (hbox); g_signal_connect (G_OBJECT (dialog), @@ -1781,11 +1799,11 @@ handle_search_command_stderr_io (GIOChannel * ioc, label = gtk_label_new (error_msgs->str); gtk_container_add (GTK_CONTAINER (expander), label); - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), hbox, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), hbox, FALSE, FALSE, 0); gtk_widget_show_all (hbox); button = gsearchtool_button_new_with_stock_icon (_("Disable _Quick Search"), GTK_STOCK_OK); - gtk_widget_set_can_default (button, TRUE); + gtk_widget_set_can_default (button, TRUE); gtk_widget_show (button); gtk_dialog_add_action_widget (GTK_DIALOG (dialog), button, GTK_RESPONSE_OK); @@ -1853,7 +1871,6 @@ spawn_search_command (GSearchWindow * gsearch, g_free (gsearch->command_details->look_in_folder_string); g_free (gsearch->command_details->name_contains_pattern_string); g_free (gsearch->command_details->name_contains_regex_string); - g_free (gsearch->search_results_date_format_string); return; } @@ -1886,7 +1903,6 @@ spawn_search_command (GSearchWindow * gsearch, g_free (gsearch->command_details->look_in_folder_string); g_free (gsearch->command_details->name_contains_pattern_string); g_free (gsearch->command_details->name_contains_regex_string); - g_free (gsearch->search_results_date_format_string); return; } @@ -1896,8 +1912,12 @@ 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 caja date_format key */ - gsearch->search_results_date_format_string = gsearchtool_mateconf_get_string ("/apps/caja/preferences/date_format"); + /* Get the value of the caja date-format key if available. */ + if (gsearch->caja_schema_exists) { + gsearch->search_results_date_format = g_settings_get_enum (gsearch->caja_settings, "date-format"); + } else { + gsearch->search_results_date_format = CAJA_DATE_FORMAT_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), @@ -2091,7 +2111,7 @@ add_constraint (GSearchWindow * gsearch, constraint->constraint_id = constraint_id; set_constraint_info_defaults (constraint); - set_constraint_mateconf_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); @@ -2635,70 +2655,68 @@ set_clone_command (GSearchWindow * gsearch, } static void -handle_mateconf_settings (GSearchWindow * gsearch) +handle_gsettings_settings (GSearchWindow * gsearch) { - gsearchtool_mateconf_add_dir ("/apps/mate-search-tool"); - - if (gsearchtool_mateconf_get_boolean ("/apps/mate-search-tool/show_additional_options")) { + if (g_settings_get_boolean (gsearch->mate_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_mateconf_get_boolean ("/apps/mate-search-tool/select/contains_the_text")) { + if (g_settings_get_boolean (gsearch->mate_search_tool_select_settings, "contains-the-text")) { add_constraint (gsearch, SEARCH_CONSTRAINT_CONTAINS_THE_TEXT, "", FALSE); } - if (gsearchtool_mateconf_get_boolean ("/apps/mate-search-tool/select/date_modified_less_than")) { + if (g_settings_get_boolean (gsearch->mate_search_tool_select_settings, "date-modified-less-than")) { add_constraint (gsearch, SEARCH_CONSTRAINT_DATE_MODIFIED_BEFORE, "", FALSE); } - if (gsearchtool_mateconf_get_boolean ("/apps/mate-search-tool/select/date_modified_more_than")) { + if (g_settings_get_boolean (gsearch->mate_search_tool_select_settings, "date-modified-more-than")) { add_constraint (gsearch, SEARCH_CONSTRAINT_DATE_MODIFIED_AFTER, "", FALSE); } - if (gsearchtool_mateconf_get_boolean ("/apps/mate-search-tool/select/size_at_least")) { + if (g_settings_get_boolean (gsearch->mate_search_tool_select_settings, "size-at-least")) { add_constraint (gsearch, SEARCH_CONSTRAINT_SIZE_IS_MORE_THAN, "", FALSE); } - if (gsearchtool_mateconf_get_boolean ("/apps/mate-search-tool/select/size_at_most")) { + if (g_settings_get_boolean (gsearch->mate_search_tool_select_settings, "size-at-most")) { add_constraint (gsearch, SEARCH_CONSTRAINT_SIZE_IS_LESS_THAN, "", FALSE); } - if (gsearchtool_mateconf_get_boolean ("/apps/mate-search-tool/select/file_is_empty")) { + if (g_settings_get_boolean (gsearch->mate_search_tool_select_settings, "file-is-empty")) { add_constraint (gsearch, SEARCH_CONSTRAINT_FILE_IS_EMPTY, NULL, FALSE); } - if (gsearchtool_mateconf_get_boolean ("/apps/mate-search-tool/select/owned_by_user")) { + if (g_settings_get_boolean (gsearch->mate_search_tool_select_settings, "owned-by-user")) { add_constraint (gsearch, SEARCH_CONSTRAINT_OWNED_BY_USER, "", FALSE); } - if (gsearchtool_mateconf_get_boolean ("/apps/mate-search-tool/select/owned_by_group")) { + if (g_settings_get_boolean (gsearch->mate_search_tool_select_settings, "owned-by-group")) { add_constraint (gsearch, SEARCH_CONSTRAINT_OWNED_BY_GROUP, "", FALSE); } - if (gsearchtool_mateconf_get_boolean ("/apps/mate-search-tool/select/owner_is_unrecognized")) { + if (g_settings_get_boolean (gsearch->mate_search_tool_select_settings, "owner-is-unrecognized")) { add_constraint (gsearch, SEARCH_CONSTRAINT_OWNER_IS_UNRECOGNIZED, NULL, FALSE); } - if (gsearchtool_mateconf_get_boolean ("/apps/mate-search-tool/select/name_does_not_contain")) { + if (g_settings_get_boolean (gsearch->mate_search_tool_select_settings, "name-does-not-contain")) { add_constraint (gsearch, SEARCH_CONSTRAINT_FILE_IS_NOT_NAMED, "", FALSE); } - if (gsearchtool_mateconf_get_boolean ("/apps/mate-search-tool/select/name_matches_regular_expression")) { + if (g_settings_get_boolean (gsearch->mate_search_tool_select_settings, "name-matches-regular-expression")) { add_constraint (gsearch, SEARCH_CONSTRAINT_FILE_MATCHES_REGULAR_EXPRESSION, "", FALSE); } - if (gsearchtool_mateconf_get_boolean ("/apps/mate-search-tool/select/show_hidden_files_and_folders")) { + if (g_settings_get_boolean (gsearch->mate_search_tool_select_settings, "show-hidden-files-and-folders")) { add_constraint (gsearch, SEARCH_CONSTRAINT_SHOW_HIDDEN_FILES_AND_FOLDERS, NULL, FALSE); } - if (gsearchtool_mateconf_get_boolean ("/apps/mate-search-tool/select/follow_symbolic_links")) { + if (g_settings_get_boolean (gsearch->mate_search_tool_select_settings, "follow-symbolic-links")) { add_constraint (gsearch, SEARCH_CONSTRAINT_FOLLOW_SYMBOLIC_LINKS, NULL, FALSE); } - if (gsearchtool_mateconf_get_boolean ("/apps/mate-search-tool/select/exclude_other_filesystems")) { + if (g_settings_get_boolean (gsearch->mate_search_tool_select_settings, "exclude-other-filesystems")) { add_constraint (gsearch, SEARCH_CONSTRAINT_SEARCH_OTHER_FILESYSTEMS, NULL, FALSE); } } @@ -2725,9 +2743,31 @@ gsearch_app_create (GSearchWindow * gsearch) GtkWidget * label; GtkWidget * button; GtkWidget * container; + const char * const *schemas; + gint i; + + gsearch->mate_search_tool_settings = g_settings_new ("org.mate.search-tool"); + gsearch->mate_search_tool_select_settings = g_settings_new ("org.mate.search-tool.select"); + gsearch->mate_desktop_interface_settings = g_settings_new ("org.mate.interface"); + + /* Check if caja schema is installed before trying to read caja settings */ + gsearch->caja_schema_exists = FALSE; + schemas = g_settings_list_schemas (); + for (i = 0; schemas[i] != NULL; i++) { + if (g_strcmp0 (schemas[i], CAJA_PREFERENCES_SCHEMA) == 0) { + gsearch->caja_schema_exists = TRUE; + break; + } + } + + if (gsearch->caja_schema_exists) { + gsearch->caja_settings = g_settings_new (CAJA_PREFERENCES_SCHEMA); + } else { + gsearch->caja_settings = NULL; + } gsearch->window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - gsearch->is_window_maximized = gsearchtool_mateconf_get_boolean ("/apps/mate-search-tool/default_window_maximized"); + gsearch->is_window_maximized = g_settings_get_boolean (gsearch->mate_search_tool_settings, "default-window-maximized"); g_signal_connect (G_OBJECT (gsearch->window), "size-allocate", G_CALLBACK (gsearch_window_size_allocate), gsearch); @@ -2800,7 +2840,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_mateconf_get_string ("/apps/mate-search-tool/look_in_folder"); + locale_string = g_settings_get_string (gsearch->mate_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)) { @@ -2937,26 +2977,27 @@ gsearch_window_get_type (void) } static void -gsearchtool_setup_mateconf_notifications (GSearchWindow * gsearch) +gsearchtool_setup_gsettings_notifications (GSearchWindow * gsearch) { gchar * click_to_activate_pref; - /* Get value of caja click behavior (single or double click to activate items) */ - click_to_activate_pref = gsearchtool_mateconf_get_string ("/apps/caja/preferences/click_policy"); - - if (click_to_activate_pref == NULL) { + /* Use the default double click behavior if caja isn't installed */ + if (gsearch->caja_schema_exists == FALSE) { gsearch->is_search_results_single_click_to_activate = FALSE; return; } + /* Get value of caja click behavior (single or double click to activate items) */ + click_to_activate_pref = g_settings_get_string (gsearch->caja_settings, "click-policy"); + gsearch->is_search_results_single_click_to_activate = (strncmp (click_to_activate_pref, "single", 6) == 0) ? TRUE : FALSE; - gsearchtool_mateconf_watch_key ("/apps/caja/preferences", - "/apps/caja/preferences/click_policy", - (MateConfClientNotifyFunc) single_click_to_activate_key_changed_cb, - gsearch); + g_signal_connect (gsearch->caja_settings, + "changed::click-policy", + G_CALLBACK (single_click_to_activate_key_changed_cb), + gsearch); g_free (click_to_activate_pref); } @@ -2971,6 +3012,7 @@ main (int argc, GError * error = NULL; EggSMClient * client; + setlocale (LC_ALL, ""); bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); @@ -3022,10 +3064,10 @@ main (int argc, gtk_widget_show (gsearch->window); - gsearchtool_setup_mateconf_notifications (gsearch); + gsearchtool_setup_gsettings_notifications (gsearch); if (handle_goption_args (gsearch) == FALSE) { - handle_mateconf_settings (gsearch); + handle_gsettings_settings (gsearch); } gtk_main (); diff --git a/gsearchtool/gsearchtool.h b/gsearchtool/gsearchtool.h index 6ed4e784..573bbe67 100644 --- a/gsearchtool/gsearchtool.h +++ b/gsearchtool/gsearchtool.h @@ -34,8 +34,6 @@ extern "C" { #endif #include <gtk/gtk.h> -#include <mateconf/mateconf.h> -#include <mateconf/mateconf-client.h> #define GSEARCH_TYPE_WINDOW gsearch_window_get_type() #define GSEARCH_WINDOW(obj) \ @@ -56,6 +54,7 @@ extern "C" { #define DEFAULT_WINDOW_HEIGHT 350 #define WINDOW_HEIGHT_STEP 35 #define NUM_VISIBLE_COLUMNS 5 +#define CAJA_PREFERENCES_SCHEMA "org.mate.caja.preferences" typedef enum { STOPPED, @@ -66,6 +65,18 @@ typedef enum { } GSearchCommandStatus; typedef enum { + SPEED_TRADEOFF_ALWAYS = 0, + SPEED_TRADEOFF_LOCAL_ONLY, + SPEED_TRADEOFF_NEVER +} CajaSpeedTradeoff; + +typedef enum { + CAJA_DATE_FORMAT_LOCALE = 0, + CAJA_DATE_FORMAT_ISO, + CAJA_DATE_FORMAT_INFORMAL +} CajaDateFormat; + +typedef enum { COLUMN_ICON, COLUMN_NAME, COLUMN_RELATIVE_PATH, @@ -130,7 +141,7 @@ struct _GSearchWindow { GtkTreePath * search_results_hover_path; GHashTable * search_results_filename_hash_table; GHashTable * search_results_pixbuf_hash_table; - gchar * search_results_date_format_string; + CajaDateFormat search_results_date_format; gint show_thumbnails_file_size_limit; gboolean show_thumbnails; gboolean is_search_results_single_click_to_activate; @@ -139,6 +150,12 @@ struct _GSearchWindow { gchar * save_results_as_default_filename; + GSettings * mate_search_tool_settings; + GSettings * mate_search_tool_select_settings; + GSettings * mate_desktop_interface_settings; + GSettings * caja_settings; + gboolean caja_schema_exists; + GSearchCommandDetails * command_details; }; @@ -198,8 +215,8 @@ void remove_constraint (gint constraint_id); void -set_constraint_mateconf_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, diff --git a/gsearchtool/help/C/mate-search-tool.xml b/gsearchtool/help/C/mate-search-tool.xml index a1516616..d1b94d7d 100644 --- a/gsearchtool/help/C/mate-search-tool.xml +++ b/gsearchtool/help/C/mate-search-tool.xml @@ -476,57 +476,57 @@ <!-- ============= Settings ============================== --> - <sect1 id="gsearchtool-settings-mateconf-keys"> + <sect1 id="gsearchtool-settings-gsettings-keys"> <title>Settings</title> - <para><application>&app;</application> provides mateconf keys to modify some of its behavior. The mateconf 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>mateconf-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/mate-search-tool/disable_quick_search</para> + <para>Key name: org.mate.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/mate-search-tool/disable_quick_search_second_scan</para> + <para>Key name: org.mate.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/mate-search-tool/quick_search_excluded_paths</para> + <para>Key name: org.mate.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/mate-search-tool/quick_search_second_scan_excluded_paths</para> + <para>Key name: org.mate.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/mate-search-tool/show_additional_options</para> + <para>Key name: org.mate.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/gsearchtool/libmateui-deprecated/Makefile.am b/gsearchtool/libmateui-deprecated/Makefile.am index 7a01c3c9..024e4277 100644 --- a/gsearchtool/libmateui-deprecated/Makefile.am +++ b/gsearchtool/libmateui-deprecated/Makefile.am @@ -1,12 +1,19 @@ -INCLUDES = -DGTK_DISABLE_DEPRECATED \ - -DGDK_DISABLE_DEPRECATED \ - -DG_DISABLE_DEPRECATED - +INCLUDES = \ + -DGTK_DISABLE_DEPRECATED \ + -DGDK_DISABLE_DEPRECATED \ + -DG_DISABLE_DEPRECATED noinst_LTLIBRARIES = libmateui-deprecated.la -libmateui_deprecated_la_LIBADD = $(MATE_UTILS_LIBS) -libmateui_deprecated_la_CFLAGS = $(MATE_UTILS_CFLAGS) \ - $(WARN_CFLAGS) -libmateui_deprecated_la_SOURCES = gsearchtool-entry.h \ - gsearchtool-entry.c +libmateui_deprecated_la_CFLAGS = \ + $(GLIB_CFLAGS) \ + $(GTK_CFLAGS) \ + $(WARN_CFLAGS) + +libmateui_deprecated_la_LIBADD = \ + $(GLIB_LIBS) \ + $(GTK_LIBS) + +libmateui_deprecated_la_SOURCES = \ + gsearchtool-entry.h \ + gsearchtool-entry.c diff --git a/gsearchtool/libmateui-deprecated/gsearchtool-entry.c b/gsearchtool/libmateui-deprecated/gsearchtool-entry.c index 25a1e612..9d39b4ba 100644 --- a/gsearchtool/libmateui-deprecated/gsearchtool-entry.c +++ b/gsearchtool/libmateui-deprecated/gsearchtool-entry.c @@ -34,7 +34,6 @@ #include <string.h> #include <glib/gi18n.h> #include <gtk/gtk.h> -#include <mateconf/mateconf-client.h> #include "gsearchtool-entry.h" @@ -57,7 +56,7 @@ struct _GsearchHistoryEntryPrivate GtkEntryCompletion *completion; - MateConfClient *mateconf_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->mateconf_client != NULL) + if (priv->settings != NULL) { - g_object_unref (G_OBJECT (priv->mateconf_client)); - priv->mateconf_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/mate-settings/ - * like the old MateEntry did - */ - - tmp = mateconf_escape_key (entry->priv->history_id, -1); - key = g_strconcat ("/apps/mate-settings/", - "mate-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 *mateconf_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)); - mateconf_items = get_history_list (entry); + items = get_history_list (entry); key = get_history_key (entry); - mateconf_client_set_list (entry->priv->mateconf_client, - key, - MATECONF_VALUE_STRING, - mateconf_items, - NULL); - - g_slist_foreach (mateconf_items, (GFunc) g_free, NULL); - g_slist_free (mateconf_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 *mateconf_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); - mateconf_items = mateconf_client_get_list (entry->priv->mateconf_client, - key, - MATECONF_VALUE_STRING, - NULL); + history = g_settings_get_value (entry->priv->settings, + "search-history"); gtk_list_store_clear (store); - for (l = mateconf_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 (mateconf_items, (GFunc) g_free, NULL); - g_slist_free (mateconf_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->mateconf_client = mateconf_client_get_default (); + priv->settings = g_settings_new ("org.mate.search-tool"); } void @@ -519,10 +550,12 @@ gsearch_history_entry_get_enable_completion (GsearchHistoryEntry *entry) return entry->priv->completion != NULL; } -GtkWidget* gsearch_history_entry_new(const gchar *history_id, gboolean enable_completion) +GtkWidget * +gsearch_history_entry_new (const gchar *history_id, + gboolean enable_completion) { - GtkWidget* ret; - GtkListStore* store; + GtkWidget *ret; + GtkListStore *store; g_return_val_if_fail(history_id != NULL, NULL); diff --git a/gsearchtool/mate-search-tool.convert b/gsearchtool/mate-search-tool.convert new file mode 100644 index 00000000..44156425 --- /dev/null +++ b/gsearchtool/mate-search-tool.convert @@ -0,0 +1,27 @@ +[org.mate.search-tool] +show-additional-options=/apps/mate-search-tool/show_additional_options +disable-quick-search=/apps/mate-search-tool/disable_quick_search +quick-search-excluded-paths=/apps/mate-search-tool/quick_search_excluded_paths +disable-quick-search-second-scan=/apps/mate-search-tool/disable_quick_search_second-scan +quick-search-second-scan-excluded-paths=/apps/mate-search-tool/quick_search_second_scan_excluded_paths +columns-order=/apps/mate-search-tool/columns_order +default-window-width=/apps/mate-search-tool/default_window_width +default-window-height=/apps/mate-search-tool/default_window_height +default-window-maximized=/apps/mate-search-tool/default_window_maximized +look-in-folder=/apps/mate-search-tool/look_in_folder + +[org.mate.search-tool.select] +contains-the-text=/apps/mate-search-tool/select/contains_the_text +date-modified-less-than=/apps/mate-search-tool/select/date_modified_less_than +date-modified-more-than=/apps/mate-search-tool/select/date_modified_more_than +size-at-least=/apps/mate-search-tool/select/size_at_least +size-at-most=/apps/mate-search-tool/select/size_at_most +file-is-empty=/apps/mate-search-tool/select/file_is_empty +owned-by-user=/apps/mate-search-tool/select/owned_by_user +owned-by-group=/apps/mate-search-tool/select/owned_by_group +owner-is-unrecognized=/apps/mate-search-tool/select/owner_is_unrecognized +name-does-not-contain=/apps/mate-search-tool/select/name_does_not_contain +name-matches-regular-expression=/apps/mate-search-tool/select/name_matches_regular_expression +show-hidden-files-and-folders=/apps/mate-search-tool/select/show_hidden_files_and_folders +follow-symbolic-links=/apps/mate-search-tool/select/follow_symbolic_links +exclude-other-filesystems=/apps/mate-search-tool/select/exclude_other_filesystems diff --git a/gsearchtool/mate-search-tool.schemas.in b/gsearchtool/mate-search-tool.schemas.in deleted file mode 100644 index cd2fd4cd..00000000 --- a/gsearchtool/mate-search-tool.schemas.in +++ /dev/null @@ -1,393 +0,0 @@ -<mateconfschemafile> - -<!-- -Note: all double hyphens in this comment have a space in the middle -because double hyphen isn't allowed in comments. So, remove the space -before use. - -To install this file type: - mateconftool - -install-schema-file mate-search-tool.schemas -You probably want your "make install" to do this for real applications. -Also, you probably want a configure option so people can retarget where the -schema file gets installed. The option should be called - -mateconf-config-source=blah -To change the mateconftool target use the - -config-source=blah option to mateconftool. ---> - - <schemalist> - <schema> - <applyto>/apps/mate-search-tool/show_additional_options</applyto> - <key>/schemas/apps/mate-search-tool/show_additional_options</key> - <owner>mate-search-tool</owner> - <type>bool</type> - <default>FALSE</default> - <locale name="C"> - <short>Show Additional Options</short> - <long><!-- Translators: The quoted text is the label of the additional - options expander that is translated elsewhere. --> - This key determines if the "Select more options" section - is expanded when the search tool is started. - </long> - </locale> - </schema> - <schema> - <applyto>/apps/mate-search-tool/select/contains_the_text</applyto> - <key>/schemas/apps/mate-search-tool/select/contains_the_text</key> - <owner>mate-search-tool</owner> - <type>bool</type> - <default>TRUE</default> - <locale name="C"> - <short><!-- Translators: The quoted text is the label of an available - search option that is translated elsewhere. -->Select the search option - "Contains the text"</short> - <long> - This key determines if the "Contains the text" search option is - selected when the search tool is started. - </long> - </locale> - </schema> - <schema> - <applyto>/apps/mate-search-tool/select/date_modified_less_than</applyto> - <key>/schemas/apps/mate-search-tool/select/date_modified_less_than</key> - <owner>mate-search-tool</owner> - <type>bool</type> - <default>FALSE</default> - <locale name="C"> - <short><!-- Translators: The quoted text is the label of an available - search option that is translated elsewhere. -->Select the search option - "Date modified less than"</short> - <long> - This key determines if the "Date modified less than" search option - is selected when the search tool is started. - </long> - </locale> - </schema> - <schema> - <applyto>/apps/mate-search-tool/select/date_modified_more_than</applyto> - <key>/schemas/apps/mate-search-tool/select/date_modified_more_than</key> - <owner>mate-search-tool</owner> - <type>bool</type> - <default>FALSE</default> - <locale name="C"> - <short><!-- Translators: The quoted text is the label of an available - search option that is translated elsewhere. -->Select the search option - "Date modified more than"</short> - <long> - This key determines if the "Date modified more than" search option - is selected when the search tool is started. - </long> - </locale> - </schema> - <schema> - <applyto>/apps/mate-search-tool/select/size_at_least</applyto> - <key>/schemas/apps/mate-search-tool/select/size_at_least</key> - <owner>mate-search-tool</owner> - <type>bool</type> - <default>FALSE</default> - <locale name="C"> - <short><!-- Translators: The quoted text is the label of an available - search option that is translated elsewhere. -->Select the search option - "Size at least"</short> - <long> - This key determines if the "Size at least" search option is - selected when the search tool is started. - </long> - </locale> - </schema> - <schema> - <applyto>/apps/mate-search-tool/select/size_at_most</applyto> - <key>/schemas/apps/mate-search-tool/select/size_at_most</key> - <owner>mate-search-tool</owner> - <type>bool</type> - <default>FALSE</default> - <locale name="C"> - <short><!-- Translators: The quoted text is the label of an available - search option that is translated elsewhere. -->Select the search option - "Size at most"</short> - <long> - This key determines if the "Size at most" search option is - selected when the search tool is started. - </long> - </locale> - </schema> - <schema> - <applyto>/apps/mate-search-tool/select/file_is_empty</applyto> - <key>/schemas/apps/mate-search-tool/select/file_is_empty</key> - <owner>mate-search-tool</owner> - <type>bool</type> - <default>FALSE</default> - <locale name="C"> - <short><!-- Translators: The quoted text is the label of an available - search option that is translated elsewhere. -->Select the search option - "File is empty"</short> - <long> - This key determines if the "File is empty" search option is - selected when the search tool is started. - </long> - </locale> - </schema> - <schema> - <applyto>/apps/mate-search-tool/select/owned_by_user</applyto> - <key>/schemas/apps/mate-search-tool/select/owned_by_user</key> - <owner>mate-search-tool</owner> - <type>bool</type> - <default>FALSE</default> - <locale name="C"> - <short><!-- Translators: The quoted text is the label of an available - search option that is translated elsewhere. -->Select the search option - "Owned by user"</short> - <long> - This key determines if the "Owned by user" search option is - selected when the search tool is started. - </long> - </locale> - </schema> - <schema> - <applyto>/apps/mate-search-tool/select/owned_by_group</applyto> - <key>/schemas/apps/mate-search-tool/select/owned_by_group</key> - <owner>mate-search-tool</owner> - <type>bool</type> - <default>FALSE</default> - <locale name="C"> - <short><!-- Translators: The quoted text is the label of an available - search option that is translated elsewhere. -->Select the search option - "Owned by group"</short> - <long> - This key determines if the "Owned by group" search option is - selected when the search tool is started. - </long> - </locale> - </schema> - <schema> - <applyto>/apps/mate-search-tool/select/owner_is_unrecognized</applyto> - <key>/schemas/apps/mate-search-tool/select/owner_is_unrecognized</key> - <owner>mate-search-tool</owner> - <type>bool</type> - <default>FALSE</default> - <locale name="C"> - <short><!-- Translators: The quoted text is the label of an available - search option that is translated elsewhere. -->Select the search option - "Owner is unrecognized"</short> - <long> - This key determines if the "Owner is unrecognized" search option - is selected when the search tool is started. - </long> - </locale> - </schema> - <schema> - <applyto>/apps/mate-search-tool/select/name_does_not_contain</applyto> - <key>/schemas/apps/mate-search-tool/select/name_does_not_contain</key> - <owner>mate-search-tool</owner> - <type>bool</type> - <default>FALSE</default> - <locale name="C"> - <short><!-- Translators: The quoted text is the label of an available - search option that is translated elsewhere. -->Select the search option - "Name does not contain"</short> - <long> - This key determines if the "Name does not contain" search option - is selected when the search tool is started. - </long> - </locale> - </schema> - <schema> - <applyto>/apps/mate-search-tool/select/name_matches_regular_expression</applyto> - <key>/schemas/apps/mate-search-tool/select/name_matches_regular_expression</key> - <owner>mate-search-tool</owner> - <type>bool</type> - <default>FALSE</default> - <locale name="C"> - <short><!-- Translators: The quoted text is the label of an available - search option that is translated elsewhere. -->Select the search option - "Name matches regular expression"</short> - <long> - This key determines if the "Name matches regular expression" search - option is selected when the search tool is started. - </long> - </locale> - </schema> - <schema> - <applyto>/apps/mate-search-tool/select/show_hidden_files_and_folders</applyto> - <key>/schemas/apps/mate-search-tool/select/show_hidden_files_and_folders</key> - <owner>mate-search-tool</owner> - <type>bool</type> - <default>FALSE</default> - <locale name="C"> - <short><!-- Translators: The quoted text is the label of an available - search option that is translated elsewhere. -->Select the search option - "Show hidden files and folders"</short> - <long> - This key determines if the "Show hidden files and - folders" search option is selected when the search tool - is started. - </long> - </locale> - </schema> - <schema> - <applyto>/apps/mate-search-tool/select/follow_symbolic_links</applyto> - <key>/schemas/apps/mate-search-tool/select/follow_symbolic_links</key> - <owner>mate-search-tool</owner> - <type>bool</type> - <default>FALSE</default> - <locale name="C"> - <short><!-- Translators: The quoted text is the label of an available - search option that is translated elsewhere. -->Select the search option - "Follow symbolic links"</short> - <long> - This key determines if the "Follow symbolic links" search option - is selected when the search tool is started. - </long> - </locale> - </schema> - <schema> - <applyto>/apps/mate-search-tool/select/exclude_other_filesystems</applyto> - <key>/schemas/apps/mate-search-tool/select/exclude_other_filesystems</key> - <owner>mate-search-tool</owner> - <type>bool</type> - <default>FALSE</default> - <locale name="C"> - <short><!-- Translators: The quoted text is the label of an available - search option that is translated elsewhere. -->Select the search option - "Exclude other filesystems"</short> - <long> - This key determines if the "Exclude other filesystems" search option - is selected when the search tool is started. - </long> - </locale> - </schema> - <schema> - <applyto>/apps/mate-search-tool/disable_quick_search</applyto> - <key>/schemas/apps/mate-search-tool/disable_quick_search</key> - <owner>mate-search-tool</owner> - <type>bool</type> - <default>FALSE</default> - <locale name="C"> - <short>Disable Quick Search</short> - <long> - This key determines if the search tool disables the use of - the locate command when performing simple file name searches. - </long> - </locale> - </schema> - <schema> - <applyto>/apps/mate-search-tool/quick_search_excluded_paths</applyto> - <key>/schemas/apps/mate-search-tool/quick_search_excluded_paths</key> - <owner>mate-search-tool</owner> - <type>list</type> - <list_type>string</list_type> - <default>[/mnt/*,/media/*,/dev/*,/tmp/*,/proc/*,/var/*]</default> - <locale name="C"> - <short>Quick Search Excluded Paths</short> - <long> - 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/*. - </long> - </locale> - </schema> - <schema> - <applyto>/apps/mate-search-tool/disable_quick_search_second_scan</applyto> - <key>/schemas/apps/mate-search-tool/disable_quick_search_second_scan</key> - <owner>mate-search-tool</owner> - <type>bool</type> - <default>FALSE</default> - <locale name="C"> - <short>Disable Quick Search Second Scan</short> - <long> - This key determines if the search tool disables the use of the - find command after performing a quick search. - </long> - </locale> - </schema> - <schema> - <applyto>/apps/mate-search-tool/quick_search_second_scan_excluded_paths</applyto> - <key>/schemas/apps/mate-search-tool/quick_search_second_scan_excluded_paths</key> - <owner>mate-search-tool</owner> - <type>list</type> - <list_type>string</list_type> - <default>[/]</default> - <locale name="C"> - <short>Quick Search Second Scan Excluded Paths</short> - <long> - 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 /. - </long> - </locale> - </schema> - <schema> - <applyto>/apps/mate-search-tool/columns_order</applyto> - <key>/schemas/apps/mate-search-tool/columns_order</key> - <owner>mate-search-tool</owner> - <type>list</type> - <list_type>int</list_type> - <default>[0]</default> - <locale name="C"> - <short>Search Result Columns Order</short> - <long> - This key defines the order of the columns in the search - results. This key should not be modified by the user. - </long> - </locale> - </schema> - <schema> - <applyto>/apps/mate-search-tool/default_window_width</applyto> - <key>/schemas/apps/mate-search-tool/default_window_width</key> - <owner>mate-search-tool</owner> - <type>int</type> - <default>-1</default> - <locale name="C"> - <short>Default Window Width</short> - <long> - 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. - </long> - </locale> - </schema> - <schema> - <applyto>/apps/mate-search-tool/default_window_height</applyto> - <key>/schemas/apps/mate-search-tool/default_window_height</key> - <owner>mate-search-tool</owner> - <type>int</type> - <default>-1</default> - <locale name="C"> - <short>Default Window Height</short> - <long> - 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. - </long> - </locale> - </schema> - <schema> - <applyto>/apps/mate-search-tool/default_window_maximized</applyto> - <key>/schemas/apps/mate-search-tool/default_window_maximized</key> - <owner>mate-search-tool</owner> - <type>bool</type> - <default>FALSE</default> - <locale name="C"> - <short>Default Window Maximized</short> - <long> - This key determines if the search tool window starts in a maximized - state. - </long> - </locale> - </schema> - <schema> - <applyto>/apps/mate-search-tool/look_in_folder</applyto> - <key>/schemas/apps/mate-search-tool/look_in_folder</key> - <owner>mate-search-tool</owner> - <type>string</type> - <default></default> - <locale name="C"> - <short>Look in Folder</short> - <long> - This key defines the default value of the "Look in Folder" - widget. - </long> - </locale> - </schema> - </schemalist> -</mateconfschemafile> diff --git a/gsearchtool/org.mate.search-tool.gschema.xml.in b/gsearchtool/org.mate.search-tool.gschema.xml.in new file mode 100644 index 00000000..b6a532c4 --- /dev/null +++ b/gsearchtool/org.mate.search-tool.gschema.xml.in @@ -0,0 +1,117 @@ +<schemalist gettext-domain="mate-utils-2.0"> + <schema id="org.mate.search-tool" path="/org/mate/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.mate.search-tool.select"/> + </schema> + <schema id="org.mate.search-tool.select" path="/org/mate/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/po/POTFILES.in b/po/POTFILES.in index 4b696dcf..c89a566f 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -46,17 +46,17 @@ mate-dictionary/src/main.c mate-screenshot/mate-screenshot.c mate-screenshot/mate-screenshot.desktop.in [type: gettext/glade]mate-screenshot/mate-screenshot.ui -mate-screenshot/mate-screenshot.schemas.in +mate-screenshot/org.mate.screenshot.gschema.xml.in mate-screenshot/screenshot-dialog.c mate-screenshot/screenshot-save.c mate-screenshot/screenshot-shadow.c mate-screenshot/screenshot-utils.c mate-screenshot/screenshot-xfer.c gsearchtool/mate-search-tool.desktop.in -gsearchtool/mate-search-tool.schemas.in +gsearchtool/gsearchtool.c gsearchtool/gsearchtool-callbacks.c gsearchtool/gsearchtool-support.c -gsearchtool/gsearchtool.c +gsearchtool/org.mate.search-tool.gschema.xml.in libeggsmclient/eggdesktopfile.c libeggsmclient/eggsmclient.c logview/data/mate-system-log.desktop.in.in |