From bab3dc622a2cd10e861e1ffb762768e68079a81e Mon Sep 17 00:00:00 2001 From: Rodrigo Moya Date: Tue, 8 Jun 2004 16:44:46 +0000 Subject: new function for notifying all pages of the client change. 2004-06-08 Rodrigo Moya * gui/dialogs/comp-editor.[ch] (comp_editor_notify_client_changed): new function for notifying all pages of the client change. (page_client_changed_cb): no need for this callback. (comp_editor_append_page): no need to connect to "client_changed" signal on the pages. * gui/dialogs/comp-editor-page.c (comp_editor_page_notify_client_changed): re-added the call to comp_editor_page_set_e_cal(), the client was not being set anywhere. * gui/dialogs/event-page.c (source_changed_cb): use comp_editor_notify_client_changed() so that all pages get informed of the client change. * gui/dialogs/task-page.c (source_changed_cb): ditto. svn path=/trunk/; revision=26255 --- calendar/ChangeLog | 18 +++++++++++++++ calendar/gui/dialogs/comp-editor-page.c | 1 + calendar/gui/dialogs/comp-editor.c | 40 ++++++++++++++++++++------------- calendar/gui/dialogs/comp-editor.h | 1 + calendar/gui/dialogs/event-page.c | 5 ++++- calendar/gui/dialogs/task-page.c | 5 ++++- 6 files changed, 53 insertions(+), 17 deletions(-) (limited to 'calendar') diff --git a/calendar/ChangeLog b/calendar/ChangeLog index fdb386f0b1..f47f7933f4 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,21 @@ +2004-06-08 Rodrigo Moya + + * gui/dialogs/comp-editor.[ch] (comp_editor_notify_client_changed): + new function for notifying all pages of the client change. + (page_client_changed_cb): no need for this callback. + (comp_editor_append_page): no need to connect to "client_changed" + signal on the pages. + + * gui/dialogs/comp-editor-page.c + (comp_editor_page_notify_client_changed): re-added the call to + comp_editor_page_set_e_cal(), the client was not being set anywhere. + + * gui/dialogs/event-page.c (source_changed_cb): use + comp_editor_notify_client_changed() so that all pages get informed + of the client change. + + * gui/dialogs/task-page.c (source_changed_cb): ditto. + 2004-06-08 Rodrigo Moya * gui/dialogs/comp-editor-page.c diff --git a/calendar/gui/dialogs/comp-editor-page.c b/calendar/gui/dialogs/comp-editor-page.c index 44e89a3b14..2d656060e7 100644 --- a/calendar/gui/dialogs/comp-editor-page.c +++ b/calendar/gui/dialogs/comp-editor-page.c @@ -433,6 +433,7 @@ comp_editor_page_notify_client_changed (CompEditorPage *page, g_return_if_fail (page != NULL); g_return_if_fail (IS_COMP_EDITOR_PAGE (page)); + comp_editor_page_set_e_cal (page, client); gtk_signal_emit (GTK_OBJECT (page), comp_editor_page_signals[CLIENT_CHANGED], client); diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 96f58a3025..ef3757cac7 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -105,7 +105,6 @@ static void page_changed_cb (GtkObject *obj, gpointer data); static void needs_send_cb (GtkObject *obj, gpointer data); static void page_summary_changed_cb (GtkObject *obj, const char *summary, gpointer data); static void page_dates_changed_cb (GtkObject *obj, CompEditorPageDates *dates, gpointer data); -static void page_client_changed_cb (GtkObject *obj, ECal *client, gpointer data); static void obj_modified_cb (ECal *client, GList *objs, gpointer data); static void obj_removed_cb (ECal *client, GList *uids, gpointer data); @@ -769,8 +768,6 @@ comp_editor_append_page (CompEditor *editor, G_CALLBACK (page_summary_changed_cb), editor); g_signal_connect(page, "dates_changed", G_CALLBACK (page_dates_changed_cb), editor); - g_signal_connect(page, "client_changed", - G_CALLBACK (page_client_changed_cb), editor); /* Listen for when the page is mapped/unmapped so we can install/uninstall the appropriate GtkAccelGroup. */ @@ -1341,6 +1338,31 @@ comp_editor_focus (CompEditor *editor) raise_and_focus (GTK_WIDGET (editor)); } +/** + * comp_editor_page_notify_client_changed: + * @page: An editor page. + * + * Makes an editor page emit the "client_changed" signal. This is meant to be + * used only by page implementations. + **/ +void +comp_editor_notify_client_changed (CompEditor *editor, ECal *client) +{ + GList *l; + CompEditorPrivate *priv; + + g_return_if_fail (editor != NULL); + g_return_if_fail (IS_COMP_EDITOR (editor)); + + priv = editor->priv; + + priv->changed = TRUE; + + comp_editor_set_e_cal (editor, client); + for (l = priv->pages; l != NULL; l = l->next) + comp_editor_page_notify_client_changed (COMP_EDITOR_PAGE (l->data), client); +} + /* Menu Commands */ static void save_close_cmd (GtkWidget *widget, gpointer data) @@ -1542,18 +1564,6 @@ page_dates_changed_cb (GtkObject *obj, } } -static void -page_client_changed_cb (GtkObject *obj, ECal *client, gpointer data) -{ - CompEditor *editor = COMP_EDITOR (data); - CompEditorPrivate *priv; - - priv = editor->priv; - - priv->changed = TRUE; - comp_editor_set_e_cal (editor, client); -} - static void obj_modified_cb (ECal *client, GList *objects, gpointer data) { diff --git a/calendar/gui/dialogs/comp-editor.h b/calendar/gui/dialogs/comp-editor.h index 48b332ce4b..b0b9521868 100644 --- a/calendar/gui/dialogs/comp-editor.h +++ b/calendar/gui/dialogs/comp-editor.h @@ -101,6 +101,7 @@ void comp_editor_set_ui_prop (CompEditor *editor, const char *val); void comp_editor_focus (CompEditor *editor); +void comp_editor_notify_client_changed (CompEditor *editor, ECal *client); diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c index abdc84aa34..d832cf4873 100644 --- a/calendar/gui/dialogs/event-page.c +++ b/calendar/gui/dialogs/event-page.c @@ -41,6 +41,7 @@ #include #include "../calendar-config.h" #include "../e-timezone-entry.h" +#include "comp-editor.h" #include "comp-editor-util.h" #include "event-page.h" @@ -1297,7 +1298,9 @@ source_changed_cb (GtkWidget *widget, ESource *source, gpointer data) gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); } else { - comp_editor_page_notify_client_changed (COMP_EDITOR_PAGE (epage), client); + comp_editor_notify_client_changed ( + COMP_EDITOR (gtk_widget_get_toplevel (priv->main)), + client); sensitize_widgets (epage); } } diff --git a/calendar/gui/dialogs/task-page.c b/calendar/gui/dialogs/task-page.c index 0979397245..de17834994 100644 --- a/calendar/gui/dialogs/task-page.c +++ b/calendar/gui/dialogs/task-page.c @@ -42,6 +42,7 @@ #include "e-util/e-categories-config.h" #include "../e-timezone-entry.h" #include "../calendar-config.h" +#include "comp-editor.h" #include "comp-editor-util.h" #include "task-page.h" @@ -827,7 +828,9 @@ source_changed_cb (GtkWidget *widget, ESource *source, gpointer data) gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); } else { - comp_editor_page_notify_client_changed (COMP_EDITOR_PAGE (epage), client); + comp_editor_notify_client_changed ( + COMP_EDITOR (gtk_widget_get_toplevel (priv->main)), + client); } } } -- cgit v1.2.3