aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui
diff options
context:
space:
mode:
authorChris Toshok <toshok@ximian.com>2002-09-13 18:02:24 +0800
committerChris Toshok <toshok@src.gnome.org>2002-09-13 18:02:24 +0800
commitdbe5c76eb0241a143c365f0f2731830e04fe1cc7 (patch)
treeb3c7cbb1417289485ee0c090a383f27de2796fce /addressbook/gui
parent285af5226ade1b9de2681bcf166945c028d33f42 (diff)
downloadgsoc2013-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/gui')
-rw-r--r--addressbook/gui/contact-list-editor/e-contact-list-editor.c50
1 files changed, 30 insertions, 20 deletions
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",