From 4927cb896fac6ab7438c56336313561800ff4308 Mon Sep 17 00:00:00 2001 From: Sergio Villar Senin Date: Tue, 14 Jul 2009 19:12:10 +0200 Subject: [PATCH] Fixes NB#127780, addressbook dialogs are unnecessarily system modal --- src/hildon2/modest-address-book.c | 8 +++++--- src/hildon2/modest-msg-view-window.c | 2 +- src/maemo/modest-address-book.c | 10 ++++++++-- src/modest-address-book-dummy.c | 3 ++- src/modest-address-book.h | 3 ++- src/modest-ui-actions.c | 8 ++------ 6 files changed, 20 insertions(+), 14 deletions(-) diff --git a/src/hildon2/modest-address-book.c b/src/hildon2/modest-address-book.c index 46f9245..1256dd6 100644 --- a/src/hildon2/modest-address-book.c +++ b/src/hildon2/modest-address-book.c @@ -104,7 +104,8 @@ open_addressbook () } void -modest_address_book_add_address (const gchar *address) +modest_address_book_add_address (const gchar *address, + GtkWindow *parent) { GtkWidget *dialog = NULL; gchar *email_address; @@ -115,10 +116,11 @@ modest_address_book_add_address (const gchar *address) } email_address = modest_text_utils_get_email_address (address); - + attribute = e_vcard_attribute_new (NULL, EVC_EMAIL); e_vcard_attribute_add_value (attribute, email_address); - dialog = osso_abook_temporary_contact_dialog_new (NULL, book, attribute, NULL); + dialog = osso_abook_temporary_contact_dialog_new (parent, book, attribute, NULL); + gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); diff --git a/src/hildon2/modest-msg-view-window.c b/src/hildon2/modest-msg-view-window.c index b78350d..99e202b 100644 --- a/src/hildon2/modest-msg-view-window.c +++ b/src/hildon2/modest-msg-view-window.c @@ -3521,7 +3521,7 @@ modest_msg_view_window_add_to_contacts (ModestMsgViewWindow *self) gtk_widget_destroy (picker_dialog); if (selected) - modest_address_book_add_address (selected); + modest_address_book_add_address (selected, (GtkWindow *) self); g_free (selected); } else { diff --git a/src/maemo/modest-address-book.c b/src/maemo/modest-address-book.c index 2bf3808..c6a3d76 100644 --- a/src/maemo/modest-address-book.c +++ b/src/maemo/modest-address-book.c @@ -131,7 +131,8 @@ open_addressbook_sync () } void -modest_address_book_add_address (const gchar *address) +modest_address_book_add_address (const gchar *address, + GtkWindow *parent) { OssoABookAccount *account = NULL; GtkWidget *dialog = NULL; @@ -147,13 +148,18 @@ modest_address_book_add_address (const gchar *address) } email_address = modest_text_utils_get_email_address (address); - + account = osso_abook_account_get (EVC_EMAIL, NULL, email_address); g_free (email_address); if (account) { dialog = osso_abook_add_to_contacts_dialog_new (contact_model, account); g_object_unref (account); + + modest_window_mgr_set_modal (modest_runtime_get_window_mgr(), + (GtkWindow *) parent, + (GtkWindow *) dialog); + gtk_dialog_run (GTK_DIALOG (dialog)); if (contact_model) { diff --git a/src/modest-address-book-dummy.c b/src/modest-address-book-dummy.c index a48dd36..1368df7 100644 --- a/src/modest-address-book-dummy.c +++ b/src/modest-address-book-dummy.c @@ -34,7 +34,8 @@ #include "modest-address-book.h" -void modest_address_book_add_address (const gchar *address) +void modest_address_book_add_address (const gchar *address, + GtkWindow *parent) { g_debug ("trying to add '%s' to non-existing address book", address); diff --git a/src/modest-address-book.h b/src/modest-address-book.h index f39b98d..f0d5690 100644 --- a/src/modest-address-book.h +++ b/src/modest-address-book.h @@ -51,7 +51,8 @@ modest_address_book_init (void); * launches the UI for adding @address to the addressbook */ void -modest_address_book_add_address (const gchar *address); +modest_address_book_add_address (const gchar *address, + GtkWindow *parent); /** * modest_address_book_select_addresses: diff --git a/src/modest-ui-actions.c b/src/modest-ui-actions.c index c87dd34..f3fb660 100644 --- a/src/modest-ui-actions.c +++ b/src/modest-ui-actions.c @@ -700,12 +700,8 @@ modest_ui_actions_on_add_to_contacts (GtkAction *action, ModestWindow *win) clipboard = gtk_clipboard_get (GDK_SELECTION_PRIMARY); selection = gtk_clipboard_wait_for_text (clipboard); - /* Question: why is the clipboard being used here? - * It doesn't really make a lot of sense. */ - - if (selection) - { - modest_address_book_add_address (selection); + if (selection) { + modest_address_book_add_address (selection, (GtkWindow *) win); g_free (selection); } } -- 1.7.9.5