aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui
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
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')
-rw-r--r--calendar/gui/e-calendar-view.c6
-rw-r--r--calendar/gui/gnome-cal.c20
2 files changed, 21 insertions, 5 deletions
diff --git a/calendar/gui/e-calendar-view.c b/calendar/gui/e-calendar-view.c
index 7450cd1221..805ec939f8 100644
--- a/calendar/gui/e-calendar-view.c
+++ b/calendar/gui/e-calendar-view.c
@@ -1242,11 +1242,15 @@ e_calendar_view_new_appointment_for (ECalendarView *cal_view,
icalcomponent *icalcomp;
ECalComponentTransparency transparency;
ECal *default_client = NULL;
+ gpointer parent;
guint32 flags = 0;
gboolean readonly = FALSE;
g_return_if_fail (E_IS_CALENDAR_VIEW (cal_view));
+ parent = gtk_widget_get_toplevel (GTK_WIDGET (cal_view));
+ parent = GTK_WIDGET_TOPLEVEL (parent) ? parent : NULL;
+
priv = cal_view->priv;
default_client = e_cal_model_get_default_client (priv->model);
@@ -1259,7 +1263,7 @@ e_calendar_view_new_appointment_for (ECalendarView *cal_view,
if (e_cal_is_read_only (default_client, &readonly, NULL) && readonly) {
GtkWidget *widget;
- widget = e_error_new (NULL, "calendar:prompt-read-only-cal", e_source_peek_name (e_cal_get_source (default_client)), NULL);
+ widget = e_error_new (parent, "calendar:prompt-read-only-cal", e_source_peek_name (e_cal_get_source (default_client)), NULL);
g_signal_connect ((GtkDialog *)widget, "response", G_CALLBACK (gtk_widget_destroy),
widget);
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);