aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@src.gnome.org>2008-09-25 06:53:30 +0800
committerMatthew Barnes <mbarnes@src.gnome.org>2008-09-25 06:53:30 +0800
commit9515b98403f2f7ef77dc6c51f82505fccef08c2b (patch)
tree2557338a0ad82878b8b2d84ecc9df7e169d75bc8 /addressbook
parent73c370019c4de89d4c901ee8c25cc0cbb55992fb (diff)
downloadgsoc2013-evolution-9515b98403f2f7ef77dc6c51f82505fccef08c2b.tar
gsoc2013-evolution-9515b98403f2f7ef77dc6c51f82505fccef08c2b.tar.gz
gsoc2013-evolution-9515b98403f2f7ef77dc6c51f82505fccef08c2b.tar.bz2
gsoc2013-evolution-9515b98403f2f7ef77dc6c51f82505fccef08c2b.tar.lz
gsoc2013-evolution-9515b98403f2f7ef77dc6c51f82505fccef08c2b.tar.xz
gsoc2013-evolution-9515b98403f2f7ef77dc6c51f82505fccef08c2b.tar.zst
gsoc2013-evolution-9515b98403f2f7ef77dc6c51f82505fccef08c2b.zip
Saving progress. Experimenting with directory layout.
Saving progress. Experimenting with directory layout. svn path=/branches/kill-bonobo/; revision=36446
Diffstat (limited to 'addressbook')
-rw-r--r--addressbook/gui/component/Makefile.am2
-rw-r--r--addressbook/gui/component/e-book-shell-content.c435
-rw-r--r--addressbook/gui/component/e-book-shell-content.h92
-rw-r--r--addressbook/gui/component/e-book-shell-sidebar.c3
-rw-r--r--addressbook/gui/component/e-book-shell-view-actions.c138
-rw-r--r--addressbook/gui/component/e-book-shell-view-private.c147
-rw-r--r--addressbook/gui/component/e-book-shell-view-private.h10
-rw-r--r--addressbook/gui/component/e-book-shell-view.c19
-rw-r--r--addressbook/gui/widgets/e-addressbook-view.c3
9 files changed, 684 insertions, 165 deletions
diff --git a/addressbook/gui/component/Makefile.am b/addressbook/gui/component/Makefile.am
index 974bce0a99..0df52c0336 100644
--- a/addressbook/gui/component/Makefile.am
+++ b/addressbook/gui/component/Makefile.am
@@ -34,6 +34,8 @@ libevolution_addressbook_la_SOURCES = \
autocompletion-config.h \
addressbook.c \
addressbook.h \
+ e-book-shell-content.c \
+ e-book-shell-content.h \
e-book-shell-module.c \
e-book-shell-sidebar.c \
e-book-shell-sidebar.h \
diff --git a/addressbook/gui/component/e-book-shell-content.c b/addressbook/gui/component/e-book-shell-content.c
new file mode 100644
index 0000000000..f7a7cb88e4
--- /dev/null
+++ b/addressbook/gui/component/e-book-shell-content.c
@@ -0,0 +1,435 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* e-book-shell-content.c
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "e-book-shell-content.h"
+
+#include <glib/gi18n.h>
+#include <e-util/gconf-bridge.h>
+
+#define E_BOOK_SHELL_CONTENT_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_BOOK_SHELL_CONTENT, EBookShellContentPrivate))
+
+struct _EBookShellContentPrivate {
+ GtkWidget *paned;
+ GtkWidget *notebook;
+ GtkWidget *preview;
+};
+
+enum {
+ PROP_0,
+ PROP_CURRENT_VIEW,
+ PROP_PREVIEW_CONTACT,
+ PROP_PREVIEW_VISIBLE
+};
+
+static gpointer parent_class;
+
+static void
+book_shell_content_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_CURRENT_VIEW:
+ e_book_shell_content_set_current_view (
+ E_BOOK_SHELL_CONTENT (object),
+ g_value_get_object (value));
+ return;
+
+ case PROP_PREVIEW_CONTACT:
+ e_book_shell_content_set_preview_contact (
+ E_BOOK_SHELL_CONTENT (object),
+ g_value_get_object (value));
+ return;
+
+ case PROP_PREVIEW_VISIBLE:
+ e_book_shell_content_set_preview_visible (
+ E_BOOK_SHELL_CONTENT (object),
+ g_value_get_boolean (value));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+book_shell_content_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_CURRENT_VIEW:
+ g_value_set_object (
+ value, e_book_shell_content_get_current_view (
+ E_BOOK_SHELL_CONTENT (object)));
+ return;
+
+ case PROP_PREVIEW_CONTACT:
+ g_value_set_object (
+ value, e_book_shell_content_get_preview_contact (
+ E_BOOK_SHELL_CONTENT (object)));
+ return;
+
+ case PROP_PREVIEW_VISIBLE:
+ g_value_set_boolean (
+ value, e_book_shell_content_get_preview_visible (
+ E_BOOK_SHELL_CONTENT (object)));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+book_shell_content_dispose (GObject *object)
+{
+ EBookShellContentPrivate *priv;
+
+ priv = E_BOOK_SHELL_CONTENT_GET_PRIVATE (object);
+
+ if (priv->paned != NULL) {
+ g_object_unref (priv->paned);
+ priv->paned = NULL;
+ }
+
+ if (priv->notebook != NULL) {
+ g_object_unref (priv->notebook);
+ priv->notebook = NULL;
+ }
+
+ if (priv->preview != NULL) {
+ g_object_unref (priv->preview);
+ priv->preview = NULL;
+ }
+
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static void
+book_shell_content_constructed (GObject *object)
+{
+ EBookShellContentPrivate *priv;
+ GConfBridge *bridge;
+ GtkWidget *container;
+ GtkWidget *widget;
+ const gchar *key;
+
+ priv = E_BOOK_SHELL_CONTENT_GET_PRIVATE (object);
+
+ /* Chain up to parent's constructed() method. */
+ G_OBJECT_CLASS (parent_class)->constructed (object);
+
+ container = GTK_WIDGET (object);
+
+ widget = gtk_vpaned_new ();
+ gtk_container_add (GTK_CONTAINER (container), widget);
+ priv->paned = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ container = widget;
+
+ widget = gtk_notebook_new ();
+ gtk_notebook_set_show_tabs (GTK_NOTEBOOK (widget), FALSE);
+ gtk_notebook_set_show_border (GTK_NOTEBOOK (widget), FALSE);
+ gtk_paned_add1 (GTK_PANED (container), widget);
+ priv->notebook = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ widget = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_policy (
+ GTK_SCROLLED_WINDOW (widget),
+ GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+ gtk_scrolled_window_set_shadow_type (
+ GTK_SCROLLED_WINDOW (widget), GTK_SHADOW_IN);
+ gtk_paned_add2 (GTK_PANED (container), widget);
+ gtk_widget_show (widget);
+
+ container = widget;
+
+ widget = eab_contact_display_new ();
+ eab_contact_display_set_mode (
+ EAB_CONTACT_DISPLAY (widget),
+ EAB_CONTACT_DISPLAY_RENDER_NORMAL);
+ gtk_container_add (GTK_CONTAINER (container), widget);
+ priv->preview = g_object_ref (widget);
+ gtk_widget_show (widget);
+
+ /* Bind GObject properties to GConf keys. */
+
+ bridge = gconf_bridge_get ();
+
+ object = G_OBJECT (priv->paned);
+ key = "/apps/evolution/addressbook/display/vpane_position";
+ gconf_bridge_bind_property_delayed (bridge, key, object, "position");
+}
+
+static void
+book_shell_content_class_init (EBookShellContentClass *class)
+{
+ GObjectClass *object_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (EBookShellContentPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->set_property = book_shell_content_set_property;
+ object_class->get_property = book_shell_content_get_property;
+ object_class->dispose = book_shell_content_dispose;
+ object_class->constructed = book_shell_content_constructed;
+
+ g_object_class_install_property (
+ object_class,
+ PROP_CURRENT_VIEW,
+ g_param_spec_object (
+ "current-view",
+ _("Current View"),
+ _("The currently selected address book view"),
+ E_TYPE_ADDRESSBOOK_VIEW,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_PREVIEW_CONTACT,
+ g_param_spec_object (
+ "preview-contact",
+ _("Previewed Contact"),
+ _("The contact being shown in the preview pane"),
+ E_TYPE_CONTACT,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_PREVIEW_VISIBLE,
+ g_param_spec_boolean (
+ "preview-visible",
+ _("Preview is Visible"),
+ _("Whether the preview pane is visible"),
+ TRUE,
+ G_PARAM_READWRITE));
+}
+
+static void
+book_shell_content_init (EBookShellContent *book_shell_content)
+{
+ book_shell_content->priv =
+ E_BOOK_SHELL_CONTENT_GET_PRIVATE (book_shell_content);
+
+ /* Postpone widget construction until we have a shell view. */
+}
+
+GType
+e_book_shell_content_get_type (void)
+{
+ static GType type = 0;
+
+ if (G_UNLIKELY (type == 0)) {
+ static const GTypeInfo type_info = {
+ sizeof (EBookShellContentClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) book_shell_content_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (EBookShellContent),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) book_shell_content_init,
+ NULL /* value_table */
+ };
+
+ type = g_type_register_static (
+ E_TYPE_SHELL_CONTENT, "EBookShellContent",
+ &type_info, 0);
+ }
+
+ return type;
+}
+
+GtkWidget *
+e_book_shell_content_new (EShellView *shell_view)
+{
+ g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), NULL);
+
+ return g_object_new (
+ E_TYPE_BOOK_SHELL_CONTENT,
+ "shell-view", shell_view, NULL);
+}
+
+void
+e_book_shell_content_insert_view (EBookShellContent *book_shell_content,
+ EAddressbookView *addressbook_view)
+{
+ GtkNotebook *notebook;
+ GtkWidget *child;
+
+ g_return_if_fail (E_IS_BOOK_SHELL_CONTENT (book_shell_content));
+ g_return_if_fail (E_IS_ADDRESSBOOK_VIEW (addressbook_view));
+
+ notebook = GTK_NOTEBOOK (book_shell_content->priv->notebook);
+ child = GTK_WIDGET (addressbook_view);
+ gtk_notebook_append_page (notebook, child, NULL);
+}
+
+void
+e_book_shell_content_remove_view (EBookShellContent *book_shell_content,
+ EAddressbookView *addressbook_view)
+{
+ GtkNotebook *notebook;
+ GtkWidget *child;
+ gint page_num;
+
+ g_return_if_fail (E_IS_BOOK_SHELL_CONTENT (book_shell_content));
+ g_return_if_fail (E_IS_ADDRESSBOOK_VIEW (addressbook_view));
+
+ notebook = GTK_NOTEBOOK (book_shell_content->priv->notebook);
+ child = GTK_WIDGET (addressbook_view);
+ page_num = gtk_notebook_page_num (notebook, child);
+ g_return_if_fail (page_num >= 0);
+
+ gtk_notebook_remove_page (notebook, page_num);
+}
+
+EAddressbookView *
+e_book_shell_content_get_current_view (EBookShellContent *book_shell_content)
+{
+ GtkNotebook *notebook;
+ GtkWidget *widget;
+ gint page_num;
+
+ g_return_val_if_fail (
+ E_IS_BOOK_SHELL_CONTENT (book_shell_content), NULL);
+
+ notebook = GTK_NOTEBOOK (book_shell_content->priv->notebook);
+ page_num = gtk_notebook_get_current_page (notebook);
+ widget = gtk_notebook_get_nth_page (notebook, page_num);
+ g_return_val_if_fail (widget != NULL, NULL);
+
+ return E_ADDRESSBOOK_VIEW (widget);
+}
+
+void
+e_book_shell_content_set_current_view (EBookShellContent *book_shell_content,
+ EAddressbookView *addressbook_view)
+{
+ GtkNotebook *notebook;
+ GtkWidget *child;
+ gint page_num;
+
+ g_return_if_fail (E_IS_BOOK_SHELL_CONTENT (book_shell_content));
+ g_return_if_fail (E_IS_ADDRESSBOOK_VIEW (addressbook_view));
+
+ notebook = GTK_NOTEBOOK (book_shell_content->priv->notebook);
+ child = GTK_WIDGET (addressbook_view);
+ page_num = gtk_notebook_page_num (notebook, child);
+ g_return_if_fail (page_num >= 0);
+
+ gtk_notebook_set_current_page (notebook, page_num);
+ g_object_notify (G_OBJECT (book_shell_content), "current-view");
+}
+
+EContact *
+e_book_shell_content_get_preview_contact (EBookShellContent *book_shell_content)
+{
+ EABContactDisplay *display;
+
+ g_return_val_if_fail (
+ E_IS_BOOK_SHELL_CONTENT (book_shell_content), NULL);
+
+ display = EAB_CONTACT_DISPLAY (book_shell_content->priv->preview);
+
+ return eab_contact_display_get_contact (display);
+}
+
+void
+e_book_shell_content_set_preview_contact (EBookShellContent *book_shell_content,
+ EContact *preview_contact)
+{
+ EABContactDisplay *display;
+
+ g_return_if_fail (E_IS_BOOK_SHELL_CONTENT (book_shell_content));
+
+ display = EAB_CONTACT_DISPLAY (book_shell_content->priv->preview);
+
+ eab_contact_display_set_contact (display, preview_contact);
+ g_object_notify (G_OBJECT (book_shell_content), "preview-contact");
+}
+
+gboolean
+e_book_shell_content_get_preview_visible (EBookShellContent *book_shell_content)
+{
+ GtkPaned *paned;
+ GtkWidget *child;
+
+ g_return_val_if_fail (
+ E_IS_BOOK_SHELL_CONTENT (book_shell_content), FALSE);
+
+ paned = GTK_PANED (book_shell_content->priv->paned);
+ child = gtk_paned_get_child2 (paned);
+
+ return GTK_WIDGET_VISIBLE (child);
+}
+
+void
+e_book_shell_content_set_preview_visible (EBookShellContent *book_shell_content,
+ gboolean preview_visible)
+{
+ GtkPaned *paned;
+ GtkWidget *child;
+
+ g_return_if_fail (E_IS_BOOK_SHELL_CONTENT (book_shell_content));
+
+ paned = GTK_PANED (book_shell_content->priv->paned);
+ child = gtk_paned_get_child2 (paned);
+
+ if (preview_visible)
+ gtk_widget_show (child);
+ else
+ gtk_widget_hide (child);
+
+ g_object_notify (G_OBJECT (book_shell_content), "preview-visible");
+}
+
+void
+e_book_shell_content_clipboard_copy (EBookShellContent *book_shell_content)
+{
+ EAddressbookView *addressbook_view;
+ GtkHTML *html;
+ gchar *selection;
+
+ g_return_if_fail (E_IS_BOOK_SHELL_CONTENT (book_shell_content));
+
+ html = GTK_HTML (book_shell_content->priv->preview);
+ addressbook_view =
+ e_book_shell_content_get_current_view (book_shell_content);
+ g_return_if_fail (addressbook_view != NULL);
+
+ if (!GTK_WIDGET_HAS_FOCUS (html)) {
+ e_addressbook_view_copy (addressbook_view);
+ return;
+ }
+
+ selection = gtk_html_get_selection_html (html, NULL);
+ if (selection != NULL)
+ gtk_html_copy (html);
+ g_free (selection);
+}
diff --git a/addressbook/gui/component/e-book-shell-content.h b/addressbook/gui/component/e-book-shell-content.h
new file mode 100644
index 0000000000..01911e79b6
--- /dev/null
+++ b/addressbook/gui/component/e-book-shell-content.h
@@ -0,0 +1,92 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* e-book-shell-content.h
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef E_BOOK_SHELL_CONTENT_H
+#define E_BOOK_SHELL_CONTENT_H
+
+#include <libebook/e-contact.h>
+
+#include <e-shell-content.h>
+#include <e-shell-view.h>
+
+#include <e-addressbook-view.h>
+
+/* Standard GObject macros */
+#define E_TYPE_BOOK_SHELL_CONTENT \
+ (e_book_shell_content_get_type ())
+#define E_BOOK_SHELL_CONTENT(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_BOOK_SHELL_CONTENT, EBookShellContent))
+#define E_BOOK_SHELL_CONTENT_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_BOOK_SHELL_CONTENT, EBookShellContentClass))
+#define E_IS_BOOK_SHELL_CONTENT(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_BOOK_SHELL_CONTENT))
+#define E_IS_BOOK_SHELL_CONTENT_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_BOOK_SHELL_CONTENT))
+#define E_BOOK_SHELL_CONTENT_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_BOOK_SHELL_CONTENT, EBookShellContentClass))
+
+G_BEGIN_DECLS
+
+typedef struct _EBookShellContent EBookShellContent;
+typedef struct _EBookShellContentClass EBookShellContentClass;
+typedef struct _EBookShellContentPrivate EBookShellContentPrivate;
+
+struct _EBookShellContent {
+ EShellContent parent;
+ EBookShellContentPrivate *priv;
+};
+
+struct _EBookShellContentClass {
+ EShellContentClass parent_class;
+};
+
+GType e_book_shell_content_get_type (void);
+GtkWidget * e_book_shell_content_new (EShellView *shell_view);
+void e_book_shell_content_insert_view(EBookShellContent *book_shell_content,
+ EAddressbookView *addressbook_view);
+void e_book_shell_content_remove_view(EBookShellContent *book_shell_content,
+ EAddressbookView *addressbook_view);
+EAddressbookView *
+ e_book_shell_content_get_current_view
+ (EBookShellContent *book_shell_content);
+void e_book_shell_content_set_current_view
+ (EBookShellContent *book_shell_content,
+ EAddressbookView *addressbook_view);
+EContact * e_book_shell_content_get_preview_contact
+ (EBookShellContent *book_shell_content);
+void e_book_shell_content_set_preview_contact
+ (EBookShellContent *book_shell_content,
+ EContact *preview_contact);
+gboolean e_book_shell_content_get_preview_visible
+ (EBookShellContent *book_shell_content);
+void e_book_shell_content_set_preview_visible
+ (EBookShellContent *book_shell_content,
+ gboolean preview_visible);
+void e_book_shell_content_clipboard_copy
+ (EBookShellContent *book_shell_content);
+
+G_END_DECLS
+
+#endif /* E_BOOK_SHELL_CONTENT_H */
diff --git a/addressbook/gui/component/e-book-shell-sidebar.c b/addressbook/gui/component/e-book-shell-sidebar.c
index d801fa1325..a38396beed 100644
--- a/addressbook/gui/component/e-book-shell-sidebar.c
+++ b/addressbook/gui/component/e-book-shell-sidebar.c
@@ -86,6 +86,9 @@ book_shell_sidebar_constructed (GObject *object)
priv = E_BOOK_SHELL_SIDEBAR_GET_PRIVATE (object);
+ /* Chain up to parent's constructed() method. */
+ G_OBJECT_CLASS (parent_class)->constructed (object);
+
shell_sidebar = E_SHELL_SIDEBAR (object);
shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
book_shell_view = E_BOOK_SHELL_VIEW (shell_view);
diff --git a/addressbook/gui/component/e-book-shell-view-actions.c b/addressbook/gui/component/e-book-shell-view-actions.c
index e27474aac0..5dd1484c7a 100644
--- a/addressbook/gui/component/e-book-shell-view-actions.c
+++ b/addressbook/gui/component/e-book-shell-view-actions.c
@@ -30,10 +30,13 @@ static void
action_address_book_copy_cb (GtkAction *action,
EBookShellView *book_shell_view)
{
+ EBookShellContent *book_shell_content;
EAddressbookView *view;
- view = e_book_shell_view_get_current_view (book_shell_view);
+ book_shell_content = book_shell_view->priv->book_shell_content;
+ view = e_book_shell_content_get_current_view (book_shell_content);
g_return_if_fail (view != NULL);
+
e_addressbook_view_copy_to_folder (view, TRUE);
}
@@ -55,7 +58,7 @@ action_address_book_delete_cb (GtkAction *action,
shell_view = E_SHELL_VIEW (book_shell_view);
shell_window = e_shell_view_get_shell_window (shell_view);
- book_shell_sidebar = e_shell_view_get_shell_sidebar (shell_view);
+ 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);
g_return_if_fail (source != NULL);
@@ -99,10 +102,13 @@ static void
action_address_book_move_cb (GtkAction *action,
EBookShellView *book_shell_view)
{
+ EBookShellContent *book_shell_content;
EAddressbookView *view;
- view = e_book_shell_view_get_current_view (book_shell_view);
+ book_shell_content = book_shell_view->priv->book_shell_content;
+ view = e_book_shell_content_get_current_view (book_shell_content);
g_return_if_fail (view != NULL);
+
e_addressbook_view_move_to_folder (view, TRUE);
}
@@ -135,7 +141,7 @@ action_address_book_properties_cb (GtkAction *action,
shell_view = E_SHELL_VIEW (book_shell_view);
shell_window = e_shell_view_get_shell_window (shell_view);
- book_shell_sidebar = e_shell_view_get_shell_sidebar (shell_view);
+ 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);
g_return_if_fail (source != NULL);
@@ -169,10 +175,13 @@ static void
action_address_book_save_as_cb (GtkAction *action,
EBookShellView *book_shell_view)
{
+ EBookShellContent *book_shell_content;
EAddressbookView *view;
- view = e_book_shell_view_get_current_view (book_shell_view);
+ book_shell_content = book_shell_view->priv->book_shell_content;
+ view = e_book_shell_content_get_current_view (book_shell_content);
g_return_if_fail (view != NULL);
+
e_addressbook_view_save_as (view, TRUE);
}
@@ -180,10 +189,13 @@ static void
action_address_book_stop_cb (GtkAction *action,
EBookShellView *book_shell_view)
{
+ EBookShellContent *book_shell_content;
EAddressbookView *view;
- view = e_book_shell_view_get_current_view (book_shell_view);
+ book_shell_content = book_shell_view->priv->book_shell_content;
+ view = e_book_shell_content_get_current_view (book_shell_content);
g_return_if_fail (view != NULL);
+
e_addressbook_view_stop (view);
}
@@ -191,33 +203,23 @@ static void
action_contact_clipboard_copy_cb (GtkAction *action,
EBookShellView *book_shell_view)
{
- EAddressbookView *view;
- GtkWidget *preview;
- gchar *selection;
-
- preview = book_shell_view->priv->preview;
- view = e_book_shell_view_get_current_view (book_shell_view);
- g_return_if_fail (view != NULL);
-
- if (!GTK_WIDGET_HAS_FOCUS (preview)) {
- e_addressbook_view_copy (view);
- return;
- }
+ EBookShellContent *book_shell_content;
- selection = gtk_html_get_selection_html (GTK_HTML (preview), NULL);
- if (selection != NULL)
- gtk_html_copy (GTK_HTML (preview));
- g_free (selection);
+ book_shell_content = book_shell_view->priv->book_shell_content;
+ e_book_shell_content_clipboard_copy (book_shell_content);
}
static void
action_contact_clipboard_cut_cb (GtkAction *action,
EBookShellView *book_shell_view)
{
+ EBookShellContent *book_shell_content;
EAddressbookView *view;
- view = e_book_shell_view_get_current_view (book_shell_view);
+ book_shell_content = book_shell_view->priv->book_shell_content;
+ view = e_book_shell_content_get_current_view (book_shell_content);
g_return_if_fail (view != NULL);
+
e_addressbook_view_cut (view);
}
@@ -225,10 +227,13 @@ static void
action_contact_clipboard_paste_cb (GtkAction *action,
EBookShellView *book_shell_view)
{
+ EBookShellContent *book_shell_content;
EAddressbookView *view;
- view = e_book_shell_view_get_current_view (book_shell_view);
+ book_shell_content = book_shell_view->priv->book_shell_content;
+ view = e_book_shell_content_get_current_view (book_shell_content);
g_return_if_fail (view != NULL);
+
e_addressbook_view_paste (view);
}
@@ -236,10 +241,13 @@ static void
action_contact_copy_cb (GtkAction *action,
EBookShellView *book_shell_view)
{
+ EBookShellContent *book_shell_content;
EAddressbookView *view;
- view = e_book_shell_view_get_current_view (book_shell_view);
+ book_shell_content = book_shell_view->priv->book_shell_content;
+ view = e_book_shell_content_get_current_view (book_shell_content);
g_return_if_fail (view != NULL);
+
e_addressbook_view_copy_to_folder (view, FALSE);
}
@@ -247,10 +255,13 @@ static void
action_contact_delete_cb (GtkAction *action,
EBookShellView *book_shell_view)
{
+ EBookShellContent *book_shell_content;
EAddressbookView *view;
- view = e_book_shell_view_get_current_view (book_shell_view);
+ book_shell_content = book_shell_view->priv->book_shell_content;
+ view = e_book_shell_content_get_current_view (book_shell_content);
g_return_if_fail (view != NULL);
+
e_addressbook_view_delete_selection (view, TRUE);
}
@@ -258,10 +269,13 @@ static void
action_contact_forward_cb (GtkAction *action,
EBookShellView *book_shell_view)
{
+ EBookShellContent *book_shell_content;
EAddressbookView *view;
- view = e_book_shell_view_get_current_view (book_shell_view);
+ book_shell_content = book_shell_view->priv->book_shell_content;
+ view = e_book_shell_content_get_current_view (book_shell_content);
g_return_if_fail (view != NULL);
+
e_addressbook_view_send (view);
}
@@ -269,10 +283,13 @@ static void
action_contact_move_cb (GtkAction *action,
EBookShellView *book_shell_view)
{
+ EBookShellContent *book_shell_content;
EAddressbookView *view;
- view = e_book_shell_view_get_current_view (book_shell_view);
+ book_shell_content = book_shell_view->priv->book_shell_content;
+ view = e_book_shell_content_get_current_view (book_shell_content);
g_return_if_fail (view != NULL);
+
e_addressbook_view_move_to_folder (view, FALSE);
}
@@ -280,12 +297,14 @@ static void
action_contact_new_cb (GtkAction *action,
EBookShellView *book_shell_view)
{
+ EBookShellContent *book_shell_content;
EAddressbookView *view;
EAddressbookModel *model;
EContact *contact;
EBook *book;
- view = e_book_shell_view_get_current_view (book_shell_view);
+ book_shell_content = book_shell_view->priv->book_shell_content;
+ view = e_book_shell_content_get_current_view (book_shell_content);
g_return_if_fail (view != NULL);
model = e_addressbook_view_get_model (view);
@@ -301,12 +320,14 @@ static void
action_contact_new_list_cb (GtkAction *action,
EBookShellView *book_shell_view)
{
+ EBookShellContent *book_shell_content;
EAddressbookView *view;
EAddressbookModel *model;
EContact *contact;
EBook *book;
- view = e_book_shell_view_get_current_view (book_shell_view);
+ book_shell_content = book_shell_view->priv->book_shell_content;
+ view = e_book_shell_content_get_current_view (book_shell_content);
g_return_if_fail (view != NULL);
model = e_addressbook_view_get_model (view);
@@ -322,10 +343,13 @@ static void
action_contact_open_cb (GtkAction *action,
EBookShellView *book_shell_view)
{
+ EBookShellContent *book_shell_content;
EAddressbookView *view;
- view = e_book_shell_view_get_current_view (book_shell_view);
+ book_shell_content = book_shell_view->priv->book_shell_content;
+ view = e_book_shell_content_get_current_view (book_shell_content);
g_return_if_fail (view != NULL);
+
e_addressbook_view_view (view);
}
@@ -333,25 +357,26 @@ static void
action_contact_preview_cb (GtkToggleAction *action,
EBookShellView *book_shell_view)
{
- GtkWidget *child;
- GtkWidget *paned;
+ EBookShellContent *book_shell_content;
gboolean visible;
- paned = book_shell_view->priv->paned;
- child = gtk_paned_get_child2 (GTK_PANED (paned));
+ book_shell_content = book_shell_view->priv->book_shell_content;
visible = gtk_toggle_action_get_active (action);
- g_object_set (child, "visible", visible, NULL);
+ e_book_shell_content_set_preview_visible (book_shell_content, visible);
}
static void
action_contact_print_cb (GtkAction *action,
EBookShellView *book_shell_view)
{
+ EBookShellContent *book_shell_content;
EAddressbookView *view;
GtkPrintOperationAction print_action;
- view = e_book_shell_view_get_current_view (book_shell_view);
+ book_shell_content = book_shell_view->priv->book_shell_content;
+ view = e_book_shell_content_get_current_view (book_shell_content);
g_return_if_fail (view != NULL);
+
print_action = GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG;
e_addressbook_view_print (view, print_action);
}
@@ -360,11 +385,14 @@ static void
action_contact_print_preview_cb (GtkAction *action,
EBookShellView *book_shell_view)
{
+ EBookShellContent *book_shell_content;
EAddressbookView *view;
GtkPrintOperationAction print_action;
- view = e_book_shell_view_get_current_view (book_shell_view);
+ book_shell_content = book_shell_view->priv->book_shell_content;
+ view = e_book_shell_content_get_current_view (book_shell_content);
g_return_if_fail (view != NULL);
+
print_action = GTK_PRINT_OPERATION_ACTION_PREVIEW;
e_addressbook_view_print (view, print_action);
}
@@ -373,10 +401,13 @@ static void
action_contact_save_as_cb (GtkAction *action,
EBookShellView *book_shell_view)
{
+ EBookShellContent *book_shell_content;
EAddressbookView *view;
- view = e_book_shell_view_get_current_view (book_shell_view);
+ book_shell_content = book_shell_view->priv->book_shell_content;
+ view = e_book_shell_content_get_current_view (book_shell_content);
g_return_if_fail (view != NULL);
+
e_addressbook_view_save_as (view, FALSE);
}
@@ -384,10 +415,13 @@ static void
action_contact_select_all_cb (GtkAction *action,
EBookShellView *book_shell_view)
{
+ EBookShellContent *book_shell_content;
EAddressbookView *view;
- view = e_book_shell_view_get_current_view (book_shell_view);
+ book_shell_content = book_shell_view->priv->book_shell_content;
+ view = e_book_shell_content_get_current_view (book_shell_content);
g_return_if_fail (view != NULL);
+
e_addressbook_view_select_all (view);
}
@@ -395,10 +429,13 @@ static void
action_contact_send_message_cb (GtkAction *action,
EBookShellView *book_shell_view)
{
+ EBookShellContent *book_shell_content;
EAddressbookView *view;
- view = e_book_shell_view_get_current_view (book_shell_view);
+ book_shell_content = book_shell_view->priv->book_shell_content;
+ view = e_book_shell_content_get_current_view (book_shell_content);
g_return_if_fail (view != NULL);
+
e_addressbook_view_send_to (view);
}
@@ -406,6 +443,7 @@ static void
action_gal_save_custom_view_cb (GtkAction *action,
EBookShellView *book_shell_view)
{
+ EBookShellContent *book_shell_content;
EShellView *shell_view;
EAddressbookView *address_view;
GalViewInstance *view_instance;
@@ -414,7 +452,8 @@ action_gal_save_custom_view_cb (GtkAction *action,
if (!e_shell_view_is_active (shell_view))
return;
- address_view = e_book_shell_view_get_current_view (book_shell_view);
+ book_shell_content = book_shell_view->priv->book_shell_content;
+ address_view = e_book_shell_content_get_current_view (book_shell_content);
view_instance = e_addressbook_view_get_view_instance (address_view);
gal_view_instance_save_as (view_instance);
}
@@ -423,13 +462,13 @@ static void
action_search_execute_cb (GtkAction *action,
EBookShellView *book_shell_view)
{
+ EBookShellContent *book_shell_content;
EShellView *shell_view;
EShellWindow *shell_window;
EShellContent *shell_content;
GString *string;
EAddressbookView *view;
EAddressbookModel *model;
- EABContactDisplay *display;
FilterRule *rule;
const gchar *format;
const gchar *text;
@@ -503,13 +542,13 @@ action_search_execute_cb (GtkAction *action,
g_object_unref (rule);
/* Submit the query. */
- view = e_book_shell_view_get_current_view (book_shell_view);
+ book_shell_content = book_shell_view->priv->book_shell_content;
+ view = e_book_shell_content_get_current_view (book_shell_content);
model = e_addressbook_view_get_model (view);
e_addressbook_model_set_query (model, query);
g_free (query);
- display = EAB_CONTACT_DISPLAY (book_shell_view->priv->preview);
- eab_contact_display_set_contact (display, NULL);
+ e_book_shell_content_set_preview_contact (book_shell_content, NULL);
}
static GtkActionEntry contact_entries[] = {
@@ -806,6 +845,7 @@ e_book_shell_view_actions_update (EBookShellView *book_shell_view)
EShellWindow *shell_window;
EAddressbookModel *model;
EAddressbookView *view;
+ EBookShellContent *book_shell_content;
EBookShellSidebar *book_shell_sidebar;
ESelectionModel *selection_model;
ESourceSelector *selector;
@@ -819,9 +859,11 @@ e_book_shell_view_actions_update (EBookShellView *book_shell_view)
shell_view = E_SHELL_VIEW (book_shell_view);
shell_window = e_shell_view_get_shell_window (shell_view);
- view = e_book_shell_view_get_current_view (book_shell_view);
- book_shell_sidebar = e_shell_view_get_shell_sidebar (shell_view);
+ book_shell_content = book_shell_view->priv->book_shell_content;
+ view = e_book_shell_content_get_current_view (book_shell_content);
+
+ 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);
diff --git a/addressbook/gui/component/e-book-shell-view-private.c b/addressbook/gui/component/e-book-shell-view-private.c
index 4dd88e7758..2cd5378c79 100644
--- a/addressbook/gui/component/e-book-shell-view-private.c
+++ b/addressbook/gui/component/e-book-shell-view-private.c
@@ -45,40 +45,40 @@ static void
book_shell_view_selection_change_foreach (gint row,
EBookShellView *book_shell_view)
{
+ EBookShellContent *book_shell_content;
EAddressbookView *view;
EAddressbookModel *model;
- EABContactDisplay *display;
EContact *contact;
/* XXX A "foreach" function is kind of a silly way to retrieve
* the one and only selected contact, but this is the only
* means that ESelectionModel provides. */
- view = e_book_shell_view_get_current_view (book_shell_view);
+ book_shell_content = book_shell_view->priv->book_shell_content;
+ view = e_book_shell_content_get_current_view (book_shell_content);
model = e_addressbook_view_get_model (view);
contact = e_addressbook_model_get_contact (model, row);
- display = EAB_CONTACT_DISPLAY (book_shell_view->priv->preview);
- eab_contact_display_set_contact (display, contact);
+ e_book_shell_content_set_preview_contact (book_shell_content, contact);
}
static void
selection_change (EBookShellView *book_shell_view,
EAddressbookView *view)
{
+ EBookShellContent *book_shell_content;
EAddressbookView *current_view;
ESelectionModel *selection_model;
- EABContactDisplay *display;
gint n_selected;
- current_view = e_book_shell_view_get_current_view (book_shell_view);
+ book_shell_content = book_shell_view->priv->book_shell_content;
+ current_view = e_book_shell_content_get_current_view (book_shell_content);
if (view != current_view)
return;
e_book_shell_view_actions_update (book_shell_view);
- display = EAB_CONTACT_DISPLAY (book_shell_view->priv->preview);
selection_model = e_addressbook_view_get_selection_model (view);
n_selected = (selection_model != NULL) ?
@@ -90,24 +90,27 @@ selection_change (EBookShellView *book_shell_view,
book_shell_view_selection_change_foreach,
book_shell_view);
else
- eab_contact_display_set_contact (display, NULL);
+ e_book_shell_content_set_preview_contact (
+ book_shell_content, NULL);
}
static void
contact_changed (EBookShellView *book_shell_view,
EContact *contact)
{
- EABContactDisplay *display;
- EContact *displayed_contact;
+ EBookShellContent *book_shell_content;
+ EContact *preview_contact;
- display = EAB_CONTACT_DISPLAY (book_shell_view->priv->preview);
- displayed_contact = eab_contact_display_get_contact (display);
+ book_shell_content = book_shell_view->priv->book_shell_content;
- if (contact != displayed_contact)
+ preview_contact =
+ e_book_shell_content_get_preview_contact (book_shell_content);
+
+ if (contact != preview_contact)
return;
/* Re-render the same contact. */
- eab_contact_display_set_contact (display, contact);
+ e_book_shell_content_set_preview_contact (book_shell_content, contact);
}
static void
@@ -115,21 +118,23 @@ contacts_removed (EBookShellView *book_shell_view,
GArray *removed_indices,
EAddressbookModel *model)
{
- EABContactDisplay *display;
- EContact *displayed_contact;
+ EBookShellContent *book_shell_content;
+ EContact *preview_contact;
+
+ book_shell_content = book_shell_view->priv->book_shell_content;
- display = EAB_CONTACT_DISPLAY (book_shell_view->priv->preview);
- displayed_contact = eab_contact_display_get_contact (display);
+ preview_contact =
+ e_book_shell_content_get_preview_contact (book_shell_content);
- if (displayed_contact == NULL)
+ if (preview_contact == NULL)
return;
/* Is the displayed contact still in the model? */
- if (e_addressbook_model_find (model, displayed_contact) < 0)
+ if (e_addressbook_model_find (model, preview_contact) < 0)
return;
/* If not, clear the contact display. */
- eab_contact_display_set_contact (display, NULL);
+ e_book_shell_content_set_preview_contact (book_shell_content, NULL);
}
static void
@@ -156,19 +161,18 @@ book_shell_view_activate_selected_source (EBookShellView *book_shell_view,
ESourceSelector *selector)
{
EShellView *shell_view;
+ EBookShellContent *book_shell_content;
EAddressbookView *view;
EAddressbookModel *model;
ESource *source;
GalViewInstance *view_instance;
GHashTable *hash_table;
- GtkNotebook *notebook;
GtkWidget *widget;
const gchar *uid;
gchar *view_id;
- gint page_num;
shell_view = E_SHELL_VIEW (book_shell_view);
- notebook = GTK_NOTEBOOK (book_shell_view->priv->notebook);
+ book_shell_content = book_shell_view->priv->book_shell_content;
source = e_source_selector_peek_primary_selection (selector);
if (source == NULL)
@@ -202,9 +206,13 @@ book_shell_view_activate_selected_source (EBookShellView *book_shell_view,
widget = e_addressbook_view_new (shell_view, source);
gtk_widget_show (widget);
- g_object_ref_sink (widget);
- gtk_notebook_append_page (notebook, widget, NULL);
- g_hash_table_insert (hash_table, g_strdup (uid), widget);
+ e_book_shell_content_insert_view (
+ book_shell_content,
+ E_ADDRESSBOOK_VIEW (widget));
+
+ g_hash_table_insert (
+ hash_table, g_strdup (uid),
+ g_object_ref (widget));
g_signal_connect_swapped (
widget, "popup-event",
@@ -236,8 +244,8 @@ book_shell_view_activate_selected_source (EBookShellView *book_shell_view,
G_CALLBACK (contacts_removed), book_shell_view);
}
- page_num = gtk_notebook_page_num (notebook, widget);
- gtk_notebook_set_current_page (notebook, page_num);
+ e_book_shell_content_set_current_view (
+ book_shell_content, E_ADDRESSBOOK_VIEW (widget));
view_instance = e_addressbook_view_get_view_instance (view);
view_id = gal_view_instance_get_current_view_id (view_instance);
@@ -333,11 +341,13 @@ book_shell_view_load_view_collection (EShellViewClass *shell_view_class)
static void
book_shell_view_notify_view_id_cb (EBookShellView *book_shell_view)
{
+ EBookShellContent *book_shell_content;
EAddressbookView *address_view;
GalViewInstance *view_instance;
const gchar *view_id;
- address_view = e_book_shell_view_get_current_view (book_shell_view);
+ book_shell_content = book_shell_view->priv->book_shell_content;
+ address_view = e_book_shell_content_get_current_view (book_shell_content);
view_instance = e_addressbook_view_get_view_instance (address_view);
view_id = e_shell_view_get_view_id (E_SHELL_VIEW (book_shell_view));
@@ -399,54 +409,16 @@ e_book_shell_view_private_constructed (EBookShellView *book_shell_view)
EShellView *shell_view;
EShellWindow *shell_window;
ESourceSelector *selector;
- GConfBridge *bridge;
- GtkWidget *container;
- GtkWidget *widget;
- GObject *object;
- const gchar *key;
shell_view = E_SHELL_VIEW (book_shell_view);
+ shell_content = e_shell_view_get_shell_content (shell_view);
+ shell_sidebar = e_shell_view_get_shell_sidebar (shell_view);
shell_window = e_shell_view_get_shell_window (shell_view);
- /* Construct view widgets. */
+ /* Cache these to avoid lots of awkward casting. */
+ priv->book_shell_content = g_object_ref (shell_content);
+ priv->book_shell_sidebar = g_object_ref (shell_sidebar);
- shell_content = e_shell_view_get_shell_content (shell_view);
- container = GTK_WIDGET (shell_content);
-
- widget = gtk_vpaned_new ();
- gtk_container_add (GTK_CONTAINER (container), widget);
- priv->paned = g_object_ref (widget);
- gtk_widget_show (widget);
-
- container = widget;
-
- widget = gtk_notebook_new ();
- gtk_notebook_set_show_tabs (GTK_NOTEBOOK (widget), FALSE);
- gtk_notebook_set_show_border (GTK_NOTEBOOK (widget), FALSE);
- gtk_paned_add1 (GTK_PANED (container), widget);
- priv->notebook = g_object_ref (widget);
- gtk_widget_show (widget);
-
- widget = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (
- GTK_SCROLLED_WINDOW (widget),
- GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
- gtk_scrolled_window_set_shadow_type (
- GTK_SCROLLED_WINDOW (widget), GTK_SHADOW_IN);
- gtk_paned_add2 (GTK_PANED (container), widget);
- gtk_widget_show (widget);
-
- container = widget;
-
- widget = eab_contact_display_new ();
- eab_contact_display_set_mode (
- EAB_CONTACT_DISPLAY (widget),
- EAB_CONTACT_DISPLAY_RENDER_NORMAL);
- gtk_container_add (GTK_CONTAINER (container), widget);
- priv->preview = g_object_ref (widget);
- gtk_widget_show (widget);
-
- shell_sidebar = e_shell_view_get_shell_sidebar (shell_view);
selector = e_book_shell_sidebar_get_selector (
E_BOOK_SHELL_SIDEBAR (shell_sidebar));
@@ -477,14 +449,6 @@ e_book_shell_view_private_constructed (EBookShellView *book_shell_view)
e_book_shell_view_actions_init (book_shell_view);
e_book_shell_view_update_search_filter (book_shell_view);
book_shell_view_activate_selected_source (book_shell_view, selector);
-
- /* Bind GObject properties to GConf keys. */
-
- bridge = gconf_bridge_get ();
-
- object = G_OBJECT (book_shell_view->priv->paned);
- key = "/apps/evolution/addressbook/display/vpane_position";
- gconf_bridge_bind_property_delayed (bridge, key, object, "position");
}
void
@@ -497,9 +461,8 @@ e_book_shell_view_private_dispose (EBookShellView *book_shell_view)
DISPOSE (priv->contact_actions);
DISPOSE (priv->filter_actions);
- DISPOSE (priv->paned);
- DISPOSE (priv->notebook);
- DISPOSE (priv->preview);
+ DISPOSE (priv->book_shell_content);
+ DISPOSE (priv->book_shell_sidebar);
g_hash_table_remove_all (priv->uid_to_view);
g_hash_table_remove_all (priv->uid_to_editor);
@@ -514,22 +477,6 @@ e_book_shell_view_private_finalize (EBookShellView *book_shell_view)
g_hash_table_destroy (priv->uid_to_editor);
}
-EAddressbookView *
-e_book_shell_view_get_current_view (EBookShellView *book_shell_view)
-{
- GtkNotebook *notebook;
- GtkWidget *widget;
- gint page_num;
-
- g_return_val_if_fail (E_IS_BOOK_SHELL_VIEW (book_shell_view), NULL);
-
- notebook = GTK_NOTEBOOK (book_shell_view->priv->notebook);
- page_num = gtk_notebook_get_current_page (notebook);
- widget = gtk_notebook_get_nth_page (notebook, page_num);
-
- return E_ADDRESSBOOK_VIEW (widget);
-}
-
void
e_book_shell_view_editor_weak_notify (EditorUidClosure *closure,
GObject *where_the_object_was)
diff --git a/addressbook/gui/component/e-book-shell-view-private.h b/addressbook/gui/component/e-book-shell-view-private.h
index f4a9d25b91..00a9249c2d 100644
--- a/addressbook/gui/component/e-book-shell-view-private.h
+++ b/addressbook/gui/component/e-book-shell-view-private.h
@@ -37,6 +37,7 @@
#include <eab-gui-util.h>
#include <e-addressbook-view.h>
+#include <e-book-shell-content.h>
#include <e-book-shell-sidebar.h>
#include <e-book-shell-view-actions.h>
@@ -90,9 +91,9 @@ struct _EBookShellViewPrivate {
/*** Other Stuff ***/
- GtkWidget *paned;
- GtkWidget *notebook;
- GtkWidget *preview;
+ /* These are just for convenience. */
+ EBookShellContent *book_shell_content;
+ EBookShellSidebar *book_shell_sidebar;
GHashTable *uid_to_view;
GHashTable *uid_to_editor;
@@ -114,9 +115,6 @@ void e_book_shell_view_actions_init
(EBookShellView *book_shell_view);
void e_book_shell_view_actions_update
(EBookShellView *book_shell_view);
-EAddressbookView *
- e_book_shell_view_get_current_view
- (EBookShellView *book_shell_view);
void e_book_shell_view_editor_weak_notify
(EditorUidClosure *closure,
GObject *where_the_object_was);
diff --git a/addressbook/gui/component/e-book-shell-view.c b/addressbook/gui/component/e-book-shell-view.c
index c2b8450b79..d43ef0bd96 100644
--- a/addressbook/gui/component/e-book-shell-view.c
+++ b/addressbook/gui/component/e-book-shell-view.c
@@ -20,8 +20,6 @@
#include "e-book-shell-view-private.h"
-#define SEARCH_OPTIONS_PATH "/contact-search-options"
-
enum {
PROP_0,
PROP_SOURCE_LIST
@@ -35,25 +33,23 @@ book_shell_view_source_list_changed_cb (EBookShellView *book_shell_view,
ESourceList *source_list)
{
EBookShellViewPrivate *priv = book_shell_view->priv;
- GtkNotebook *notebook;
+ EBookShellContent *book_shell_content;
GList *keys, *iter;
- notebook = GTK_NOTEBOOK (priv->notebook);
+ book_shell_content = book_shell_view->priv->book_shell_content;
keys = g_hash_table_get_keys (priv->uid_to_view);
for (iter = keys; iter != NULL; iter = iter->next) {
gchar *uid = iter->data;
- GtkWidget *widget;
- gint page_num;
+ EAddressbookView *view;
/* If the source still exists, move on. */
if (e_source_list_peek_source_by_uid (source_list, uid))
continue;
/* Remove the view for the deleted source. */
- widget = g_hash_table_lookup (priv->uid_to_view, uid);
- page_num = gtk_notebook_page_num (notebook, widget);
- gtk_notebook_remove_page (notebook, page_num);
+ view = g_hash_table_lookup (priv->uid_to_view, uid);
+ e_book_shell_content_remove_view (book_shell_content, view);
g_hash_table_remove (priv->uid_to_view, uid);
}
g_list_free (keys);
@@ -166,10 +162,11 @@ book_shell_view_class_init (EBookShellViewClass *class,
shell_view_class = E_SHELL_VIEW_CLASS (class);
shell_view_class->label = N_("Contacts");
shell_view_class->icon_name = "x-office-address-book";
+ shell_view_class->search_options = "/contact-search-options";
shell_view_class->type_module = type_module;
- shell_view_class->changed = book_shell_view_changed;
- shell_view_class->search_options_path = SEARCH_OPTIONS_PATH;
+ shell_view_class->new_shell_content = e_book_shell_content_new;
shell_view_class->new_shell_sidebar = e_book_shell_sidebar_new;
+ shell_view_class->changed = book_shell_view_changed;
g_object_class_install_property (
object_class,
diff --git a/addressbook/gui/widgets/e-addressbook-view.c b/addressbook/gui/widgets/e-addressbook-view.c
index de10df9a41..a46bddbc99 100644
--- a/addressbook/gui/widgets/e-addressbook-view.c
+++ b/addressbook/gui/widgets/e-addressbook-view.c
@@ -853,8 +853,10 @@ status_message (EAddressbookView *view,
const gchar *status)
{
EActivity *activity;
+ EShellView *shell_view;
activity = view->priv->activity;
+ shell_view = e_addressbook_view_get_shell_view (view);
if (status == NULL || *status == '\0') {
if (activity != NULL) {
@@ -866,6 +868,7 @@ status_message (EAddressbookView *view,
} else if (activity == NULL) {
activity = e_activity_new (status);
view->priv->activity = activity;
+ e_shell_view_add_activity (shell_view, activity);
} else
e_activity_set_primary_text (activity, status);