aboutsummaryrefslogtreecommitdiffstats
path: root/modules/addressbook
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2010-11-02 02:44:23 +0800
committerRodrigo Moya <rodrigo@gnome-db.org>2010-11-10 06:33:21 +0800
commit26afa6081c3d9826dbae78236dd712fad8b7c340 (patch)
tree531e8587a88bc408b91341a98e20fbd934cbb344 /modules/addressbook
parentf5460f323b2581af28764b96635b2d3a0f1548c9 (diff)
downloadgsoc2013-evolution-26afa6081c3d9826dbae78236dd712fad8b7c340.tar.gz
gsoc2013-evolution-26afa6081c3d9826dbae78236dd712fad8b7c340.tar.zst
gsoc2013-evolution-26afa6081c3d9826dbae78236dd712fad8b7c340.zip
Utilize the new ESourceSelector:primary-selection property.
Diffstat (limited to 'modules/addressbook')
-rw-r--r--modules/addressbook/apps_evolution_addressbook.schemas.in14
-rw-r--r--modules/addressbook/e-book-shell-settings.c4
-rw-r--r--modules/addressbook/e-book-shell-sidebar.c19
-rw-r--r--modules/addressbook/e-book-shell-view-actions.c4
-rw-r--r--modules/addressbook/e-book-shell-view-private.c2
5 files changed, 39 insertions, 4 deletions
diff --git a/modules/addressbook/apps_evolution_addressbook.schemas.in b/modules/addressbook/apps_evolution_addressbook.schemas.in
index 7ce3902c82..03e6006527 100644
--- a/modules/addressbook/apps_evolution_addressbook.schemas.in
+++ b/modules/addressbook/apps_evolution_addressbook.schemas.in
@@ -73,6 +73,20 @@
</schema>
<schema>
+ <key>/schemas/apps/evolution/addressbook/display/primary_addressbook</key>
+ <applyto>/apps/evolution/addressbook/display/primary_addressbook</applyto>
+ <owner>evolution-addressbook</owner>
+ <type>string</type>
+ <locale name="C">
+ <short>Primary address book</short>
+ <long>
+ The UID of the selected (or "primary") address book in the
+ sidebar of the "Contacts" view.
+ </long>
+ </locale>
+ </schema>
+
+ <schema>
<key>/schemas/apps/evolution/addressbook/display/hpane_position</key>
<applyto>/apps/evolution/addressbook/display/hpane_position</applyto>
<owner>evolution-addressbook</owner>
diff --git a/modules/addressbook/e-book-shell-settings.c b/modules/addressbook/e-book-shell-settings.c
index 6d6802a1a2..d8d86b5d82 100644
--- a/modules/addressbook/e-book-shell-settings.c
+++ b/modules/addressbook/e-book-shell-settings.c
@@ -27,4 +27,8 @@ e_book_shell_backend_init_settings (EShell *shell)
e_shell_settings_install_property_for_key (
"book-completion-show-address",
"/apps/evolution/addressbook/completion/show_address");
+
+ e_shell_settings_install_property_for_key (
+ "book-primary-selection",
+ "/apps/evolution/addressbook/display/primary_addressbook");
}
diff --git a/modules/addressbook/e-book-shell-sidebar.c b/modules/addressbook/e-book-shell-sidebar.c
index 5ff6c2902c..3c61f5e55d 100644
--- a/modules/addressbook/e-book-shell-sidebar.c
+++ b/modules/addressbook/e-book-shell-sidebar.c
@@ -24,6 +24,8 @@
#include <string.h>
#include <glib/gi18n.h>
+#include <e-util/e-util.h>
+
#include "e-book-shell-view.h"
#include "e-book-shell-backend.h"
#include "e-addressbook-selector.h"
@@ -81,9 +83,11 @@ static void
book_shell_sidebar_constructed (GObject *object)
{
EBookShellSidebarPrivate *priv;
+ EShell *shell;
EShellView *shell_view;
EShellBackend *shell_backend;
EShellSidebar *shell_sidebar;
+ EShellSettings *shell_settings;
ESourceList *source_list;
GtkContainer *container;
GtkWidget *widget;
@@ -97,6 +101,9 @@ book_shell_sidebar_constructed (GObject *object)
shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
shell_backend = e_shell_view_get_shell_backend (shell_view);
+ shell = e_shell_backend_get_shell (shell_backend);
+ shell_settings = e_shell_get_shell_settings (shell);
+
source_list = e_book_shell_backend_get_source_list (
E_BOOK_SHELL_BACKEND (shell_backend));
@@ -118,6 +125,16 @@ book_shell_sidebar_constructed (GObject *object)
gtk_container_add (GTK_CONTAINER (container), widget);
priv->selector = g_object_ref (widget);
gtk_widget_show (widget);
+
+ g_object_bind_property_full (
+ shell_settings, "book-primary-selection",
+ widget, "primary-selection",
+ G_BINDING_BIDIRECTIONAL |
+ G_BINDING_SYNC_CREATE,
+ (GBindingTransformFunc) e_binding_transform_uid_to_source,
+ (GBindingTransformFunc) e_binding_transform_source_to_uid,
+ g_object_ref (source_list),
+ (GDestroyNotify) g_object_unref);
}
static guint32
@@ -132,7 +149,7 @@ book_shell_sidebar_check_state (EShellSidebar *shell_sidebar)
book_shell_sidebar = E_BOOK_SHELL_SIDEBAR (shell_sidebar);
selector = e_book_shell_sidebar_get_selector (book_shell_sidebar);
- source = e_source_selector_peek_primary_selection (selector);
+ source = e_source_selector_get_primary_selection (selector);
if (source != NULL) {
const gchar *uri;
diff --git a/modules/addressbook/e-book-shell-view-actions.c b/modules/addressbook/e-book-shell-view-actions.c
index 9c13e599a7..7dec37968d 100644
--- a/modules/addressbook/e-book-shell-view-actions.c
+++ b/modules/addressbook/e-book-shell-view-actions.c
@@ -65,7 +65,7 @@ action_address_book_delete_cb (GtkAction *action,
book_shell_sidebar = book_shell_view->priv->book_shell_sidebar;
selector = e_book_shell_sidebar_get_selector (book_shell_sidebar);
- source = e_source_selector_peek_primary_selection (selector);
+ source = e_source_selector_get_primary_selection (selector);
g_return_if_fail (source != NULL);
response = e_alert_run_dialog_for_args (
@@ -179,7 +179,7 @@ action_address_book_properties_cb (GtkAction *action,
book_shell_sidebar = book_shell_view->priv->book_shell_sidebar;
selector = e_book_shell_sidebar_get_selector (book_shell_sidebar);
- source = e_source_selector_peek_primary_selection (selector);
+ source = e_source_selector_get_primary_selection (selector);
g_return_if_fail (source != NULL);
uid = e_source_peek_uid (source);
diff --git a/modules/addressbook/e-book-shell-view-private.c b/modules/addressbook/e-book-shell-view-private.c
index 542c4e1178..097e6128d5 100644
--- a/modules/addressbook/e-book-shell-view-private.c
+++ b/modules/addressbook/e-book-shell-view-private.c
@@ -226,7 +226,7 @@ book_shell_view_activate_selected_source (EBookShellView *book_shell_view,
shell_window = e_shell_view_get_shell_window (shell_view);
book_shell_content = book_shell_view->priv->book_shell_content;
- source = e_source_selector_peek_primary_selection (selector);
+ source = e_source_selector_get_primary_selection (selector);
if (source == NULL)
return;