aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui/component/e-book-shell-content.c
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@src.gnome.org>2008-10-25 07:02:33 +0800
committerMatthew Barnes <mbarnes@src.gnome.org>2008-10-25 07:02:33 +0800
commite7a31c5035a0afeed6c1675e30487c1e2bdc139f (patch)
treeeb1e733a6fe69773498725efa64304a9234270bc /addressbook/gui/component/e-book-shell-content.c
parent95cae9b166587d19db3aadde6a21cc12c30da6e6 (diff)
downloadgsoc2013-evolution-e7a31c5035a0afeed6c1675e30487c1e2bdc139f.tar
gsoc2013-evolution-e7a31c5035a0afeed6c1675e30487c1e2bdc139f.tar.gz
gsoc2013-evolution-e7a31c5035a0afeed6c1675e30487c1e2bdc139f.tar.bz2
gsoc2013-evolution-e7a31c5035a0afeed6c1675e30487c1e2bdc139f.tar.lz
gsoc2013-evolution-e7a31c5035a0afeed6c1675e30487c1e2bdc139f.tar.xz
gsoc2013-evolution-e7a31c5035a0afeed6c1675e30487c1e2bdc139f.tar.zst
gsoc2013-evolution-e7a31c5035a0afeed6c1675e30487c1e2bdc139f.zip
Commit recent work so I can merge from trunk.
svn path=/branches/kill-bonobo/; revision=36684
Diffstat (limited to 'addressbook/gui/component/e-book-shell-content.c')
-rw-r--r--addressbook/gui/component/e-book-shell-content.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/addressbook/gui/component/e-book-shell-content.c b/addressbook/gui/component/e-book-shell-content.c
index 6b7b01bc4c..8190a5958a 100644
--- a/addressbook/gui/component/e-book-shell-content.c
+++ b/addressbook/gui/component/e-book-shell-content.c
@@ -185,10 +185,47 @@ book_shell_content_constructed (GObject *object)
gconf_bridge_bind_property_delayed (bridge, key, object, "position");
}
+static guint32
+book_shell_content_check_state (EShellContent *shell_content)
+{
+ EBookShellContent *book_shell_content;
+ ESelectionModel *selection_model;
+ EAddressbookModel *model;
+ EAddressbookView *view;
+ guint32 state = 0;
+ gint n_contacts;
+ gint n_selected;
+
+ book_shell_content = E_BOOK_SHELL_CONTENT (shell_content);
+ view = e_book_shell_content_get_current_view (book_shell_content);
+ model = e_addressbook_view_get_model (view);
+
+ selection_model = e_addressbook_view_get_selection_model (view);
+ n_contacts = (selection_model != NULL) ?
+ e_selection_model_row_count (selection_model) : 0;
+ n_selected = (selection_model != NULL) ?
+ e_selection_model_selected_count (selection_model) : 0;
+
+ /* FIXME Finish the rest of the flags. */
+ if (n_selected == 1)
+ state |= E_BOOK_SHELL_CONTENT_SELECTION_SINGLE;
+ if (n_selected > 1)
+ state |= E_BOOK_SHELL_CONTENT_SELECTION_MULTIPLE;
+ if (e_addressbook_model_can_stop (model))
+ state |= E_BOOK_SHELL_CONTENT_SOURCE_IS_BUSY;
+ if (e_addressbook_model_get_editable (model))
+ state |= E_BOOK_SHELL_CONTENT_SOURCE_IS_EDITABLE;
+ if (n_contacts == 0)
+ state |= E_BOOK_SHELL_CONTENT_SOURCE_IS_EMPTY;
+
+ return state;
+}
+
static void
book_shell_content_class_init (EBookShellContentClass *class)
{
GObjectClass *object_class;
+ EShellContentClass *shell_content_class;
parent_class = g_type_class_peek_parent (class);
g_type_class_add_private (class, sizeof (EBookShellContentPrivate));
@@ -199,6 +236,9 @@ book_shell_content_class_init (EBookShellContentClass *class)
object_class->dispose = book_shell_content_dispose;
object_class->constructed = book_shell_content_constructed;
+ shell_content_class = E_SHELL_CONTENT_CLASS (class);
+ shell_content_class->check_state = book_shell_content_check_state;
+
g_object_class_install_property (
object_class,
PROP_CURRENT_VIEW,