Move the nautilus-widgets classes to libnautilus-extensions.

* Makefile.am:
* components/hardware/Makefile.am:
* components/help/Makefile.am:
* components/history/Makefile.am:
* components/html/Makefile.am:
* components/loser/content/Makefile.am:
* components/loser/sidebar/Makefile.am:
* components/music/Makefile.am:
* components/notes/Makefile.am:
* components/rpmview/Makefile.am:
* components/sample/Makefile.am:
* components/services/startup/nautilus-view/Makefile.am:
* components/services/time/nautilus-view/Makefile.am:
* components/services/trilobite/sample/nautilus-view/Makefile.am:
* components/websearch/Makefile.am:
* configure.in:
* helper-utilities/authenticate/Makefile.am:
* helper-utilities/authenticate/nautilus-authenticate.c:
* libnautilus-extensions/Makefile.am:
* libnautilus-extensions/nautilus-caption-table.c:
* libnautilus-extensions/nautilus-caption.c:
* libnautilus-extensions/nautilus-file-utilities.c:
* libnautilus-extensions/nautilus-global-preferences.c:
* libnautilus-extensions/nautilus-global-preferences.h:
* libnautilus-extensions/nautilus-lib-self-check-functions.h:
* libnautilus-extensions/nautilus-link-set.c:
* libnautilus-extensions/nautilus-link.c:
* libnautilus-extensions/nautilus-password-dialog.c:
* libnautilus-extensions/nautilus-preference.c:
(nautilus_self_check_preference):
* libnautilus-extensions/nautilus-preferences-box.c:
* libnautilus-extensions/nautilus-preferences-box.h:
* libnautilus-extensions/nautilus-preferences-dialog.c:
* libnautilus-extensions/nautilus-preferences-dialog.h:
* libnautilus-extensions/nautilus-preferences-group.c:
* libnautilus-extensions/nautilus-preferences-group.h:
* libnautilus-extensions/nautilus-preferences-item.c:
* libnautilus-extensions/nautilus-preferences-item.h:
* libnautilus-extensions/nautilus-preferences-pane.c:
* libnautilus-extensions/nautilus-preferences-pane.h:
* libnautilus-extensions/nautilus-preferences.c:
* libnautilus-extensions/nautilus-preferences.h:
* libnautilus-extensions/nautilus-radio-button-group.c:
* libnautilus-extensions/nautilus-string-picker.c:
* libnautilus-extensions/nautilus-string-picker.h:
* libnautilus-extensions/nautilus-text-caption.c:
* libnautilus-extensions/nautilus-text-caption.h:
* libnautilus-extensions/nautilus-undo-manager.c:
* libnautilus-extensions/nautilus-user-level-manager.c:
* libnautilus-extensions/nautilus-user-level-manager.h:
* libnautilus-extensions/nautilus-widgets-self-check-functions.c:
* libnautilus-extensions/nautilus-widgets-self-check-functions.h:
* libnautilus-extensions/test-nautilus-preferences.c:
* libnautilus-extensions/test-preferences.c:
* nautilus-widgets/Makefile.am:
* nautilus-widgets/nautilus-caption-table.c:
* nautilus-widgets/nautilus-caption-table.h:
* nautilus-widgets/nautilus-caption.c:
* nautilus-widgets/nautilus-caption.h:
* nautilus-widgets/nautilus-password-dialog.c:
* nautilus-widgets/nautilus-password-dialog.h:
* nautilus-widgets/nautilus-preference.c:
* nautilus-widgets/nautilus-preference.h:
* nautilus-widgets/nautilus-preferences-box.c:
* nautilus-widgets/nautilus-preferences-box.h:
* nautilus-widgets/nautilus-preferences-dialog.c:
* nautilus-widgets/nautilus-preferences-dialog.h:
* nautilus-widgets/nautilus-preferences-group.c:
* nautilus-widgets/nautilus-preferences-group.h:
* nautilus-widgets/nautilus-preferences-item.c:
* nautilus-widgets/nautilus-preferences-item.h:
* nautilus-widgets/nautilus-preferences-pane.c:
* nautilus-widgets/nautilus-preferences-pane.h:
* nautilus-widgets/nautilus-preferences.c:
* nautilus-widgets/nautilus-preferences.h:
* nautilus-widgets/nautilus-radio-button-group.c:
* nautilus-widgets/nautilus-radio-button-group.h:
* nautilus-widgets/nautilus-string-picker.c:
* nautilus-widgets/nautilus-string-picker.h:
* nautilus-widgets/nautilus-text-caption.c:
* nautilus-widgets/nautilus-text-caption.h:
* nautilus-widgets/nautilus-user-level-manager.c:
* nautilus-widgets/nautilus-user-level-manager.h:
* nautilus-widgets/nautilus-widgets-self-check-functions.c:
* nautilus-widgets/nautilus-widgets-self-check-functions.h:
* nautilus-widgets/test-nautilus-preferences.c:
* nautilus-widgets/test-nautilus-widgets.c:
* nautilus-widgets/test-preferences.c:
* src/Makefile.am:
* src/nautilus-main.c: (main):
* src/nautilus-sidebar.c:
* src/nautilus-window-menus.c:
* test/Makefile.am:
Move the nautilus-widgets classes to libnautilus-extensions.
This commit is contained in:
Ramiro Estrugo 2000-06-10 00:38:05 +00:00
parent daceb4832b
commit 2b631110b6
117 changed files with 287 additions and 8048 deletions

View file

@ -1,3 +1,100 @@
2000-06-09 Ramiro Estrugo <ramiro@eazel.com>
* Makefile.am:
* components/hardware/Makefile.am:
* components/help/Makefile.am:
* components/history/Makefile.am:
* components/html/Makefile.am:
* components/loser/content/Makefile.am:
* components/loser/sidebar/Makefile.am:
* components/music/Makefile.am:
* components/notes/Makefile.am:
* components/rpmview/Makefile.am:
* components/sample/Makefile.am:
* components/services/startup/nautilus-view/Makefile.am:
* components/services/time/nautilus-view/Makefile.am:
* components/services/trilobite/sample/nautilus-view/Makefile.am:
* components/websearch/Makefile.am:
* configure.in:
* helper-utilities/authenticate/Makefile.am:
* helper-utilities/authenticate/nautilus-authenticate.c:
* libnautilus-extensions/Makefile.am:
* libnautilus-extensions/nautilus-caption-table.c:
* libnautilus-extensions/nautilus-caption.c:
* libnautilus-extensions/nautilus-file-utilities.c:
* libnautilus-extensions/nautilus-global-preferences.c:
* libnautilus-extensions/nautilus-global-preferences.h:
* libnautilus-extensions/nautilus-lib-self-check-functions.h:
* libnautilus-extensions/nautilus-link-set.c:
* libnautilus-extensions/nautilus-link.c:
* libnautilus-extensions/nautilus-password-dialog.c:
* libnautilus-extensions/nautilus-preference.c:
(nautilus_self_check_preference):
* libnautilus-extensions/nautilus-preferences-box.c:
* libnautilus-extensions/nautilus-preferences-box.h:
* libnautilus-extensions/nautilus-preferences-dialog.c:
* libnautilus-extensions/nautilus-preferences-dialog.h:
* libnautilus-extensions/nautilus-preferences-group.c:
* libnautilus-extensions/nautilus-preferences-group.h:
* libnautilus-extensions/nautilus-preferences-item.c:
* libnautilus-extensions/nautilus-preferences-item.h:
* libnautilus-extensions/nautilus-preferences-pane.c:
* libnautilus-extensions/nautilus-preferences-pane.h:
* libnautilus-extensions/nautilus-preferences.c:
* libnautilus-extensions/nautilus-preferences.h:
* libnautilus-extensions/nautilus-radio-button-group.c:
* libnautilus-extensions/nautilus-string-picker.c:
* libnautilus-extensions/nautilus-string-picker.h:
* libnautilus-extensions/nautilus-text-caption.c:
* libnautilus-extensions/nautilus-text-caption.h:
* libnautilus-extensions/nautilus-undo-manager.c:
* libnautilus-extensions/nautilus-user-level-manager.c:
* libnautilus-extensions/nautilus-user-level-manager.h:
* libnautilus-extensions/nautilus-widgets-self-check-functions.c:
* libnautilus-extensions/nautilus-widgets-self-check-functions.h:
* libnautilus-extensions/test-nautilus-preferences.c:
* libnautilus-extensions/test-preferences.c:
* nautilus-widgets/Makefile.am:
* nautilus-widgets/nautilus-caption-table.c:
* nautilus-widgets/nautilus-caption-table.h:
* nautilus-widgets/nautilus-caption.c:
* nautilus-widgets/nautilus-caption.h:
* nautilus-widgets/nautilus-password-dialog.c:
* nautilus-widgets/nautilus-password-dialog.h:
* nautilus-widgets/nautilus-preference.c:
* nautilus-widgets/nautilus-preference.h:
* nautilus-widgets/nautilus-preferences-box.c:
* nautilus-widgets/nautilus-preferences-box.h:
* nautilus-widgets/nautilus-preferences-dialog.c:
* nautilus-widgets/nautilus-preferences-dialog.h:
* nautilus-widgets/nautilus-preferences-group.c:
* nautilus-widgets/nautilus-preferences-group.h:
* nautilus-widgets/nautilus-preferences-item.c:
* nautilus-widgets/nautilus-preferences-item.h:
* nautilus-widgets/nautilus-preferences-pane.c:
* nautilus-widgets/nautilus-preferences-pane.h:
* nautilus-widgets/nautilus-preferences.c:
* nautilus-widgets/nautilus-preferences.h:
* nautilus-widgets/nautilus-radio-button-group.c:
* nautilus-widgets/nautilus-radio-button-group.h:
* nautilus-widgets/nautilus-string-picker.c:
* nautilus-widgets/nautilus-string-picker.h:
* nautilus-widgets/nautilus-text-caption.c:
* nautilus-widgets/nautilus-text-caption.h:
* nautilus-widgets/nautilus-user-level-manager.c:
* nautilus-widgets/nautilus-user-level-manager.h:
* nautilus-widgets/nautilus-widgets-self-check-functions.c:
* nautilus-widgets/nautilus-widgets-self-check-functions.h:
* nautilus-widgets/test-nautilus-preferences.c:
* nautilus-widgets/test-nautilus-widgets.c:
* nautilus-widgets/test-preferences.c:
* src/Makefile.am:
* src/nautilus-main.c: (main):
* src/nautilus-sidebar.c:
* src/nautilus-window-menus.c:
* test/Makefile.am:
Move the nautilus-widgets classes to libnautilus-extensions.
2000-06-09 Maciej Stachowiak <mjs@eazel.com>
* src/nautilus-applicable-views.c (got_file_info_callback): Do not

View file

@ -8,7 +8,6 @@ SUBDIRS =\
libnautilus \
libnautilus-extensions \
librsvg \
nautilus-widgets \
helper-utilities \
components \
po \

View file

@ -13,7 +13,6 @@ INCLUDES=-I$(top_srcdir) -I$(top_builddir) \
LDADD =\
$(top_builddir)/libnautilus/libnautilus.la \
$(top_builddir)/nautilus-widgets/libnautilus-widgets.la \
$(top_builddir)/libnautilus-extensions/libnautilus-extensions.la \
$(top_builddir)/librsvg/librsvg.la \
$(BONOBO_LIBS) \

View file

@ -4,8 +4,7 @@ CPPFLAGS = \
-DPREFIX=\"$(prefix)\" \
-DG_LOG_DOMAIN=\"trilobite-eazel-time-service\" \
-DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
${NULL}
${NULL}
INCLUDES = \
-I$(top_srcdir) \
@ -71,7 +70,6 @@ trilobite_eazel_time_view_LDADD = \
trilobite_eazel_time_view_LDFLAGS = \
$(top_builddir)/nautilus-widgets/libnautilus-widgets.la \
$(top_builddir)/libnautilus/libnautilus.la \
$(top_builddir)/libnautilus-extensions/libnautilus-extensions.la \
$(top_builddir)/librsvg/librsvg.la \

View file

@ -10,7 +10,6 @@ INCLUDES=\
$(WERROR)
LDADD=\
$(top_builddir)/nautilus-widgets/libnautilus-widgets.la \
$(top_builddir)/libnautilus-extensions/libnautilus-extensions.la \
$(top_builddir)/libnautilus/libnautilus.la \
$(top_builddir)/librsvg/librsvg.la \

View file

@ -340,7 +340,6 @@ idl/Makefile
librsvg/Makefile
libnautilus/Makefile
libnautilus-extensions/Makefile
nautilus-widgets/Makefile
src/Makefile
src/file-manager/Makefile
components/Makefile

View file

@ -1,4 +1,4 @@
NULL =
NULL =
CPPFLAGS = \
-DPREFIX=\"$(prefix)\" \
@ -20,7 +20,6 @@ nautilus_authenticate_SOURCES =\
$(NULL)
nautilus_authenticate_LDFLAGS = \
$(top_builddir)/nautilus-widgets/libnautilus-widgets.la \
$(top_builddir)/libnautilus-extensions/libnautilus-extensions.la \
$(top_builddir)/librsvg/librsvg.la \
$(GNOMEUI_LIBS) \

View file

@ -27,7 +27,7 @@
#include <config.h>
#include "nautilus-authenticate.h"
#include <nautilus-widgets/nautilus-password-dialog.h>
#include <libnautilus-extensions/nautilus-password-dialog.h>
#include <libgnomeui/gnome-init.h>

View file

@ -32,16 +32,20 @@ libnautilus_extensions_la_SOURCES = \
nautilus-background.c \
nautilus-bonobo-extensions.c \
nautilus-bookmark.c \
nautilus-caption-table.c \
nautilus-caption.c \
nautilus-debug.c \
nautilus-default-file-icon.c \
nautilus-directory-async.c \
nautilus-directory-background.c \
nautilus-directory-metafile.c \
nautilus-directory.c \
nautilus-drag.c \
nautilus-entry.c \
nautilus-file-changes-queue.c \
nautilus-file-utilities.c \
nautilus-file.c \
nautilus-font-factory.c \
nautilus-gdk-extensions.c \
nautilus-gdk-pixbuf-extensions.c \
nautilus-generous-bin.c \
@ -52,27 +56,37 @@ libnautilus_extensions_la_SOURCES = \
nautilus-gtk-extensions.c \
nautilus-icon-canvas-item.c \
nautilus-icon-container.c \
nautilus-drag.c \
nautilus-icon-dnd.c \
nautilus-icon-factory.c \
nautilus-font-factory.c \
nautilus-icon-grid.c \
nautilus-icon-text-item.c \
nautilus-keep-last-vertical-box.c \
nautilus-lib-self-check-functions.c \
nautilus-link.c \
nautilus-link-set.c \
nautilus-link.c \
nautilus-list-column-title.c \
nautilus-list.c \
nautilus-mime-actions.c \
nautilus-mini-icon.c \
nautilus-password-dialog.c \
nautilus-preference.c \
nautilus-preferences-box.c \
nautilus-preferences-dialog.c \
nautilus-preferences-group.c \
nautilus-preferences-item.c \
nautilus-preferences-pane.c \
nautilus-preferences.c \
nautilus-program-chooser.c \
nautilus-program-choosing.c \
nautilus-radio-button-group.c \
nautilus-self-checks.c \
nautilus-string-list.c \
nautilus-string-picker.c \
nautilus-string.c \
nautilus-text-caption.c \
nautilus-undo-context.c \
nautilus-undo-manager.c \
nautilus-user-level-manager.c \
nautilus-view-identifier.c \
nautilus-xml-extensions.c \
$(NULL)
@ -88,6 +102,8 @@ noinst_HEADERS = \
nautilus-background.h \
nautilus-bonobo-extensions.h \
nautilus-bookmark.h \
nautilus-caption-table.h \
nautilus-caption.h \
nautilus-debug.h \
nautilus-default-file-icon.h \
nautilus-directory-background.h \
@ -127,13 +143,25 @@ noinst_HEADERS = \
nautilus-metadata.h \
nautilus-mime-actions.h \
nautilus-mini-icon.h \
nautilus-password-dialog.h \
nautilus-preference.h \
nautilus-preferences-box.h \
nautilus-preferences-dialog.h \
nautilus-preferences-group.h \
nautilus-preferences-item.h \
nautilus-preferences-pane.h \
nautilus-preferences.h \
nautilus-program-chooser.h \
nautilus-program-choosing.h \
nautilus-radio-button-group.h \
nautilus-self-checks.h \
nautilus-string-list.h \
nautilus-string-picker.h \
nautilus-string.h \
nautilus-text-caption.h \
nautilus-undo-context.h \
nautilus-undo-manager.h \
nautilus-user-level-manager.h \
nautilus-view-identifier.h \
nautilus-xml-extensions.h \
$(NULL)

View file

@ -28,7 +28,7 @@
#include <gtk/gtkentry.h>
#include <gtk/gtksignal.h>
#include <gtk/gtklabel.h>
#include <libnautilus-extensions/nautilus-gtk-macros.h>
#include "nautilus-gtk-macros.h"
struct _NautilusCaptionTableDetail
{

View file

@ -26,8 +26,8 @@
#include "nautilus-caption.h"
#include <libnautilus-extensions/nautilus-gtk-macros.h>
#include <libnautilus-extensions/nautilus-glib-extensions.h>
#include "nautilus-gtk-macros.h"
#include "nautilus-glib-extensions.h"
#include <gtk/gtklabel.h>
#include <gtk/gtkentry.h>

View file

@ -35,7 +35,7 @@
#include "nautilus-metadata.h"
#include <libnautilus-extensions/nautilus-string.h>
#include "nautilus-string.h"
#include <libgnomevfs/gnome-vfs-utils.h>
#define NAUTILUS_USER_DIRECTORY_NAME ".nautilus"

View file

@ -48,6 +48,7 @@ void nautilus_run_lib_self_checks (void);
macro (nautilus_self_check_file) \
macro (nautilus_self_check_icon_container) \
macro (nautilus_self_check_icon_factory) \
macro (nautilus_self_check_preference) \
/* Add new self-check functions to the list above this line. */
/* Generate prototypes for all the functions. */

View file

@ -38,7 +38,7 @@
#include "nautilus-string.h"
#include "nautilus-xml-extensions.h"
#include "nautilus-global-preferences.h"
#include <nautilus-widgets/nautilus-preferences.h>
#include "nautilus-preferences.h"
/* routine to create a new .link file in the specified directory */
static gboolean

View file

@ -38,7 +38,7 @@
#include "nautilus-string.h"
#include "nautilus-xml-extensions.h"
#include "nautilus-global-preferences.h"
#include "nautilus-widgets/nautilus-preferences.h"
#include "nautilus-preferences.h"
#define REMOTE_ICON_DIR_PERMISSIONS (GNOME_VFS_PERM_USER_ALL | GNOME_VFS_PERM_GROUP_ALL | GNOME_VFS_PERM_OTHER_ALL)

View file

@ -29,7 +29,7 @@
#include <libgnomeui/gnome-stock.h>
#include <gtk/gtkmain.h>
#include <gtk/gtksignal.h>
#include <libnautilus-extensions/nautilus-gtk-macros.h>
#include "nautilus-gtk-macros.h"
struct _NautilusPasswordDialogDetail
{

View file

@ -28,11 +28,10 @@
#include <stdio.h>
#include <stdlib.h>
#include <libnautilus-extensions/nautilus-gtk-macros.h>
#include <libnautilus-extensions/nautilus-string-list.h>
#include "nautilus-widgets-self-check-functions.h"
#include <nautilus-widgets/nautilus-user-level-manager.h>
#include "nautilus-gtk-macros.h"
#include "nautilus-string-list.h"
#include "nautilus-user-level-manager.h"
#include "nautilus-lib-self-check-functions.h"
/*
* PreferenceHashNode:
@ -791,7 +790,7 @@ nautilus_preference_enum_add_entry_by_name (const char *name,
#if !defined (NAUTILUS_OMIT_SELF_CHECK)
void
nautilus_widgets_self_check_preference (void)
nautilus_self_check_preference (void)
{
NautilusPreference *preference;

View file

@ -24,8 +24,8 @@
#include <config.h>
#include <nautilus-widgets/nautilus-preferences-box.h>
#include <libnautilus-extensions/nautilus-gtk-macros.h>
#include "nautilus-preferences-box.h"
#include "nautilus-gtk-macros.h"
#include <gtk/gtkclist.h>

View file

@ -27,7 +27,7 @@
#include <libgnomeui/gnome-dialog.h>
#include <gtk/gtkhbox.h>
#include <nautilus-widgets/nautilus-preferences-pane.h>
#include <libnautilus-extensions/nautilus-preferences-pane.h>
BEGIN_GNOME_DECLS

View file

@ -23,8 +23,8 @@
*/
#include <config.h>
#include <nautilus-widgets/nautilus-preferences-dialog.h>
#include <libnautilus-extensions/nautilus-gtk-macros.h>
#include "nautilus-preferences-dialog.h"
#include "nautilus-gtk-macros.h"
/* #include "caption-table.h" */

View file

@ -26,7 +26,7 @@
#define NAUTILUS_PREFERENCES_DIALOG_H
#include <libgnomeui/gnome-dialog.h>
#include <nautilus-widgets/nautilus-preferences-box.h>
#include <libnautilus-extensions/nautilus-preferences-box.h>
BEGIN_GNOME_DECLS

View file

@ -28,7 +28,7 @@
#include <gnome.h>
#include <gtk/gtkradiobutton.h>
#include <gtk/gtksignal.h>
#include <libnautilus-extensions/nautilus-gtk-macros.h>
#include "nautilus-gtk-macros.h"
/* Signals */
typedef enum

View file

@ -28,8 +28,8 @@
#include <gtk/gtkframe.h>
#include <gnome.h>
#include <nautilus-widgets/nautilus-preferences.h>
#include <nautilus-widgets/nautilus-preferences-item.h>
#include <libnautilus-extensions/nautilus-preferences.h>
#include <libnautilus-extensions/nautilus-preferences-item.h>
BEGIN_GNOME_DECLS

View file

@ -25,9 +25,9 @@
#include <config.h>
#include "nautilus-preferences-item.h"
#include "nautilus-preferences.h"
#include <libnautilus-extensions/nautilus-file-utilities.h>
#include <libnautilus-extensions/nautilus-glib-extensions.h>
#include <libnautilus-extensions/nautilus-gtk-macros.h>
#include "nautilus-file-utilities.h"
#include "nautilus-glib-extensions.h"
#include "nautilus-gtk-macros.h"
#include <libgnomevfs/gnome-vfs.h>
#include <gtk/gtkcheckbutton.h>

View file

@ -27,7 +27,7 @@
#include <gtk/gtkvbox.h>
#include <gnome.h>
#include <nautilus-widgets/nautilus-preferences.h>
#include <libnautilus-extensions/nautilus-preferences.h>
BEGIN_GNOME_DECLS

View file

@ -24,8 +24,8 @@
#include <config.h>
#include <nautilus-widgets/nautilus-preferences-pane.h>
#include <libnautilus-extensions/nautilus-gtk-macros.h>
#include "nautilus-preferences-pane.h"
#include "nautilus-gtk-macros.h"
#include <gtk/gtklabel.h>
#include <gtk/gtkframe.h>

View file

@ -27,7 +27,7 @@
#include <libgnomeui/gnome-dialog.h>
#include <gtk/gtkvbox.h>
#include <nautilus-widgets/nautilus-preferences-group.h>
#include <libnautilus-extensions/nautilus-preferences-group.h>
BEGIN_GNOME_DECLS

View file

@ -28,9 +28,9 @@
#include "nautilus-preferences.h"
#include "nautilus-user-level-manager.h"
#include <libnautilus-extensions/nautilus-gtk-macros.h>
#include <libnautilus-extensions/nautilus-glib-extensions.h>
#include <libnautilus-extensions/nautilus-string.h>
#include "nautilus-gtk-macros.h"
#include "nautilus-glib-extensions.h"
#include "nautilus-string.h"
#include <gconf/gconf.h>
#include <gconf/gconf-client.h>

View file

@ -28,7 +28,7 @@
#include <gtk/gtkobject.h>
#include <libgnome/gnome-defs.h>
#include <nautilus-widgets/nautilus-preference.h>
#include <libnautilus-extensions/nautilus-preference.h>
BEGIN_GNOME_DECLS

View file

@ -23,11 +23,11 @@
*/
#include <config.h>
#include <nautilus-widgets/nautilus-radio-button-group.h>
#include "nautilus-radio-button-group.h"
#include <gtk/gtkradiobutton.h>
#include <gtk/gtksignal.h>
#include <libnautilus-extensions/nautilus-gtk-macros.h>
#include "nautilus-gtk-macros.h"
static const gint RADIO_BUTTON_GROUP_INVALID = -1;

View file

@ -24,9 +24,9 @@
#include <config.h>
#include <nautilus-widgets/nautilus-string-picker.h>
#include <libnautilus-extensions/nautilus-gtk-macros.h>
#include <libnautilus-extensions/nautilus-glib-extensions.h>
#include "nautilus-string-picker.h"
#include "nautilus-gtk-macros.h"
#include "nautilus-glib-extensions.h"
#include <gtk/gtklabel.h>
#include <gtk/gtkcombo.h>

View file

@ -25,7 +25,7 @@
#ifndef NAUTILUS_STRING_PICKER_H
#define NAUTILUS_STRING_PICKER_H
#include <nautilus-widgets/nautilus-caption.h>
#include <libnautilus-extensions/nautilus-caption.h>
#include <libnautilus-extensions/nautilus-string-list.h>
/*

View file

@ -24,9 +24,9 @@
#include <config.h>
#include <nautilus-widgets/nautilus-text-caption.h>
#include <libnautilus-extensions/nautilus-gtk-macros.h>
#include <libnautilus-extensions/nautilus-glib-extensions.h>
#include "nautilus-text-caption.h"
#include "nautilus-gtk-macros.h"
#include "nautilus-glib-extensions.h"
#include <gtk/gtklabel.h>
#include <gtk/gtkentry.h>

View file

@ -25,7 +25,7 @@
#ifndef NAUTILUS_TEXT_CAPTION_H
#define NAUTILUS_TEXT_CAPTION_H
#include <nautilus-widgets/nautilus-caption.h>
#include <libnautilus-extensions/nautilus-caption.h>
/*
* NautilusTextCaption is made up of 2 widgets.

View file

@ -25,8 +25,8 @@
#include <config.h>
#include "nautilus-undo-manager.h"
#include <libnautilus-extensions/nautilus-gtk-macros.h>
#include <libnautilus-extensions/nautilus-gtk-extensions.h>
#include "nautilus-gtk-macros.h"
#include "nautilus-gtk-extensions.h"
#include <gtk/gtksignal.h>
#include <bonobo/bonobo-main.h>
#include <libnautilus/nautilus-undo-private.h>

View file

@ -24,8 +24,8 @@
#include <config.h>
#include "nautilus-user-level-manager.h"
#include <libnautilus-extensions/nautilus-gtk-macros.h>
#include <libnautilus-extensions/nautilus-glib-extensions.h>
#include "nautilus-gtk-macros.h"
#include "nautilus-glib-extensions.h"
#include <gtk/gtksignal.h>

View file

@ -28,7 +28,7 @@
#include <gtk/gtkobject.h>
#include <libgnome/gnome-defs.h>
#include <libnautilus-extensions/nautilus-string-list.h>
#include <nautilus-widgets/nautilus-preference.h>
#include <libnautilus-extensions/nautilus-preference.h>
BEGIN_GNOME_DECLS

View file

@ -1,38 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
nautilus-widgets-self-check-functions.c: Wrapper for all self-check
functions in nautilus-widgets.
Copyright (C) 2000 Eazel, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
This program 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
General Public License for more details.
You should have received a copy of the GNU General Public
License along with this program; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
Author: Ramiro Estrugo <ramiro@eazel.com>
*/
#include <config.h>
#if ! defined (NAUTILUS_OMIT_SELF_CHECK)
#include "nautilus-widgets-self-check-functions.h"
void
nautilus_widgets_run_self_checks (void)
{
NAUTILUS_WIDGETS_FOR_EACH_SELF_CHECK_FUNCTION (NAUTILUS_CALL_SELF_CHECK_FUNCTION)
}
#endif /* ! NAUTILUS_OMIT_SELF_CHECK */

View file

@ -1,36 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
nautilus-widgets-self-check-functions.h: Wrapper and prototypes for all
self-check functions in nautilus-widgets.
Copyright (C) 2000 Eazel, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
This program 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
General Public License for more details.
You should have received a copy of the GNU General Public
License along with this program; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
Author: Ramiro Estrugo <ramiro@eazel.com>
*/
#include <libnautilus-extensions/nautilus-self-checks.h>
/* See libnautilus-extensions for information on self tests */
void nautilus_widgets_run_self_checks (void);
#define NAUTILUS_WIDGETS_FOR_EACH_SELF_CHECK_FUNCTION(macro) \
macro (nautilus_widgets_self_check_preference)
/* Add new self-check functions to the list above this line. */
/* Generate prototypes for all the functions. */
NAUTILUS_WIDGETS_FOR_EACH_SELF_CHECK_FUNCTION (NAUTILUS_SELF_CHECK_FUNCTION_PROTOTYPE)

View file

@ -1,11 +1,11 @@
#include <config.h>
#include <nautilus-widgets/nautilus-radio-button-group.h>
#include <nautilus-widgets/nautilus-caption-table.h>
#include <nautilus-widgets/nautilus-password-dialog.h>
#include <nautilus-widgets/nautilus-preferences-group.h>
#include <nautilus-widgets/nautilus-preferences-item.h>
#include <nautilus-widgets/nautilus-preferences.h>
#include "nautilus-radio-button-group.h"
#include "nautilus-caption-table.h"
#include "nautilus-password-dialog.h"
#include "nautilus-preferences-group.h"
#include "nautilus-preferences-item.h"
#include "nautilus-preferences.h"
#include <gtk/gtk.h>

View file

@ -1,9 +1,9 @@
#include <config.h>
#include <nautilus-widgets/nautilus-radio-button-group.h>
#include <nautilus-widgets/nautilus-preferences-group.h>
#include <nautilus-widgets/nautilus-preferences-item.h>
#include <nautilus-widgets/nautilus-preferences.h>
#include "nautilus-radio-button-group.h"
#include "nautilus-preferences-group.h"
#include "nautilus-preferences-item.h"
#include "nautilus-preferences.h"
#include <gtk/gtk.h>
#include <stdio.h>

View file

@ -32,16 +32,20 @@ libnautilus_extensions_la_SOURCES = \
nautilus-background.c \
nautilus-bonobo-extensions.c \
nautilus-bookmark.c \
nautilus-caption-table.c \
nautilus-caption.c \
nautilus-debug.c \
nautilus-default-file-icon.c \
nautilus-directory-async.c \
nautilus-directory-background.c \
nautilus-directory-metafile.c \
nautilus-directory.c \
nautilus-drag.c \
nautilus-entry.c \
nautilus-file-changes-queue.c \
nautilus-file-utilities.c \
nautilus-file.c \
nautilus-font-factory.c \
nautilus-gdk-extensions.c \
nautilus-gdk-pixbuf-extensions.c \
nautilus-generous-bin.c \
@ -52,27 +56,37 @@ libnautilus_extensions_la_SOURCES = \
nautilus-gtk-extensions.c \
nautilus-icon-canvas-item.c \
nautilus-icon-container.c \
nautilus-drag.c \
nautilus-icon-dnd.c \
nautilus-icon-factory.c \
nautilus-font-factory.c \
nautilus-icon-grid.c \
nautilus-icon-text-item.c \
nautilus-keep-last-vertical-box.c \
nautilus-lib-self-check-functions.c \
nautilus-link.c \
nautilus-link-set.c \
nautilus-link.c \
nautilus-list-column-title.c \
nautilus-list.c \
nautilus-mime-actions.c \
nautilus-mini-icon.c \
nautilus-password-dialog.c \
nautilus-preference.c \
nautilus-preferences-box.c \
nautilus-preferences-dialog.c \
nautilus-preferences-group.c \
nautilus-preferences-item.c \
nautilus-preferences-pane.c \
nautilus-preferences.c \
nautilus-program-chooser.c \
nautilus-program-choosing.c \
nautilus-radio-button-group.c \
nautilus-self-checks.c \
nautilus-string-list.c \
nautilus-string-picker.c \
nautilus-string.c \
nautilus-text-caption.c \
nautilus-undo-context.c \
nautilus-undo-manager.c \
nautilus-user-level-manager.c \
nautilus-view-identifier.c \
nautilus-xml-extensions.c \
$(NULL)
@ -88,6 +102,8 @@ noinst_HEADERS = \
nautilus-background.h \
nautilus-bonobo-extensions.h \
nautilus-bookmark.h \
nautilus-caption-table.h \
nautilus-caption.h \
nautilus-debug.h \
nautilus-default-file-icon.h \
nautilus-directory-background.h \
@ -127,13 +143,25 @@ noinst_HEADERS = \
nautilus-metadata.h \
nautilus-mime-actions.h \
nautilus-mini-icon.h \
nautilus-password-dialog.h \
nautilus-preference.h \
nautilus-preferences-box.h \
nautilus-preferences-dialog.h \
nautilus-preferences-group.h \
nautilus-preferences-item.h \
nautilus-preferences-pane.h \
nautilus-preferences.h \
nautilus-program-chooser.h \
nautilus-program-choosing.h \
nautilus-radio-button-group.h \
nautilus-self-checks.h \
nautilus-string-list.h \
nautilus-string-picker.h \
nautilus-string.h \
nautilus-text-caption.h \
nautilus-undo-context.h \
nautilus-undo-manager.h \
nautilus-user-level-manager.h \
nautilus-view-identifier.h \
nautilus-xml-extensions.h \
$(NULL)

View file

@ -28,7 +28,7 @@
#include <gtk/gtkentry.h>
#include <gtk/gtksignal.h>
#include <gtk/gtklabel.h>
#include <libnautilus-extensions/nautilus-gtk-macros.h>
#include "nautilus-gtk-macros.h"
struct _NautilusCaptionTableDetail
{

View file

@ -26,8 +26,8 @@
#include "nautilus-caption.h"
#include <libnautilus-extensions/nautilus-gtk-macros.h>
#include <libnautilus-extensions/nautilus-glib-extensions.h>
#include "nautilus-gtk-macros.h"
#include "nautilus-glib-extensions.h"
#include <gtk/gtklabel.h>
#include <gtk/gtkentry.h>

View file

@ -35,7 +35,7 @@
#include "nautilus-metadata.h"
#include <libnautilus-extensions/nautilus-string.h>
#include "nautilus-string.h"
#include <libgnomevfs/gnome-vfs-utils.h>
#define NAUTILUS_USER_DIRECTORY_NAME ".nautilus"

View file

@ -48,6 +48,7 @@ void nautilus_run_lib_self_checks (void);
macro (nautilus_self_check_file) \
macro (nautilus_self_check_icon_container) \
macro (nautilus_self_check_icon_factory) \
macro (nautilus_self_check_preference) \
/* Add new self-check functions to the list above this line. */
/* Generate prototypes for all the functions. */

View file

@ -38,7 +38,7 @@
#include "nautilus-string.h"
#include "nautilus-xml-extensions.h"
#include "nautilus-global-preferences.h"
#include <nautilus-widgets/nautilus-preferences.h>
#include "nautilus-preferences.h"
/* routine to create a new .link file in the specified directory */
static gboolean

View file

@ -38,7 +38,7 @@
#include "nautilus-string.h"
#include "nautilus-xml-extensions.h"
#include "nautilus-global-preferences.h"
#include "nautilus-widgets/nautilus-preferences.h"
#include "nautilus-preferences.h"
#define REMOTE_ICON_DIR_PERMISSIONS (GNOME_VFS_PERM_USER_ALL | GNOME_VFS_PERM_GROUP_ALL | GNOME_VFS_PERM_OTHER_ALL)

View file

@ -29,7 +29,7 @@
#include <libgnomeui/gnome-stock.h>
#include <gtk/gtkmain.h>
#include <gtk/gtksignal.h>
#include <libnautilus-extensions/nautilus-gtk-macros.h>
#include "nautilus-gtk-macros.h"
struct _NautilusPasswordDialogDetail
{

View file

@ -28,11 +28,10 @@
#include <stdio.h>
#include <stdlib.h>
#include <libnautilus-extensions/nautilus-gtk-macros.h>
#include <libnautilus-extensions/nautilus-string-list.h>
#include "nautilus-widgets-self-check-functions.h"
#include <nautilus-widgets/nautilus-user-level-manager.h>
#include "nautilus-gtk-macros.h"
#include "nautilus-string-list.h"
#include "nautilus-user-level-manager.h"
#include "nautilus-lib-self-check-functions.h"
/*
* PreferenceHashNode:
@ -791,7 +790,7 @@ nautilus_preference_enum_add_entry_by_name (const char *name,
#if !defined (NAUTILUS_OMIT_SELF_CHECK)
void
nautilus_widgets_self_check_preference (void)
nautilus_self_check_preference (void)
{
NautilusPreference *preference;

View file

@ -24,8 +24,8 @@
#include <config.h>
#include <nautilus-widgets/nautilus-preferences-box.h>
#include <libnautilus-extensions/nautilus-gtk-macros.h>
#include "nautilus-preferences-box.h"
#include "nautilus-gtk-macros.h"
#include <gtk/gtkclist.h>

View file

@ -27,7 +27,7 @@
#include <libgnomeui/gnome-dialog.h>
#include <gtk/gtkhbox.h>
#include <nautilus-widgets/nautilus-preferences-pane.h>
#include <libnautilus-extensions/nautilus-preferences-pane.h>
BEGIN_GNOME_DECLS

View file

@ -23,8 +23,8 @@
*/
#include <config.h>
#include <nautilus-widgets/nautilus-preferences-dialog.h>
#include <libnautilus-extensions/nautilus-gtk-macros.h>
#include "nautilus-preferences-dialog.h"
#include "nautilus-gtk-macros.h"
/* #include "caption-table.h" */

View file

@ -26,7 +26,7 @@
#define NAUTILUS_PREFERENCES_DIALOG_H
#include <libgnomeui/gnome-dialog.h>
#include <nautilus-widgets/nautilus-preferences-box.h>
#include <libnautilus-extensions/nautilus-preferences-box.h>
BEGIN_GNOME_DECLS

View file

@ -28,7 +28,7 @@
#include <gnome.h>
#include <gtk/gtkradiobutton.h>
#include <gtk/gtksignal.h>
#include <libnautilus-extensions/nautilus-gtk-macros.h>
#include "nautilus-gtk-macros.h"
/* Signals */
typedef enum

View file

@ -28,8 +28,8 @@
#include <gtk/gtkframe.h>
#include <gnome.h>
#include <nautilus-widgets/nautilus-preferences.h>
#include <nautilus-widgets/nautilus-preferences-item.h>
#include <libnautilus-extensions/nautilus-preferences.h>
#include <libnautilus-extensions/nautilus-preferences-item.h>
BEGIN_GNOME_DECLS

View file

@ -25,9 +25,9 @@
#include <config.h>
#include "nautilus-preferences-item.h"
#include "nautilus-preferences.h"
#include <libnautilus-extensions/nautilus-file-utilities.h>
#include <libnautilus-extensions/nautilus-glib-extensions.h>
#include <libnautilus-extensions/nautilus-gtk-macros.h>
#include "nautilus-file-utilities.h"
#include "nautilus-glib-extensions.h"
#include "nautilus-gtk-macros.h"
#include <libgnomevfs/gnome-vfs.h>
#include <gtk/gtkcheckbutton.h>

View file

@ -27,7 +27,7 @@
#include <gtk/gtkvbox.h>
#include <gnome.h>
#include <nautilus-widgets/nautilus-preferences.h>
#include <libnautilus-extensions/nautilus-preferences.h>
BEGIN_GNOME_DECLS

View file

@ -24,8 +24,8 @@
#include <config.h>
#include <nautilus-widgets/nautilus-preferences-pane.h>
#include <libnautilus-extensions/nautilus-gtk-macros.h>
#include "nautilus-preferences-pane.h"
#include "nautilus-gtk-macros.h"
#include <gtk/gtklabel.h>
#include <gtk/gtkframe.h>

View file

@ -27,7 +27,7 @@
#include <libgnomeui/gnome-dialog.h>
#include <gtk/gtkvbox.h>
#include <nautilus-widgets/nautilus-preferences-group.h>
#include <libnautilus-extensions/nautilus-preferences-group.h>
BEGIN_GNOME_DECLS

View file

@ -28,9 +28,9 @@
#include "nautilus-preferences.h"
#include "nautilus-user-level-manager.h"
#include <libnautilus-extensions/nautilus-gtk-macros.h>
#include <libnautilus-extensions/nautilus-glib-extensions.h>
#include <libnautilus-extensions/nautilus-string.h>
#include "nautilus-gtk-macros.h"
#include "nautilus-glib-extensions.h"
#include "nautilus-string.h"
#include <gconf/gconf.h>
#include <gconf/gconf-client.h>

View file

@ -28,7 +28,7 @@
#include <gtk/gtkobject.h>
#include <libgnome/gnome-defs.h>
#include <nautilus-widgets/nautilus-preference.h>
#include <libnautilus-extensions/nautilus-preference.h>
BEGIN_GNOME_DECLS

View file

@ -23,11 +23,11 @@
*/
#include <config.h>
#include <nautilus-widgets/nautilus-radio-button-group.h>
#include "nautilus-radio-button-group.h"
#include <gtk/gtkradiobutton.h>
#include <gtk/gtksignal.h>
#include <libnautilus-extensions/nautilus-gtk-macros.h>
#include "nautilus-gtk-macros.h"
static const gint RADIO_BUTTON_GROUP_INVALID = -1;

View file

@ -24,9 +24,9 @@
#include <config.h>
#include <nautilus-widgets/nautilus-string-picker.h>
#include <libnautilus-extensions/nautilus-gtk-macros.h>
#include <libnautilus-extensions/nautilus-glib-extensions.h>
#include "nautilus-string-picker.h"
#include "nautilus-gtk-macros.h"
#include "nautilus-glib-extensions.h"
#include <gtk/gtklabel.h>
#include <gtk/gtkcombo.h>

View file

@ -25,7 +25,7 @@
#ifndef NAUTILUS_STRING_PICKER_H
#define NAUTILUS_STRING_PICKER_H
#include <nautilus-widgets/nautilus-caption.h>
#include <libnautilus-extensions/nautilus-caption.h>
#include <libnautilus-extensions/nautilus-string-list.h>
/*

View file

@ -24,9 +24,9 @@
#include <config.h>
#include <nautilus-widgets/nautilus-text-caption.h>
#include <libnautilus-extensions/nautilus-gtk-macros.h>
#include <libnautilus-extensions/nautilus-glib-extensions.h>
#include "nautilus-text-caption.h"
#include "nautilus-gtk-macros.h"
#include "nautilus-glib-extensions.h"
#include <gtk/gtklabel.h>
#include <gtk/gtkentry.h>

View file

@ -25,7 +25,7 @@
#ifndef NAUTILUS_TEXT_CAPTION_H
#define NAUTILUS_TEXT_CAPTION_H
#include <nautilus-widgets/nautilus-caption.h>
#include <libnautilus-extensions/nautilus-caption.h>
/*
* NautilusTextCaption is made up of 2 widgets.

View file

@ -25,8 +25,8 @@
#include <config.h>
#include "nautilus-undo-manager.h"
#include <libnautilus-extensions/nautilus-gtk-macros.h>
#include <libnautilus-extensions/nautilus-gtk-extensions.h>
#include "nautilus-gtk-macros.h"
#include "nautilus-gtk-extensions.h"
#include <gtk/gtksignal.h>
#include <bonobo/bonobo-main.h>
#include <libnautilus/nautilus-undo-private.h>

View file

@ -24,8 +24,8 @@
#include <config.h>
#include "nautilus-user-level-manager.h"
#include <libnautilus-extensions/nautilus-gtk-macros.h>
#include <libnautilus-extensions/nautilus-glib-extensions.h>
#include "nautilus-gtk-macros.h"
#include "nautilus-glib-extensions.h"
#include <gtk/gtksignal.h>

View file

@ -28,7 +28,7 @@
#include <gtk/gtkobject.h>
#include <libgnome/gnome-defs.h>
#include <libnautilus-extensions/nautilus-string-list.h>
#include <nautilus-widgets/nautilus-preference.h>
#include <libnautilus-extensions/nautilus-preference.h>
BEGIN_GNOME_DECLS

View file

@ -1,38 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
nautilus-widgets-self-check-functions.c: Wrapper for all self-check
functions in nautilus-widgets.
Copyright (C) 2000 Eazel, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
This program 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
General Public License for more details.
You should have received a copy of the GNU General Public
License along with this program; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
Author: Ramiro Estrugo <ramiro@eazel.com>
*/
#include <config.h>
#if ! defined (NAUTILUS_OMIT_SELF_CHECK)
#include "nautilus-widgets-self-check-functions.h"
void
nautilus_widgets_run_self_checks (void)
{
NAUTILUS_WIDGETS_FOR_EACH_SELF_CHECK_FUNCTION (NAUTILUS_CALL_SELF_CHECK_FUNCTION)
}
#endif /* ! NAUTILUS_OMIT_SELF_CHECK */

View file

@ -1,36 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
nautilus-widgets-self-check-functions.h: Wrapper and prototypes for all
self-check functions in nautilus-widgets.
Copyright (C) 2000 Eazel, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
This program 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
General Public License for more details.
You should have received a copy of the GNU General Public
License along with this program; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
Author: Ramiro Estrugo <ramiro@eazel.com>
*/
#include <libnautilus-extensions/nautilus-self-checks.h>
/* See libnautilus-extensions for information on self tests */
void nautilus_widgets_run_self_checks (void);
#define NAUTILUS_WIDGETS_FOR_EACH_SELF_CHECK_FUNCTION(macro) \
macro (nautilus_widgets_self_check_preference)
/* Add new self-check functions to the list above this line. */
/* Generate prototypes for all the functions. */
NAUTILUS_WIDGETS_FOR_EACH_SELF_CHECK_FUNCTION (NAUTILUS_SELF_CHECK_FUNCTION_PROTOTYPE)

View file

@ -1,11 +1,11 @@
#include <config.h>
#include <nautilus-widgets/nautilus-radio-button-group.h>
#include <nautilus-widgets/nautilus-caption-table.h>
#include <nautilus-widgets/nautilus-password-dialog.h>
#include <nautilus-widgets/nautilus-preferences-group.h>
#include <nautilus-widgets/nautilus-preferences-item.h>
#include <nautilus-widgets/nautilus-preferences.h>
#include "nautilus-radio-button-group.h"
#include "nautilus-caption-table.h"
#include "nautilus-password-dialog.h"
#include "nautilus-preferences-group.h"
#include "nautilus-preferences-item.h"
#include "nautilus-preferences.h"
#include <gtk/gtk.h>

View file

@ -1,9 +1,9 @@
#include <config.h>
#include <nautilus-widgets/nautilus-radio-button-group.h>
#include <nautilus-widgets/nautilus-preferences-group.h>
#include <nautilus-widgets/nautilus-preferences-item.h>
#include <nautilus-widgets/nautilus-preferences.h>
#include "nautilus-radio-button-group.h"
#include "nautilus-preferences-group.h"
#include "nautilus-preferences-item.h"
#include "nautilus-preferences.h"
#include <gtk/gtk.h>
#include <stdio.h>

View file

@ -1,79 +0,0 @@
NULL=
bin_PROGRAMS = test-nautilus-widgets test-nautilus-preferences
lib_LTLIBRARIES=libnautilus-widgets.la
INCLUDES =\
-I$(top_srcdir) \
-I$(top_builddir) \
$(GNOME_CFLAGS) \
$(GCONF_CFLAGS) \
$(WERROR) \
-D_REENTRANT \
$(NULL)
libnautilus_widgets_la_LDFLAGS=\
$(GNOME_LIBS) \
$(top_builddir)/libnautilus/.libs/libnautilus.so
libnautilus_widgetsincludedir=$(includedir)/nautilus-widgets
libnautilus_widgetsinclude_HEADERS =\
nautilus-caption-table.h \
nautilus-caption.h \
nautilus-password-dialog.h \
nautilus-preference.h \
nautilus-preferences-box.h \
nautilus-preferences-dialog.h \
nautilus-preferences-group.h \
nautilus-preferences-item.h \
nautilus-preferences-pane.h \
nautilus-preferences.h \
nautilus-radio-button-group.h \
nautilus-string-picker.h \
nautilus-text-caption.h \
nautilus-user-level-manager.h \
$(NULL)
libnautilus_widgets_la_SOURCES =\
nautilus-caption-table.c \
nautilus-caption.c \
nautilus-password-dialog.c \
nautilus-preference.c \
nautilus-preferences-box.c \
nautilus-preferences-dialog.c \
nautilus-preferences-group.c \
nautilus-preferences-item.c \
nautilus-preferences-pane.c \
nautilus-preferences.c \
nautilus-radio-button-group.c \
nautilus-string-picker.c \
nautilus-text-caption.c \
nautilus-user-level-manager.c \
nautilus-widgets-self-check-functions.c \
nautilus-widgets-self-check-functions.h \
$(NULL)
test_ldd =\
$(GCONF_LIBS) \
$(GNOMEUI_LIBS) \
../nautilus-widgets/libnautilus-widgets.la \
../libnautilus-extensions/libnautilus-extensions.la \
../libnautilus/libnautilus.la \
../librsvg/librsvg.la \
$(NULL)
test_nautilus_widgets_SOURCES =\
test-nautilus-widgets.c \
$(NULL)
test_nautilus_widgets_LDADD = $(test_ldd)
test_nautilus_preferences_SOURCES =\
test-nautilus-preferences.c \
$(NULL)
test_nautilus_preferences_LDADD = $(test_ldd)
../nautilus-widgets/libnautilus-widgets.la: libnautilus-widgets.la

View file

@ -1,396 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* nautilus-caption-table.c - An easy way to do tables of aligned captions.
Copyright (C) 1999, 2000 Eazel, Inc.
The Gnome Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The Gnome Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the Gnome Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
Authors: Ramiro Estrugo <ramiro@eazel.com>
*/
#include <config.h>
#include "nautilus-caption-table.h"
#include <gtk/gtkentry.h>
#include <gtk/gtksignal.h>
#include <gtk/gtklabel.h>
#include <libnautilus-extensions/nautilus-gtk-macros.h>
struct _NautilusCaptionTableDetail
{
GtkWidget **labels;
GtkWidget **entries;
guint num_rows;
guint size;
};
enum
{
ACTIVATE,
LAST_SIGNAL
};
/* NautilusCaptionTableClass methods */
static void nautilus_caption_table_initialize_class (NautilusCaptionTableClass *klass);
static void nautilus_caption_table_initialize (NautilusCaptionTable *caption_table);
/* GtkObjectClass methods */
static void caption_table_destroy (GtkObject *object);
/* Private methods */
static GtkWidget* caption_table_find_next_sensitive_entry (NautilusCaptionTable *caption_table,
guint index);
static int caption_table_index_of_entry (NautilusCaptionTable *caption_table,
GtkWidget *entry);
/* Entry callbacks */
static void entry_activate (GtkWidget *widget,
gpointer data);
/* Boilerplate stuff */
NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusCaptionTable,
nautilus_caption_table,
GTK_TYPE_TABLE)
static int caption_table_signals[LAST_SIGNAL] = { 0 };
static void
nautilus_caption_table_initialize_class (NautilusCaptionTableClass *klass)
{
GtkObjectClass *object_class;
GtkWidgetClass *widget_class;
object_class = GTK_OBJECT_CLASS (klass);
widget_class = GTK_WIDGET_CLASS (klass);
caption_table_signals[ACTIVATE] =
gtk_signal_new ("activate",
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (NautilusCaptionTableClass, activate),
gtk_marshal_NONE__INT,
GTK_TYPE_NONE, 1, GTK_TYPE_INT);
gtk_object_class_add_signals (object_class, caption_table_signals, LAST_SIGNAL);
/* GtkObjectClass */
object_class->destroy = caption_table_destroy;
}
#define CAPTION_TABLE_DEFAULT_ROWS 1
static void
nautilus_caption_table_initialize (NautilusCaptionTable *caption_table)
{
GtkTable *table = GTK_TABLE (caption_table);
caption_table->detail = g_new (NautilusCaptionTableDetail, 1);
caption_table->detail->num_rows = 0;
caption_table->detail->size = 0;
caption_table->detail->labels = NULL;
caption_table->detail->entries = NULL;
table->homogeneous = FALSE;
}
/* GtkObjectClass methods */
static void
caption_table_destroy (GtkObject *object)
{
NautilusCaptionTable *caption_table;
g_return_if_fail (object != NULL);
g_return_if_fail (NAUTILUS_IS_CAPTION_TABLE (object));
caption_table = NAUTILUS_CAPTION_TABLE (object);
if (caption_table->detail->labels)
g_free(caption_table->detail->labels);
if (caption_table->detail->entries)
g_free(caption_table->detail->entries);
g_free (caption_table->detail);
if (GTK_OBJECT_CLASS (parent_class)->destroy)
(*GTK_OBJECT_CLASS (parent_class)->destroy) (object);
}
void
nautilus_caption_table_resize (NautilusCaptionTable *caption_table,
guint num_rows)
{
GtkTable* table = NULL;
g_return_if_fail (caption_table != NULL);
g_return_if_fail (NAUTILUS_IS_CAPTION_TABLE (caption_table));
/* Make sure the num_rows have changed */
if (caption_table->detail->num_rows == num_rows)
return;
caption_table->detail->num_rows = num_rows;
/* Resize the GtkTable */
table = GTK_TABLE (caption_table);
gtk_table_resize(table, caption_table->detail->num_rows, 2);
/* Create more label/entry pairs if needed */
if (caption_table->detail->num_rows > caption_table->detail->size)
{
guint i;
guint old_size = caption_table->detail->size;
guint new_size = caption_table->detail->num_rows;
guint realloc_size = sizeof(GtkWidget *) * new_size;
/* FIXME bugzilla.eazel.com 680: Use a GList for this */
caption_table->detail->labels = (GtkWidget**) g_realloc (caption_table->detail->labels,
realloc_size);
caption_table->detail->entries = (GtkWidget**) g_realloc (caption_table->detail->entries,
realloc_size);
for (i = old_size; i < new_size; i++)
{
caption_table->detail->labels[i] = gtk_label_new("");
caption_table->detail->entries[i] = gtk_entry_new();
gtk_signal_connect(GTK_OBJECT (caption_table->detail->entries[i]),
"activate",
GTK_SIGNAL_FUNC (entry_activate),
(gpointer) caption_table);
gtk_misc_set_alignment (GTK_MISC (caption_table->detail->labels[i]), 1.0, 0.5);
/* Column 1 */
gtk_table_attach (table,
caption_table->detail->labels[i], /* child */
0, /* left_attatch */
1, /* right_attatch */
i, /* top_attatch */
i + 1, /* bottom_attatch */
GTK_FILL, /* xoptions */
(GTK_FILL|GTK_EXPAND), /* yoptions */
0, /* xpadding */
0); /* ypadding */
/* Column 2 */
gtk_table_attach (table,
caption_table->detail->entries[i], /* child */
1, /* left_attatch */
2, /* right_attatch */
i, /* top_attatch */
i + 1, /* bottom_attatch */
(GTK_FILL|GTK_EXPAND), /* xoptions */
(GTK_FILL|GTK_EXPAND), /* yoptions */
0, /* xpadding */
0); /* ypadding */
}
caption_table->detail->size = new_size;
}
/* Show only the needed caption widgets */
if (caption_table->detail->size > 0)
{
guint i;
for(i = 0; i < caption_table->detail->size; i++)
{
if (i < caption_table->detail->num_rows)
{
gtk_widget_show (caption_table->detail->labels[i]);
gtk_widget_show (caption_table->detail->entries[i]);
}
else
{
gtk_widget_hide (caption_table->detail->labels[i]);
gtk_widget_hide (caption_table->detail->entries[i]);
}
}
}
/* Set inter row spacing */
if (caption_table->detail->num_rows > 1)
{
guint i;
for(i = 0; i < (caption_table->detail->num_rows - 1); i++)
gtk_table_set_row_spacing (GTK_TABLE (table), i, 10);
}
}
static int
caption_table_index_of_entry (NautilusCaptionTable *caption_table,
GtkWidget* entry)
{
guint i;
g_return_val_if_fail (caption_table != NULL, -1);
g_return_val_if_fail (NAUTILUS_IS_CAPTION_TABLE (caption_table), -1);
for(i = 0; i < caption_table->detail->num_rows; i++)
if (caption_table->detail->entries[i] == entry)
return i;
return -1;
}
static GtkWidget*
caption_table_find_next_sensitive_entry (NautilusCaptionTable *caption_table,
guint index)
{
guint i;
g_return_val_if_fail (caption_table != NULL, NULL);
g_return_val_if_fail (NAUTILUS_IS_CAPTION_TABLE (caption_table), NULL);
for(i = index; i < caption_table->detail->num_rows; i++)
if (GTK_WIDGET_SENSITIVE (caption_table->detail->entries[i]))
return caption_table->detail->entries[i];
return NULL;
}
static void
entry_activate (GtkWidget *widget, gpointer data)
{
NautilusCaptionTable *caption_table = NAUTILUS_CAPTION_TABLE (data);
int index;
g_return_if_fail (caption_table != NULL);
g_return_if_fail (NAUTILUS_IS_CAPTION_TABLE (caption_table));
index = caption_table_index_of_entry (caption_table, widget);
/* Check for an invalid index */
if (index == -1)
return;
/* Check for the last index */
if (index < caption_table->detail->num_rows)
{
/* Look for the next sensitive entry */
GtkWidget* sensitive_entry =
caption_table_find_next_sensitive_entry (caption_table, index + 1);
/* Make the next sensitive entry take focus */
if (sensitive_entry)
gtk_widget_grab_focus (sensitive_entry);
}
/* Emit the activate signal */
gtk_signal_emit (GTK_OBJECT (caption_table),
caption_table_signals[ACTIVATE],
index);
}
/* Public methods */
GtkWidget*
nautilus_caption_table_new (guint num_rows)
{
GtkWidget *widget = GTK_WIDGET (gtk_type_new (nautilus_caption_table_get_type()));
if (num_rows == 0)
num_rows = 1;
nautilus_caption_table_resize (NAUTILUS_CAPTION_TABLE(widget), num_rows);
gtk_table_set_col_spacing (GTK_TABLE (widget), 0, 10);
return widget;
}
void
nautilus_caption_table_set_row_info (NautilusCaptionTable *caption_table,
guint row,
const char* label_text,
const char* entry_text,
gboolean entry_visibility,
gboolean entry_readonly)
{
g_return_if_fail (caption_table != NULL);
g_return_if_fail (NAUTILUS_IS_CAPTION_TABLE (caption_table));
g_return_if_fail (row < caption_table->detail->num_rows);
gtk_label_set_text (GTK_LABEL (caption_table->detail->labels[row]), label_text);
gtk_entry_set_text (GTK_ENTRY (caption_table->detail->entries[row]), entry_text);
gtk_entry_set_visibility (GTK_ENTRY (caption_table->detail->entries[row]), entry_visibility);
gtk_widget_set_sensitive (caption_table->detail->entries[row], !entry_readonly);
}
void
nautilus_caption_table_set_entry_text (NautilusCaptionTable *caption_table,
guint row,
const char* entry_text)
{
g_return_if_fail (caption_table != NULL);
g_return_if_fail (NAUTILUS_IS_CAPTION_TABLE (caption_table));
g_return_if_fail (row < caption_table->detail->num_rows);
gtk_entry_set_text (GTK_ENTRY (caption_table->detail->entries[row]), entry_text);
}
void
nautilus_caption_table_set_entry_readonly (NautilusCaptionTable *caption_table,
guint row,
gboolean readonly)
{
g_return_if_fail (caption_table != NULL);
g_return_if_fail (NAUTILUS_IS_CAPTION_TABLE (caption_table));
g_return_if_fail (row < caption_table->detail->num_rows);
gtk_widget_set_sensitive (caption_table->detail->entries[row], !readonly);
}
void
nautilus_caption_table_entry_grab_focus (NautilusCaptionTable *caption_table, guint row)
{
g_return_if_fail (caption_table != NULL);
g_return_if_fail (NAUTILUS_IS_CAPTION_TABLE (caption_table));
g_return_if_fail (row < caption_table->detail->num_rows);
if (GTK_WIDGET_SENSITIVE (caption_table->detail->entries[row]))
gtk_widget_grab_focus (caption_table->detail->entries[row]);
}
char*
nautilus_caption_table_get_entry_text (NautilusCaptionTable *caption_table, guint row)
{
char *text;
g_return_val_if_fail (caption_table != NULL, NULL);
g_return_val_if_fail (NAUTILUS_IS_CAPTION_TABLE (caption_table), NULL);
g_return_val_if_fail (row < caption_table->detail->num_rows, NULL);
text = gtk_entry_get_text (GTK_ENTRY (caption_table->detail->entries[row]));
return g_strdup (text);
}
guint
nautilus_caption_table_get_num_rows (NautilusCaptionTable *caption_table)
{
g_return_val_if_fail (caption_table != NULL, 0);
g_return_val_if_fail (NAUTILUS_IS_CAPTION_TABLE (caption_table), 0);
return caption_table->detail->num_rows;
}

View file

@ -1,89 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* nautilus-caption-table.h - An easy way to do tables of aligned captions.
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_CAPTION_TABLE_H
#define NAUTILUS_CAPTION_TABLE_H
#include <gtk/gtktable.h>
#include <gnome.h>
/*
* NautilusCaptionTable is a GtkTable sublass that allows you to painlessly
* create tables of nicely aligned captions.
*/
BEGIN_GNOME_DECLS
#define NAUTILUS_TYPE_CAPTION_TABLE (nautilus_caption_table_get_type ())
#define NAUTILUS_CAPTION_TABLE(obj) (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_CAPTION_TABLE, NautilusCaptionTable))
#define NAUTILUS_CAPTION_TABLE_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_CAPTION_TABLE, NautilusCaptionTableClass))
#define NAUTILUS_IS_CAPTION_TABLE(obj) (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_CAPTION_TABLE))
#define NAUTILUS_IS_CAPTION_TABLE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_CAPTION_TABLE))
typedef struct _NautilusCaptionTable NautilusCaptionTable;
typedef struct _NautilusCaptionTableClass NautilusCaptionTableClass;
typedef struct _NautilusCaptionTableDetail NautilusCaptionTableDetail;
struct _NautilusCaptionTable
{
GtkTable table;
NautilusCaptionTableDetail *detail;
};
struct _NautilusCaptionTableClass
{
GtkTableClass parent_class;
void (*activate) (GtkWidget *caption_table, int active_entry);
};
GtkType nautilus_caption_table_get_type (void);
GtkWidget* nautilus_caption_table_new (guint num_rows);
void nautilus_caption_table_set_row_info (NautilusCaptionTable *caption_table,
guint row,
const char *label_text,
const char *entry_text,
gboolean entry_visibility,
gboolean entry_readonly);
void nautilus_caption_table_set_entry_text (NautilusCaptionTable *caption_table,
guint row,
const char *entry_text);
void nautilus_caption_table_set_entry_readonly (NautilusCaptionTable *caption_table,
guint row,
gboolean readonly);
void nautilus_caption_table_entry_grab_focus (NautilusCaptionTable *caption_table,
guint row);
char* nautilus_caption_table_get_entry_text (NautilusCaptionTable *caption_table,
guint row);
guint nautilus_caption_table_get_num_rows (NautilusCaptionTable *caption_table);
void nautilus_caption_table_resize (NautilusCaptionTable *caption_table,
guint num_rows);
BEGIN_GNOME_DECLS
#endif /* NAUTILUS_CAPTION_TABLE_H */

View file

@ -1,188 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* nautilus-caption.c - A captioned text widget
Copyright (C) 1999, 2000 Eazel, Inc.
The Gnome Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The Gnome Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the Gnome Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
Authors: Ramiro Estrugo <ramiro@eazel.com>
*/
#include <config.h>
#include "nautilus-caption.h"
#include <libnautilus-extensions/nautilus-gtk-macros.h>
#include <libnautilus-extensions/nautilus-glib-extensions.h>
#include <gtk/gtklabel.h>
#include <gtk/gtkentry.h>
static const gint CAPTION_INVALID = -1;
static const gint CAPTION_SPACING = 10;
struct _NautilusCaptionDetail
{
GtkWidget *title_label;
GtkWidget *child;
};
/* NautilusCaptionClass methods */
static void nautilus_caption_initialize_class (NautilusCaptionClass *klass);
static void nautilus_caption_initialize (NautilusCaption *caption);
/* GtkObjectClass methods */
static void nautilus_caption_destroy (GtkObject *object);
NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusCaption, nautilus_caption, GTK_TYPE_HBOX)
/*
* NautilusCaptionClass methods
*/
static void
nautilus_caption_initialize_class (NautilusCaptionClass *caption_class)
{
GtkObjectClass *object_class;
GtkWidgetClass *widget_class;
object_class = GTK_OBJECT_CLASS (caption_class);
widget_class = GTK_WIDGET_CLASS (caption_class);
/* GtkObjectClass */
object_class->destroy = nautilus_caption_destroy;
}
static void
nautilus_caption_initialize (NautilusCaption *caption)
{
caption->detail = g_new (NautilusCaptionDetail, 1);
gtk_box_set_homogeneous (GTK_BOX (caption), FALSE);
gtk_box_set_spacing (GTK_BOX (caption), CAPTION_SPACING);
caption->detail->title_label = gtk_label_new ("Title Label:");
caption->detail->child = NULL;
gtk_box_pack_start (GTK_BOX (caption),
caption->detail->title_label,
FALSE, /* expand */
TRUE, /* fill */
0); /* padding */
gtk_widget_show (caption->detail->title_label);
}
/*
* GtkObjectClass methods
*/
static void
nautilus_caption_destroy (GtkObject* object)
{
NautilusCaption * caption;
g_return_if_fail (object != NULL);
g_return_if_fail (NAUTILUS_IS_CAPTION (object));
caption = NAUTILUS_CAPTION (object);
g_free (caption->detail);
/* Chain */
NAUTILUS_CALL_PARENT_CLASS (GTK_OBJECT_CLASS, destroy, (object));
}
/*
* NautilusCaption public methods
*/
GtkWidget*
nautilus_caption_new (void)
{
NautilusCaption *caption;
caption = gtk_type_new (nautilus_caption_get_type ());
return GTK_WIDGET (caption);
}
/**
* nautilus_caption_set_title_label:
* @caption: A NautilusCaption
* @title_label: The title label
*
*/
void
nautilus_caption_set_title_label (NautilusCaption *caption,
const char *title_label)
{
g_return_if_fail (caption != NULL);
g_return_if_fail (NAUTILUS_IS_CAPTION (caption));
g_return_if_fail (title_label != NULL);
gtk_label_set_text (GTK_LABEL (caption->detail->title_label), title_label);
}
/**
* nautilus_caption_get_title_label:
* @caption: A NautilusCaption
*
* Returns: A newly allocated copy of the title label.
*/
char *
nautilus_caption_get_title_label (const NautilusCaption *caption)
{
gchar *str;
g_return_val_if_fail (caption != NULL, NULL);
g_return_val_if_fail (NAUTILUS_IS_CAPTION (caption), NULL);
/* DANGER! DANGER!
*
* gtk_label_get () does not strdup the result.
*/
gtk_label_get (GTK_LABEL (caption->detail->title_label), &str);
return str ? g_strdup (str) : NULL;
}
/**
* nautilus_caption_get_title_label:
* @caption: A NautilusCaption
*
* Returns: A newly allocated copy of the title label.
*/
void
nautilus_caption_set_child (NautilusCaption *caption,
GtkWidget *child)
{
g_return_if_fail (caption != NULL);
g_return_if_fail (NAUTILUS_IS_CAPTION (caption));
g_return_if_fail (child != NULL);
g_return_if_fail (GTK_IS_WIDGET (child));
g_return_if_fail (caption->detail->child == NULL);
caption->detail->child = child;
gtk_box_pack_end (GTK_BOX (caption),
caption->detail->child,
TRUE, /* expand */
TRUE, /* fill */
0); /* padding */
gtk_widget_show (caption->detail->child);
}

View file

@ -1,81 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* nautilus-caption.h - A captioned text widget
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_CAPTION_H
#define NAUTILUS_CAPTION_H
#include <gtk/gtkvbox.h>
#include <gnome.h>
#include <libnautilus-extensions/nautilus-string-list.h>
/*
* NautilusCaption is made up of 2 widgets.
*
* [title label] [something]
*
*/
BEGIN_GNOME_DECLS
#define NAUTILUS_TYPE_CAPTION (nautilus_caption_get_type ())
#define NAUTILUS_CAPTION(obj) (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_CAPTION, NautilusCaption))
#define NAUTILUS_CAPTION_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_CAPTION, NautilusCaptionClass))
#define NAUTILUS_IS_CAPTION(obj) (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_CAPTION))
typedef struct _NautilusCaption NautilusCaption;
typedef struct _NautilusCaptionClass NautilusCaptionClass;
typedef struct _NautilusCaptionDetail NautilusCaptionDetail;
struct _NautilusCaption
{
/* Super Class */
GtkHBox hbox;
/* Private stuff */
NautilusCaptionDetail *detail;
};
struct _NautilusCaptionClass
{
GtkHBoxClass parent_class;
};
GtkType nautilus_caption_get_type (void);
GtkWidget* nautilus_caption_new (void);
/* Title label mutator. */
void nautilus_caption_set_title_label (NautilusCaption *caption,
const char *title_label);
/* Title label accessor. */
char *nautilus_caption_get_title_label (const NautilusCaption *caption);
/* Set the child. */
void nautilus_caption_set_child (NautilusCaption *caption,
GtkWidget *child);
BEGIN_GNOME_DECLS
#endif /* NAUTILUS_CAPTION_H */

View file

@ -1,359 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* nautilus-password-dialog.c - A use password prompting dialog widget.
Copyright (C) 1999, 2000 Eazel, Inc.
The Gnome Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The Gnome Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the Gnome Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
Authors: Ramiro Estrugo <ramiro@eazel.com>
*/
#include <config.h>
#include "nautilus-password-dialog.h"
#include "nautilus-caption-table.h"
#include <libgnomeui/gnome-stock.h>
#include <gtk/gtkmain.h>
#include <gtk/gtksignal.h>
#include <libnautilus-extensions/nautilus-gtk-macros.h>
struct _NautilusPasswordDialogDetail
{
char *username;
char *password;
gint last_button_clicked;
gboolean readonly_username;
GtkWidget *table;
GtkWidget *blurb;
};
enum
{
ACTIVATE,
LAST_SIGNAL
};
static const char * 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
{
USERNAME_ROW = 0,
PASSWORD_ROW
};
/* NautilusPasswordDialogClass methods */
static void nautilus_password_dialog_initialize_class (NautilusPasswordDialogClass *klass);
static void nautilus_password_dialog_initialize (NautilusPasswordDialog *password_dialog);
/* GtkObjectClass methods */
static void bnautilus_password_dialog_destroy (GtkObject *object);
/* GtkDialog callbacks */
static void dialog_clicked_callback (GtkWidget *widget,
gint n,
gpointer data);
static void dialog_show_callback (GtkWidget *widget,
gpointer data);
static void dialog_destroy_callback (GtkWidget *widget,
gpointer data);
/* NautilusCaptionTable callbacks */
static void caption_table_activate_callback (GtkWidget *widget,
gint entry,
gpointer data);
NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusPasswordDialog,
nautilus_password_dialog,
gnome_dialog_get_type ());
static void
nautilus_password_dialog_initialize_class (NautilusPasswordDialogClass * klass)
{
GtkObjectClass * object_class;
GtkWidgetClass * widget_class;
object_class = GTK_OBJECT_CLASS(klass);
widget_class = GTK_WIDGET_CLASS(klass);
/* GtkObjectClass */
object_class->destroy = bnautilus_password_dialog_destroy;
}
static void
nautilus_password_dialog_initialize (NautilusPasswordDialog *password_dialog)
{
password_dialog->detail = g_new (NautilusPasswordDialogDetail, 1);
password_dialog->detail->username = NULL;
password_dialog->detail->password = NULL;
password_dialog->detail->last_button_clicked = UNKNOWN_BUTTON;
password_dialog->detail->readonly_username = FALSE;
password_dialog->detail->table = NULL;
}
/* GtkDialog callbacks */
static void
dialog_clicked_callback (GtkWidget *widget, gint n, gpointer data)
{
NautilusPasswordDialog *password_dialog = (NautilusPasswordDialog *) data;
g_assert (password_dialog != NULL);
password_dialog->detail->last_button_clicked = n;
gtk_grab_remove(GTK_WIDGET (password_dialog));
gtk_widget_hide(GTK_WIDGET (password_dialog));
}
static void
dialog_show_callback (GtkWidget *widget, gpointer data)
{
NautilusPasswordDialog *password_dialog = (NautilusPasswordDialog *) data;
g_assert (password_dialog != NULL);
nautilus_caption_table_entry_grab_focus (NAUTILUS_CAPTION_TABLE (password_dialog->detail->table),
PASSWORD_ROW);
}
static void
dialog_destroy_callback (GtkWidget *widget, gpointer data)
{
NautilusPasswordDialog *password_dialog = (NautilusPasswordDialog *) data;
g_assert (password_dialog != NULL);
g_free (password_dialog->detail);
gtk_grab_remove(GTK_WIDGET (password_dialog));
}
/* NautilusCaptionTable callbacks */
static void
caption_table_activate_callback (GtkWidget *widget, gint entry, gpointer data)
{
NautilusPasswordDialog *password_dialog = (NautilusPasswordDialog *) data;
g_assert (password_dialog != NULL);
if (entry == (nautilus_caption_table_get_num_rows (NAUTILUS_CAPTION_TABLE (widget)) - 1))
dialog_clicked_callback(GTK_WIDGET (password_dialog), OK_BUTTON, (gpointer) password_dialog);
}
/* Public NautilusPasswordDialog methods */
GtkWidget*
nautilus_password_dialog_new (const char *dialog_title,
const char *username,
const char *password,
gboolean readonly_username)
{
NautilusPasswordDialog *password_dialog;
password_dialog = gtk_type_new (nautilus_password_dialog_get_type ());
gnome_dialog_constructv (GNOME_DIALOG (password_dialog), dialog_title, stock_buttons);
/* Setup the dialog */
gtk_window_set_policy (GTK_WINDOW (password_dialog),
FALSE, /* allow_shrink */
TRUE, /* allow_grow */
FALSE); /* auto_shrink */
gtk_widget_realize (GTK_WIDGET (password_dialog));
gdk_window_set_functions (GTK_WIDGET (password_dialog)->window,
GDK_FUNC_ALL | GDK_FUNC_RESIZE | GDK_FUNC_MINIMIZE);
gtk_window_set_position (GTK_WINDOW (password_dialog), GTK_WIN_POS_CENTER);
gtk_container_set_border_width (GTK_CONTAINER (password_dialog),
DEFAULT_BORDER_WIDTH);
gnome_dialog_set_default (GNOME_DIALOG (password_dialog),
DEFAULT_BUTTON);
gtk_signal_connect(GTK_OBJECT (password_dialog),
"clicked",
GTK_SIGNAL_FUNC (dialog_clicked_callback),
(gpointer) password_dialog);
gtk_signal_connect(GTK_OBJECT (password_dialog),
"show",
GTK_SIGNAL_FUNC (dialog_show_callback),
(gpointer) password_dialog);
gtk_signal_connect(GTK_OBJECT (password_dialog),
"destroy",
GTK_SIGNAL_FUNC (dialog_destroy_callback),
(gpointer) password_dialog);
/* The table that holds the captions */
password_dialog->detail->table = nautilus_caption_table_new (2);
gtk_signal_connect (GTK_OBJECT (password_dialog->detail->table),
"activate",
GTK_SIGNAL_FUNC (caption_table_activate_callback),
(gpointer) password_dialog);
nautilus_caption_table_set_row_info (NAUTILUS_CAPTION_TABLE (password_dialog->detail->table),
USERNAME_ROW,
"Username:",
"",
TRUE,
TRUE);
nautilus_caption_table_set_row_info (NAUTILUS_CAPTION_TABLE (password_dialog->detail->table),
PASSWORD_ROW,
"Password:",
"",
FALSE,
FALSE);
/* Configure the GNOME_DIALOG's vbox */
g_assert (GNOME_DIALOG (password_dialog)->vbox != NULL);
gtk_box_set_spacing (GTK_BOX (GNOME_DIALOG (password_dialog)->vbox), 10);
gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (password_dialog)->vbox),
password_dialog->detail->table,
TRUE, /* expand */
TRUE, /* fill */
0); /* padding */
/* Configure the table */
gtk_container_set_border_width (GTK_CONTAINER(password_dialog->detail->table),
DEFAULT_BORDER_WIDTH);
gtk_widget_show_all (GNOME_DIALOG (password_dialog)->vbox);
nautilus_password_dialog_set_username (password_dialog, username);
nautilus_password_dialog_set_password (password_dialog, password);
nautilus_password_dialog_set_readonly_username (password_dialog, readonly_username);
return GTK_WIDGET (password_dialog);
}
/* GtkObjectClass methods */
static void
bnautilus_password_dialog_destroy (GtkObject* object)
{
NautilusPasswordDialog *password_dialog;
g_return_if_fail (object != NULL);
g_return_if_fail (NAUTILUS_IS_PASSWORD_DIALOG (object));
password_dialog = NAUTILUS_PASSWORD_DIALOG (object);
if (password_dialog->detail->username)
g_free (password_dialog->detail->username);
if (password_dialog->detail->password)
g_free (password_dialog->detail->password);
}
gboolean
nautilus_password_dialog_run_and_block(NautilusPasswordDialog *password_dialog)
{
g_return_val_if_fail (password_dialog != NULL, FALSE);
g_return_val_if_fail (NAUTILUS_IS_PASSWORD_DIALOG (password_dialog), FALSE);
password_dialog->detail->last_button_clicked = UNKNOWN_BUTTON;
gtk_widget_show_all (GTK_WIDGET (password_dialog));
gtk_grab_add (GTK_WIDGET (password_dialog));
while (password_dialog->detail->last_button_clicked == UNKNOWN_BUTTON)
gtk_main_iteration ();
if (password_dialog->detail->last_button_clicked == OK_BUTTON)
return TRUE;
return FALSE;
}
void
nautilus_password_dialog_set_username (NautilusPasswordDialog *password_dialog,
const char * username)
{
g_return_if_fail (password_dialog != NULL);
g_return_if_fail (NAUTILUS_IS_PASSWORD_DIALOG (password_dialog));
nautilus_caption_table_set_entry_text (NAUTILUS_CAPTION_TABLE (password_dialog->detail->table),
USERNAME_ROW,
username);
}
void
nautilus_password_dialog_set_password (NautilusPasswordDialog *password_dialog,
const char * password)
{
g_return_if_fail (password_dialog != NULL);
g_return_if_fail (NAUTILUS_IS_PASSWORD_DIALOG (password_dialog));
nautilus_caption_table_set_entry_text (NAUTILUS_CAPTION_TABLE (password_dialog->detail->table),
PASSWORD_ROW,
password);
}
void
nautilus_password_dialog_set_readonly_username (NautilusPasswordDialog *password_dialog,
gboolean readonly)
{
g_return_if_fail (password_dialog != NULL);
g_return_if_fail (NAUTILUS_IS_PASSWORD_DIALOG (password_dialog));
nautilus_caption_table_set_entry_readonly (NAUTILUS_CAPTION_TABLE (password_dialog->detail->table),
USERNAME_ROW,
readonly);
}
char *
nautilus_password_dialog_get_username (NautilusPasswordDialog *password_dialog)
{
g_return_val_if_fail (password_dialog != NULL, NULL);
g_return_val_if_fail (NAUTILUS_IS_PASSWORD_DIALOG (password_dialog), NULL);
return nautilus_caption_table_get_entry_text (NAUTILUS_CAPTION_TABLE (password_dialog->detail->table),
USERNAME_ROW);
}
char *
nautilus_password_dialog_get_password (NautilusPasswordDialog *password_dialog)
{
g_return_val_if_fail (password_dialog != NULL, NULL);
g_return_val_if_fail (NAUTILUS_IS_PASSWORD_DIALOG (password_dialog), NULL);
return nautilus_caption_table_get_entry_text (NAUTILUS_CAPTION_TABLE (password_dialog->detail->table),
PASSWORD_ROW);
}

View file

@ -1,72 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* nautilus-password-dialog.h - A use password prompting dialog widget.
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_PASSWORD_DIALOG_H
#define NAUTILUS_PASSWORD_DIALOG_H
#include <libgnomeui/gnome-dialog.h>
BEGIN_GNOME_DECLS
#define GTK_TYPE_AUTH_DIALOG (nautilus_password_dialog_get_type ())
#define NAUTILUS_PASSWORD_DIALOG(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_AUTH_DIALOG, NautilusPasswordDialog))
#define NAUTILUS_PASSWORD_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_AUTH_DIALOG, NautilusPasswordDialogClass))
#define NAUTILUS_IS_PASSWORD_DIALOG(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_AUTH_DIALOG))
#define NAUTILUS_IS_PASSWORD_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_AUTH_DIALOG))
typedef struct _NautilusPasswordDialog NautilusPasswordDialog;
typedef struct _NautilusPasswordDialogClass NautilusPasswordDialogClass;
typedef struct _NautilusPasswordDialogDetail NautilusPasswordDialogDetail;
struct _NautilusPasswordDialog
{
GnomeDialog gnome_dialog;
NautilusPasswordDialogDetail *detail;
};
struct _NautilusPasswordDialogClass
{
GnomeDialogClass parent_class;
};
GtkType nautilus_password_dialog_get_type (void);
GtkWidget* nautilus_password_dialog_new (const char *dialog_title,
const char *username,
const char *password,
gboolean readonly_username);
gboolean nautilus_password_dialog_run_and_block (NautilusPasswordDialog *auth_dialog);
void nautilus_password_dialog_set_username (NautilusPasswordDialog *auth_dialog,
const char *username);
void nautilus_password_dialog_set_password (NautilusPasswordDialog *auth_dialog,
const char *password);
void nautilus_password_dialog_set_readonly_username (NautilusPasswordDialog *auth_dialog,
gboolean readonly);
char * nautilus_password_dialog_get_username (NautilusPasswordDialog *auth_dialog);
char * nautilus_password_dialog_get_password (NautilusPasswordDialog *auth_dialog);
BEGIN_GNOME_DECLS
#endif /* NAUTILUS_PASSWORD_DIALOG_H */

View file

@ -1,907 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* nautilus-preference.c - An object to describe a single Nautilus preference.
Copyright (C) 1999, 2000 Eazel, Inc.
The Gnome Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The Gnome Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the Gnome Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
Authors: Ramiro Estrugo <ramiro@eazel.com>
*/
#include <config.h>
#include "nautilus-preference.h"
#include <stdio.h>
#include <stdlib.h>
#include <libnautilus-extensions/nautilus-gtk-macros.h>
#include <libnautilus-extensions/nautilus-string-list.h>
#include "nautilus-widgets-self-check-functions.h"
#include <nautilus-widgets/nautilus-user-level-manager.h>
/*
* PreferenceHashNode:
*
* A structure to manage preference hash table nodes.
* Preferences are hash tables. The hash key is the preference name
* (a string). The hash value is a pointer of the following struct:
*/
typedef struct {
NautilusPreference *preference;
} PreferenceHashNode;
static GHashTable *global_preference_table = NULL;
static const char PREFERENCE_NO_DESCRIPTION[] = "No Description";
/*
* NautilusPreferenceDetail:
*
* Private members for NautilusPreference.
*/
struct NautilusPreferenceDetail {
char *name;
char *description;
NautilusPreferenceType type;
gpointer type_info;
};
typedef struct {
NautilusStringList *names;
NautilusStringList *descriptions;
GList *values;
guint num_entries;
} PreferenceEnumInfo;
/* NautilusPreferenceClass methods */
static void nautilus_preference_initialize_class (NautilusPreferenceClass *klass);
static void nautilus_preference_initialize (NautilusPreference *preference);
/* GtkObjectClass methods */
static void nautilus_preference_destroy (GtkObject *object);
/* Type info functions */
static void preference_free_type_info (NautilusPreference *preference);
static gboolean preference_initialize_if_needed (void);
void nautilus_preference_shutdown (void);
/* PreferenceHashNode functions */
static PreferenceHashNode * preference_hash_node_alloc (char *name,
char *description,
NautilusPreferenceType type);
static void preference_hash_node_free (PreferenceHashNode *node);
static void preference_hash_node_free_func (gpointer key,
gpointer value,
gpointer user_data);
/* Private stuff */
static PreferenceHashNode * preference_hash_node_lookup (const char *name);
static PreferenceHashNode * preference_hash_node_lookup_with_registration (const char *pref_name,
NautilusPreferenceType pref_type);
static void preference_register (char *name,
char *description,
NautilusPreferenceType type);
static gboolean
preference_initialize_if_needed (void)
{
if (global_preference_table) {
return TRUE;
}
g_assert (global_preference_table == NULL);
global_preference_table = g_hash_table_new (g_str_hash, g_str_equal);
g_assert (global_preference_table != NULL);
return TRUE;
}
NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusPreference, nautilus_preference, GTK_TYPE_OBJECT)
/**
* nautilus_preference_initialize_class
*
* NautilusPreferenceClass class initialization method.
* @preference_class: The class to initialize.
*
**/
static void
nautilus_preference_initialize_class (NautilusPreferenceClass *preference_class)
{
GtkObjectClass *object_class;
object_class = GTK_OBJECT_CLASS (preference_class);
parent_class = gtk_type_class (gtk_object_get_type ());
/* GtkObjectClass */
object_class->destroy = nautilus_preference_destroy;
}
/**
* nautilus_preference_initialize
*
* GtkObject initialization method.
* @object: The NautilusPreference object to initialize.
*
**/
static void
nautilus_preference_initialize (NautilusPreference *preference)
{
preference->detail = g_new (NautilusPreferenceDetail, 1);
preference->detail->name = NULL;
preference->detail->description = NULL;
preference->detail->type_info = NULL;
preference->detail->type = NAUTILUS_PREFERENCE_STRING;
}
/**
* nautilus_preference_destroy
*
* GtkObject destruction method. Chains to super class.
* @object: The NautilusPreference object to destroy.
*
**/
static void
nautilus_preference_destroy (GtkObject *object)
{
NautilusPreference *preference;
preference = NAUTILUS_PREFERENCE (object);
if (preference->detail->name != NULL)
g_free (preference->detail->name);
if (preference->detail->description != NULL)
g_free (preference->detail->description);
preference_free_type_info (preference);
g_free (preference->detail);
/* Chain */
NAUTILUS_CALL_PARENT_CLASS (GTK_OBJECT_CLASS, destroy, (object));
}
/**
* preference_free_type_info
*
* Free the type specific info attatched to this type
* @preference: Pointer to self.
*
**/
static void
preference_free_type_info (NautilusPreference *preference)
{
g_assert (preference != NULL);
g_assert (NAUTILUS_IS_PREFERENCE (preference));
switch (preference->detail->type)
{
case NAUTILUS_PREFERENCE_ENUM:
if (preference->detail->type_info) {
PreferenceEnumInfo * info;
info = (PreferenceEnumInfo *) preference->detail->type_info;
if (info->names)
nautilus_string_list_free (info->names);
if (info->descriptions)
nautilus_string_list_free (info->descriptions);
if (info->values)
g_list_free (info->values);
info->num_entries = 0;
g_free (preference->detail->type_info);
}
break;
default:
break;
}
preference->detail->type_info = NULL;
}
/**
* preference_type_info_allocate
*
* Allocate the type specific info attatched to this type
* @preference: Pointer to self.
*
**/
static void
preference_allocate_type_info (NautilusPreference *preference)
{
g_assert (NAUTILUS_IS_PREFERENCE (preference));
switch (preference->detail->type)
{
case NAUTILUS_PREFERENCE_ENUM:
{
PreferenceEnumInfo * info;
g_assert (preference->detail->type_info == NULL);
info = g_new (PreferenceEnumInfo, 1);
info->names = nautilus_string_list_new ();
info->descriptions = nautilus_string_list_new ();
info->values = NULL;
info->num_entries = 0;
preference->detail->type_info = (gpointer) info;
}
break;
default:
break;
}
}
/**
* nautilus_preference_new
*
* Allocate a new preference object. By default, preferences created with this
* function will have a type of NAUTILUS_PREFERENCE_STRING.
* @name: The name of the preference.
*
* Return value: A newly allocated preference.
*
**/
GtkObject *
nautilus_preference_new (const char *name)
{
g_return_val_if_fail (name != NULL, NULL);
return nautilus_preference_new_from_type (name, NAUTILUS_PREFERENCE_STRING);
}
/**
* nautilus_preference_new_from_type
*
* Allocate a new preference object with the given type.
* @name: The name of the preference.
* @type: The type for the new preference.
*
* Return value: A newly allocated preference.
*
**/
GtkObject *
nautilus_preference_new_from_type (const char *name,
NautilusPreferenceType type)
{
NautilusPreference *preference;
g_return_val_if_fail (name != NULL, NULL);
preference = gtk_type_new (nautilus_preference_get_type ());
g_assert (preference != NULL );
preference->detail->name = g_strdup (name);
preference->detail->type = type;
preference_allocate_type_info (preference);
return GTK_OBJECT (preference);
}
/**
* nautilus_preference_get_preference_type
*
* Get the type for the given preference.
* @preference: The preference object.
*
* Return value: The type for the preference.
*
**/
NautilusPreferenceType
nautilus_preference_get_preference_type (const NautilusPreference *preference)
{
g_return_val_if_fail (preference != NULL, NAUTILUS_PREFERENCE_STRING);
g_return_val_if_fail (NAUTILUS_IS_PREFERENCE (preference), NAUTILUS_PREFERENCE_STRING);
return preference->detail->type;
}
/**
* nautilus_preference_set_preference_type
*
* Set the type for the given preference. Yes it possible to morph the preference type
* in midair. This is actually an important feature so that users of preferences can pull
* them out of their assess without having to register them first. Changing the preference
* type is guranteed not to leak resources regardless of the old/new types. (such as extra
* enum type info).
*
* @preference: The preference object.
* @type: The new type of the preference.
*
**/
void
nautilus_preference_set_preference_type (NautilusPreference *preference,
NautilusPreferenceType type)
{
g_return_if_fail (preference != NULL);
g_return_if_fail (NAUTILUS_IS_PREFERENCE (preference));
/* cmon */
if (preference->detail->type == type)
return;
/* Free the old type info */
preference_free_type_info (preference);
preference->detail->type = type;
/* allocate the new type info */
preference_allocate_type_info (preference);
}
/**
* nautilus_preference_get_name
*
* Get a copy of the name for the given preference.
* @preference: The preference object.
*
* Return value: A newly allocated string with the prefrence name. This function is always
* guranteed to return a valid newly allocated string (the default is "").
*
**/
char *
nautilus_preference_get_name (const NautilusPreference *preference)
{
g_return_val_if_fail (preference != NULL, NULL);
g_return_val_if_fail (NAUTILUS_IS_PREFERENCE (preference), NULL);
return g_strdup (preference->detail->name ? preference->detail->name : "");
}
/**
* nautilus_preference_get_description
*
* Get a copy of the description for the given preference.
* @preference: The preference object.
*
* Return value: A newly allocated string with the prefrence description. This function is always
* guranteed to return a valid newly allocated string (the default is "").
*
**/
char *
nautilus_preference_get_description (const NautilusPreference *preference)
{
g_return_val_if_fail (preference != NULL, NULL);
g_return_val_if_fail (NAUTILUS_IS_PREFERENCE (preference), NULL);
return g_strdup (preference->detail->description ?
preference->detail->description :
PREFERENCE_NO_DESCRIPTION);
}
/**
* nautilus_preference_set_description
*
* Set the description for the current preference.
* @preference: The preference object.
* @description: The new description string.
*
**/
void
nautilus_preference_set_description (NautilusPreference *preference,
const char * description)
{
g_return_if_fail (preference != NULL);
g_return_if_fail (NAUTILUS_IS_PREFERENCE (preference));
g_return_if_fail (description != NULL);
if (preference->detail->description)
g_free (preference->detail->description);
preference->detail->description = g_strdup (description);
}
void
nautilus_preference_enum_add_entry (NautilusPreference *preference,
const char *entry_name,
const char *entry_description,
gint entry_value)
{
PreferenceEnumInfo *info;
g_return_if_fail (preference != NULL);
g_return_if_fail (NAUTILUS_IS_PREFERENCE (preference));
g_return_if_fail (preference->detail->type == NAUTILUS_PREFERENCE_ENUM);
g_return_if_fail (entry_name != NULL);
g_assert (preference->detail->type_info != NULL);
info = (PreferenceEnumInfo *) preference->detail->type_info;
nautilus_string_list_insert (info->names, entry_name);
nautilus_string_list_insert (info->descriptions,
entry_description ? entry_description : PREFERENCE_NO_DESCRIPTION);
info->values = g_list_append (info->values, GINT_TO_POINTER (entry_value));
info->num_entries++;
}
char *
nautilus_preference_enum_get_nth_entry_name (const NautilusPreference *preference,
guint n)
{
PreferenceEnumInfo *info;
g_return_val_if_fail (preference != NULL, NULL);
g_return_val_if_fail (NAUTILUS_IS_PREFERENCE (preference), NULL);
g_return_val_if_fail (preference->detail->type == NAUTILUS_PREFERENCE_ENUM, NULL);
g_assert (preference->detail->type_info != NULL);
info = (PreferenceEnumInfo *) preference->detail->type_info;
if (n < nautilus_string_list_get_length (info->names))
return nautilus_string_list_nth (info->names, n);
return NULL;
}
char *
nautilus_preference_enum_get_nth_entry_description (const NautilusPreference *preference,
guint n)
{
PreferenceEnumInfo *info;
g_return_val_if_fail (preference != NULL, NULL);
g_return_val_if_fail (NAUTILUS_IS_PREFERENCE (preference), NULL);
g_return_val_if_fail (preference->detail->type == NAUTILUS_PREFERENCE_ENUM, NULL);
g_assert (preference->detail->type_info != NULL);
info = (PreferenceEnumInfo *) preference->detail->type_info;
if (n < nautilus_string_list_get_length (info->descriptions))
return nautilus_string_list_nth (info->descriptions, n);
return NULL;
}
gint
nautilus_preference_enum_get_nth_entry_value (const NautilusPreference *preference,
guint n)
{
PreferenceEnumInfo *info;
g_return_val_if_fail (preference != NULL, 0);
g_return_val_if_fail (NAUTILUS_IS_PREFERENCE (preference), 0);
g_return_val_if_fail (preference->detail->type == NAUTILUS_PREFERENCE_ENUM, 0);
g_assert (preference->detail->type_info != NULL);
info = (PreferenceEnumInfo *) preference->detail->type_info;
if (n < g_list_length (info->values))
return GPOINTER_TO_INT (g_list_nth_data (info->values, n));
return 0;
}
guint
nautilus_preference_enum_get_num_entries (const NautilusPreference *preference)
{
g_return_val_if_fail (preference != NULL, 0);
g_return_val_if_fail (NAUTILUS_IS_PREFERENCE (preference), 0);
g_return_val_if_fail (preference->detail->type == NAUTILUS_PREFERENCE_ENUM, 0);
if (preference->detail->type_info) {
PreferenceEnumInfo *info = (PreferenceEnumInfo *) preference->detail->type_info;
return info->num_entries;
}
return 0;
}
/**
* preference_hash_node_alloc
*
* Allocate a preference hash node.
* @info: Pointer to info structure to use for the node memebers.
*
* Return value: A newly allocated node.
**/
static PreferenceHashNode *
preference_hash_node_alloc (char *name,
char *description,
NautilusPreferenceType type)
{
PreferenceHashNode * node;
g_assert (name != NULL);
node = g_new (PreferenceHashNode, 1);
node->preference = NAUTILUS_PREFERENCE (nautilus_preference_new_from_type (name, type));
g_assert (node->preference != NULL);
if (description) {
nautilus_preference_set_description (node->preference, description);
}
return node;
}
/**
* preference_hash_node_free_func
*
* A function that frees a pref hash node. It is meant to be fed to
* g_hash_table_foreach ()
* @key: The hash key privately maintained by the GHashTable.
* @value: The hash value privately maintained by the GHashTable.
* @callback_data: The callback_data privately maintained by the GHashTable.
**/
static void
preference_hash_node_free_func (gpointer key,
gpointer value,
gpointer user_data)
{
g_assert (value != NULL);
preference_hash_node_free ((PreferenceHashNode *) value);
}
/**
* preference_hash_node_free
*
* Free a preference hash node members along with the node itself.
* @preference_hash_node: The node to free.
**/
static void
preference_hash_node_free (PreferenceHashNode *node)
{
g_assert (node != NULL);
g_assert (node->preference != NULL);
gtk_object_unref (GTK_OBJECT (node->preference));
node->preference = NULL;
g_free (node);
}
static void
preference_register (char *name,
char *description,
NautilusPreferenceType type)
{
PreferenceHashNode *node;
g_return_if_fail (name != NULL);
g_return_if_fail (description != NULL);
preference_initialize_if_needed ();
node = preference_hash_node_lookup (name);
if (node) {
g_warning ("the '%s' preference is already registered", name);
return;
}
node = preference_hash_node_alloc (name, description, type);
g_hash_table_insert (global_preference_table, (gpointer) name, (gpointer) node);
g_assert (node->preference != NULL);
}
static PreferenceHashNode *
preference_hash_node_lookup (const char *name)
{
gpointer hash_value;
g_assert (name != NULL);
preference_initialize_if_needed ();
hash_value = g_hash_table_lookup (global_preference_table, (gconstpointer) name);
return (PreferenceHashNode *) hash_value;
}
static PreferenceHashNode *
preference_hash_node_lookup_with_registration (const char *name,
NautilusPreferenceType type)
{
PreferenceHashNode * node;
g_assert (name != NULL);
preference_initialize_if_needed ();
node = preference_hash_node_lookup (name);
if (!node) {
preference_register (g_strdup (name),
"Unspecified Description",
type);
node = preference_hash_node_lookup (name);
}
g_assert (node != NULL);
return node;
}
void
nautilus_preference_shutdown (void)
{
if (global_preference_table == NULL) {
return;
}
if (global_preference_table != NULL) {
g_hash_table_foreach (global_preference_table,
preference_hash_node_free_func,
NULL);
g_hash_table_destroy (global_preference_table);
global_preference_table = NULL;
}
}
/*
* Public functions
*/
/**
* nautilus_preference_find_by_name
*
* Search for a named preference in the given preference and return it.
* @preference: The preference to search
*
* Return value: A referenced pointer to the preference object that corresponds
* to the given preference name. The caller should gtk_object_unref() the return
* value of this function.
**/
NautilusPreference *
nautilus_preference_find_by_name (const char *name)
{
PreferenceHashNode *node;
g_return_val_if_fail (name != NULL, NULL);
preference_initialize_if_needed ();
node = preference_hash_node_lookup (name);
g_assert (node != NULL);
gtk_object_ref (GTK_OBJECT (node->preference));
return node->preference;
}
void
nautilus_preference_set_info_by_name (const char *name,
const char *description,
NautilusPreferenceType type,
gconstpointer *default_values,
guint num_default_values)
{
PreferenceHashNode *node;
g_return_if_fail (name != NULL);
preference_initialize_if_needed ();
node = preference_hash_node_lookup_with_registration (name, type);
g_assert (node != NULL);
g_assert (node->preference != NULL);
if (description) {
nautilus_preference_set_description (node->preference, description);
}
if (default_values && num_default_values) {
guint i;
for (i = 0; i < num_default_values; i++)
{
nautilus_user_level_manager_set_default_value_if_needed (name,
type,
i,
default_values[i]);
}
}
}
void
nautilus_preference_enum_add_entry_by_name (const char *name,
const char *entry_name,
const char *entry_description,
int entry_value)
{
PreferenceHashNode *node;
g_return_if_fail (name != NULL);
preference_initialize_if_needed ();
node = preference_hash_node_lookup_with_registration (name, NAUTILUS_PREFERENCE_ENUM);
g_assert (node != NULL);
g_assert (node->preference != NULL);
g_assert (nautilus_preference_get_preference_type (node->preference) == NAUTILUS_PREFERENCE_ENUM);
nautilus_preference_enum_add_entry (node->preference,
entry_name,
entry_description,
entry_value);
}
#if !defined (NAUTILUS_OMIT_SELF_CHECK)
void
nautilus_widgets_self_check_preference (void)
{
NautilusPreference *preference;
preference = NAUTILUS_PREFERENCE (nautilus_preference_new ("foo/bar"));
NAUTILUS_CHECK_INTEGER_RESULT (nautilus_preference_get_preference_type (preference), NAUTILUS_PREFERENCE_STRING);
/* Test boolean things */
{
NautilusPreference *bp;
bp = NAUTILUS_PREFERENCE (nautilus_preference_new_from_type ("active", NAUTILUS_PREFERENCE_BOOLEAN));
nautilus_preference_set_description (bp, "Is it active ?");
NAUTILUS_CHECK_STRING_RESULT (nautilus_preference_get_name (bp), "active");
NAUTILUS_CHECK_STRING_RESULT (nautilus_preference_get_description (bp), "Is it active ?");
gtk_object_unref (GTK_OBJECT (bp));
}
/* Test enumeration things */
{
NautilusPreference *ep;
ep = NAUTILUS_PREFERENCE (nautilus_preference_new_from_type ("color",NAUTILUS_PREFERENCE_ENUM));
nautilus_preference_enum_add_entry (ep, "red", "A red something", 100);
nautilus_preference_enum_add_entry (ep, "green", "A green something", 200);
nautilus_preference_enum_add_entry (ep, "blue", "A blue something", 300);
NAUTILUS_CHECK_STRING_RESULT (nautilus_preference_get_name (ep), "color");
NAUTILUS_CHECK_INTEGER_RESULT (nautilus_preference_enum_get_num_entries (ep), 3);
NAUTILUS_CHECK_STRING_RESULT (nautilus_preference_enum_get_nth_entry_name (ep, 0), "red");
NAUTILUS_CHECK_STRING_RESULT (nautilus_preference_enum_get_nth_entry_name (ep, 1), "green");
NAUTILUS_CHECK_STRING_RESULT (nautilus_preference_enum_get_nth_entry_name (ep, 2), "blue");
NAUTILUS_CHECK_INTEGER_RESULT (nautilus_preference_enum_get_nth_entry_value (ep, 0), 100);
NAUTILUS_CHECK_INTEGER_RESULT (nautilus_preference_enum_get_nth_entry_value (ep, 1), 200);
NAUTILUS_CHECK_INTEGER_RESULT (nautilus_preference_enum_get_nth_entry_value (ep, 2), 300);
gtk_object_unref (GTK_OBJECT (ep));
}
/* Test string things */
{
NautilusPreference *sp;
sp = NAUTILUS_PREFERENCE (nautilus_preference_new_from_type ("font", NAUTILUS_PREFERENCE_STRING));
NAUTILUS_CHECK_STRING_RESULT (nautilus_preference_get_name (sp), "font");
gtk_object_unref (GTK_OBJECT (sp));
}
/* Allocate a bunch of preference objects to test that they dont leak */
{
const guint num_to_allocate = 20; /* larger number is too slow with memprof */
guint i;
for (i = 0; i < num_to_allocate; i++)
{
NautilusPreference *bp;
char *bn;
bn = g_strdup_printf ("bp_%d", i);
bp = NAUTILUS_PREFERENCE (nautilus_preference_new_from_type (bn, NAUTILUS_PREFERENCE_BOOLEAN));
g_free (bn);
gtk_object_unref (GTK_OBJECT (bp));
}
for (i = 0; i < num_to_allocate; i++)
{
NautilusPreference *ep;
char *en;
en = g_strdup_printf ("ep_%d", i);
ep = NAUTILUS_PREFERENCE (nautilus_preference_new_from_type (en, NAUTILUS_PREFERENCE_ENUM));
nautilus_preference_enum_add_entry (ep, "small", "A small foo", 1);
nautilus_preference_enum_add_entry (ep, "medium", "A medium foo", 2);
nautilus_preference_enum_add_entry (ep, "large", "A large foo", 3);
g_free (en);
gtk_object_unref (GTK_OBJECT (ep));
}
for (i = 0; i < num_to_allocate; i++)
{
NautilusPreference *sp;
char *sn;
sn = g_strdup_printf ("sp_%d", i);
sp = NAUTILUS_PREFERENCE (nautilus_preference_new_from_type (sn, NAUTILUS_PREFERENCE_STRING));
g_free (sn);
gtk_object_unref (GTK_OBJECT (sp));
}
}
}
#endif /* !NAUTILUS_OMIT_SELF_CHECK */

View file

@ -1,112 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* nautilus-preference.h - An object to describe a single Nautilus preference.
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_PREFERENCE_H
#define NAUTILUS_PREFERENCE_H
#include <gtk/gtkobject.h>
#include <libgnome/gnome-defs.h>
#include <libnautilus-extensions/nautilus-string-list.h>
BEGIN_GNOME_DECLS
#define NAUTILUS_TYPE_PREFERENCE (nautilus_preference_get_type ())
#define NAUTILUS_PREFERENCE(obj) (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_PREFERENCE, NautilusPreference))
#define NAUTILUS_PREFERENCE_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_PREFERENCE, NautilusPreferenceClass))
#define NAUTILUS_IS_PREFERENCE(obj) (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_PREFERENCE))
#define NAUTILUS_IS_PREFERENCE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_PREFERENCE))
typedef struct NautilusPreference NautilusPreference;
typedef struct NautilusPreferenceClass NautilusPreferenceClass;
typedef struct NautilusPreferenceDetail NautilusPreferenceDetail;
struct NautilusPreference
{
GtkObject object;
NautilusPreferenceDetail *detail;
};
/*
* NautilusPreferenceType:
*
* The types of supported preferences. By default, a preference is of type
* NAUTILUS_PREFERENCE_STRING, unless otherwise specified in the api.
*/
typedef enum
{
NAUTILUS_PREFERENCE_STRING,
NAUTILUS_PREFERENCE_BOOLEAN,
NAUTILUS_PREFERENCE_ENUM
} NautilusPreferenceType;
struct NautilusPreferenceClass
{
GtkObjectClass object_class;
};
GtkType nautilus_preference_get_type (void);
GtkObject * nautilus_preference_new (const char *name);
GtkObject * nautilus_preference_new_from_type (const char *name,
NautilusPreferenceType type);
NautilusPreferenceType nautilus_preference_get_preference_type (const NautilusPreference *preference);
void nautilus_preference_set_preference_type (NautilusPreference *preference,
NautilusPreferenceType type);
char * nautilus_preference_get_name (const NautilusPreference *preference);
char * nautilus_preference_get_description (const NautilusPreference *preference);
void nautilus_preference_set_description (NautilusPreference *preference,
const char *description);
/* Methods to deal with enum preferences */
void nautilus_preference_enum_add_entry (NautilusPreference *preference,
const char *entry_name,
const char *entry_description,
gint entry_value);
char * nautilus_preference_enum_get_nth_entry_name (const NautilusPreference *preference,
guint n);
char * nautilus_preference_enum_get_nth_entry_description (const NautilusPreference *preference,
guint n);
gint nautilus_preference_enum_get_nth_entry_value (const NautilusPreference *preference,
guint n);
guint nautilus_preference_enum_get_num_entries (const NautilusPreference *preference);
/*
*
*/
NautilusPreference *nautilus_preference_find_by_name (const char *name);
void nautilus_preference_set_info_by_name (const char *name,
const char *description,
NautilusPreferenceType type,
gconstpointer *default_values,
guint num_default_values);
void nautilus_preference_enum_add_entry_by_name (const char *name,
const char *entry_name,
const char *entry_description,
int entry_value);
void nautilus_preference_shutdown (void);
BEGIN_GNOME_DECLS
#endif /* NAUTILUS_PREFERENCE_H */

View file

@ -1,356 +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 <config.h>
#include <nautilus-widgets/nautilus-preferences-box.h>
#include <libnautilus-extensions/nautilus-gtk-macros.h>
#include <gtk/gtkclist.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 _NautilusPreferencesBoxDetails
{
GtkWidget *category_list;
GtkWidget *pane_container;
GList *panes;
gint selected_pane;
};
typedef void (*GnomeBoxSignal1) (GtkObject* object,
gint arg1,
gpointer data);
/* NautilusPreferencesBoxClass methods */
static void nautilus_preferences_box_initialize_class (NautilusPreferencesBoxClass *klass);
static void nautilus_preferences_box_initialize (NautilusPreferencesBox *prefs_box);
/* GtkObjectClass methods */
static void nautilus_preferences_box_destroy (GtkObject *object);
/* Misc private stuff */
static void prefs_box_construct (NautilusPreferencesBox *prefs_box);
static void prefs_box_select_pane (NautilusPreferencesBox *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 (NautilusPreferencesBox, nautilus_preferences_box, GTK_TYPE_HBOX)
/*
* NautilusPreferencesBoxClass methods
*/
static void
nautilus_preferences_box_initialize_class (NautilusPreferencesBoxClass *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_preferences_box_destroy;
}
static void
nautilus_preferences_box_initialize (NautilusPreferencesBox *prefs_box)
{
prefs_box->details = g_new (NautilusPreferencesBoxDetails, 1);
prefs_box->details->category_list = NULL;
prefs_box->details->pane_container = NULL;
prefs_box->details->panes = NULL;
prefs_box->details->selected_pane = PREFS_SELECTED_PANE_UNKNOWN;
}
/*
* GtkObjectClass methods
*/
static void
nautilus_preferences_box_destroy (GtkObject *object)
{
NautilusPreferencesBox * prefs_box;
g_return_if_fail (object != NULL);
g_return_if_fail (NAUTILUS_IS_PREFS_BOX (object));
prefs_box = NAUTILUS_PREFERENCES_BOX (object);
if (prefs_box->details->panes)
{
GList *panes;
panes = prefs_box->details->panes;
while (panes)
{
PaneInfo * info = panes->data;
g_assert (info != NULL);
pane_info_free (info);
panes = panes->next;
}
g_list_free (prefs_box->details->panes);
}
g_free (prefs_box->details);
/* Chain */
if (GTK_OBJECT_CLASS (parent_class)->destroy != NULL)
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
}
/*
* Misc private stuff
*/
static void
prefs_box_construct (NautilusPreferencesBox *prefs_box)
{
g_assert (prefs_box != NULL);
g_assert (prefs_box->details != NULL);
g_assert (prefs_box->details->category_list == NULL);
g_assert (prefs_box->details->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->details->category_list =
gtk_clist_new (PREFS_BOX_NUM_CATEGORY_COLUMNS);
gtk_signal_connect (GTK_OBJECT (prefs_box->details->category_list),
"select_row",
GTK_SIGNAL_FUNC (category_list_select_row),
(gpointer) prefs_box);
gtk_clist_set_selection_mode (GTK_CLIST (prefs_box->details->category_list),
GTK_SELECTION_BROWSE);
gtk_clist_set_column_auto_resize (GTK_CLIST (prefs_box->details->category_list),
PREFS_BOX_CATEGORY_COLUMN,
TRUE);
gtk_box_pack_start (GTK_BOX (prefs_box),
prefs_box->details->category_list,
FALSE,
TRUE,
0);
gtk_widget_show (prefs_box->details->category_list);
}
static void
prefs_box_select_pane (NautilusPreferencesBox *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->details != NULL);
g_assert (prefs_box->details->panes != NULL);
g_assert (pane_row < g_list_length (prefs_box->details->panes));
pane_node = g_list_nth (prefs_box->details->panes, pane_row);
g_assert (pane_node != NULL);
pane_info = pane_node->data;
/* Show only the corresponding pane widget */
pane_iterator = prefs_box->details->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;
}
gtk_widget_show (info->pane_widget);
}
else
{
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)
{
NautilusPreferencesBox *prefs_box = (NautilusPreferencesBox *) user_data;
g_assert (prefs_box != NULL);
g_assert (NAUTILUS_IS_PREFS_BOX (prefs_box));
prefs_box_select_pane (prefs_box, (guint) row);
}
/*
* NautilusPreferencesBox public methods
*/
GtkWidget*
nautilus_preferences_box_new (const gchar *box_title)
{
NautilusPreferencesBox *prefs_box;
prefs_box = gtk_type_new (nautilus_preferences_box_get_type ());
prefs_box_construct (prefs_box);
return GTK_WIDGET (prefs_box);
}
GtkWidget *
nautilus_preferences_box_add_pane (NautilusPreferencesBox *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->details->panes = g_list_append (prefs_box->details->panes,
(gpointer) info);
info->pane_widget = nautilus_preferences_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->details->category_list),
text);
return info->pane_widget;
}

View file

@ -1,70 +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_PREFERENCES_BOX_H
#define NAUTILUS_PREFERENCES_BOX_H
#include <libgnomeui/gnome-dialog.h>
#include <gtk/gtkhbox.h>
#include <nautilus-widgets/nautilus-preferences-pane.h>
BEGIN_GNOME_DECLS
#define NAUTILUS_TYPE_PREFS_BOX (nautilus_preferences_box_get_type ())
#define NAUTILUS_PREFERENCES_BOX(obj) (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_PREFS_BOX, NautilusPreferencesBox))
#define NAUTILUS_PREFERENCES_BOX_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_PREFS_BOX, NautilusPreferencesBoxClass))
#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 _NautilusPreferencesBox NautilusPreferencesBox;
typedef struct _NautilusPreferencesBoxClass NautilusPreferencesBoxClass;
typedef struct _NautilusPreferencesBoxDetails NautilusPreferencesBoxDetails;
struct _NautilusPreferencesBox
{
/* Super Class */
GtkHBox hbox;
/* Private stuff */
NautilusPreferencesBoxDetails *details;
};
struct _NautilusPreferencesBoxClass
{
GtkHBoxClass parent_class;
void (*activate) (GtkWidget * prefs_box, gint entry_number);
};
GtkType nautilus_preferences_box_get_type (void);
GtkWidget* nautilus_preferences_box_new (const gchar *box_title);
GtkWidget* nautilus_preferences_box_add_pane (NautilusPreferencesBox *prefs_box,
const gchar *pane_title,
const gchar *pane_description);
BEGIN_GNOME_DECLS
#endif /* NAUTILUS_PREFERENCES_BOX_H */

View file

@ -1,251 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* nautilus-preferences-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 <config.h>
#include <nautilus-widgets/nautilus-preferences-dialog.h>
#include <libnautilus-extensions/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 _NautilusPreferencesDialogDetails
{
GtkWidget *prefs_box;
};
static const gchar * stock_buttons[] =
{
"OK",
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;
static const guint PREFS_DIALOG_DEFAULT_WIDTH = 500;
static const guint PREFS_DIALOG_DEFAULT_HEIGHT = 300;
enum
{
COMMAND_ROW = 0,
USERNAME_ROW,
PASSWORD_ROW
};
/* NautilusPreferencesDialogClass methods */
static void nautilus_preferences_dialog_initialize_class (NautilusPreferencesDialogClass *klass);
static void nautilus_preferences_dialog_initialize (NautilusPreferencesDialog *prefs_dialog);
/* GtkObjectClass methods */
static void nautilus_preferences_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_preferences_dialog_construct (NautilusPreferencesDialog *prefs_dialog,
const gchar *dialog_title);
NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusPreferencesDialog,
nautilus_preferences_dialog,
gnome_dialog_get_type ())
/*
* NautilusPreferencesDialogClass methods
*/
static void
nautilus_preferences_dialog_initialize_class (NautilusPreferencesDialogClass * 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_preferences_dialog_destroy;
}
static void
nautilus_preferences_dialog_initialize (NautilusPreferencesDialog * prefs_dialog)
{
prefs_dialog->details = g_new (NautilusPreferencesDialogDetails, 1);
prefs_dialog->details->prefs_box = NULL;
}
static void
dialog_clicked(GtkWidget * widget, gint n, gpointer data)
{
NautilusPreferencesDialog * prefs_dialog = (NautilusPreferencesDialog *) data;
g_assert(prefs_dialog);
gtk_widget_hide(GTK_WIDGET(prefs_dialog));
}
static void
dialog_show(GtkWidget * widget, gpointer data)
{
NautilusPreferencesDialog * prefs_dialog = (NautilusPreferencesDialog *) data;
g_assert(prefs_dialog);
}
static void
dialog_destroy(GtkWidget * widget, gpointer data)
{
NautilusPreferencesDialog * prefs_dialog = (NautilusPreferencesDialog *) data;
g_assert(prefs_dialog);
}
static void
nautilus_preferences_dialog_construct (NautilusPreferencesDialog *prefs_dialog,
const gchar *dialog_title)
{
GnomeDialog *gnome_dialog;
g_assert (prefs_dialog != NULL);
g_assert (prefs_dialog->details != NULL);
g_assert (prefs_dialog->details->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),
PREFS_DIALOG_DEFAULT_WIDTH,
PREFS_DIALOG_DEFAULT_HEIGHT);
/* 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
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->details->prefs_box = nautilus_preferences_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->details->prefs_box,
TRUE, /* expand */
TRUE, /* fill */
0); /* padding */
gtk_widget_show (prefs_dialog->details->prefs_box);
}
GtkWidget*
nautilus_preferences_dialog_new (const gchar *dialog_title)
{
NautilusPreferencesDialog *prefs_dialog;
prefs_dialog = gtk_type_new (nautilus_preferences_dialog_get_type ());
nautilus_preferences_dialog_construct (prefs_dialog, dialog_title);
return GTK_WIDGET (prefs_dialog);
}
/* GtkObjectClass methods */
static void
nautilus_preferences_dialog_destroy(GtkObject* object)
{
NautilusPreferencesDialog * prefs_dialog;
g_return_if_fail (object != NULL);
g_return_if_fail (NAUTILUS_IS_PREFS_DIALOG (object));
prefs_dialog = NAUTILUS_PREFERENCES_DIALOG(object);
g_free (prefs_dialog->details);
/* Chain */
if (GTK_OBJECT_CLASS (parent_class)->destroy != NULL)
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
}
GtkWidget*
nautilus_preferences_dialog_get_prefs_box (NautilusPreferencesDialog *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->details->prefs_box;
}

View file

@ -1,68 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* nautilus-preferences-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_PREFERENCES_DIALOG_H
#define NAUTILUS_PREFERENCES_DIALOG_H
#include <libgnomeui/gnome-dialog.h>
#include <nautilus-widgets/nautilus-preferences-box.h>
BEGIN_GNOME_DECLS
#define NAUTILUS_TYPE_PREFS_DIALOG (nautilus_preferences_dialog_get_type ())
#define NAUTILUS_PREFERENCES_DIALOG(obj) (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_PREFS_DIALOG, NautilusPreferencesDialog))
#define NAUTILUS_PREFERENCES_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_PREFS_DIALOG, NautilusPreferencesDialogClass))
#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 _NautilusPreferencesDialog NautilusPreferencesDialog;
typedef struct _NautilusPreferencesDialogClass NautilusPreferencesDialogClass;
typedef struct _NautilusPreferencesDialogDetails NautilusPreferencesDialogDetails;
struct _NautilusPreferencesDialog
{
/* Super Class */
GnomeDialog gnome_dialog;
/* Private stuff */
NautilusPreferencesDialogDetails *details;
};
struct _NautilusPreferencesDialogClass
{
GnomeDialogClass parent_class;
void (*activate) (GtkWidget * prefs_dialog, gint entry_number);
};
GtkType nautilus_preferences_dialog_get_type (void);
GtkWidget* nautilus_preferences_dialog_new (const gchar *dialog_title);
GtkWidget* nautilus_preferences_dialog_get_prefs_box (NautilusPreferencesDialog *prefs_dialog);
BEGIN_GNOME_DECLS
#endif /* NAUTILUS_PREFERENCES_DIALOG_H */

View file

@ -1,230 +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 <config.h>
#include "nautilus-preferences-group.h"
#include <gnome.h>
#include <gtk/gtkradiobutton.h>
#include <gtk/gtksignal.h>
#include <libnautilus-extensions/nautilus-gtk-macros.h>
/* Signals */
typedef enum
{
CHANGED,
LAST_SIGNAL
} RadioGroupSignals;
typedef struct
{
GtkWidget *radio_button;
} ButtonInfo;
struct _NautilusPreferencesGroupDetails
{
GtkWidget *main_box;
GtkWidget *content_box;
GtkWidget *description_label;
gboolean show_description;
};
static const gint PREFERENCES_GROUP_NOT_FOUND = -1;
/* NautilusPreferencesGroupClass methods */
static void nautilus_preferences_group_initialize_class (NautilusPreferencesGroupClass *klass);
static void nautilus_preferences_group_initialize (NautilusPreferencesGroup *preferences_group);
/* GtkObjectClass methods */
static void nautilus_preferences_group_destroy (GtkObject *object);
/* Private stuff */
static void preferences_group_construct (NautilusPreferencesGroup *prefs_group,
const gchar * title);
NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusPreferencesGroup,
nautilus_preferences_group,
GTK_TYPE_FRAME);
/*
* NautilusPreferencesGroupClass methods
*/
static void
nautilus_preferences_group_initialize_class (NautilusPreferencesGroupClass *preferences_group_class)
{
GtkObjectClass *object_class;
GtkWidgetClass *widget_class;
object_class = GTK_OBJECT_CLASS (preferences_group_class);
widget_class = GTK_WIDGET_CLASS (preferences_group_class);
parent_class = gtk_type_class (gtk_frame_get_type ());
/* GtkObjectClass */
object_class->destroy = nautilus_preferences_group_destroy;
}
static void
nautilus_preferences_group_initialize (NautilusPreferencesGroup *group)
{
group->details = g_new (NautilusPreferencesGroupDetails, 1);
group->details->main_box = NULL;
group->details->content_box = NULL;
group->details->description_label = NULL;
group->details->show_description = FALSE;
}
/*
* GtkObjectClass methods
*/
static void
nautilus_preferences_group_destroy(GtkObject* object)
{
NautilusPreferencesGroup *group;
g_return_if_fail (object != NULL);
g_return_if_fail (NAUTILUS_IS_PREFERENCES_GROUP (object));
group = NAUTILUS_PREFERENCES_GROUP (object);
g_free (group->details);
/* Chain */
if (GTK_OBJECT_CLASS (parent_class)->destroy != NULL)
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
}
/*
* Private stuff
*/
static void
preferences_group_construct (NautilusPreferencesGroup *group,
const gchar * title)
{
g_assert (group != NULL);
g_assert (title != NULL);
g_assert (group->details->content_box == NULL);
g_assert (group->details->main_box == NULL);
g_assert (group->details->description_label == NULL);
/* Ourselves */
gtk_frame_set_shadow_type (GTK_FRAME (group),
GTK_SHADOW_ETCHED_IN);
gtk_frame_set_label (GTK_FRAME (group), title);
/* Main box */
group->details->main_box = gtk_vbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (group),
group->details->main_box);
/* Description label */
group->details->description_label = gtk_label_new ("Blurb");
gtk_label_set_justify (GTK_LABEL (group->details->description_label),
GTK_JUSTIFY_LEFT);
gtk_box_pack_start (GTK_BOX (group->details->main_box),
group->details->description_label,
FALSE,
FALSE,
0);
if (group->details->show_description)
{
gtk_widget_show (group->details->description_label);
}
/* Content box */
group->details->content_box =
gtk_vbox_new (FALSE, 0);
gtk_box_pack_start (GTK_BOX (group->details->main_box),
group->details->content_box,
FALSE,
FALSE,
0);
gtk_container_set_border_width (GTK_CONTAINER (group->details->content_box),
4);
gtk_widget_show (group->details->content_box);
gtk_widget_show (group->details->main_box);
}
/*
* NautilusPreferencesGroup public methods
*/
GtkWidget*
nautilus_preferences_group_new (const gchar *title)
{
NautilusPreferencesGroup *group;
g_return_val_if_fail (title != NULL, NULL);
group = gtk_type_new (nautilus_preferences_group_get_type ());
preferences_group_construct (group, title);
return GTK_WIDGET (group);
}
GtkWidget *
nautilus_preferences_group_add_item (NautilusPreferencesGroup *group,
const char *preference_name,
NautilusPreferencesItemType item_type)
{
GtkWidget *item;
NautilusPreference *preference;
g_return_val_if_fail (group != NULL, NULL);
g_return_val_if_fail (NAUTILUS_IS_PREFERENCES_GROUP (group), NULL);
g_return_val_if_fail (preference_name != NULL, NULL);
preference = nautilus_preference_find_by_name (preference_name);
g_assert (preference != NULL);
gtk_object_unref (GTK_OBJECT (preference));
preference = NULL;
item = nautilus_preferences_item_new (preference_name, item_type);
gtk_box_pack_start (GTK_BOX (group->details->content_box),
item,
TRUE,
TRUE,
0);
gtk_widget_show (item);
return item;
}

View file

@ -1,70 +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_PREFERENCES_GROUP_H
#define NAUTILUS_PREFERENCES_GROUP_H
#include <gtk/gtkframe.h>
#include <gnome.h>
#include <nautilus-widgets/nautilus-preferences.h>
#include <nautilus-widgets/nautilus-preferences-item.h>
BEGIN_GNOME_DECLS
#define NAUTILUS_TYPE_PREFERENCES_GROUP (nautilus_preferences_group_get_type ())
#define NAUTILUS_PREFERENCES_GROUP(obj) (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_PREFERENCES_GROUP, NautilusPreferencesGroup))
#define NAUTILUS_PREFERENCES_GROUP_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_PREFERENCES_GROUP, NautilusPreferencesGroupClass))
#define NAUTILUS_IS_PREFERENCES_GROUP(obj) (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_PREFERENCES_GROUP))
#define NAUTILUS_IS_PREFERENCES_GROUP_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_PREFERENCES_GROUP))
typedef struct _NautilusPreferencesGroup NautilusPreferencesGroup;
typedef struct _NautilusPreferencesGroupClass NautilusPreferencesGroupClass;
typedef struct _NautilusPreferencesGroupDetails NautilusPreferencesGroupDetails;
struct _NautilusPreferencesGroup
{
/* Super Class */
GtkFrame frame;
/* Private stuff */
NautilusPreferencesGroupDetails *details;
};
struct _NautilusPreferencesGroupClass
{
GtkFrameClass parent_class;
};
GtkType nautilus_preferences_group_get_type (void);
GtkWidget* nautilus_preferences_group_new (const gchar *title);
GtkWidget* nautilus_preferences_group_add_item (NautilusPreferencesGroup *group,
const char *preference_name,
NautilusPreferencesItemType item_type);
BEGIN_GNOME_DECLS
#endif /* NAUTILUS_PREFERENCES_GROUP_H */

View file

@ -1,727 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* nautilus-preferences-item.c - Implementation for an individual prefs item.
Copyright (C) 1999, 2000 Eazel, Inc.
The Gnome Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The Gnome Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the Gnome Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
Authors: Ramiro Estrugo <ramiro@eazel.com>
*/
#include <config.h>
#include "nautilus-preferences-item.h"
#include "nautilus-preferences.h"
#include <libnautilus-extensions/nautilus-file-utilities.h>
#include <libnautilus-extensions/nautilus-glib-extensions.h>
#include <libnautilus-extensions/nautilus-gtk-macros.h>
#include <libgnomevfs/gnome-vfs.h>
#include <gtk/gtkcheckbutton.h>
#include "nautilus-radio-button-group.h"
#include "nautilus-string-picker.h"
#include "nautilus-text-caption.h"
/* Arguments */
enum
{
ARG_0,
ARG_SHOW_DESCRIPTION,
ARG_DESCRIPTION_STRING,
ARG_TITLE_STRING
};
enum
{
ACTIVATE,
LAST_SIGNAL
};
static const guint PREFERENCES_ITEM_TITLE_SPACING = 4;
static const guint PREFERENCES_ITEM_FRAME_BORDER_WIDTH = 6;
static const gint PREFERENCES_ITEM_UNDEFINED_ITEM = -1;
struct _NautilusPreferencesItemDetails
{
gchar *preference_name;
NautilusPreferencesItemType item_type;
GtkWidget *child;
};
/* NautilusPreferencesItemClass methods */
static void nautilus_preferences_item_initialize_class (NautilusPreferencesItemClass *klass);
static void nautilus_preferences_item_initialize (NautilusPreferencesItem *preferences_item);
/* GtkObjectClass methods */
static void preferences_item_destroy (GtkObject *object);
static void preferences_item_set_arg (GtkObject *object,
GtkArg *arg,
guint arg_id);
static void preferences_item_get_arg (GtkObject *object,
GtkArg *arg,
guint arg_id);
/* Private stuff */
static void preferences_item_construct (NautilusPreferencesItem *item,
const gchar *preference_name,
NautilusPreferencesItemType item_type);
static void preferences_item_create_enum (NautilusPreferencesItem *item,
const NautilusPreference *prefrence);
static void preferences_item_create_boolean (NautilusPreferencesItem *item,
const NautilusPreference *prefrence);
static void preferences_item_create_editable_string (NautilusPreferencesItem *item,
const NautilusPreference *prefrence);
static void preferences_item_create_font_family (NautilusPreferencesItem *item,
const NautilusPreference *prefrence);
static void preferences_item_create_icon_theme (NautilusPreferencesItem *item,
const NautilusPreference *preference);
static void preferences_item_create_toolbar_icon_theme (NautilusPreferencesItem *item,
const NautilusPreference *preference);
static void enum_radio_group_changed_callback (GtkWidget *button_group,
GtkWidget *button,
gpointer user_data);
static void boolean_button_toggled_callback (GtkWidget *button_group,
gpointer user_data);
static void text_item_changed_callback (GtkWidget *string_picker,
gpointer user_data);
static void editable_string_changed_callback (GtkWidget *caption,
gpointer user_data);
NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusPreferencesItem, nautilus_preferences_item, GTK_TYPE_VBOX)
/* NautilusPreferencesItemClass methods */
static void
nautilus_preferences_item_initialize_class (NautilusPreferencesItemClass *preferences_item_class)
{
GtkObjectClass *object_class;
GtkWidgetClass *widget_class;
object_class = GTK_OBJECT_CLASS (preferences_item_class);
widget_class = GTK_WIDGET_CLASS (preferences_item_class);
parent_class = gtk_type_class (gtk_vbox_get_type ());
/* Arguments */
gtk_object_add_arg_type ("NautilusPreferencesItem::show_description",
GTK_TYPE_BOOL,
GTK_ARG_READWRITE,
ARG_SHOW_DESCRIPTION);
gtk_object_add_arg_type ("NautilusPreferencesItem::description_string",
GTK_TYPE_STRING,
GTK_ARG_WRITABLE,
ARG_DESCRIPTION_STRING);
gtk_object_add_arg_type ("NautilusPreferencesItem::title_string",
GTK_TYPE_STRING,
GTK_ARG_WRITABLE,
ARG_TITLE_STRING);
/* GtkObjectClass */
object_class->destroy = preferences_item_destroy;
object_class->set_arg = preferences_item_set_arg;
object_class->get_arg = preferences_item_get_arg;
}
static void
nautilus_preferences_item_initialize (NautilusPreferencesItem *item)
{
item->details = g_new (NautilusPreferencesItemDetails, 1);
item->details->preference_name = NULL;
item->details->item_type = PREFERENCES_ITEM_UNDEFINED_ITEM;
item->details->child = NULL;
}
/* GtkObjectClass methods */
static void
preferences_item_destroy (GtkObject *object)
{
NautilusPreferencesItem * item;
g_return_if_fail (object != NULL);
g_return_if_fail (NAUTILUS_IS_PREFERENCES_ITEM (object));
item = NAUTILUS_PREFERENCES_ITEM (object);
if (item->details->preference_name)
{
g_free (item->details->preference_name);
}
g_free (item->details);
/* Chain */
if (GTK_OBJECT_CLASS (parent_class)->destroy != NULL)
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
}
static void
preferences_item_set_arg (GtkObject *object,
GtkArg *arg,
guint arg_id)
{
NautilusPreferencesItem * item;
g_return_if_fail (object != NULL);
g_return_if_fail (NAUTILUS_IS_PREFERENCES_ITEM (object));
item = NAUTILUS_PREFERENCES_ITEM (object);
#if 0
switch (arg_id)
{
case ARG_SHOW_DESCRIPTION:
item->details->show_description = GTK_VALUE_BOOL (*arg);
if (item->details->show_description)
{
gtk_widget_show (item->details->description_label);
}
else
{
gtk_widget_hide (item->details->description_label);
}
break;
case ARG_DESCRIPTION_STRING:
gtk_label_set_text (GTK_LABEL (item->details->description_label),
GTK_VALUE_STRING (*arg));
break;
case ARG_TITLE_STRING:
gtk_frame_set_label (GTK_FRAME (object), GTK_VALUE_STRING (*arg));
break;
}
#endif
}
static void
preferences_item_get_arg (GtkObject *object,
GtkArg *arg,
guint arg_id)
{
NautilusPreferencesItem * item;
g_return_if_fail (object != NULL);
g_return_if_fail (NAUTILUS_IS_PREFERENCES_ITEM (object));
item = NAUTILUS_PREFERENCES_ITEM (object);
#if 0
switch (arg_id)
{
case ARG_SHOW_DESCRIPTION:
GTK_VALUE_BOOL (*arg) =
GTK_WIDGET_VISIBLE (item->details->description_label);
break;
}
#endif
}
/*
* Private stuff
*/
static void
preferences_item_construct (NautilusPreferencesItem *item,
const gchar *preference_name,
NautilusPreferencesItemType item_type)
{
const NautilusPreference *preference;
g_assert (item != NULL);
g_assert (preference_name != NULL);
g_assert (item_type != PREFERENCES_ITEM_UNDEFINED_ITEM);
g_assert (item->details->child == NULL);
g_assert (item->details->preference_name == NULL);
item->details->preference_name = g_strdup (preference_name);
preference = nautilus_preference_find_by_name (item->details->preference_name);
g_assert (preference != NULL);
/* Create the child widget according to the item type */
switch (item_type)
{
case NAUTILUS_PREFERENCE_ITEM_BOOLEAN:
preferences_item_create_boolean (item, preference);
break;
case NAUTILUS_PREFERENCE_ITEM_ENUM:
preferences_item_create_enum (item, preference);
break;
case NAUTILUS_PREFERENCE_ITEM_FONT_FAMILY:
preferences_item_create_font_family (item, preference);
break;
case NAUTILUS_PREFERENCE_ITEM_ICON_THEME:
preferences_item_create_icon_theme (item, preference);
break;
case NAUTILUS_PREFERENCE_ITEM_EDITABLE_STRING:
preferences_item_create_editable_string (item, preference);
break;
case NAUTILUS_PREFERENCE_ITEM_TOOLBAR_ICON_THEME:
preferences_item_create_toolbar_icon_theme (item, preference);
break;
}
gtk_object_unref (GTK_OBJECT (preference));
g_assert (item->details->child != NULL);
gtk_box_pack_start (GTK_BOX (item),
item->details->child,
FALSE,
FALSE,
0);
gtk_widget_show (item->details->child);
}
static void
preferences_item_create_enum (NautilusPreferencesItem *item,
const NautilusPreference *preference)
{
guint i;
gint value;
g_assert (item != NULL);
g_assert (preference != NULL);
g_assert (item->details->preference_name != NULL);
item->details->child = nautilus_radio_button_group_new ();
value = nautilus_preferences_get_enum (item->details->preference_name, 0);
for (i = 0; i < nautilus_preference_enum_get_num_entries (preference); i++) {
char *description;
description = nautilus_preference_enum_get_nth_entry_description (preference, i);
g_assert (description != NULL);
nautilus_radio_button_group_insert (NAUTILUS_RADIO_BUTTON_GROUP (item->details->child),
description);
g_free (description);
if (value == nautilus_preference_enum_get_nth_entry_value (preference, i)) {
nautilus_radio_button_group_set_active_index (NAUTILUS_RADIO_BUTTON_GROUP (item->details->child), i);
}
}
gtk_signal_connect (GTK_OBJECT (item->details->child),
"changed",
GTK_SIGNAL_FUNC (enum_radio_group_changed_callback),
(gpointer) item);
}
static void
preferences_item_create_boolean (NautilusPreferencesItem *item,
const NautilusPreference *preference)
{
gboolean value;
char *description;
g_assert (item != NULL);
g_assert (preference != NULL);
g_assert (item->details->preference_name != NULL);
description = nautilus_preference_get_description (preference);
g_assert (description != NULL);
item->details->child = gtk_check_button_new_with_label (description);
g_free (description);
value = nautilus_preferences_get_boolean (item->details->preference_name, FALSE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (item->details->child), value);
gtk_signal_connect (GTK_OBJECT (item->details->child),
"toggled",
GTK_SIGNAL_FUNC (boolean_button_toggled_callback),
(gpointer) item);
}
static void
preferences_item_create_editable_string (NautilusPreferencesItem *item,
const NautilusPreference *preference)
{
char *current_value;
char *description;
g_assert (item != NULL);
g_assert (preference != NULL);
g_assert (item->details->preference_name != NULL);
description = nautilus_preference_get_description (preference);
g_assert (description != NULL);
item->details->child = nautilus_text_caption_new ();
nautilus_caption_set_title_label (NAUTILUS_CAPTION (item->details->child), description);
g_free (description);
current_value = nautilus_preferences_get (item->details->preference_name, "file://home/pavel");
g_assert (current_value != NULL);
nautilus_text_caption_set_text (NAUTILUS_TEXT_CAPTION (item->details->child), current_value);
g_free (current_value);
gtk_signal_connect (GTK_OBJECT (item->details->child),
"changed",
GTK_SIGNAL_FUNC (editable_string_changed_callback),
(gpointer) item);
}
static void
preferences_item_create_font_family (NautilusPreferencesItem *item,
const NautilusPreference *preference)
{
char *description;
char *current_value;
NautilusStringList *font_list;
g_assert (item != NULL);
g_assert (preference != NULL);
g_assert (item->details->preference_name != NULL);
description = nautilus_preference_get_description (preference);
g_assert (description != NULL);
item->details->child = nautilus_string_picker_new ();
nautilus_caption_set_title_label (NAUTILUS_CAPTION (item->details->child), description);
g_free (description);
/* FIXME bugzilla.eazel.com 1274: Need to query system for available fonts */
font_list = nautilus_string_list_new ();
nautilus_string_list_insert (font_list, "helvetica");
nautilus_string_list_insert (font_list, "times");
nautilus_string_list_insert (font_list, "courier");
nautilus_string_list_insert (font_list, "lucida");
nautilus_string_list_insert (font_list, "fixed");
nautilus_string_picker_set_string_list (NAUTILUS_STRING_PICKER (item->details->child), font_list);
current_value = nautilus_preferences_get (item->details->preference_name, "helvetica");
g_assert (current_value != NULL);
g_assert (nautilus_string_list_contains (font_list, current_value));
nautilus_string_picker_set_text (NAUTILUS_STRING_PICKER (item->details->child), current_value);
g_free (current_value);
nautilus_string_list_free (font_list);
gtk_signal_connect (GTK_OBJECT (item->details->child),
"changed",
GTK_SIGNAL_FUNC (text_item_changed_callback),
(gpointer) item);
}
/* utility to determine if an image file exists in the candidate directory */
static const char *icon_file_name_suffixes[] =
{
".svg",
".SVG",
".png",
".PNG"
};
static gboolean
has_image_file(const char *directory_uri, const char *dir_name, const char *required_file)
{
char *temp_str, *base_uri;
int index;
GnomeVFSResult result;
GnomeVFSFileInfo *file_info;
file_info = gnome_vfs_file_info_new ();
temp_str = nautilus_make_path(directory_uri, dir_name);
base_uri = nautilus_make_path(temp_str, required_file);
g_free(temp_str);
for (index = 0; index < NAUTILUS_N_ELEMENTS (icon_file_name_suffixes); index++) {
temp_str = g_strconcat (base_uri, icon_file_name_suffixes[index], NULL);
gnome_vfs_file_info_init (file_info);
result = gnome_vfs_get_file_info (temp_str, file_info, 0, NULL);
g_free(temp_str);
if (result == GNOME_VFS_OK) {
g_free(base_uri);
gnome_vfs_file_info_unref (file_info);
return TRUE;
}
}
gnome_vfs_file_info_unref (file_info);
g_free(base_uri);
return FALSE;
}
/* add available icon themes to the theme list by iterating through the
nautilus icons directory, looking for sub-directories */
static void
add_icon_themes(NautilusStringList *theme_list, char *required_file)
{
char *directory_uri;
GnomeVFSResult result;
GnomeVFSFileInfo *current_file_info;
GnomeVFSDirectoryList *list;
/* get the uri for the images directory */
directory_uri = gnome_pixmap_file("nautilus");
result = gnome_vfs_directory_list_load (&list, directory_uri,
GNOME_VFS_FILE_INFO_DEFAULT, NULL, NULL);
if (result != GNOME_VFS_OK) {
g_free(directory_uri);
return;
}
/* interate through the directory for each file */
current_file_info = gnome_vfs_directory_list_first(list);
while (current_file_info != NULL) {
if ((current_file_info->type == GNOME_VFS_FILE_TYPE_DIRECTORY) &&
(current_file_info->name[0] != '.'))
if (has_image_file(directory_uri, current_file_info->name, required_file))
nautilus_string_list_insert (theme_list, current_file_info->name);
current_file_info = gnome_vfs_directory_list_next(list);
}
g_free(directory_uri);
gnome_vfs_directory_list_destroy(list);
}
static void
preferences_item_create_icon_theme (NautilusPreferencesItem *item,
const NautilusPreference *preference)
{
char *description;
char *current_value;
NautilusStringList *theme_list;
g_assert (item != NULL);
g_assert (preference != NULL);
g_assert (item->details->preference_name != NULL);
description = nautilus_preference_get_description (preference);
g_assert (description != NULL);
item->details->child = nautilus_string_picker_new ();
nautilus_caption_set_title_label (NAUTILUS_CAPTION (item->details->child), description);
g_free (description);
theme_list = nautilus_string_list_new ();
nautilus_string_list_insert (theme_list, "default");
add_icon_themes(theme_list, "i-directory");
nautilus_string_picker_set_string_list (NAUTILUS_STRING_PICKER (item->details->child), theme_list);
current_value = nautilus_preferences_get (item->details->preference_name, "default");
g_assert (current_value != NULL);
g_assert (nautilus_string_list_contains (theme_list, current_value));
nautilus_string_picker_set_text (NAUTILUS_STRING_PICKER (item->details->child), current_value);
g_free (current_value);
nautilus_string_list_free (theme_list);
gtk_signal_connect (GTK_OBJECT (item->details->child),
"changed",
GTK_SIGNAL_FUNC (text_item_changed_callback),
(gpointer) item);
}
static void
preferences_item_create_toolbar_icon_theme (NautilusPreferencesItem *item,
const NautilusPreference *preference)
{
char *description;
char *current_value;
NautilusStringList *theme_list;
g_assert (item != NULL);
g_assert (preference != NULL);
g_assert (item->details->preference_name != NULL);
description = nautilus_preference_get_description (preference);
g_assert (description != NULL);
item->details->child = nautilus_string_picker_new ();
nautilus_caption_set_title_label (NAUTILUS_CAPTION (item->details->child), description);
g_free (description);
theme_list = nautilus_string_list_new ();
nautilus_string_list_insert (theme_list, "standard");
add_icon_themes(theme_list, "Up");
nautilus_string_picker_set_string_list (NAUTILUS_STRING_PICKER (item->details->child), theme_list);
current_value = nautilus_preferences_get (item->details->preference_name, "standard");
g_assert (current_value != NULL);
g_assert (nautilus_string_list_contains (theme_list, current_value));
nautilus_string_picker_set_text (NAUTILUS_STRING_PICKER (item->details->child), current_value);
g_free (current_value);
nautilus_string_list_free (theme_list);
gtk_signal_connect (GTK_OBJECT (item->details->child),
"changed",
GTK_SIGNAL_FUNC (text_item_changed_callback),
(gpointer) item);
}
/* NautilusPreferencesItem public methods */
GtkWidget *
nautilus_preferences_item_new (const gchar *preference_name,
NautilusPreferencesItemType item_type)
{
NautilusPreferencesItem * item;
g_return_val_if_fail (preference_name != NULL, NULL);
item = gtk_type_new (nautilus_preferences_item_get_type ());
/* Cast away the constness so that the preferences object can be
* refed in this object. */
preferences_item_construct (item, preference_name, item_type);
return GTK_WIDGET (item);
}
static void
enum_radio_group_changed_callback (GtkWidget *buttons, GtkWidget * button, gpointer user_data)
{
NautilusPreferencesItem *item;
const NautilusPreference *preference;
gint i;
g_assert (user_data != NULL);
g_assert (NAUTILUS_IS_PREFERENCES_ITEM (user_data));
item = NAUTILUS_PREFERENCES_ITEM (user_data);
g_assert (item->details->preference_name != NULL);
preference = nautilus_preference_find_by_name (item->details->preference_name);
i = nautilus_radio_button_group_get_active_index (NAUTILUS_RADIO_BUTTON_GROUP (buttons));
nautilus_preferences_set_enum (item->details->preference_name,
nautilus_preference_enum_get_nth_entry_value (preference, i));
}
static void
boolean_button_toggled_callback (GtkWidget *button, gpointer user_data)
{
NautilusPreferencesItem *item;
gboolean active_state;
g_assert (user_data != NULL);
g_assert (NAUTILUS_IS_PREFERENCES_ITEM (user_data));
item = NAUTILUS_PREFERENCES_ITEM (user_data);
active_state = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
nautilus_preferences_set_boolean (item->details->preference_name, active_state);
}
static void
text_item_changed_callback (GtkWidget *button, gpointer user_data)
{
NautilusPreferencesItem *item;
char *text;
g_assert (user_data != NULL);
g_assert (NAUTILUS_IS_PREFERENCES_ITEM (user_data));
item = NAUTILUS_PREFERENCES_ITEM (user_data);
g_assert (item->details->child != NULL);
g_assert (NAUTILUS_IS_STRING_PICKER (item->details->child));
text = nautilus_string_picker_get_text (NAUTILUS_STRING_PICKER (item->details->child));
if (text != NULL)
{
nautilus_preferences_set (item->details->preference_name, text);
g_free (text);
}
}
static void
editable_string_changed_callback (GtkWidget *button, gpointer user_data)
{
NautilusPreferencesItem *item;
char *text;
g_assert (user_data != NULL);
g_assert (NAUTILUS_IS_PREFERENCES_ITEM (user_data));
item = NAUTILUS_PREFERENCES_ITEM (user_data);
g_assert (item->details->child != NULL);
g_assert (NAUTILUS_IS_TEXT_CAPTION (item->details->child));
text = nautilus_text_caption_get_text (NAUTILUS_TEXT_CAPTION (item->details->child));
if (text != NULL)
{
nautilus_preferences_set (item->details->preference_name, text);
g_free (text);
}
}

View file

@ -1,84 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* nautilus-preferences-item.h - Interface for an individual prefs item.
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_PREFERENCES_ITEM_H
#define NAUTILUS_PREFERENCES_ITEM_H
#include <gtk/gtkvbox.h>
#include <gnome.h>
#include <nautilus-widgets/nautilus-preferences.h>
BEGIN_GNOME_DECLS
#define NAUTILUS_TYPE_PREFERENCES_ITEM (nautilus_preferences_item_get_type ())
#define NAUTILUS_PREFERENCES_ITEM(obj) (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_PREFERENCES_ITEM, NautilusPreferencesItem))
#define NAUTILUS_PREFERENCES_ITEM_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_PREFERENCES_ITEM, NautilusPreferencesItemClass))
#define NAUTILUS_IS_PREFERENCES_ITEM(obj) (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_PREFERENCES_ITEM))
#define NAUTILUS_IS_PREFERENCES_ITEM_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_PREFERENCES_ITEM))
typedef struct _NautilusPreferencesItem NautilusPreferencesItem;
typedef struct _NautilusPreferencesItemClass NautilusPreferencesItemClass;
typedef struct _NautilusPreferencesItemDetails NautilusPreferencesItemDetails;
struct _NautilusPreferencesItem
{
/* Super Class */
GtkVBox vbox;
/* Private stuff */
NautilusPreferencesItemDetails *details;
};
struct _NautilusPreferencesItemClass
{
GtkVBoxClass vbox_class;
};
/*
* NautilusPreferencesItemType:
*
* The types of supported preferences that also have a corresponding ui in the
* preferences dialog. Note that this is different than NautilusPreferencesType
* because it is possible to have a prefernce that is not exposed in the ui.
*/
typedef enum
{
NAUTILUS_PREFERENCE_ITEM_BOOLEAN,
NAUTILUS_PREFERENCE_ITEM_ENUM,
NAUTILUS_PREFERENCE_ITEM_FONT_FAMILY,
NAUTILUS_PREFERENCE_ITEM_ICON_THEME,
NAUTILUS_PREFERENCE_ITEM_EDITABLE_STRING,
NAUTILUS_PREFERENCE_ITEM_TOOLBAR_ICON_THEME
} NautilusPreferencesItemType;
GtkType nautilus_preferences_item_get_type (void);
GtkWidget* nautilus_preferences_item_new (const gchar *preference_name,
NautilusPreferencesItemType item_type);
BEGIN_GNOME_DECLS
#endif /* NAUTILUS_PREFERENCES_ITEM_H */

View file

@ -1,325 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* nautilus-preferences-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 <config.h>
#include <nautilus-widgets/nautilus-preferences-pane.h>
#include <libnautilus-extensions/nautilus-gtk-macros.h>
#include <gtk/gtklabel.h>
#include <gtk/gtkframe.h>
#include <gtk/gtkhbox.h>
#include <gnome.h>
enum
{
ACTIVATE,
LAST_SIGNAL
};
static const guint PREFS_PANE_GROUPS_BOX_TOP_OFFSET = 0;
static const guint PREFS_PANE_IN_BETWEEN_OFFSET = 4;
struct _NautilusPreferencesPaneDetails
{
GtkWidget *title_box;
GtkWidget *title_frame;
GtkWidget *title_label;
GtkWidget *description_label;
GtkWidget *groups_box;
gboolean show_title;
GList *groups;
};
typedef void (*GnomeBoxSignal1) (GtkObject* object,
gint arg1,
gpointer data);
/* NautilusPreferencesPaneClass methods */
static void nautilus_preferences_pane_initialize_class (NautilusPreferencesPaneClass *klass);
static void nautilus_preferences_pane_initialize (NautilusPreferencesPane *prefs_pane);
/* GtkObjectClass methods */
static void nautilus_preferences_pane_destroy (GtkObject *object);
/* Private stuff */
static void prefs_pane_construct (NautilusPreferencesPane *prefs_pane,
const gchar *pane_title,
const gchar *pane_description);
NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusPreferencesPane, nautilus_preferences_pane, GTK_TYPE_VBOX)
/*
* NautilusPreferencesPaneClass methods
*/
static void
nautilus_preferences_pane_initialize_class (NautilusPreferencesPaneClass *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_preferences_pane_destroy;
}
static void
nautilus_preferences_pane_initialize (NautilusPreferencesPane *prefs_pane)
{
prefs_pane->details = g_new (NautilusPreferencesPaneDetails, 1);
prefs_pane->details->title_label = NULL;
prefs_pane->details->description_label = NULL;
prefs_pane->details->title_box = NULL;
prefs_pane->details->title_frame = NULL;
prefs_pane->details->groups_box = NULL;
prefs_pane->details->groups = NULL;
prefs_pane->details->show_title = FALSE;
}
/*
* GtkObjectClass methods
*/
static void
nautilus_preferences_pane_destroy(GtkObject* object)
{
NautilusPreferencesPane * prefs_pane;
g_return_if_fail (object != NULL);
g_return_if_fail (NAUTILUS_IS_PREFS_PANE (object));
prefs_pane = NAUTILUS_PREFERENCES_PANE (object);
if (prefs_pane->details->groups)
{
g_list_free (prefs_pane->details->groups);
}
g_free (prefs_pane->details);
/* Chain destroy */
NAUTILUS_CALL_PARENT_CLASS (GTK_OBJECT_CLASS, destroy, (object));
}
/*
* Private stuff
*/
static void
prefs_pane_construct (NautilusPreferencesPane *prefs_pane,
const gchar *pane_title,
const gchar *pane_description)
{
g_assert (prefs_pane != NULL);
g_assert (prefs_pane->details != NULL);
g_assert (pane_title != NULL);
g_assert (pane_description != NULL);
g_assert (prefs_pane->details->title_label == NULL);
g_assert (prefs_pane->details->description_label == NULL);
g_assert (prefs_pane->details->title_box == NULL);
g_assert (prefs_pane->details->groups_box == NULL);
g_assert (prefs_pane->details->title_frame == NULL);
g_assert (prefs_pane->details->groups == NULL);
if (prefs_pane->details->show_title)
{
/* Title frame */
prefs_pane->details->title_frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (prefs_pane->details->title_frame),
GTK_SHADOW_ETCHED_IN);
/* Title box */
prefs_pane->details->title_box = gtk_hbox_new (FALSE, 0);
/* Title labels */
prefs_pane->details->title_label = gtk_label_new (pane_title);
prefs_pane->details->description_label = gtk_label_new (pane_description);
gtk_box_pack_start (GTK_BOX (prefs_pane->details->title_box),
prefs_pane->details->title_label,
FALSE,
FALSE,
0);
gtk_box_pack_end (GTK_BOX (prefs_pane->details->title_box),
prefs_pane->details->description_label,
FALSE,
FALSE,
0);
gtk_widget_show (prefs_pane->details->title_label);
gtk_widget_show (prefs_pane->details->description_label);
/* Add title box to title frame */
gtk_container_add (GTK_CONTAINER (prefs_pane->details->title_frame),
prefs_pane->details->title_box);
gtk_widget_show (prefs_pane->details->title_box);
/* Add title frame to ourselves */
gtk_box_pack_start (GTK_BOX (prefs_pane),
prefs_pane->details->title_frame,
FALSE,
FALSE,
0);
gtk_widget_show (prefs_pane->details->title_frame);
}
/* Groups box */
prefs_pane->details->groups_box = gtk_vbox_new (FALSE, 0);
/* Add groups box to ourselves */
gtk_box_pack_start (GTK_BOX (prefs_pane),
prefs_pane->details->groups_box,
FALSE,
FALSE,
PREFS_PANE_GROUPS_BOX_TOP_OFFSET);
gtk_widget_show (prefs_pane->details->groups_box);
}
/*
* NautilusPreferencesPane public methods
*/
GtkWidget*
nautilus_preferences_pane_new (const gchar *pane_title,
const gchar *pane_description)
{
NautilusPreferencesPane *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_preferences_pane_get_type ());
prefs_pane_construct (prefs_pane, pane_title, pane_description);
return GTK_WIDGET (prefs_pane);
}
void
nautilus_preferences_pane_set_title (NautilusPreferencesPane *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->details->title_label != NULL);
gtk_label_set_text (GTK_LABEL (prefs_pane->details->title_label),
pane_title);
}
void
nautilus_preferences_pane_set_description (NautilusPreferencesPane *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->details->description_label != NULL);
gtk_label_set_text (GTK_LABEL (prefs_pane->details->description_label),
pane_description);
}
GtkWidget *
nautilus_preferences_pane_add_group (NautilusPreferencesPane *prefs_pane,
const char *group_title)
{
GtkWidget *group;
g_return_val_if_fail (prefs_pane != NULL, NULL);
g_return_val_if_fail (NAUTILUS_IS_PREFS_PANE (prefs_pane), NULL);
g_return_val_if_fail (group_title != NULL, NULL);
group = nautilus_preferences_group_new (group_title);
prefs_pane->details->groups = g_list_append (prefs_pane->details->groups,
(gpointer) group);
gtk_box_pack_start (GTK_BOX (prefs_pane->details->groups_box),
group,
TRUE,
TRUE,
PREFS_PANE_IN_BETWEEN_OFFSET);
gtk_widget_show (group);
return group;
}
GtkWidget *
nautilus_preferences_pane_add_item_to_nth_group (NautilusPreferencesPane *prefs_pane,
guint n,
const char *preference_name,
NautilusPreferencesItemType item_type)
{
GtkWidget *item;
GtkWidget *group;
g_return_val_if_fail (prefs_pane != NULL, NULL);
g_return_val_if_fail (NAUTILUS_IS_PREFS_PANE (prefs_pane), NULL);
g_return_val_if_fail (preference_name != NULL, NULL);
if (!prefs_pane->details->groups) {
g_warning ("nautilus_preferences_pane_add_item_to_nth_group () There are no groups!");
return NULL;
}
if (n >= g_list_length (prefs_pane->details->groups)) {
g_warning ("nautilus_preferences_pane_add_item_to_nth_group (n = %d) n is out of bounds!", n);
return NULL;
}
g_assert (g_list_nth_data (prefs_pane->details->groups, n) != NULL);
g_assert (GTK_IS_WIDGET (g_list_nth_data (prefs_pane->details->groups, n)));
group = GTK_WIDGET (g_list_nth_data (prefs_pane->details->groups, n));
item = nautilus_preferences_group_add_item (NAUTILUS_PREFERENCES_GROUP (group),
preference_name,
item_type);
g_assert (item != NULL);
return item;
}

View file

@ -1,76 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* nautilus-preferences-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_PREFERENCES_PANE_H
#define NAUTILUS_PREFERENCES_PANE_H
#include <libgnomeui/gnome-dialog.h>
#include <gtk/gtkvbox.h>
#include <nautilus-widgets/nautilus-preferences-group.h>
BEGIN_GNOME_DECLS
#define NAUTILUS_TYPE_PREFS_PANE (nautilus_preferences_pane_get_type ())
#define NAUTILUS_PREFERENCES_PANE(obj) (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_PREFS_PANE, NautilusPreferencesPane))
#define NAUTILUS_PREFERENCES_PANE_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_PREFS_PANE, NautilusPreferencesPaneClass))
#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 _NautilusPreferencesPane NautilusPreferencesPane;
typedef struct _NautilusPreferencesPaneClass NautilusPreferencesPaneClass;
typedef struct _NautilusPreferencesPaneDetails NautilusPreferencesPaneDetails;
struct _NautilusPreferencesPane
{
/* Super Class */
GtkVBox vbox;
/* Private stuff */
NautilusPreferencesPaneDetails *details;
};
struct _NautilusPreferencesPaneClass
{
GtkVBoxClass parent_class;
void (*construct) (NautilusPreferencesPane *prefs_pane, GtkWidget *box);
};
GtkType nautilus_preferences_pane_get_type (void);
GtkWidget* nautilus_preferences_pane_new (const gchar *pane_title,
const gchar *pane_description);
void nautilus_preferences_pane_set_title (NautilusPreferencesPane *prefs_pane,
const gchar *pane_title);
void nautilus_preferences_pane_set_description (NautilusPreferencesPane *prefs_pane,
const gchar *pane_description);
GtkWidget *nautilus_preferences_pane_add_group (NautilusPreferencesPane *prefs_pane,
const char *group_title);
GtkWidget *nautilus_preferences_pane_add_item_to_nth_group (NautilusPreferencesPane *prefs_pane,
guint n,
const char *preference_name,
NautilusPreferencesItemType item_type);
BEGIN_GNOME_DECLS
#endif /* NAUTILUS_PREFERENCES_PANE_H */

View file

@ -1,881 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* nautilus-preferences.h - Preference peek/poke/notify object 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 <config.h>
#include <string.h>
#include "nautilus-preferences.h"
#include "nautilus-user-level-manager.h"
#include <libnautilus-extensions/nautilus-gtk-macros.h>
#include <libnautilus-extensions/nautilus-glib-extensions.h>
#include <libnautilus-extensions/nautilus-string.h>
#include <gconf/gconf.h>
#include <gconf/gconf-client.h>
#include <gtk/gtksignal.h>
static const char PREFERENCES_GCONF_PATH[] = "/apps/nautilus";
/*
* PreferencesHashNode:
*
* A structure to manage preference hash table nodes.
* Preferences are hash tables. The hash key is the preference name
* (a string). The hash value is a pointer of the following struct:
*/
typedef struct {
GList *callback_list;
int gconf_connections[3];
char *name;
} PreferencesHashNode;
/*
* PreferencesCallbackNode:
*
* A structure to manage callback lists. A callback list is a GList.
* The callback_data in each list node is a pointer to the following
* struct:
*/
typedef struct {
NautilusPreferencesCallback callback_proc;
gpointer callback_data;
const PreferencesHashNode *hash_node;
} PreferencesCallbackNode;
/*
* PreferencesGlobalData
*
* A structure to make it easier to grok the usage of global variables
* in the code below.
*/
typedef struct {
GHashTable *preference_table;
GConfClient *gconf_client;
guint old_user_level;
} PreferencesGlobalData;
static PreferencesGlobalData GLOBAL = { NULL, NULL, 0 };
/* PreferencesHashNode functions */
static PreferencesHashNode * preferences_hash_node_alloc (const char *name);
static void preferences_hash_node_free (PreferencesHashNode *node);
static void preferences_hash_node_free_func (gpointer key,
gpointer value,
gpointer callback_data);
static void preferences_hash_node_check_changes_func (gpointer key,
gpointer value,
gpointer callback_data);
/* PreferencesCallbackNode functions */
static PreferencesCallbackNode *preferences_callback_node_alloc (NautilusPreferencesCallback callback_proc,
gpointer callback_data,
const PreferencesHashNode *hash_node);
static void preferences_callback_node_free (PreferencesCallbackNode *node);
static void preferences_callback_node_free_func (gpointer data,
gpointer callback_data);
static void preferences_callback_node_invoke_func (gpointer data,
gpointer callback_data);
static void preferences_hash_node_add_callback (PreferencesHashNode *node,
NautilusPreferencesCallback callback_proc,
gpointer callback_data);
static void preferences_hash_node_remove_callback (PreferencesHashNode *node,
NautilusPreferencesCallback callback_proc,
gpointer callback_data);
/* Private stuff */
static PreferencesHashNode * preferences_hash_node_lookup (const char *name);
static PreferencesHashNode * preferences_hash_node_lookup_with_registration (const char *pref_name);
static void preferences_register (const char *name);
/* Gconf callbacks */
static void preferences_gconf_callback (GConfClient *client,
guint cnxn_id,
const gchar *key,
GConfValue *value,
gboolean is_default,
gpointer user_data);
static gboolean preferences_initialize_if_needed (void);
/**
* preferences_hash_node_alloc
*
* Allocate a preference hash node.
* @info: Pointer to info structure to use for the node memebers.
*
* Return value: A newly allocated node.
**/
static PreferencesHashNode *
preferences_hash_node_alloc (const char *name)
{
PreferencesHashNode * node;
g_assert (name != NULL);
node = g_new (PreferencesHashNode, 1);
node->name = g_strdup(name);
node->callback_list = NULL;
node->gconf_connections[0] = 0;
node->gconf_connections[1] = 0;
node->gconf_connections[2] = 0;
return node;
}
/**
* preferences_hash_node_free
*
* Free a preference hash node members along with the node itself.
* @preferences_hash_node: The node to free.
**/
static void
preferences_hash_node_free (PreferencesHashNode *node)
{
guint i;
g_assert (node != NULL);
/* Remove the gconf notification if its still lingering */
for (i = 0; i < 3; i++)
{
if (node->gconf_connections[i] != 0)
{
gconf_client_notify_remove (GLOBAL.gconf_client,
node->gconf_connections[i]);
node->gconf_connections[i] = 0;
}
}
nautilus_g_list_free_deep_custom (node->callback_list,
preferences_callback_node_free_func,
NULL);
node->callback_list = NULL;
g_free (node->name);
g_free (node);
}
/**
* preferences_hash_node_add_callback
*
* Add a callback to a pref node. Callbacks are fired whenever
* the pref value changes.
* @preferences_hash_node: The hash node.
* @callback_proc: The user supplied callback.
* @callback_data: The user supplied closure.
**/
static void
preferences_hash_node_add_callback (PreferencesHashNode *node,
NautilusPreferencesCallback callback_proc,
gpointer callback_data)
{
PreferencesCallbackNode *preferences_callback_node;
guint i;
g_assert (node != NULL);
g_assert (callback_proc != NULL);
preferences_callback_node = preferences_callback_node_alloc (callback_proc,
callback_data,
node);
g_assert (preferences_callback_node != NULL);
node->callback_list = g_list_append (node->callback_list,
(gpointer) preferences_callback_node);
/*
* We install only one gconf notification for each preference node.
* Otherwise, we would invoke the installed callbacks more than once
* per registered callback.
*/
for (i = 0; i < 3; i++)
{
if (node->gconf_connections[i] == 0) {
char *key;
g_assert (node->name != NULL);
g_assert (node->gconf_connections[i] == 0);
key = nautilus_user_level_manager_make_gconf_key (node->name, i);
g_assert (key);
node->gconf_connections[i] = gconf_client_notify_add (GLOBAL.gconf_client,
key,
preferences_gconf_callback,
node,
NULL,
NULL);
g_free (key);
}
}
}
/**
* preferences_hash_node_remove_callback
*
* remove a callback from a pref node. Both the callback and the callback_data must
* match in order for a callback to be removed from the node.
* @preferences_hash_node: The hash node.
* @callback_proc: The user supplied callback.
* @callback_data: The user supplied closure.
**/
static void
preferences_hash_node_remove_callback (PreferencesHashNode *node,
NautilusPreferencesCallback callback_proc,
gpointer callback_data)
{
GList *new_list;
GList *iterator;
g_assert (node != NULL);
g_assert (callback_proc != NULL);
g_assert (node->callback_list != NULL);
new_list = g_list_copy (node->callback_list);
for (iterator = new_list; iterator != NULL; iterator = iterator->next) {
PreferencesCallbackNode *callback_info = (PreferencesCallbackNode *) iterator->data;
g_assert (callback_info != NULL);
if (callback_info->callback_proc == callback_proc &&
callback_info->callback_data == callback_data) {
node->callback_list = g_list_remove (node->callback_list,
(gpointer) callback_info);
preferences_callback_node_free (callback_info);
}
}
/*
* If there are no callbacks left in the node, remove the gconf
* notification as well.
*/
if (node->callback_list == NULL) {
guint i;
for (i = 0; i < 3; i++)
{
g_assert (node->gconf_connections[i] != 0);
gconf_client_notify_remove (GLOBAL.gconf_client,
node->gconf_connections[i]);
node->gconf_connections[i] = 0;
}
}
}
/**
* preferences_hash_node_free_func
*
* A function that frees a pref hash node. It is meant to be fed to
* g_hash_table_foreach ()
* @key: The hash key privately maintained by the GHashTable.
* @value: The hash value privately maintained by the GHashTable.
* @callback_data: The callback_data privately maintained by the GHashTable.
**/
static void
preferences_hash_node_free_func (gpointer key,
gpointer value,
gpointer callback_data)
{
g_assert (value != NULL);
preferences_hash_node_free ((PreferencesHashNode *) value);
}
static void
preferences_hash_node_check_changes_func (gpointer key,
gpointer value,
gpointer user_data)
{
PreferencesHashNode *node;
guint old_user_level;
guint new_user_level;
g_assert (value != NULL);
node = (PreferencesHashNode *) value;
old_user_level = (guint) user_data;
new_user_level = nautilus_user_level_manager_get_user_level ();
/* FIXME bugzilla.eazel.com 1273:
* This currently only works for keys, it doesnt work with whole namespaces
*/
if (!nautilus_user_level_manager_compare_preference_between_user_levels (node->name,
old_user_level,
new_user_level)) {
/* Invoke callbacks for this node */
if (node->callback_list) {
g_list_foreach (node->callback_list,
preferences_callback_node_invoke_func,
(gpointer) NULL);
}
}
}
/**
* preferences_callback_node_alloc
*
* Allocate a callback info struct from the given values. PreferencesCallbackNode
* structures are used as nodes for the callbac_list member of pref hash table
* nodes.
* @callback_proc: The callback.
* @callback_data: The user data.
* @hash_node: The hash table node this callback belongs to.
*
* Return value: A newly allocated node.
**/
static PreferencesCallbackNode *
preferences_callback_node_alloc (NautilusPreferencesCallback callback_proc,
gpointer callback_data,
const PreferencesHashNode *hash_node)
{
PreferencesCallbackNode *callback_node;
g_assert (callback_proc != NULL);
callback_node = g_new (PreferencesCallbackNode, 1);
callback_node->callback_proc = callback_proc;
callback_node->callback_data = callback_data;
callback_node->hash_node = hash_node;
return callback_node;
}
/**
* preferences_callback_node_free
*
* Free a callback info struct.
* @preferences_callback_node: The struct to free.
**/
static void
preferences_callback_node_free (PreferencesCallbackNode *callback_node)
{
g_assert (callback_node != NULL);
callback_node->callback_proc = NULL;
callback_node->callback_data = NULL;
g_free (callback_node);
}
/**
* preferences_callback_node_free_func
*
* A function that frees a callback info struct. It is meant to be fed to
* g_list_foreach ()
* @data: The list data privately maintained by the GList.
* @callback_data: The callback_data privately maintained by the GList.
**/
static void
preferences_callback_node_free_func (gpointer data,
gpointer callback_data)
{
g_assert (data != NULL);
preferences_callback_node_free ((PreferencesCallbackNode *) data);
}
/**
* preferences_callback_node_invoke_func
*
* A function that invokes a callback from the given struct. It is meant to be fed to
* g_list_foreach ()
* @data: The list data privately maintained by the GList.
* @callback_data: The callback_data privately maintained by the GList.
**/
static void
preferences_callback_node_invoke_func (gpointer data,
gpointer callback_data)
{
PreferencesCallbackNode *callback_node;
callback_node = (PreferencesCallbackNode *) data;
g_assert (callback_node != NULL);
g_assert (callback_node->callback_proc != NULL);
(* callback_node->callback_proc) (callback_node->callback_data);
}
static void
preferences_register (const char *name)
{
PreferencesHashNode *node;
g_return_if_fail (name != NULL);
preferences_initialize_if_needed ();
node = preferences_hash_node_lookup (name);
if (node) {
g_warning ("the '%s' preference is already registered", name);
return;
}
node = preferences_hash_node_alloc (name);
g_hash_table_insert (GLOBAL.preference_table, (gpointer) name, (gpointer) node);
}
static PreferencesHashNode *
preferences_hash_node_lookup (const char *name)
{
gpointer hash_value;
g_assert (name != NULL);
preferences_initialize_if_needed ();
hash_value = g_hash_table_lookup (GLOBAL.preference_table, (gconstpointer) name);
return (PreferencesHashNode *) hash_value;
}
static PreferencesHashNode *
preferences_hash_node_lookup_with_registration (const char *name)
{
PreferencesHashNode * node;
g_assert (name != NULL);
preferences_initialize_if_needed ();
node = preferences_hash_node_lookup (name);
if (!node) {
preferences_register (name);
node = preferences_hash_node_lookup (name);
}
g_assert (node != NULL);
return node;
}
static void
preferences_gconf_callback (GConfClient *client,
guint connection_id,
const gchar *key,
GConfValue *value,
gboolean is_default,
gpointer user_data)
{
PreferencesHashNode *node;
const char *expected_name;
char *expected_key;
g_return_if_fail (user_data != NULL);
node = (PreferencesHashNode *) user_data;
expected_name = node->name;
g_assert (expected_name != NULL);
/*
* This gconf notification was installed with an expected key in mind.
* The expected is not always the key passed into this function.
*
* This happens when the expected key is a namespace, and the key
* that changes is actually beneath that namespace.
*
* For example:
*
* 1. Tell me when "foo/bar" changes.
* 2. "foo/bar/x" or "foo/bar/y" or "foo/bar/z" changes
* 3. I get notified that "foo/bar/{x,y,z}" changed - not "foo/bar"
*
* This makes sense, since it is "foo/bar/{x,y,z}" that indeed changed.
*
* So we can use this mechanism to keep track of changes within a whole
* namespace by comparing the expected_key to the given key.
*/
expected_key = nautilus_user_level_manager_make_current_gconf_key (expected_name);
if (strcmp (key, expected_key) != 0) {
/* The prefix should be the same */
if (strncmp (key, expected_key, strlen (expected_key)) != 0) {
/* FIXME bugzilla.eazel.com 1272: This is triggering the first time the beast runs
* without an existing ~/.gconf directory.
*/
#if 0
g_warning ("preferences_gconf_callback: Wrong prefix! This indicates a bug.\n");
#endif
g_free (expected_key);
return;
}
key = expected_key;
}
g_assert (key != NULL);
node = preferences_hash_node_lookup (expected_name);
g_assert (node != NULL);
gconf_client_suggest_sync (GLOBAL.gconf_client, NULL);
/* Invoke callbacks for this node */
if (node->callback_list) {
g_list_foreach (node->callback_list,
preferences_callback_node_invoke_func,
(gpointer) NULL);
}
g_free (expected_key);
}
static void
user_level_changed_callback (GtkObject *user_level_manager,
gpointer user_data)
{
guint new_user_level;
new_user_level = nautilus_user_level_manager_get_user_level ();
g_hash_table_foreach (GLOBAL.preference_table,
preferences_hash_node_check_changes_func,
(gpointer) GLOBAL.old_user_level);
GLOBAL.old_user_level = new_user_level;
}
static gboolean
preferences_initialize_if_needed (void)
{
if (GLOBAL.preference_table != NULL && GLOBAL.gconf_client != NULL) {
return TRUE;
}
if (!gconf_is_initialized ()) {
GConfError *error = NULL;
char *argv[] = { "nautilus", NULL };
if (!gconf_init (1, argv, &error)) {
g_assert (error != NULL);
/* FIXME bugzilla.eazel.com 672: Need better error reporting here */
g_warning ("GConf init failed:\n %s", error->str);
gconf_error_destroy (error);
error = NULL;
return FALSE;
}
}
g_assert (GLOBAL.preference_table == NULL);
g_assert (GLOBAL.gconf_client == NULL);
GLOBAL.preference_table = g_hash_table_new (g_str_hash, g_str_equal);
g_assert (GLOBAL.preference_table != NULL);
GLOBAL.gconf_client = gconf_client_new ();
/* Let gconf know about ~/.gconf/nautilus */
gconf_client_add_dir (GLOBAL.gconf_client,
PREFERENCES_GCONF_PATH,
GCONF_CLIENT_PRELOAD_RECURSIVE,
NULL);
g_assert (GLOBAL.gconf_client != NULL);
GLOBAL.old_user_level = nautilus_user_level_manager_get_user_level ();
/* Register to find out about user level changes */
gtk_signal_connect (GTK_OBJECT (nautilus_user_level_manager_get ()),
"user_level_changed",
user_level_changed_callback,
NULL);
return TRUE;
}
/*
* Public functions
*/
gboolean
nautilus_preferences_add_callback (const char *name,
NautilusPreferencesCallback callback_proc,
gpointer callback_data)
{
PreferencesHashNode *node;
g_return_val_if_fail (name != NULL, FALSE);
g_return_val_if_fail (callback_proc != NULL, FALSE);
preferences_initialize_if_needed ();
node = preferences_hash_node_lookup_with_registration (name);
if (node == NULL) {
g_warning ("trying to add a callback for an unregistered preference");
return FALSE;
}
preferences_hash_node_add_callback (node, callback_proc, callback_data);
return TRUE;
}
gboolean
nautilus_preferences_remove_callback (const char *name,
NautilusPreferencesCallback callback_proc,
gpointer callback_data)
{
PreferencesHashNode *node;
g_return_val_if_fail (name != NULL, FALSE);
g_return_val_if_fail (callback_proc != NULL, FALSE);
node = preferences_hash_node_lookup (name);
if (node == NULL) {
g_warning ("trying to remove a callback for an unregistered preference");
return FALSE;
}
preferences_hash_node_remove_callback (node, callback_proc, callback_data);
return TRUE;
}
void
nautilus_preferences_set_boolean (const char *name,
gboolean boolean_value)
{
char *key;
gboolean gconf_result;
g_return_if_fail (name != NULL);
preferences_initialize_if_needed ();
key = nautilus_user_level_manager_make_current_gconf_key (name);
g_assert (key != NULL);
/* Make sure the preference value is indeed different */
if (gconf_client_get_bool (GLOBAL.gconf_client, key, NULL) == boolean_value) {
g_free (key);
return;
}
gconf_result = gconf_client_set_bool (GLOBAL.gconf_client, key, boolean_value, NULL);
g_assert (gconf_result);
gconf_client_suggest_sync (GLOBAL.gconf_client, NULL);
g_free (key);
}
gboolean
nautilus_preferences_get_boolean (const char *name,
gboolean default_value)
{
gboolean result;
char *key;
g_return_val_if_fail (name != NULL, FALSE);
preferences_initialize_if_needed ();
key = nautilus_user_level_manager_make_current_gconf_key (name);
g_assert (key != NULL);
result = gconf_client_get_bool (GLOBAL.gconf_client, key, NULL);
g_free (key);
return result;
}
void
nautilus_preferences_set_enum (const char *name,
int enum_value)
{
gboolean gconf_result;
char *key;
g_return_if_fail (name != NULL);
preferences_initialize_if_needed ();
key = nautilus_user_level_manager_make_current_gconf_key (name);
g_assert (key != NULL);
/* Make sure the preference value is indeed different */
if (gconf_client_get_int (GLOBAL.gconf_client, key, NULL) == enum_value) {
g_free (key);
return;
}
gconf_result = gconf_client_set_int (GLOBAL.gconf_client, key, enum_value, NULL);
g_assert (gconf_result);
gconf_client_suggest_sync (GLOBAL.gconf_client, NULL);
g_free (key);
}
int
nautilus_preferences_get_enum (const char *name,
int default_value)
{
int result;
char *key;
g_return_val_if_fail (name != NULL, FALSE);
preferences_initialize_if_needed ();
key = nautilus_user_level_manager_make_current_gconf_key (name);
g_assert (key != NULL);
result = gconf_client_get_int (GLOBAL.gconf_client, key, NULL);
g_free (key);
return result;
}
void
nautilus_preferences_set (const char *name,
const char *value)
{
gboolean gconf_result;
char *key;
g_return_if_fail (name != NULL);
preferences_initialize_if_needed ();
key = nautilus_user_level_manager_make_current_gconf_key (name);
g_assert (key != NULL);
/* Make sure the preference value is indeed different */
if (value) {
char *current_value = gconf_client_get_string (GLOBAL.gconf_client, key, NULL);
int result = nautilus_strcmp (current_value, value);
if (current_value) {
g_free (current_value);
}
if (result == 0) {
g_free (key);
return;
}
}
gconf_result = gconf_client_set_string (GLOBAL.gconf_client, key, value, NULL);
g_assert (gconf_result);
gconf_client_suggest_sync (GLOBAL.gconf_client, NULL);
g_free (key);
}
char *
nautilus_preferences_get (const char *name,
const char *default_value)
{
gchar *value = NULL;
char *key;
g_return_val_if_fail (name != NULL, FALSE);
preferences_initialize_if_needed ();
key = nautilus_user_level_manager_make_current_gconf_key (name);
g_assert (key != NULL);
value = gconf_client_get_string (GLOBAL.gconf_client, key, NULL);
if (!value && default_value) {
value = g_strdup (default_value);
}
g_free (key);
return value;
}
void
nautilus_preferences_shutdown (void)
{
if (GLOBAL.preference_table == NULL && GLOBAL.gconf_client == NULL) {
return;
}
gtk_signal_disconnect_by_func (GTK_OBJECT (nautilus_user_level_manager_get ()),
user_level_changed_callback,
NULL);
if (GLOBAL.preference_table != NULL) {
g_hash_table_foreach (GLOBAL.preference_table,
preferences_hash_node_free_func,
NULL);
g_hash_table_destroy (GLOBAL.preference_table);
GLOBAL.preference_table = NULL;
}
if (GLOBAL.gconf_client != NULL) {
gtk_object_unref (GTK_OBJECT (GLOBAL.gconf_client));
GLOBAL.gconf_client = NULL;
}
}

View file

@ -1,64 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* nautilus-preferences.h - Preference peek/poke/notify object 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_PREFERENCES_H
#define NAUTILUS_PREFERENCES_H
#include <gtk/gtkobject.h>
#include <libgnome/gnome-defs.h>
#include <nautilus-widgets/nautilus-preference.h>
BEGIN_GNOME_DECLS
/*
* A callback which you can register to to be notified when a particular
* preference changes.
*/
typedef void (*NautilusPreferencesCallback) (gpointer callback_data);
gboolean nautilus_preferences_add_callback (const char *name,
NautilusPreferencesCallback callback,
gpointer callback_data);
gboolean nautilus_preferences_remove_callback (const char *name,
NautilusPreferencesCallback callback,
gpointer callback_data);
void nautilus_preferences_set_boolean (const char *name,
gboolean value);
gboolean nautilus_preferences_get_boolean (const char *name,
gboolean default_value);
void nautilus_preferences_set_enum (const char *name,
int value);
int nautilus_preferences_get_enum (const char *name,
int default_value);
void nautilus_preferences_set (const char *name,
const char *value);
char * nautilus_preferences_get (const char *name,
const gchar *default_value);
void nautilus_preferences_shutdown (void);
BEGIN_GNOME_DECLS
#endif /* NAUTILUS_PREFERENCES_H */

View file

@ -1,298 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* nautilus-radio-button-group.c - A radio button group container.
Copyright (C) 1999, 2000 Eazel, Inc.
The Gnome Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The Gnome Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the Gnome Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
Authors: Ramiro Estrugo <ramiro@eazel.com>
*/
#include <config.h>
#include <nautilus-widgets/nautilus-radio-button-group.h>
#include <gtk/gtkradiobutton.h>
#include <gtk/gtksignal.h>
#include <libnautilus-extensions/nautilus-gtk-macros.h>
static const gint RADIO_BUTTON_GROUP_INVALID = -1;
/* Signals */
typedef enum
{
CHANGED,
LAST_SIGNAL
} RadioGroupSignals;
struct _NautilusRadioButtonGroupDetails
{
GList *buttons;
GSList *group;
};
/* NautilusRadioButtonGroupClass methods */
static void nautilus_radio_button_group_initialize_class (NautilusRadioButtonGroupClass *klass);
static void nautilus_radio_button_group_initialize (NautilusRadioButtonGroup *button_group);
/* GtkObjectClass methods */
static void nautilus_radio_button_group_destroy (GtkObject *object);
/* Private stuff */
static void radio_button_group_free_button_group (NautilusRadioButtonGroup *button_group);
static void radio_button_group_emit_changed_signal (NautilusRadioButtonGroup *button_group,
GtkWidget *button);
/* Radio button callbacks */
static void button_toggled (GtkWidget *button,
gpointer user_data);
NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusRadioButtonGroup,
nautilus_radio_button_group,
GTK_TYPE_VBOX)
static guint radio_group_signals[LAST_SIGNAL] = { 0 };
/*
* NautilusRadioButtonGroupClass methods
*/
static void
nautilus_radio_button_group_initialize_class (NautilusRadioButtonGroupClass *radio_button_group_class)
{
GtkObjectClass *object_class;
GtkWidgetClass *widget_class;
object_class = GTK_OBJECT_CLASS (radio_button_group_class);
widget_class = GTK_WIDGET_CLASS (radio_button_group_class);
parent_class = gtk_type_class (gtk_vbox_get_type ());
/* GtkObjectClass */
object_class->destroy = nautilus_radio_button_group_destroy;
/* Signals */
radio_group_signals[CHANGED] =
gtk_signal_new ("changed",
GTK_RUN_LAST,
object_class->type,
0,
gtk_marshal_NONE__OBJECT,
GTK_TYPE_NONE,
1,
GTK_TYPE_POINTER);
gtk_object_class_add_signals (object_class, radio_group_signals, LAST_SIGNAL);
}
static void
nautilus_radio_button_group_initialize (NautilusRadioButtonGroup *button_group)
{
button_group->details = g_new (NautilusRadioButtonGroupDetails, 1);
button_group->details->buttons = NULL;
button_group->details->group = NULL;
}
/*
* GtkObjectClass methods
*/
static void
nautilus_radio_button_group_destroy(GtkObject* object)
{
NautilusRadioButtonGroup * button_group;
g_return_if_fail (object != NULL);
g_return_if_fail (NAUTILUS_IS_RADIO_BUTTON_GROUP (object));
button_group = NAUTILUS_RADIO_BUTTON_GROUP (object);
radio_button_group_free_button_group (button_group);
g_free (button_group->details);
/* Chain */
if (GTK_OBJECT_CLASS (parent_class)->destroy != NULL)
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
}
/*
* Private stuff
*/
static void
radio_button_group_emit_changed_signal (NautilusRadioButtonGroup *button_group,
GtkWidget *button)
{
g_assert (button_group != NULL);
g_assert (button_group->details != NULL);
g_assert (button != NULL);
gtk_signal_emit (GTK_OBJECT (button_group),
radio_group_signals[CHANGED],
button);
}
static void
radio_button_group_free_button_group (NautilusRadioButtonGroup *button_group)
{
g_assert (button_group != NULL);
g_assert (button_group->details != NULL);
if (button_group->details->buttons)
{
g_list_free (button_group->details->buttons);
}
button_group->details->buttons = NULL;
button_group->details->group = NULL;
}
/*
* Radio button callbacks
*/
static void
button_toggled (GtkWidget *button, gpointer user_data)
{
NautilusRadioButtonGroup *button_group = (NautilusRadioButtonGroup *) user_data;
g_assert (button_group != NULL);
g_assert (button_group->details != NULL);
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)))
{
radio_button_group_emit_changed_signal (button_group, button);
}
}
/*
* NautilusRadioButtonGroup public methods
*/
GtkWidget*
nautilus_radio_button_group_new (void)
{
NautilusRadioButtonGroup *button_group;
button_group = gtk_type_new (nautilus_radio_button_group_get_type ());
return GTK_WIDGET (button_group);
}
/**
* nautilus_radio_button_group_insert:
* @button_group: The button group
* @label: Label to use for the new button
*
* Create and insert a new radio button to the collection.
*
* Returns: The index of the new button.
*/
guint
nautilus_radio_button_group_insert (NautilusRadioButtonGroup *button_group,
const gchar *label)
{
GtkWidget *button;
g_return_val_if_fail (button_group != NULL, 0);
g_return_val_if_fail (NAUTILUS_IS_RADIO_BUTTON_GROUP (button_group), 0);
g_return_val_if_fail (label != NULL, 0);
button = gtk_radio_button_new_with_label (button_group->details->group, label);
/*
* For some crazy reason I dont grok, the group has to be fetched each
* time from the previous button
*/
button_group->details->group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
gtk_signal_connect (GTK_OBJECT (button),
"toggled",
GTK_SIGNAL_FUNC (button_toggled),
(gpointer) button_group);
gtk_box_pack_start (GTK_BOX (button_group),
button,
TRUE,
TRUE,
0);
gtk_widget_show (button);
button_group->details->buttons = g_list_append (button_group->details->buttons,
(gpointer) button);
return g_list_length (button_group->details->buttons) - 1;
}
/**
* nautilus_radio_button_group_get_active_index:
* @button_group: The button group
*
* Returns: The index of the active button. There is always one active by law.
*/
guint
nautilus_radio_button_group_get_active_index (NautilusRadioButtonGroup *button_group)
{
GList *button_iterator;
gint i = 0;
g_return_val_if_fail (button_group != NULL, 0);
g_return_val_if_fail (NAUTILUS_IS_RADIO_BUTTON_GROUP (button_group), 0);
g_assert (button_group != NULL);
button_iterator = button_group->details->buttons;
while (button_iterator)
{
g_assert (GTK_TOGGLE_BUTTON (button_iterator->data));
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button_iterator->data)))
{
return i;
}
button_iterator = button_iterator->next;
i++;
}
g_assert (0);
return 0;
}
void
nautilus_radio_button_group_set_active_index (NautilusRadioButtonGroup *button_group,
guint active_index)
{
GList *node;
g_return_if_fail (button_group != NULL);
g_return_if_fail (NAUTILUS_IS_RADIO_BUTTON_GROUP (button_group));
node = g_list_nth (button_group->details->buttons, active_index);
g_assert (node != NULL);
g_assert (GTK_TOGGLE_BUTTON (node->data));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (node->data), TRUE);
}

View file

@ -1,83 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* nautilus-radio-button-group.h - A radio button group container.
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_RADIO_BUTTON_GROUP_H
#define NAUTILUS_RADIO_BUTTON_GROUP_H
#include <gtk/gtkvbox.h>
#include <gnome.h>
/*
* NautilusRadioButtonGroup is a collection of radio buttons.
*/
BEGIN_GNOME_DECLS
#define NAUTILUS_TYPE_RADIO_BUTTON_GROUP (nautilus_radio_button_group_get_type ())
#define NAUTILUS_RADIO_BUTTON_GROUP(obj) (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_RADIO_BUTTON_GROUP, NautilusRadioButtonGroup))
#define NAUTILUS_RADIO_BUTTON_GROUP_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_RADIO_BUTTON_GROUP, NautilusRadioButtonGroupClass))
#define NAUTILUS_IS_RADIO_BUTTON_GROUP(obj) (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_RADIO_BUTTON_GROUP))
typedef struct _NautilusRadioButtonGroup NautilusRadioButtonGroup;
typedef struct _NautilusRadioButtonGroupClass NautilusRadioButtonGroupClass;
typedef struct _NautilusRadioButtonGroupDetails NautilusRadioButtonGroupDetails;
struct _NautilusRadioButtonGroup
{
/* Super Class */
GtkVBox vbox;
/* Private stuff */
NautilusRadioButtonGroupDetails *details;
};
struct _NautilusRadioButtonGroupClass
{
GtkVBoxClass parent_class;
};
typedef struct
{
guint active_button_index;
} NautilusRadioButtonGroupSignalData;
GtkType nautilus_radio_button_group_get_type (void);
GtkWidget* nautilus_radio_button_group_new (void);
/* Insert a new item to the group. Returns the new item's index */
guint nautilus_radio_button_group_insert (NautilusRadioButtonGroup *button_group,
const gchar *label);
/* Get the active item index. By law there always is an active item */
guint nautilus_radio_button_group_get_active_index (NautilusRadioButtonGroup *button_group);
/* Set the active item index. */
void nautilus_radio_button_group_set_active_index (NautilusRadioButtonGroup *button_group,
guint active_index);
BEGIN_GNOME_DECLS
#endif /* NAUTILUS_RADIO_BUTTON_GROUP_H */

View file

@ -1,260 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* nautilus-string-picker.c - A widget to pick a string from a list.
Copyright (C) 1999, 2000 Eazel, Inc.
The Gnome Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The Gnome Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the Gnome Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
Authors: Ramiro Estrugo <ramiro@eazel.com>
*/
#include <config.h>
#include <nautilus-widgets/nautilus-string-picker.h>
#include <libnautilus-extensions/nautilus-gtk-macros.h>
#include <libnautilus-extensions/nautilus-glib-extensions.h>
#include <gtk/gtklabel.h>
#include <gtk/gtkcombo.h>
#include <gtk/gtksignal.h>
static const gint STRING_PICKER_INVALID = -1;
static const gint STRING_PICKER_SPACING = 10;
/* Signals */
typedef enum
{
CHANGED,
LAST_SIGNAL
} NautilusStringPickerSignals;
struct _NautilusStringPickerDetail
{
// GtkWidget *title_label;
GtkWidget *combo_box;
NautilusStringList *string_list;
};
/* NautilusStringPickerClass methods */
static void nautilus_string_picker_initialize_class (NautilusStringPickerClass *klass);
static void nautilus_string_picker_initialize (NautilusStringPicker *string_picker);
/* GtkObjectClass methods */
static void nautilus_string_picker_destroy (GtkObject *object);
/* Private stuff */
static GtkEntry *string_picker_get_entry_widget (NautilusStringPicker *string_picker);
/* Editable (entry) callbacks */
static void entry_changed_callback (GtkWidget *entry,
gpointer user_data);
NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusStringPicker, nautilus_string_picker, NAUTILUS_TYPE_CAPTION)
static guint string_picker_signals[LAST_SIGNAL] = { 0 };
/*
* NautilusStringPickerClass methods
*/
static void
nautilus_string_picker_initialize_class (NautilusStringPickerClass *string_picker_class)
{
GtkObjectClass *object_class;
GtkWidgetClass *widget_class;
object_class = GTK_OBJECT_CLASS (string_picker_class);
widget_class = GTK_WIDGET_CLASS (string_picker_class);
/* GtkObjectClass */
object_class->destroy = nautilus_string_picker_destroy;
/* Signals */
string_picker_signals[CHANGED] =
gtk_signal_new ("changed",
GTK_RUN_LAST,
object_class->type,
0,
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE,
0);
gtk_object_class_add_signals (object_class, string_picker_signals, LAST_SIGNAL);
}
static void
nautilus_string_picker_initialize (NautilusStringPicker *string_picker)
{
string_picker->detail = g_new (NautilusStringPickerDetail, 1);
gtk_box_set_homogeneous (GTK_BOX (string_picker), FALSE);
gtk_box_set_spacing (GTK_BOX (string_picker), STRING_PICKER_SPACING);
string_picker->detail->string_list = NULL;
// string_picker->detail->title_label = gtk_label_new ("Title Label:");
string_picker->detail->combo_box = gtk_combo_new ();
gtk_entry_set_editable (string_picker_get_entry_widget (string_picker), FALSE);
// gtk_box_pack_start (GTK_BOX (string_picker),
// string_picker->detail->title_label,
// FALSE, /* expand */
// TRUE, /* fill */
// 0); /* padding */
// gtk_box_pack_end (GTK_BOX (string_picker),
// string_picker->detail->combo_box,
// TRUE, /* expand */
// TRUE, /* fill */
// 0); /* padding */
nautilus_caption_set_child (NAUTILUS_CAPTION (string_picker),
string_picker->detail->combo_box);
gtk_signal_connect (GTK_OBJECT (string_picker_get_entry_widget (string_picker)),
"changed",
GTK_SIGNAL_FUNC (entry_changed_callback),
(gpointer) string_picker);
gtk_widget_show (string_picker->detail->combo_box);
}
/*
* GtkObjectClass methods
*/
static void
nautilus_string_picker_destroy(GtkObject* object)
{
NautilusStringPicker * string_picker;
g_return_if_fail (object != NULL);
g_return_if_fail (NAUTILUS_IS_STRING_PICKER (object));
string_picker = NAUTILUS_STRING_PICKER (object);
if (string_picker->detail->string_list != NULL) {
nautilus_string_list_free (string_picker->detail->string_list);
}
g_free (string_picker->detail);
/* Chain */
NAUTILUS_CALL_PARENT_CLASS (GTK_OBJECT_CLASS, destroy, (object));
}
/*
* Private stuff
*/
static GtkEntry *
string_picker_get_entry_widget (NautilusStringPicker *string_picker)
{
g_assert (string_picker != NULL);
g_assert (NAUTILUS_IS_STRING_PICKER (string_picker));
return GTK_ENTRY (GTK_COMBO (string_picker->detail->combo_box)->entry);
}
/*
* Editable (entry) callbacks
*/
static void
entry_changed_callback (GtkWidget *entry, gpointer user_data)
{
NautilusStringPicker *string_picker;
g_assert (user_data != NULL);
g_assert (NAUTILUS_IS_STRING_PICKER (user_data));
string_picker = NAUTILUS_STRING_PICKER (user_data);
gtk_signal_emit (GTK_OBJECT (string_picker), string_picker_signals[CHANGED]);
}
/*
* NautilusStringPicker public methods
*/
GtkWidget*
nautilus_string_picker_new (void)
{
NautilusStringPicker *string_picker;
string_picker = gtk_type_new (nautilus_string_picker_get_type ());
return GTK_WIDGET (string_picker);
}
/**
* nautilus_string_picker_set_string_list:
* @string_picker: A NautilusStringPicker
*
* Returns: The index of the active button. There is always one active by law.
*/
void
nautilus_string_picker_set_string_list (NautilusStringPicker *string_picker,
const NautilusStringList *string_list)
{
GList *strings;
g_return_if_fail (string_picker != NULL);
g_return_if_fail (NAUTILUS_IS_STRING_PICKER (string_picker));
string_picker->detail->string_list = nautilus_string_list_new_from_string_list (string_list);
strings = nautilus_string_list_as_g_list (string_picker->detail->string_list);
gtk_combo_set_popdown_strings (GTK_COMBO (string_picker->detail->combo_box), strings);
nautilus_g_list_free_deep (strings);
}
/**
* nautilus_string_picker_get_text
* @string_picker: A NautilusStringPicker
*
* Returns: A copy of the currently selected text. Need to g_free() it.
*/
char *
nautilus_string_picker_get_text (NautilusStringPicker *string_picker)
{
const char *entry_text;
g_return_val_if_fail (string_picker != NULL, NULL);
g_return_val_if_fail (NAUTILUS_IS_STRING_PICKER (string_picker), NULL);
/* WATCHOUT:
* As of gtk1.2, gtk_entry_get_text() returns a non const reference to
* the internal string.
*/
entry_text = (const char *) gtk_entry_get_text (string_picker_get_entry_widget (string_picker));
return g_strdup (entry_text);
}
void
nautilus_string_picker_set_text (NautilusStringPicker *string_picker,
const char *text)
{
g_return_if_fail (string_picker != NULL);
g_return_if_fail (NAUTILUS_IS_STRING_PICKER (string_picker));
g_return_if_fail (string_picker->detail->string_list != NULL);
g_return_if_fail (nautilus_string_list_contains (string_picker->detail->string_list, text));
gtk_entry_set_text (string_picker_get_entry_widget (string_picker), text);
}

View file

@ -1,82 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* nautilus-string-picker.h - A widget to pick a string from a list.
Copyright (C) 1999, 2000 Eazel, Inc.
The Gnome Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The Gnome Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the Gnome Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
Authors: Ramiro Estrugo <ramiro@eazel.com>
*/
#ifndef NAUTILUS_STRING_PICKER_H
#define NAUTILUS_STRING_PICKER_H
#include <nautilus-widgets/nautilus-caption.h>
#include <libnautilus-extensions/nautilus-string-list.h>
/*
* NautilusStringPicker is made up of 2 widgets.
*
* [title label] [string combo box]
*
* The user can select a string from the list.
*/
BEGIN_GNOME_DECLS
#define NAUTILUS_TYPE_STRING_PICKER (nautilus_string_picker_get_type ())
#define NAUTILUS_STRING_PICKER(obj) (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_STRING_PICKER, NautilusStringPicker))
#define NAUTILUS_STRING_PICKER_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_STRING_PICKER, NautilusStringPickerClass))
#define NAUTILUS_IS_STRING_PICKER(obj) (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_STRING_PICKER))
typedef struct _NautilusStringPicker NautilusStringPicker;
typedef struct _NautilusStringPickerClass NautilusStringPickerClass;
typedef struct _NautilusStringPickerDetail NautilusStringPickerDetail;
struct _NautilusStringPicker
{
/* Super Class */
NautilusCaption caption;
/* Private stuff */
NautilusStringPickerDetail *detail;
};
struct _NautilusStringPickerClass
{
NautilusCaptionClass parent_class;
};
GtkType nautilus_string_picker_get_type (void);
GtkWidget* nautilus_string_picker_new (void);
/* String list mutator. */
void nautilus_string_picker_set_string_list (NautilusStringPicker *string_picker,
const NautilusStringList *string_list);
/* Entry text accesor. */
char *nautilus_string_picker_get_text (NautilusStringPicker *string_picker);
/* Entry text mutator. */
void nautilus_string_picker_set_text (NautilusStringPicker *string_picker,
const char *text);
BEGIN_GNOME_DECLS
#endif /* NAUTILUS_STRING_PICKER_H */

View file

@ -1,196 +0,0 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* nautilus-string-picker.c - A widget to pick a string from a list.
Copyright (C) 1999, 2000 Eazel, Inc.
The Gnome Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The Gnome Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the Gnome Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
Authors: Ramiro Estrugo <ramiro@eazel.com>
*/
#include <config.h>
#include <nautilus-widgets/nautilus-text-caption.h>
#include <libnautilus-extensions/nautilus-gtk-macros.h>
#include <libnautilus-extensions/nautilus-glib-extensions.h>
#include <gtk/gtklabel.h>
#include <gtk/gtkentry.h>
#include <gtk/gtksignal.h>
static const gint TEXT_CAPTION_INVALID = -1;
static const gint TEXT_CAPTION_SPACING = 10;
/* Signals */
typedef enum
{
CHANGED,
LAST_SIGNAL
} NautilusTextCaptionSignals;
struct _NautilusTextCaptionDetail
{
GtkWidget *text;
};
/* NautilusTextCaptionClass methods */
static void nautilus_text_caption_initialize_class (NautilusTextCaptionClass *klass);
static void nautilus_text_caption_initialize (NautilusTextCaption *text_caption);
/* GtkObjectClass methods */
static void nautilus_text_caption_destroy (GtkObject *object);
/* Editable (entry) callbacks */
static void entry_changed_callback (GtkWidget *entry,
gpointer user_data);
NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusTextCaption, nautilus_text_caption, NAUTILUS_TYPE_CAPTION)
static guint text_caption_signals[LAST_SIGNAL] = { 0 };
/*
* NautilusTextCaptionClass methods
*/
static void
nautilus_text_caption_initialize_class (NautilusTextCaptionClass *text_caption_class)
{
GtkObjectClass *object_class;
GtkWidgetClass *widget_class;
object_class = GTK_OBJECT_CLASS (text_caption_class);
widget_class = GTK_WIDGET_CLASS (text_caption_class);
/* GtkObjectClass */
object_class->destroy = nautilus_text_caption_destroy;
/* Signals */
text_caption_signals[CHANGED] =
gtk_signal_new ("changed",
GTK_RUN_LAST,
object_class->type,
0,
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE,
0);
gtk_object_class_add_signals (object_class, text_caption_signals, LAST_SIGNAL);
}
static void
nautilus_text_caption_initialize (NautilusTextCaption *text_caption)
{
text_caption->detail = g_new (NautilusTextCaptionDetail, 1);
gtk_box_set_homogeneous (GTK_BOX (text_caption), FALSE);
gtk_box_set_spacing (GTK_BOX (text_caption), TEXT_CAPTION_SPACING);
text_caption->detail->text = gtk_entry_new ();
gtk_entry_set_editable (GTK_ENTRY (text_caption->detail->text), TRUE);
nautilus_caption_set_child (NAUTILUS_CAPTION (text_caption),
text_caption->detail->text);
gtk_signal_connect (GTK_OBJECT (text_caption->detail->text),
"changed",
GTK_SIGNAL_FUNC (entry_changed_callback),
(gpointer) text_caption);
gtk_widget_show (text_caption->detail->text);
}
/*
* GtkObjectClass methods
*/
static void
nautilus_text_caption_destroy(GtkObject* object)
{
NautilusTextCaption * text_caption;
g_return_if_fail (object != NULL);
g_return_if_fail (NAUTILUS_IS_TEXT_CAPTION (object));
text_caption = NAUTILUS_TEXT_CAPTION (object);
g_free (text_caption->detail);
/* Chain */
NAUTILUS_CALL_PARENT_CLASS (GTK_OBJECT_CLASS, destroy, (object));
}
/*
* Editable (entry) callbacks
*/
static void
entry_changed_callback (GtkWidget *entry, gpointer user_data)
{
NautilusTextCaption *text_caption;
g_assert (user_data != NULL);
g_assert (NAUTILUS_IS_TEXT_CAPTION (user_data));
text_caption = NAUTILUS_TEXT_CAPTION (user_data);
gtk_signal_emit (GTK_OBJECT (text_caption), text_caption_signals[CHANGED]);
}
/*
* NautilusTextCaption public methods
*/
GtkWidget*
nautilus_text_caption_new (void)
{
NautilusTextCaption *text_caption;
text_caption = gtk_type_new (nautilus_text_caption_get_type ());
return GTK_WIDGET (text_caption);
}
/**
* nautilus_text_caption_get_text
* @text_caption: A NautilusTextCaption
*
* Returns: A copy of the currently selected text. Need to g_free() it.
*/
char *
nautilus_text_caption_get_text (NautilusTextCaption *text_caption)
{
const char *entry_text;
g_return_val_if_fail (text_caption != NULL, NULL);
g_return_val_if_fail (NAUTILUS_IS_TEXT_CAPTION (text_caption), NULL);
/* WATCHOUT:
* As of gtk1.2, gtk_entry_get_text() returns a non const reference to
* the internal string.
*/
entry_text = (const char *) gtk_entry_get_text (GTK_ENTRY (text_caption->detail->text));
return g_strdup (entry_text);
}
void
nautilus_text_caption_set_text (NautilusTextCaption *text_caption,
const char *text)
{
g_return_if_fail (text_caption != NULL);
g_return_if_fail (NAUTILUS_IS_TEXT_CAPTION (text_caption));
gtk_entry_set_text (GTK_ENTRY (text_caption->detail->text), text);
}

Some files were not shown because too many files have changed in this diff Show more