diff options
author | Jonathon Jongsma <jonathon@quotidian.org> | 2009-11-25 06:27:08 +0800 |
---|---|---|
committer | Jonathon Jongsma <jonathon@quotidian.org> | 2009-12-01 03:29:25 +0800 |
commit | ae8f6d681c0512089f9259de0fd1b270396991d5 (patch) | |
tree | 45955945a454da85b89f7b2aae3a3554904c64b5 /e-util/e-error.h | |
parent | 407f96826f41fe5d74d7224be99dff59492d8ee4 (diff) | |
download | gsoc2013-evolution-ae8f6d681c0512089f9259de0fd1b270396991d5.tar.gz gsoc2013-evolution-ae8f6d681c0512089f9259de0fd1b270396991d5.tar.zst gsoc2013-evolution-ae8f6d681c0512089f9259de0fd1b270396991d5.zip |
Refactor error reporting to separate error from dialogs
Previously, Most things reported errors directly. This is evidenced by the fact
that e_error_new() returns a GtkDialog*. This patch attempts to de-couple
error-reporting from the UI. It introduces a simple stuct (EError) that
describes the error which is returned much like a GError by passing it as an
output parameter to a function.
e_error_new() now returns a newly-allocated EError*, but the function signature
has changed to no longer accept a parent GtkWidget, so the API change should be
detected at compile time. I kept the convenience dialog functions, but renamed
them slightly:
- e_error_new() -> e_error_new_dialog()
- e_error_run() -> e_error_run_dialog()
Build is currently broken because nothing has been ported to use this new API
yet.
https://bugzilla.gnome.org/show_bug.cgi?id=602963
Diffstat (limited to 'e-util/e-error.h')
-rw-r--r-- | e-util/e-error.h | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/e-util/e-error.h b/e-util/e-error.h index 38de4c86ed..8068668a26 100644 --- a/e-util/e-error.h +++ b/e-util/e-error.h @@ -47,13 +47,20 @@ /* takes filename, reason */ #define E_ERROR_NO_LOAD_FILE "system:no-save-file" -/* Note that all errors returned are standard GtkDialoge's */ -GtkWidget *e_error_new(GtkWindow *parent, const gchar *tag, const gchar *arg0, ...); -GtkWidget *e_error_newv(GtkWindow *parent, const gchar *tag, const gchar *arg0, va_list ap); +typedef struct _EError EError; -gint e_error_run(GtkWindow *parent, const gchar *tag, const gchar *arg0, ...); -gint e_error_runv(GtkWindow *parent, const gchar *tag, const gchar *arg0, va_list ap); +EError *e_error_new(const gchar *tag, const gchar *arg0, ...); +EError *e_error_newv(const gchar *tag, const gchar *arg0, va_list ap); -guint e_error_count_buttons (GtkDialog *dialog); +void e_error_free (EError *error); + +/* Convenience functions for displaying the error in a GtkDialog */ +GtkWidget *e_error_new_dialog(GtkWindow *parent, EError *error); +GtkWidget *e_error_new_dialog_for_args (GtkWindow *parent, const gchar *tag, const gchar *arg0, ...); + +gint e_error_run_dialog(GtkWindow *parent, EError *error); +gint e_error_run_dialog_for_args (GtkWindow *parent, const gchar *tag, const gchar *arg0, ...); + +guint e_error_dialog_count_buttons (GtkDialog *dialog); #endif /* !_E_ERROR_H */ |