aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2011-01-24 20:30:38 +0800
committerMatthew Barnes <mbarnes@redhat.com>2011-01-25 23:37:39 +0800
commit9bd1641646ba98139dcd1fac959165c871e0f979 (patch)
tree000f6de5ae174280ef02684f714e4eb82f304e59
parent413ec51e6f58479ee70633aabfe1bc9826a0f79e (diff)
downloadgsoc2013-evolution-9bd1641646ba98139dcd1fac959165c871e0f979.tar.gz
gsoc2013-evolution-9bd1641646ba98139dcd1fac959165c871e0f979.tar.zst
gsoc2013-evolution-9bd1641646ba98139dcd1fac959165c871e0f979.zip
Various critical warnings about comp-editor-pages and date edit
-rw-r--r--calendar/gui/dialogs/comp-editor.c26
-rw-r--r--calendar/gui/dialogs/event-page.c9
-rw-r--r--calendar/gui/dialogs/memo-page.c9
-rw-r--r--calendar/gui/dialogs/task-page.c9
-rw-r--r--calendar/gui/dialogs/task-page.ui3
-rw-r--r--e-util/e-dialog-widgets.c22
-rw-r--r--e-util/e-dialog-widgets.h4
-rw-r--r--widgets/misc/e-dateedit.c1
8 files changed, 70 insertions, 13 deletions
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
@@ -1419,6 +1419,27 @@ comp_editor_get_property (GObject *object,
}
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)
{
CompEditorPrivate *priv;
@@ -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 @@
<object class="GtkComboBox" id="organizer">
<property name="visible">True</property>
<property name="model">model1</property>
- <property name="has-entry">TRUE</property>
+ <property name="has-entry">True</property>
+ <property name="entry-text-column">0</property>
</object>
<packing>
<property name="position">0</property>
diff --git a/e-util/e-dialog-widgets.c b/e-util/e-dialog-widgets.c
index a847960eb2..87821acd71 100644
--- a/e-util/e-dialog-widgets.c
+++ b/e-util/e-dialog-widgets.c
@@ -161,3 +161,25 @@ e_dialog_combo_box_get (GtkWidget *widget, const gint *value_map)
}
return i;
}
+
+/**
+ * e_dialog_append_list_store_text:
+ * @list_store: A #GtkListStore
+ * @text_column: A string column ID, where to write @text_value
+ * @text_value: A string to be added to the @list_store
+ **/
+void
+e_dialog_append_list_store_text (GtkTreeModel *list_store, gint text_column, const gchar *text_value)
+{
+ GtkTreeIter iter;
+ GtkListStore *store;
+
+ g_return_if_fail (list_store != NULL);
+ g_return_if_fail (GTK_IS_LIST_STORE (list_store));
+ g_return_if_fail (text_column >= 0);
+ g_return_if_fail (text_value != NULL);
+
+ store = GTK_LIST_STORE (list_store);
+ gtk_list_store_append (store, &iter);
+ gtk_list_store_set (store, &iter, text_column, text_value, -1);
+}
diff --git a/e-util/e-dialog-widgets.h b/e-util/e-dialog-widgets.h
index 6e9f798db7..5b2585c62a 100644
--- a/e-util/e-dialog-widgets.h
+++ b/e-util/e-dialog-widgets.h
@@ -25,10 +25,14 @@
#ifndef E_DIALOG_WIDGETS_H
#define E_DIALOG_WIDGETS_H
+#include <gtk/gtk.h>
+
void e_dialog_editable_set (GtkWidget *widget, const gchar *value);
gchar *e_dialog_editable_get (GtkWidget *widget);
void e_dialog_combo_box_set (GtkWidget *widget, gint value, const gint *value_map);
gint e_dialog_combo_box_get (GtkWidget *widget, const gint *value_map);
+void e_dialog_append_list_store_text (GtkTreeModel *list_store, gint text_column, const gchar *text_value);
+
#endif
diff --git a/widgets/misc/e-dateedit.c b/widgets/misc/e-dateedit.c
index 8aa048cb28..0a2b744372 100644
--- a/widgets/misc/e-dateedit.c
+++ b/widgets/misc/e-dateedit.c
@@ -570,6 +570,7 @@ create_children (EDateEdit *dedit)
time_store = gtk_list_store_new (1, G_TYPE_STRING);
priv->time_combo = gtk_combo_box_new_with_model_and_entry (
GTK_TREE_MODEL (time_store));
+ gtk_combo_box_set_entry_text_column (GTK_COMBO_BOX (priv->time_combo), 0);
g_object_unref (time_store);
child = gtk_bin_get_child (GTK_BIN (priv->time_combo));