diff options
author | Chris Toshok <toshok@ximian.com> | 2002-09-13 18:02:24 +0800 |
---|---|---|
committer | Chris Toshok <toshok@src.gnome.org> | 2002-09-13 18:02:24 +0800 |
commit | dbe5c76eb0241a143c365f0f2731830e04fe1cc7 (patch) | |
tree | b3c7cbb1417289485ee0c090a383f27de2796fce /addressbook | |
parent | 285af5226ade1b9de2681bcf166945c028d33f42 (diff) | |
download | gsoc2013-evolution-dbe5c76eb0241a143c365f0f2731830e04fe1cc7.tar.gz gsoc2013-evolution-dbe5c76eb0241a143c365f0f2731830e04fe1cc7.tar.zst gsoc2013-evolution-dbe5c76eb0241a143c365f0f2731830e04fe1cc7.zip |
[ Fixes bug #30250 ] handle "Unnamed Lists" here by setting their name to
2002-09-13 Chris Toshok <toshok@ximian.com>
[ Fixes bug #30250 ]
* backend/ebook/e-destination.c (e_destination_get_name): handle
"Unnamed Lists" here by setting their name to _("Unnamed List').
* backend/ebook/e-card-simple.c (e_card_simple_get): same.
* gui/contact-list-editor/e-contact-list-editor.c (is_named): new
function, return TRUE if the name field is filled in.
(prompt_to_save_changes): return TRUE if the list isn't named
(meaning it's not saveable.)
(command_state_changed): saving requires a name.
(add_email_cb): always call command_state_changed.
(remove_entry_cb): same.
(list_name_changed_cb): same.
(visible_addrs_toggled_cb): same.
(table_drag_data_received_cb): same.
svn path=/trunk/; revision=18059
Diffstat (limited to 'addressbook')
-rw-r--r-- | addressbook/ChangeLog | 19 | ||||
-rw-r--r-- | addressbook/backend/ebook/e-card-simple.c | 10 | ||||
-rw-r--r-- | addressbook/backend/ebook/e-destination.c | 5 | ||||
-rw-r--r-- | addressbook/gui/contact-list-editor/e-contact-list-editor.c | 50 |
4 files changed, 61 insertions, 23 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index 2acabe88ff..bdd792a5b0 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,3 +1,22 @@ +2002-09-13 Chris Toshok <toshok@ximian.com> + + [ Fixes bug #30250 ] + * backend/ebook/e-destination.c (e_destination_get_name): handle + "Unnamed Lists" here by setting their name to _("Unnamed List'). + + * backend/ebook/e-card-simple.c (e_card_simple_get): same. + + * gui/contact-list-editor/e-contact-list-editor.c (is_named): new + function, return TRUE if the name field is filled in. + (prompt_to_save_changes): return TRUE if the list isn't named + (meaning it's not saveable.) + (command_state_changed): saving requires a name. + (add_email_cb): always call command_state_changed. + (remove_entry_cb): same. + (list_name_changed_cb): same. + (visible_addrs_toggled_cb): same. + (table_drag_data_received_cb): same. + 2002-09-12 Dan Winship <danw@ximian.com> * backend/ebook/e-card-simple.c (e_card_simple_get): return diff --git a/addressbook/backend/ebook/e-card-simple.c b/addressbook/backend/ebook/e-card-simple.c index d6baddaadd..7f0dd263b4 100644 --- a/addressbook/backend/ebook/e-card-simple.c +++ b/addressbook/backend/ebook/e-card-simple.c @@ -831,6 +831,8 @@ char *e_card_simple_get (ECardSimple *simple, switch (field) { case E_CARD_SIMPLE_FIELD_NAME_OR_ORG: if (simple->card) { + gboolean is_list; + gtk_object_get(GTK_OBJECT(simple->card), "file_as", &string, NULL); @@ -846,8 +848,12 @@ char *e_card_simple_get (ECardSimple *simple, NULL); if (string && *string) return g_strdup(string); - string = e_card_simple_get_email(simple, - E_CARD_SIMPLE_EMAIL_ID_EMAIL); + is_list = e_card_evolution_list (simple->card); + if (is_list) + string = _("Unnamed List"); + else + string = e_card_simple_get_email(simple, + E_CARD_SIMPLE_EMAIL_ID_EMAIL); return g_strdup(string); } else return NULL; diff --git a/addressbook/backend/ebook/e-destination.c b/addressbook/backend/ebook/e-destination.c index c83d908e9b..25932c29e6 100644 --- a/addressbook/backend/ebook/e-destination.c +++ b/addressbook/backend/ebook/e-destination.c @@ -702,7 +702,10 @@ e_destination_get_name (const EDestination *dest) if (priv->name == NULL || *priv->name == '\0') { g_free (priv->name); - priv->name = g_strdup (e_destination_get_email (dest)); + if (e_card_evolution_list (priv->card)) + priv->name = g_strdup (_("Unnamed List")); + else + priv->name = g_strdup (e_destination_get_email (dest)); } } else if (priv->raw != NULL) { CamelInternetAddress *addr = camel_internet_address_new (); diff --git a/addressbook/gui/contact-list-editor/e-contact-list-editor.c b/addressbook/gui/contact-list-editor/e-contact-list-editor.c index e75d8d35e8..5dd61ebec4 100644 --- a/addressbook/gui/contact-list-editor/e-contact-list-editor.c +++ b/addressbook/gui/contact-list-editor/e-contact-list-editor.c @@ -391,9 +391,24 @@ save_card (EContactListEditor *cle, gboolean should_close) } static gboolean +is_named (EContactListEditor *editor) +{ + char *string = e_utf8_gtk_editable_get_chars(GTK_EDITABLE (editor->list_name_entry), 0, -1); + gboolean named = FALSE; + + if (string && *string) { + named = TRUE; + } + + g_free (string); + + return named; +} + +static gboolean prompt_to_save_changes (EContactListEditor *editor) { - if (!editor->changed) + if (!editor->changed || !is_named (editor)) return TRUE; switch (e_addressbook_prompt_save_dialog (GTK_WINDOW(editor->app))) { @@ -718,10 +733,9 @@ add_email_cb (GtkWidget *w, EContactListEditor *editor) gtk_entry_set_text (GTK_ENTRY(editor->email_entry), ""); - if (!editor->changed) { - editor->changed = TRUE; - command_state_changed (editor); - } + editor->changed = TRUE; + + command_state_changed (editor); } static void @@ -735,28 +749,22 @@ remove_entry_cb (GtkWidget *w, EContactListEditor *editor) { e_table_selected_row_foreach (e_table_scrolled_get_table(E_TABLE_SCROLLED(editor->table)), (EForeachFunc)remove_row, editor); - if (!editor->changed) { - editor->changed = TRUE; - command_state_changed (editor); - } + editor->changed = TRUE; + command_state_changed (editor); } static void list_name_changed_cb (GtkWidget *w, EContactListEditor *editor) { - if (!editor->changed) { - editor->changed = TRUE; - command_state_changed (editor); - } + editor->changed = TRUE; + command_state_changed (editor); } static void visible_addrs_toggled_cb (GtkWidget *w, EContactListEditor *editor) { - if (!editor->changed) { - editor->changed = TRUE; - command_state_changed (editor); - } + editor->changed = TRUE; + command_state_changed (editor); } static void @@ -878,7 +886,7 @@ table_drag_data_received_cb (ETable *table, int row, int col, gtk_adjustment_set_value (adj, adj->upper); } - if (changed && !editor->changed) { + if (changed) { editor->changed = TRUE; command_state_changed (editor); } @@ -887,15 +895,17 @@ table_drag_data_received_cb (ETable *table, int row, int col, static void command_state_changed (EContactListEditor *editor) { + gboolean named = is_named (editor); + bonobo_ui_component_set_prop (editor->uic, "/commands/ContactListEditorSaveClose", "sensitive", - editor->changed && editor->editable ? "1" : "0", NULL); + editor->changed && named && editor->editable ? "1" : "0", NULL); bonobo_ui_component_set_prop (editor->uic, "/commands/ContactListEditorSave", "sensitive", - editor->changed && editor->editable ? "1" : "0", NULL); + editor->changed && named && editor->editable ? "1" : "0", NULL); bonobo_ui_component_set_prop (editor->uic, "/commands/ContactListEditorDelete", |