summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHavoc Pennington <hp@pobox.com>2000-10-17 05:18:20 +0000
committerHavoc Pennington <hp@src.gnome.org>2000-10-17 05:18:20 +0000
commit074a696e8bbdbb9a72300a655ae0248000d5b7c2 (patch)
tree7309f130bea882e7dea49540e72d74291aaa7755
parent1330890f3074897b6c705cc5f1716ebbed3861fa (diff)
downloadgconf-074a696e8bbdbb9a72300a655ae0248000d5b7c2.tar.gz
implement default error handler that prints to stderr
2000-10-16 Havoc Pennington <hp@pobox.com> * wrappers/gtk/gconf-client.c (gconf_client_real_unreturned_error): implement default error handler that prints to stderr (gconf_client_key_is_writable): hmm, this function didn't compile very cleanly * wrappers/gtk/gconf-client.h: Remove the ParentWindowFunc concept. Two reasons: a) it was really hard for users to implement such a thing, and if they did then implementing an error dialog function was pretty trivial also b) decided to make the default error handler use fprintf(stderr) since GConfClient is going to move into the main GConf library and thus not depend on GTK. So, this is mild API breakage (but hopefully no one was using the feature anyway).
-rw-r--r--ChangeLog18
-rw-r--r--TODO2
-rw-r--r--gconf/gconf-client.c31
-rw-r--r--gconf/gconf-client.h18
-rw-r--r--wrappers/gtk/gconf-client.c31
-rw-r--r--wrappers/gtk/gconf-client.h18
6 files changed, 54 insertions, 64 deletions
diff --git a/ChangeLog b/ChangeLog
index 201acc97..4e2a4e3e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2000-10-16 Havoc Pennington <hp@pobox.com>
+
+ * wrappers/gtk/gconf-client.c
+ (gconf_client_real_unreturned_error): implement default error
+ handler that prints to stderr
+ (gconf_client_key_is_writable): hmm, this function didn't compile
+ very cleanly
+
+ * wrappers/gtk/gconf-client.h: Remove the ParentWindowFunc
+ concept. Two reasons: a) it was really hard for users to implement
+ such a thing, and if they did then implementing an error dialog
+ function was pretty trivial also b) decided to make the default
+ error handler use fprintf(stderr) since GConfClient is going to
+ move into the main GConf library and thus not depend on GTK.
+
+ So, this is mild API breakage (but hopefully no one was using the
+ feature anyway).
+
2000-10-10 Christophe Merlet <christophe@merlet.net>
* backends/Makefile.am: Added README.bdb in EXTRA_DIST.
diff --git a/TODO b/TODO
index 6dc8e29b..29b5600a 100644
--- a/TODO
+++ b/TODO
@@ -19,8 +19,6 @@ Other
* Maintain documentation
-* Implement the default error handlers in GConfClient
-
* Envisioneering
Maybe 1.4
diff --git a/gconf/gconf-client.c b/gconf/gconf-client.c
index 72b58f4d..d200139b 100644
--- a/gconf/gconf-client.c
+++ b/gconf/gconf-client.c
@@ -129,6 +129,14 @@ static void gconf_client_real_remove_dir (GConfClient* client,
Dir* d,
GError** err);
+static GConfValue* get_nocopy (GConfClient *client,
+ const gchar *key,
+ gboolean use_default,
+ gboolean *is_default_retloc,
+ gboolean *is_writable_retloc,
+ GError **error);
+
+
static guint client_signals[LAST_SIGNAL] = { 0 };
static GtkObjectClass* parent_class = NULL;
@@ -272,13 +280,12 @@ gconf_client_real_unreturned_error (GConfClient* client, GError* error)
{
if (global_error_handler != NULL)
{
- (*global_error_handler) (client, client->parent_func, client->parent_user_data,
- error);
-
+ (*global_error_handler) (client, error);
}
else
{
- g_warning("Default GConf error handler unimplemented, error is:\n %s", error->message);
+ fprintf (stderr, _("GConf Error: %s\n"),
+ error->message);
}
}
}
@@ -290,13 +297,12 @@ gconf_client_real_error (GConfClient* client, GError* error)
{
if (global_error_handler != NULL)
{
- (*global_error_handler) (client, client->parent_func, client->parent_user_data,
- error);
-
+ (*global_error_handler) (client, error);
}
else
{
- g_warning("Default GConf error handler unimplemented, error is:\n %s", error->message);
+ fprintf (stderr, _("GConf Error: %s\n"),
+ error->message);
}
}
}
@@ -718,17 +724,12 @@ gconf_client_notify_remove (GConfClient* client,
void
gconf_client_set_error_handling(GConfClient* client,
- GConfClientErrorHandlingMode mode,
- /* func can be NULL for none or N/A */
- GConfClientParentWindowFunc func,
- gpointer user_data)
+ GConfClientErrorHandlingMode mode)
{
g_return_if_fail(client != NULL);
g_return_if_fail(GCONF_IS_CLIENT(client));
client->error_mode = mode;
- client->parent_func = func;
- client->parent_user_data = user_data;
}
static gboolean
@@ -968,7 +969,7 @@ gconf_client_key_is_writable(GConfClient* client,
GConfValue* val = NULL;
gboolean is_writable = TRUE;
- g_return_val_if_fail(err == NULL || *err == NULL, NULL);
+ g_return_val_if_fail(err == NULL || *err == NULL, FALSE);
val = get_nocopy (client, key, TRUE,
NULL, &is_writable, &error);
diff --git a/gconf/gconf-client.h b/gconf/gconf-client.h
index 5504b359..435bee2b 100644
--- a/gconf/gconf-client.h
+++ b/gconf/gconf-client.h
@@ -79,17 +79,8 @@ typedef void (*GConfClientNotifyFunc)(GConfClient* client,
GConfEntry *entry,
gpointer user_data);
-/*
- * Return the parent window error dialogs should be associated with,
- * or NULL for none.
- */
-
-typedef GtkWidget* (*GConfClientParentWindowFunc) (GConfClient* client,
- gpointer user_data);
-
typedef void (*GConfClientErrorHandlerFunc) (GConfClient* client,
- GConfClientParentWindowFunc parent_func,
- gpointer parent_user_data, GError* error);
+ GError* error);
#define GCONF_TYPE_CLIENT (gconf_client_get_type ())
#define GCONF_CLIENT(obj) (GTK_CHECK_CAST ((obj), GCONF_TYPE_CLIENT, GConfClient))
@@ -105,8 +96,6 @@ struct _GConfClient
GConfEngine* engine;
GConfClientErrorHandlingMode error_mode;
- GConfClientParentWindowFunc parent_func;
- gpointer parent_user_data;
GHashTable* dir_hash;
GHashTable* cache_hash;
GConfListeners* listeners;
@@ -204,10 +193,7 @@ void gconf_client_notify_remove (GConfClient* client,
*/
void gconf_client_set_error_handling(GConfClient* client,
- GConfClientErrorHandlingMode mode,
- /* func can be NULL for none or N/A */
- GConfClientParentWindowFunc func,
- gpointer user_data);
+ GConfClientErrorHandlingMode mode);
/* Intended for use by gnome-libs */
diff --git a/wrappers/gtk/gconf-client.c b/wrappers/gtk/gconf-client.c
index 72b58f4d..d200139b 100644
--- a/wrappers/gtk/gconf-client.c
+++ b/wrappers/gtk/gconf-client.c
@@ -129,6 +129,14 @@ static void gconf_client_real_remove_dir (GConfClient* client,
Dir* d,
GError** err);
+static GConfValue* get_nocopy (GConfClient *client,
+ const gchar *key,
+ gboolean use_default,
+ gboolean *is_default_retloc,
+ gboolean *is_writable_retloc,
+ GError **error);
+
+
static guint client_signals[LAST_SIGNAL] = { 0 };
static GtkObjectClass* parent_class = NULL;
@@ -272,13 +280,12 @@ gconf_client_real_unreturned_error (GConfClient* client, GError* error)
{
if (global_error_handler != NULL)
{
- (*global_error_handler) (client, client->parent_func, client->parent_user_data,
- error);
-
+ (*global_error_handler) (client, error);
}
else
{
- g_warning("Default GConf error handler unimplemented, error is:\n %s", error->message);
+ fprintf (stderr, _("GConf Error: %s\n"),
+ error->message);
}
}
}
@@ -290,13 +297,12 @@ gconf_client_real_error (GConfClient* client, GError* error)
{
if (global_error_handler != NULL)
{
- (*global_error_handler) (client, client->parent_func, client->parent_user_data,
- error);
-
+ (*global_error_handler) (client, error);
}
else
{
- g_warning("Default GConf error handler unimplemented, error is:\n %s", error->message);
+ fprintf (stderr, _("GConf Error: %s\n"),
+ error->message);
}
}
}
@@ -718,17 +724,12 @@ gconf_client_notify_remove (GConfClient* client,
void
gconf_client_set_error_handling(GConfClient* client,
- GConfClientErrorHandlingMode mode,
- /* func can be NULL for none or N/A */
- GConfClientParentWindowFunc func,
- gpointer user_data)
+ GConfClientErrorHandlingMode mode)
{
g_return_if_fail(client != NULL);
g_return_if_fail(GCONF_IS_CLIENT(client));
client->error_mode = mode;
- client->parent_func = func;
- client->parent_user_data = user_data;
}
static gboolean
@@ -968,7 +969,7 @@ gconf_client_key_is_writable(GConfClient* client,
GConfValue* val = NULL;
gboolean is_writable = TRUE;
- g_return_val_if_fail(err == NULL || *err == NULL, NULL);
+ g_return_val_if_fail(err == NULL || *err == NULL, FALSE);
val = get_nocopy (client, key, TRUE,
NULL, &is_writable, &error);
diff --git a/wrappers/gtk/gconf-client.h b/wrappers/gtk/gconf-client.h
index 5504b359..435bee2b 100644
--- a/wrappers/gtk/gconf-client.h
+++ b/wrappers/gtk/gconf-client.h
@@ -79,17 +79,8 @@ typedef void (*GConfClientNotifyFunc)(GConfClient* client,
GConfEntry *entry,
gpointer user_data);
-/*
- * Return the parent window error dialogs should be associated with,
- * or NULL for none.
- */
-
-typedef GtkWidget* (*GConfClientParentWindowFunc) (GConfClient* client,
- gpointer user_data);
-
typedef void (*GConfClientErrorHandlerFunc) (GConfClient* client,
- GConfClientParentWindowFunc parent_func,
- gpointer parent_user_data, GError* error);
+ GError* error);
#define GCONF_TYPE_CLIENT (gconf_client_get_type ())
#define GCONF_CLIENT(obj) (GTK_CHECK_CAST ((obj), GCONF_TYPE_CLIENT, GConfClient))
@@ -105,8 +96,6 @@ struct _GConfClient
GConfEngine* engine;
GConfClientErrorHandlingMode error_mode;
- GConfClientParentWindowFunc parent_func;
- gpointer parent_user_data;
GHashTable* dir_hash;
GHashTable* cache_hash;
GConfListeners* listeners;
@@ -204,10 +193,7 @@ void gconf_client_notify_remove (GConfClient* client,
*/
void gconf_client_set_error_handling(GConfClient* client,
- GConfClientErrorHandlingMode mode,
- /* func can be NULL for none or N/A */
- GConfClientParentWindowFunc func,
- gpointer user_data);
+ GConfClientErrorHandlingMode mode);
/* Intended for use by gnome-libs */