aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui
diff options
context:
space:
mode:
authorChris Toshok <toshok@ximian.com>2004-06-30 23:32:37 +0800
committerChris Toshok <toshok@src.gnome.org>2004-06-30 23:32:37 +0800
commitd08695416fbeb098fe9e3906a6d10ced297b6c40 (patch)
tree870f5ac33e49fbd279fe306ada35cbc690c46eeb /addressbook/gui
parent4b2f9ba9281b12db44fd9b0c6624613098f8a55e (diff)
downloadgsoc2013-evolution-d08695416fbeb098fe9e3906a6d10ced297b6c40.tar.gz
gsoc2013-evolution-d08695416fbeb098fe9e3906a6d10ced297b6c40.tar.zst
gsoc2013-evolution-d08695416fbeb098fe9e3906a6d10ced297b6c40.zip
disconnect source/target_editable signal ids.
2004-06-30 Chris Toshok <toshok@ximian.com> * gui/contact-editor/e-contact-editor.c (e_contact_editor_dispose): disconnect source/target_editable signal ids. (e_contact_editor_set_property): disconnect/connect editable signals. (writable_changed): new function - we need this since writable status is generally communicated asynchronously with the async interface. * gui/contact-editor/e-contact-editor.h (struct _EContactEditor): add source/target_editable_id slots. svn path=/trunk/; revision=26554
Diffstat (limited to 'addressbook/gui')
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor.c38
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor.h4
2 files changed, 39 insertions, 3 deletions
diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c
index 6038d44775..0dcfbf47ba 100644
--- a/addressbook/gui/contact-editor/e-contact-editor.c
+++ b/addressbook/gui/contact-editor/e-contact-editor.c
@@ -2999,11 +2999,13 @@ e_contact_editor_dispose (GObject *object)
}
if (e_contact_editor->source_book) {
+ g_signal_handler_disconnect (e_contact_editor->source_book, e_contact_editor->source_editable_id);
g_object_unref(e_contact_editor->source_book);
e_contact_editor->source_book = NULL;
}
if (e_contact_editor->target_book) {
+ g_signal_handler_disconnect (e_contact_editor->target_book, e_contact_editor->target_editable_id);
g_object_unref(e_contact_editor->target_book);
e_contact_editor->target_book = NULL;
}
@@ -3079,6 +3081,28 @@ e_contact_editor_new (EBook *book,
}
static void
+writable_changed (EBook *book, gboolean writable, EContactEditor *ce)
+{
+ int new_source_editable, new_target_editable;
+ gboolean changed = FALSE;
+
+ new_source_editable = e_book_is_writable (ce->source_book);
+ new_target_editable = e_book_is_writable (ce->target_book);
+
+ if (ce->source_editable != new_source_editable)
+ changed = TRUE;
+
+ if (ce->target_editable != new_target_editable)
+ changed = TRUE;
+
+ ce->source_editable = new_source_editable;
+ ce->target_editable = new_target_editable;
+
+ if (changed)
+ sensitize_all (ce);
+}
+
+static void
e_contact_editor_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
{
EContactEditor *editor;
@@ -3090,11 +3114,15 @@ e_contact_editor_set_property (GObject *object, guint prop_id, const GValue *val
gboolean writable;
gboolean changed = FALSE;
- if (editor->source_book)
+ if (editor->source_book) {
+ g_signal_handler_disconnect (editor->source_book, editor->source_editable_id);
g_object_unref(editor->source_book);
+ }
editor->source_book = E_BOOK (g_value_get_object (value));
g_object_ref (editor->source_book);
-
+ editor->source_editable_id = g_signal_connect (editor->source_book, "writable_status",
+ G_CALLBACK (writable_changed), editor);
+
if (!editor->target_book) {
editor->target_book = editor->source_book;
g_object_ref (editor->target_book);
@@ -3122,10 +3150,14 @@ e_contact_editor_set_property (GObject *object, guint prop_id, const GValue *val
}
case PROP_TARGET_BOOK: {
- if (editor->target_book)
+ if (editor->target_book) {
+ g_signal_handler_disconnect (editor->target_book, editor->target_editable_id);
g_object_unref(editor->target_book);
+ }
editor->target_book = E_BOOK (g_value_get_object (value));
g_object_ref (editor->target_book);
+ editor->target_editable_id = g_signal_connect (editor->target_book, "writable_status",
+ G_CALLBACK (writable_changed), editor);
e_book_async_get_supported_fields (editor->target_book,
(EBookEListCallback) supported_fields_cb, editor);
diff --git a/addressbook/gui/contact-editor/e-contact-editor.h b/addressbook/gui/contact-editor/e-contact-editor.h
index 7ab3969e3f..58d9f2bb0d 100644
--- a/addressbook/gui/contact-editor/e-contact-editor.h
+++ b/addressbook/gui/contact-editor/e-contact-editor.h
@@ -96,6 +96,10 @@ struct _EContactEditor
/* ID for async load_source call */
guint load_source_id;
EBook *load_book;
+
+ /* signal ids for "writable_status" */
+ int source_editable_id;
+ int target_editable_id;
};
struct _EContactEditorClass