aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/gnome-cal.c
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2009-09-05 05:07:15 +0800
committerMatthew Barnes <mbarnes@redhat.com>2009-09-05 05:07:15 +0800
commit983fce5e535e4e203815767cf6899f6dc8c5242a (patch)
treed6ca3538c046798597275132c66be6da18733d7f /calendar/gui/gnome-cal.c
parentc95a226217a68703c48397c23ea8accc491d44e4 (diff)
downloadgsoc2013-evolution-983fce5e535e4e203815767cf6899f6dc8c5242a.tar.gz
gsoc2013-evolution-983fce5e535e4e203815767cf6899f6dc8c5242a.tar.zst
gsoc2013-evolution-983fce5e535e4e203815767cf6899f6dc8c5242a.zip
Kill the default parent window hack in e-error.c.
Fix as many cases that relied on it as I could find, but there may be more cases out there. They should be fixed too. Passing a NULL parent window to e_error_new() is illegal and will emit a runtime warning.
Diffstat (limited to 'calendar/gui/gnome-cal.c')
-rw-r--r--calendar/gui/gnome-cal.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index 690c7003b1..b56c37da57 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -1869,10 +1869,14 @@ client_cal_opened_cb (ECal *ecal, ECalendarStatus status, GnomeCalendar *gcal)
ECalLoadState state;
gchar *msg;
GtkWidget *w = NULL;
+ gpointer parent;
gchar *id;
priv = gcal->priv;
+ parent = gtk_widget_get_toplevel (GTK_WIDGET (gcal));
+ parent = GTK_WIDGET_TOPLEVEL (parent) ? parent : NULL;
+
source = e_cal_get_source (ecal);
state = e_cal_get_load_state (ecal);
@@ -1895,7 +1899,7 @@ client_cal_opened_cb (ECal *ecal, ECalendarStatus status, GnomeCalendar *gcal)
return;
}
- w = e_error_new(NULL, "calendar:server-version", NULL);
+ w = e_error_new(parent, "calendar:server-version", NULL);
/*e_calendar_utils_show_error_silent (w); KILL-BONOBO */
g_hash_table_insert (non_intrusive_error_table, id, g_object_ref(w));
g_signal_connect(w, "destroy", G_CALLBACK(non_intrusive_error_remove), id);
@@ -1916,7 +1920,7 @@ client_cal_opened_cb (ECal *ecal, ECalendarStatus status, GnomeCalendar *gcal)
return;
}
- w = e_error_new(GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (gcal))), "calendar:unable-to-load-the-calendar", e_cal_get_error_message (status), NULL);
+ w = e_error_new(parent, "calendar:unable-to-load-the-calendar", e_cal_get_error_message (status), NULL);
/*e_calendar_utils_show_error_silent (w); KILL-BONOBO */
g_hash_table_insert (non_intrusive_error_table, id, g_object_ref(w));
g_signal_connect(w, "destroy", G_CALLBACK(non_intrusive_error_remove), id);
@@ -2040,11 +2044,15 @@ backend_error_cb (ECal *client, const gchar *message, gpointer data)
{
GnomeCalendar *gcal;
GtkDialog *dialog;
+ gpointer parent;
gchar *uristr;
gchar *id;
gcal = GNOME_CALENDAR (data);
+ parent = gtk_widget_get_toplevel (GTK_WIDGET (gcal));
+ parent = GTK_WIDGET_TOPLEVEL (parent) ? parent : NULL;
+
uristr = get_uri_without_password (e_cal_get_uri (client));
id = g_strdup ("calendar:error-on-loading-the-calendar");
@@ -2054,7 +2062,7 @@ backend_error_cb (ECal *client, const gchar *message, gpointer data)
return;
}
- dialog = (GtkDialog *)e_error_new(GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (gcal))), "calendar:error-on-loading-the-calendar", uristr, message, NULL);
+ dialog = (GtkDialog *)e_error_new(parent, "calendar:error-on-loading-the-calendar", uristr, message, NULL);
/* e_calendar_utils_show_error_silent(GTK_WIDGET (dialog)); KILL-BONOBO */
g_hash_table_insert (non_intrusive_error_table, id, g_object_ref(dialog));
@@ -2070,12 +2078,16 @@ backend_died_cb (ECal *ecal, gpointer data)
GnomeCalendar *gcal;
GnomeCalendarPrivate *priv;
ESource *source;
+ gpointer parent;
const gchar *id;
GtkWidget *w = NULL;
gcal = GNOME_CALENDAR (data);
priv = gcal->priv;
+ parent = gtk_widget_get_toplevel (GTK_WIDGET (gcal));
+ parent = GTK_WIDGET_TOPLEVEL (parent) ? parent : NULL;
+
/* FIXME What about default sources? */
/* Make sure the source doesn't go away on us since we use it below */
@@ -2098,7 +2110,7 @@ backend_died_cb (ECal *ecal, gpointer data)
return;
}
- w = e_error_new(GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (gcal))), "calendar:backend_died", NULL);
+ w = e_error_new(parent, "calendar:backend_died", NULL);
/* e_calendar_utils_show_error_silent (w); KILL-BONOBO */
g_hash_table_insert (non_intrusive_error_table, (gpointer) id, g_object_ref(w));
g_signal_connect((GtkObject *)w, "destroy", G_CALLBACK(non_intrusive_error_remove), (gpointer) id);