diff options
author | Chris Toshok <toshok@ximian.com> | 2001-08-09 01:04:54 +0800 |
---|---|---|
committer | Chris Toshok <toshok@src.gnome.org> | 2001-08-09 01:04:54 +0800 |
commit | 62b28b0d5f05bcdff51bcf3bb2c71f06db583e1b (patch) | |
tree | a196c7b116cfe947abad781dfeb8229889260f36 /addressbook | |
parent | d364b46165a668e8f8760d3e4ec8335a6f05dab6 (diff) | |
download | gsoc2013-evolution-62b28b0d5f05bcdff51bcf3bb2c71f06db583e1b.tar.gz gsoc2013-evolution-62b28b0d5f05bcdff51bcf3bb2c71f06db583e1b.tar.zst gsoc2013-evolution-62b28b0d5f05bcdff51bcf3bb2c71f06db583e1b.zip |
mark the dialog as changed so the save button is immediately available.
2001-08-08 Chris Toshok <toshok@ximian.com>
* 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
Diffstat (limited to 'addressbook')
-rw-r--r-- | addressbook/ChangeLog | 13 | ||||
-rw-r--r-- | addressbook/gui/contact-editor/e-contact-editor.c | 32 | ||||
-rw-r--r-- | addressbook/gui/contact-editor/e-contact-quick-add.c | 5 |
3 files changed, 48 insertions, 2 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index 5ea346cb8e..e07924fc03 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,5 +1,18 @@ 2001-08-08 Chris Toshok <toshok@ximian.com> + * 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". + +2001-08-08 Chris Toshok <toshok@ximian.com> + * gui/contact-editor/e-contact-quick-add.c (ce_have_book): better to assume that we can write to the local addressbook than that we can't write to it :) 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); diff --git a/addressbook/gui/contact-editor/e-contact-quick-add.c b/addressbook/gui/contact-editor/e-contact-quick-add.c index 64e4202291..daed820b6c 100644 --- a/addressbook/gui/contact-editor/e-contact-quick-add.c +++ b/addressbook/gui/contact-editor/e-contact-quick-add.c @@ -181,6 +181,11 @@ ce_have_book (EBook *book, gpointer closure) } else { EContactEditor *contact_editor = e_contact_editor_new (book, qa->card, TRUE, TRUE /* XXX */); + /* mark it as changed so the Save buttons are enabled when we bring up the dialog. */ + gtk_object_set (GTK_OBJECT(contact_editor), + "changed", TRUE, + NULL); + gtk_signal_connect (GTK_OBJECT (contact_editor), "card_added", GTK_SIGNAL_FUNC (card_added_cb), |