Fixes NB#127780, addressbook dialogs are unnecessarily system modal
authorSergio Villar Senin <svillar@igalia.com>
Tue, 14 Jul 2009 17:12:10 +0000 (19:12 +0200)
committerSergio Villar Senin <svillar@igalia.com>
Thu, 16 Jul 2009 15:56:07 +0000 (17:56 +0200)
src/hildon2/modest-address-book.c
src/hildon2/modest-msg-view-window.c
src/maemo/modest-address-book.c
src/modest-address-book-dummy.c
src/modest-address-book.h
src/modest-ui-actions.c

index 46f9245..1256dd6 100644 (file)
@@ -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);
index b78350d..99e202b 100644 (file)
@@ -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 {
index 2bf3808..c6a3d76 100644 (file)
@@ -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) {
index a48dd36..1368df7 100644 (file)
@@ -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);
index f39b98d..f0d5690 100644 (file)
@@ -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:
index c87dd34..f3fb660 100644 (file)
@@ -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);
        }
 }