aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/misc
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2004-05-21 17:12:15 +0800
committerMichael Zucci <zucchi@src.gnome.org>2004-05-21 17:12:15 +0800
commit323689b6584196bce37251b2ec3c81d52c815f62 (patch)
treec250c12ce20dae3c9f606a8363c4817a0c70a644 /widgets/misc
parentffa75e6801faaffb2626d83779fe0a91a8f58d3a (diff)
downloadgsoc2013-evolution-323689b6584196bce37251b2ec3c81d52c815f62.tar
gsoc2013-evolution-323689b6584196bce37251b2ec3c81d52c815f62.tar.gz
gsoc2013-evolution-323689b6584196bce37251b2ec3c81d52c815f62.tar.bz2
gsoc2013-evolution-323689b6584196bce37251b2ec3c81d52c815f62.tar.lz
gsoc2013-evolution-323689b6584196bce37251b2ec3c81d52c815f62.tar.xz
gsoc2013-evolution-323689b6584196bce37251b2ec3c81d52c815f62.tar.zst
gsoc2013-evolution-323689b6584196bce37251b2ec3c81d52c815f62.zip
set a default error parent fallback. (e_error_newv): if parent is null,
2004-05-21 Not Zed <NotZed@Ximian.com> * e-error.c (e_error_default_parent): set a default error parent fallback. (e_error_newv): if parent is null, see if we have a default still alive, and use that. warn if not. svn path=/trunk/; revision=26031
Diffstat (limited to 'widgets/misc')
-rw-r--r--widgets/misc/ChangeLog7
-rw-r--r--widgets/misc/e-error.c30
-rw-r--r--widgets/misc/e-error.h2
3 files changed, 39 insertions, 0 deletions
diff --git a/widgets/misc/ChangeLog b/widgets/misc/ChangeLog
index a286d51d87..5eee093db6 100644
--- a/widgets/misc/ChangeLog
+++ b/widgets/misc/ChangeLog
@@ -1,3 +1,10 @@
+2004-05-21 Not Zed <NotZed@Ximian.com>
+
+ * e-error.c (e_error_default_parent): set a default error parent
+ fallback.
+ (e_error_newv): if parent is null, see if we have a default still
+ alive, and use that. warn if not.
+
2004-05-20 JP Rosevear <jpr@novell.com>
* e-task-widget.c (e_task_widget_construct): only unref the mask
diff --git a/widgets/misc/e-error.c b/widgets/misc/e-error.c
index 2a2fd7426b..9310ef9bfc 100644
--- a/widgets/misc/e-error.c
+++ b/widgets/misc/e-error.c
@@ -67,6 +67,7 @@ struct _e_error_table {
};
static GHashTable *error_table;
+static GSList *ee_parent_list;
/* ********************************************************************** */
@@ -394,8 +395,12 @@ e_error_newv(GtkWindow *parent, const char *tag, const char *arg0, va_list ap)
dialog = (GtkDialog *)gtk_dialog_new();
gtk_dialog_set_has_separator(dialog, FALSE);
+ if (parent == NULL && ee_parent_list)
+ parent = (GtkWindow *)ee_parent_list->data;
if (parent)
gtk_window_set_transient_for((GtkWindow *)dialog, parent);
+ else
+ g_warning("No parent set, or default parent available for error dialog");
domain = alloca(strlen(tag)+1);
strcpy(domain, tag);
@@ -567,4 +572,29 @@ e_error_run(GtkWindow *parent, const char *tag, const char *arg0, ...)
return res;
}
+static void
+remove_parent(GtkWidget *w, GtkWidget *parent)
+{
+ ee_parent_list = g_slist_remove(ee_parent_list, parent);
+}
+
+/**
+ * e_error_default_parent:
+ * @parent:
+ *
+ * Bit of a hack, set a default parent that will be used to parent any
+ * error boxes if none is supplied.
+ *
+ * This may be called multiple times, and the last call will be the
+ * main default. This function will keep track of the parents
+ * destruction state.
+ **/
+void
+e_error_default_parent(struct _GtkWindow *parent)
+{
+ if (g_slist_find(ee_parent_list, parent) != NULL) {
+ ee_parent_list = g_slist_prepend(ee_parent_list, parent);
+ g_signal_connect(parent, "destroy", G_CALLBACK(remove_parent), parent);
+ }
+}
diff --git a/widgets/misc/e-error.h b/widgets/misc/e-error.h
index 2b0bded9bc..fe097656ab 100644
--- a/widgets/misc/e-error.h
+++ b/widgets/misc/e-error.h
@@ -52,4 +52,6 @@ struct _GtkWidget *e_error_newv(struct _GtkWindow *parent, const char *tag, cons
int e_error_run(struct _GtkWindow *parent, const char *tag, const char *arg0, ...);
int e_error_runv(struct _GtkWindow *parent, const char *tag, const char *arg0, va_list ap);
+void e_error_default_parent(struct _GtkWindow *parent);
+
#endif /* !_E_ERROR_H */