Commit 42550b2c authored by Ramiro Estrugo's avatar Ramiro Estrugo
Browse files

Use better names for the global preferences macros.

New method for removing callbacks.
Filter files according to the user level.
Add/Remove a preferences callback to keep track of user level changes.
parent 7d2c672e
2000-03-12 Ramiro Estrugo <ramiro@eazel.com>
* libnautilus/nautilus-global-preferences.c,
libnautilus/nautilus-global-preferences.h,
src/ntl-window-state.c:
Use better names for the global preferences macros.
Cleanup some #include cruft.
* nautilus-widgets/nautilus-preferences.c,
nautilus-widgets/nautilus-preferences.h:
(nautilus_prefecences_remove_callback):
New method for removing callbacks.
* src/file-manager/fm-directory-view.c:
(queue_pending_files, fm_directory_view_initialize ,
fm_directory_view_destroy): Filter files according to the user level.
Add/Remove a preferences callback to keep track of user level changes.
2000-03-12 Ramiro Estrugo <ramiro@eazel.com>
* AUTHORS,
......
......@@ -26,15 +26,8 @@
#include <nautilus-widgets/nautilus-preferences-group.h>
#include <nautilus-widgets/nautilus-preferences-item.h>
#include <nautilus-widgets/nautilus-preferences-dialog.h>
#include <gnome.h>
BEGIN_GNOME_DECLS
#include <libnautilus/nautilus-glib-extensions.h>
/*
* Constants
*/
......@@ -53,16 +46,10 @@ static GtkWidget *global_preferences_get_dialog (void);
static void global_preferences_register_static (NautilusPreferences *prefs);
static void global_preferences_register_dynamic (NautilusPreferences *prefs);
// static GtkWidget *global_preferences_dialog = NULL;
// static GtkObject *global_preferences = NULL;
static GtkWidget *panes[3];
static const gchar *global_preferences_window_option_pref_names[] =
{
NAUTILUS_GLOBAL_PREFERENCES_WINDOW_ALWAYS_NEW,
NAUTILUS_GLOBAL_PREFERENCES_WINDOW_SEARCH_EXISTING
NAUTILUS_PREFERENCES_WINDOW_ALWAYS_NEW,
NAUTILUS_PREFERENCES_WINDOW_SEARCH_EXISTING
};
static const gchar *global_preferences_meta_view_names[] =
......@@ -110,21 +97,21 @@ static NautilusPreferencesEnumData global_preferences_user_level_data =
static NautilusPreferencesInfo global_preferences_static_info[] =
{
{
NAUTILUS_GLOBAL_PREFERENCES_USER_LEVEL,
NAUTILUS_PREFERENCES_USER_LEVEL,
"User Level",
GTK_TYPE_ENUM,
FALSE,
(gconstpointer) NAUTILUS_USER_LEVEL_HACKER,
(gpointer) &global_preferences_user_level_data
},
{
NAUTILUS_GLOBAL_PREFERENCES_WINDOW_ALWAYS_NEW,
NAUTILUS_PREFERENCES_WINDOW_ALWAYS_NEW,
"Create new window for each new page",
GTK_TYPE_BOOL,
FALSE,
NULL
},
{
NAUTILUS_GLOBAL_PREFERENCES_WINDOW_SEARCH_EXISTING,
NAUTILUS_PREFERENCES_WINDOW_SEARCH_EXISTING,
"Do not open more than one window with the same page",
GTK_TYPE_BOOL,
FALSE,
......@@ -138,9 +125,9 @@ static NautilusPreferencesInfo global_preferences_static_info[] =
static GtkWidget *
global_preferences_create_dialog (void)
{
GtkWidget *panes[3];
GtkWidget *prefs_dialog;
NautilusPreferencesBox *prefs_box;
GtkWidget *user_level_group;
prefs_dialog = nautilus_preferences_dialog_new (GLOBAL_PREFERENCES_DIALOG_TITLE);
......@@ -150,9 +137,9 @@ global_preferences_create_dialog (void)
"User Level",
"User Level Something");
user_level_group = global_prefernces_create_enum_group (panes[0],
"User Level",
NAUTILUS_GLOBAL_PREFERENCES_USER_LEVEL);
global_prefernces_create_enum_group (panes[0],
"User Level",
NAUTILUS_PREFERENCES_USER_LEVEL);
panes[1] = nautilus_preferences_box_add_pane (prefs_box,
"Window Options",
......
......@@ -31,18 +31,19 @@
BEGIN_GNOME_DECLS
/* User level */
#define NAUTILUS_GLOBAL_PREFERENCES_USER_LEVEL "/nautilus/prefs/user_level"
#define NAUTILUS_PREFERENCES_USER_LEVEL "/nautilus/preferences/user_level"
/* Window options */
#define NAUTILUS_GLOBAL_PREFERENCES_WINDOW_ALWAYS_NEW "/nautilus/prefs/window_always_new"
#define NAUTILUS_GLOBAL_PREFERENCES_WINDOW_SEARCH_EXISTING "/nautilus/prefs/window_search_existing"
#define NAUTILUS_PREFERENCES_META_VIEWS_SHOW_ANNOTATIONS "/nautilus/prefs/metaviews::ntl_notes_view"
#define NAUTILUS_PREFERENCES_META_VIEWS_SHOW_HELP_CONTENTS "/nautilus/prefs/metaviews::hyperbola_navigation_tree"
#define NAUTILUS_PREFERENCES_META_VIEWS_SHOW_HELP_INDEX "/nautilus/prefs/metaviews::hyperbola_navigation_index"
#define NAUTILUS_PREFERENCES_META_VIEWS_SHOW_HELP_SEARCH "/nautilus/prefs/metaviews::hyperbola_navigation_search"
#define NAUTILUS_PREFERENCES_META_VIEWS_SHOW_HISTORY "/nautilus/prefs/metaviews::ntl_history_view"
#define NAUTILUS_PREFERENCES_META_VIEWS_SHOW_WEB_SEARCH "/nautilus/prefs/metaviews::ntl_websearch_view"
#define NAUTILUS_PREFERENCES_WINDOW_ALWAYS_NEW "/nautilus/preferences/window_always_new"
#define NAUTILUS_PREFERENCES_WINDOW_SEARCH_EXISTING "/nautilus/preferences/window_search_existing"
/* Wellknown meta views */
#define NAUTILUS_PREFERENCES_META_VIEWS_SHOW_ANNOTATIONS "/nautilus/metaviews/ntl_notes_view"
#define NAUTILUS_PREFERENCES_META_VIEWS_SHOW_HELP_CONTENTS "/nautilus/metaviews/hyperbola_navigation_tree"
#define NAUTILUS_PREFERENCES_META_VIEWS_SHOW_HELP_INDEX "/nautilus/metaviews/hyperbola_navigation_index"
#define NAUTILUS_PREFERENCES_META_VIEWS_SHOW_HELP_SEARCH "/nautilus/metaviews/hyperbola_navigation_search"
#define NAUTILUS_PREFERENCES_META_VIEWS_SHOW_HISTORY "/nautilus/metaviews/ntl_history_view"
#define NAUTILUS_PREFERENCES_META_VIEWS_SHOW_WEB_SEARCH "/nautilus/metaviews/ntl_websearch_view"
enum
{
......
......@@ -57,49 +57,46 @@ struct _NautilusPreferencesDetails
};
/* NautilusPreferencesClass methods */
static void nautilus_preferences_initialize_class (NautilusPreferencesClass *klass);
static void nautilus_preferences_initialize (NautilusPreferences *prefs);
static void nautilus_preferences_initialize_class (NautilusPreferencesClass *klass);
static void nautilus_preferences_initialize (NautilusPreferences *prefs);
/* GtkObjectClass methods */
static void prefs_destroy (GtkObject *object);
static void prefs_destroy (GtkObject *object);
/* PrefHashInfo functions */
static PrefHashInfo * pref_hash_info_alloc (const NautilusPreferencesInfo *pref_info);
static void pref_hash_info_free (PrefHashInfo *pref_hash_info);
static void pref_hash_info_free_func (gpointer key,
gpointer value,
gpointer user_data);
static PrefHashInfo * pref_hash_info_alloc (const NautilusPreferencesInfo *pref_info);
static void pref_hash_info_free (PrefHashInfo *pref_hash_info);
static void pref_hash_info_free_func (gpointer key,
gpointer value,
gpointer user_data);
/* PrefCallbackInfo functions */
static PrefCallbackInfo * pref_callback_info_alloc (NautilusPreferencesCallback callback_proc,
gpointer user_data,
const PrefHashInfo *hash_info);
static void pref_callback_info_free (PrefCallbackInfo *pref_hash_info);
static void pref_callback_info_free_func (gpointer data,
gpointer user_data);
static void pref_callback_info_invoke_func (gpointer data,
gpointer user_data);
static void pref_hash_info_add_callback (PrefHashInfo *pref_hash_info,
NautilusPreferencesCallback callback_proc,
gpointer user_data);
static PrefCallbackInfo * pref_callback_info_alloc (NautilusPreferencesCallback callback_proc,
gpointer user_data,
const PrefHashInfo *hash_info);
static void pref_callback_info_free (PrefCallbackInfo *pref_hash_info);
static void pref_callback_info_free_func (gpointer data,
gpointer user_data);
static void pref_callback_info_invoke_func (gpointer data,
gpointer user_data);
static void pref_hash_info_add_callback (PrefHashInfo *pref_hash_info,
NautilusPreferencesCallback callback_proc,
gpointer user_data);
static void pref_hash_info_remove_callback (PrefHashInfo *pref_hash_info,
NautilusPreferencesCallback callback_proc,
gpointer user_data);
/* Private stuff */
static GtkFundamentalType prefs_check_supported_type (GtkFundamentalType pref_type);
static gboolean prefs_set_pref (NautilusPreferences *prefs,
const gchar *pref_name,
gpointer pref_value);
static gboolean prefs_get_pref (NautilusPreferences *prefs,
const gchar *pref_name,
GtkFundamentalType *pref_type_out,
gconstpointer *pref_value_out);
PrefHashInfo * prefs_hash_lookup (NautilusPreferences *prefs,
const gchar *pref_name);
static GtkFundamentalType prefs_check_supported_type (GtkFundamentalType pref_type);
static gboolean prefs_set_pref (NautilusPreferences *prefs,
const gchar *pref_name,
gpointer pref_value);
static gboolean prefs_get_pref (NautilusPreferences *prefs,
const gchar *pref_name,
GtkFundamentalType *pref_type_out,
gconstpointer *pref_value_out);
PrefHashInfo * prefs_hash_lookup (NautilusPreferences *prefs,
const gchar *pref_name);
NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusPreferences, nautilus_preferences, GTK_TYPE_OBJECT)
......@@ -238,11 +235,46 @@ pref_hash_info_add_callback (PrefHashInfo *pref_hash_info,
user_data,
pref_hash_info);
g_assert (pref_callback_info != NULL);
pref_hash_info->callback_list =
g_list_append (pref_hash_info->callback_list,
(gpointer) pref_callback_info);
}
static void
pref_hash_info_remove_callback (PrefHashInfo *pref_hash_info,
NautilusPreferencesCallback callback_proc,
gpointer user_data)
{
GList *new_list;
GList *iterator;
g_assert (pref_hash_info != NULL);
g_assert (callback_proc != NULL);
g_assert (pref_hash_info->callback_list != NULL);
new_list = g_list_copy (pref_hash_info->callback_list);
for (iterator = new_list; iterator != NULL; iterator = iterator->next)
{
PrefCallbackInfo *callback_info = (PrefCallbackInfo *) iterator->data;
g_assert (callback_info != NULL);
if (callback_info->callback_proc == callback_proc &&
callback_info->user_data == user_data)
{
g_list_remove (pref_hash_info->callback_list,
(gpointer) callback_info);
pref_callback_info_free (callback_info);
}
}
}
static void
pref_hash_info_free_func (gpointer key,
gpointer value,
......@@ -529,6 +561,35 @@ nautilus_preferences_add_callback (NautilusPreferences *prefs,
return TRUE;
}
gboolean
nautilus_preferences_remove_callback (NautilusPreferences *prefs,
const gchar *pref_name,
NautilusPreferencesCallback callback_proc,
gpointer user_data)
{
PrefHashInfo * pref_hash_info;
g_return_val_if_fail (prefs != NULL, FALSE);
g_return_val_if_fail (NAUTILUS_IS_PREFS (prefs), FALSE);
g_return_val_if_fail (pref_name != NULL, FALSE);
g_return_val_if_fail (callback_proc != NULL, FALSE);
pref_hash_info = prefs_hash_lookup (prefs, pref_name);
if (!pref_hash_info)
{
g_warning ("trying to remove a callback from an unregistered preference.\n");
return FALSE;
}
pref_hash_info_remove_callback (pref_hash_info,
callback_proc,
user_data);
return TRUE;
}
void
nautilus_preferences_set_boolean (NautilusPreferences *prefs,
const gchar *pref_name,
......
......@@ -81,33 +81,38 @@ typedef struct
guint num_entries;
} NautilusPreferencesEnumData;
GtkType nautilus_preferences_get_type (void);
GtkObject* nautilus_preferences_new (const gchar *domain);
void nautilus_preferences_register_from_info (NautilusPreferences *prefs,
const NautilusPreferencesInfo *pref_info);
void nautilus_preferences_register_from_values (NautilusPreferences *prefs,
gchar *pref_name,
gchar *pref_description,
GtkFundamentalType pref_type,
gconstpointer pref_default_value,
gpointer type_data);
const NautilusPreferencesInfo *nautilus_preferences_get_pref_info (NautilusPreferences *prefs,
const gchar *pref_name);
gboolean nautilus_preferences_add_callback (NautilusPreferences *prefs,
const gchar *pref_name,
NautilusPreferencesCallback callback,
gpointer user_data);
void nautilus_preferences_set_boolean (NautilusPreferences *prefs,
const gchar *pref_name,
gboolean boolean_value);
gboolean nautilus_preferences_get_boolean (NautilusPreferences *prefs,
const gchar *pref_name);
void nautilus_preferences_set_enum (NautilusPreferences *prefs,
const gchar *pref_name,
gint enum_value);
gint nautilus_preferences_get_enum (NautilusPreferences *prefs,
const gchar *pref_name);
NautilusPreferences * nautilus_preferences_get_global_preferences (void);
GtkType nautilus_preferences_get_type (void);
GtkObject* nautilus_preferences_new (const gchar *domain);
void nautilus_preferences_register_from_info (NautilusPreferences *prefs,
const NautilusPreferencesInfo *pref_info);
void nautilus_preferences_register_from_values (NautilusPreferences *prefs,
gchar *pref_name,
gchar *pref_description,
GtkFundamentalType pref_type,
gconstpointer pref_default_value,
gpointer type_data);
const NautilusPreferencesInfo *nautilus_preferences_get_pref_info (NautilusPreferences *prefs,
const gchar *pref_name);
gboolean nautilus_preferences_add_callback (NautilusPreferences *prefs,
const gchar *pref_name,
NautilusPreferencesCallback callback,
gpointer user_data);
gboolean nautilus_preferences_remove_callback (NautilusPreferences *prefs,
const gchar *pref_name,
NautilusPreferencesCallback callback,
gpointer user_data);
void nautilus_preferences_set_boolean (NautilusPreferences *prefs,
const gchar *pref_name,
gboolean boolean_value);
gboolean nautilus_preferences_get_boolean (NautilusPreferences *prefs,
const gchar *pref_name);
void nautilus_preferences_set_enum (NautilusPreferences *prefs,
const gchar *pref_name,
gint enum_value);
gint nautilus_preferences_get_enum (NautilusPreferences *prefs,
const gchar *pref_name);
NautilusPreferences * nautilus_preferences_get_global_preferences (void);
BEGIN_GNOME_DECLS
......
......@@ -26,15 +26,8 @@
#include <nautilus-widgets/nautilus-preferences-group.h>
#include <nautilus-widgets/nautilus-preferences-item.h>
#include <nautilus-widgets/nautilus-preferences-dialog.h>
#include <gnome.h>
BEGIN_GNOME_DECLS
#include <libnautilus/nautilus-glib-extensions.h>
/*
* Constants
*/
......@@ -53,16 +46,10 @@ static GtkWidget *global_preferences_get_dialog (void);
static void global_preferences_register_static (NautilusPreferences *prefs);
static void global_preferences_register_dynamic (NautilusPreferences *prefs);
// static GtkWidget *global_preferences_dialog = NULL;
// static GtkObject *global_preferences = NULL;
static GtkWidget *panes[3];
static const gchar *global_preferences_window_option_pref_names[] =
{
NAUTILUS_GLOBAL_PREFERENCES_WINDOW_ALWAYS_NEW,
NAUTILUS_GLOBAL_PREFERENCES_WINDOW_SEARCH_EXISTING
NAUTILUS_PREFERENCES_WINDOW_ALWAYS_NEW,
NAUTILUS_PREFERENCES_WINDOW_SEARCH_EXISTING
};
static const gchar *global_preferences_meta_view_names[] =
......@@ -110,21 +97,21 @@ static NautilusPreferencesEnumData global_preferences_user_level_data =
static NautilusPreferencesInfo global_preferences_static_info[] =
{
{
NAUTILUS_GLOBAL_PREFERENCES_USER_LEVEL,
NAUTILUS_PREFERENCES_USER_LEVEL,
"User Level",
GTK_TYPE_ENUM,
FALSE,
(gconstpointer) NAUTILUS_USER_LEVEL_HACKER,
(gpointer) &global_preferences_user_level_data
},
{
NAUTILUS_GLOBAL_PREFERENCES_WINDOW_ALWAYS_NEW,
NAUTILUS_PREFERENCES_WINDOW_ALWAYS_NEW,
"Create new window for each new page",
GTK_TYPE_BOOL,
FALSE,
NULL
},
{
NAUTILUS_GLOBAL_PREFERENCES_WINDOW_SEARCH_EXISTING,
NAUTILUS_PREFERENCES_WINDOW_SEARCH_EXISTING,
"Do not open more than one window with the same page",
GTK_TYPE_BOOL,
FALSE,
......@@ -138,9 +125,9 @@ static NautilusPreferencesInfo global_preferences_static_info[] =
static GtkWidget *
global_preferences_create_dialog (void)
{
GtkWidget *panes[3];
GtkWidget *prefs_dialog;
NautilusPreferencesBox *prefs_box;
GtkWidget *user_level_group;
prefs_dialog = nautilus_preferences_dialog_new (GLOBAL_PREFERENCES_DIALOG_TITLE);
......@@ -150,9 +137,9 @@ global_preferences_create_dialog (void)
"User Level",
"User Level Something");
user_level_group = global_prefernces_create_enum_group (panes[0],
"User Level",
NAUTILUS_GLOBAL_PREFERENCES_USER_LEVEL);
global_prefernces_create_enum_group (panes[0],
"User Level",
NAUTILUS_PREFERENCES_USER_LEVEL);
panes[1] = nautilus_preferences_box_add_pane (prefs_box,
"Window Options",
......
......@@ -31,18 +31,19 @@
BEGIN_GNOME_DECLS
/* User level */
#define NAUTILUS_GLOBAL_PREFERENCES_USER_LEVEL "/nautilus/prefs/user_level"
#define NAUTILUS_PREFERENCES_USER_LEVEL "/nautilus/preferences/user_level"
/* Window options */
#define NAUTILUS_GLOBAL_PREFERENCES_WINDOW_ALWAYS_NEW "/nautilus/prefs/window_always_new"
#define NAUTILUS_GLOBAL_PREFERENCES_WINDOW_SEARCH_EXISTING "/nautilus/prefs/window_search_existing"
#define NAUTILUS_PREFERENCES_META_VIEWS_SHOW_ANNOTATIONS "/nautilus/prefs/metaviews::ntl_notes_view"
#define NAUTILUS_PREFERENCES_META_VIEWS_SHOW_HELP_CONTENTS "/nautilus/prefs/metaviews::hyperbola_navigation_tree"
#define NAUTILUS_PREFERENCES_META_VIEWS_SHOW_HELP_INDEX "/nautilus/prefs/metaviews::hyperbola_navigation_index"
#define NAUTILUS_PREFERENCES_META_VIEWS_SHOW_HELP_SEARCH "/nautilus/prefs/metaviews::hyperbola_navigation_search"
#define NAUTILUS_PREFERENCES_META_VIEWS_SHOW_HISTORY "/nautilus/prefs/metaviews::ntl_history_view"
#define NAUTILUS_PREFERENCES_META_VIEWS_SHOW_WEB_SEARCH "/nautilus/prefs/metaviews::ntl_websearch_view"
#define NAUTILUS_PREFERENCES_WINDOW_ALWAYS_NEW "/nautilus/preferences/window_always_new"
#define NAUTILUS_PREFERENCES_WINDOW_SEARCH_EXISTING "/nautilus/preferences/window_search_existing"
/* Wellknown meta views */
#define NAUTILUS_PREFERENCES_META_VIEWS_SHOW_ANNOTATIONS "/nautilus/metaviews/ntl_notes_view"
#define NAUTILUS_PREFERENCES_META_VIEWS_SHOW_HELP_CONTENTS "/nautilus/metaviews/hyperbola_navigation_tree"
#define NAUTILUS_PREFERENCES_META_VIEWS_SHOW_HELP_INDEX "/nautilus/metaviews/hyperbola_navigation_index"
#define NAUTILUS_PREFERENCES_META_VIEWS_SHOW_HELP_SEARCH "/nautilus/metaviews/hyperbola_navigation_search"
#define NAUTILUS_PREFERENCES_META_VIEWS_SHOW_HISTORY "/nautilus/metaviews/ntl_history_view"
#define NAUTILUS_PREFERENCES_META_VIEWS_SHOW_WEB_SEARCH "/nautilus/metaviews/ntl_websearch_view"
enum
{
......
......@@ -57,49 +57,46 @@ struct _NautilusPreferencesDetails
};
/* NautilusPreferencesClass methods */
static void nautilus_preferences_initialize_class (NautilusPreferencesClass *klass);
static void nautilus_preferences_initialize (NautilusPreferences *prefs);
static void nautilus_preferences_initialize_class (NautilusPreferencesClass *klass);
static void nautilus_preferences_initialize (NautilusPreferences *prefs);
/* GtkObjectClass methods */
static void prefs_destroy (GtkObject *object);
static void prefs_destroy (GtkObject *object);
/* PrefHashInfo functions */
static PrefHashInfo * pref_hash_info_alloc (const NautilusPreferencesInfo *pref_info);
static void pref_hash_info_free (PrefHashInfo *pref_hash_info);
static void pref_hash_info_free_func (gpointer key,
gpointer value,
gpointer user_data);
static PrefHashInfo * pref_hash_info_alloc (const NautilusPreferencesInfo *pref_info);
static void pref_hash_info_free (PrefHashInfo *pref_hash_info);
static void pref_hash_info_free_func (gpointer key,
gpointer value,
gpointer user_data);
/* PrefCallbackInfo functions */
static PrefCallbackInfo * pref_callback_info_alloc (NautilusPreferencesCallback callback_proc,
gpointer user_data,
const PrefHashInfo *hash_info);
static void pref_callback_info_free (PrefCallbackInfo *pref_hash_info);
static void pref_callback_info_free_func (gpointer data,
gpointer user_data);
static void pref_callback_info_invoke_func (gpointer data,
gpointer user_data);
static void pref_hash_info_add_callback (PrefHashInfo *pref_hash_info,
NautilusPreferencesCallback callback_proc,
gpointer user_data);
static PrefCallbackInfo * pref_callback_info_alloc (NautilusPreferencesCallback callback_proc,
gpointer user_data,
const PrefHashInfo *hash_info);
static void pref_callback_info_free (PrefCallbackInfo *pref_hash_info);
static void pref_callback_info_free_func (gpointer data,
gpointer user_data);
static void pref_callback_info_invoke_func (gpointer data,
gpointer user_data);
static void pref_hash_info_add_callback (PrefHashInfo *pref_hash_info,
NautilusPreferencesCallback callback_proc,
gpointer user_data);
static void pref_hash_info_remove_callback (PrefHashInfo *pref_hash_info,
NautilusPreferencesCallback callback_proc,
gpointer user_data);
/* Private stuff */
static GtkFundamentalType prefs_check_supported_type (GtkFundamentalType pref_type);
static gboolean prefs_set_pref (NautilusPreferences *prefs,
const gchar *pref_name,
gpointer pref_value);
static gboolean prefs_get_pref (NautilusPreferences *prefs,
const gchar *pref_name,
GtkFundamentalType *pref_type_out,
gconstpointer *pref_value_out);
PrefHashInfo * prefs_hash_lookup (NautilusPreferences *prefs,
const gchar *pref_name);
static GtkFundamentalType prefs_check_supported_type (GtkFundamentalType pref_type);
static gboolean prefs_set_pref (NautilusPreferences *prefs,
const gchar *pref_name,
gpointer pref_value);
static gboolean prefs_get_pref (NautilusPreferences *prefs,
const gchar *pref_name,
GtkFundamentalType *pref_type_out,
gconstpointer *pref_value_out);
PrefHashInfo * prefs_hash_lookup (NautilusPreferences *prefs,
const gchar *pref_name);
NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusPreferences, nautilus_preferences, GTK_TYPE_OBJECT)
......@@ -238,11 +235,46 @@ pref_hash_info_add_callback (PrefHashInfo *pref_hash_info,
user_data,
pref_hash_info);
g_assert (pref_callback_info != NULL);
pref_hash_info->callback_list =
g_list_append (pref_hash_info->callback_list,
(gpointer) pref_callback_info);
}
static void
pref_hash_info_remove_callback (PrefHashInfo *pref_hash_info,
NautilusPreferencesCallback callback_proc,
gpointer user_data)
{
GList *new_list;
GList *iterator;
g_assert (pref_hash_info != NULL);
g_assert (callback_proc != NULL);
g_assert (pref_hash_info->callback_list != NULL);
new_list = g_list_copy (pref_hash_info->callback_list);
for (iterator = new_list; iterator != NULL; iterator = iterator->next)
{
PrefCallbackInfo *callback_info = (PrefCallbackInfo *) iterator->data;
g_assert (callback_info != NULL);
if (callback_info->callback_proc == callback_proc &&
callback_info->user_data == user_data)
{
g_list_remove (pref_hash_info->callback_list,
(gpointer) callback_info);
pref_callback_info_free (callback_info);
}