aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2013-01-09 05:17:36 +0800
committerMilan Crha <mcrha@redhat.com>2013-01-09 05:17:36 +0800
commitf1e24f60ddd39e6ce2432c5bb5a37a5fae642b97 (patch)
tree6f500341029e0636f2dc19c73dc3e29cd722461c
parenta8a3942d520feeacf68116dc6340b54a88050aa3 (diff)
downloadgsoc2013-evolution-f1e24f60ddd39e6ce2432c5bb5a37a5fae642b97.tar
gsoc2013-evolution-f1e24f60ddd39e6ce2432c5bb5a37a5fae642b97.tar.gz
gsoc2013-evolution-f1e24f60ddd39e6ce2432c5bb5a37a5fae642b97.tar.bz2
gsoc2013-evolution-f1e24f60ddd39e6ce2432c5bb5a37a5fae642b97.tar.lz
gsoc2013-evolution-f1e24f60ddd39e6ce2432c5bb5a37a5fae642b97.tar.xz
gsoc2013-evolution-f1e24f60ddd39e6ce2432c5bb5a37a5fae642b97.tar.zst
gsoc2013-evolution-f1e24f60ddd39e6ce2432c5bb5a37a5fae642b97.zip
Bug #691134 - New contact lists always saved to a default book
-rw-r--r--addressbook/gui/contact-list-editor/e-contact-list-editor.c2
-rw-r--r--modules/addressbook/e-book-shell-backend.c36
2 files changed, 34 insertions, 4 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 a6205757d8..1e62da7f5f 100644
--- a/addressbook/gui/contact-list-editor/e-contact-list-editor.c
+++ b/addressbook/gui/contact-list-editor/e-contact-list-editor.c
@@ -949,7 +949,7 @@ contact_list_editor_source_menu_changed_cb (GtkWidget *widget)
if (!e_source_equal (client_source, active_source))
e_client_utils_open_new (
- client_source, E_CLIENT_SOURCE_TYPE_CONTACTS,
+ active_source, E_CLIENT_SOURCE_TYPE_CONTACTS,
FALSE, NULL, contact_list_editor_book_loaded_cb,
g_object_ref (editor));
diff --git a/modules/addressbook/e-book-shell-backend.c b/modules/addressbook/e-book-shell-backend.c
index 2475312832..66562a33d8 100644
--- a/modules/addressbook/e-book-shell-backend.c
+++ b/modules/addressbook/e-book-shell-backend.c
@@ -38,6 +38,7 @@
#include "widgets/misc/e-source-config-dialog.h"
#include "addressbook/gui/widgets/eab-gui-util.h"
+#include "addressbook/gui/widgets/e-addressbook-view.h"
#include "addressbook/gui/contact-editor/e-contact-editor.h"
#include "addressbook/gui/contact-editor/e-contact-quick-add.h"
#include "addressbook/gui/contact-list-editor/e-contact-list-editor.h"
@@ -45,6 +46,7 @@
#include "autocompletion-config.h"
+#include "e-book-shell-content.h"
#include "e-book-shell-migrate.h"
#include "e-book-shell-settings.h"
#include "e-book-shell-view.h"
@@ -176,7 +178,7 @@ action_contact_new_cb (GtkAction *action,
EShellWindow *shell_window)
{
EShell *shell;
- ESource *source;
+ ESource *source = NULL;
ESourceRegistry *registry;
const gchar *action_name;
@@ -184,8 +186,36 @@ action_contact_new_cb (GtkAction *action,
shell = e_shell_window_get_shell (shell_window);
- registry = e_shell_get_registry (shell);
- source = e_source_registry_ref_default_address_book (registry);
+ if (g_strcmp0 (e_shell_window_get_active_view (shell_window), "addressbook") == 0) {
+ EShellView *shell_view = e_shell_window_get_shell_view (shell_window, "addressbook");
+
+ if (shell_view && E_IS_BOOK_SHELL_VIEW (shell_view)) {
+ EBookShellContent *book_shell_content;
+ EAddressbookView *view;
+ EAddressbookModel *model;
+ EBookClient *book_client;
+
+ book_shell_content = NULL;
+ g_object_get (G_OBJECT (shell_view), "shell-content", &book_shell_content, NULL);
+ g_return_if_fail (book_shell_content != NULL);
+
+ view = e_book_shell_content_get_current_view (book_shell_content);
+ g_return_if_fail (view != NULL);
+
+ model = e_addressbook_view_get_model (view);
+ book_client = e_addressbook_model_get_client (model);
+ g_return_if_fail (book_client != NULL);
+
+ source = g_object_ref (e_client_get_source (E_CLIENT (book_client)));
+
+ g_object_unref (book_shell_content);
+ }
+ }
+
+ if (!source) {
+ registry = e_shell_get_registry (shell);
+ source = e_source_registry_ref_default_address_book (registry);
+ }
/* Use a callback function appropriate for the action. */
action_name = gtk_action_get_name (action);