aboutsummaryrefslogtreecommitdiffstats
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
parentaa1c135937b7c533ff8b599cf6009a4507afb51c (diff)
downloadgsoc2013-evolution-54e056e2ddd661e589ccbc31b3faa2999631175e.tar.gz
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.
-rw-r--r--addressbook/gui/contact-list-editor/e-contact-list-editor.c10
-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
-rw-r--r--composer/e-composer-header-table.c15
6 files changed, 44 insertions, 8 deletions
diff --git a/addressbook/gui/contact-list-editor/e-contact-list-editor.c b/addressbook/gui/contact-list-editor/e-contact-list-editor.c
index a4f30ca573..a6a9ceca15 100644
--- a/addressbook/gui/contact-list-editor/e-contact-list-editor.c
+++ b/addressbook/gui/contact-list-editor/e-contact-list-editor.c
@@ -1133,7 +1133,6 @@ setup_custom_widgets (EContactListEditor *editor)
GtkWidget *combo_box;
ESourceList *source_list;
ENameSelectorEntry *name_selector_entry;
- ENameSelector *name_selector;
GtkWidget *old, *parent;
EContactListEditorPrivate *priv;
GError *error = NULL;
@@ -1162,14 +1161,8 @@ setup_custom_widgets (EContactListEditor *editor)
old = CONTACT_LIST_EDITOR_WIDGET (editor, "email-entry");
g_return_if_fail (old != NULL);
- name_selector = e_name_selector_new ();
-
- e_name_selector_model_add_section (
- e_name_selector_peek_model (name_selector),
- "Members", _("_Members"), NULL);
-
name_selector_entry = e_name_selector_peek_section_entry (
- name_selector, "Members");
+ priv->name_selector, "Members");
gtk_widget_set_name (
GTK_WIDGET (name_selector_entry),
@@ -1316,6 +1309,7 @@ contact_list_editor_dispose (GObject *object)
EContactListEditorPrivate *priv = editor->priv;
if (priv->name_selector) {
+ e_name_selector_cancel_loading (priv->name_selector);
g_object_unref (priv->name_selector);
priv->name_selector = NULL;
}
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 *
diff --git a/composer/e-composer-header-table.c b/composer/e-composer-header-table.c
index 78404a62e7..c87abcf307 100644
--- a/composer/e-composer-header-table.c
+++ b/composer/e-composer-header-table.c
@@ -825,6 +825,7 @@ composer_header_table_dispose (GObject *object)
}
if (priv->name_selector != NULL) {
+ e_name_selector_cancel_loading (priv->name_selector);
g_object_unref (priv->name_selector);
priv->name_selector = NULL;
}
@@ -991,6 +992,17 @@ e_composer_header_table_class_init (EComposerHeaderTableClass *class)
}
static void
+composer_header_table_realize_cb (EComposerHeaderTable *table)
+{
+ g_return_if_fail (table != NULL);
+ g_return_if_fail (table->priv != NULL);
+
+ g_signal_handlers_disconnect_by_func (table, composer_header_table_realize_cb, NULL);
+
+ e_name_selector_load_books (table->priv->name_selector);
+}
+
+static void
e_composer_header_table_init (EComposerHeaderTable *table)
{
EComposerHeader *header;
@@ -1064,6 +1076,9 @@ e_composer_header_table_init (EComposerHeaderTable *table)
header->input_widget, "visible",
G_BINDING_SYNC_CREATE);
}
+
+ /* postpone name_selector loading, do that only when really needed */
+ g_signal_connect (table, "realize", G_CALLBACK (composer_header_table_realize_cb), NULL);
}
GtkWidget *