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
This commit is contained in:
Chris Toshok
2001-08-08 17:04:54 +00:00
committed by Chris Toshok
parent d364b46165
commit 62b28b0d5f
3 changed files with 48 additions and 2 deletions

View File

@ -1,3 +1,16 @@
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

View File

@ -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);

View File

@ -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),