aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2011-06-24 00:30:36 +0800
committerRodrigo Moya <rodrigo@gnome-db.org>2011-06-30 00:42:32 +0800
commit54e056e2ddd661e589ccbc31b3faa2999631175e (patch)
tree42c18758598ee6f6973800ddff890a3cc56424e3 /calendar
parentaa1c135937b7c533ff8b599cf6009a4507afb51c (diff)
downloadgsoc2013-evolution-54e056e2ddd661e589ccbc31b3faa2999631175e.tar
gsoc2013-evolution-54e056e2ddd661e589ccbc31b3faa2999631175e.tar.gz
gsoc2013-evolution-54e056e2ddd661e589ccbc31b3faa2999631175e.tar.bz2
gsoc2013-evolution-54e056e2ddd661e589ccbc31b3faa2999631175e.tar.lz
gsoc2013-evolution-54e056e2ddd661e589ccbc31b3faa2999631175e.tar.xz
gsoc2013-evolution-54e056e2ddd661e589ccbc31b3faa2999631175e.tar.zst
gsoc2013-evolution-54e056e2ddd661e589ccbc31b3faa2999631175e.zip
Postpone ENameSelector loading as much as possible
Also fixes few memory leaks around ENameSelector and cancels loading of its address books when not needed any more.
Diffstat (limited to 'calendar')
-rw-r--r--calendar/gui/dialogs/alarm-dialog.c5
-rw-r--r--calendar/gui/dialogs/e-delegate-dialog.c2
-rw-r--r--calendar/gui/dialogs/memo-page.c6
-rw-r--r--calendar/gui/e-meeting-list-view.c14
4 files changed, 27 insertions, 0 deletions
diff --git a/calendar/gui/dialogs/alarm-dialog.c b/calendar/gui/dialogs/alarm-dialog.c
index 564c4dd1f4..ec57b11657 100644
--- a/calendar/gui/dialogs/alarm-dialog.c
+++ b/calendar/gui/dialogs/alarm-dialog.c
@@ -903,6 +903,7 @@ setup_select_names (Dialog *dialog)
ENameSelectorDialog *name_selector_dialog;
dialog->name_selector = e_name_selector_new ();
+ e_name_selector_load_books (dialog->name_selector);
name_selector_model = e_name_selector_peek_model (dialog->name_selector);
e_name_selector_model_add_section (name_selector_model, section_name, section_name, NULL);
@@ -1229,6 +1230,10 @@ alarm_dialog_run (GtkWidget *parent, ECalClient *cal_client, ECalComponentAlarm
if (response_id == GTK_RESPONSE_OK)
dialog_to_alarm (&dialog);
+ if (dialog.name_selector) {
+ e_name_selector_cancel_loading (dialog.name_selector);
+ g_object_unref (dialog.name_selector);
+ }
gtk_widget_destroy (dialog.toplevel);
g_object_unref (dialog.builder);
diff --git a/calendar/gui/dialogs/e-delegate-dialog.c b/calendar/gui/dialogs/e-delegate-dialog.c
index 2bca1c908b..da6eeea05d 100644
--- a/calendar/gui/dialogs/e-delegate-dialog.c
+++ b/calendar/gui/dialogs/e-delegate-dialog.c
@@ -96,6 +96,7 @@ e_delegate_dialog_finalize (GObject *object)
edd = E_DELEGATE_DIALOG (object);
priv = edd->priv;
+ e_name_selector_cancel_loading (priv->name_selector);
g_object_unref (priv->name_selector);
/* Destroy the actual dialog. */
@@ -137,6 +138,7 @@ e_delegate_dialog_construct (EDelegateDialog *edd, const gchar *name, const gcha
}
priv->name_selector = e_name_selector_new ();
+ e_name_selector_load_books (priv->name_selector);
name_selector_model = e_name_selector_peek_model (priv->name_selector);
e_name_selector_model_add_section (name_selector_model, section_name, section_name, NULL);
diff --git a/calendar/gui/dialogs/memo-page.c b/calendar/gui/dialogs/memo-page.c
index d720e91b1d..3a53421dd5 100644
--- a/calendar/gui/dialogs/memo-page.c
+++ b/calendar/gui/dialogs/memo-page.c
@@ -202,6 +202,12 @@ memo_page_finalize (GObject *object)
priv = MEMO_PAGE (object)->priv;
+ if (priv->name_selector) {
+ e_name_selector_cancel_loading (priv->name_selector);
+ g_object_unref (priv->name_selector);
+ priv->name_selector = NULL;
+ }
+
if (priv->main != NULL) {
g_object_unref (priv->main);
priv->main = NULL;
diff --git a/calendar/gui/e-meeting-list-view.c b/calendar/gui/e-meeting-list-view.c
index 11f47e6030..5283b5e385 100644
--- a/calendar/gui/e-meeting-list-view.c
+++ b/calendar/gui/e-meeting-list-view.c
@@ -82,6 +82,7 @@ e_meeting_list_view_finalize (GObject *obj)
EMeetingListViewPrivate *priv = view->priv;
if (priv->name_selector) {
+ e_name_selector_cancel_loading (priv->name_selector);
g_object_unref (priv->name_selector);
priv->name_selector = NULL;
}
@@ -127,6 +128,17 @@ add_section (ENameSelector *name_selector, const gchar *name)
}
static void
+meeting_list_view_realize_cb (EMeetingListView *view)
+{
+ g_return_if_fail (view != NULL);
+ g_return_if_fail (view->priv != NULL);
+
+ g_signal_handlers_disconnect_by_func (view, meeting_list_view_realize_cb, NULL);
+
+ e_name_selector_load_books (view->priv->name_selector);
+}
+
+static void
e_meeting_list_view_init (EMeetingListView *view)
{
EMeetingListViewPrivate *priv;
@@ -149,6 +161,8 @@ e_meeting_list_view_init (EMeetingListView *view)
g_signal_connect (name_selector_dialog, "response",
G_CALLBACK (name_selector_dialog_close_cb), view);
+ /* postpone name_selector loading, do that only when really needed */
+ g_signal_connect (view, "realize", G_CALLBACK (meeting_list_view_realize_cb), NULL);
}
static GList *