Commit 00f9035c authored by Ramiro Estrugo's avatar Ramiro Estrugo

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.
parent b9488278
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,
......
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
......
/* -*- 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);
}
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* nautilus-prefs-box.h - Interface for preferences box component.
/* nautilus-global-prefs.h - Nautilus main preferences api.
Copyright (C) 1999, 2000 Eazel, Inc.
......@@ -22,52 +22,32 @@
Authors: Ramiro Estrugo <ramiro@eazel.com>
*/
#ifndef NAUTILUS_PREFS_BOX_H
#define NAUTILUS_PREFS_BOX_H
#ifndef NAUTILUS_PREFS_GLOBAL_H
#define NAUTILUS_PREFS_GLOBAL_H
#include <libgnomeui/gnome-dialog.h>
#include <gtk/gtkhbox.h>
#include "nautilus-prefs-pane.h"
//#include <gnome.h>
#include <gnome.h>
#include <nautilus-widgets/nautilus-preferences.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;
};
#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"
struct _NautilusPrefsBoxClass
enum
{
GtkHBoxClass parent_class;
void (*activate) (GtkWidget * prefs_box, gint entry_number);
NAUTILUS_USER_LEVEL_NOVICE,
NAUTILUS_USER_LEVEL_INTERMEDIATE,
NAUTILUS_USER_LEVEL_HACKER,
NAUTILUS_USER_LEVEL_ETTORE
};
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);
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_BOX_H */
#endif /* NAUTILUS_PREFS_GLOBAL_H */
......@@ -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[] = {
......
/* -*- 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);