diff options
author | Ramiro Estrugo <ramiro@src.gnome.org> | 2000-05-29 10:29:01 +0000 |
---|---|---|
committer | Ramiro Estrugo <ramiro@src.gnome.org> | 2000-05-29 10:29:01 +0000 |
commit | 7b4e5be3e67c81584691ff05aaf787f64d7f0c25 (patch) | |
tree | c81fbb52cb564f7f34399530267911fbd09756d6 /nautilus-widgets | |
parent | b6046f5e0ff2501a7d95fd0cbda5d752f19d93d6 (diff) | |
download | nautilus-7b4e5be3e67c81584691ff05aaf787f64d7f0c25.tar.gz |
nautilus-widgets/nautilus-string-picker.c, New widget to pick a string
* nautilus-widgets/nautilus-string-picker.c,
* nautilus-widgets/nautilus-string-picker.h:
New widget to pick a string from a list.
* nautilus-widgets/test-nautilus-preferences.c:
New test program. Test prefrences things.
* nautilus-widgets/test-nautilus-widgets.c:
Remove preference tests. Test only non preference widgetry.
* nautilus-widgets/Makefile.am,
* nautilus-widgets/.cvsignore:
Add test-nautilus-preferences.
Diffstat (limited to 'nautilus-widgets')
-rw-r--r-- | nautilus-widgets/.cvsignore | 1 | ||||
-rw-r--r-- | nautilus-widgets/Makefile.am | 25 | ||||
-rw-r--r-- | nautilus-widgets/nautilus-string-picker.c | 264 | ||||
-rw-r--r-- | nautilus-widgets/nautilus-string-picker.h | 80 | ||||
-rw-r--r-- | nautilus-widgets/test-nautilus-preferences.c | 123 | ||||
-rw-r--r-- | nautilus-widgets/test-nautilus-widgets.c | 175 |
6 files changed, 546 insertions, 122 deletions
diff --git a/nautilus-widgets/.cvsignore b/nautilus-widgets/.cvsignore index c181e2bb8..694111a77 100644 --- a/nautilus-widgets/.cvsignore +++ b/nautilus-widgets/.cvsignore @@ -5,3 +5,4 @@ Makefile Makefile.in test-nautilus-widgets +test-nautilus-preferences diff --git a/nautilus-widgets/Makefile.am b/nautilus-widgets/Makefile.am index 6a07f9920..89f29e221 100644 --- a/nautilus-widgets/Makefile.am +++ b/nautilus-widgets/Makefile.am @@ -1,6 +1,6 @@ NULL= -bin_PROGRAMS = test-nautilus-widgets +bin_PROGRAMS = test-nautilus-widgets test-nautilus-preferences lib_LTLIBRARIES=libnautilus-widgets.la @@ -30,10 +30,10 @@ libnautilus_widgetsinclude_HEADERS =\ nautilus-preferences-pane.h \ nautilus-preferences.h \ nautilus-radio-button-group.h \ + nautilus-string-picker.h \ $(NULL) libnautilus_widgets_la_SOURCES =\ - nautilus-widgets-self-check-functions.h \ nautilus-caption-table.c \ nautilus-password-dialog.c \ nautilus-preference.c \ @@ -44,14 +44,12 @@ libnautilus_widgets_la_SOURCES =\ nautilus-preferences-pane.c \ nautilus-preferences.c \ nautilus-radio-button-group.c \ + nautilus-string-picker.c \ nautilus-widgets-self-check-functions.c \ + nautilus-widgets-self-check-functions.h \ $(NULL) -test_nautilus_widgets_SOURCES =\ - test-nautilus-widgets.c \ - $(NULL) - -test_nautilus_widgets_LDADD =\ +test_ldd =\ $(GCONF_LIBS) \ $(GNOMEUI_LIBS) \ ../nautilus-widgets/libnautilus-widgets.la \ @@ -60,7 +58,14 @@ test_nautilus_widgets_LDADD =\ ../librsvg/librsvg.la \ $(NULL) -#test_preferences_SOURCES =\ -# test-preferences.c \ -# $(NULL) +test_nautilus_widgets_SOURCES =\ + test-nautilus-widgets.c \ + $(NULL) + +test_nautilus_widgets_LDADD = $(test_ldd) + +test_nautilus_preferences_SOURCES =\ + test-nautilus-preferences.c \ + $(NULL) +test_nautilus_preferences_LDADD = $(test_ldd) diff --git a/nautilus-widgets/nautilus-string-picker.c b/nautilus-widgets/nautilus-string-picker.c new file mode 100644 index 000000000..c2922ed37 --- /dev/null +++ b/nautilus-widgets/nautilus-string-picker.c @@ -0,0 +1,264 @@ +/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ + +/* nautilus-string-picker.c - A widget to pick a string from a list. + + Copyright (C) 1999, 2000 Eazel, Inc. + + The Gnome Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The Gnome Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the Gnome Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. + + Authors: Ramiro Estrugo <ramiro@eazel.com> +*/ + +#include <config.h> + +#include <nautilus-widgets/nautilus-string-picker.h> +#include <libnautilus-extensions/nautilus-gtk-macros.h> +#include <libnautilus-extensions/nautilus-glib-extensions.h> + +#include <gtk/gtklabel.h> +#include <gtk/gtkcombo.h> + +#include <gtk/gtksignal.h> + +static const gint STRING_PICKER_INVALID = -1; +static const gint STRING_PICKER_SPACING = 10; + +/* Signals */ +typedef enum +{ + CHANGED, + LAST_SIGNAL +} RadioGroupSignals; + +struct _NautilusStringPickerDetail +{ + GtkWidget *title_label; + GtkWidget *combo_box; +}; + +/* NautilusStringPickerClass methods */ +static void nautilus_string_picker_initialize_class (NautilusStringPickerClass *klass); +static void nautilus_string_picker_initialize (NautilusStringPicker *string_picker); + + +/* GtkObjectClass methods */ +static void nautilus_string_picker_destroy (GtkObject *object); + + +/* Private stuff */ +static GtkEntry * string_picker_get_entry_widget (NautilusStringPicker *string_picker); + +/* Editable (entry) callbacks */ +static void entry_changed_callback (GtkWidget *entry, + gpointer user_data); + +NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusStringPicker, nautilus_string_picker, GTK_TYPE_HBOX) + +static guint string_picker_signals[LAST_SIGNAL] = { 0 }; + +/* + * NautilusStringPickerClass methods + */ +static void +nautilus_string_picker_initialize_class (NautilusStringPickerClass *string_picker_class) +{ + GtkObjectClass *object_class; + GtkWidgetClass *widget_class; + + object_class = GTK_OBJECT_CLASS (string_picker_class); + widget_class = GTK_WIDGET_CLASS (string_picker_class); + + parent_class = gtk_type_class (gtk_hbox_get_type ()); + + /* GtkObjectClass */ + object_class->destroy = nautilus_string_picker_destroy; + + /* Signals */ + string_picker_signals[CHANGED] = + gtk_signal_new ("changed", + GTK_RUN_LAST, + object_class->type, + 0, + gtk_marshal_NONE__NONE, + GTK_TYPE_NONE, + 0); + + gtk_object_class_add_signals (object_class, string_picker_signals, LAST_SIGNAL); +} + +static void +nautilus_string_picker_initialize (NautilusStringPicker *string_picker) +{ + string_picker->detail = g_new (NautilusStringPickerDetail, 1); + + gtk_box_set_homogeneous (GTK_BOX (string_picker), FALSE); + gtk_box_set_spacing (GTK_BOX (string_picker), STRING_PICKER_SPACING); + + string_picker->detail->title_label = gtk_label_new ("Title Label:"); + string_picker->detail->combo_box = gtk_combo_new (); + + gtk_entry_set_editable (string_picker_get_entry_widget (string_picker), FALSE); + + gtk_box_pack_start (GTK_BOX (string_picker), + string_picker->detail->title_label, + FALSE, /* expand */ + TRUE, /* fill */ + 0); /* padding */ + + gtk_box_pack_end (GTK_BOX (string_picker), + string_picker->detail->combo_box, + TRUE, /* expand */ + TRUE, /* fill */ + 0); /* padding */ + + gtk_signal_connect (GTK_OBJECT (string_picker_get_entry_widget (string_picker)), + "changed", + GTK_SIGNAL_FUNC (entry_changed_callback), + (gpointer) string_picker); + + gtk_widget_show (string_picker->detail->title_label); + gtk_widget_show (string_picker->detail->combo_box); +} + +/* + * GtkObjectClass methods + */ +static void +nautilus_string_picker_destroy(GtkObject* object) +{ + NautilusStringPicker * string_picker; + + g_return_if_fail (object != NULL); + g_return_if_fail (NAUTILUS_IS_STRING_PICKER (object)); + + string_picker = NAUTILUS_STRING_PICKER (object); + + g_free (string_picker->detail); + + /* Chain */ + NAUTILUS_CALL_PARENT_CLASS (GTK_OBJECT_CLASS, destroy, (object)); +} + +/* + * Private stuff + */ +static GtkEntry * +string_picker_get_entry_widget (NautilusStringPicker *string_picker) +{ + g_assert (string_picker != NULL); + g_assert (NAUTILUS_IS_STRING_PICKER (string_picker)); + + return GTK_ENTRY (GTK_COMBO (string_picker->detail->combo_box)->entry); +} + +/* + * Editable (entry) callbacks + */ +static void +entry_changed_callback (GtkWidget *entry, gpointer user_data) +{ + const char *entry_text; + + NautilusStringPicker *string_picker; + + g_assert (user_data != NULL); + g_assert (NAUTILUS_IS_STRING_PICKER (user_data)); + + string_picker = NAUTILUS_STRING_PICKER (user_data); + + /* WATCHOUT: + * As of gtk1.2, gtk_entry_get_text() returns a non const reference to + * the internal string. + */ + entry_text = (const char *) gtk_entry_get_text (string_picker_get_entry_widget (string_picker)); + + gtk_signal_emit (GTK_OBJECT (string_picker), string_picker_signals[CHANGED]); +} + +/* + * NautilusStringPicker public methods + */ +GtkWidget* +nautilus_string_picker_new (void) +{ + NautilusStringPicker *string_picker; + + string_picker = gtk_type_new (nautilus_string_picker_get_type ()); + + return GTK_WIDGET (string_picker); +} + +/** + * nautilus_string_picker_set_string_list: + * @string_picker: A NautilusStringPicker + * + * Returns: The index of the active button. There is always one active by law. + */ +void +nautilus_string_picker_set_string_list (NautilusStringPicker *string_picker, + const NautilusStringList *string_list) +{ + GList *strings; + + g_return_if_fail (string_picker != NULL); + g_return_if_fail (NAUTILUS_IS_STRING_PICKER (string_picker)); + + strings = nautilus_string_list_as_g_list (string_list); + + gtk_combo_set_popdown_strings (GTK_COMBO (string_picker->detail->combo_box), strings); + + nautilus_g_list_free_deep (strings); +} + +/** + * nautilus_string_picker_set_title_label: + * @string_picker: A NautilusStringPicker + * @title_label: The title label + * + */ +void +nautilus_string_picker_set_title_label (NautilusStringPicker *string_picker, + const char *title_label) +{ + g_return_if_fail (string_picker != NULL); + g_return_if_fail (NAUTILUS_IS_STRING_PICKER (string_picker)); + g_return_if_fail (title_label != NULL); + + gtk_label_set_text (GTK_LABEL (string_picker->detail->title_label), title_label); +} + +/** + * nautilus_string_picker_get_text + * @string_picker: A NautilusStringPicker + * + * Returns: A copy of the currently selected text. Need to g_free() it. + */ +char * +nautilus_string_picker_get_text (NautilusStringPicker *string_picker) +{ + const char *entry_text; + + g_return_val_if_fail (string_picker != NULL, NULL); + g_return_val_if_fail (NAUTILUS_IS_STRING_PICKER (string_picker), NULL); + + /* WATCHOUT: + * As of gtk1.2, gtk_entry_get_text() returns a non const reference to + * the internal string. + */ + entry_text = (const char *) gtk_entry_get_text (string_picker_get_entry_widget (string_picker)); + + return g_strdup (entry_text); +} diff --git a/nautilus-widgets/nautilus-string-picker.h b/nautilus-widgets/nautilus-string-picker.h new file mode 100644 index 000000000..a41006603 --- /dev/null +++ b/nautilus-widgets/nautilus-string-picker.h @@ -0,0 +1,80 @@ +/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ + +/* nautilus-string-picker.h - A widget to pick a string from a list. + + Copyright (C) 1999, 2000 Eazel, Inc. + + The Gnome Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The Gnome Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the Gnome Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. + + Authors: Ramiro Estrugo <ramiro@eazel.com> +*/ + +#ifndef NAUTILUS_STRING_PICKER_H +#define NAUTILUS_STRING_PICKER_H + +#include <gtk/gtkvbox.h> +#include <gnome.h> +#include <libnautilus-extensions/nautilus-string-list.h> + +/* + * NautilusStringPicker is made up of 2 widgets. + * + * [title label] [string combo box] + * + * The user can select a string from the list. + */ +BEGIN_GNOME_DECLS + +#define NAUTILUS_TYPE_STRING_PICKER (nautilus_string_picker_get_type ()) +#define NAUTILUS_STRING_PICKER(obj) (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_STRING_PICKER, NautilusStringPicker)) +#define NAUTILUS_STRING_PICKER_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_STRING_PICKER, NautilusStringPickerClass)) +#define NAUTILUS_IS_STRING_PICKER(obj) (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_STRING_PICKER)) + +typedef struct _NautilusStringPicker NautilusStringPicker; +typedef struct _NautilusStringPickerClass NautilusStringPickerClass; +typedef struct _NautilusStringPickerDetail NautilusStringPickerDetail; + +struct _NautilusStringPicker +{ + /* Super Class */ + GtkHBox hbox; + + /* Private stuff */ + NautilusStringPickerDetail *detail; +}; + +struct _NautilusStringPickerClass +{ + GtkHBoxClass parent_class; +}; + +GtkType nautilus_string_picker_get_type (void); +GtkWidget* nautilus_string_picker_new (void); + + + +/* Set the string list. */ +void nautilus_string_picker_set_string_list (NautilusStringPicker *string_picker, + const NautilusStringList *string_list); +void nautilus_string_picker_set_title_label (NautilusStringPicker *string_picker, + const char *title_label); +char * nautilus_string_picker_get_text (NautilusStringPicker *string_picker); + +BEGIN_GNOME_DECLS + +#endif /* NAUTILUS_STRING_PICKER_H */ + + diff --git a/nautilus-widgets/test-nautilus-preferences.c b/nautilus-widgets/test-nautilus-preferences.c new file mode 100644 index 000000000..8b5013838 --- /dev/null +++ b/nautilus-widgets/test-nautilus-preferences.c @@ -0,0 +1,123 @@ + +#include <config.h> +#include <nautilus-widgets/nautilus-radio-button-group.h> +#include <nautilus-widgets/nautilus-caption-table.h> +#include <nautilus-widgets/nautilus-password-dialog.h> +#include <nautilus-widgets/nautilus-preferences-group.h> +#include <nautilus-widgets/nautilus-preferences-item.h> +#include <nautilus-widgets/nautilus-preferences.h> + +#include <gtk/gtk.h> + +static void test_preferences_group (void); +static void test_preferences_item (void); +static void register_global_preferences (void); +GtkWidget * create_enum_item (const char *preference_name); +GtkWidget * create_bool_item (const char *preference_name); + +enum +{ + FRUIT_APPLE, + FRUIT_ORANGE, + FRUIT_BANNANA +}; + +static const char FRUIT_PREFERENCE[] = "/a/very/fruity/path"; + +int +main (int argc, char * argv[]) +{ + gnome_init ("foo", "bar", argc, argv); + + nautilus_preferences_initialize (argc, argv); + + register_global_preferences (); + + test_preferences_group (); + test_preferences_item (); + + gtk_main (); + + return 0; +} + +static void +test_preferences_item (void) +{ + GtkWidget * window; + GtkWidget * item; + + window = gtk_window_new (GTK_WINDOW_TOPLEVEL); + + item = create_enum_item (FRUIT_PREFERENCE); + + gtk_container_add (GTK_CONTAINER (window), item); + + gtk_widget_show (item); + + gtk_widget_show (window); +} + +static void +test_preferences_group (void) +{ + GtkWidget * window; + GtkWidget * group; + + window = gtk_window_new (GTK_WINDOW_TOPLEVEL); + + group = nautilus_preferences_group_new ("A group"); + + nautilus_preferences_group_add_item (NAUTILUS_PREFERENCES_GROUP (group), + FRUIT_PREFERENCE, + NAUTILUS_PREFERENCE_ITEM_ENUM); + + gtk_container_add (GTK_CONTAINER (window), group); + + gtk_widget_show (group); + + gtk_widget_show (window); +} + +GtkWidget * +create_enum_item (const char *preference_name) +{ + return nautilus_preferences_item_new (preference_name, NAUTILUS_PREFERENCE_ITEM_ENUM); +} + +// GtkWidget * +// create_bool_item (const char *preference_name) +// { +// return nautilus_preferences_item_new (global_preferences, +// preference_name, +// NAUTILUS_PREFERENCE_ITEM_BOOLEAN); +// } + +static void +register_global_preferences (void) +{ + g_assert (nautilus_preferences_is_initialized ()); + + nautilus_preferences_set_info (FRUIT_PREFERENCE, + "Fruits", + NAUTILUS_PREFERENCE_ENUM, + (gconstpointer) FRUIT_ORANGE); + + nautilus_preferences_enum_add_entry (FRUIT_PREFERENCE, + "apple", + "Apple", + FRUIT_APPLE); + + nautilus_preferences_enum_add_entry (FRUIT_PREFERENCE, + "orange", + "Orange", + FRUIT_ORANGE); + + nautilus_preferences_enum_add_entry (FRUIT_PREFERENCE, + "bannana", + "Bannana", + FRUIT_BANNANA); + + nautilus_preferences_set_enum (FRUIT_PREFERENCE, + FRUIT_BANNANA); +} diff --git a/nautilus-widgets/test-nautilus-widgets.c b/nautilus-widgets/test-nautilus-widgets.c index a53521362..82ea878d0 100644 --- a/nautilus-widgets/test-nautilus-widgets.c +++ b/nautilus-widgets/test-nautilus-widgets.c @@ -1,54 +1,36 @@ #include <config.h> #include <nautilus-widgets/nautilus-radio-button-group.h> +#include <nautilus-widgets/nautilus-string-picker.h> #include <nautilus-widgets/nautilus-caption-table.h> #include <nautilus-widgets/nautilus-password-dialog.h> -#include <nautilus-widgets/nautilus-preferences-group.h> -#include <nautilus-widgets/nautilus-preferences-item.h> -#include <nautilus-widgets/nautilus-preferences.h> #include <gtk/gtk.h> static void test_radio_group (void); static void test_caption_table (void); static void test_password_dialog (void); -static void test_preferences_group (void); -static void test_preferences_item (void); -static void test_radio_changed_callback (GtkWidget *button_group, - gpointer user_data); -static void test_authenticate_boink_callback (GtkWidget *button, - gpointer user_data); -static void test_caption_table_activate_callback (GtkWidget *button_group, - gint active_index, - gpointer user_data); -static void register_global_preferences (void); -GtkWidget * create_enum_item (const char *preference_name); -GtkWidget * create_bool_item (const char *preference_name); - -enum -{ - FRUIT_APPLE, - FRUIT_ORANGE, - FRUIT_BANNANA -}; - -static const char FRUIT_PREFERENCE[] = "/a/very/fruity/path"; +static void test_string_picker (void); +static void test_radio_changed_callback (GtkWidget *button_group, + gpointer user_data); +static void test_authenticate_boink_callback (GtkWidget *button, + gpointer user_data); +static void string_picker_changed_callback (GtkWidget *string_picker, + gpointer user_data); +static void test_caption_table_activate_callback (GtkWidget *button_group, + gint active_index, + gpointer user_data); int main (int argc, char * argv[]) { gnome_init ("foo", "bar", argc, argv); - nautilus_preferences_initialize (argc, argv); - - register_global_preferences (); - test_radio_group (); test_caption_table (); test_password_dialog (); - test_preferences_group (); - test_preferences_item (); - + test_string_picker (); + gtk_main (); return 0; @@ -132,6 +114,41 @@ test_caption_table (void) } static void +test_string_picker (void) +{ + GtkWidget *window; + GtkWidget *picker; + NautilusStringList *font_list; + + window = gtk_window_new (GTK_WINDOW_TOPLEVEL); + + picker = nautilus_string_picker_new (); + + nautilus_string_picker_set_title_label (NAUTILUS_STRING_PICKER (picker), "Icon Font Family:"); + + font_list = nautilus_string_list_new (); + + nautilus_string_list_insert (font_list, "Helvetica"); + nautilus_string_list_insert (font_list, "Times"); + nautilus_string_list_insert (font_list, "Courier"); + nautilus_string_list_insert (font_list, "Lucida"); + nautilus_string_list_insert (font_list, "Fixed"); + + nautilus_string_picker_set_string_list (NAUTILUS_STRING_PICKER (picker), font_list); + + nautilus_string_list_free (font_list); + + gtk_container_add (GTK_CONTAINER (window), picker); + + gtk_signal_connect (GTK_OBJECT (picker), + "changed", + GTK_SIGNAL_FUNC (string_picker_changed_callback), + (gpointer) NULL); + + gtk_widget_show_all (window); +} + +static void test_authenticate_boink_callback (GtkWidget *button, gpointer user_data) { GtkWidget *dialog; @@ -162,6 +179,21 @@ test_authenticate_boink_callback (GtkWidget *button, gpointer user_data) } static void +string_picker_changed_callback (GtkWidget *string_picker, gpointer user_data) +{ + char *text; + + g_assert (string_picker != NULL); + g_assert (NAUTILUS_IS_STRING_PICKER (string_picker)); + + text = nautilus_string_picker_get_text (NAUTILUS_STRING_PICKER (string_picker)); + + g_print ("string_picker_changed_callback(%s)\n", text); + + g_free (text); +} + +static void test_password_dialog (void) { GtkWidget * window; @@ -184,44 +216,6 @@ test_password_dialog (void) } static void -test_preferences_item (void) -{ - GtkWidget * window; - GtkWidget * item; - - window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - - item = create_enum_item (FRUIT_PREFERENCE); - - gtk_container_add (GTK_CONTAINER (window), item); - - gtk_widget_show (item); - - gtk_widget_show (window); -} - -static void -test_preferences_group (void) -{ - GtkWidget * window; - GtkWidget * group; - - window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - - group = nautilus_preferences_group_new ("A group"); - - nautilus_preferences_group_add_item (NAUTILUS_PREFERENCES_GROUP (group), - FRUIT_PREFERENCE, - NAUTILUS_PREFERENCE_ITEM_ENUM); - - gtk_container_add (GTK_CONTAINER (window), group); - - gtk_widget_show (group); - - gtk_widget_show (window); -} - -static void test_radio_changed_callback (GtkWidget *buttons, gpointer user_data) { gint i; @@ -238,46 +232,3 @@ test_caption_table_activate_callback (GtkWidget *button_group, { g_print ("test_caption_table_activate_callback (active_index=%d)\n", active_index); } - -GtkWidget * -create_enum_item (const char *preference_name) -{ - return nautilus_preferences_item_new (preference_name, NAUTILUS_PREFERENCE_ITEM_ENUM); -} - -// GtkWidget * -// create_bool_item (const char *preference_name) -// { -// return nautilus_preferences_item_new (global_preferences, -// preference_name, -// NAUTILUS_PREFERENCE_ITEM_BOOLEAN); -// } - -static void -register_global_preferences (void) -{ - g_assert (nautilus_preferences_is_initialized ()); - - nautilus_preferences_set_info (FRUIT_PREFERENCE, - "Fruits", - NAUTILUS_PREFERENCE_ENUM, - (gconstpointer) FRUIT_ORANGE); - - nautilus_preferences_enum_add_entry (FRUIT_PREFERENCE, - "apple", - "Apple", - FRUIT_APPLE); - - nautilus_preferences_enum_add_entry (FRUIT_PREFERENCE, - "orange", - "Orange", - FRUIT_ORANGE); - - nautilus_preferences_enum_add_entry (FRUIT_PREFERENCE, - "bannana", - "Bannana", - FRUIT_BANNANA); - - nautilus_preferences_set_enum (FRUIT_PREFERENCE, - FRUIT_BANNANA); -} |