aboutsummaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2009-08-28 05:32:53 +0800
committerMatthew Barnes <mbarnes@redhat.com>2009-08-28 05:35:22 +0800
commit76229dcb001dc7a72f35e89fbad4835d6529d728 (patch)
treea0cbe569272f0b5cc42c9cc319249b94ca22781d /modules
parent0fda8cb5a28729724c678c4e379c12a79f1e820e (diff)
downloadgsoc2013-evolution-76229dcb001dc7a72f35e89fbad4835d6529d728.tar.gz
gsoc2013-evolution-76229dcb001dc7a72f35e89fbad4835d6529d728.tar.zst
gsoc2013-evolution-76229dcb001dc7a72f35e89fbad4835d6529d728.zip
Add vertical view to Contacts.
Diffstat (limited to 'modules')
-rw-r--r--modules/addressbook/apps_evolution_addressbook.schemas.in38
-rw-r--r--modules/addressbook/e-book-shell-content.c105
-rw-r--r--modules/addressbook/e-book-shell-view-actions.c70
-rw-r--r--modules/addressbook/e-book-shell-view-actions.h4
4 files changed, 186 insertions, 31 deletions
diff --git a/modules/addressbook/apps_evolution_addressbook.schemas.in b/modules/addressbook/apps_evolution_addressbook.schemas.in
index 4a336409df..7ce3902c82 100644
--- a/modules/addressbook/apps_evolution_addressbook.schemas.in
+++ b/modules/addressbook/apps_evolution_addressbook.schemas.in
@@ -56,13 +56,47 @@
<!-- View state -->
<schema>
+ <key>/schemas/apps/evolution/addressbook/display/layout</key>
+ <applyto>/apps/evolution/addressbook/display/layout</applyto>
+ <owner>evolution-addressbook</owner>
+ <type>int</type>
+ <default>0</default>
+ <locale name="C">
+ <short>Contact layout style</short>
+ <long>
+ The layout style determines where to place the preview pane
+ in relation to the contact list. "0" (Classic View) places
+ the preview pane below the contact list. "1" (Vertical View)
+ places the preview pane next to the contact list.
+ </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>
+ <type>int</type>
+ <default>200</default>
+ <locale name="C">
+ <short>Contact preview pane position (horizontal)</short>
+ <long>
+ Position of the contact preview pane when oriented horizontally.
+ </long>
+ </locale>
+ </schema>
+
+ <schema>
<key>/schemas/apps/evolution/addressbook/display/vpane_position</key>
<applyto>/apps/evolution/addressbook/display/vpane_position</applyto>
<owner>evolution-addressbook</owner>
<type>int</type>
+ <default>400</default>
<locale name="C">
- <short>Vertical pane position</short>
- <long>Position of the vertical pane, between the card and list views and the preview pane, in pixels.</long>
+ <short>Contact preview pane position (vertical)</short>
+ <long>
+ Position of the contact preview pane when oriented vertically.
+ </long>
</locale>
</schema>
diff --git a/modules/addressbook/e-book-shell-content.c b/modules/addressbook/e-book-shell-content.c
index cce03b1575..f138da3d00 100644
--- a/modules/addressbook/e-book-shell-content.c
+++ b/modules/addressbook/e-book-shell-content.c
@@ -23,7 +23,9 @@
#include <glib/gi18n.h>
+#include "e-util/e-binding.h"
#include "e-util/gconf-bridge.h"
+#include "widgets/misc/e-paned.h"
#define E_BOOK_SHELL_CONTENT_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE \
@@ -33,17 +35,22 @@ struct _EBookShellContentPrivate {
GtkWidget *paned;
GtkWidget *notebook;
GtkWidget *preview;
+
+ GtkOrientation orientation;
+
+ guint preview_visible : 1;
};
enum {
PROP_0,
PROP_CURRENT_VIEW,
+ PROP_ORIENTATION,
PROP_PREVIEW_CONTACT,
PROP_PREVIEW_VISIBLE
};
static gpointer parent_class;
-static GType book_shell_view_type;
+static GType book_shell_content_type;
static void
book_shell_content_send_message_cb (EBookShellContent *book_shell_content,
@@ -55,6 +62,21 @@ book_shell_content_send_message_cb (EBookShellContent *book_shell_content,
eab_send_as_to (&node);
}
+static GtkOrientation
+book_shell_content_get_orientation (EBookShellContent *book_shell_content)
+{
+ return book_shell_content->priv->orientation;
+}
+
+static void
+book_shell_content_set_orientation (EBookShellContent *book_shell_content,
+ GtkOrientation orientation)
+{
+ book_shell_content->priv->orientation = orientation;
+
+ g_object_notify (G_OBJECT (book_shell_content), "orientation");
+}
+
static void
book_shell_content_set_property (GObject *object,
guint property_id,
@@ -68,6 +90,12 @@ book_shell_content_set_property (GObject *object,
g_value_get_object (value));
return;
+ case PROP_ORIENTATION:
+ book_shell_content_set_orientation (
+ E_BOOK_SHELL_CONTENT (object),
+ g_value_get_enum (value));
+ return;
+
case PROP_PREVIEW_CONTACT:
e_book_shell_content_set_preview_contact (
E_BOOK_SHELL_CONTENT (object),
@@ -93,19 +121,29 @@ book_shell_content_get_property (GObject *object,
switch (property_id) {
case PROP_CURRENT_VIEW:
g_value_set_object (
- value, e_book_shell_content_get_current_view (
+ value,
+ e_book_shell_content_get_current_view (
+ E_BOOK_SHELL_CONTENT (object)));
+ return;
+
+ case PROP_ORIENTATION:
+ g_value_set_enum (
+ value,
+ book_shell_content_get_orientation (
E_BOOK_SHELL_CONTENT (object)));
return;
case PROP_PREVIEW_CONTACT:
g_value_set_object (
- value, e_book_shell_content_get_preview_contact (
+ 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 (
+ value,
+ e_book_shell_content_get_preview_visible (
E_BOOK_SHELL_CONTENT (object)));
return;
}
@@ -155,17 +193,21 @@ book_shell_content_constructed (GObject *object)
container = GTK_WIDGET (object);
- widget = gtk_vpaned_new ();
+ widget = e_paned_new (GTK_ORIENTATION_VERTICAL);
gtk_container_add (GTK_CONTAINER (container), widget);
priv->paned = g_object_ref (widget);
gtk_widget_show (widget);
+ e_binding_new (
+ G_OBJECT (object), "orientation",
+ G_OBJECT (widget), "orientation");
+
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);
+ gtk_paned_pack1 (GTK_PANED (container), widget, TRUE, FALSE);
priv->notebook = g_object_ref (widget);
gtk_widget_show (widget);
@@ -175,9 +217,13 @@ book_shell_content_constructed (GObject *object)
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_paned_pack2 (GTK_PANED (container), widget, FALSE, FALSE);
gtk_widget_show (widget);
+ e_binding_new (
+ G_OBJECT (object), "preview-visible",
+ G_OBJECT (widget), "visible");
+
container = widget;
widget = eab_contact_display_new ();
@@ -197,8 +243,12 @@ book_shell_content_constructed (GObject *object)
bridge = gconf_bridge_get ();
object = G_OBJECT (priv->paned);
+ key = "/apps/evolution/addressbook/display/hpane_position";
+ gconf_bridge_bind_property_delayed (bridge, key, object, "hposition");
+
+ object = G_OBJECT (priv->paned);
key = "/apps/evolution/addressbook/display/vpane_position";
- gconf_bridge_bind_property_delayed (bridge, key, object, "position");
+ gconf_bridge_bind_property_delayed (bridge, key, object, "vposition");
}
static guint32
@@ -283,7 +333,11 @@ book_shell_content_class_init (EBookShellContentClass *class)
_("Preview is Visible"),
_("Whether the preview pane is visible"),
TRUE,
- G_PARAM_READWRITE));
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
+
+ g_object_class_override_property (
+ object_class, PROP_ORIENTATION, "orientation");
}
static void
@@ -298,7 +352,7 @@ book_shell_content_init (EBookShellContent *book_shell_content)
GType
e_book_shell_content_get_type (void)
{
- return book_shell_view_type;
+ return book_shell_content_type;
}
void
@@ -317,9 +371,19 @@ e_book_shell_content_register_type (GTypeModule *type_module)
NULL /* value_table */
};
- book_shell_view_type = g_type_module_register_type (
+ static const GInterfaceInfo orientable_info = {
+ (GInterfaceInitFunc) NULL,
+ (GInterfaceFinalizeFunc) NULL,
+ NULL /* interface_data */
+ };
+
+ book_shell_content_type = g_type_module_register_type (
type_module, E_TYPE_SHELL_CONTENT,
"EBookShellContent", &type_info, 0);
+
+ g_type_module_add_interface (
+ type_module, book_shell_content_type,
+ GTK_TYPE_ORIENTABLE, &orientable_info);
}
GtkWidget *
@@ -434,34 +498,19 @@ e_book_shell_content_set_preview_contact (EBookShellContent *book_shell_content,
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);
+ return book_shell_content->priv->preview_visible;
}
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);
+ book_shell_content->priv->preview_visible = preview_visible;
g_object_notify (G_OBJECT (book_shell_content), "preview-visible");
}
diff --git a/modules/addressbook/e-book-shell-view-actions.c b/modules/addressbook/e-book-shell-view-actions.c
index 4515207ed4..c2195e52de 100644
--- a/modules/addressbook/e-book-shell-view-actions.c
+++ b/modules/addressbook/e-book-shell-view-actions.c
@@ -534,6 +534,32 @@ action_contact_send_message_cb (GtkAction *action,
}
static void
+action_contact_view_cb (GtkRadioAction *action,
+ GtkRadioAction *current,
+ EBookShellView *book_shell_view)
+{
+ EBookShellContent *book_shell_content;
+ GtkOrientable *orientable;
+ GtkOrientation orientation;
+
+ book_shell_content = book_shell_view->priv->book_shell_content;
+ orientable = GTK_ORIENTABLE (book_shell_content);
+
+ switch (gtk_radio_action_get_current_value (action)) {
+ case 0:
+ orientation = GTK_ORIENTATION_VERTICAL;
+ break;
+ case 1:
+ orientation = GTK_ORIENTATION_HORIZONTAL;
+ break;
+ default:
+ g_return_if_reached ();
+ }
+
+ gtk_orientable_set_orientation (orientable, orientation);
+}
+
+static void
action_gal_save_custom_view_cb (GtkAction *action,
EBookShellView *book_shell_view)
{
@@ -736,11 +762,18 @@ static GtkActionEntry contact_entries[] = {
/*** Menus ***/
- { "actions-menu",
+ { "contact-actions-menu",
NULL,
N_("_Actions"),
NULL,
NULL,
+ NULL },
+
+ { "contact-preview-menu",
+ NULL,
+ N_("_Preview"),
+ NULL,
+ NULL,
NULL }
};
@@ -814,6 +847,33 @@ static GtkToggleActionEntry contact_toggle_entries[] = {
TRUE }
};
+static GtkRadioActionEntry contact_view_entries[] = {
+
+ /* This action represents the initial active contact view.
+ * It should not be visible in the UI, nor should it be
+ * possible to switch to it from another shell view. */
+ { "contact-view-initial",
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ -1 },
+
+ { "contact-view-classic",
+ NULL,
+ N_("_Classic View"),
+ NULL,
+ N_("Show contact preview below the contact list"),
+ 0 },
+
+ { "contact-view-vertical",
+ NULL,
+ N_("_Vertical View"),
+ NULL,
+ N_("Show contact preview alongside the contact list"),
+ 1 }
+};
+
static GtkRadioActionEntry contact_filter_entries[] = {
{ "contact-filter-any-category",
@@ -905,6 +965,10 @@ e_book_shell_view_actions_init (EBookShellView *book_shell_view)
action_group, contact_toggle_entries,
G_N_ELEMENTS (contact_toggle_entries), book_shell_view);
gtk_action_group_add_radio_actions (
+ action_group, contact_view_entries,
+ G_N_ELEMENTS (contact_view_entries), -1,
+ G_CALLBACK (action_contact_view_cb), book_shell_view);
+ gtk_action_group_add_radio_actions (
action_group, contact_search_entries,
G_N_ELEMENTS (contact_search_entries),
CONTACT_SEARCH_NAME_CONTAINS,
@@ -927,6 +991,10 @@ e_book_shell_view_actions_init (EBookShellView *book_shell_view)
key = "/apps/evolution/addressbook/display/show_preview";
gconf_bridge_bind_property (bridge, key, object, "active");
+ object = G_OBJECT (ACTION (CONTACT_VIEW_VERTICAL));
+ key = "/apps/evolution/addressbook/display/layout";
+ gconf_bridge_bind_property (bridge, key, object, "current-value");
+
/* Fine tuning. */
action = ACTION (CONTACT_DELETE);
diff --git a/modules/addressbook/e-book-shell-view-actions.h b/modules/addressbook/e-book-shell-view-actions.h
index 8e3d31f7bf..4c3a18bddf 100644
--- a/modules/addressbook/e-book-shell-view-actions.h
+++ b/modules/addressbook/e-book-shell-view-actions.h
@@ -73,6 +73,10 @@
E_SHELL_WINDOW_ACTION ((window), "contact-select-all")
#define E_SHELL_WINDOW_ACTION_CONTACT_SEND_MESSAGE(window) \
E_SHELL_WINDOW_ACTION ((window), "contact-send-message")
+#define E_SHELL_WINDOW_ACTION_CONTACT_VIEW_CLASSIC(window) \
+ E_SHELL_WINDOW_ACTION ((window), "contact-view-classic")
+#define E_SHELL_WINDOW_ACTION_CONTACT_VIEW_VERTICAL(window) \
+ E_SHELL_WINDOW_ACTION ((window), "contact-view-vertical")
/* Search Actions */
#define E_SHELL_WINDOW_ACTION_CONTACT_SEARCH_ANY_FIELD_CONTAINS(window) \