summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorHavoc Pennington <hp@pobox.com>2002-01-05 04:05:26 +0000
committerHavoc Pennington <hp@src.gnome.org>2002-01-05 04:05:26 +0000
commite60f2abe9f114f800b22a824402fededf45a5ba7 (patch)
treef7220ba659cb7f50f4ea29fba649eb7b99837118 /test
parentd84dbfa0dd361f02f03673a2dc83d272a1e6fd62 (diff)
downloadnautilus-e60f2abe9f114f800b22a824402fededf45a5ba7.tar.gz
add preload of the gconf cache, to hopefully avoid a zillion round trips
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, incomplete, needs to be finished and installed * 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
Diffstat (limited to 'test')
-rw-r--r--test/test-nautilus-preferences-change.c132
-rw-r--r--test/test-nautilus-preferences-display.c52
-rw-r--r--test/test.c7
3 files changed, 15 insertions, 176 deletions
diff --git a/test/test-nautilus-preferences-change.c b/test/test-nautilus-preferences-change.c
index acbf8030b..4d968bd95 100644
--- a/test/test-nautilus-preferences-change.c
+++ b/test/test-nautilus-preferences-change.c
@@ -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 (EelStringPicker *string_picker,
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,33 +48,6 @@ 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;
}
@@ -135,8 +56,6 @@ int
main (int argc, char *argv[])
{
GtkWidget *window;
-
- GtkWidget *user_level_picker;
GtkWidget *green_picker;
GtkWidget *yellow_picker;
GtkWidget *red_picker;
@@ -157,36 +76,16 @@ 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);
@@ -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);
@@ -218,12 +115,7 @@ main (int argc, char *argv[])
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 ();
diff --git a/test/test-nautilus-preferences-display.c b/test/test-nautilus-preferences-display.c
index bd3442186..ae4a0f311 100644
--- a/test/test-nautilus-preferences-display.c
+++ b/test/test-nautilus-preferences-display.c
@@ -21,33 +21,6 @@ text_caption_update (EelTextCaption *text_caption,
}
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);
diff --git a/test/test.c b/test/test.c
index d2e085f17..f7efdf7ec 100644
--- a/test/test.c
+++ b/test/test.c
@@ -46,11 +46,10 @@ test_window_new (const char *title, guint border_width)
}
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;