[Nautilus-list] user levels, gconf patch
- From: Havoc Pennington <hp redhat com>
- To: nautilus-list eazel com
- Subject: [Nautilus-list] user levels, gconf patch
- Date: 04 Jan 2002 18:39:13 -0500
Hi,
Appended patches to eel and nautilus. Requires HEAD gconf from a few
minutes ago to avoid a warning about preloading. Otherwise it seems to
work OK for me. I haven't actually run a CORBA debug trace, but I
would expect the patch to noticeably reduce gconf-related traffic.
Darin I didn't see what needed changing in gnome-vfs? I added a
preload in there but that's all.
The obvious bad thing about this patch is that all advanced prefs are
now visible always; I think going through the prefs dialog with a
hatchet is likely in order. But it would make sense to me to do that
separately. eel_preferences_set_is_invisible() should still work as a
way to temporarily hide a pref we aren't sure we want to remove.
Havoc
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/eel/ChangeLog,v
retrieving revision 1.234
diff -u -p -u -r1.234 ChangeLog
--- ChangeLog 2002/01/04 16:35:57 1.234
+++ ChangeLog 2002/01/04 23:28:06
@@ -1,3 +1,42 @@
+2002-01-04 Havoc Pennington <hp pobox com>
+
+ * eel/eel-font-picker.c (font_picker_get_selected_style_entry):
+ add FIXME and GNOME2_CONVERSION_COMPLETE for similar
+ option_menu->menu_item issue
+
+ * eel/eel-string-picker.c (eel_string_picker_get_selected_string):
+ use gtk_option_menu_get_history() instead of setting item index
+ as object data - option_menu->menu_item is no longer non-NULL
+ apparently, when we want it to be.
+
+ * eel/eel-gconf-extensions.c
+ (eel_gconf_value_get_eel_string_list): add a function to get an
+ EelStringList
+
+ * eel/eel-preferences-item.c
+ (preferences_item_create_enumeration_list): use emergency fallback
+ instead of default for deciding on number of string pickers
+
+ * eel/eel-graphic-effects.c: don't include art_config.h, it
+ ended up being included twice and has no include guards
+
+ * eel/eel-preferences.c: remove user levels, remove concept of
+ installing defaults here, never "fix" invalid values in gconf
+ database (as we did when a list of enum values was invalid), don't
+ bother to cache values since GConfClient does already, remove
+ callbacks_blocked which incorrectly relied on
+ synchronicity/non-reentrancy of gconf, don't store the default
+ value, remove all suggest_sync
+ (eel_preferences_set_emergency_fallback): new function to replace
+ setting defaults
+ (eel_preferences_get_emergency_fallback): getter
+
+ * eel/eel-gconf-extensions.c (eel_gconf_preload_cache): New
+ function to allow us to get a bunch of GConf data in a single
+ round trip
+ (eel_gconf_get_default_value): new function to get the default
+ from the schema
+
2002-01-04 Anders Carlsson <andersca gnu org>
* eel/eel-gdk-extensions.c (eel_gdk_rgb_to_color): Fix up
Index: eel/eel-caption.c
===================================================================
RCS file: /cvs/gnome/eel/eel/eel-caption.c,v
retrieving revision 1.10
diff -u -p -u -r1.10 eel-caption.c
--- eel/eel-caption.c 2002/01/01 23:21:53 1.10
+++ eel/eel-caption.c 2002/01/04 23:28:31
@@ -150,7 +150,7 @@ eel_caption_new (void)
*/
void
eel_caption_set_title_label (EelCaption *caption,
- const char *title_label)
+ const char *title_label)
{
g_return_if_fail (EEL_IS_CAPTION (caption));
g_return_if_fail (title_label != NULL);
@@ -222,9 +222,9 @@ eel_caption_get_title_label_width (const
*/
void
eel_caption_set_child (EelCaption *caption,
- GtkWidget *child,
- gboolean expand,
- gboolean fill)
+ GtkWidget *child,
+ gboolean expand,
+ gboolean fill)
{
g_return_if_fail (EEL_IS_CAPTION (caption));
g_return_if_fail (GTK_IS_WIDGET (child));
@@ -253,7 +253,7 @@ eel_caption_set_child (EelCaption *capti
*/
void
eel_caption_set_extra_spacing (EelCaption *caption,
- int extra_spacing)
+ int extra_spacing)
{
g_return_if_fail (EEL_IS_CAPTION (caption));
g_return_if_fail (extra_spacing >= 0);
Index: eel/eel-font-picker.c
===================================================================
RCS file: /cvs/gnome/eel/eel/eel-font-picker.c,v
retrieving revision 1.16
diff -u -p -u -r1.16 eel-font-picker.c
--- eel/eel-font-picker.c 2002/01/04 00:14:27 1.16
+++ eel/eel-font-picker.c 2002/01/04 23:28:32
@@ -931,7 +931,10 @@ font_picker_get_selected_style_entry (co
GtkWidget *selected_style_menu_item;
g_return_val_if_fail (EEL_IS_FONT_PICKER (font_picker), NULL);
-
+
+#ifdef GNOME2_CONVERSION_COMPLETE
+ /* FIXME option_menu->menu_item can apparently be NULL in GTK 2 */
+#endif
selected_font_menu_item = GTK_OPTION_MENU (font_picker->details->option_menu)->menu_item;
g_return_val_if_fail (GTK_IS_MENU_ITEM (selected_font_menu_item), NULL);
Index: eel/eel-gconf-extensions.c
===================================================================
RCS file: /cvs/gnome/eel/eel/eel-gconf-extensions.c,v
retrieving revision 1.6
diff -u -p -u -r1.6 eel-gconf-extensions.c
--- eel/eel-gconf-extensions.c 2001/12/18 17:49:45 1.6
+++ eel/eel-gconf-extensions.c 2002/01/04 23:28:32
@@ -322,6 +322,28 @@ eel_gconf_monitor_remove (const char *di
}
void
+eel_gconf_preload_cache (const char *directory,
+ GConfClientPreloadType preload_type)
+{
+ GError *error = NULL;
+ GConfClient *client;
+
+ if (directory == NULL) {
+ return;
+ }
+
+ client = gconf_client_get_default ();
+ g_return_if_fail (client != NULL);
+
+ gconf_client_preload (client,
+ directory,
+ preload_type,
+ &error);
+
+ eel_gconf_handle_error (&error);
+}
+
+void
eel_gconf_suggest_sync (void)
{
GConfClient *client;
@@ -358,6 +380,30 @@ eel_gconf_get_value (const char *key)
return value;
}
+GConfValue*
+eel_gconf_get_default_value (const char *key)
+{
+ GConfValue *value = NULL;
+ GConfClient *client;
+ GError *error = NULL;
+
+ g_return_val_if_fail (key != NULL, NULL);
+
+ client = eel_gconf_client_get_global ();
+ g_return_val_if_fail (client != NULL, NULL);
+
+ value = gconf_client_get_default_from_schema (client, key, &error);
+
+ if (eel_gconf_handle_error (&error)) {
+ if (value != NULL) {
+ gconf_value_free (value);
+ value = NULL;
+ }
+ }
+
+ return value;
+}
+
static gboolean
simple_value_is_equal (const GConfValue *a,
const GConfValue *b)
@@ -561,4 +607,22 @@ eel_gconf_value_set_string_list (GConfVa
gconf_value_free (node->data);
}
g_slist_free (value_list);
+}
+
+EelStringList *
+eel_gconf_value_get_eel_string_list (const GConfValue *value)
+{
+ GSList *slist;
+ EelStringList *result;
+
+ if (value == NULL) {
+ return eel_string_list_new (TRUE);
+ }
+ g_return_val_if_fail (value->type == GCONF_VALUE_LIST, eel_string_list_new (TRUE));
+ g_return_val_if_fail (gconf_value_get_list_type (value) == GCONF_VALUE_STRING, eel_string_list_new (TRUE));
+
+ slist = eel_gconf_value_get_string_list (value);
+ result = eel_string_list_new_from_g_slist (slist, TRUE);
+ eel_g_slist_free_deep (slist);
+ return result;
}
Index: eel/eel-gconf-extensions.h
===================================================================
RCS file: /cvs/gnome/eel/eel/eel-gconf-extensions.h,v
retrieving revision 1.3
diff -u -p -u -r1.3 eel-gconf-extensions.h
--- eel/eel-gconf-extensions.h 2001/08/22 17:04:00 1.3
+++ eel/eel-gconf-extensions.h 2002/01/04 23:28:32
@@ -28,6 +28,7 @@
#include <glib.h>
#include <gconf/gconf.h>
#include <gconf/gconf-client.h>
+#include <eel/eel-string-list.h>
G_BEGIN_DECLS
@@ -50,8 +51,11 @@ void eel_gconf_set_string_list
gboolean eel_gconf_is_default (const char *key);
gboolean eel_gconf_monitor_add (const char *directory);
gboolean eel_gconf_monitor_remove (const char *directory);
+void eel_gconf_preload_cache (const char *directory,
+ GConfClientPreloadType preload_type);
void eel_gconf_suggest_sync (void);
GConfValue* eel_gconf_get_value (const char *key);
+GConfValue* eel_gconf_get_default_value (const char *key);
gboolean eel_gconf_value_is_equal (const GConfValue *a,
const GConfValue *b);
void eel_gconf_value_free (GConfValue *value);
@@ -62,6 +66,7 @@ void eel_gconf_notification_remo
GSList * eel_gconf_value_get_string_list (const GConfValue *value);
void eel_gconf_value_set_string_list (GConfValue *value,
const GSList *string_list);
+EelStringList *eel_gconf_value_get_eel_string_list (const GConfValue *value);
G_END_DECLS
Index: eel/eel-preferences-item.c
===================================================================
RCS file: /cvs/gnome/eel/eel/eel-preferences-item.c,v
retrieving revision 1.17
diff -u -p -u -r1.17 eel-preferences-item.c
--- eel/eel-preferences-item.c 2002/01/03 23:43:11 1.17
+++ eel/eel-preferences-item.c 2002/01/04 23:28:33
@@ -442,6 +442,7 @@ preferences_item_create_enumeration_list
guint j;
char *enumeration_id;
char *enum_description;
+ GConfValue *fallback;
EelStringList *default_value;
guint num_pickers;
GtkWidget *string_picker;
@@ -456,9 +457,14 @@ preferences_item_create_enumeration_list
g_return_if_fail (eel_strlen (enumeration_id) > 0);
g_return_if_fail (eel_enumeration_id_get_length (enumeration_id) > 0);
- /* FIXME: Hard coded user level */
- default_value = eel_preferences_default_get_string_list (item->details->preference_name, 0);
+ fallback = eel_preferences_get_emergency_fallback (item->details->preference_name);
+ g_assert (fallback);
+
+ default_value = eel_gconf_value_get_eel_string_list (fallback);
+
+ gconf_value_free (fallback);
+
num_pickers = eel_string_list_get_length (default_value);
g_return_if_fail (num_pickers > 0);
Index: eel/eel-preferences.c
===================================================================
RCS file: /cvs/gnome/eel/eel/eel-preferences.c,v
retrieving revision 1.6
diff -u -p -u -r1.6 eel-preferences.c
--- eel/eel-preferences.c 2001/11/04 02:53:00 1.6
+++ eel/eel-preferences.c 2002/01/04 23:28:33
@@ -36,9 +36,6 @@
#include <gtk/gtksignal.h>
#include <libgnome/gnome-i18n.h>
-#define DEFAULT_USER_LEVEL EEL_USER_LEVEL_INTERMEDIATE
-#define USER_LEVEL_KEY "/apps/nautilus/user_level"
-
/* An enumeration used for updating auto-storage variables in a type-specific way.
* FIXME: there is another enumeration like this in eel-global-preferences.c,
* used for different purposes but in a related way. Should we combine them?
@@ -63,13 +60,10 @@ typedef struct {
PreferenceType type;
gboolean invisible;
GList *callback_list;
- gboolean callbacks_blocked;
GList *auto_storage_list;
int gconf_connection_id;
char *enumeration_id;
- GConfValue *cached_value;
- int visible_user_level;
- GConfValue *default_values[3];
+ GConfValue *fallback;
} PreferencesEntry;
/*
@@ -84,44 +78,21 @@ typedef struct {
gpointer callback_data;
} PreferencesCallbackEntry;
-static const char *user_level_names_for_display[] = {
- N_("Beginner"),
- N_("Intermediate"),
- N_("Advanced")
-};
-
-static const char *user_level_names_for_storage[] = {
- "novice",
- "intermediate",
- "advanced"
-};
-
static const char * preferences_peek_storage_path (void);
static gboolean preferences_preference_is_gconf_key (const char *name);
-static gboolean preferences_preference_is_user_level (const char *name);
-static gboolean preferences_preference_is_default (const char *name);
static char * preferences_key_make (const char *name);
-static void preferences_user_level_changed_notice (GConfClient *client,
- guint connection_id,
- GConfEntry *gconf_entry,
- gpointer user_data);
static void preferences_something_changed_notice (GConfClient *client,
guint connection_id,
GConfEntry *gconf_entry,
gpointer user_data);
-static void preferences_global_table_check_changes_function (gpointer key,
- gpointer value,
- gpointer callback_data);
static GHashTable * preferences_global_table_get_global (void);
static void preferences_callback_entry_free (PreferencesCallbackEntry *callback_entry);
static void preferences_entry_update_auto_storage (PreferencesEntry *entry);
static void preferences_global_table_free (void);
-static const char * preferences_peek_user_level_name_for_storage (int user_level);
+
static PreferencesEntry *preferences_global_table_lookup_or_insert (const char *name);
-static const GConfValue *preferences_find_first_non_null_default_value (const char *name,
- int user_level);
+static GConfValue *preferences_get_default_value (const char *name);
-static guint user_level_changed_connection_id = EEL_GCONF_UNDEFINED_CONNECTION;
static GHashTable *global_table = NULL;
static char *storage_path = NULL;
static gboolean initialized = FALSE;
@@ -216,35 +187,23 @@ preferences_get_value (const char *name)
{
GConfValue *result;
char *key;
- const GConfValue *default_value;
-
+ PreferencesEntry *entry;
+
g_return_val_if_fail (name != NULL, 0);
g_return_val_if_fail (preferences_is_initialized (), 0);
- /* If the preference is default (no value is stored for it) or
- * it is not visible in the current user level, return the
- * default_value */
- if (preferences_preference_is_default (name)
- || !eel_preferences_visible_in_current_user_level (name)) {
- default_value = preferences_find_first_non_null_default_value (name, eel_preferences_get_user_level ());
- return (default_value != NULL)
- ? gconf_value_copy ((GConfValue *) default_value)
- : NULL;
- }
-
key = preferences_key_make (name);
result = eel_gconf_get_value (key);
g_free (key);
- return result;
-}
+ if (result == NULL) {
+ entry = preferences_global_table_lookup_or_insert (name);
-static const char *
-preferences_peek_user_level_name_for_storage (int user_level)
-{
- user_level = eel_preferences_user_level_clamp (user_level);
+ if (entry->fallback)
+ result = gconf_value_copy (entry->fallback);
+ }
- return user_level_names_for_storage[user_level];
+ return result;
}
/* If the preference name begind with a "/", we interpret
@@ -261,15 +220,6 @@ preferences_preference_is_gconf_key (con
return TRUE;
}
-static gboolean
-preferences_preference_is_user_level (const char *name)
-{
- g_return_val_if_fail (name != NULL, FALSE);
-
- return eel_str_is_equal (name, USER_LEVEL_KEY)
- || eel_str_is_equal (name, "user_level");
-}
-
static char *
preferences_key_make (const char *name)
{
@@ -280,101 +230,36 @@ preferences_key_make (const char *name)
}
/* Otherwise, we prefix it with the path */
- return g_strdup_printf ("%s/%s", preferences_peek_storage_path (), name);
+ return g_strconcat (preferences_peek_storage_path (), "/",
+ name, NULL);
}
-/* Find the first non NULL default_value that is less than or
- * equal to the given user level */
-static const GConfValue *
-preferences_find_first_non_null_default_value (const char *name,
- int user_level)
+/* Get default from schema or emergency fallback */
+static GConfValue *
+preferences_get_default_value (const char *name)
{
- const GConfValue *result;
+ GConfValue *result;
PreferencesEntry *entry;
- gboolean done;
+ char *key;
g_return_val_if_fail (name != NULL, NULL);
- entry = preferences_global_table_lookup_or_insert (name);
- g_assert (entry != NULL);
-
- user_level = eel_preferences_user_level_clamp (user_level);
-
- done = FALSE;
- while (!done) {
- result = entry->default_values[user_level];
- done = (user_level == 0) || (result != NULL);
- if (!done) {
- user_level--;
- }
- }
-
- return result;
-}
-
-static gboolean
-preferences_preference_is_default (const char *name)
-{
- gboolean result;
- char *key;
-
- g_return_val_if_fail (name != NULL, FALSE);
-
key = preferences_key_make (name);
- result = eel_gconf_is_default (key);
- g_free (key);
-
- return result;
-}
-
-static void
-preferences_block_callbacks (const char *name)
-{
- PreferencesEntry *entry;
-
- g_return_if_fail (name != NULL);
- g_return_if_fail (preferences_is_initialized ());
-
- entry = preferences_global_table_lookup_or_insert (name);
- g_assert (entry != NULL);
-
- entry->callbacks_blocked = TRUE;
-}
-
-static void
-preferences_unblock_callbacks (const char *name)
-{
- PreferencesEntry *entry;
- g_return_if_fail (name != NULL);
- g_return_if_fail (preferences_is_initialized ());
+ result = eel_gconf_get_default_value (key);
- entry = preferences_global_table_lookup_or_insert (name);
- g_assert (entry != NULL);
+ g_free (key);
- entry->callbacks_blocked = FALSE;
+ if (result == NULL) {
+ entry = preferences_global_table_lookup_or_insert (name);
+ if (entry && entry->fallback)
+ result = gconf_value_copy (entry->fallback);
+ }
+
+ return result;
}
/* Public preferences functions */
-int
-eel_preferences_get_visible_user_level (const char *name)
-{
- g_return_val_if_fail (name != NULL, FALSE);
- g_return_val_if_fail (preferences_is_initialized (), FALSE);
-
- return preferences_global_table_lookup_or_insert (name)->visible_user_level;
-}
-
-void
-eel_preferences_set_visible_user_level (const char *name,
- int visible_user_level)
-{
- g_return_if_fail (name != NULL);
- g_return_if_fail (preferences_is_initialized ());
-
- preferences_global_table_lookup_or_insert (name)->visible_user_level =
- eel_preferences_user_level_clamp (visible_user_level);
-}
gboolean
eel_preferences_get_is_invisible (const char *name)
@@ -442,7 +327,6 @@ eel_preferences_set_integer (const char
if (int_value != old_value) {
eel_gconf_set_integer (key, int_value);
- eel_gconf_suggest_sync ();
}
g_free (key);
}
@@ -478,8 +362,6 @@ eel_preferences_set (const char *name,
if (strcmp (string_value, old_value) != 0) {
eel_gconf_set_string (key, string_value);
-
- eel_gconf_suggest_sync ();
}
g_free (key);
}
@@ -516,8 +398,6 @@ eel_preferences_set_string_list (const c
g_free (key);
eel_g_slist_free_deep (slist);
-
- eel_gconf_suggest_sync ();
}
static gboolean
@@ -547,7 +427,7 @@ eel_preferences_get_string_list (const c
EelStringList *result;
GConfValue *value;
PreferencesEntry *entry;
- const GConfValue *default_value;
+ GConfValue *default_value;
g_return_val_if_fail (name != NULL, 0);
g_return_val_if_fail (preferences_is_initialized (), 0);
@@ -571,202 +451,14 @@ eel_preferences_get_string_list (const c
/* Forget the bad value and use the default instead */
eel_string_list_free (result);
-
- default_value = preferences_find_first_non_null_default_value (name, eel_preferences_get_user_level ());
- result = preferences_gconf_value_get_string_list (default_value);
-
- /* Go the extra mile and fix the problem for the user */
- preferences_block_callbacks (name);
- eel_preferences_set_string_list (name, result);
- preferences_unblock_callbacks (name);
- return result;
-}
-
-int
-eel_preferences_get_user_level (void)
-{
- char *user_level;
- int result;
-
- g_return_val_if_fail (preferences_is_initialized (), 0);
-
- user_level = eel_gconf_get_string (USER_LEVEL_KEY);
-
- if (eel_str_is_equal (user_level, "advanced")) {
- result = EEL_USER_LEVEL_ADVANCED;
- } else if (eel_str_is_equal (user_level, "intermediate")) {
- result = EEL_USER_LEVEL_INTERMEDIATE;
- } else if (eel_str_is_equal (user_level, "novice")) {
- result = EEL_USER_LEVEL_NOVICE;
- } else {
- result = DEFAULT_USER_LEVEL;
+ default_value = preferences_get_default_value (name);
+ if (default_value) {
+ result = preferences_gconf_value_get_string_list (default_value);
+ gconf_value_free (default_value);
}
-
- g_free (user_level);
- return result;
-}
-
-void
-eel_preferences_set_user_level (int user_level)
-{
- g_return_if_fail (preferences_is_initialized ());
- g_return_if_fail (eel_preferences_user_level_is_valid (user_level));
-
- user_level = eel_preferences_user_level_clamp (user_level);
-
- eel_gconf_set_string (USER_LEVEL_KEY, user_level_names_for_storage[user_level]);
-
- eel_gconf_suggest_sync ();
-}
-
-void
-eel_preferences_default_set_integer (const char *name,
- int user_level,
- int int_value)
-{
- PreferencesEntry *entry;
-
- g_return_if_fail (name != NULL);
- g_return_if_fail (preferences_is_initialized ());
- g_return_if_fail (eel_preferences_user_level_is_valid (user_level));
-
- entry = preferences_global_table_lookup_or_insert (name);
- g_assert (entry != NULL);
-
- if (entry->default_values[user_level] == NULL) {
- entry->default_values[user_level] = gconf_value_new (GCONF_VALUE_INT);
- }
- gconf_value_set_int (entry->default_values[user_level], int_value);
-}
-
-int
-eel_preferences_default_get_integer (const char *name,
- int user_level)
-{
- PreferencesEntry *entry;
-
- g_return_val_if_fail (name != NULL, 0);
- g_return_val_if_fail (preferences_is_initialized (), 0);
- g_return_val_if_fail (eel_preferences_user_level_is_valid (user_level), 0);
-
- entry = preferences_global_table_lookup_or_insert (name);
- g_assert (entry != NULL);
-
- return preferences_gconf_value_get_int (entry->default_values[user_level]);
-}
-
-void
-eel_preferences_default_set_boolean (const char *name,
- int user_level,
- gboolean boolean_value)
-{
- PreferencesEntry *entry;
-
- g_return_if_fail (name != NULL);
- g_return_if_fail (preferences_is_initialized ());
- g_return_if_fail (eel_preferences_user_level_is_valid (user_level));
-
- entry = preferences_global_table_lookup_or_insert (name);
- g_assert (entry != NULL);
-
- if (entry->default_values[user_level] == NULL) {
- entry->default_values[user_level] = gconf_value_new (GCONF_VALUE_BOOL);
- }
- gconf_value_set_bool (entry->default_values[user_level], boolean_value);
-}
-
-gboolean
-eel_preferences_default_get_boolean (const char *name,
- int user_level)
-{
- PreferencesEntry *entry;
-
- g_return_val_if_fail (name != NULL, FALSE);
- g_return_val_if_fail (preferences_is_initialized (), FALSE);
- g_return_val_if_fail (eel_preferences_user_level_is_valid (user_level), FALSE);
-
- entry = preferences_global_table_lookup_or_insert (name);
- g_assert (entry != NULL);
-
- return preferences_gconf_value_get_bool (entry->default_values[user_level]);
-}
-
-void
-eel_preferences_default_set_string (const char *name,
- int user_level,
- const char *string_value)
-{
- PreferencesEntry *entry;
- g_return_if_fail (name != NULL);
- g_return_if_fail (preferences_is_initialized ());
- g_return_if_fail (eel_preferences_user_level_is_valid (user_level));
-
- entry = preferences_global_table_lookup_or_insert (name);
- g_assert (entry != NULL);
-
- if (entry->default_values[user_level] == NULL) {
- entry->default_values[user_level] = gconf_value_new (GCONF_VALUE_STRING);
- }
- gconf_value_set_string (entry->default_values[user_level], string_value);
-}
-
-char *
-eel_preferences_default_get_string (const char *name,
- int user_level)
-{
- PreferencesEntry *entry;
-
- g_return_val_if_fail (name != NULL, FALSE);
- g_return_val_if_fail (preferences_is_initialized (), FALSE);
- g_return_val_if_fail (eel_preferences_user_level_is_valid (user_level), FALSE);
-
- entry = preferences_global_table_lookup_or_insert (name);
- g_assert (entry != NULL);
-
- return preferences_gconf_value_get_string (entry->default_values[user_level]);
-}
-
-void
-eel_preferences_default_set_string_list (const char *name,
- int user_level,
- const EelStringList *string_list_value)
-{
- PreferencesEntry *entry;
- GSList *slist;
-
- g_return_if_fail (name != NULL);
- g_return_if_fail (preferences_is_initialized ());
- g_return_if_fail (eel_preferences_user_level_is_valid (user_level));
-
- entry = preferences_global_table_lookup_or_insert (name);
- g_assert (entry != NULL);
-
- if (entry->default_values[user_level] == NULL) {
- entry->default_values[user_level] = gconf_value_new (GCONF_VALUE_LIST);
- gconf_value_set_list_type (entry->default_values[user_level], GCONF_VALUE_STRING);
- }
-
- slist = eel_string_list_as_g_slist (string_list_value);
- eel_gconf_value_set_string_list (entry->default_values[user_level], slist);
- eel_g_slist_free_deep (slist);
-}
-
-EelStringList *
-eel_preferences_default_get_string_list (const char *name,
- int user_level)
-{
- PreferencesEntry *entry;
-
- g_return_val_if_fail (name != NULL, FALSE);
- g_return_val_if_fail (preferences_is_initialized (), FALSE);
- g_return_val_if_fail (eel_preferences_user_level_is_valid (user_level), FALSE);
-
- entry = preferences_global_table_lookup_or_insert (name);
- g_assert (entry != NULL);
-
- return preferences_gconf_value_get_string_list (entry->default_values[user_level]);
+ return result;
}
/**
@@ -790,23 +482,8 @@ preferences_callback_entry_invoke_functi
(* callback_entry->callback) (callback_entry->callback_data);
}
-/**
- * preferences_entry_invoke_callbacks_if_needed
- *
- * @entry: A PreferencesEntry
- *
- * This function checks the cached value in the entry with the current
- * value of the preference. If the value has changed, then callbacks
- * are invoked and auto storage updated.
- *
- * We need this check because even though the GConf value of a preference
- * could indeed have changed, its representation on the Eel side
- * of things could still be the same. The best example of this is
- * user level changes, where the value of the preference on the Eel
- * end of things is determined by visibility.
- **/
static void
-preferences_entry_invoke_callbacks_if_needed (PreferencesEntry *entry)
+preferences_entry_invoke_callbacks (PreferencesEntry *entry)
{
GConfValue *new_value;
@@ -814,25 +491,10 @@ preferences_entry_invoke_callbacks_if_ne
new_value = preferences_get_value (entry->name);
- /* If the values are the same, then we dont need to invoke any callbacks */
- if (eel_gconf_value_is_equal (entry->cached_value, new_value)) {
- eel_gconf_value_free (new_value);
- return;
- }
-
/* Update the auto storage preferences */
if (entry->auto_storage_list != NULL) {
preferences_entry_update_auto_storage (entry);
}
-
- /* Store the new cached value */
- eel_gconf_value_free (entry->cached_value);
- entry->cached_value = new_value;
-
- /* Dont invoke callbacks if the entry is blocked */
- if (entry->callbacks_blocked) {
- return;
- }
/* Invoke callbacks for this entry if any */
if (entry->callback_list != NULL) {
@@ -932,57 +594,10 @@ preferences_something_changed_notice (GC
g_return_if_fail (entry->key != NULL);
g_return_if_fail (notice_data != NULL);
- preferences_entry_invoke_callbacks_if_needed (notice_data);
+ preferences_entry_invoke_callbacks (notice_data);
}
static void
-preferences_global_table_check_changes_function (gpointer key,
- gpointer value,
- gpointer user_data)
-{
- PreferencesEntry *entry;
-
- g_return_if_fail (key != NULL);
- g_return_if_fail (value != NULL);
-
- entry = value;
-
- g_return_if_fail (entry->name != NULL);
-
- /* We dont worry about the 'user_level' itself for recursive reasons */
- if (preferences_preference_is_user_level (entry->name)) {
- return;
- }
-
- preferences_entry_invoke_callbacks_if_needed (entry);
-}
-
-static void
-preferences_entry_update_cached_value (PreferencesEntry *entry)
-{
- g_return_if_fail (entry != NULL);
-
- eel_gconf_value_free (entry->cached_value);
-
- entry->cached_value = preferences_get_value (entry->name);
-}
-
-static void
-preferences_user_level_changed_notice (GConfClient *client,
- guint connection_id,
- GConfEntry *gconf_entry,
- gpointer user_data)
-{
- g_return_if_fail (gconf_entry != NULL);
- g_return_if_fail (gconf_entry->key != NULL);
- g_return_if_fail (eel_str_has_suffix (gconf_entry->key, "user_level"));
-
- g_hash_table_foreach (preferences_global_table_get_global (),
- preferences_global_table_check_changes_function,
- NULL);
-}
-
-static void
preferences_entry_ensure_gconf_connection (PreferencesEntry *entry)
{
char *key;
@@ -1006,15 +621,6 @@ preferences_entry_ensure_gconf_connectio
g_free (key);
g_return_if_fail (entry->gconf_connection_id != EEL_GCONF_UNDEFINED_CONNECTION);
-
- /* Update the cached value.
- * From now onwards the cached value will be updated
- * each time preferences_something_changed_notice() triggers
- * so that it can be later compared with new values to
- * determine if the gconf value is different from the
- * Eel value.
- */
- preferences_entry_update_cached_value (entry);
}
/**
@@ -1243,10 +849,7 @@ preferences_entry_free (PreferencesEntry
g_free (entry->description);
g_free (entry->enumeration_id);
- eel_gconf_value_free (entry->cached_value);
- eel_gconf_value_free (entry->default_values[0]);
- eel_gconf_value_free (entry->default_values[1]);
- eel_gconf_value_free (entry->default_values[2]);
+ eel_gconf_value_free (entry->fallback);
g_free (entry);
}
@@ -1327,18 +930,6 @@ preferences_global_table_insert (const c
g_return_val_if_fail (entry == preferences_global_table_lookup (name), NULL);
- /* Update the cached value for the first time.
- *
- * We need to do this because checks for value changes
- * happen not only as a result of callbacks triggering, but
- * also as a result of user_level changes. When a user level
- * changes, all the preferences entries are iterated to invoke
- * callbacks for those that changed as a result.
- *
- * See preferences_global_table_check_changes_function().
- */
- preferences_entry_update_cached_value (entry);
-
return entry;
}
@@ -1666,56 +1257,121 @@ eel_preferences_get_enumeration_id (cons
return entry->enumeration_id ? g_strdup (entry->enumeration_id) : NULL;
}
-char *
-eel_preferences_get_user_level_name_for_display (int user_level)
+static void
+preferences_set_emergency_fallback_stealing_value (const char *name,
+ GConfValue *value)
{
- g_return_val_if_fail (preferences_is_initialized (), NULL);
+ PreferencesEntry *entry;
+
+ g_return_if_fail (name != NULL);
+ g_return_if_fail (preferences_is_initialized ());
+
+ entry = preferences_global_table_lookup_or_insert (name);
+ g_assert (entry != NULL);
- user_level = eel_preferences_user_level_clamp (user_level);
+ if (entry->fallback)
+ gconf_value_free (entry->fallback);
+ entry->fallback = value; /* steal ownership of value */
+}
+
+void
+eel_preferences_set_emergency_fallback_string (const char *name,
+ const char *value)
+{
+ GConfValue *gconf_value;
+
+ g_return_if_fail (name != NULL);
+ g_return_if_fail (value != NULL);
- return g_strdup (_(user_level_names_for_display[user_level]));
+ gconf_value = gconf_value_new (GCONF_VALUE_STRING);
+
+ gconf_value_set_string (gconf_value, value);
+
+ preferences_set_emergency_fallback_stealing_value (name, gconf_value);
}
-char *
-eel_preferences_get_user_level_name_for_storage (int user_level)
+void
+eel_preferences_set_emergency_fallback_integer (const char *name,
+ int value)
{
- g_return_val_if_fail (preferences_is_initialized (), NULL);
+ GConfValue *gconf_value;
+
+ g_return_if_fail (name != NULL);
+
+ gconf_value = gconf_value_new (GCONF_VALUE_INT);
- return g_strdup (preferences_peek_user_level_name_for_storage (user_level));
+ gconf_value_set_int (gconf_value, value);
+
+ preferences_set_emergency_fallback_stealing_value (name, gconf_value);
}
-int
-eel_preferences_user_level_clamp (int user_level)
+void
+eel_preferences_set_emergency_fallback_boolean (const char *name,
+ gboolean value)
{
- g_return_val_if_fail (preferences_is_initialized (), 0);
+ GConfValue *gconf_value;
+
+ g_return_if_fail (name != NULL);
+
+ gconf_value = gconf_value_new (GCONF_VALUE_BOOL);
+
+ gconf_value_set_bool (gconf_value, value);
- return CLAMP (user_level, EEL_USER_LEVEL_NOVICE, EEL_USER_LEVEL_ADVANCED);
+ preferences_set_emergency_fallback_stealing_value (name, gconf_value);
}
-gboolean
-eel_preferences_user_level_is_valid (int user_level)
+static void
+listify_strings_foreach (const char *string,
+ gpointer callback_data)
{
- g_return_val_if_fail (preferences_is_initialized (), FALSE);
+ GSList **listp = callback_data;
+ GConfValue *value;
- return user_level == eel_preferences_user_level_clamp (user_level);
+ value = gconf_value_new (GCONF_VALUE_STRING);
+ gconf_value_set_string (value, string);
+
+ *listp = g_slist_prepend (*listp, value);
}
-gboolean
-eel_preferences_monitor_directory (const char *directory)
+void
+eel_preferences_set_emergency_fallback_string_list (const char *name,
+ EelStringList *value)
{
- g_return_val_if_fail (preferences_is_initialized (), FALSE);
+ GConfValue *gconf_value;
+ GSList *list;
- return eel_gconf_monitor_add (directory);
+ g_return_if_fail (name != NULL);
+ g_return_if_fail (value != NULL);
+
+ gconf_value = gconf_value_new (GCONF_VALUE_LIST);
+
+ gconf_value_set_list_type (gconf_value, GCONF_VALUE_STRING);
+ list = NULL;
+ eel_string_list_for_each (value, listify_strings_foreach, &list);
+ gconf_value_set_list_nocopy (gconf_value, list);
+
+ preferences_set_emergency_fallback_stealing_value (name, gconf_value);
+}
+
+GConfValue*
+eel_preferences_get_emergency_fallback (const char *name)
+{
+ PreferencesEntry *entry;
+
+ g_return_val_if_fail (name != NULL, NULL);
+ g_return_val_if_fail (preferences_is_initialized (), NULL);
+
+ entry = preferences_global_table_lookup_or_insert (name);
+
+ return entry->fallback ? gconf_value_copy (entry->fallback) : NULL;
}
gboolean
-eel_preferences_visible_in_current_user_level (const char *name)
+eel_preferences_monitor_directory (const char *directory)
{
- g_return_val_if_fail (name != NULL, FALSE);
g_return_val_if_fail (preferences_is_initialized (), FALSE);
- return eel_preferences_get_visible_user_level (name)
- <= eel_preferences_get_user_level ();
+ return eel_gconf_monitor_add (directory);
}
gboolean
@@ -1724,20 +1380,9 @@ eel_preferences_is_visible (const char *
g_return_val_if_fail (name != NULL, FALSE);
g_return_val_if_fail (preferences_is_initialized (), FALSE);
- if (!eel_preferences_visible_in_current_user_level (name)) {
- return FALSE;
- }
-
return !preferences_global_table_lookup_or_insert (name)->invisible;
}
-static void
-preferences_remove_user_level_notice (void)
-{
- eel_gconf_notification_remove (user_level_changed_connection_id);
- user_level_changed_connection_id = EEL_GCONF_UNDEFINED_CONNECTION;
-}
-
void
eel_preferences_init (const char *path)
{
@@ -1748,12 +1393,6 @@ eel_preferences_init (const char *path)
}
initialized = TRUE;
-
- user_level_changed_connection_id = eel_gconf_notification_add (USER_LEVEL_KEY,
- preferences_user_level_changed_notice,
- NULL);
-
- g_atexit (preferences_remove_user_level_notice);
preferences_set_storage_path (path);
}
Index: eel/eel-preferences.h
===================================================================
RCS file: /cvs/gnome/eel/eel/eel-preferences.h,v
retrieving revision 1.4
diff -u -p -u -r1.4 eel-preferences.h
--- eel/eel-preferences.h 2001/11/04 02:53:00 1.4
+++ eel/eel-preferences.h 2002/01/04 23:28:33
@@ -28,6 +28,7 @@
#include <glib.h>
#include <gtk/gtkobject.h>
#include <eel/eel-string-list.h>
+#include <eel/eel-gconf-extensions.h>
G_BEGIN_DECLS
@@ -37,23 +38,6 @@ G_BEGIN_DECLS
*/
typedef void (*EelPreferencesCallback) (gpointer callback_data);
-/* User level */
-
-/* Note that there's a function to get the number of user levels, but there's
- * a lot of code elsewhere that assumes three levels. Publicizing the numbers
- * of these levels lets that other code be coherent and less error-prone.
- */
-#define EEL_USER_LEVEL_NOVICE 0
-#define EEL_USER_LEVEL_INTERMEDIATE 1
-#define EEL_USER_LEVEL_ADVANCED 2
-
-char * eel_preferences_get_user_level_name_for_display (int user_level);
-char * eel_preferences_get_user_level_name_for_storage (int user_level);
-int eel_preferences_get_user_level (void);
-void eel_preferences_set_user_level (int user_level);
-int eel_preferences_user_level_clamp (int user_level);
-gboolean eel_preferences_user_level_is_valid (int user_level);
-
/* Preferences getters and setters */
gboolean eel_preferences_get_boolean (const char *name);
void eel_preferences_set_boolean (const char *name,
@@ -68,27 +52,6 @@ EelStringList *eel_preferences_get_strin
void eel_preferences_set_string_list (const char *name,
const EelStringList *string_list_value);
-/* Default values getters and setters */
-gboolean eel_preferences_default_get_boolean (const char *name,
- int user_level);
-void eel_preferences_default_set_boolean (const char *name,
- int user_level,
- gboolean boolean_value);
-int eel_preferences_default_get_integer (const char *name,
- int user_level);
-void eel_preferences_default_set_integer (const char *name,
- int user_level,
- int int_value);
-char * eel_preferences_default_get_string (const char *name,
- int user_level);
-void eel_preferences_default_set_string (const char *name,
- int user_level,
- const char *string_value);
-EelStringList *eel_preferences_default_get_string_list (const char *name,
- int user_level);
-void eel_preferences_default_set_string_list (const char *name,
- int user_level,
- const EelStringList *string_list_value);
/* Callbacks */
void eel_preferences_add_callback (const char *name,
EelPreferencesCallback callback,
@@ -120,9 +83,7 @@ void eel_preferences_remove_au
int *storage);
/* Preferences attributes */
-int eel_preferences_get_visible_user_level (const char *name);
-void eel_preferences_set_visible_user_level (const char *name,
- int visible_user_level);
+
gboolean eel_preferences_get_is_invisible (const char *name);
void eel_preferences_set_is_invisible (const char *name,
gboolean invisible);
@@ -132,8 +93,19 @@ void eel_preferences_set_descr
char * eel_preferences_get_enumeration_id (const char *name);
void eel_preferences_set_enumeration_id (const char *name,
const char *enumeration_id);
+
+void eel_preferences_set_emergency_fallback_string (const char *name,
+ const char *value);
+void eel_preferences_set_emergency_fallback_integer (const char *name,
+ int value);
+void eel_preferences_set_emergency_fallback_boolean (const char *name,
+ gboolean value);
+void eel_preferences_set_emergency_fallback_string_list (const char *name,
+ EelStringList *list);
+GConfValue *eel_preferences_get_emergency_fallback (const char *name);
+
+
gboolean eel_preferences_monitor_directory (const char *directory);
-gboolean eel_preferences_visible_in_current_user_level (const char *name);
gboolean eel_preferences_is_visible (const char *name);
void eel_preferences_init (const char *storage_path);
Index: eel/eel-string-picker.c
===================================================================
RCS file: /cvs/gnome/eel/eel/eel-string-picker.c,v
retrieving revision 1.15
diff -u -p -u -r1.15 eel-string-picker.c
--- eel/eel-string-picker.c 2001/11/09 01:43:49 1.15
+++ eel/eel-string-picker.c 2002/01/04 23:28:34
@@ -263,11 +263,8 @@ eel_string_picker_set_string_list (EelSt
"activate",
G_CALLBACK (option_menu_activate_callback),
string_picker);
- }
+ }
- /* Save the index so we can later use it to retrieve the nth label from the list */
- g_object_set_data (G_OBJECT (menu_item), "index", GINT_TO_POINTER (i));
-
gtk_widget_show (menu_item);
gtk_menu_shell_append (GTK_MENU_SHELL (string_picker->detail->menu), menu_item);
@@ -310,13 +307,12 @@ eel_string_picker_get_selected_string (E
{
int item_index;
GtkWidget *option_menu;
- GtkWidget *menu_item;
g_return_val_if_fail (EEL_IS_STRING_PICKER (string_picker), NULL);
option_menu = string_picker->detail->option_menu;
- menu_item = GTK_OPTION_MENU (option_menu)->menu_item;
- item_index = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (menu_item), "index"));
+
+ item_index = gtk_option_menu_get_history (GTK_OPTION_MENU (option_menu));
return (item_index != -1) ? eel_string_list_nth (string_picker->detail->string_list, item_index) : NULL;
}
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/nautilus/ChangeLog,v
retrieving revision 1.4892
diff -u -p -u -r1.4892 ChangeLog
--- ChangeLog 2002/01/04 17:28:27 1.4892
+++ ChangeLog 2002/01/04 23:28:30
@@ -1,3 +1,29 @@
+2002-01-04 Havoc Pennington <hp pobox com>
+
+ * libnautilus-private/nautilus-global-preferences.c
+ (nautilus_global_preferences_init): add preload of the gconf
+ cache, to hopefully avoid a zillion round trips to gconfd on
+ startup.
+
+ * test/test.c (test_window_new): remove weird gtk_window_set_policy
+
+ * test/test-nautilus-preferences-display.c: remove user level
+ stuff
+
+ * test/test-nautilus-preferences-change.c: remove user level stuff
+
+ * libnautilus-private/nautilus-global-preferences.c: the default
+ click policy was SPEED_TRADEOFF_LOCAL_ONLY, fix
+
+ * libnautilus-private/nautilus.schemas: add schemas file
+
+ * libnautilus-private/nautilus-global-preferences.c: strip out
+ user levels
+
+ * src/nautilus-shell-ui.xml: strip out user level menu
+
+ * src/nautilus-window-menus.c: strip out user level menu
+
2002-01-04 Frederic Crozat <fcrozat mandrakesoft com>
* configure.in: Add esound cflags to CORE_CFLAGS,
Index: libnautilus-private/nautilus-global-preferences.c
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-global-preferences.c,v
retrieving revision 1.182
diff -u -p -u -r1.182 nautilus-global-preferences.c
--- libnautilus-private/nautilus-global-preferences.c 2002/01/04 00:14:17 1.182
+++ libnautilus-private/nautilus-global-preferences.c 2002/01/04 23:28:31
@@ -51,9 +51,9 @@ static const char SYSTEM_GNOME_VFS_PATH[
/* Forward declarations */
static void global_preferences_install_defaults (void);
static void global_preferences_register_enumerations (void);
-static gpointer default_font_callback (int user_level);
-static gpointer default_home_location_callback (int user_level);
-static gpointer default_default_folder_viewer_callback (int user_level);
+static gpointer default_font_callback (void);
+static gpointer default_home_location_callback (void);
+static gpointer default_default_folder_viewer_callback (void);
/* An enumeration used for installing type specific preferences defaults. */
typedef enum
@@ -215,31 +215,20 @@ static EelEnumerationInfo enumerations[]
};
/*
- * A callback which can be used to fetch dynamic default values.
+ * 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) (int user_level);
+typedef gpointer (*PreferencesDefaultValueCallback) (void);
-/* A structure that pairs a default value with a specific user level. */
-typedef struct
-{
- int user_level;
- const gpointer value;
- PreferencesDefaultValueCallback callback;
- GFreeFunc callback_result_free_function;
-} PreferenceUserLevelDefault;
-
-#define USER_LEVEL_NONE -1
-
/* A structure that describes a single preference including defaults and visibility. */
typedef struct
{
const char *name;
PreferenceType type;
- int visible_user_level;
- const PreferenceUserLevelDefault default1;
- const PreferenceUserLevelDefault default2;
+ const gpointer fallback_value;
+ PreferencesDefaultValueCallback fallback_callback;
+ GFreeFunc fallback_callback_result_free_function;
const char *enumeration_id;
} PreferenceDefault;
@@ -262,440 +251,320 @@ typedef struct
* PREFERENCE_INTEGER
* PREFERENCE_STRING
* PREFERENCE_STRING_LIST
- *
- * 3. visible_user_level
- * The visible user level is the first user level at which the
- * preference is visible. By default all preferences have a visibility of 0.
- *
- * A preference with a visible_user_level greater than 0, will be "visible"
- * only at that level or higher. Any getters that ask for that preference at
- * lower user levels will always receive the default value. Also, if the
- * preference has an entry in the preferences dialog, it will not be shown
- * unless the current user level is greater than or equal to the preference's
- * visible user level.
- *
- * 4. default1
- * A pair of a user_level and a value (PreferenceUserLevelDefault). For the
- * left hand side user_level, the preference will have the right hand side
- * default value.
- *
- * This pair does not need to be given. It can be { USER_LEVEL_NONE }, in
- * which case the preference defaults to 0 at all user levels.
*
- * 5. default2
- * A pair of a user_level and a value (PreferenceUserLevelDefault). For the
- * left hand side user_level, the preference will have the right hand side
- * default value.
+ * 3. fallback_value
+ * Emergency fallback value if our gconf schemas are hosed somehow.
*
- * This pair does not need to be given. It can be { USER_LEVEL_NONE }, in
- * which case the preference defaults to 0 at all user levels.
+ * 4. fallback_callback
+ * callback to get dynamic fallback
*
- * Notes:
+ * 5. fallback_callback_result_free_function
+ * free result of fallback_callback
*
- * Define defaults only for preferences that need something other than 0 (integer)
- * FALSE (boolean) or "" (string) as their defaults.
- *
- * Its possible to have different defaults for different user levels Its not
- * required to have defaults for EACH user level. If there is no default
- * installed for a high user level, the next lowest user level with a valid
- * default is used.
- *
* 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.
*/
+
+/* NOTE THAT THE FALLBACKS HERE ARE NOT SUPPOSED TO BE USED -
+ * YOU SHOULD EDIT THE SCHEMAS FILE TO CHANGE DEFAULTS.
+ */
static const PreferenceDefault preference_defaults[] = {
{ NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES,
PREFERENCE_BOOLEAN,
- EEL_USER_LEVEL_INTERMEDIATE,
- { EEL_USER_LEVEL_NOVICE, GINT_TO_POINTER (FALSE) },
- { USER_LEVEL_NONE }
+ GINT_TO_POINTER (FALSE)
},
{ NAUTILUS_PREFERENCES_SHOW_BACKUP_FILES,
PREFERENCE_BOOLEAN,
- EEL_USER_LEVEL_INTERMEDIATE,
- { EEL_USER_LEVEL_NOVICE, GINT_TO_POINTER (FALSE) },
- { USER_LEVEL_NONE }
+ GINT_TO_POINTER (FALSE)
},
{ NAUTILUS_PREFERENCES_CONFIRM_TRASH,
PREFERENCE_BOOLEAN,
- EEL_USER_LEVEL_ADVANCED,
- { EEL_USER_LEVEL_NOVICE, GINT_TO_POINTER (TRUE) },
- { USER_LEVEL_NONE }
+ GINT_TO_POINTER (TRUE)
},
{ NAUTILUS_PREFERENCES_ENABLE_DELETE,
PREFERENCE_BOOLEAN,
- EEL_USER_LEVEL_ADVANCED,
- { EEL_USER_LEVEL_NOVICE, GINT_TO_POINTER (FALSE) },
- { USER_LEVEL_NONE }
+ GINT_TO_POINTER (FALSE)
},
{ NAUTILUS_PREFERENCES_SHOW_TEXT_IN_ICONS,
PREFERENCE_INTEGER,
- EEL_USER_LEVEL_INTERMEDIATE,
- { EEL_USER_LEVEL_NOVICE, GINT_TO_POINTER (NAUTILUS_SPEED_TRADEOFF_LOCAL_ONLY) },
- { USER_LEVEL_NONE },
+ GINT_TO_POINTER (NAUTILUS_SPEED_TRADEOFF_LOCAL_ONLY),
+ NULL, NULL,
"speed_tradeoff"
},
- /* Don't show remote directory item counts for Beginner users because computing them
- * can be annoyingly slow, especially for FTP. If we make this fast enough for FTP in
- * particular, we should change this default to ALWAYS.
+ /* 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,
+ * we should change this default to ALWAYS.
*/
{ NAUTILUS_PREFERENCES_SHOW_DIRECTORY_ITEM_COUNTS,
PREFERENCE_INTEGER,
- EEL_USER_LEVEL_INTERMEDIATE,
- { EEL_USER_LEVEL_NOVICE, GINT_TO_POINTER (NAUTILUS_SPEED_TRADEOFF_LOCAL_ONLY) },
- { EEL_USER_LEVEL_INTERMEDIATE, GINT_TO_POINTER (NAUTILUS_SPEED_TRADEOFF_ALWAYS) },
+ GINT_TO_POINTER (NAUTILUS_SPEED_TRADEOFF_LOCAL_ONLY),
+ NULL, NULL,
"speed_tradeoff"
},
{ NAUTILUS_PREFERENCES_CLICK_POLICY,
PREFERENCE_INTEGER,
- EEL_USER_LEVEL_INTERMEDIATE,
- { EEL_USER_LEVEL_NOVICE, GINT_TO_POINTER (NAUTILUS_SPEED_TRADEOFF_LOCAL_ONLY) },
- { USER_LEVEL_NONE },
+ GINT_TO_POINTER (NAUTILUS_CLICK_POLICY_DOUBLE),
+ NULL, NULL,
"click_policy"
},
{ NAUTILUS_PREFERENCES_EXECUTABLE_TEXT_ACTIVATION,
PREFERENCE_INTEGER,
- EEL_USER_LEVEL_ADVANCED,
- { EEL_USER_LEVEL_NOVICE, GINT_TO_POINTER (NAUTILUS_EXECUTABLE_TEXT_ASK) },
- { USER_LEVEL_NONE },
+ GINT_TO_POINTER (NAUTILUS_EXECUTABLE_TEXT_ASK),
+ NULL, NULL,
"executable_text_activation"
},
{ NAUTILUS_PREFERENCES_THEME,
PREFERENCE_STRING,
- EEL_USER_LEVEL_NOVICE,
- { EEL_USER_LEVEL_NOVICE, "default" },
- { USER_LEVEL_NONE }
+ "default"
},
{ NAUTILUS_PREFERENCES_SHOW_IMAGE_FILE_THUMBNAILS,
PREFERENCE_INTEGER,
- EEL_USER_LEVEL_INTERMEDIATE,
- { EEL_USER_LEVEL_NOVICE, GINT_TO_POINTER (NAUTILUS_SPEED_TRADEOFF_LOCAL_ONLY) },
- { USER_LEVEL_NONE },
+ GINT_TO_POINTER (NAUTILUS_SPEED_TRADEOFF_LOCAL_ONLY),
+ NULL, NULL,
"speed_tradeoff"
},
{ NAUTILUS_PREFERENCES_IMAGE_FILE_THUMBNAIL_LIMIT,
PREFERENCE_INTEGER,
- EEL_USER_LEVEL_ADVANCED,
- { EEL_USER_LEVEL_NOVICE, GINT_TO_POINTER (3145728) },
- { USER_LEVEL_NONE },
+ GINT_TO_POINTER (3145728),
+ NULL, NULL,
"file_size"
},
{ NAUTILUS_PREFERENCES_USE_PUBLIC_METADATA,
PREFERENCE_INTEGER,
- EEL_USER_LEVEL_ADVANCED,
- { EEL_USER_LEVEL_NOVICE, GINT_TO_POINTER (NAUTILUS_SPEED_TRADEOFF_LOCAL_ONLY) },
- { USER_LEVEL_NONE },
+ GINT_TO_POINTER (NAUTILUS_SPEED_TRADEOFF_LOCAL_ONLY),
+ NULL, NULL,
"speed_tradeoff"
},
{ NAUTILUS_PREFERENCES_SMOOTH_GRAPHICS_MODE,
PREFERENCE_BOOLEAN,
- EEL_USER_LEVEL_INTERMEDIATE,
- { EEL_USER_LEVEL_NOVICE, GINT_TO_POINTER (TRUE) },
- { USER_LEVEL_NONE }
+ GINT_TO_POINTER (TRUE)
},
{ NAUTILUS_PREFERENCES_PREVIEW_SOUND,
PREFERENCE_INTEGER,
- EEL_USER_LEVEL_INTERMEDIATE,
- { EEL_USER_LEVEL_NOVICE, GINT_TO_POINTER (NAUTILUS_SPEED_TRADEOFF_LOCAL_ONLY) },
- { USER_LEVEL_NONE },
+ GINT_TO_POINTER (NAUTILUS_SPEED_TRADEOFF_LOCAL_ONLY),
+ NULL, NULL,
"speed_tradeoff"
},
{ NAUTILUS_PREFERENCES_SHOW_SPECIAL_FLAGS,
PREFERENCE_BOOLEAN,
- EEL_USER_LEVEL_ADVANCED,
- { EEL_USER_LEVEL_NOVICE, GINT_TO_POINTER (FALSE) },
- { EEL_USER_LEVEL_ADVANCED, GINT_TO_POINTER (TRUE) }
+ GINT_TO_POINTER (FALSE)
},
{ NAUTILUS_PREFERENCES_SORT_DIRECTORIES_FIRST,
PREFERENCE_BOOLEAN,
- EEL_USER_LEVEL_INTERMEDIATE,
- { EEL_USER_LEVEL_NOVICE, GINT_TO_POINTER (FALSE) },
- { USER_LEVEL_NONE }
+ GINT_TO_POINTER (FALSE)
},
{ NAUTILUS_PREFERENCES_SHOW_DESKTOP,
PREFERENCE_BOOLEAN,
- EEL_USER_LEVEL_INTERMEDIATE,
- { EEL_USER_LEVEL_NOVICE, GINT_TO_POINTER (TRUE) },
- { USER_LEVEL_NONE }
+ GINT_TO_POINTER (TRUE)
},
{ NAUTILUS_PREFERENCES_DESKTOP_IS_HOME_DIR,
PREFERENCE_BOOLEAN,
- EEL_USER_LEVEL_ADVANCED,
- { EEL_USER_LEVEL_NOVICE, GINT_TO_POINTER (FALSE) },
- { USER_LEVEL_NONE }
+ GINT_TO_POINTER (FALSE)
},
{ NAUTILUS_PREFERENCES_CAN_ADD_CONTENT,
PREFERENCE_BOOLEAN,
- EEL_USER_LEVEL_NOVICE,
- { EEL_USER_LEVEL_NOVICE, GINT_TO_POINTER (FALSE) },
- { EEL_USER_LEVEL_INTERMEDIATE, GINT_TO_POINTER (TRUE) }
+ GINT_TO_POINTER (FALSE)
},
{ NAUTILUS_PREFERENCES_SEARCH_BAR_TYPE,
PREFERENCE_INTEGER,
- EEL_USER_LEVEL_INTERMEDIATE,
- { EEL_USER_LEVEL_NOVICE, GINT_TO_POINTER (NAUTILUS_SIMPLE_SEARCH_BAR) },
- { EEL_USER_LEVEL_INTERMEDIATE, GINT_TO_POINTER (NAUTILUS_COMPLEX_SEARCH_BAR) },
+ GINT_TO_POINTER (NAUTILUS_SIMPLE_SEARCH_BAR),
+ NULL, NULL,
"search_bar_type"
},
{ NAUTILUS_PREFERENCES_WINDOW_ALWAYS_NEW,
PREFERENCE_BOOLEAN,
- EEL_USER_LEVEL_NOVICE,
- { EEL_USER_LEVEL_NOVICE, GINT_TO_POINTER (FALSE) },
- { USER_LEVEL_NONE }
+ GINT_TO_POINTER (FALSE)
},
{ NAUTILUS_PREFERENCES_ICON_VIEW_CAPTIONS,
PREFERENCE_STRING_LIST,
- EEL_USER_LEVEL_NOVICE,
- { EEL_USER_LEVEL_NOVICE, "size,date_modified,type", },
- { USER_LEVEL_NONE },
+ "size,date_modified,type",
+ NULL, NULL,
"icon_captions"
},
{ NAUTILUS_PREFERENCES_HIDE_BUILT_IN_BOOKMARKS,
PREFERENCE_BOOLEAN,
- EEL_USER_LEVEL_INTERMEDIATE,
- { EEL_USER_LEVEL_NOVICE, GINT_TO_POINTER (FALSE) },
- { USER_LEVEL_NONE }
+ GINT_TO_POINTER (FALSE)
},
{ NAUTILUS_PREFERENCES_USE_EMACS_SHORTCUTS,
PREFERENCE_BOOLEAN,
- EEL_USER_LEVEL_ADVANCED,
- { EEL_USER_LEVEL_NOVICE, GINT_TO_POINTER (FALSE) },
- { USER_LEVEL_NONE }
+ GINT_TO_POINTER (FALSE)
},
/* FIXME bugzilla.gnome.org 41245: Saved in pixels instead of in %? */
{ NAUTILUS_PREFERENCES_SIDEBAR_WIDTH,
PREFERENCE_INTEGER,
- EEL_USER_LEVEL_NOVICE,
- { EEL_USER_LEVEL_NOVICE, GINT_TO_POINTER (148) },
- { USER_LEVEL_NONE }
+ GINT_TO_POINTER (148)
},
{ NAUTILUS_PREFERENCES_SEARCH_WEB_URI,
PREFERENCE_STRING,
- EEL_USER_LEVEL_INTERMEDIATE,
- { EEL_USER_LEVEL_NOVICE, "http://www.google.com" },
- { USER_LEVEL_NONE }
+ "http://www.google.com"
},
{ NAUTILUS_PREFERENCES_START_WITH_TOOLBAR,
PREFERENCE_BOOLEAN,
- EEL_USER_LEVEL_INTERMEDIATE,
- { EEL_USER_LEVEL_NOVICE, GINT_TO_POINTER (TRUE) },
- { USER_LEVEL_NONE }
+ GINT_TO_POINTER (TRUE)
},
{ NAUTILUS_PREFERENCES_START_WITH_LOCATION_BAR,
PREFERENCE_BOOLEAN,
- EEL_USER_LEVEL_INTERMEDIATE,
- { EEL_USER_LEVEL_NOVICE, GINT_TO_POINTER (TRUE) },
- { USER_LEVEL_NONE }
+ GINT_TO_POINTER (TRUE)
},
{ NAUTILUS_PREFERENCES_START_WITH_STATUS_BAR,
PREFERENCE_BOOLEAN,
- EEL_USER_LEVEL_INTERMEDIATE,
- { EEL_USER_LEVEL_NOVICE, GINT_TO_POINTER (TRUE) },
- { USER_LEVEL_NONE }
+ GINT_TO_POINTER (TRUE)
},
{ NAUTILUS_PREFERENCES_START_WITH_SIDEBAR,
PREFERENCE_BOOLEAN,
- EEL_USER_LEVEL_INTERMEDIATE,
- { EEL_USER_LEVEL_NOVICE, GINT_TO_POINTER (TRUE) },
- { USER_LEVEL_NONE }
+ GINT_TO_POINTER (TRUE)
},
{ NAUTILUS_PREFERENCES_TREE_SHOW_ONLY_DIRECTORIES,
PREFERENCE_BOOLEAN,
- EEL_USER_LEVEL_INTERMEDIATE,
- { EEL_USER_LEVEL_NOVICE, GINT_TO_POINTER (FALSE) },
- { USER_LEVEL_NONE }
+ GINT_TO_POINTER (FALSE)
},
/* Proxy defaults */
{ NAUTILUS_PREFERENCES_HTTP_USE_PROXY,
PREFERENCE_BOOLEAN,
- EEL_USER_LEVEL_NOVICE,
- { EEL_USER_LEVEL_NOVICE, GINT_TO_POINTER (FALSE) },
- { USER_LEVEL_NONE }
+ GINT_TO_POINTER (FALSE)
},
{ NAUTILUS_PREFERENCES_HTTP_PROXY_PORT,
PREFERENCE_INTEGER,
- EEL_USER_LEVEL_NOVICE,
- { EEL_USER_LEVEL_NOVICE, GINT_TO_POINTER (8080) },
- { USER_LEVEL_NONE }
+ GINT_TO_POINTER (8080)
},
{ NAUTILUS_PREFERENCES_HTTP_PROXY_USE_AUTH,
PREFERENCE_BOOLEAN,
- EEL_USER_LEVEL_NOVICE,
- { EEL_USER_LEVEL_NOVICE, GINT_TO_POINTER (FALSE) },
- { USER_LEVEL_NONE }
+ GINT_TO_POINTER (FALSE)
},
/* Home URI */
{ NAUTILUS_PREFERENCES_HOME_URI,
PREFERENCE_STRING,
- EEL_USER_LEVEL_INTERMEDIATE,
- { EEL_USER_LEVEL_NOVICE, NULL, default_home_location_callback, g_free },
- { EEL_USER_LEVEL_INTERMEDIATE, NULL, default_home_location_callback, g_free },
+ NULL, default_home_location_callback, g_free
},
/* Default fonts */
{ NAUTILUS_PREFERENCES_DEFAULT_FONT,
PREFERENCE_STRING,
- EEL_USER_LEVEL_NOVICE,
- { EEL_USER_LEVEL_NOVICE, NULL, default_font_callback, g_free },
- { USER_LEVEL_NONE }
+ NULL, default_font_callback, g_free
},
{ NAUTILUS_PREFERENCES_DEFAULT_FONT_SIZE,
PREFERENCE_INTEGER,
- EEL_USER_LEVEL_NOVICE,
- { EEL_USER_LEVEL_NOVICE, GINT_TO_POINTER (12) },
- { USER_LEVEL_NONE },
+ GINT_TO_POINTER (12),
+ NULL, NULL,
"standard_font_size"
},
/* View Preferences */
{ NAUTILUS_PREFERENCES_DEFAULT_FOLDER_VIEWER,
PREFERENCE_INTEGER,
- EEL_USER_LEVEL_NOVICE,
- { EEL_USER_LEVEL_NOVICE, NULL, default_default_folder_viewer_callback, NULL },
- { USER_LEVEL_NONE },
+ NULL, default_default_folder_viewer_callback, NULL,
"default_folder_viewer"
},
/* Icon View Default Preferences */
+
{ NAUTILUS_PREFERENCES_ICON_VIEW_FONT,
PREFERENCE_STRING,
- EEL_USER_LEVEL_NOVICE,
- { EEL_USER_LEVEL_NOVICE, NULL, default_font_callback, g_free },
- { USER_LEVEL_NONE }
+ NULL, default_font_callback, g_free
},
{ NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_ZOOM_LEVEL_FONT_SIZE,
PREFERENCE_INTEGER,
- EEL_USER_LEVEL_NOVICE,
- { EEL_USER_LEVEL_NOVICE, GINT_TO_POINTER (12) },
- { USER_LEVEL_NONE },
+ GINT_TO_POINTER (12),
+ NULL, NULL,
"standard_font_size"
},
{ NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_SORT_ORDER,
PREFERENCE_INTEGER,
- EEL_USER_LEVEL_NOVICE,
- { EEL_USER_LEVEL_NOVICE, GINT_TO_POINTER (NAUTILUS_FILE_SORT_BY_DISPLAY_NAME) },
- { USER_LEVEL_NONE },
+ GINT_TO_POINTER (NAUTILUS_FILE_SORT_BY_DISPLAY_NAME),
+ NULL, NULL,
"default_icon_view_sort_order"
},
{ NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_SORT_ORDER_OR_MANUAL_LAYOUT,
PREFERENCE_INTEGER,
- EEL_USER_LEVEL_NOVICE,
- { EEL_USER_LEVEL_NOVICE, GINT_TO_POINTER (NAUTILUS_FILE_SORT_BY_DISPLAY_NAME) },
- { USER_LEVEL_NONE },
+ GINT_TO_POINTER (NAUTILUS_FILE_SORT_BY_DISPLAY_NAME),
+ NULL, NULL,
"default_icon_view_sort_order"
},
{ NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_SORT_IN_REVERSE_ORDER,
PREFERENCE_BOOLEAN,
- EEL_USER_LEVEL_NOVICE,
- { EEL_USER_LEVEL_NOVICE, GINT_TO_POINTER (FALSE) },
- { USER_LEVEL_NONE }
+ GINT_TO_POINTER (FALSE)
},
{ NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_USE_TIGHTER_LAYOUT,
PREFERENCE_BOOLEAN,
- EEL_USER_LEVEL_NOVICE,
- { EEL_USER_LEVEL_NOVICE, GINT_TO_POINTER (FALSE) },
- { USER_LEVEL_NONE }
+ GINT_TO_POINTER (FALSE)
},
{ NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_USE_MANUAL_LAYOUT,
PREFERENCE_BOOLEAN,
- EEL_USER_LEVEL_NOVICE,
- { EEL_USER_LEVEL_NOVICE, GINT_TO_POINTER (FALSE) },
- { USER_LEVEL_NONE }
+ GINT_TO_POINTER (FALSE)
},
{ NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_ZOOM_LEVEL,
PREFERENCE_INTEGER,
- EEL_USER_LEVEL_NOVICE,
- { EEL_USER_LEVEL_NOVICE, GINT_TO_POINTER (NAUTILUS_ZOOM_LEVEL_STANDARD) },
- { USER_LEVEL_NONE },
+ GINT_TO_POINTER (NAUTILUS_ZOOM_LEVEL_STANDARD),
+ NULL, NULL,
"default_zoom_level"
},
/* List View Default Preferences */
{ NAUTILUS_PREFERENCES_LIST_VIEW_FONT,
PREFERENCE_STRING,
- EEL_USER_LEVEL_NOVICE,
- { EEL_USER_LEVEL_NOVICE, NULL, default_font_callback, g_free },
- { USER_LEVEL_NONE }
+ NULL, default_font_callback, g_free
},
{ NAUTILUS_PREFERENCES_LIST_VIEW_DEFAULT_ZOOM_LEVEL_FONT_SIZE,
PREFERENCE_INTEGER,
- EEL_USER_LEVEL_NOVICE,
- { EEL_USER_LEVEL_NOVICE, GINT_TO_POINTER (12) },
- { USER_LEVEL_NONE },
+ GINT_TO_POINTER (12),
+ NULL, NULL,
"standard_font_size"
},
{ NAUTILUS_PREFERENCES_LIST_VIEW_DEFAULT_SORT_ORDER,
PREFERENCE_INTEGER,
- EEL_USER_LEVEL_NOVICE,
- { EEL_USER_LEVEL_NOVICE, GINT_TO_POINTER (NAUTILUS_FILE_SORT_BY_DISPLAY_NAME) },
- { USER_LEVEL_NONE },
+ GINT_TO_POINTER (NAUTILUS_FILE_SORT_BY_DISPLAY_NAME),
+ NULL, NULL,
"default_list_view_sort_order"
},
{ NAUTILUS_PREFERENCES_LIST_VIEW_DEFAULT_SORT_IN_REVERSE_ORDER,
PREFERENCE_BOOLEAN,
- EEL_USER_LEVEL_NOVICE,
- { EEL_USER_LEVEL_NOVICE, GINT_TO_POINTER (FALSE) },
- { USER_LEVEL_NONE }
+ GINT_TO_POINTER (FALSE)
},
{ NAUTILUS_PREFERENCES_LIST_VIEW_DEFAULT_ZOOM_LEVEL,
PREFERENCE_INTEGER,
- EEL_USER_LEVEL_NOVICE,
- { EEL_USER_LEVEL_NOVICE, GINT_TO_POINTER (NAUTILUS_ZOOM_LEVEL_SMALLER) },
- { USER_LEVEL_NONE },
+ GINT_TO_POINTER (NAUTILUS_ZOOM_LEVEL_SMALLER),
+ NULL, NULL,
"default_zoom_level"
},
/* Sidebar panel default */
{ nautilus_sidebar_news_enabled_preference_name,
PREFERENCE_BOOLEAN,
- EEL_USER_LEVEL_INTERMEDIATE,
- { EEL_USER_LEVEL_NOVICE, GINT_TO_POINTER (TRUE) },
- { USER_LEVEL_NONE }
+ GINT_TO_POINTER (TRUE)
},
{ nautilus_sidebar_notes_enabled_preference_name,
PREFERENCE_BOOLEAN,
- EEL_USER_LEVEL_INTERMEDIATE,
- { EEL_USER_LEVEL_NOVICE, GINT_TO_POINTER (TRUE) },
- { USER_LEVEL_NONE }
+ GINT_TO_POINTER (TRUE)
},
{ nautilus_sidebar_history_enabled_preference_name,
PREFERENCE_BOOLEAN,
- EEL_USER_LEVEL_INTERMEDIATE,
- { EEL_USER_LEVEL_NOVICE, GINT_TO_POINTER (TRUE) },
- { USER_LEVEL_NONE }
+ GINT_TO_POINTER (TRUE)
},
{ nautilus_sidebar_tree_enabled_preference_name,
PREFERENCE_BOOLEAN,
- EEL_USER_LEVEL_INTERMEDIATE,
- { EEL_USER_LEVEL_NOVICE, GINT_TO_POINTER (FALSE) },
- { EEL_USER_LEVEL_INTERMEDIATE, GINT_TO_POINTER (TRUE) }
+ GINT_TO_POINTER (FALSE)
},
/* news panel preferences */
{ NAUTILUS_PREFERENCES_NEWS_MAX_ITEMS,
PREFERENCE_INTEGER,
- EEL_USER_LEVEL_NOVICE,
- { EEL_USER_LEVEL_NOVICE, GINT_TO_POINTER (6) },
- { USER_LEVEL_NONE }
+ GINT_TO_POINTER (6)
},
{ NAUTILUS_PREFERENCES_NEWS_UPDATE_INTERVAL,
PREFERENCE_INTEGER,
- EEL_USER_LEVEL_NOVICE,
- { EEL_USER_LEVEL_NOVICE, GINT_TO_POINTER (5) },
- { USER_LEVEL_NONE }
+ GINT_TO_POINTER (5)
},
/* non-visible preferences */
{ NAUTILUS_PREFERENCES_ADD_TO_SESSION,
PREFERENCE_BOOLEAN,
- EEL_USER_LEVEL_NOVICE,
- { EEL_USER_LEVEL_NOVICE, GINT_TO_POINTER (TRUE) },
- { USER_LEVEL_NONE }
+ GINT_TO_POINTER (TRUE)
},
{ NULL }
@@ -732,53 +601,46 @@ global_preferences_register_enumerations
static void
global_preferences_install_one_default (const char *preference_name,
PreferenceType preference_type,
- const PreferenceUserLevelDefault *user_level_default)
+ const PreferenceDefault *preference_default)
{
gpointer value = NULL;
EelStringList *string_list_value;
-
+
g_return_if_fail (preference_name != NULL);
g_return_if_fail (preference_type >= PREFERENCE_BOOLEAN);
g_return_if_fail (preference_type <= PREFERENCE_STRING_LIST);
- g_return_if_fail (user_level_default != NULL);
-
- if (user_level_default->user_level == USER_LEVEL_NONE) {
- return;
- }
+ g_return_if_fail (preference_default != NULL);
/* If a callback is given, use that to fetch the default value */
- if (user_level_default->callback != NULL) {
- value = (* user_level_default->callback) (user_level_default->user_level);
+ if (preference_default->fallback_callback != NULL) {
+ value = (* preference_default->fallback_callback) ();
} else {
- value = user_level_default->value;
+ value = preference_default->fallback_value;
}
switch (preference_type) {
case PREFERENCE_BOOLEAN:
- eel_preferences_default_set_boolean (preference_name,
- user_level_default->user_level,
- GPOINTER_TO_INT (value));
+ eel_preferences_set_emergency_fallback_boolean (preference_name,
+ GPOINTER_TO_INT (value));
break;
case PREFERENCE_INTEGER:
- eel_preferences_default_set_integer (preference_name,
- user_level_default->user_level,
- GPOINTER_TO_INT (value));
+ eel_preferences_set_emergency_fallback_integer (preference_name,
+
+ GPOINTER_TO_INT (value));
break;
case PREFERENCE_STRING:
- eel_preferences_default_set_string (preference_name,
- user_level_default->user_level,
- value);
+ eel_preferences_set_emergency_fallback_string (preference_name,
+ value);
break;
case PREFERENCE_STRING_LIST:
string_list_value = eel_string_list_new_from_tokens (value,
STRING_LIST_DEFAULT_TOKENS_DELIMETER,
TRUE);
- eel_preferences_default_set_string_list (preference_name,
- user_level_default->user_level,
- string_list_value);
+ eel_preferences_set_emergency_fallback_string_list (preference_name,
+ string_list_value);
eel_string_list_free (string_list_value);
break;
@@ -787,9 +649,9 @@ global_preferences_install_one_default (
}
/* Free the dynamic default value if needed */
- if (user_level_default->callback != NULL
- && user_level_default->callback_result_free_function != NULL) {
- (* user_level_default->callback_result_free_function) (value);
+ if (preference_default->fallback_callback != NULL
+ && preference_default->fallback_callback_result_free_function != NULL) {
+ (* preference_default->fallback_callback_result_free_function) (value);
}
}
@@ -810,23 +672,14 @@ global_preferences_install_defaults (voi
for (i = 0; preference_defaults[i].name != NULL; i++) {
global_preferences_install_one_default (preference_defaults[i].name,
- preference_defaults[i].type,
- &preference_defaults[i].default1);
-
- global_preferences_install_one_default (preference_defaults[i].name,
preference_defaults[i].type,
- &preference_defaults[i].default2);
-
- eel_preferences_set_visible_user_level (preference_defaults[i].name,
- preference_defaults[i].visible_user_level);
+ &preference_defaults[i]);
}
}
static gpointer
-default_font_callback (int user_level)
+default_font_callback (void)
{
- g_return_val_if_fail (eel_preferences_user_level_is_valid (user_level), NULL);
-
if (eel_dumb_down_for_multi_byte_locale_hack ()) {
return g_strdup ("fixed");
}
@@ -849,7 +702,7 @@ get_default_folder_viewer_preference_fro
}
static gpointer
-default_default_folder_viewer_callback (int user_level)
+default_default_folder_viewer_callback (void)
{
Bonobo_ServerInfo *bonobo_activation_info;
int result;
@@ -869,9 +722,8 @@ default_default_folder_viewer_callback (
}
static gpointer
-default_home_location_callback (int user_level)
+default_home_location_callback (void)
{
- g_return_val_if_fail (eel_preferences_user_level_is_valid (user_level), NULL);
return gnome_vfs_get_uri_from_local_path (g_get_home_dir ());
}
@@ -984,9 +836,9 @@ nautilus_global_preferences_init (void)
/* Install defaults */
global_preferences_install_defaults ();
-
- global_preferences_register_enumerations ();
+ global_preferences_register_enumerations ();
+
/* Add the gnome-vfs path to the list of monitored directories - for proxy settings */
eel_preferences_monitor_directory (SYSTEM_GNOME_VFS_PATH);
@@ -1007,4 +859,9 @@ nautilus_global_preferences_init (void)
* widget machinery.
*/
smooth_graphics_mode_changed_callback (NULL);
+
+ /* Preload everything in a big batch */
+ eel_gconf_preload_cache ("/apps/nautilus/preferences",
+ GCONF_CLIENT_PRELOAD_ONELEVEL);
}
+
Index: libnautilus-private/nautilus.schemas
===================================================================
RCS file: nautilus.schemas
diff -N nautilus.schemas
--- /dev/null Tue May 5 16:32:27 1998
+++ nautilus.schemas Fri Jan 4 18:28:32 2002
@@ -0,0 +1,129 @@
+<gconfschemafile>
+ <schemalist>
+
+ <!-- Keep the defaults in sync with the emergency fallbacks
+ in nautilus-global-preferences.c -->
+
+ <!-- General preferences -->
+
+ <schema>
+ <key>/schemas/apps/nautilus/preferences/show_hidden_files</key>
+ <applyto>/apps/nautilus/preferences/show_hidden_files</applyto>
+ <owner>nautilus</owner>
+ <type>bool</type>
+ <default>false</default>
+ <locale name="C">
+ <short>Whether to show dotfiles</short>
+ <long>
+ If set to true, then hidden files (dotfiles) are shown in
+ the file manager.
+ </long>
+ </locale>
+ </schema>
+
+ <schema>
+ <key>/schemas/apps/nautilus/preferences/show_backup_files</key>
+ <applyto>/apps/nautilus/preferences/show_backup_files</applyto>
+ <owner>nautilus</owner>
+ <type>bool</type>
+ <default>false</default>
+ <locale name="C">
+ <short>Whether to show backup files</short>
+ <long>
+ If set to true, then backup files such as those created
+ by Emacs are displayed. Currently, only files ending in
+ a tilde (~) are considered backup files.
+ </long>
+ </locale>
+ </schema>
+
+ <schema>
+ <key>/schemas/apps/nautilus/preferences/confirm_trash</key>
+ <applyto>/apps/nautilus/preferences/confirm_trash</applyto>
+ <owner>nautilus</owner>
+ <type>bool</type>
+ <default>true</default>
+ <locale name="C">
+ <short>Whether to ask for confirmation when moving files to trash</short>
+ <long>
+ If set to true, then Nautilus will ask for confirmation when
+ you attempt to put files in the trash.
+ </long>
+ </locale>
+ </schema>
+
+ <schema>
+ <key>/schemas/apps/nautilus/preferences/enable_delete</key>
+ <applyto>/apps/nautilus/preferences/enable_delete</applyto>
+ <owner>nautilus</owner>
+ <type>bool</type>
+ <default>false</default>
+ <locale name="C">
+ <short>Whether to enable immediate deletion</short>
+ <long>
+ If set to true, then Nautilus will have a feature allowing
+ you to delete a file immediately and in-place, instead of moving it
+ to the trash. This feature can be dangerous, so use caution.
+ </long>
+ </locale>
+ </schema>
+
+ <schema>
+ <key>/schemas/apps/nautilus/preferences/show_icon_text</key>
+ <applyto>/apps/nautilus/preferences/show_icon_text</applyto>
+ <owner>nautilus</owner>
+ <type>string</type>
+ <default>local_only</default>
+ <locale name="C">
+ <short>When to show preview text in icons</short>
+ <long>
+ Speed tradeoff for when to show a preview of text file contents
+ in the file's icon.
+ If set to "always" then always show previews,
+ even if the directory is on a remote server.
+ If set to "local_only" then only show previews for local filesystems.
+ If set to "never" then never bother to read preview data.
+ </long>
+ </locale>
+ </schema>
+
+ <schema>
+ <key>/schemas/apps/nautilus/preferences/show_directory_item_counts</key>
+ <applyto>/apps/nautilus/preferences/show_directory_item_counts</applyto>
+ <owner>nautilus</owner>
+ <type>string</type>
+ <default>local_only</default>
+ <locale name="C">
+ <short>When to show number of items in a directory</short>
+ <long>
+ Speed tradeoff for when to show the number of items in a
+ directory. If set to "always" then always show item counts,
+ even if the directory is on a remote server.
+ If set to "local_only" then only show counts for local filesystems.
+ If set to "never" then never bother to compute item counts.
+ </long>
+ </locale>
+ </schema>
+
+ <schema>
+ <key>/schemas/apps/nautilus/preferences/click_policy</key>
+ <applyto>/apps/nautilus/preferences/click_policy</applyto>
+ <owner>nautilus</owner>
+ <type>string</type>
+ <default>double</default>
+ <locale name="C">
+ <short>Type of click used to launch/open files</short>
+ <long>
+ Possible values are "single" to launch files on a single click,
+ or "double" to launch them on a double click.
+ </long>
+ </locale>
+ </schema>
+
+
+ </schemalist>
+</gconfschemafile>
+
+
+
+
Index: src/nautilus-shell-ui.xml
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-shell-ui.xml,v
retrieving revision 1.71
diff -u -p -u -r1.71 nautilus-shell-ui.xml
--- src/nautilus-shell-ui.xml 2001/11/05 18:17:24 1.71
+++ src/nautilus-shell-ui.xml 2002/01/04 23:28:32
@@ -124,6 +124,11 @@
<separator/>
+ <menuitem name="User Level Customization"
+ _label="P_references..."
+ _tip="Edit Nautilus preferences"
+ verb="User Level Customization"/>
+
<menuitem name="Customize"
_label="_Backgrounds and Emblems..."
_tip="Display patterns, colors, and emblems that can be used to customize appearance"
@@ -251,29 +256,6 @@
_label="_Report Profiling"
_tip="Report Profiling"
verb="Report Profiling"/>
- </submenu>
-
- <submenu name="Preferences" _label="_Preferences">
-
- <placeholder name="User Levels Placeholder" delimit="none">
- <menuitem name="Switch to Beginner Level"
- _label=" _Beginner"
- _tip="Use preferences appropriate for beginners"
- verb="" pixtype="filename"/>
- <menuitem name="Switch to Intermediate Level"
- _label=" _Intermediate"
- _tip="Use preferences appropriate for most people"
- verb="" pixtype="filename"/>
- <menuitem name="Switch to Advanced Level"
- _label=" _Advanced"
- _tip="Use preferences appropriate for experts"
- verb="" pixtype="filename"/>
- </placeholder>
- <separator/>
- <menuitem name="User Level Customization"
- _label="_Edit Preferences..."
- _tip="Edit various Nautilus preferences"
- verb="User Level Customization"/>
</submenu>
<submenu name="Help" _label="_Help">
Index: src/nautilus-window-menus.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-window-menus.c,v
retrieving revision 1.215
diff -u -p -u -r1.215 nautilus-window-menus.c
--- src/nautilus-window-menus.c 2001/12/07 00:55:19 1.215
+++ src/nautilus-window-menus.c 2002/01/04 23:28:32
@@ -119,13 +119,6 @@ static void schedule_re
static void edit_bookmarks (NautilusWindow *window);
static void add_bookmark_for_current_location (NautilusWindow *window);
-/* User level things */
-static guint convert_verb_to_user_level (const char *verb);
-static const char * convert_user_level_to_path (guint user_level);
-static void switch_to_user_level (NautilusWindow *window,
- int new_user_level);
-
-
#define NAUTILUS_MENU_PATH_NOVICE_ITEM "/menu/Preferences/User Levels Placeholder/Switch to Beginner Level"
#define NAUTILUS_MENU_PATH_INTERMEDIATE_ITEM "/menu/Preferences/User Levels Placeholder/Switch to Intermediate Level"
#define NAUTILUS_MENU_PATH_EXPERT_ITEM "/menu/Preferences/User Levels Placeholder/Switch to Advanced Level"
@@ -694,90 +687,7 @@ help_menu_nautilus_feedback_callback (Bo
CUSTOMER_FEEDBACK_URI);
}
-/* utility routine to return an image corresponding to the passed-in user level */
-
-static char *
-get_user_level_icon_name (int user_level, gboolean is_selected)
-{
- const char *image_name;
- char *full_image_name;
-
- switch (user_level) {
- case EEL_USER_LEVEL_NOVICE:
- image_name = "novice";
- break;
- case EEL_USER_LEVEL_ADVANCED:
- image_name = "expert";
- break;
- case EEL_USER_LEVEL_INTERMEDIATE:
- default:
- image_name = "intermediate";
- break;
- }
-
- if (is_selected) {
- full_image_name = g_strdup_printf ("nautilus/%s-selected.png", image_name);
- } else {
- full_image_name = g_strdup_printf ("nautilus/%s.png", image_name);
- }
-
- return full_image_name;
-}
-
-/* handle user level changes */
static void
-switch_to_user_level (NautilusWindow *window, int new_user_level)
-{
- char *old_user_level_icon_name;
- int old_user_level;
- char *new_user_level_icon_name_selected;
-
- if (window->details->shell_ui == NULL) {
- return;
- }
-
- old_user_level = eel_preferences_get_user_level ();
- if (new_user_level == old_user_level) {
- return;
- }
-
- eel_preferences_set_user_level (new_user_level);
-
- nautilus_window_ui_freeze (window);
-
- bonobo_ui_component_freeze (window->details->shell_ui, NULL);
-
- /* change the item icons to reflect the new user level */
- old_user_level_icon_name = get_user_level_icon_name (old_user_level, FALSE);
- nautilus_bonobo_set_icon (window->details->shell_ui,
- convert_user_level_to_path (old_user_level),
- old_user_level_icon_name);
- g_free (old_user_level_icon_name);
-
- new_user_level_icon_name_selected = get_user_level_icon_name (new_user_level, TRUE);
- nautilus_bonobo_set_icon (window->details->shell_ui,
- convert_user_level_to_path (new_user_level),
- new_user_level_icon_name_selected);
- g_free (new_user_level_icon_name_selected);
-
- bonobo_ui_component_thaw (window->details->shell_ui, NULL);
-
- nautilus_window_ui_thaw (window);
-}
-
-static void
-user_level_menu_item_callback (BonoboUIComponent *component,
- gpointer user_data,
- const char *verb)
-{
- NautilusWindow *window;
-
- window = NAUTILUS_WINDOW (user_data);
-
- switch_to_user_level (window, convert_verb_to_user_level (verb));
-}
-
-static void
remove_bookmarks_for_uri_if_yes (GtkDialog *dialog, int response, gpointer callback_data)
{
const char *uri;
@@ -1203,54 +1113,6 @@ nautilus_window_initialize_go_menu (Naut
GTK_OBJECT (window));
}
-static void
-update_user_level_menu_item (NautilusWindow *window,
- const char *menu_path,
- guint item_user_level)
-{
-
- guint current_user_level;
- char *icon_name;
-
- if (window->details->shell_ui == NULL) {
- return;
- }
-
- current_user_level = eel_preferences_get_user_level ();
-
- icon_name = get_user_level_icon_name (item_user_level, current_user_level == item_user_level);
-
- nautilus_window_ui_freeze (window);
-
- nautilus_bonobo_set_icon (window->details->shell_ui,
- menu_path,
- icon_name);
-
- g_free (icon_name);
-
- nautilus_window_ui_thaw (window);
-}
-
-static void
-user_level_changed_callback (gpointer callback_data)
-{
- NautilusWindow *window;
-
- g_return_if_fail (NAUTILUS_IS_WINDOW (callback_data));
-
- window = NAUTILUS_WINDOW (callback_data);
-
- update_user_level_menu_item (window,
- NAUTILUS_MENU_PATH_NOVICE_ITEM,
- EEL_USER_LEVEL_NOVICE);
- update_user_level_menu_item (window,
- NAUTILUS_MENU_PATH_INTERMEDIATE_ITEM,
- EEL_USER_LEVEL_INTERMEDIATE);
- update_user_level_menu_item (window,
- NAUTILUS_MENU_PATH_EXPERT_ITEM,
- EEL_USER_LEVEL_ADVANCED);
-}
-
/**
* nautilus_window_initialize_menus
*
@@ -1302,12 +1164,7 @@ nautilus_window_initialize_menus_part_1
BONOBO_UI_VERB ("Nautilus Quick Reference", help_menu_nautilus_quick_reference_callback),
BONOBO_UI_VERB ("Nautilus Release Notes", help_menu_nautilus_release_notes_callback),
BONOBO_UI_VERB ("Nautilus Feedback", help_menu_nautilus_feedback_callback),
-
- BONOBO_UI_VERB ("Switch to Beginner Level", user_level_menu_item_callback),
- BONOBO_UI_VERB ("Switch to Intermediate Level", user_level_menu_item_callback),
- BONOBO_UI_VERB ("Switch to Advanced Level", user_level_menu_item_callback),
BONOBO_UI_VERB ("User Level Customization", user_level_customize_callback),
-
BONOBO_UI_VERB ("Stop", stop_button_callback),
BONOBO_UI_VERB_END
@@ -1321,14 +1178,6 @@ nautilus_window_initialize_menus_part_1
nautilus_window_update_show_hide_menu_items (window);
- /* Keep track of user level changes to update the user level menu item icons */
- eel_preferences_add_callback_while_alive ("user_level",
- user_level_changed_callback,
- window,
- G_OBJECT (window));
- /* Update the user level menu items for the first time */
- user_level_changed_callback (window);
-
/* Register to catch Bonobo UI events so we can notice View As changes */
g_signal_connect (window->details->shell_ui, "ui_event",
G_CALLBACK (nautilus_window_handle_ui_event_callback), window);
@@ -1520,35 +1369,3 @@ schedule_refresh_go_menu (NautilusWindow
}
-static guint
-convert_verb_to_user_level (const char *verb)
-{
- g_assert (verb != NULL);
-
- if (strcmp (verb, SWITCH_TO_BEGINNER_VERB) == 0) {
- return EEL_USER_LEVEL_NOVICE;
- } else if (strcmp (verb, SWITCH_TO_INTERMEDIATE_VERB) == 0) {
- return EEL_USER_LEVEL_INTERMEDIATE;
- } else if (strcmp (verb, SWITCH_TO_ADVANCED_VERB) == 0) {
- return EEL_USER_LEVEL_ADVANCED;
- }
-
- g_assert_not_reached ();
- return EEL_USER_LEVEL_NOVICE;
-}
-
-static const char *
-convert_user_level_to_path (guint user_level)
-{
- switch (user_level) {
- case EEL_USER_LEVEL_NOVICE:
- return NAUTILUS_MENU_PATH_NOVICE_ITEM;
- case EEL_USER_LEVEL_INTERMEDIATE:
- return NAUTILUS_MENU_PATH_INTERMEDIATE_ITEM;
- case EEL_USER_LEVEL_ADVANCED:
- return NAUTILUS_MENU_PATH_EXPERT_ITEM;
- }
-
- g_assert_not_reached ();
- return NAUTILUS_MENU_PATH_NOVICE_ITEM;
-}
Index: test/test-nautilus-preferences-change.c
===================================================================
RCS file: /cvs/gnome/nautilus/test/test-nautilus-preferences-change.c,v
retrieving revision 1.10
diff -u -p -u -r1.10 test-nautilus-preferences-change.c
--- test/test-nautilus-preferences-change.c 2001/11/09 02:05:53 1.10
+++ test/test-nautilus-preferences-change.c 2002/01/04 23:28:33
@@ -7,39 +7,6 @@
#include <unistd.h>
static void
-user_level_changed_callback (gpointer callback_data)
-{
- char *name;
- int user_level;
- int visible_user_level;
-
- g_return_if_fail (EEL_IS_STRING_PICKER (callback_data));
-
-
- name = eel_caption_get_title_label (EEL_CAPTION (callback_data));
-
- user_level = eel_preferences_get_user_level ();
- visible_user_level = eel_preferences_get_visible_user_level (name);
-
- if (visible_user_level <= user_level) {
- gtk_widget_show (GTK_WIDGET (callback_data));
- } else {
- gtk_widget_hide (GTK_WIDGET (callback_data));
- }
-
-#if 0
- g_print ("%s(data=%s) user_level = %d, visible_user_level = %d, action = %s\n",
- __FUNCTION__,
- name,
- user_level,
- visible_user_level,
- (visible_user_level <= user_level) ? "show" : "hide");
-#endif
-
- g_free (name);
-}
-
-static void
fruits_changed_callback (gpointer callback_data)
{
g_print ("Something underneath 'fruits' changed, dunno what\n");
@@ -64,25 +31,6 @@ int_picker_changed_callback (EelStringPi
g_free (selected_string);
}
-static void
-user_level_picker_changed_callback (EelStringPicker *string_picker,
- gpointer callback_data)
-{
- char *selected_string;
- int new_user_level;
-
- g_return_if_fail (EEL_IS_STRING_PICKER (string_picker));
- g_return_if_fail (callback_data != NULL);
-
- selected_string = eel_string_picker_get_selected_string (string_picker);
-
- new_user_level = eel_string_picker_get_index_for_string (string_picker, selected_string);
-
- eel_preferences_set_user_level (new_user_level);
-
- g_free (selected_string);
-}
-
static GtkWidget *
picker_new (const char *name,
const EelStringList *entries)
@@ -100,43 +48,14 @@ picker_new (const char *name,
eel_string_picker_set_string_list (EEL_STRING_PICKER (string_picker), entries);
eel_string_picker_set_selected_string_index (EEL_STRING_PICKER (string_picker),
eel_preferences_get_integer (name));
-
- eel_preferences_add_callback ("user_level", user_level_changed_callback, string_picker);
- user_level_changed_callback (string_picker);
return string_picker;
}
-static GtkWidget *
-user_level_picker_new (const char *name,
- const EelStringList *entries)
-{
- GtkWidget *string_picker;
-
- g_return_val_if_fail (name != NULL, NULL);
- g_return_val_if_fail (entries != NULL, NULL);
-
- string_picker = eel_string_picker_new ();
- eel_caption_set_title_label (EEL_CAPTION (string_picker), name);
- g_signal_connect (string_picker, "changed", G_CALLBACK (user_level_picker_changed_callback),
- (gpointer) name);
-
- eel_string_picker_set_string_list (EEL_STRING_PICKER (string_picker), entries);
- eel_string_picker_set_selected_string_index (EEL_STRING_PICKER (string_picker),
- eel_preferences_get_user_level ());
-
- eel_preferences_add_callback ("user_level", user_level_changed_callback, string_picker);
- user_level_changed_callback (string_picker);
-
- return string_picker;
-}
-
int
main (int argc, char *argv[])
{
GtkWidget *window;
-
- GtkWidget *user_level_picker;
GtkWidget *green_picker;
GtkWidget *yellow_picker;
GtkWidget *red_picker;
@@ -157,37 +76,17 @@ main (int argc, char *argv[])
user_level_entries = eel_string_list_new_from_tokens ("Beginner,Intermediate,Advanced", ",", TRUE);
color_entries = eel_string_list_new_from_tokens ("0,1,2,3,4,5,6,7,8,9,10", ",", TRUE);
fruits_entries = eel_string_list_new_from_tokens ("0,1,2,3", ",", TRUE);
-
- eel_preferences_default_set_string ("user_level",
- EEL_USER_LEVEL_NOVICE,
- "advanced");
- eel_preferences_default_set_integer ("green",
- EEL_USER_LEVEL_NOVICE,
- 3);
-
- eel_preferences_default_set_integer ("yellow",
- EEL_USER_LEVEL_NOVICE,
- 9);
-
- eel_preferences_default_set_integer ("red",
- EEL_USER_LEVEL_NOVICE,
- 7);
-
- eel_preferences_default_set_integer ("fruits/apple",
- EEL_USER_LEVEL_NOVICE,
- 1);
- eel_preferences_default_set_integer ("fruits/orange",
- EEL_USER_LEVEL_NOVICE,
- 2);
- eel_preferences_default_set_integer ("fruits/pear",
- EEL_USER_LEVEL_NOVICE,
- 3);
-
- eel_preferences_set_visible_user_level ("yellow", 1);
- eel_preferences_set_visible_user_level ("green", 0);
- eel_preferences_set_visible_user_level ("red", 2);
+ eel_preferences_set_emergency_fallback_integer ("green", 3);
+
+ eel_preferences_set_emergency_fallback_integer ("yellow", 9);
+
+ eel_preferences_set_emergency_fallback_integer ("red", 7);
+ eel_preferences_set_emergency_fallback_integer ("fruits/apple", 1);
+ eel_preferences_set_emergency_fallback_integer ("fruits/orange", 2);
+ eel_preferences_set_emergency_fallback_integer ("fruits/pear", 3);
+
//sleep (10);
window = test_window_new (NULL, 4);
@@ -195,16 +94,14 @@ main (int argc, char *argv[])
vbox = gtk_vbox_new (FALSE, 2);
gtk_container_add (GTK_CONTAINER (window), vbox);
-
- user_level_picker = user_level_picker_new ("user_level", user_level_entries);
+
green_picker = picker_new ("green", color_entries);
yellow_picker = picker_new ("yellow", color_entries);
red_picker = picker_new ("red", color_entries);
fruits_apple_picker = picker_new ("fruits/apple", fruits_entries);
fruits_orange_picker = picker_new ("fruits/orange", fruits_entries);
fruits_pear_picker = picker_new ("fruits/pear", fruits_entries);
-
- gtk_box_pack_start (GTK_BOX (vbox), user_level_picker, FALSE, FALSE, 0);
+
gtk_box_pack_start (GTK_BOX (vbox), green_picker, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (vbox), yellow_picker, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (vbox), red_picker, FALSE, FALSE, 0);
@@ -217,13 +114,8 @@ main (int argc, char *argv[])
eel_string_list_free (fruits_entries);
eel_preferences_add_callback ("fruits", fruits_changed_callback, NULL);
-
- gtk_widget_show (vbox);
- gtk_widget_show (window);
-// user_level_changed_callback (green_picker);
-// user_level_changed_callback (yellow_picker);
-// user_level_changed_callback (red_picker);
+ gtk_widget_show_all (window);
gtk_main ();
Index: test/test-nautilus-preferences-display.c
===================================================================
RCS file: /cvs/gnome/nautilus/test/test-nautilus-preferences-display.c,v
retrieving revision 1.6
diff -u -p -u -r1.6 test-nautilus-preferences-display.c
--- test/test-nautilus-preferences-display.c 2001/10/28 20:21:52 1.6
+++ test/test-nautilus-preferences-display.c 2002/01/04 23:28:33
@@ -21,33 +21,6 @@ text_caption_update (EelTextCaption *tex
}
static void
-user_level_caption_update (EelTextCaption *text_caption)
-{
- char *old_text;
- char *new_text;
-
- g_return_if_fail (EEL_IS_TEXT_CAPTION (text_caption));
-
- old_text = eel_text_caption_get_text (text_caption);
- new_text = eel_preferences_get ("user_level");
-
- g_print ("'%s' changed from '%s' to '%s'\n",
- "user_level",
- old_text, new_text);
-
- g_free (old_text);
- g_free (new_text);
-
- test_text_caption_set_text_for_string_preferences (text_caption, "user_level");
-}
-
-static void
-user_level_changed_callback (gpointer callback_data)
-{
- user_level_caption_update (EEL_TEXT_CAPTION (callback_data));
-}
-
-static void
green_changed_callback (gpointer callback_data)
{
text_caption_update (EEL_TEXT_CAPTION (callback_data), "green");
@@ -114,28 +87,6 @@ entry_new (const char *name,
}
static GtkWidget *
-user_level_frame_new (void)
-{
- GtkWidget *user_level_caption;
- GtkWidget *user_level_default_caption;
- GtkWidget *user_level_hbox;
- GtkWidget *frame;
-
- frame = gtk_frame_new ("user_level");
-
- user_level_hbox = entry_new ("user_level", &user_level_caption, &user_level_default_caption);
- test_text_caption_set_text_for_string_preferences (EEL_TEXT_CAPTION (user_level_caption), "user_level");
- test_text_caption_set_text_for_default_string_preferences (EEL_TEXT_CAPTION (user_level_default_caption), "user_level");
- eel_preferences_add_callback ("user_level", user_level_changed_callback, user_level_caption);
-
- gtk_container_add (GTK_CONTAINER (frame), user_level_hbox);
-
- gtk_widget_show_all (frame);
-
- return frame;
-}
-
-static GtkWidget *
colors_frame_new (void)
{
GtkWidget *green_caption;
@@ -237,7 +188,6 @@ main (int argc, char *argv[])
GtkWidget *window;
GtkWidget *vbox;
- GtkWidget *user_level_frame;
GtkWidget *colors_frame;
GtkWidget *fruits_frame;
@@ -251,11 +201,9 @@ main (int argc, char *argv[])
vbox = gtk_vbox_new (FALSE, 2);
gtk_container_add (GTK_CONTAINER (window), vbox);
- user_level_frame = user_level_frame_new ();
colors_frame = colors_frame_new ();
fruits_frame = fruits_frame_new ();
- gtk_box_pack_start (GTK_BOX (vbox), user_level_frame, TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (vbox), colors_frame, TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (vbox), fruits_frame, TRUE, TRUE, 0);
Index: test/test.c
===================================================================
RCS file: /cvs/gnome/nautilus/test/test.c,v
retrieving revision 1.22
diff -u -p -u -r1.22 test.c
--- test/test.c 2002/01/03 23:21:01 1.22
+++ test/test.c 2002/01/04 23:28:33
@@ -46,11 +46,10 @@ test_window_new (const char *title, guin
}
g_signal_connect (window,
- "delete_event",
- G_CALLBACK (test_delete_event),
- NULL);
+ "delete_event",
+ G_CALLBACK (test_delete_event),
+ NULL);
- gtk_window_set_policy (GTK_WINDOW (window), TRUE, TRUE, FALSE);
gtk_container_set_border_width (GTK_CONTAINER (window), border_width);
return window;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]