[nautilus] Convert show-text-in-icons to gsettings



commit 4b5a2c833296abfb2ea28c0cca45d1a748d8a0d1
Author: Alexander Larsson <alexl redhat com>
Date:   Thu Jul 22 17:50:13 2010 +0200

    Convert show-text-in-icons to gsettings

 libnautilus-private/nautilus-directory.c          |    8 ++++----
 libnautilus-private/nautilus-file.c               |    9 +++++----
 libnautilus-private/nautilus-global-preferences.c |    6 ------
 libnautilus-private/nautilus-global-preferences.h |    2 +-
 src/nautilus-file-management-properties.c         |   10 +++++-----
 5 files changed, 15 insertions(+), 20 deletions(-)
---
diff --git a/libnautilus-private/nautilus-directory.c b/libnautilus-private/nautilus-directory.c
index 2480fb3..8b80bfa 100644
--- a/libnautilus-private/nautilus-directory.c
+++ b/libnautilus-private/nautilus-directory.c
@@ -320,10 +320,10 @@ add_preferences_callbacks (void)
 				  "changed::" NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES,
 				  G_CALLBACK(filtering_changed_callback),
 				  NULL);
-
-	eel_preferences_add_callback (NAUTILUS_PREFERENCES_SHOW_TEXT_IN_ICONS,
-				      async_data_preference_changed_callback,
-				      NULL);
+	g_signal_connect_swapped (nautilus_preferences,
+				  "changed::" NAUTILUS_PREFERENCES_SHOW_TEXT_IN_ICONS,
+				  G_CALLBACK (async_data_preference_changed_callback),
+				  NULL);
 	eel_preferences_add_callback (NAUTILUS_PREFERENCES_SHOW_DIRECTORY_ITEM_COUNTS,
 				      async_data_preference_changed_callback,
 				      NULL);
diff --git a/libnautilus-private/nautilus-file.c b/libnautilus-private/nautilus-file.c
index 21ab130..dcf8220 100644
--- a/libnautilus-private/nautilus-file.c
+++ b/libnautilus-private/nautilus-file.c
@@ -4665,7 +4665,7 @@ static NautilusSpeedTradeoffValue show_text_in_icons;
 static void
 show_text_in_icons_changed_callback (gpointer callback_data)
 {
-	show_text_in_icons = eel_preferences_get_enum (NAUTILUS_PREFERENCES_SHOW_TEXT_IN_ICONS);
+	show_text_in_icons = g_settings_get_enum (nautilus_preferences, NAUTILUS_PREFERENCES_SHOW_TEXT_IN_ICONS);
 }
 
 static void
@@ -4761,9 +4761,10 @@ nautilus_file_should_get_top_left_text (NautilusFile *file)
 
 	/* Add the callback once for the life of our process */
 	if (!show_text_in_icons_callback_added) {
-		eel_preferences_add_callback (NAUTILUS_PREFERENCES_SHOW_TEXT_IN_ICONS,
-						   show_text_in_icons_changed_callback,
-						   NULL);
+		g_signal_connect_swapped (nautilus_preferences,
+					  "changed::" NAUTILUS_PREFERENCES_SHOW_TEXT_IN_ICONS,
+					  G_CALLBACK (show_text_in_icons_changed_callback),
+					  NULL);
 		show_text_in_icons_callback_added = TRUE;
 
 		/* Peek for the first time */
diff --git a/libnautilus-private/nautilus-global-preferences.c b/libnautilus-private/nautilus-global-preferences.c
index 55f6b49..541a505 100644
--- a/libnautilus-private/nautilus-global-preferences.c
+++ b/libnautilus-private/nautilus-global-preferences.c
@@ -180,12 +180,6 @@ typedef struct
  * YOU SHOULD EDIT THE SCHEMAS FILE TO CHANGE DEFAULTS.
  */
 static const PreferenceDefault preference_defaults[] = {
-	{ NAUTILUS_PREFERENCES_SHOW_TEXT_IN_ICONS,
-	  PREFERENCE_STRING,
-	  "local_only",
-	  NULL, NULL,
-	  "speed_tradeoff"
-	},
 	/* Don't show remote directory item counts by default
 	 * because computing them can be annoyingly slow, especially
 	 * for FTP. If we make this fast enough for FTP in particular,
diff --git a/libnautilus-private/nautilus-global-preferences.h b/libnautilus-private/nautilus-global-preferences.h
index 8f9cee2..6b1e5b9 100644
--- a/libnautilus-private/nautilus-global-preferences.h
+++ b/libnautilus-private/nautilus-global-preferences.h
@@ -198,7 +198,7 @@ typedef enum
 	NAUTILUS_SPEED_TRADEOFF_NEVER
 } NautilusSpeedTradeoffValue;
 
-#define NAUTILUS_PREFERENCES_SHOW_TEXT_IN_ICONS		"preferences/show_icon_text"
+#define NAUTILUS_PREFERENCES_SHOW_TEXT_IN_ICONS		"show-icon-text"
 #define NAUTILUS_PREFERENCES_SHOW_DIRECTORY_ITEM_COUNTS "preferences/show_directory_item_counts"
 #define NAUTILUS_PREFERENCES_SHOW_IMAGE_FILE_THUMBNAILS	"preferences/show_image_thumbnails"
 #define NAUTILUS_PREFERENCES_IMAGE_FILE_THUMBNAIL_LIMIT	"preferences/thumbnail_limit"
diff --git a/src/nautilus-file-management-properties.c b/src/nautilus-file-management-properties.c
index c19c229..c378899 100644
--- a/src/nautilus-file-management-properties.c
+++ b/src/nautilus-file-management-properties.c
@@ -110,7 +110,7 @@ static const char * const date_format_values[] = {
 
 static const char * const preview_values[] = {
 	"always",
-	"local_only",
+	"local-only",
 	"never",
 	NULL
 };
@@ -921,10 +921,10 @@ nautilus_file_management_properties_dialog_setup (GtkBuilder *builder, GtkWindow
 	eel_preferences_builder_connect_string_enum_combo_box_slave (builder,
 								     NAUTILUS_FILE_MANAGEMENT_PROPERTIES_SORT_ORDER_WIDGET,
 								     NAUTILUS_PREFERENCES_LIST_VIEW_DEFAULT_SORT_ORDER);
-	eel_preferences_builder_connect_string_enum_combo_box (builder,
-							       NAUTILUS_FILE_MANAGEMENT_PROPERTIES_PREVIEW_TEXT_WIDGET,
-							       NAUTILUS_PREFERENCES_SHOW_TEXT_IN_ICONS,
-							       (const char **) preview_values);
+	bind_builder_enum (builder, nautilus_preferences,
+			   NAUTILUS_FILE_MANAGEMENT_PROPERTIES_PREVIEW_TEXT_WIDGET,
+			   NAUTILUS_PREFERENCES_SHOW_TEXT_IN_ICONS,
+			   (const char **) preview_values);
 	eel_preferences_builder_connect_string_enum_combo_box (builder,
 							       NAUTILUS_FILE_MANAGEMENT_PROPERTIES_PREVIEW_IMAGE_WIDGET,
 							       NAUTILUS_PREFERENCES_SHOW_IMAGE_FILE_THUMBNAILS,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]