From 62b28b0d5f05bcdff51bcf3bb2c71f06db583e1b Mon Sep 17 00:00:00 2001 From: Chris Toshok Date: Wed, 8 Aug 2001 17:04:54 +0000 Subject: mark the dialog as changed so the save button is immediately available. 2001-08-08 Chris Toshok * gui/contact-editor/e-contact-quick-add.c (ce_have_book): mark the dialog as changed so the save button is immediately available. * gui/contact-editor/e-contact-editor.c (card_modified_cb): once we save reset the change flag to false if we aren't closing the dialog. (card_added_cb): same. (e_contact_editor_class_init): add a "changed" arg. (e_contact_editor_set_arg): add setter for "changed". (e_contact_editor_get_arg): add getter for "changed". svn path=/trunk/; revision=11799 --- addressbook/gui/contact-editor/e-contact-editor.c | 32 +++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) (limited to 'addressbook/gui/contact-editor/e-contact-editor.c') diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c index 1a5f154111..1189759263 100644 --- a/addressbook/gui/contact-editor/e-contact-editor.c +++ b/addressbook/gui/contact-editor/e-contact-editor.c @@ -97,6 +97,7 @@ enum { ARG_CARD, ARG_IS_NEW_CARD, ARG_EDITABLE, + ARG_CHANGED, ARG_WRITABLE_FIELDS }; @@ -168,6 +169,8 @@ e_contact_editor_class_init (EContactEditorClass *klass) GTK_ARG_READWRITE, ARG_WRITABLE_FIELDS); gtk_object_add_arg_type ("EContactEditor::editable", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_EDITABLE); + gtk_object_add_arg_type ("EContactEditor::changed", GTK_TYPE_BOOL, + GTK_ARG_READWRITE, ARG_CHANGED); contact_editor_signals[CARD_ADDED] = gtk_signal_new ("card_added", @@ -797,8 +800,13 @@ card_added_cb (EBook *book, EBookStatus status, const char *id, EditorCloseStruc if (status == E_BOOK_STATUS_SUCCESS) { ce->is_new_card = FALSE; - if (should_close) + if (should_close) { close_dialog (ce); + } + else { + ce->changed = FALSE; + command_state_changed (ce); + } } } @@ -814,8 +822,13 @@ card_modified_cb (EBook *book, EBookStatus status, EditorCloseStruct *ecs) status, ce->card); if (status == E_BOOK_STATUS_SUCCESS) { - if (should_close) + if (should_close) { close_dialog (ce); + } + else { + ce->changed = FALSE; + command_state_changed (ce); + } } } @@ -1367,6 +1380,17 @@ e_contact_editor_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) } break; } + + case ARG_CHANGED: { + gboolean new_value = GTK_VALUE_BOOL (*arg) ? TRUE : FALSE; + gboolean changed = (editor->changed != new_value); + + editor->changed = new_value; + + if (changed) + command_state_changed (editor); + break; + } case ARG_WRITABLE_FIELDS: if (editor->writable_fields) gtk_object_unref(GTK_OBJECT(editor->writable_fields)); @@ -1406,6 +1430,10 @@ e_contact_editor_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) GTK_VALUE_BOOL (*arg) = e_contact_editor->editable ? TRUE : FALSE; break; + case ARG_CHANGED: + GTK_VALUE_BOOL (*arg) = e_contact_editor->changed ? TRUE : FALSE; + break; + case ARG_WRITABLE_FIELDS: if (e_contact_editor->writable_fields) GTK_VALUE_POINTER (*arg) = e_list_duplicate (e_contact_editor->writable_fields); -- cgit v1.2.3