aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/dialogs/comp-editor-page.c
diff options
context:
space:
mode:
authorHans Petter Jansson <hpj@ximian.com>2003-12-18 10:41:53 +0800
committerHans Petter <hansp@src.gnome.org>2003-12-18 10:41:53 +0800
commite4a68478f7fed9fdf32feae4cca56fb1f4b71411 (patch)
treeccaf59a8b1d95a3be46e9241248185f490592535 /calendar/gui/dialogs/comp-editor-page.c
parent919563751e1cce6a0aa42f6ec8bd02f84ec7d67c (diff)
downloadgsoc2013-evolution-e4a68478f7fed9fdf32feae4cca56fb1f4b71411.tar
gsoc2013-evolution-e4a68478f7fed9fdf32feae4cca56fb1f4b71411.tar.gz
gsoc2013-evolution-e4a68478f7fed9fdf32feae4cca56fb1f4b71411.tar.bz2
gsoc2013-evolution-e4a68478f7fed9fdf32feae4cca56fb1f4b71411.tar.lz
gsoc2013-evolution-e4a68478f7fed9fdf32feae4cca56fb1f4b71411.tar.xz
gsoc2013-evolution-e4a68478f7fed9fdf32feae4cca56fb1f4b71411.tar.zst
gsoc2013-evolution-e4a68478f7fed9fdf32feae4cca56fb1f4b71411.zip
Add the concept of a source client, where the object lives currently. The
2003-12-17 Hans Petter Jansson <hpj@ximian.com> * gui/dialogs/comp-editor.c: Add the concept of a source client, where the object lives currently. The plain client is where it will be stored. (comp_editor_finalize): If we have a source client, disconnect from and unref it. (save_comp): Check if the object is being moved, and if so, remove it from the source client, and make the target client the new source. (comp_editor_append_page): Connect to client_changed signal. (real_set_e_cal): Change an old gtk_signal_disconnect_by_data() to the GLib equivalent, and don't cast ECal to GtkObject. If the source client is not set, make it equivalent to the target client. (page_client_changed_cb): Implement. Handles a client change. * gui/dialogs/comp-editor-page.c (comp_editor_page_class_init): Add a new signal, "client_changed", that notifies that the ECal client was changed from one of the editor pages. (comp_editor_page_set_e_cal): Fix two bugs in this function; if the same client is set twice, its ref count could drop to 0. Additionally, it was unreffing the new client instead of the old one. (comp_editor_page_notify_client_changed): Implement. * gui/dialogs/event-page.c (event_page_fill_widgets): Fill in the source menu. (get_widgets): Get the source menu. (source_changed_cb): Implement. Try to open a client for the new source, and if successful, notify of the change. Show a dialog on failure, and revert to last selected source. (init_widgets): Connect to source menu. (event_page_create_source_option_menu): Implement Glade helper. * gui/dialogs/task-page.c (task_page_fill_widgets): Fill in the source menu. (get_widgets): Get the source menu. (source_changed_cb): Implement, similar to the event page, but for tasks. (init_widgets): Connect to source menu. (task_page_construct): Fix a message booboo. (task_page_create_source_option_menu): Implement Glade helper. * gui/dialogs/event-page.glade: Add source menu widget. * gui/dialogs/task-page.glade: Add source menu widget. svn path=/trunk/; revision=23974
Diffstat (limited to 'calendar/gui/dialogs/comp-editor-page.c')
-rw-r--r--calendar/gui/dialogs/comp-editor-page.c34
1 files changed, 33 insertions, 1 deletions
diff --git a/calendar/gui/dialogs/comp-editor-page.c b/calendar/gui/dialogs/comp-editor-page.c
index 64771bebed..db51481f62 100644
--- a/calendar/gui/dialogs/comp-editor-page.c
+++ b/calendar/gui/dialogs/comp-editor-page.c
@@ -43,6 +43,7 @@ enum {
NEEDS_SEND,
SUMMARY_CHANGED,
DATES_CHANGED,
+ CLIENT_CHANGED,
LAST_SIGNAL
};
@@ -131,6 +132,15 @@ comp_editor_page_class_init (CompEditorPageClass *class)
g_cclosure_marshal_VOID__POINTER,
G_TYPE_NONE, 1, G_TYPE_POINTER);
+ comp_editor_page_signals[CLIENT_CHANGED] =
+ g_signal_new ("client_changed",
+ G_TYPE_FROM_CLASS (class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (CompEditorPageClass, client_changed),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__OBJECT,
+ G_TYPE_NONE, 1, G_TYPE_OBJECT);
+
class->changed = NULL;
class->summary_changed = NULL;
class->dates_changed = NULL;
@@ -272,8 +282,11 @@ comp_editor_page_set_e_cal (CompEditorPage *page, ECal *client)
g_return_if_fail (page != NULL);
g_return_if_fail (IS_COMP_EDITOR_PAGE (page));
+ if (client == page->client)
+ return;
+
if (page->client)
- g_object_unref (client);
+ g_object_unref (page->client);
page->client = client;
if (page->client)
@@ -385,6 +398,25 @@ comp_editor_page_notify_dates_changed (CompEditorPage *page,
}
/**
+ * 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_page_notify_client_changed (CompEditorPage *page,
+ ECal *client)
+{
+ g_return_if_fail (page != NULL);
+ g_return_if_fail (IS_COMP_EDITOR_PAGE (page));
+
+ gtk_signal_emit (GTK_OBJECT (page),
+ comp_editor_page_signals[CLIENT_CHANGED],
+ client);
+}
+
+/**
* comp_editor_page_display_validation_error:
* @page: An editor page.
* @msg: Error message to display.