[nautilus] Remove last users of eel_preferences and eel_gconf
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] Remove last users of eel_preferences and eel_gconf
- Date: Fri, 23 Jul 2010 10:35:04 +0000 (UTC)
commit ca1c74b6df8a67e305c73adc1893e3552b763835
Author: Alexander Larsson <alexl redhat com>
Date: Fri Jul 23 12:03:26 2010 +0200
Remove last users of eel_preferences and eel_gconf
.../nautilus-desktop-link-monitor.c | 10 +-
.../nautilus-directory-background.c | 40 ++--
libnautilus-private/nautilus-global-preferences.c | 89 --------
libnautilus-private/nautilus-global-preferences.h | 2 +-
libnautilus-private/nautilus-icon-container.c | 25 ++-
libnautilus-private/nautilus-program-choosing.c | 1 -
src/file-manager/fm-tree-view.c | 1 -
src/nautilus-connect-server-dialog-main.c | 2 -
src/nautilus-file-management-properties-main.c | 3 -
src/nautilus-file-management-properties.c | 25 +--
src/nautilus-history-sidebar.c | 1 -
src/nautilus-navigation-window-pane.c | 3 -
src/nautilus-pathbar.c | 1 -
src/nautilus-places-sidebar.c | 1 -
src/nautilus-window-menus.c | 1 -
test/test-nautilus-preferences-display.c | 213 --------------------
test/test.c | 2 -
17 files changed, 45 insertions(+), 375 deletions(-)
---
diff --git a/libnautilus-private/nautilus-desktop-link-monitor.c b/libnautilus-private/nautilus-desktop-link-monitor.c
index c2bdc6d..0610eb8 100644
--- a/libnautilus-private/nautilus-desktop-link-monitor.c
+++ b/libnautilus-private/nautilus-desktop-link-monitor.c
@@ -466,7 +466,7 @@ nautilus_desktop_link_monitor_init (gpointer object, gpointer klass)
static void
remove_link_and_preference (NautilusDesktopLink **link_ref,
const char *preference_key,
- EelPreferencesCallback callback,
+ GCallback callback,
gpointer callback_data)
{
if (*link_ref != NULL) {
@@ -491,22 +491,22 @@ desktop_link_monitor_finalize (GObject *object)
remove_link_and_preference (&monitor->details->home_link,
NAUTILUS_PREFERENCES_DESKTOP_HOME_VISIBLE,
- desktop_home_visible_changed,
+ G_CALLBACK (desktop_home_visible_changed),
monitor);
remove_link_and_preference (&monitor->details->computer_link,
NAUTILUS_PREFERENCES_DESKTOP_COMPUTER_VISIBLE,
- desktop_computer_visible_changed,
+ G_CALLBACK (desktop_computer_visible_changed),
monitor);
remove_link_and_preference (&monitor->details->trash_link,
NAUTILUS_PREFERENCES_DESKTOP_TRASH_VISIBLE,
- desktop_trash_visible_changed,
+ G_CALLBACK (desktop_trash_visible_changed),
monitor);
remove_link_and_preference (&monitor->details->network_link,
NAUTILUS_PREFERENCES_DESKTOP_NETWORK_VISIBLE,
- desktop_network_visible_changed,
+ G_CALLBACK (desktop_network_visible_changed),
monitor);
/* Mounts */
diff --git a/libnautilus-private/nautilus-directory-background.c b/libnautilus-private/nautilus-directory-background.c
index 5b187a6..4c8e152 100644
--- a/libnautilus-private/nautilus-directory-background.c
+++ b/libnautilus-private/nautilus-directory-background.c
@@ -72,7 +72,7 @@ nautilus_connect_desktop_background_to_file_metadata (NautilusIconContainer *ico
*/
nautilus_connect_background_to_file_metadata (GTK_WIDGET (icon_container), file, NAUTILUS_DND_ACTION_SET_AS_FOLDER_BACKGROUND);
- nautilus_file_background_receive_gconf_changes (background);
+ nautilus_file_background_receive_gconf_changes (background);
}
static void
@@ -294,13 +294,13 @@ call_settings_changed (EelBackground *background)
static void
desktop_background_destroyed_callback (EelBackground *background, void *georgeWBush)
{
- guint notification_id;
- guint notification_timeout_id;
+ guint notification_id;
+ guint notification_timeout_id;
notification_id = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (background), "desktop_gconf_notification"));
- eel_gconf_notification_remove (notification_id);
+ gconf_client_notify_remove (nautilus_gconf_client, notification_id);
- notification_timeout_id = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (background), "desktop_gconf_notification_timeout"));
+ notification_timeout_id = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (background), "desktop_gconf_notification_timeout"));
if (notification_timeout_id != 0) {
g_source_remove (notification_timeout_id);
}
@@ -309,22 +309,23 @@ desktop_background_destroyed_callback (EelBackground *background, void *georgeWB
static void
desktop_background_gconf_notify_cb (GConfClient *client, guint notification_id, GConfEntry *entry, gpointer data)
{
- EelBackground *background;
- guint notification_timeout_id;
-
- background = EEL_BACKGROUND (data);
+ EelBackground *background;
+ guint notification_timeout_id;
+
+ background = EEL_BACKGROUND (data);
- notification_timeout_id = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (background), "desktop_gconf_notification_timeout"));
+ notification_timeout_id = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (background), "desktop_gconf_notification_timeout"));
if (strcmp (entry->key, "/desktop/gnome/background/stamp") == 0) {
- if (notification_timeout_id != 0)
+ if (notification_timeout_id != 0) {
g_source_remove (notification_timeout_id);
-
+ }
+
call_settings_changed (background);
}
else if (notification_timeout_id == 0) {
notification_timeout_id = g_timeout_add (300, (GSourceFunc) call_settings_changed, background);
-
+
g_object_set_data (G_OBJECT (background), "desktop_gconf_notification_timeout", GUINT_TO_POINTER (notification_timeout_id));
}
}
@@ -332,14 +333,15 @@ desktop_background_gconf_notify_cb (GConfClient *client, guint notification_id,
static void
nautilus_file_background_receive_gconf_changes (EelBackground *background)
{
- guint notification_id;
+ guint notification_id;
+
+ notification_id = gconf_client_notify_add (nautilus_gconf_client,
+ "/desktop/gnome/background", desktop_background_gconf_notify_cb, background,
+ NULL, NULL);
- eel_gconf_monitor_add ("/desktop/gnome/background");
- notification_id = eel_gconf_notification_add ("/desktop/gnome/background", desktop_background_gconf_notify_cb, background);
+ g_object_set_data (G_OBJECT (background), "desktop_gconf_notification", GUINT_TO_POINTER (notification_id));
- g_object_set_data (G_OBJECT (background), "desktop_gconf_notification", GUINT_TO_POINTER (notification_id));
-
- g_signal_connect (background, "destroy",
+ g_signal_connect (background, "destroy",
G_CALLBACK (desktop_background_destroyed_callback), NULL);
}
diff --git a/libnautilus-private/nautilus-global-preferences.c b/libnautilus-private/nautilus-global-preferences.c
index a6b9c17..35c346f 100644
--- a/libnautilus-private/nautilus-global-preferences.c
+++ b/libnautilus-private/nautilus-global-preferences.c
@@ -28,85 +28,16 @@
#include "nautilus-file-utilities.h"
#include "nautilus-file.h"
-#include <eel/eel-enumeration.h>
#include <eel/eel-glib-extensions.h>
#include <eel/eel-gtk-extensions.h>
#include <eel/eel-stock-dialogs.h>
#include <eel/eel-string.h>
#include <glib/gi18n.h>
-/* Constants */
-#define STRING_ARRAY_DEFAULT_TOKENS_DELIMETER ","
-#define PREFERENCES_SORT_ORDER_MANUALLY 100
-
/* Path for gnome-vfs preferences */
static const char *EXTRA_MONITOR_PATHS[] = { "/desktop/gnome/background",
"/desktop/gnome/lockdown",
NULL };
-
-/* An enumeration used for installing type specific preferences defaults. */
-typedef enum
-{
- PREFERENCE_BOOLEAN = 1,
- PREFERENCE_INTEGER,
- PREFERENCE_STRING,
- PREFERENCE_STRING_ARRAY
-} PreferenceType;
-
-/*
- * A callback which can be used to fetch dynamic fallback values.
- * For example, values that are dependent on the environment (such as user name)
- * cannot be specified as constants.
- */
-typedef gpointer (*PreferencesDefaultValueCallback) (void);
-
-/* A structure that describes a single preference including defaults and visibility. */
-typedef struct
-{
- const char *name;
- PreferenceType type;
- const gpointer fallback_value;
- PreferencesDefaultValueCallback fallback_callback;
- GFreeFunc fallback_callback_result_free_function;
- const char *enumeration_id;
-} PreferenceDefault;
-
-/* The following table defines the default values and user level visibilities of
- * Nautilus preferences. Each of these preferences does not necessarily need to
- * have a UI item in the preferences dialog. To add an item to the preferences
- * dialog, see the NautilusPreferencesItemDescription tables later in this file.
- *
- * Field definitions:
- *
- * 1. name
- *
- * The name of the preference. Usually defined in
- * nautilus-global-preferences.h
- *
- * 2. type
- * The preference type. One of:
- *
- * PREFERENCE_BOOLEAN
- * PREFERENCE_INTEGER
- * PREFERENCE_STRING
- * PREFERENCE_STRING_ARRAY
- *
- * 3. fallback_value
- * Emergency fallback value if our gconf schemas are hosed somehow.
- *
- * 4. fallback_callback
- * callback to get dynamic fallback
- *
- * 5. fallback_callback_result_free_function
- * free result of fallback_callback
- *
- * 6. enumeration_id
- * An an enumeration id is a unique string that identifies an enumeration.
- * If given, an enumeration id can be used to qualify a INTEGER preference.
- * The preferences dialog widgetry will use this enumeration id to find out
- * what choices and descriptions of choices to present to the user.
- */
-
/*
* Public functions
*/
@@ -142,8 +73,6 @@ nautilus_global_preferences_init (void)
initialized = TRUE;
- eel_preferences_init ("/apps/nautilus");
-
nautilus_preferences = g_settings_new("org.gnome.nautilus.preferences");
nautilus_media_preferences = g_settings_new("org.gnome.media-handling");
nautilus_window_state = g_settings_new("org.gnome.nautilus.window-state");
@@ -162,22 +91,4 @@ nautilus_global_preferences_init (void)
GCONF_CLIENT_PRELOAD_ONELEVEL,
NULL);
}
-
- /* Preload everything in a big batch */
- eel_gconf_preload_cache ("/apps/nautilus/preferences",
- GCONF_CLIENT_PRELOAD_ONELEVEL);
- eel_gconf_preload_cache ("/desktop/gnome/file_views",
- GCONF_CLIENT_PRELOAD_ONELEVEL);
- eel_gconf_preload_cache ("/desktop/gnome/background",
- GCONF_CLIENT_PRELOAD_ONELEVEL);
- eel_gconf_preload_cache ("/desktop/gnome/lockdown",
- GCONF_CLIENT_PRELOAD_ONELEVEL);
-
- /* These are always needed for the desktop */
- eel_gconf_preload_cache ("/apps/nautilus/desktop",
- GCONF_CLIENT_PRELOAD_ONELEVEL);
- eel_gconf_preload_cache ("/apps/nautilus/icon_view",
- GCONF_CLIENT_PRELOAD_ONELEVEL);
- eel_gconf_preload_cache ("/apps/nautilus/desktop-metadata",
- GCONF_CLIENT_PRELOAD_RECURSIVE);
}
diff --git a/libnautilus-private/nautilus-global-preferences.h b/libnautilus-private/nautilus-global-preferences.h
index d25fcbf..c6e2fa3 100644
--- a/libnautilus-private/nautilus-global-preferences.h
+++ b/libnautilus-private/nautilus-global-preferences.h
@@ -26,9 +26,9 @@
#ifndef NAUTILUS_GLOBAL_PREFERENCES_H
#define NAUTILUS_GLOBAL_PREFERENCES_H
-#include <eel/eel-preferences.h>
#include <libnautilus-private/nautilus-global-preferences.h>
#include <gio/gio.h>
+#include <gconf/gconf-client.h>
G_BEGIN_DECLS
diff --git a/libnautilus-private/nautilus-icon-container.c b/libnautilus-private/nautilus-icon-container.c
index 7106312..21b23ea 100644
--- a/libnautilus-private/nautilus-icon-container.c
+++ b/libnautilus-private/nautilus-icon-container.c
@@ -45,8 +45,6 @@
#include <eel/eel-editable-label.h>
#include <eel/eel-marshal.h>
#include <eel/eel-string.h>
-#include <eel/eel-preferences.h>
-#include <eel/eel-enumeration.h>
#include <eel/eel-canvas-rect-ellipse.h>
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
@@ -6257,14 +6255,22 @@ get_text_ellipsis_limit_for_zoom (char **strs,
return success;
}
+static const char * zoom_level_names[] = {
+ "smallest",
+ "smaller",
+ "small",
+ "standard",
+ "large",
+ "larger",
+ "largest"
+};
+
static void
text_ellipsis_limit_changed_callback (gpointer callback_data)
{
char **pref;
unsigned int i;
int one_limit;
- const EelEnumeration *eenum;
- const EelEnumerationEntry *entry;
pref = g_settings_get_strv (nautilus_icon_view_preferences,
NAUTILUS_PREFERENCES_ICON_VIEW_TEXT_ELLIPSIS_LIMIT);
@@ -6276,12 +6282,11 @@ text_ellipsis_limit_changed_callback (gpointer callback_data)
}
/* override for each zoom level */
- eenum = eel_enumeration_lookup ("default_zoom_level");
- g_assert (eenum != NULL);
- for (i = 0; i < eel_enumeration_get_length (eenum); i++) {
- entry = eel_enumeration_get_nth_entry (eenum, i);
- if (get_text_ellipsis_limit_for_zoom (pref, entry->name, &one_limit)) {
- text_ellipsis_limits[entry->value] = one_limit;
+ for (i = 0; i < G_N_ELEMENTS(zoom_level_names); i++) {
+ if (get_text_ellipsis_limit_for_zoom (pref,
+ zoom_level_names[i],
+ &one_limit)) {
+ text_ellipsis_limits[i] = one_limit;
}
}
diff --git a/libnautilus-private/nautilus-program-choosing.c b/libnautilus-private/nautilus-program-choosing.c
index 2ac6d04..a939800 100644
--- a/libnautilus-private/nautilus-program-choosing.c
+++ b/libnautilus-private/nautilus-program-choosing.c
@@ -34,7 +34,6 @@
#include <eel/eel-glib-extensions.h>
#include <eel/eel-gnome-extensions.h>
#include <eel/eel-stock-dialogs.h>
-#include <eel/eel-preferences.h>
#include <eel/eel-string.h>
#include <gtk/gtk.h>
#include <glib/gi18n.h>
diff --git a/src/file-manager/fm-tree-view.c b/src/file-manager/fm-tree-view.c
index dcd1f57..cd02acc 100644
--- a/src/file-manager/fm-tree-view.c
+++ b/src/file-manager/fm-tree-view.c
@@ -38,7 +38,6 @@
#include <eel/eel-alert-dialog.h>
#include <eel/eel-glib-extensions.h>
#include <eel/eel-gtk-extensions.h>
-#include <eel/eel-preferences.h>
#include <eel/eel-stock-dialogs.h>
#include <gtk/gtk.h>
#include <glib/gi18n.h>
diff --git a/src/nautilus-connect-server-dialog-main.c b/src/nautilus-connect-server-dialog-main.c
index 3d35089..8804459 100644
--- a/src/nautilus-connect-server-dialog-main.c
+++ b/src/nautilus-connect-server-dialog-main.c
@@ -33,7 +33,6 @@
#include <stdlib.h>
-#include <eel/eel-preferences.h>
#include <eel/eel-stock-dialogs.h>
#include <libnautilus-private/nautilus-icon-names.h>
@@ -197,7 +196,6 @@ main (int argc, char *argv[])
g_option_context_free (context);
nautilus_global_preferences_init ();
- eel_preferences_init ("/apps/nautilus");
gtk_window_set_default_icon_name (NAUTILUS_ICON_FOLDER);
diff --git a/src/nautilus-file-management-properties-main.c b/src/nautilus-file-management-properties-main.c
index 917a5e2..856906b 100644
--- a/src/nautilus-file-management-properties-main.c
+++ b/src/nautilus-file-management-properties-main.c
@@ -30,8 +30,6 @@
#include <libnautilus-private/nautilus-module.h>
#include <libnautilus-private/nautilus-global-preferences.h>
-#include <eel/eel-preferences.h>
-
#include "nautilus-file-management-properties.h"
static void
@@ -52,7 +50,6 @@ main (int argc, char *argv[])
gtk_init (&argc, &argv);
- eel_preferences_init ("/apps/nautilus");
nautilus_global_preferences_init ();
nautilus_module_setup ();
diff --git a/src/nautilus-file-management-properties.c b/src/nautilus-file-management-properties.c
index bbdc0b5..5aff589 100644
--- a/src/nautilus-file-management-properties.c
+++ b/src/nautilus-file-management-properties.c
@@ -33,9 +33,7 @@
#include <glib/gi18n.h>
-#include <eel/eel-gconf-extensions.h>
#include <eel/eel-glib-extensions.h>
-#include <eel/eel-preferences.h>
#include <libnautilus-private/nautilus-column-chooser.h>
#include <libnautilus-private/nautilus-column-utilities.h>
@@ -252,11 +250,6 @@ nautilus_file_management_properties_dialog_response_cb (GtkDialog *parent,
}
preferences_show_help (GTK_WINDOW (parent), "user-guide", section);
} else if (response_id == GTK_RESPONSE_CLOSE) {
- /* remove gconf monitors */
- eel_gconf_monitor_remove ("/apps/nautilus/icon_view");
- eel_gconf_monitor_remove ("/apps/nautilus/list_view");
- eel_gconf_monitor_remove ("/apps/nautilus/preferences");
- eel_gconf_monitor_remove ("/desktop/gnome/file_views");
g_signal_handlers_disconnect_by_func (nautilus_media_preferences,
nautilus_file_management_properties_dialog_update_media_sensitivity,
builder);
@@ -402,7 +395,7 @@ update_caption_combo_box (GtkBuilder *builder,
}
static void
-update_icon_captions_from_gconf (GtkBuilder *builder)
+update_icon_captions_from_settings (GtkBuilder *builder)
{
char **captions;
int i, j;
@@ -459,7 +452,7 @@ nautilus_file_management_properties_dialog_setup_icon_caption_page (GtkBuilder *
nautilus_column_list_free (columns);
- update_icon_captions_from_gconf (builder);
+ update_icon_captions_from_settings (builder);
}
static void
@@ -909,20 +902,8 @@ nautilus_file_management_properties_dialog_setup (GtkBuilder *builder, GtkWindow
{
GtkWidget *dialog;
- /* setup gconf stuff */
- eel_gconf_monitor_add ("/apps/nautilus/icon_view");
- eel_gconf_preload_cache ("/apps/nautilus/icon_view", GCONF_CLIENT_PRELOAD_ONELEVEL);
- eel_gconf_monitor_add ("/apps/nautilus/compact_view");
- eel_gconf_preload_cache ("/apps/nautilus/compact_view", GCONF_CLIENT_PRELOAD_ONELEVEL);
- eel_gconf_monitor_add ("/apps/nautilus/list_view");
- eel_gconf_preload_cache ("/apps/nautilus/list_view", GCONF_CLIENT_PRELOAD_ONELEVEL);
- eel_gconf_monitor_add ("/apps/nautilus/preferences");
- eel_gconf_preload_cache ("/apps/nautilus/preferences", GCONF_CLIENT_PRELOAD_ONELEVEL);
- eel_gconf_monitor_add ("/desktop/gnome/file_views");
- eel_gconf_preload_cache ("/desktop/gnome/file_views", GCONF_CLIENT_PRELOAD_ONELEVEL);
-
/* setup UI */
- nautilus_file_management_properties_size_group_create (builder,
+ nautilus_file_management_properties_size_group_create (builder,
"views_label",
5);
nautilus_file_management_properties_size_group_create (builder,
diff --git a/src/nautilus-history-sidebar.c b/src/nautilus-history-sidebar.c
index b85112f..4b2572f 100644
--- a/src/nautilus-history-sidebar.c
+++ b/src/nautilus-history-sidebar.c
@@ -30,7 +30,6 @@
#include <eel/eel-debug.h>
#include <eel/eel-gtk-extensions.h>
#include <eel/eel-glib-extensions.h>
-#include <eel/eel-preferences.h>
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include <libnautilus-private/nautilus-bookmark.h>
diff --git a/src/nautilus-navigation-window-pane.c b/src/nautilus-navigation-window-pane.c
index 05ea970..94e0741 100644
--- a/src/nautilus-navigation-window-pane.c
+++ b/src/nautilus-navigation-window-pane.c
@@ -35,9 +35,6 @@
#include <libnautilus-private/nautilus-view-factory.h>
#include <libnautilus-private/nautilus-entry.h>
-#include <eel/eel-preferences.h>
-
-
static void nautilus_navigation_window_pane_init (NautilusNavigationWindowPane *pane);
static void nautilus_navigation_window_pane_class_init (NautilusNavigationWindowPaneClass *class);
static void nautilus_navigation_window_pane_dispose (GObject *object);
diff --git a/src/nautilus-pathbar.c b/src/nautilus-pathbar.c
index 0698fe5..736c842 100644
--- a/src/nautilus-pathbar.c
+++ b/src/nautilus-pathbar.c
@@ -22,7 +22,6 @@
#include <eel/eel-debug.h>
#include <eel/eel-gtk-extensions.h>
#include <eel/eel-glib-extensions.h>
-#include <eel/eel-preferences.h>
#include <eel/eel-string.h>
#include <gtk/gtk.h>
#include <glib/gi18n.h>
diff --git a/src/nautilus-places-sidebar.c b/src/nautilus-places-sidebar.c
index bfb9a3e..15b0ee0 100644
--- a/src/nautilus-places-sidebar.c
+++ b/src/nautilus-places-sidebar.c
@@ -26,7 +26,6 @@
#include <eel/eel-debug.h>
#include <eel/eel-gtk-extensions.h>
#include <eel/eel-glib-extensions.h>
-#include <eel/eel-preferences.h>
#include <eel/eel-string.h>
#include <eel/eel-stock-dialogs.h>
#include <gdk/gdkkeysyms.h>
diff --git a/src/nautilus-window-menus.c b/src/nautilus-window-menus.c
index 0efd5ea..ab84dcc 100644
--- a/src/nautilus-window-menus.c
+++ b/src/nautilus-window-menus.c
@@ -43,7 +43,6 @@
#include <gio/gio.h>
#include <glib/gi18n.h>
#include <eel/eel-gtk-extensions.h>
-#include <eel/eel-preferences.h>
#include <libnautilus-extension/nautilus-menu-provider.h>
#include <libnautilus-private/nautilus-file-utilities.h>
#include <libnautilus-private/nautilus-global-preferences.h>
diff --git a/test/test.c b/test/test.c
index 8390960..76fd44c 100644
--- a/test/test.c
+++ b/test/test.c
@@ -2,8 +2,6 @@
#include <sys/types.h>
#include <unistd.h>
-#include <eel/eel-preferences.h>
-
void
test_init (int *argc,
char ***argv)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]