[nautilus] Convert show-directory-item-counts to gsettings



commit bcf929af833a83aba7ab58b7ae85697a288d006d
Author: Alexander Larsson <alexl redhat com>
Date:   Thu Jul 22 17:57:13 2010 +0200

    Convert show-directory-item-counts to gsettings

 libnautilus-private/nautilus-directory.c          |    7 ++++---
 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         |    8 ++++----
 src/nautilus-sidebar-title.c                      |   13 ++++++++-----
 6 files changed, 22 insertions(+), 23 deletions(-)
---
diff --git a/libnautilus-private/nautilus-directory.c b/libnautilus-private/nautilus-directory.c
index 8b80bfa..ffe2ac4 100644
--- a/libnautilus-private/nautilus-directory.c
+++ b/libnautilus-private/nautilus-directory.c
@@ -324,9 +324,10 @@ add_preferences_callbacks (void)
 				  "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);
+	g_signal_connect_swapped (nautilus_preferences,
+				  "changed::" NAUTILUS_PREFERENCES_SHOW_DIRECTORY_ITEM_COUNTS,
+				  G_CALLBACK (async_data_preference_changed_callback),
+				  NULL);
 	g_signal_connect_swapped (nautilus_preferences,
 				  "changed::" NAUTILUS_PREFERENCES_DATE_FORMAT,
 				  G_CALLBACK(async_data_preference_changed_callback),
diff --git a/libnautilus-private/nautilus-file.c b/libnautilus-private/nautilus-file.c
index dcf8220..16b77f2 100644
--- a/libnautilus-private/nautilus-file.c
+++ b/libnautilus-private/nautilus-file.c
@@ -4671,7 +4671,7 @@ show_text_in_icons_changed_callback (gpointer callback_data)
 static void
 show_directory_item_count_changed_callback (gpointer callback_data)
 {
-	show_directory_item_count = eel_preferences_get_enum (NAUTILUS_PREFERENCES_SHOW_DIRECTORY_ITEM_COUNTS);
+	show_directory_item_count = g_settings_get_enum (nautilus_preferences, NAUTILUS_PREFERENCES_SHOW_DIRECTORY_ITEM_COUNTS);
 }
 
 static gboolean
@@ -4723,9 +4723,10 @@ nautilus_file_should_show_directory_item_count (NautilusFile *file)
 	
 	/* Add the callback once for the life of our process */
 	if (!show_directory_item_count_callback_added) {
-		eel_preferences_add_callback (NAUTILUS_PREFERENCES_SHOW_DIRECTORY_ITEM_COUNTS,
-						   show_directory_item_count_changed_callback,
-						   NULL);
+		g_signal_connect_swapped (nautilus_preferences,
+					  "changed::" NAUTILUS_PREFERENCES_SHOW_DIRECTORY_ITEM_COUNTS,
+					  G_CALLBACK(show_directory_item_count_changed_callback),
+					  NULL);
 		show_directory_item_count_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 541a505..d822aad 100644
--- a/libnautilus-private/nautilus-global-preferences.c
+++ b/libnautilus-private/nautilus-global-preferences.c
@@ -185,12 +185,6 @@ static const PreferenceDefault preference_defaults[] = {
 	 * for FTP. If we make this fast enough for FTP in particular,
 	 * we should change this default to ALWAYS.
 	 */
-	{ NAUTILUS_PREFERENCES_SHOW_DIRECTORY_ITEM_COUNTS,
-	  PREFERENCE_STRING,
-	  "local_only",
-	  NULL, NULL,
-	  "speed_tradeoff"
-	},
 	{ NAUTILUS_PREFERENCES_SHOW_IMAGE_FILE_THUMBNAILS,
 	  PREFERENCE_STRING,
 	  "local_only",
diff --git a/libnautilus-private/nautilus-global-preferences.h b/libnautilus-private/nautilus-global-preferences.h
index 6b1e5b9..7800b4f 100644
--- a/libnautilus-private/nautilus-global-preferences.h
+++ b/libnautilus-private/nautilus-global-preferences.h
@@ -199,7 +199,7 @@ typedef enum
 } NautilusSpeedTradeoffValue;
 
 #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_DIRECTORY_ITEM_COUNTS "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"
 #define NAUTILUS_PREFERENCES_PREVIEW_SOUND		"preferences/preview_sound"
diff --git a/src/nautilus-file-management-properties.c b/src/nautilus-file-management-properties.c
index c378899..fce46c1 100644
--- a/src/nautilus-file-management-properties.c
+++ b/src/nautilus-file-management-properties.c
@@ -933,10 +933,10 @@ nautilus_file_management_properties_dialog_setup (GtkBuilder *builder, GtkWindow
 							       NAUTILUS_FILE_MANAGEMENT_PROPERTIES_PREVIEW_SOUND_WIDGET,
 							       NAUTILUS_PREFERENCES_PREVIEW_SOUND,
 							       (const char **) preview_values);
-	eel_preferences_builder_connect_string_enum_combo_box (builder,
-							       NAUTILUS_FILE_MANAGEMENT_PROPERTIES_PREVIEW_FOLDER_WIDGET,
-							       NAUTILUS_PREFERENCES_SHOW_DIRECTORY_ITEM_COUNTS,
-							       (const char **) preview_values);
+	bind_builder_enum (builder, nautilus_preferences,
+			   NAUTILUS_FILE_MANAGEMENT_PROPERTIES_PREVIEW_FOLDER_WIDGET,
+			   NAUTILUS_PREFERENCES_SHOW_DIRECTORY_ITEM_COUNTS,
+			   (const char **) preview_values);
 	bind_builder_enum (builder, nautilus_preferences,
 			   NAUTILUS_FILE_MANAGEMENT_PROPERTIES_DATE_FORMAT_WIDGET,
 			   NAUTILUS_PREFERENCES_DATE_FORMAT,
diff --git a/src/nautilus-sidebar-title.c b/src/nautilus-sidebar-title.c
index 3cfb33f..f650cbe 100644
--- a/src/nautilus-sidebar-title.c
+++ b/src/nautilus-sidebar-title.c
@@ -163,10 +163,10 @@ nautilus_sidebar_title_init (NautilusSidebarTitle *sidebar_title)
 	/* initialize the label colors & fonts */
 	style_set (GTK_WIDGET (sidebar_title), NULL);
 
-	eel_preferences_add_callback_while_alive (
-		NAUTILUS_PREFERENCES_SHOW_DIRECTORY_ITEM_COUNTS,
-		(EelPreferencesCallback) update_more_info,
-		sidebar_title, G_OBJECT (sidebar_title));
+	g_signal_connect_swapped (nautilus_preferences,
+				  "changed::" NAUTILUS_PREFERENCES_SHOW_DIRECTORY_ITEM_COUNTS,
+				  G_CALLBACK(update_more_info),
+				  sidebar_title);
 }
 
 /* destroy by throwing away private storage */
@@ -201,6 +201,9 @@ nautilus_sidebar_title_destroy (GtkObject *object)
 		sidebar_title->details = NULL;
 	}
 
+	g_signal_handlers_disconnect_by_func (nautilus_preferences,
+					      update_more_info, sidebar_title);
+
 	EEL_CALL_PARENT (GTK_OBJECT_CLASS, destroy, (object));
 }
 
@@ -435,7 +438,7 @@ update_more_info (NautilusSidebarTitle *sidebar_title)
 	int sidebar_width;
 	PangoLayout *layout;
 	GtkAllocation allocation;
-	
+
 	file = sidebar_title->details->file;
 
 	/* allow components to specify the info if they wish to */



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