aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui
diff options
context:
space:
mode:
authorEttore Perazzoli <ettore@src.gnome.org>2002-05-17 02:48:59 +0800
committerEttore Perazzoli <ettore@src.gnome.org>2002-05-17 02:48:59 +0800
commit073927075b22b5a2988e299e91d2ccb7ec58c1c8 (patch)
treebca81ff15073987dcff9ddf5cf19377a22a05ba4 /addressbook/gui
parent3a868a57bb55512cf7315b3178d9557d6350be32 (diff)
downloadgsoc2013-evolution-073927075b22b5a2988e299e91d2ccb7ec58c1c8.tar.gz
gsoc2013-evolution-073927075b22b5a2988e299e91d2ccb7ec58c1c8.tar.zst
gsoc2013-evolution-073927075b22b5a2988e299e91d2ccb7ec58c1c8.zip
New, quit handler for the EvolutionShellComponent. (add_creatable_item):
* gui/component/addressbook-component.c (request_quit): New, quit handler for the EvolutionShellComponent. (add_creatable_item): Set it up. * gui/contact-editor/e-contact-list-editor.c (e_contact_list_editor_request_close_all): New. (e_contact_list_editor_new): Put the contact editor in a static list and gtk_object_weakref() it. (contact_list_editor_destroy_notify): New, GtkDestroyNotify function for the contact editors. * gui/contact-editor/e-contact-editor.c (e_contact_editor_request_close_all): New. (e_contact_editor_new): Put the contact editor in a static list and gtk_object_weakref() it. (contact_editor_destroy_notify): New, GtkDestroyNotify function for the contact editors. svn path=/trunk/; revision=16934
Diffstat (limited to 'addressbook/gui')
-rw-r--r--addressbook/gui/component/addressbook-component.c17
-rw-r--r--addressbook/gui/component/addressbook-storage.c2
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor.c37
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor.h20
-rw-r--r--addressbook/gui/contact-list-editor/e-contact-list-editor.c37
-rw-r--r--addressbook/gui/contact-list-editor/e-contact-list-editor.h20
6 files changed, 113 insertions, 20 deletions
diff --git a/addressbook/gui/component/addressbook-component.c b/addressbook/gui/component/addressbook-component.c
index 2979d211eb..54940faeab 100644
--- a/addressbook/gui/component/addressbook-component.c
+++ b/addressbook/gui/component/addressbook-component.c
@@ -505,6 +505,20 @@ destination_folder_handle_drop (EvolutionShellComponentDndDestinationFolder *fol
}
+/* Quitting. */
+
+static gboolean
+request_quit (EvolutionShellComponent *shell_component,
+ void *data)
+{
+ if (! e_contact_editor_request_close_all ()
+ || ! e_contact_list_editor_request_close_all ())
+ return FALSE;
+ else
+ return TRUE;
+}
+
+
/* The factory function. */
static void
@@ -549,7 +563,8 @@ create_component (void)
remove_folder, xfer_folder,
NULL,
get_dnd_selection,
- NULL, NULL);
+ request_quit,
+ NULL);
destination_interface = evolution_shell_component_dnd_destination_folder_new (destination_folder_handle_motion,
destination_folder_handle_drop,
diff --git a/addressbook/gui/component/addressbook-storage.c b/addressbook/gui/component/addressbook-storage.c
index d3430dd476..358c3e8245 100644
--- a/addressbook/gui/component/addressbook-storage.c
+++ b/addressbook/gui/component/addressbook-storage.c
@@ -165,7 +165,7 @@ addressbook_get_other_contact_storage (void)
EvolutionStorageResult result;
if (storage == NULL) {
- storage = evolution_storage_new (U_("Other Contacts"), FALSE);
+ storage = evolution_storage_new (U_("Other Contacts"), TRUE);
gtk_signal_connect (GTK_OBJECT (storage),
"remove_folder",
GTK_SIGNAL_FUNC(remove_ldap_folder), NULL);
diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c
index fd0f14ddb5..a3dd431d2e 100644
--- a/addressbook/gui/contact-editor/e-contact-editor.c
+++ b/addressbook/gui/contact-editor/e-contact-editor.c
@@ -112,6 +112,8 @@ enum {
DYNAMIC_LIST_ADDRESS
};
+static GSList *all_contact_editors = NULL;
+
GtkType
e_contact_editor_get_type (void)
{
@@ -1489,6 +1491,14 @@ supported_fields_cb (EBook *book, EBookStatus status,
command_state_changed (ce);
}
+static void
+contact_editor_destroy_notify (void *data)
+{
+ EContactEditor *ce = E_CONTACT_EDITOR (data);
+
+ all_contact_editors = g_slist_remove (all_contact_editors, ce);
+}
+
EContactEditor *
e_contact_editor_new (EBook *book,
ECard *card,
@@ -1502,6 +1512,9 @@ e_contact_editor_new (EBook *book,
ce = E_CONTACT_EDITOR (gtk_type_new (E_CONTACT_EDITOR_TYPE));
+ all_contact_editors = g_slist_prepend (all_contact_editors, ce);
+ gtk_object_weakref (GTK_OBJECT (ce), contact_editor_destroy_notify, ce);
+
gtk_object_set (GTK_OBJECT (ce),
"book", book,
"card", card,
@@ -2746,3 +2759,27 @@ enable_widget (GtkWidget *widget, gboolean enabled)
else
gtk_widget_set_sensitive (widget, enabled);
}
+
+
+gboolean
+e_contact_editor_request_close_all (void)
+{
+ GSList *p;
+ GSList *pnext;
+ gboolean retval;
+
+ retval = TRUE;
+ for (p = all_contact_editors; p != NULL; p = pnext) {
+ pnext = p->next;
+
+ e_contact_editor_raise (E_CONTACT_EDITOR (p->data));
+ if (! prompt_to_save_changes (E_CONTACT_EDITOR (p->data))) {
+ retval = FALSE;
+ break;
+ }
+
+ close_dialog (E_CONTACT_EDITOR (p->data));
+ }
+
+ return retval;
+}
diff --git a/addressbook/gui/contact-editor/e-contact-editor.h b/addressbook/gui/contact-editor/e-contact-editor.h
index 249640379b..0010182b99 100644
--- a/addressbook/gui/contact-editor/e-contact-editor.h
+++ b/addressbook/gui/contact-editor/e-contact-editor.h
@@ -117,17 +117,19 @@ struct _EContactEditorClass
void (* editor_closed) (EContactEditor *ce);
};
-EContactEditor *e_contact_editor_new (EBook *book,
- ECard *card,
- gboolean is_new_card,
- gboolean editable);
-GtkType e_contact_editor_get_type (void);
-void e_contact_editor_show (EContactEditor *editor);
-void e_contact_editor_close (EContactEditor *editor);
-void e_contact_editor_raise (EContactEditor *editor);
+EContactEditor *e_contact_editor_new (EBook *book,
+ ECard *card,
+ gboolean is_new_card,
+ gboolean editable);
+GtkType e_contact_editor_get_type (void);
+void e_contact_editor_show (EContactEditor *editor);
+void e_contact_editor_close (EContactEditor *editor);
+void e_contact_editor_raise (EContactEditor *editor);
-gboolean e_contact_editor_confirm_delete (GtkWindow *parent);
+gboolean e_contact_editor_confirm_delete (GtkWindow *parent);
+
+gboolean e_contact_editor_request_close_all (void);
#ifdef __cplusplus
}
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 c88af3005e..abb08d30f8 100644
--- a/addressbook/gui/contact-list-editor/e-contact-list-editor.c
+++ b/addressbook/gui/contact-list-editor/e-contact-list-editor.c
@@ -97,6 +97,8 @@ enum {
ARG_EDITABLE
};
+static GSList *all_contact_list_editors = NULL;
+
GtkType
e_contact_list_editor_get_type (void)
{
@@ -538,6 +540,14 @@ create_ui (EContactListEditor *ce)
e_pixmaps_update (ce->uic, pixmaps);
}
+static void
+contact_list_editor_destroy_notify (void *data)
+{
+ EContactListEditor *ce = E_CONTACT_LIST_EDITOR (data);
+
+ all_contact_list_editors = g_slist_remove (all_contact_list_editors, ce);
+}
+
EContactListEditor *
e_contact_list_editor_new (EBook *book,
ECard *list_card,
@@ -548,6 +558,9 @@ e_contact_list_editor_new (EBook *book,
ce = E_CONTACT_LIST_EDITOR (gtk_type_new (E_CONTACT_LIST_EDITOR_TYPE));
+ all_contact_list_editors = g_slist_prepend (all_contact_list_editors, ce);
+ gtk_object_weakref (GTK_OBJECT (ce), contact_list_editor_destroy_notify, ce);
+
gtk_object_set (GTK_OBJECT (ce),
"book", book,
"card", list_card,
@@ -978,3 +991,27 @@ fill_in_info(EContactListEditor *editor)
}
}
}
+
+
+gboolean
+e_contact_list_editor_request_close_all (void)
+{
+ GSList *p;
+ GSList *pnext;
+ gboolean retval;
+
+ retval = TRUE;
+ for (p = all_contact_list_editors; p != NULL; p = pnext) {
+ pnext = p->next;
+
+ e_contact_list_editor_raise (E_CONTACT_LIST_EDITOR (p->data));
+ if (! prompt_to_save_changes (E_CONTACT_LIST_EDITOR (p->data))) {
+ retval = FALSE;
+ break;
+ }
+
+ close_dialog (E_CONTACT_LIST_EDITOR (p->data));
+ }
+
+ return retval;
+}
diff --git a/addressbook/gui/contact-list-editor/e-contact-list-editor.h b/addressbook/gui/contact-list-editor/e-contact-list-editor.h
index 37f54df170..a091c6c680 100644
--- a/addressbook/gui/contact-list-editor/e-contact-list-editor.h
+++ b/addressbook/gui/contact-list-editor/e-contact-list-editor.h
@@ -92,15 +92,17 @@ struct _EContactListEditorClass
void (* editor_closed) (EContactListEditor *cle);
};
-EContactListEditor *e_contact_list_editor_new (EBook *book,
- ECard *list_card,
- gboolean is_new_list,
- gboolean editable);
-GtkType e_contact_list_editor_get_type (void);
-void e_contact_list_editor_show (EContactListEditor *editor);
-void e_contact_list_editor_raise (EContactListEditor *editor);
-
-gboolean e_contact_list_editor_confirm_delete (GtkWindow *parent);
+EContactListEditor *e_contact_list_editor_new (EBook *book,
+ ECard *list_card,
+ gboolean is_new_list,
+ gboolean editable);
+GtkType e_contact_list_editor_get_type (void);
+void e_contact_list_editor_show (EContactListEditor *editor);
+void e_contact_list_editor_raise (EContactListEditor *editor);
+
+gboolean e_contact_list_editor_confirm_delete (GtkWindow *parent);
+
+gboolean e_contact_list_editor_request_close_all (void);
#ifdef __cplusplus
}