diff options
author | Ramiro Estrugo <ramiro@src.gnome.org> | 2000-03-11 00:18:22 +0000 |
---|---|---|
committer | Ramiro Estrugo <ramiro@src.gnome.org> | 2000-03-11 00:18:22 +0000 |
commit | 00f9035c4b10c3a80be553b616dcf64aeb0da903 (patch) | |
tree | c90437672470d604c2e82e3aba34671086e71345 | |
parent | b948827821e27c22c1d23683d70c257290f932e9 (diff) | |
download | nautilus-00f9035c4b10c3a80be553b616dcf64aeb0da903.tar.gz |
src/Makefile.am Moved prefs things to nautilus-widgets. Use
* src/Makefile.am
Moved prefs things to nautilus-widgets.
Use alphabetization technology on the source list.
* src/nautilus-global-preferences.c,
src/nautilus-global-preferences.h:
New files that to deal with preferences that are
global to nautilus.
* src/nautilus-window-menus.c:
Use the new preferences dialog.
* src/ntl-window-state.c:
Go to a different home directory based on the user level.
Commented off until andy makes a nice default home directory
for novice users.
* src/nautilus-prefs-box.c
src/nautilus-prefs-box.h,
src/nautilus-prefs-dialog.c,
src/nautilus-prefs-dialog.h,
src/nautilus-prefs-group-check.c,
src/nautilus-prefs-group-check.h,
src/nautilus-prefs-group-radio.c,
src/nautilus-prefs-group-radio.h,
src/nautilus-prefs-group.c,
src/nautilus-prefs-group.h,
src/nautilus-prefs-pane.c,
src/nautilus-prefs-pane.h,
src/ntl-prefs.c,
src/ntl-prefs.h:
Moved prefs widegtry things to nautilus-widgets.
-rw-r--r-- | ChangeLog-20000414 | 39 | ||||
-rw-r--r-- | src/Makefile.am | 50 | ||||
-rw-r--r-- | src/nautilus-global-preferences.c | 393 | ||||
-rw-r--r-- | src/nautilus-global-preferences.h | 53 | ||||
-rw-r--r-- | src/nautilus-navigation-window-menus.c | 5 | ||||
-rw-r--r-- | src/nautilus-prefs-box.c | 380 | ||||
-rw-r--r-- | src/nautilus-prefs-box.h | 73 | ||||
-rw-r--r-- | src/nautilus-prefs-dialog.c | 281 | ||||
-rw-r--r-- | src/nautilus-prefs-dialog.h | 71 | ||||
-rw-r--r-- | src/nautilus-prefs-group-check.c | 275 | ||||
-rw-r--r-- | src/nautilus-prefs-group-check.h | 69 | ||||
-rw-r--r-- | src/nautilus-prefs-group-radio.c | 454 | ||||
-rw-r--r-- | src/nautilus-prefs-group-radio.h | 77 | ||||
-rw-r--r-- | src/nautilus-prefs-group.c | 202 | ||||
-rw-r--r-- | src/nautilus-prefs-group.h | 77 | ||||
-rw-r--r-- | src/nautilus-prefs-pane.c | 281 | ||||
-rw-r--r-- | src/nautilus-prefs-pane.h | 74 | ||||
-rw-r--r-- | src/nautilus-window-menus.c | 5 | ||||
-rw-r--r-- | src/nautilus-window-state.c | 52 | ||||
-rw-r--r-- | src/ntl-prefs.c | 10 | ||||
-rw-r--r-- | src/ntl-prefs.h | 4 | ||||
-rw-r--r-- | src/ntl-window-state.c | 52 |
22 files changed, 610 insertions, 2367 deletions
diff --git a/ChangeLog-20000414 b/ChangeLog-20000414 index d3c155c05..87a10666b 100644 --- a/ChangeLog-20000414 +++ b/ChangeLog-20000414 @@ -1,5 +1,44 @@ 2000-03-10 Ramiro Estrugo <ramiro@eazel.com> + * src/Makefile.am + Moved prefs things to nautilus-widgets. + Use alphabetization technology on the source list. + + * src/nautilus-global-preferences.c, + src/nautilus-global-preferences.h: + New files that to deal with preferences that are + global to nautilus. + + * src/nautilus-window-menus.c: + Use the new preferences dialog. + + * src/ntl-window-state.c: + Go to a different home directory based on the user level. + Commented off until andy makes a nice default home directory + for novice users. + + * src/ntl-prefs.c, + src/ntl-prefs.h: + Renamed a typedef to avoid conflict. This is a temporary hack. + + * src/nautilus-prefs-box.c + src/nautilus-prefs-box.h, + src/nautilus-prefs-dialog.c, + src/nautilus-prefs-dialog.h, + src/nautilus-prefs-group-check.c, + src/nautilus-prefs-group-check.h, + src/nautilus-prefs-group-radio.c, + src/nautilus-prefs-group-radio.h, + src/nautilus-prefs-group.c, + src/nautilus-prefs-group.h, + src/nautilus-prefs-pane.c, + src/nautilus-prefs-pane.h, + src/ntl-prefs.c, + src/ntl-prefs.h: + Moved prefs widegtry things to nautilus-widgets. + +2000-03-10 Ramiro Estrugo <ramiro@eazel.com> + * nautilus-widgets/Makefile.am, nautilus-widgets/nautilus-preferences-box.c nautilus-widgets/nautilus-preferences-box.h, diff --git a/src/Makefile.am b/src/Makefile.am index b5f6dddac..b5e8fac17 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,49 +1,51 @@ +NULL= + SUBDIRS=file-manager bin_PROGRAMS=nautilus -INCLUDES=-I$(top_srcdir) -I$(top_builddir) \ +INCLUDES =\ + -I$(top_srcdir) -I$(top_builddir) \ $(BONOBO_CFLAGS) $(GNORBA_CFLAGS) \ $(GNOMEUI_CFLAGS) $(GNOMECANVASPIXBUF_INCLUDEDIR) \ $(VFS_CFLAGS) \ $(XML_CFLAGS) \ -DVERSION="\"$(VERSION)\"" \ - $(WERROR) + $(WERROR) \ + $(NULL) -LDADD= file-manager/libntl-file-manager.la \ +LDADD =\ + file-manager/libntl-file-manager.la \ + ../nautilus-widgets/libnautilus-widgets.la \ ../libnautilus/libnautilus.la \ $(BONOBO_LIBS) \ $(GNORBA_LIBS) \ $(GNOMEUI_LIBS) \ $(GNOMECANVASPIXBUF_LIBS) \ $(VFS_LIBS) \ - $(XML_LIBS) + $(XML_LIBS) \ + $(NULL) -nautilus_SOURCES= \ +nautilus_SOURCES =\ explorer-location-bar.c \ explorer-location-bar.h \ nautilus-bookmarklist.c \ nautilus-bookmarklist.h \ nautilus-bookmarks-window.c \ nautilus-bookmarks-window.h \ - nautilus-index-tabs.c \ - nautilus-index-tabs.h \ - nautilus-index-title.c \ - nautilus-index-title.h \ - nautilus-self-check-functions.c \ - nautilus-self-check-functions.h \ + nautilus-global-preferences.c \ + nautilus-global-preferences.h \ nautilus-signaller.c \ nautilus-signaller.h \ - nautilus-window-menus.c \ - nautilus-zoomable-frame-svr.c \ nautilus-zoom-control.c \ nautilus-zoom-control.h \ + nautilus-zoomable-frame-svr.c \ ntl-app.c \ ntl-app.h \ ntl-content-view.c \ - ntl-index-panel.h \ - ntl-index-panel.c \ ntl-content-view.h \ + ntl-index-panel.c \ + ntl-index-panel.h \ ntl-main.c \ ntl-meta-view.c \ ntl-meta-view.h \ @@ -56,18 +58,26 @@ nautilus_SOURCES= \ ntl-uri-map.h \ ntl-view-bonobo-control.c \ ntl-view-bonobo-subdoc.c \ - ntl-view.c \ ntl-view-frame-svr.c \ - ntl-view.h \ ntl-view-nautilus.c \ ntl-view-private.h \ - ntl-window.c \ - ntl-window.h \ + ntl-view.c \ + ntl-view.h \ ntl-window-msgs.c \ ntl-window-msgs.h \ ntl-window-private.h \ ntl-window-state.c \ - ntl-window-state.h + ntl-window-state.h \ + ntl-window.c \ + ntl-window.h \ + nautilus-index-tabs.c \ + nautilus-index-tabs.h \ + nautilus-index-title.c \ + nautilus-index-title.h \ + nautilus-self-check-functions.c \ + nautilus-self-check-functions.h \ + nautilus-window-menus.c \ + $(NULL) TESTS=check-nautilus diff --git a/src/nautilus-global-preferences.c b/src/nautilus-global-preferences.c new file mode 100644 index 000000000..6bd10a001 --- /dev/null +++ b/src/nautilus-global-preferences.c @@ -0,0 +1,393 @@ +/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ + +/* nautilus-prefs-dialog.c - Implementation for preferences dialog. + + 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 "nautilus-global-preferences.h" +#include <nautilus-widgets/nautilus-preferences-group.h> +#include <nautilus-widgets/nautilus-preferences-item.h> +#include <nautilus-widgets/nautilus-preferences-dialog.h> + +#include <gnome.h> + +BEGIN_GNOME_DECLS + + +#include <libnautilus/nautilus-glib-extensions.h> + + +/* + * Constants + */ +#define NAUTILUS_PREFS_DIALOG_TITLE _("Nautilus Preferences") + +/* Private stuff */ +static GtkWidget *prefs_global_create_dialog (void); +static GtkWidget *prefs_global_create_enum_group (GtkWidget *pane, + const gchar *group_title, + const gchar *pref_name); +static GtkWidget *prefs_global_create_check_group (GtkWidget *pane, + const gchar *group_title, + const gchar *pref_names[], + guint num_prefs); + +static GtkWidget *prefs_global_get_prefs_dialog (void); + +//static void user_level_changed_cb (GtkWidget *group, gpointer call_data, gpointer client_data); + +static void prefs_global_register_static_prefs (NautilusPrefs *prefs); + +static void prefs_global_register_dynamic_prefs (NautilusPrefs *prefs); + + +static GtkWidget *panes[3]; + +static const gchar * PREFS_GLOBAL_NAMESPACE = "Nautilus::Global"; + +static const gchar *prefs_global_window_option_pref_names[] = +{ + NAUTILUS_PREFS_WINDOW_ALWAYS_NEW, + NAUTILUS_PREFS_WINDOW_SEARCH_EXISTING +}; + +#if 0 +static const gchar *META_VIEWS[] = +{ + "Annotations", + "Help Contents", + "Help Index", + "Help Search", + "History", + "Web Search" +}; +#endif + + +static const gchar * prefs_global_user_level_names[] = +{ + "novice", + "intermediate", + "hacker", + "ettore" +}; + +static const gchar * prefs_global_user_level_descriptions[] = +{ + "Novice", + "Intermediate", + "Hacker", + "Ettore" +}; + +static const gint prefs_global_user_level_values[] = +{ + NAUTILUS_USER_LEVEL_NOVICE, + NAUTILUS_USER_LEVEL_INTERMEDIATE, + NAUTILUS_USER_LEVEL_HACKER, + NAUTILUS_USER_LEVEL_ETTORE +}; + +static NautilusPrefEnumData prefs_global_user_level_data = +{ + prefs_global_user_level_names, + prefs_global_user_level_descriptions, + prefs_global_user_level_values, + NAUTILUS_N_ELEMENTS (prefs_global_user_level_names) +}; + +static NautilusPrefInfo prefs_global_static_pref_info[] = +{ + { + NAUTILUS_PREFS_USER_LEVEL, + "User Level", + GTK_TYPE_ENUM, + FALSE, + (gpointer) &prefs_global_user_level_data + }, + { + NAUTILUS_PREFS_WINDOW_ALWAYS_NEW, + "Create new window for each new page", + GTK_TYPE_BOOL, + FALSE, + NULL + }, + { + NAUTILUS_PREFS_WINDOW_SEARCH_EXISTING, + "Do not open more than one window with the same page", + GTK_TYPE_BOOL, + FALSE, + NULL + }, +}; + +/* + * Private stuff + */ +static GtkWidget * +prefs_global_create_dialog (void) +{ + GtkWidget *prefs_dialog; + NautilusPrefsBox *prefs_box; + GtkWidget *user_level_group; + + prefs_dialog = nautilus_prefs_dialog_new (NAUTILUS_PREFS_DIALOG_TITLE); + + prefs_box = NAUTILUS_PREFS_BOX (nautilus_prefs_dialog_get_prefs_box (NAUTILUS_PREFS_DIALOG (prefs_dialog))); + + panes[0] = nautilus_prefs_box_add_pane (prefs_box, + "User Level", + "User Level Something"); + + user_level_group = prefs_global_create_enum_group (panes[0], + "User Level", + NAUTILUS_PREFS_USER_LEVEL); + + panes[1] = nautilus_prefs_box_add_pane (prefs_box, + "Window Options", + "Window Options Something"); + + prefs_global_create_check_group (panes[1], + "Basic window options", + prefs_global_window_option_pref_names, + NAUTILUS_N_ELEMENTS (prefs_global_window_option_pref_names)); + +#if 0 + panes[2] = nautilus_prefs_box_add_pane (prefs_box, + "Meta Views", + "Meta Views Something"); + + prefs_global_create_check_group (panes[2], + "Meta Views", + META_VIEWS, + NAUTILUS_N_ELEMENTS (META_VIEWS)); +#endif + + return prefs_dialog; +} + +static GtkWidget * +prefs_global_create_check_group (GtkWidget *pane, + const gchar *group_title, + const gchar *pref_names[], + guint num_prefs) +{ + GtkWidget *group; + guint i; + + group = nautilus_preferences_group_new (group_title); + + for (i = 0; i < num_prefs; i++) + { + GtkWidget *item; + + item = nautilus_preferences_item_new (GTK_OBJECT (nautilus_prefs_global_get_prefs ()), + pref_names[i], + NAUTILUS_PREFERENCES_ITEM_BOOL); + + nautilus_preferences_group_add (NAUTILUS_PREFERENCES_GROUP (group), + item); + + gtk_widget_show (item); + } + + nautilus_prefs_pane_add_group (NAUTILUS_PREFS_PANE (pane), group); + + gtk_widget_show (group); + + return group; +} + +static GtkWidget * +prefs_global_create_enum_group (GtkWidget *pane, + const gchar *group_title, + const gchar *pref_name) +{ + GtkWidget *group; + GtkWidget *item; + + group = nautilus_preferences_group_new (group_title); + + item = nautilus_preferences_item_new (GTK_OBJECT (nautilus_prefs_global_get_prefs ()), + pref_name, + NAUTILUS_PREFERENCES_ITEM_ENUM); + + + nautilus_preferences_group_add (NAUTILUS_PREFERENCES_GROUP (group), item); + + gtk_widget_show (item); + + nautilus_prefs_pane_add_group (NAUTILUS_PREFS_PANE (pane), group); + + gtk_widget_show (group); + + return group; +} + +#if 0 +static void +user_level_changed_cb (GtkWidget *group, gpointer call_data, gpointer client_data) +{ + NautilusPrefsGroupRadioSignalData *data = (NautilusPrefsGroupRadioSignalData *) call_data; + + g_assert (data != NULL); + + // Do something +} +#endif + +static void +prefs_global_register_static_prefs (NautilusPrefs *prefs) +{ + guint i; + + g_assert (prefs != NULL); + + /* Register the static prefs */ + for (i = 0; i < NAUTILUS_N_ELEMENTS (prefs_global_static_pref_info); i++) + { + nautilus_prefs_register_from_info (prefs, &prefs_global_static_pref_info[i]); + } +} + +static void +prefs_global_register_dynamic_prefs (NautilusPrefs *prefs) +{ + g_assert (prefs != NULL); + + /* + * Presummably, the following would be registered + * only if the component was present. Once we + * have smarter activation, that will be case. + * + * For now turn onall the ones we know off. + */ + + nautilus_prefs_register_from_values (prefs, + "/nautilus/prefs/metaviews::ntl_history_view", + "History View", + GTK_TYPE_BOOL, + FALSE, + NULL); + + nautilus_prefs_register_from_values (prefs, + "/nautilus/prefs/metaviews::ntl_websearch_view", + "Web Search View", + GTK_TYPE_BOOL, + FALSE, + NULL); + + nautilus_prefs_register_from_values (prefs, + "/nautilus/prefs/metaviews::ntl_notes_view", + "Annotations", + GTK_TYPE_BOOL, + FALSE, + NULL); + + nautilus_prefs_register_from_values (prefs, + "/nautilus/prefs/metaviews::hyperbola_navigation_tree", + "Help Contents", + GTK_TYPE_BOOL, + FALSE, + NULL); + + nautilus_prefs_register_from_values (prefs, + "/nautilus/prefs/metaviews::hyperbola_navigation_index", + "Help Index", + GTK_TYPE_BOOL, + FALSE, + NULL); + + nautilus_prefs_register_from_values (prefs, + "/nautilus/prefs/metaviews::hyperbola_navigation_search", + "Help Search", + GTK_TYPE_BOOL, + FALSE, + NULL); +} + +static GtkWidget * +prefs_global_get_prefs_dialog (void) +{ + static GtkWidget * global_prefs_dialog = NULL; + + NautilusPrefs * global_prefs = nautilus_prefs_global_get_prefs (); + + if (!global_prefs) + { + g_warning ("something went terribly wrong wrt implicit prefs initialization\n"); + + return NULL; + } + + if (!global_prefs_dialog) + { + global_prefs_dialog = prefs_global_create_dialog (); + } + + return global_prefs_dialog; +} + +/* + * Public functions + */ +NautilusPrefs * +nautilus_prefs_global_get_prefs (void) +{ + static GtkObject * global_prefs = NULL; + + if (!global_prefs) + { + global_prefs = nautilus_prefs_new (PREFS_GLOBAL_NAMESPACE); + + prefs_global_register_static_prefs (NAUTILUS_PREFS (global_prefs)); + prefs_global_register_dynamic_prefs (NAUTILUS_PREFS (global_prefs)); + } + + return NAUTILUS_PREFS (global_prefs); +} + +void +nautilus_prefs_global_show_dialog (void) +{ + GtkWidget * global_prefs_dialog = prefs_global_get_prefs_dialog (); + + nautilus_prefs_set_enum (nautilus_prefs_global_get_prefs (), + NAUTILUS_PREFS_USER_LEVEL, + NAUTILUS_USER_LEVEL_ETTORE); + + gtk_widget_show (global_prefs_dialog); +} + +void +nautilus_prefs_global_shutdown (void) +{ + GtkWidget * global_prefs_dialog; + GtkObject * global_prefs; + + global_prefs_dialog = prefs_global_get_prefs_dialog (); + + global_prefs = GTK_OBJECT (nautilus_prefs_global_get_prefs ()); + + gtk_widget_unref (global_prefs_dialog); + + gtk_object_unref (global_prefs); +} diff --git a/src/nautilus-global-preferences.h b/src/nautilus-global-preferences.h new file mode 100644 index 000000000..c3a1efde6 --- /dev/null +++ b/src/nautilus-global-preferences.h @@ -0,0 +1,53 @@ +/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ + +/* nautilus-global-prefs.h - Nautilus main preferences api. + + 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_PREFS_GLOBAL_H +#define NAUTILUS_PREFS_GLOBAL_H + +#include <gnome.h> +#include <nautilus-widgets/nautilus-preferences.h> + +BEGIN_GNOME_DECLS + +#define NAUTILUS_PREFS_WINDOW_ALWAYS_NEW "/nautilus/prefs/window_always_new" +#define NAUTILUS_PREFS_WINDOW_SEARCH_EXISTING "/nautilus/prefs/window_search_existing" +#define NAUTILUS_PREFS_USER_LEVEL "/nautilus/prefs/user_level" + +enum +{ + NAUTILUS_USER_LEVEL_NOVICE, + NAUTILUS_USER_LEVEL_INTERMEDIATE, + NAUTILUS_USER_LEVEL_HACKER, + NAUTILUS_USER_LEVEL_ETTORE +}; + +void nautilus_prefs_global_shutdown (void); +void nautilus_prefs_global_show_dialog (void); +NautilusPrefs *nautilus_prefs_global_get_prefs (void); + +BEGIN_GNOME_DECLS + +#endif /* NAUTILUS_PREFS_GLOBAL_H */ + + diff --git a/src/nautilus-navigation-window-menus.c b/src/nautilus-navigation-window-menus.c index 87b217ec1..97b33e32c 100644 --- a/src/nautilus-navigation-window-menus.c +++ b/src/nautilus-navigation-window-menus.c @@ -29,6 +29,7 @@ #include "ntl-app.h" #include "ntl-prefs.h" #include "ntl-window-private.h" +#include "nautilus-global-preferences.h" #include <libnautilus/nautilus-gtk-extensions.h> #include <libnautilus/nautilus-icon-factory.h> @@ -104,7 +105,9 @@ static void general_settings_cb (GtkWidget *widget, GtkWindow *mainwin) { - nautilus_prefs_ui_show(mainwin); +/* nautilus_prefs_ui_show (mainwin); */ + + nautilus_prefs_global_show_dialog (); } static GnomeUIInfo file_menu_info[] = { diff --git a/src/nautilus-prefs-box.c b/src/nautilus-prefs-box.c deleted file mode 100644 index 48a7a323b..000000000 --- a/src/nautilus-prefs-box.c +++ /dev/null @@ -1,380 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ - -/* nautilus-prefs-box.h - Implementation for preferences box component. - - 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 "nautilus-prefs-box.h" -#include <libnautilus/nautilus-gtk-macros.h> - -#include <gtk/gtkclist.h> - -// #include <gtk/gtkmain.h> - -#include <libgnomeui/gnome-stock.h> -#include <gtk/gtkmain.h> -#include <gtk/gtksignal.h> - -enum -{ - ACTIVATE, - LAST_SIGNAL -}; - -static const guint PREFS_BOX_NUM_CATEGORY_COLUMNS = 1; -static const guint PREFS_BOX_CATEGORY_COLUMN = 0; -static const guint PREFS_BOX_SPACING = 4; -static const guint PREFS_SELECTED_PANE_UNKNOWN = -1; -static const guint PREFS_BOX_PANE_LEFT_OFFSET = 10; - -typedef struct -{ - gchar *pane_name; - GtkWidget *pane_widget; - gboolean constructed; -} PaneInfo; - -struct _NautilusPrefsBoxPrivate -{ - GtkWidget *category_list; - GtkWidget *pane_container; - - GList *panes; - - gint selected_pane; -}; - -typedef void (*GnomeBoxSignal1) (GtkObject* object, - gint arg1, - gpointer data); - -/* NautilusPrefsBoxClass methods */ -static void nautilus_prefs_box_initialize_class (NautilusPrefsBoxClass *klass); -static void nautilus_prefs_box_initialize (NautilusPrefsBox *prefs_box); - - - -/* GtkObjectClass methods */ -static void nautilus_prefs_box_destroy (GtkObject *object); - - - -/* Misc private stuff */ -static void prefs_box_construct (NautilusPrefsBox *prefs_box); -static void prefs_box_select_pane (NautilusPrefsBox *prefs_box, - guint pane_row); - - - - -/* PaneInfo functions */ -static PaneInfo *pane_info_alloc (const gchar *pane_name); -static void pane_info_free (PaneInfo *info); - - - - -/* Category list callbacks */ -static void category_list_select_row (GtkCList *clist, - gint row, - gint column, - GdkEventButton *event, - gpointer user_data); - -NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusPrefsBox, nautilus_prefs_box, GTK_TYPE_HBOX) - -/* - * NautilusPrefsBoxClass methods - */ -static void -nautilus_prefs_box_initialize_class (NautilusPrefsBoxClass *prefs_box_class) -{ - GtkObjectClass *object_class; - GtkWidgetClass *widget_class; - - object_class = GTK_OBJECT_CLASS (prefs_box_class); - widget_class = GTK_WIDGET_CLASS (prefs_box_class); - - parent_class = gtk_type_class (gtk_hbox_get_type ()); - - /* GtkObjectClass */ - object_class->destroy = nautilus_prefs_box_destroy; -} - -static void -nautilus_prefs_box_initialize (NautilusPrefsBox *prefs_box) -{ - prefs_box->priv = g_new (NautilusPrefsBoxPrivate, 1); - - prefs_box->priv->category_list = NULL; - prefs_box->priv->pane_container = NULL; - prefs_box->priv->panes = NULL; - - prefs_box->priv->selected_pane = PREFS_SELECTED_PANE_UNKNOWN; -} - -/* - * GtkObjectClass methods - */ -static void -nautilus_prefs_box_destroy (GtkObject *object) -{ - NautilusPrefsBox * prefs_box; - - g_return_if_fail (object != NULL); - g_return_if_fail (NAUTILUS_IS_PREFS_BOX (object)); - - prefs_box = NAUTILUS_PREFS_BOX (object); - - if (prefs_box->priv->panes) - { - GList *panes; - - panes = prefs_box->priv->panes; - - while (panes) - { - PaneInfo * info = panes->data; - - g_assert (info != NULL); - - pane_info_free (info); - - panes = panes->next; - } - - g_list_free (prefs_box->priv->panes); - } - - g_free (prefs_box->priv); - - /* Chain */ - if (GTK_OBJECT_CLASS (parent_class)->destroy != NULL) - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - -/* - * Misc private stuff - */ -static void -prefs_box_construct (NautilusPrefsBox *prefs_box) -{ - g_assert (prefs_box != NULL); - g_assert (prefs_box->priv != NULL); - - g_assert (prefs_box->priv->category_list == NULL); - g_assert (prefs_box->priv->panes == NULL); - - /* Configure ourselves */ - gtk_box_set_homogeneous (GTK_BOX (prefs_box), FALSE); - - gtk_box_set_spacing (GTK_BOX (prefs_box), PREFS_BOX_SPACING); - - /* The category list */ - prefs_box->priv->category_list = - gtk_clist_new (PREFS_BOX_NUM_CATEGORY_COLUMNS); - - gtk_signal_connect (GTK_OBJECT (prefs_box->priv->category_list), - "select_row", - GTK_SIGNAL_FUNC (category_list_select_row), - (gpointer) prefs_box); - - gtk_clist_set_selection_mode (GTK_CLIST (prefs_box->priv->category_list), - GTK_SELECTION_BROWSE); - - gtk_clist_set_column_auto_resize (GTK_CLIST (prefs_box->priv->category_list), - PREFS_BOX_CATEGORY_COLUMN, - TRUE); - - gtk_box_pack_start (GTK_BOX (prefs_box), - prefs_box->priv->category_list, - FALSE, - TRUE, - 0); - - gtk_widget_show (prefs_box->priv->category_list); -} - -static void -prefs_box_select_pane (NautilusPrefsBox *prefs_box, - guint pane_row) -{ - GList *pane_node; - PaneInfo *pane_info; - GList *pane_iterator; - - g_assert (prefs_box != NULL); - g_assert (NAUTILUS_IS_PREFS_BOX (prefs_box)); - g_assert (prefs_box->priv != NULL); - g_assert (prefs_box->priv->panes != NULL); - - g_assert (pane_row < g_list_length (prefs_box->priv->panes)); - - pane_node = g_list_nth (prefs_box->priv->panes, pane_row); - - g_assert (pane_node != NULL); - - pane_info = pane_node->data; - - /* Show only the corresponding pane widget */ - pane_iterator = prefs_box->priv->panes; - - while (pane_iterator) - { - PaneInfo * info = pane_iterator->data; - - g_assert (info != NULL); - - if (pane_info == info) - { - /* Construct pane for first time if needed */ - if (!info->constructed) - { - - info->constructed = TRUE; - } - -// printf("showing %s\n", info->pane_name); - - gtk_widget_show (info->pane_widget); - } - else - { -// printf("hidding %s\n", info->pane_name); - - gtk_widget_hide (info->pane_widget); - } - - pane_iterator = pane_iterator->next; - } -} - -/* - * PaneInfo functions - */ -static PaneInfo * -pane_info_alloc (const gchar *pane_name) -{ - PaneInfo * info; - - g_assert (pane_name != NULL); - - info = g_new (PaneInfo, 1); - - info->pane_name = g_strdup (pane_name); - - return info; -} - -static void -pane_info_free (PaneInfo *info) -{ - g_assert (info != NULL); - - g_free (info->pane_name); - - g_free (info); -} - -/* - * Category list callbacks - */ -static void -category_list_select_row (GtkCList *clist, - gint row, - gint column, - GdkEventButton *event, - gpointer user_data) -{ - NautilusPrefsBox *prefs_box = (NautilusPrefsBox *) user_data; - - g_assert (prefs_box != NULL); - g_assert (NAUTILUS_IS_PREFS_BOX (prefs_box)); - -// printf("selected (%d,%d)\n", column, row); - - prefs_box_select_pane (prefs_box, (guint) row); - -#if 0 - const NautilusBookmark *selected; - - g_assert(GTK_IS_ENTRY(name_field)); - g_assert(GTK_IS_ENTRY(uri_field)); - - selected = get_selected_bookmark(); - gtk_entry_set_text(GTK_ENTRY(name_field), - nautilus_bookmark_get_name(selected)); - gtk_entry_set_text(GTK_ENTRY(uri_field), - nautilus_bookmark_get_uri(selected)); -#endif -} - -/* - * NautilusPrefsBox public methods - */ -GtkWidget* -nautilus_prefs_box_new (const gchar *box_title) -{ - NautilusPrefsBox *prefs_box; - - prefs_box = gtk_type_new (nautilus_prefs_box_get_type ()); - - prefs_box_construct (prefs_box); - - return GTK_WIDGET (prefs_box); -} - -GtkWidget * -nautilus_prefs_box_add_pane (NautilusPrefsBox *prefs_box, - const gchar *pane_title, - const gchar *pane_description) -{ - PaneInfo *info; - gint new_row; - gchar *text[PREFS_BOX_NUM_CATEGORY_COLUMNS]; - - g_return_val_if_fail (prefs_box != NULL, NULL); - g_return_val_if_fail (NAUTILUS_IS_PREFS_BOX (prefs_box), NULL); - g_return_val_if_fail (pane_title != NULL, NULL); - g_return_val_if_fail (pane_description != NULL, NULL); - - info = pane_info_alloc (pane_title); - - prefs_box->priv->panes = g_list_append (prefs_box->priv->panes, - (gpointer) info); - - info->pane_widget = nautilus_prefs_pane_new (pane_title, - pane_description); - - gtk_box_pack_start (GTK_BOX (prefs_box), - info->pane_widget, - TRUE, - TRUE, - PREFS_BOX_PANE_LEFT_OFFSET); - - text[PREFS_BOX_CATEGORY_COLUMN] = (gchar *) pane_title; - - new_row = gtk_clist_append (GTK_CLIST (prefs_box->priv->category_list), - text); - - return info->pane_widget; -} diff --git a/src/nautilus-prefs-box.h b/src/nautilus-prefs-box.h deleted file mode 100644 index 354221886..000000000 --- a/src/nautilus-prefs-box.h +++ /dev/null @@ -1,73 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ - -/* nautilus-prefs-box.h - Interface for preferences box component. - - 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_PREFS_BOX_H -#define NAUTILUS_PREFS_BOX_H - -#include <libgnomeui/gnome-dialog.h> -#include <gtk/gtkhbox.h> -#include "nautilus-prefs-pane.h" - -//#include <gnome.h> - -BEGIN_GNOME_DECLS - -#define NAUTILUS_TYPE_PREFS_BOX (nautilus_prefs_box_get_type ()) -#define NAUTILUS_PREFS_BOX(obj) (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_PREFS_BOX, NautilusPrefsBox)) -#define NAUTILUS_PREFS_BOX_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_PREFS_BOX, NautilusPrefsBoxClass)) -#define NAUTILUS_IS_PREFS_BOX(obj) (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_PREFS_BOX)) -#define NAUTILUS_IS_PREFS_BOX_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_PREFS_BOX)) - -typedef struct _NautilusPrefsBox NautilusPrefsBox; -typedef struct _NautilusPrefsBoxClass NautilusPrefsBoxClass; -typedef struct _NautilusPrefsBoxPrivate NautilusPrefsBoxPrivate; - -struct _NautilusPrefsBox -{ - /* Super Class */ - GtkHBox hbox; - - /* Private stuff */ - NautilusPrefsBoxPrivate *priv; -}; - -struct _NautilusPrefsBoxClass -{ - GtkHBoxClass parent_class; - - void (*activate) (GtkWidget * prefs_box, gint entry_number); -}; - -GtkType nautilus_prefs_box_get_type (void); -GtkWidget* nautilus_prefs_box_new (const gchar *box_title); - -GtkWidget* nautilus_prefs_box_add_pane (NautilusPrefsBox *prefs_box, - const gchar *pane_title, - const gchar *pane_description); - -BEGIN_GNOME_DECLS - -#endif /* NAUTILUS_PREFS_BOX_H */ - - diff --git a/src/nautilus-prefs-dialog.c b/src/nautilus-prefs-dialog.c deleted file mode 100644 index 9a2cf8a48..000000000 --- a/src/nautilus-prefs-dialog.c +++ /dev/null @@ -1,281 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ - -/* nautilus-prefs-dialog.c - Implementation for preferences dialog. - - 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 "nautilus-prefs-dialog.h" -#include <libnautilus/nautilus-gtk-macros.h> - -/* #include "caption-table.h" */ - -#include <libgnomeui/gnome-stock.h> -#include <gtk/gtkmain.h> -#include <gtk/gtksignal.h> - -#include <gnome.h> - -enum -{ - ACTIVATE, - LAST_SIGNAL -}; - -struct _NautilusPrefsDialogPrivate -{ - GtkWidget *prefs_box; -}; - -static const gchar * stock_buttons[] = -{ - GNOME_STOCK_BUTTON_OK, - GNOME_STOCK_BUTTON_CANCEL, - NULL -}; - -static const gint UNKNOWN_BUTTON = -1; -static const gint OK_BUTTON = 0; -static const gint DEFAULT_BUTTON = 0; -static const guint DEFAULT_BORDER_WIDTH = 0; - -enum -{ - COMMAND_ROW = 0, - USERNAME_ROW, - PASSWORD_ROW -}; - -typedef void (*GnomeDialogSignal1) (GtkObject* object, - gint arg1, - gpointer data); - -/* NautilusPrefsDialogClass methods */ -static void nautilus_prefs_dialog_initialize_class (NautilusPrefsDialogClass *klass); -static void nautilus_prefs_dialog_initialize (NautilusPrefsDialog *prefs_dialog); - -/* GtkObjectClass methods */ -static void nautilus_prefs_dialog_destroy (GtkObject *object); -static void dialog_clicked (GtkWidget *widget, - gint n, - gpointer data); -static void dialog_show (GtkWidget *widget, - gpointer data); -static void dialog_destroy (GtkWidget *widget, - gpointer data); - -/* Misc private stuff */ -static void nautilus_prefs_dialog_construct (NautilusPrefsDialog *prefs_dialog, - const gchar *dialog_title); - - -NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusPrefsDialog, - nautilus_prefs_dialog, - gnome_dialog_get_type ()) - -/* - * NautilusPrefsDialogClass methods - */ -static void -nautilus_prefs_dialog_initialize_class (NautilusPrefsDialogClass * klass) -{ - GtkObjectClass * object_class; - GtkWidgetClass * widget_class; - - object_class = GTK_OBJECT_CLASS(klass); - widget_class = GTK_WIDGET_CLASS(klass); - - parent_class = gtk_type_class(gnome_dialog_get_type()); - - /* GtkObjectClass */ - object_class->destroy = nautilus_prefs_dialog_destroy; -} - -static void -nautilus_prefs_dialog_initialize (NautilusPrefsDialog * prefs_dialog) -{ - prefs_dialog->priv = g_new (NautilusPrefsDialogPrivate, 1); - - prefs_dialog->priv->prefs_box = NULL; -} - -static void -dialog_clicked(GtkWidget * widget, gint n, gpointer data) -{ - NautilusPrefsDialog * prefs_dialog = (NautilusPrefsDialog *) data; - - g_assert(prefs_dialog); - -// gtk_grab_remove(GTK_WIDGET(prefs_dialog)); - - gtk_widget_hide(GTK_WIDGET(prefs_dialog)); -} - -static void -dialog_show(GtkWidget * widget, gpointer data) -{ - NautilusPrefsDialog * prefs_dialog = (NautilusPrefsDialog *) data; - - g_assert(prefs_dialog); - -// gtk_caption_table_entry_grab_focus(GTK_CAPTION_TABLE(prefs_dialog->priv->table), -// PASSWORD_ROW); -} - -static void -dialog_destroy(GtkWidget * widget, gpointer data) -{ - NautilusPrefsDialog * prefs_dialog = (NautilusPrefsDialog *) data; - - g_assert(prefs_dialog); - -// gtk_grab_remove(GTK_WIDGET(prefs_dialog)); - -// gtk_widget_destroy (widget); -} - -static void -nautilus_prefs_dialog_construct (NautilusPrefsDialog *prefs_dialog, - const gchar *dialog_title) -{ - GnomeDialog *gnome_dialog; - - g_assert (prefs_dialog != NULL); - g_assert (prefs_dialog->priv != NULL); - - g_assert (prefs_dialog->priv->prefs_box == NULL); - - gnome_dialog = GNOME_DIALOG (prefs_dialog); - - gnome_dialog_constructv (gnome_dialog, dialog_title, stock_buttons); - - /* Setup the dialog */ - gtk_window_set_policy (GTK_WINDOW (prefs_dialog), - FALSE, /* allow_shrink */ - TRUE, /* allow_grow */ - FALSE); /* auto_shrink */ - - gtk_widget_set_usize (GTK_WIDGET (prefs_dialog), 600, 400); - - /* Doesnt work in enlightenment or sawmill */ -#if 0 - /* This is supposed to setup the window manager functions */ - gdk_window_set_functions (GTK_WIDGET (prefs_dialog)->window, GDK_FUNC_MOVE | GDK_FUNC_RESIZE); -#endif - -// gdk_window_set_decorations (GTK_WINDOW(prefs_dialog), GDK_DECOR_ALL); - - gtk_window_set_position (GTK_WINDOW (prefs_dialog), GTK_WIN_POS_CENTER); - - gtk_container_set_border_width (GTK_CONTAINER(prefs_dialog), - DEFAULT_BORDER_WIDTH); - - gnome_dialog_set_default (GNOME_DIALOG(prefs_dialog), - DEFAULT_BUTTON); - - gtk_signal_connect (GTK_OBJECT (prefs_dialog), - "clicked", - GTK_SIGNAL_FUNC (dialog_clicked), - (gpointer) prefs_dialog); - - gtk_signal_connect (GTK_OBJECT (prefs_dialog), - "show", - GTK_SIGNAL_FUNC(dialog_show), - (gpointer) prefs_dialog); - - gtk_signal_connect (GTK_OBJECT (prefs_dialog), - "destroy", - GTK_SIGNAL_FUNC (dialog_destroy), - (gpointer) prefs_dialog); - - /* Configure the GNOME_DIALOG's vbox */ - g_assert (gnome_dialog->vbox); - - prefs_dialog->priv->prefs_box = nautilus_prefs_box_new (_("Prefs Box")); - - gtk_box_set_spacing (GTK_BOX (gnome_dialog->vbox), 10); - - gtk_box_pack_start (GTK_BOX (gnome_dialog->vbox), - prefs_dialog->priv->prefs_box, - TRUE, /* expand */ - TRUE, /* fill */ - 0); /* padding */ - - gtk_widget_show (prefs_dialog->priv->prefs_box); -} - -GtkWidget* -nautilus_prefs_dialog_new (const gchar *dialog_title) -{ - NautilusPrefsDialog *prefs_dialog; - - prefs_dialog = gtk_type_new (nautilus_prefs_dialog_get_type ()); - - nautilus_prefs_dialog_construct (prefs_dialog, dialog_title); - - return GTK_WIDGET (prefs_dialog); -} - -/* GtkObjectClass methods */ -static void -nautilus_prefs_dialog_destroy(GtkObject* object) -{ - NautilusPrefsDialog * prefs_dialog; - - g_return_if_fail (object != NULL); - g_return_if_fail (NAUTILUS_IS_PREFS_DIALOG (object)); - - prefs_dialog = NAUTILUS_PREFS_DIALOG(object); - - g_free (prefs_dialog->priv); - - /* Chain */ - if (GTK_OBJECT_CLASS (parent_class)->destroy != NULL) - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - -gboolean -nautilus_prefs_dialog_run_and_block(NautilusPrefsDialog* prefs_dialog) -{ -// g_return_val_if_fail(prefs_dialog, FALSE); - -// prefs_dialog->priv->last_button_clicked = UNKNOWN_BUTTON; - -// gtk_widget_show_all(GTK_WIDGET(prefs_dialog)); - -// gtk_grab_add(GTK_WIDGET(prefs_dialog)); - -// while (prefs_dialog->priv->last_button_clicked == UNKNOWN_BUTTON) -// gtk_main_iteration(); - -// if (prefs_dialog->priv->last_button_clicked == OK_BUTTON) -// return TRUE; - - return FALSE; -} - -GtkWidget* -nautilus_prefs_dialog_get_prefs_box (NautilusPrefsDialog *prefs_dialog) -{ - g_return_val_if_fail (prefs_dialog != NULL, NULL); - g_return_val_if_fail (NAUTILUS_IS_PREFS_DIALOG (prefs_dialog), NULL); - - return prefs_dialog->priv->prefs_box; -} diff --git a/src/nautilus-prefs-dialog.h b/src/nautilus-prefs-dialog.h deleted file mode 100644 index 4dbbea092..000000000 --- a/src/nautilus-prefs-dialog.h +++ /dev/null @@ -1,71 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ - -/* nautilus-prefs-dialog.h - Interface for preferences dialog. - - 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_PREFS_DIALOG_H -#define NAUTILUS_PREFS_DIALOG_H - -#include <libgnomeui/gnome-dialog.h> -#include "nautilus-prefs-box.h" - -//#include <gnome.h> - -BEGIN_GNOME_DECLS - -#define NAUTILUS_TYPE_PREFS_DIALOG (nautilus_prefs_dialog_get_type ()) -#define NAUTILUS_PREFS_DIALOG(obj) (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_PREFS_DIALOG, NautilusPrefsDialog)) -#define NAUTILUS_PREFS_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_PREFS_DIALOG, NautilusPrefsDialogClass)) -#define NAUTILUS_IS_PREFS_DIALOG(obj) (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_PREFS_DIALOG)) -#define NAUTILUS_IS_PREFS_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_PREFS_DIALOG)) - - -typedef struct _NautilusPrefsDialog NautilusPrefsDialog; -typedef struct _NautilusPrefsDialogClass NautilusPrefsDialogClass; -typedef struct _NautilusPrefsDialogPrivate NautilusPrefsDialogPrivate; - -struct _NautilusPrefsDialog -{ - /* Super Class */ - GnomeDialog gnome_dialog; - - /* Private stuff */ - NautilusPrefsDialogPrivate *priv; -}; - -struct _NautilusPrefsDialogClass -{ - GnomeDialogClass parent_class; - - void (*activate) (GtkWidget * prefs_dialog, gint entry_number); -}; - -GtkType nautilus_prefs_dialog_get_type (void); -GtkWidget* nautilus_prefs_dialog_new (const gchar *dialog_title); -gboolean nautilus_prefs_dialog_run_and_block (NautilusPrefsDialog *prefs_dialog); -GtkWidget* nautilus_prefs_dialog_get_prefs_box (NautilusPrefsDialog *prefs_dialog); - -BEGIN_GNOME_DECLS - -#endif /* NAUTILUS_PREFS_DIALOG_H */ - - diff --git a/src/nautilus-prefs-group-check.c b/src/nautilus-prefs-group-check.c deleted file mode 100644 index d8916739d..000000000 --- a/src/nautilus-prefs-group-check.c +++ /dev/null @@ -1,275 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ - -/* nautilus-prefs-group-check.c - Check button prefs group implementation. - - 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 "nautilus-prefs-group-check.h" - -#include <gnome.h> -#include <gtk/gtkcheckbutton.h> -#include <gtk/gtksignal.h> -#include <libnautilus/nautilus-gtk-macros.h> - -enum -{ - ACTIVATE, - LAST_SIGNAL -}; - -typedef struct -{ - GtkWidget *check_button; -} ButtonInfo; - -struct _NautilusPrefsGroupCheckPrivate -{ - GList *button_list; -}; - -/* NautilusPrefsGroupCheckClass methods */ -static void nautilus_prefs_group_check_initialize_class (NautilusPrefsGroupCheckClass *klass); -static void nautilus_prefs_group_check_initialize (NautilusPrefsGroupCheck *prefs_group_check); - - -/* GtkObjectClass methods */ -static void nautilus_prefs_group_check_destroy (GtkObject *object); - - -/* Misc private stuff */ -static void prefs_group_check_construct (NautilusPrefsGroup *prefs_group, - const gchar *group_title); -static void prefs_group_check_free_button_list (NautilusPrefsGroupCheck *prefs_group_check); - -/* ButtonInfo functions */ -static ButtonInfo *button_info_alloc (GtkWidget * check_button); -static void button_info_free (ButtonInfo *info); -static void button_info_free_func (gpointer data, - gpointer user_data); - - -NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusPrefsGroupCheck, - nautilus_prefs_group_check, - NAUTILUS_TYPE_PREFS_GROUP) - -/* - * NautilusPrefsGroupCheckClass methods - */ -static void -nautilus_prefs_group_check_initialize_class (NautilusPrefsGroupCheckClass *prefs_group_check_class) -{ - GtkObjectClass *object_class; - GtkWidgetClass *widget_class; - NautilusPrefsGroupClass *prefs_group_class; - - object_class = GTK_OBJECT_CLASS (prefs_group_check_class); - widget_class = GTK_WIDGET_CLASS (prefs_group_check_class); - - prefs_group_class = NAUTILUS_PREFS_GROUP_CLASS (prefs_group_check_class); - - parent_class = gtk_type_class (nautilus_prefs_group_get_type ()); - - /* GtkObjectClass */ - object_class->destroy = nautilus_prefs_group_check_destroy; - - /* NautilusPrefsGroupClass */ - prefs_group_class->construct = prefs_group_check_construct; -} - -static void -nautilus_prefs_group_check_initialize (NautilusPrefsGroupCheck *prefs_group_check) -{ - prefs_group_check->priv = g_new (NautilusPrefsGroupCheckPrivate, 1); - - prefs_group_check->priv->button_list = NULL; -} - -/* - * GtkObjectClass methods - */ -static void -nautilus_prefs_group_check_destroy(GtkObject* object) -{ - NautilusPrefsGroupCheck * prefs_group_check; - - g_return_if_fail (object != NULL); - g_return_if_fail (NAUTILUS_IS_PREFS_GROUP_CHECK (object)); - - prefs_group_check = NAUTILUS_PREFS_GROUP_CHECK (object); - - prefs_group_check_free_button_list (prefs_group_check); - - g_free (prefs_group_check->priv); - - /* Chain */ - if (GTK_OBJECT_CLASS (parent_class)->destroy != NULL) - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - -/* - * Misc private stuff - */ -static void -prefs_group_check_construct (NautilusPrefsGroup *prefs_group, - const gchar *group_title) -{ - NautilusPrefsGroupCheck *prefs_group_check; - - g_return_if_fail (prefs_group != NULL); - g_return_if_fail (NAUTILUS_IS_PREFS_GROUP_CHECK (prefs_group)); - - prefs_group_check = NAUTILUS_PREFS_GROUP_CHECK (prefs_group); - - /* Construct the superclass part */ - g_assert (NAUTILUS_PREFS_GROUP_CLASS (parent_class)->construct ); - - (* NAUTILUS_PREFS_GROUP_CLASS (parent_class)->construct) (prefs_group, - group_title); -} - -/* - * ButtonInfo functions - */ -static ButtonInfo * -button_info_alloc (GtkWidget * check_button) -{ - ButtonInfo * info; - - g_assert (check_button != NULL); - - info = g_new (ButtonInfo, 1); - - info->check_button = check_button; - - return info; -} - -static void -button_info_free (ButtonInfo *info) -{ - g_assert (info != NULL); - - g_free (info); -} - -static void -button_info_free_func (gpointer data, - gpointer user_data) -{ - ButtonInfo *info = (ButtonInfo *) data; - - g_assert (info != NULL); - - g_assert (info->check_button != NULL); - - gtk_widget_destroy (info->check_button); - - button_info_free (info); -} - -static void -prefs_group_check_free_button_list (NautilusPrefsGroupCheck *prefs_group_check) -{ - g_assert (prefs_group_check != NULL); - g_assert (prefs_group_check->priv != NULL); - - if (prefs_group_check->priv->button_list) - { - g_list_foreach (prefs_group_check->priv->button_list, - button_info_free_func, - NULL); - - g_list_free (prefs_group_check->priv->button_list); - } - - prefs_group_check->priv->button_list = NULL; -} - -/* - * NautilusPrefsGroupCheck public methods - */ -GtkWidget* -nautilus_prefs_group_check_new (const gchar *group_title) -{ -// return nautilus_prefs_group_new (group_title); - NautilusPrefsGroupCheck *prefs_group_check; - NautilusPrefsGroup *prefs_group; - - g_return_val_if_fail (group_title != NULL, NULL); - - - prefs_group_check = gtk_type_new (nautilus_prefs_group_check_get_type ()); - - prefs_group = NAUTILUS_PREFS_GROUP (prefs_group_check); - -// prefs_group_check_construct (prefs_group_check, group_title); - - NAUTILUS_PREFS_GROUP_ASSERT_METHOD (prefs_group_check, construct); - - NAUTILUS_PREFS_GROUP_INVOKE_METHOD (prefs_group_check, construct) (prefs_group, - group_title); - return GTK_WIDGET (prefs_group_check); -} - -void -nautilus_prefs_group_check_clear (NautilusPrefsGroupCheck *prefs_group_check) -{ -} - -void -nautilus_prefs_group_check_insert (NautilusPrefsGroupCheck *prefs_group_check, - const gchar *label, - gboolean active) -{ - ButtonInfo *info; - GtkWidget *check_button; - GtkWidget *content_box; - - g_return_if_fail (prefs_group_check != NULL); - g_return_if_fail (NAUTILUS_IS_PREFS_GROUP_CHECK (prefs_group_check)); - g_return_if_fail (label != NULL); - - content_box = - nautilus_prefs_group_get_content_box (NAUTILUS_PREFS_GROUP (prefs_group_check)); - - g_assert (content_box != NULL); - - check_button = gtk_check_button_new_with_label (label); - - gtk_object_set (GTK_OBJECT (check_button), - "active", - (gpointer) (gint)active, - NULL); - - gtk_box_pack_start (GTK_BOX (content_box), - check_button, - TRUE, - TRUE, - 0); - - info = button_info_alloc (check_button); - - gtk_widget_show (check_button); - - prefs_group_check->priv->button_list = - g_list_append (prefs_group_check->priv->button_list, - (gpointer) info); -} diff --git a/src/nautilus-prefs-group-check.h b/src/nautilus-prefs-group-check.h deleted file mode 100644 index 5286f52b4..000000000 --- a/src/nautilus-prefs-group-check.h +++ /dev/null @@ -1,69 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ - -/* nautilus-prefs-group-check.h - Check button prefs group interface. - - 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_PREFS_GROUP_CHECK_H -#define NAUTILUS_PREFS_GROUP_CHECK_H - -#include "nautilus-prefs-group.h" - -BEGIN_GNOME_DECLS - -#define NAUTILUS_TYPE_PREFS_GROUP_CHECK (nautilus_prefs_group_check_get_type ()) -#define NAUTILUS_PREFS_GROUP_CHECK(obj) (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_PREFS_GROUP_CHECK, NautilusPrefsGroupCheck)) -#define NAUTILUS_PREFS_GROUP_CHECK_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_PREFS_GROUP_CHECK, NautilusPrefsGroupCheckClass)) -#define NAUTILUS_IS_PREFS_GROUP_CHECK(obj) (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_PREFS_GROUP_CHECK)) -#define NAUTILUS_IS_PREFS_GROUP_CHECK_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_PREFS_GROUP_CHECK)) -#define NAUTILUS_PREFS_GROUP_CHECK_INVOKE_METHOD_IF(group, method) \ -NAUTILUS_INVOKE_METHOD_IF (group, NAUTILUS_TYPE_PREFS_GROUP_CHECK, NautilusPrefsGroupCheckClass, method) - -typedef struct _NautilusPrefsGroupCheck NautilusPrefsGroupCheck; -typedef struct _NautilusPrefsGroupCheckClass NautilusPrefsGroupCheckClass; -typedef struct _NautilusPrefsGroupCheckPrivate NautilusPrefsGroupCheckPrivate; - -struct _NautilusPrefsGroupCheck -{ - /* Super Class */ - NautilusPrefsGroup prefs_group; - - /* Private stuff */ - NautilusPrefsGroupCheckPrivate *priv; -}; - -struct _NautilusPrefsGroupCheckClass -{ - NautilusPrefsGroupClass parent_class; -}; - -GtkType nautilus_prefs_group_check_get_type (void); -GtkWidget* nautilus_prefs_group_check_new (const gchar *group_title); -void nautilus_prefs_group_check_clear (NautilusPrefsGroupCheck *prefs_group_check); -void nautilus_prefs_group_check_insert (NautilusPrefsGroupCheck *prefs_group_check, - const gchar *label, - gboolean active); - -BEGIN_GNOME_DECLS - -#endif /* NAUTILUS_PREFS_GROUP_CHECK_H */ - - diff --git a/src/nautilus-prefs-group-radio.c b/src/nautilus-prefs-group-radio.c deleted file mode 100644 index cd4a2f59b..000000000 --- a/src/nautilus-prefs-group-radio.c +++ /dev/null @@ -1,454 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ - -/* nautilus-prefs-group-radio.c - Radio button prefs group implementation. - - 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 "nautilus-prefs-group-radio.h" - -#include <gnome.h> -#include <gtk/gtkradiobutton.h> -#include <gtk/gtksignal.h> -#include <libnautilus/nautilus-gtk-macros.h> - -/* Signals */ -typedef enum -{ - CHANGED, - LAST_SIGNAL -} RadioGroupSignals; - -typedef struct -{ - GtkWidget *radio_button; -} ButtonInfo; - -struct _NautilusPrefsGroupRadioPrivate -{ - GList *button_list; - GSList *button_group; - guint active_button; -}; - -static const gint PREFS_GROUP_RADIO_NOT_FOUND = -1; - -/* NautilusPrefsGroupRadioClass methods */ -static void nautilus_prefs_group_radio_initialize_class (NautilusPrefsGroupRadioClass *klass); -static void nautilus_prefs_group_radio_initialize (NautilusPrefsGroupRadio *prefs_group_radio); - - -/* GtkObjectClass methods */ -static void nautilus_prefs_group_radio_destroy (GtkObject *object); - - -/* NautilusPrefsGroupClass methods */ -static void prefs_group_radio_construct (NautilusPrefsGroup *prefs_group, - const gchar *group_title); - -/* Private stuff */ -static void prefs_group_radio_construct (NautilusPrefsGroup *prefs_group, - const gchar *group_title); -static void prefs_group_radio_free_button_list (NautilusPrefsGroupRadio *prefs_group_radio); -static void prefs_group_radio_emit_changed_signal (NautilusPrefsGroupRadio *prefs_group_radio, - GtkWidget *button); - -static gint prefs_group_radio_index_of_button (NautilusPrefsGroupRadio *prefs_group_radio, - GtkWidget *button); - - -/* ButtonInfo functions */ -static ButtonInfo *button_info_alloc (GtkWidget *radio_button); -static void button_info_free (ButtonInfo *info); -static void button_info_free_func (gpointer data, - gpointer user_data); -static void button_info_set_active_func (gpointer data, - gpointer user_data); - - - -/* Radio button callbacks */ -static void radio_button_toggled (GtkWidget *button, - gpointer user_data); - - -NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusPrefsGroupRadio, - nautilus_prefs_group_radio, - NAUTILUS_TYPE_PREFS_GROUP) - -static guint radio_group_signals[LAST_SIGNAL] = { 0 }; - -/* - * NautilusPrefsGroupRadioClass methods - */ -static void -nautilus_prefs_group_radio_initialize_class (NautilusPrefsGroupRadioClass *prefs_group_radio_class) -{ - GtkObjectClass *object_class; - GtkWidgetClass *widget_class; - NautilusPrefsGroupClass *prefs_group_class; - - object_class = GTK_OBJECT_CLASS (prefs_group_radio_class); - widget_class = GTK_WIDGET_CLASS (prefs_group_radio_class); - - prefs_group_class = NAUTILUS_PREFS_GROUP_CLASS (prefs_group_radio_class); - - parent_class = gtk_type_class (nautilus_prefs_group_get_type ()); - - /* GtkObjectClass */ - object_class->destroy = nautilus_prefs_group_radio_destroy; - - /* Signals */ - radio_group_signals[CHANGED] = - gtk_signal_new ("changed", - GTK_RUN_LAST, - object_class->type, - 0,//GTK_SIGNAL_OFFSET (NautilusPrefGroupRadioClass, changed), - gtk_marshal_NONE__POINTER, - GTK_TYPE_NONE, - 1, - GTK_TYPE_POINTER); - - gtk_object_class_add_signals (object_class, radio_group_signals, LAST_SIGNAL); - - /* NautilusPrefsGroupClass */ - prefs_group_class->construct = prefs_group_radio_construct; -} - -static void -nautilus_prefs_group_radio_initialize (NautilusPrefsGroupRadio *prefs_group_radio) -{ - prefs_group_radio->priv = g_new (NautilusPrefsGroupRadioPrivate, 1); - - prefs_group_radio->priv->button_list = NULL; - prefs_group_radio->priv->button_group = NULL; - prefs_group_radio->priv->active_button = 0; -} - -/* - * GtkObjectClass methods - */ -static void -nautilus_prefs_group_radio_destroy(GtkObject* object) -{ - NautilusPrefsGroupRadio * prefs_group_radio; - - g_return_if_fail (object != NULL); - g_return_if_fail (NAUTILUS_IS_PREFS_GROUP_RADIO (object)); - - prefs_group_radio = NAUTILUS_PREFS_GROUP_RADIO (object); - - prefs_group_radio_free_button_list (prefs_group_radio); - - g_free (prefs_group_radio->priv); - - /* Chain */ - if (GTK_OBJECT_CLASS (parent_class)->destroy != NULL) - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - -/* - * NautilusPrefsGroupClass methods - */ -static void -prefs_group_radio_construct (NautilusPrefsGroup *prefs_group, - const gchar *group_title) -{ - NautilusPrefsGroupRadio *prefs_group_radio; - - g_return_if_fail (prefs_group != NULL); - g_return_if_fail (NAUTILUS_IS_PREFS_GROUP_RADIO (prefs_group)); - - prefs_group_radio = NAUTILUS_PREFS_GROUP_RADIO (prefs_group); - - /* Construct the superclass part */ - g_assert (NAUTILUS_PREFS_GROUP_CLASS (parent_class)->construct ); - - (* NAUTILUS_PREFS_GROUP_CLASS (parent_class)->construct) (prefs_group, - group_title); -} - -/* - * ButtonInfo functions - */ -static ButtonInfo * -button_info_alloc (GtkWidget * radio_button) -{ - ButtonInfo * info; - - g_assert (radio_button != NULL); - - info = g_new (ButtonInfo, 1); - - info->radio_button = radio_button; - - return info; -} - -static void -button_info_free (ButtonInfo *info) -{ - g_assert (info != NULL); - - g_free (info); -} - -static void -button_info_free_func (gpointer data, - gpointer user_data) -{ - ButtonInfo *info = (ButtonInfo *) data; - - g_assert (info != NULL); - - g_assert (info->radio_button != NULL); - - gtk_widget_destroy (info->radio_button); - - button_info_free (info); -} - -static void -button_info_set_active_func (gpointer data, - gpointer user_data) -{ - ButtonInfo *info = (ButtonInfo *) data; - GtkWidget *active_button = (GtkWidget *) user_data; - - g_assert (info != NULL); - g_assert (active_button != NULL); - - g_assert (info->radio_button != NULL); - - if (info->radio_button == active_button) - { - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (info->radio_button), TRUE); - } -} - -/* - * Private stuff - */ -static void -prefs_group_radio_emit_changed_signal (NautilusPrefsGroupRadio *prefs_group_radio, - GtkWidget *button) -{ - gint index; - - NautilusPrefsGroupRadioSignalData signal_data; - - g_assert (prefs_group_radio != NULL); - g_assert (prefs_group_radio->priv != NULL); - g_assert (button != NULL); - - index = prefs_group_radio_index_of_button (prefs_group_radio, button); - - g_assert (index != PREFS_GROUP_RADIO_NOT_FOUND); - - signal_data.active_button_index = (guint) index; - - gtk_signal_emit (GTK_OBJECT (prefs_group_radio), - radio_group_signals[CHANGED], - (gpointer) &signal_data); -} - -static gint -prefs_group_radio_index_of_button (NautilusPrefsGroupRadio *prefs_group_radio, - GtkWidget *button) -{ - GList *button_iterator; - gint i = 0; - - g_assert (prefs_group_radio != NULL); - g_assert (button != NULL); - - button_iterator = prefs_group_radio->priv->button_list; - - while (button_iterator) - { - ButtonInfo * info = button_iterator->data; - - g_assert (info != NULL); - - if (info->radio_button == button) - { - return i; - } - - button_iterator = button_iterator->next; - - i++; - } - - return PREFS_GROUP_RADIO_NOT_FOUND; -} - -static void -prefs_group_radio_free_button_list (NautilusPrefsGroupRadio *prefs_group_radio) -{ - g_assert (prefs_group_radio != NULL); - g_assert (prefs_group_radio->priv != NULL); - - if (prefs_group_radio->priv->button_list) - { - g_list_foreach (prefs_group_radio->priv->button_list, - button_info_free_func, - NULL); - - g_list_free (prefs_group_radio->priv->button_list); - } - - prefs_group_radio->priv->button_list = NULL; - prefs_group_radio->priv->button_group = NULL; - prefs_group_radio->priv->active_button = 0; -} - -/* - * Radio button callbacks - */ -static void -radio_button_toggled (GtkWidget *button, gpointer user_data) -{ - NautilusPrefsGroupRadio *prefs_group_radio = (NautilusPrefsGroupRadio *) user_data; - - g_assert (prefs_group_radio != NULL); - g_assert (prefs_group_radio->priv != NULL); - - if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button))) - { - prefs_group_radio_emit_changed_signal (prefs_group_radio, button); - } -} - -/* - * NautilusPrefsGroupRadio public methods - */ -GtkWidget* -nautilus_prefs_group_radio_new (const gchar *group_title) -{ -// return nautilus_prefs_group_new (group_title); - NautilusPrefsGroupRadio *prefs_group_radio; - NautilusPrefsGroup *prefs_group; - - g_return_val_if_fail (group_title != NULL, NULL); - - - prefs_group_radio = gtk_type_new (nautilus_prefs_group_radio_get_type ()); - - prefs_group = NAUTILUS_PREFS_GROUP (prefs_group_radio); - -// prefs_group_radio_construct (prefs_group_radio, group_title); - - NAUTILUS_PREFS_GROUP_ASSERT_METHOD (prefs_group_radio, construct); - - NAUTILUS_PREFS_GROUP_INVOKE_METHOD (prefs_group_radio, construct) (prefs_group, - group_title); - return GTK_WIDGET (prefs_group_radio); -} - -void -nautilus_prefs_group_radio_clear (NautilusPrefsGroupRadio *prefs_group_radio) -{ -} - -void -nautilus_prefs_group_radio_insert (NautilusPrefsGroupRadio *prefs_group_radio, - const gchar *label, - gboolean active) -{ - ButtonInfo *info; - GtkWidget *radio_button; - GtkWidget *content_box; - - g_return_if_fail (prefs_group_radio != NULL); - g_return_if_fail (NAUTILUS_IS_PREFS_GROUP_RADIO (prefs_group_radio)); - g_return_if_fail (label != NULL); - - content_box = - nautilus_prefs_group_get_content_box (NAUTILUS_PREFS_GROUP (prefs_group_radio)); - - g_assert (content_box != NULL); - - printf("label = %s, group = %p\n",label,prefs_group_radio->priv->button_group); - - radio_button = gtk_radio_button_new_with_label (prefs_group_radio->priv->button_group, - label); - - /* - * For some crazy reason I dont grok, the group has to be fetched each - * time from the previous button - */ - prefs_group_radio->priv->button_group = - gtk_radio_button_group (GTK_RADIO_BUTTON (radio_button)); - - gtk_signal_connect (GTK_OBJECT (radio_button), - "toggled", - GTK_SIGNAL_FUNC (radio_button_toggled), - (gpointer) prefs_group_radio); - - gtk_box_pack_start (GTK_BOX (content_box), - radio_button, - TRUE, - TRUE, - 0); - - info = button_info_alloc (radio_button); - - gtk_widget_show (radio_button); - - prefs_group_radio->priv->button_list = - g_list_append (prefs_group_radio->priv->button_list, - (gpointer) info); -} - -void -nautilus_prefs_group_radio_set_active_button (NautilusPrefsGroupRadio *prefs_group_radio, - guint button_index) -{ - GList *button_node; - ButtonInfo *button_info; - - g_return_if_fail (prefs_group_radio != NULL); - g_return_if_fail (NAUTILUS_IS_PREFS_GROUP_RADIO (prefs_group_radio)); - g_return_if_fail (button_index < g_list_length (prefs_group_radio->priv->button_list)); - - prefs_group_radio->priv->active_button = button_index; - - button_node = g_list_nth (prefs_group_radio->priv->button_list, button_index); - - g_assert (button_node); - - button_info = (ButtonInfo *) button_node->data; - - g_assert (button_info); - - g_list_foreach (prefs_group_radio->priv->button_list, - button_info_set_active_func, - (gpointer) button_info->radio_button); -} - -guint -nautilus_prefs_group_radio_get_active_button (NautilusPrefsGroupRadio *prefs_group_radio) -{ - g_return_val_if_fail (prefs_group_radio != NULL, 0); - g_return_val_if_fail (NAUTILUS_IS_PREFS_GROUP_RADIO (prefs_group_radio), 0); - - return prefs_group_radio->priv->active_button; -} diff --git a/src/nautilus-prefs-group-radio.h b/src/nautilus-prefs-group-radio.h deleted file mode 100644 index 951e8d0aa..000000000 --- a/src/nautilus-prefs-group-radio.h +++ /dev/null @@ -1,77 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ - -/* nautilus-prefs-group-check.h - Check button prefs group interface. - - 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_PREFS_GROUP_RADIO_H -#define NAUTILUS_PREFS_GROUP_RADIO_H - -#include "nautilus-prefs-group.h" - -BEGIN_GNOME_DECLS - -#define NAUTILUS_TYPE_PREFS_GROUP_RADIO (nautilus_prefs_group_radio_get_type ()) -#define NAUTILUS_PREFS_GROUP_RADIO(obj) (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_PREFS_GROUP_RADIO, NautilusPrefsGroupRadio)) -#define NAUTILUS_PREFS_GROUP_RADIO_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_PREFS_GROUP_RADIO, NautilusPrefsGroupRadioClass)) -#define NAUTILUS_IS_PREFS_GROUP_RADIO(obj) (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_PREFS_GROUP_RADIO)) -#define NAUTILUS_IS_PREFS_GROUP_RADIO_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_PREFS_GROUP_RADIO)) -#define NAUTILUS_PREFS_GROUP_RADIO_INVOKE_METHOD_IF(group, method) \ -NAUTILUS_INVOKE_METHOD_IF (group, NAUTILUS_TYPE_PREFS_GROUP_RADIO, NautilusPrefsGroupRadioClass, method) - -typedef struct _NautilusPrefsGroupRadio NautilusPrefsGroupRadio; -typedef struct _NautilusPrefsGroupRadioClass NautilusPrefsGroupRadioClass; -typedef struct _NautilusPrefsGroupRadioPrivate NautilusPrefsGroupRadioPrivate; - -struct _NautilusPrefsGroupRadio -{ - /* Super Class */ - NautilusPrefsGroup prefs_group; - - /* Private stuff */ - NautilusPrefsGroupRadioPrivate *priv; -}; - -struct _NautilusPrefsGroupRadioClass -{ - NautilusPrefsGroupClass parent_class; -}; - -typedef struct -{ - guint active_button_index; -} NautilusPrefsGroupRadioSignalData; - -GtkType nautilus_prefs_group_radio_get_type (void); -GtkWidget* nautilus_prefs_group_radio_new (const gchar *group_title); -void nautilus_prefs_group_radio_clear (NautilusPrefsGroupRadio *prefs_group_radio); -void nautilus_prefs_group_radio_insert (NautilusPrefsGroupRadio *prefs_group_radio, - const gchar *label, - gboolean active); -void nautilus_prefs_group_radio_set_active_button (NautilusPrefsGroupRadio *prefs_group_radio, - guint button_index); -guint nautilus_prefs_group_radio_get_active_button (NautilusPrefsGroupRadio *prefs_group_radio); - -BEGIN_GNOME_DECLS - -#endif /* NAUTILUS_PREFS_GROUP_RADIO_H */ - - diff --git a/src/nautilus-prefs-group.c b/src/nautilus-prefs-group.c deleted file mode 100644 index 49e061bfd..000000000 --- a/src/nautilus-prefs-group.c +++ /dev/null @@ -1,202 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ - -/* nautilus-prefs-group.c - Interface for a prefs group superclass. - - 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 "nautilus-prefs-group.h" -#include <libnautilus/nautilus-gtk-macros.h> - -#include <gtk/gtklabel.h> -#include <gtk/gtkframe.h> -#include <gtk/gtkhbox.h> -#include <gtk/gtkvbox.h> - -// #include <gtk/gtkmain.h> -#include <gnome.h> - -#include <libgnomeui/gnome-stock.h> -#include <gtk/gtkmain.h> -#include <gtk/gtksignal.h> - -enum -{ - ACTIVATE, - LAST_SIGNAL -}; - -static const guint PREFS_GROUP_TITLE_SPACING = 4; -static const guint PREFS_GROUP_FRAME_BORDER_WIDTH = 6; - -struct _NautilusPrefsGroupPrivate -{ - gchar *title_label_string; - GtkWidget *content_box; - gboolean is_constructed; -}; - -typedef void (*GnomeBoxSignal1) (GtkObject* object, - gint arg1, - gpointer data); - -/* NautilusPrefsGroupClass methods */ -static void nautilus_prefs_group_initialize_class (NautilusPrefsGroupClass *klass); -static void nautilus_prefs_group_initialize (NautilusPrefsGroup *prefs_group); - -/* GtkObjectClass methods */ -static void nautilus_prefs_group_destroy (GtkObject *object); - -/* Misc private stuff */ -static void prefs_group_construct (NautilusPrefsGroup *prefs_group, - const gchar *group_title); - -NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusPrefsGroup, nautilus_prefs_group, GTK_TYPE_FRAME) - -/* - * NautilusPrefsGroupClass methods - */ -static void -nautilus_prefs_group_initialize_class (NautilusPrefsGroupClass *prefs_group_class) -{ - GtkObjectClass *object_class; - GtkWidgetClass *widget_class; - - object_class = GTK_OBJECT_CLASS (prefs_group_class); - widget_class = GTK_WIDGET_CLASS (prefs_group_class); - - parent_class = gtk_type_class (gtk_frame_get_type ()); - - /* GtkObjectClass */ - object_class->destroy = nautilus_prefs_group_destroy; - - /* NautilusPrefsGroupClass */ - prefs_group_class->construct = prefs_group_construct; - prefs_group_class->changed = NULL; -} - -static void -nautilus_prefs_group_initialize (NautilusPrefsGroup *prefs_group) -{ - prefs_group->priv = g_new (NautilusPrefsGroupPrivate, 1); - - prefs_group->priv->title_label_string = NULL; - prefs_group->priv->content_box = NULL; - prefs_group->priv->is_constructed = FALSE; -} - -/* - * GtkObjectClass methods - */ -static void -nautilus_prefs_group_destroy (GtkObject *object) -{ - NautilusPrefsGroup * prefs_group; - - g_return_if_fail (object != NULL); - g_return_if_fail (NAUTILUS_IS_PREFS_GROUP (object)); - - prefs_group = NAUTILUS_PREFS_GROUP (object); - - g_free (prefs_group->priv); - - /* Chain */ - if (GTK_OBJECT_CLASS (parent_class)->destroy != NULL) - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - -/* - * Misc private stuff - */ -static void -prefs_group_construct (NautilusPrefsGroup *prefs_group, - const gchar *group_title) -{ - g_assert (prefs_group != NULL); - g_assert (prefs_group->priv != NULL); - - g_assert (group_title != NULL); - - g_assert (prefs_group->priv->content_box == NULL); - - /* Ourselves */ - gtk_frame_set_shadow_type (GTK_FRAME (prefs_group), - GTK_SHADOW_ETCHED_IN); - - nautilus_prefs_group_set_title (prefs_group, group_title); - - /* Main box */ - prefs_group->priv->content_box = - gtk_vbox_new (FALSE, PREFS_GROUP_TITLE_SPACING); - - gtk_container_add (GTK_CONTAINER (prefs_group), - prefs_group->priv->content_box); - - gtk_container_set_border_width (GTK_CONTAINER (prefs_group->priv->content_box), - PREFS_GROUP_FRAME_BORDER_WIDTH); - - gtk_widget_show (prefs_group->priv->content_box); - -#if 0 - NAUTILUS_PREFS_GROUP_ASSERT_METHOD (prefs_group, construct); - - NAUTILUS_PREFS_GROUP_INVOKE_METHOD (prefs_group, construct) (prefs_group, - prefs_group->priv->content_box); -#endif -} - -/* - * NautilusPrefsGroup public methods - */ -// GtkWidget* -// nautilus_prefs_group_new (const gchar *group_title) -// { -// NautilusPrefsGroup *prefs_group; - -// g_return_val_if_fail (group_title != NULL, NULL); - -// prefs_group = gtk_type_new (nautilus_prefs_group_get_type ()); - -// prefs_group_construct (prefs_group, group_title); - -// return GTK_WIDGET (prefs_group); -// } - -void -nautilus_prefs_group_set_title (NautilusPrefsGroup *prefs_group, - const gchar *group_title) -{ - g_return_if_fail (prefs_group != NULL); - g_return_if_fail (NAUTILUS_IS_PREFS_GROUP (prefs_group)); - g_return_if_fail (GTK_IS_FRAME (prefs_group)); - g_return_if_fail (group_title != NULL); - - gtk_frame_set_label (GTK_FRAME (prefs_group), group_title); -} - -GtkWidget* -nautilus_prefs_group_get_content_box (NautilusPrefsGroup *prefs_group) -{ - g_return_val_if_fail (prefs_group != NULL, NULL); - g_return_val_if_fail (NAUTILUS_IS_PREFS_GROUP (prefs_group), NULL); - - return prefs_group->priv->content_box; -} - diff --git a/src/nautilus-prefs-group.h b/src/nautilus-prefs-group.h deleted file mode 100644 index 4054819f0..000000000 --- a/src/nautilus-prefs-group.h +++ /dev/null @@ -1,77 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ - -/* nautilus-prefs-group.h - Interface for a prefs group superclass. - - 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_PREFS_GROUP_H -#define NAUTILUS_PREFS_GROUP_H - -#include <libgnomeui/gnome-dialog.h> -#include <gtk/gtkframe.h> - -//#include <gnome.h> - -BEGIN_GNOME_DECLS - -#define NAUTILUS_TYPE_PREFS_GROUP (nautilus_prefs_group_get_type ()) -#define NAUTILUS_PREFS_GROUP(obj) (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_PREFS_GROUP, NautilusPrefsGroup)) -#define NAUTILUS_PREFS_GROUP_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_PREFS_GROUP, NautilusPrefsGroupClass)) -#define NAUTILUS_IS_PREFS_GROUP(obj) (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_PREFS_GROUP)) -#define NAUTILUS_IS_PREFS_GROUP_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_PREFS_GROUP)) -#define NAUTILUS_PREFS_GROUP_ASSERT_METHOD(group, method) \ -NAUTILUS_ASSERT_METHOD (group, NAUTILUS_TYPE_PREFS_GROUP, NautilusPrefsGroupClass, method) -#define NAUTILUS_PREFS_GROUP_INVOKE_METHOD(group, method) \ -NAUTILUS_INVOKE_METHOD (group, NAUTILUS_TYPE_PREFS_GROUP, NautilusPrefsGroupClass, method) - -typedef struct _NautilusPrefsGroup NautilusPrefsGroup; -typedef struct _NautilusPrefsGroupClass NautilusPrefsGroupClass; -typedef struct _NautilusPrefsGroupPrivate NautilusPrefsGroupPrivate; - -struct _NautilusPrefsGroup -{ - /* Super Class */ - GtkFrame frame; - - /* Private stuff */ - NautilusPrefsGroupPrivate *priv; -}; - -struct _NautilusPrefsGroupClass -{ - GtkFrameClass parent_class; - - void (*construct) (NautilusPrefsGroup *prefs_group, const gchar *group_title); - - void (*changed) (NautilusPrefsGroup *prefs_group); -}; - -GtkType nautilus_prefs_group_get_type (void); -// GtkWidget* nautilus_prefs_group_new (const gchar *group_title); -void nautilus_prefs_group_set_title (NautilusPrefsGroup *prefs_group, - const gchar *group_title); -GtkWidget* nautilus_prefs_group_get_content_box (NautilusPrefsGroup *prefs_group); - -BEGIN_GNOME_DECLS - -#endif /* NAUTILUS_PREFS_GROUP_H */ - - diff --git a/src/nautilus-prefs-pane.c b/src/nautilus-prefs-pane.c deleted file mode 100644 index 27be532b4..000000000 --- a/src/nautilus-prefs-pane.c +++ /dev/null @@ -1,281 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ - -/* nautilus-prefs-pane.h - Interface for a prefs pane superclass. - - 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 "nautilus-prefs-pane.h" -#include <libnautilus/nautilus-gtk-macros.h> - -#include <gtk/gtklabel.h> -#include <gtk/gtkframe.h> -#include <gtk/gtkhbox.h> - -// #include <gtk/gtkmain.h> -#include <gnome.h> - -#include <libgnomeui/gnome-stock.h> -#include <gtk/gtkmain.h> -#include <gtk/gtksignal.h> - -enum -{ - ACTIVATE, - LAST_SIGNAL -}; - -static const guint PREFS_PANE_TITLE_SPACING = 100; -static const guint PREFS_PANE_GROUPS_BOX_TOP_OFFSET = 10; - -struct _NautilusPrefsPanePrivate -{ - GtkWidget *title_box; - GtkWidget *title_frame; - GtkWidget *title_label; - GtkWidget *description_label; - - GtkWidget *groups_box; - - GSList *groups; -}; - -typedef void (*GnomeBoxSignal1) (GtkObject* object, - gint arg1, - gpointer data); - -/* NautilusPrefsPaneClass methods */ -static void nautilus_prefs_pane_initialize_class (NautilusPrefsPaneClass *klass); -static void nautilus_prefs_pane_initialize (NautilusPrefsPane *prefs_pane); - -/* GtkObjectClass methods */ -static void nautilus_prefs_pane_destroy (GtkObject *object); - -/* Private stuff */ -static void prefs_pane_construct (NautilusPrefsPane *prefs_pane, - const gchar *pane_title, - const gchar *pane_description); - -NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusPrefsPane, nautilus_prefs_pane, GTK_TYPE_VBOX) - -/* - * NautilusPrefsPaneClass methods - */ -static void -nautilus_prefs_pane_initialize_class (NautilusPrefsPaneClass *prefs_pane_class) -{ - GtkObjectClass *object_class; - GtkWidgetClass *widget_class; - - object_class = GTK_OBJECT_CLASS (prefs_pane_class); - widget_class = GTK_WIDGET_CLASS (prefs_pane_class); - - parent_class = gtk_type_class (gtk_vbox_get_type ()); - - /* GtkObjectClass */ - object_class->destroy = nautilus_prefs_pane_destroy; -} - -static void -nautilus_prefs_pane_initialize (NautilusPrefsPane *prefs_pane) -{ - prefs_pane->priv = g_new (NautilusPrefsPanePrivate, 1); - - prefs_pane->priv->title_label = NULL; - prefs_pane->priv->description_label = NULL; - prefs_pane->priv->title_box = NULL; - prefs_pane->priv->title_frame = NULL; - prefs_pane->priv->groups_box = NULL; - - prefs_pane->priv->groups = NULL; -} - -/* - * GtkObjectClass methods - */ -static void -nautilus_prefs_pane_destroy(GtkObject* object) -{ - NautilusPrefsPane * prefs_pane; - - g_return_if_fail (object != NULL); - g_return_if_fail (NAUTILUS_IS_PREFS_PANE (object)); - - prefs_pane = NAUTILUS_PREFS_PANE (object); - - if (prefs_pane->priv->groups) - { - g_slist_free (prefs_pane->priv->groups); - } - - g_free (prefs_pane->priv); - - /* Chain */ - if (GTK_OBJECT_CLASS (parent_class)->destroy != NULL) - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - -/* - * Private stuff - */ -static void -prefs_pane_construct (NautilusPrefsPane *prefs_pane, - const gchar *pane_title, - const gchar *pane_description) -{ - g_assert (prefs_pane != NULL); - g_assert (prefs_pane->priv != NULL); - - g_assert (pane_title != NULL); - g_assert (pane_description != NULL); - - g_assert (prefs_pane->priv->title_label == NULL); - g_assert (prefs_pane->priv->description_label == NULL); - g_assert (prefs_pane->priv->title_box == NULL); - g_assert (prefs_pane->priv->groups_box == NULL); - g_assert (prefs_pane->priv->title_frame == NULL); - g_assert (prefs_pane->priv->groups == NULL); - - prefs_pane->priv->groups = g_slist_alloc (); - - /* Title frame */ - prefs_pane->priv->title_frame = gtk_frame_new (NULL); - - gtk_frame_set_shadow_type (GTK_FRAME (prefs_pane->priv->title_frame), - GTK_SHADOW_ETCHED_IN); - - /* Title box */ - prefs_pane->priv->title_box = - gtk_hbox_new (FALSE, PREFS_PANE_TITLE_SPACING); - - /* Title labels */ - prefs_pane->priv->title_label = gtk_label_new (pane_title); - prefs_pane->priv->description_label = gtk_label_new (pane_description); - - gtk_box_pack_start (GTK_BOX (prefs_pane->priv->title_box), - prefs_pane->priv->title_label, - FALSE, - FALSE, - 0); - - gtk_box_pack_end (GTK_BOX (prefs_pane->priv->title_box), - prefs_pane->priv->description_label, - FALSE, - FALSE, - 0); - - gtk_widget_show (prefs_pane->priv->title_label); - gtk_widget_show (prefs_pane->priv->description_label); - - /* Add title box to title frame */ - gtk_container_add (GTK_CONTAINER (prefs_pane->priv->title_frame), - prefs_pane->priv->title_box); - - gtk_widget_show (prefs_pane->priv->title_box); - - /* Add title frame to ourselves */ - gtk_box_pack_start (GTK_BOX (prefs_pane), - prefs_pane->priv->title_frame, - FALSE, - FALSE, - 0); - - gtk_widget_show (prefs_pane->priv->title_frame); - - /* Groups box */ - prefs_pane->priv->groups_box = - gtk_vbox_new (TRUE, PREFS_PANE_TITLE_SPACING); - - /* Add groups box to ourselves */ - gtk_box_pack_start (GTK_BOX (prefs_pane), - prefs_pane->priv->groups_box, - FALSE, - FALSE, - PREFS_PANE_GROUPS_BOX_TOP_OFFSET); - - gtk_widget_show (prefs_pane->priv->groups_box); -} - - -/* - * NautilusPrefsPane public methods - */ -GtkWidget* -nautilus_prefs_pane_new (const gchar *pane_title, - const gchar *pane_description) -{ - NautilusPrefsPane *prefs_pane; - - g_return_val_if_fail (pane_title != NULL, NULL); - g_return_val_if_fail (pane_description != NULL, NULL); - - prefs_pane = gtk_type_new (nautilus_prefs_pane_get_type ()); - - prefs_pane_construct (prefs_pane, pane_title, pane_description); - - return GTK_WIDGET (prefs_pane); -} - -void -nautilus_prefs_pane_set_title (NautilusPrefsPane *prefs_pane, - const gchar *pane_title) -{ - g_return_if_fail (prefs_pane != NULL); - g_return_if_fail (NAUTILUS_IS_PREFS_PANE (prefs_pane)); - - g_assert (prefs_pane->priv->title_label != NULL); - - gtk_label_set_text (GTK_LABEL (prefs_pane->priv->title_label), - pane_title); -} - -void -nautilus_prefs_pane_set_description (NautilusPrefsPane *prefs_pane, - const gchar *pane_description) -{ - g_return_if_fail (prefs_pane != NULL); - g_return_if_fail (NAUTILUS_IS_PREFS_PANE (prefs_pane)); - - g_assert (prefs_pane->priv->description_label != NULL); - - gtk_label_set_text (GTK_LABEL (prefs_pane->priv->description_label), - pane_description); -} - -void -nautilus_prefs_pane_add_group (NautilusPrefsPane *prefs_pane, - GtkWidget *prefs_group) -{ - g_return_if_fail (prefs_pane != NULL); - g_return_if_fail (NAUTILUS_IS_PREFS_PANE (prefs_pane)); - g_return_if_fail (prefs_group != NULL); - -// group = nautilus_prefs_group_new (group_title); - - gtk_box_pack_start (GTK_BOX (prefs_pane->priv->groups_box), - prefs_group, - TRUE, - TRUE, - 0); - -// gtk_widget_show (prefs_group); -} - diff --git a/src/nautilus-prefs-pane.h b/src/nautilus-prefs-pane.h deleted file mode 100644 index 45f1c9bc5..000000000 --- a/src/nautilus-prefs-pane.h +++ /dev/null @@ -1,74 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ - -/* nautilus-prefs-pane.h - Interface for a prefs pane superclass. - - 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_PREFS_PANE_H -#define NAUTILUS_PREFS_PANE_H - -#include <libgnomeui/gnome-dialog.h> -#include <gtk/gtkvbox.h> -#include "nautilus-prefs-group.h" - -//#include <gnome.h> - -BEGIN_GNOME_DECLS - -#define NAUTILUS_TYPE_PREFS_PANE (nautilus_prefs_pane_get_type ()) -#define NAUTILUS_PREFS_PANE(obj) (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_PREFS_PANE, NautilusPrefsPane)) -#define NAUTILUS_PREFS_PANE_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_PREFS_PANE, NautilusPrefsPaneClass)) -#define NAUTILUS_IS_PREFS_PANE(obj) (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_PREFS_PANE)) -#define NAUTILUS_IS_PREFS_PANE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_PREFS_PANE)) - -typedef struct _NautilusPrefsPane NautilusPrefsPane; -typedef struct _NautilusPrefsPaneClass NautilusPrefsPaneClass; -typedef struct _NautilusPrefsPanePrivate NautilusPrefsPanePrivate; - -struct _NautilusPrefsPane -{ - /* Super Class */ - GtkVBox vbox; - - /* Private stuff */ - NautilusPrefsPanePrivate *priv; -}; - -struct _NautilusPrefsPaneClass -{ - GtkVBoxClass parent_class; - - void (*construct) (NautilusPrefsPane *prefs_pane, GtkWidget *box); -}; - -GtkType nautilus_prefs_pane_get_type (void); -GtkWidget* nautilus_prefs_pane_new (const gchar *pane_title, - const gchar *pane_description); -void nautilus_prefs_pane_set_title (NautilusPrefsPane * prefs_pane, - const gchar *pane_title); -void nautilus_prefs_pane_set_description (NautilusPrefsPane * prefs_pane, - const gchar *pane_description); -void nautilus_prefs_pane_add_group (NautilusPrefsPane *prefs_pane, - GtkWidget *prefs_group); - -BEGIN_GNOME_DECLS - -#endif /* NAUTILUS_PREFS_PANE_H */ diff --git a/src/nautilus-window-menus.c b/src/nautilus-window-menus.c index 87b217ec1..97b33e32c 100644 --- a/src/nautilus-window-menus.c +++ b/src/nautilus-window-menus.c @@ -29,6 +29,7 @@ #include "ntl-app.h" #include "ntl-prefs.h" #include "ntl-window-private.h" +#include "nautilus-global-preferences.h" #include <libnautilus/nautilus-gtk-extensions.h> #include <libnautilus/nautilus-icon-factory.h> @@ -104,7 +105,9 @@ static void general_settings_cb (GtkWidget *widget, GtkWindow *mainwin) { - nautilus_prefs_ui_show(mainwin); +/* nautilus_prefs_ui_show (mainwin); */ + + nautilus_prefs_global_show_dialog (); } static GnomeUIInfo file_menu_info[] = { diff --git a/src/nautilus-window-state.c b/src/nautilus-window-state.c index 410a13950..ea9450bfc 100644 --- a/src/nautilus-window-state.c +++ b/src/nautilus-window-state.c @@ -1,4 +1,4 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ /* * Nautilus @@ -25,21 +25,49 @@ */ #include "nautilus.h" +#include "nautilus-global-preferences.h" void -nautilus_window_set_initial_state(NautilusWindow *window, const char *initial_url) +nautilus_window_set_initial_state (NautilusWindow *window, const char *initial_url) { - if(initial_url) - nautilus_window_goto_uri(window, initial_url); - else - { - GString* path_name; + if (initial_url) + { + nautilus_window_goto_uri (window, initial_url); + } + else + { + GString *path_name; + gint user_level; - path_name = g_string_new("file://"); - g_string_append(path_name, g_get_home_dir()); - nautilus_window_goto_uri(window, path_name->str); - g_string_free(path_name, TRUE); - } + path_name = g_string_new ("file://"); + + user_level = nautilus_prefs_get_enum (nautilus_prefs_global_get_prefs (), + NAUTILUS_PREFS_USER_LEVEL); + +#define ANDY_WILL_FIX_THIS_IN_A_BIT 1 + + +#if ANDY_WILL_FIX_THIS_IN_A_BIT + switch (user_level) + { + case NAUTILUS_USER_LEVEL_NOVICE: + case NAUTILUS_USER_LEVEL_INTERMEDIATE: + g_string_append (path_name, "/tmp"); + break; + + case NAUTILUS_USER_LEVEL_HACKER: + case NAUTILUS_USER_LEVEL_ETTORE: + g_string_append (path_name, g_get_home_dir ()); + break; + } +#else + g_string_append (path_name, g_get_home_dir ()); +#endif + + nautilus_window_goto_uri (window, path_name->str); + + g_string_free (path_name, TRUE); + } } void diff --git a/src/ntl-prefs.c b/src/ntl-prefs.c index 6d4baea08..c87191cf7 100644 --- a/src/ntl-prefs.c +++ b/src/ntl-prefs.c @@ -31,7 +31,7 @@ PrefsPageInfo pages[] = { {NULL, NULL, NULL, NULL, NULL} }; -NautilusPrefs nautilus_prefs = {0,0, NULL}; +NautilusPrefsOld nautilus_prefs = {0,0, NULL}; void nautilus_prefs_save(void) @@ -46,8 +46,8 @@ nautilus_prefs_save(void) pieces[i] = cur->data; gnome_config_set_vector("/nautilus/prefs/global_meta_views", npieces, (const char **)pieces); - gnome_config_set_bool("/nautilus/prefs/window_alwaysnew", nautilus_prefs.window_alwaysnew); - gnome_config_set_bool("/nautilus/prefs/window_search_existing", nautilus_prefs.window_search_existing); + gnome_config_set_bool("/nautilus/prefs/caca::window_alwaysnew", nautilus_prefs.window_alwaysnew); + gnome_config_set_bool("/nautilus/prefs/caca2::window_search_existing", nautilus_prefs.window_search_existing); gnome_config_sync(); } @@ -63,9 +63,9 @@ nautilus_prefs_load(void) } nautilus_prefs.window_alwaysnew = - gnome_config_get_bool("/nautilus/prefs/window_alwaysnew=0"); + gnome_config_get_bool("/nautilus/prefs/caca::window_alwaysnew=0"); nautilus_prefs.window_search_existing = - gnome_config_get_bool("/nautilus/prefs/window_search_existing=0"); + gnome_config_get_bool("/nautilus/prefs/caca2::window_search_existing=0"); { int npieces; diff --git a/src/ntl-prefs.h b/src/ntl-prefs.h index 8cad5a048..082071c79 100644 --- a/src/ntl-prefs.h +++ b/src/ntl-prefs.h @@ -8,9 +8,9 @@ typedef struct { guchar window_search_existing : 1; GSList *global_meta_views; -} NautilusPrefs; +} NautilusPrefsOld; -extern NautilusPrefs nautilus_prefs; +extern NautilusPrefsOld nautilus_prefs; void nautilus_prefs_load(void); void nautilus_prefs_save(void); diff --git a/src/ntl-window-state.c b/src/ntl-window-state.c index 410a13950..ea9450bfc 100644 --- a/src/ntl-window-state.c +++ b/src/ntl-window-state.c @@ -1,4 +1,4 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ /* * Nautilus @@ -25,21 +25,49 @@ */ #include "nautilus.h" +#include "nautilus-global-preferences.h" void -nautilus_window_set_initial_state(NautilusWindow *window, const char *initial_url) +nautilus_window_set_initial_state (NautilusWindow *window, const char *initial_url) { - if(initial_url) - nautilus_window_goto_uri(window, initial_url); - else - { - GString* path_name; + if (initial_url) + { + nautilus_window_goto_uri (window, initial_url); + } + else + { + GString *path_name; + gint user_level; - path_name = g_string_new("file://"); - g_string_append(path_name, g_get_home_dir()); - nautilus_window_goto_uri(window, path_name->str); - g_string_free(path_name, TRUE); - } + path_name = g_string_new ("file://"); + + user_level = nautilus_prefs_get_enum (nautilus_prefs_global_get_prefs (), + NAUTILUS_PREFS_USER_LEVEL); + +#define ANDY_WILL_FIX_THIS_IN_A_BIT 1 + + +#if ANDY_WILL_FIX_THIS_IN_A_BIT + switch (user_level) + { + case NAUTILUS_USER_LEVEL_NOVICE: + case NAUTILUS_USER_LEVEL_INTERMEDIATE: + g_string_append (path_name, "/tmp"); + break; + + case NAUTILUS_USER_LEVEL_HACKER: + case NAUTILUS_USER_LEVEL_ETTORE: + g_string_append (path_name, g_get_home_dir ()); + break; + } +#else + g_string_append (path_name, g_get_home_dir ()); +#endif + + nautilus_window_goto_uri (window, path_name->str); + + g_string_free (path_name, TRUE); + } } void |