From fd695a3677d41d145709f69eb2f8335df5178098 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Mon, 24 Jan 2011 13:30:38 +0100 Subject: Various critical warnings about comp-editor-pages and date edit --- calendar/gui/dialogs/comp-editor.c | 26 +++++++++++++++++++++++--- calendar/gui/dialogs/event-page.c | 9 ++++++--- calendar/gui/dialogs/memo-page.c | 9 ++++++--- calendar/gui/dialogs/task-page.c | 9 ++++++--- calendar/gui/dialogs/task-page.ui | 3 ++- 5 files changed, 43 insertions(+), 13 deletions(-) (limited to 'calendar') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index b62e5f2aa8..0115f85a0e 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -1418,6 +1418,27 @@ comp_editor_get_property (GObject *object, G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); } +static void +unref_page_cb (gpointer editor_page, gpointer comp_editor) +{ + if (IS_COMP_EDITOR_PAGE (editor_page)) { + GtkWidget *page_widget; + CompEditorPage *page = COMP_EDITOR_PAGE (editor_page); + CompEditor *editor = COMP_EDITOR (comp_editor); + + g_return_if_fail (page != NULL); + g_return_if_fail (editor != NULL); + + page_widget = comp_editor_page_get_widget (page); + g_signal_handlers_disconnect_matched ( + page_widget, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, page); + } + + g_signal_handlers_disconnect_matched ( + editor_page, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, comp_editor); + g_object_unref (editor_page); +} + static void comp_editor_dispose (GObject *object) { @@ -1464,7 +1485,7 @@ comp_editor_dispose (GObject *object) /* We want to destroy the pages after the widgets get destroyed, since they have lots of signal handlers connected to the widgets with the pages as the data. */ - g_list_foreach (priv->pages, (GFunc) g_object_unref, NULL); + g_list_foreach (priv->pages, (GFunc) unref_page_cb, object); g_list_free (priv->pages); priv->pages = NULL; @@ -2589,8 +2610,7 @@ page_unmapped_cb (GtkWidget *page_widget, return; if (page->accel_group) { - gtk_window_remove_accel_group (GTK_WINDOW (toplevel), - page->accel_group); + gtk_window_remove_accel_group (GTK_WINDOW (toplevel), page->accel_group); } } diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c index 7595f50915..5bf870e512 100644 --- a/calendar/gui/dialogs/event-page.c +++ b/calendar/gui/dialogs/event-page.c @@ -1107,8 +1107,10 @@ event_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) g_signal_handlers_block_by_func (gtk_bin_get_child (GTK_BIN (priv->organizer)), organizer_changed_cb, epage); if (!priv->user_org) { - gtk_list_store_clear (GTK_LIST_STORE (gtk_combo_box_get_model (GTK_COMBO_BOX (priv->organizer)))); - gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (priv->organizer), string); + GtkTreeModel *model = gtk_combo_box_get_model (GTK_COMBO_BOX (priv->organizer)); + + gtk_list_store_clear (GTK_LIST_STORE (model)); + e_dialog_append_list_store_text (model, 0, string); gtk_combo_box_set_active (GTK_COMBO_BOX (priv->organizer), 0); gtk_editable_set_editable (GTK_EDITABLE (gtk_bin_get_child (GTK_BIN (priv->organizer))), FALSE); } else { @@ -3206,9 +3208,10 @@ event_page_construct (EventPage *epage, if (priv->address_strings) { GList *l; + GtkTreeModel *model = gtk_combo_box_get_model (GTK_COMBO_BOX (priv->organizer)); for (l = priv->address_strings; l; l = l->next) - gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (priv->organizer), l->data); + e_dialog_append_list_store_text (model, 0, l->data); gtk_combo_box_set_active (GTK_COMBO_BOX (priv->organizer), 0); diff --git a/calendar/gui/dialogs/memo-page.c b/calendar/gui/dialogs/memo-page.c index 996a4de8a5..414b644d0c 100644 --- a/calendar/gui/dialogs/memo-page.c +++ b/calendar/gui/dialogs/memo-page.c @@ -270,8 +270,10 @@ memo_page_fill_widgets (CompEditorPage *page, if (itip_organizer_is_user (comp, client) || itip_sentby_is_user (comp, client)) { gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (priv->org_combo))), string); } else { - gtk_list_store_clear (GTK_LIST_STORE (gtk_combo_box_get_model (GTK_COMBO_BOX (priv->org_combo)))); - gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (priv->org_combo), string); + GtkTreeModel *model = gtk_combo_box_get_model (GTK_COMBO_BOX (priv->org_combo)); + + gtk_list_store_clear (GTK_LIST_STORE (model)); + e_dialog_append_list_store_text (model, 0, string); gtk_combo_box_set_active (GTK_COMBO_BOX (priv->org_combo), 0); gtk_editable_set_editable (GTK_EDITABLE (gtk_bin_get_child (GTK_BIN (priv->org_combo))), FALSE); } @@ -1189,9 +1191,10 @@ memo_page_construct (MemoPage *mpage) if (priv->address_strings) { GList *l; + GtkTreeModel *model = gtk_combo_box_get_model (GTK_COMBO_BOX (priv->org_combo)); for (l = priv->address_strings; l; l = l->next) - gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (priv->org_combo), l->data); + e_dialog_append_list_store_text (model, 0, l->data); gtk_combo_box_set_active (GTK_COMBO_BOX (priv->org_combo), 0); } else diff --git a/calendar/gui/dialogs/task-page.c b/calendar/gui/dialogs/task-page.c index 7956b1b5d7..6df7afc9aa 100644 --- a/calendar/gui/dialogs/task-page.c +++ b/calendar/gui/dialogs/task-page.c @@ -729,8 +729,10 @@ task_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) g_signal_handlers_block_by_func (gtk_bin_get_child (GTK_BIN (priv->organizer)), organizer_changed_cb, tpage); if (!priv->user_org) { - gtk_list_store_clear (GTK_LIST_STORE (gtk_combo_box_get_model (GTK_COMBO_BOX (priv->organizer)))); - gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (priv->organizer), string); + GtkTreeModel *model = gtk_combo_box_get_model (GTK_COMBO_BOX (priv->organizer)); + + gtk_list_store_clear (GTK_LIST_STORE (model)); + e_dialog_append_list_store_text (model, 0, string); gtk_combo_box_set_active (GTK_COMBO_BOX (priv->organizer), 0); gtk_editable_set_editable (GTK_EDITABLE (gtk_bin_get_child (GTK_BIN (priv->organizer))), FALSE); } else { @@ -2086,9 +2088,10 @@ task_page_construct (TaskPage *tpage, EMeetingStore *model, ECal *client) if (priv->address_strings) { GList *l; + GtkTreeModel *model = gtk_combo_box_get_model (GTK_COMBO_BOX (priv->organizer)); for (l = priv->address_strings; l; l = l->next) - gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (priv->organizer), l->data); + e_dialog_append_list_store_text (model, 0, l->data); gtk_combo_box_set_active (GTK_COMBO_BOX (priv->organizer), 0); diff --git a/calendar/gui/dialogs/task-page.ui b/calendar/gui/dialogs/task-page.ui index 664caadf68..1ca36a12bc 100644 --- a/calendar/gui/dialogs/task-page.ui +++ b/calendar/gui/dialogs/task-page.ui @@ -411,7 +411,8 @@ True model1 - TRUE + True + 0 0 -- cgit v1.2.3