diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2009-08-28 01:38:17 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2009-08-28 05:35:21 +0800 |
commit | 7dc82b2dcbab7f85504c3061ef45cc4249821e42 (patch) | |
tree | c54a1b8936775cfb12d4401f8c18ce85f504aa1d | |
parent | 0e1066b431b3d172c18b7be8744875942515e117 (diff) | |
download | gsoc2013-evolution-7dc82b2dcbab7f85504c3061ef45cc4249821e42.tar.gz gsoc2013-evolution-7dc82b2dcbab7f85504c3061ef45cc4249821e42.tar.zst gsoc2013-evolution-7dc82b2dcbab7f85504c3061ef45cc4249821e42.zip |
Add vertical view to Memos and Tasks.
-rw-r--r-- | calendar/gui/apps_evolution_calendar.schemas.in | 95 | ||||
-rw-r--r-- | modules/calendar/e-memo-shell-content.c | 112 | ||||
-rw-r--r-- | modules/calendar/e-memo-shell-content.h | 6 | ||||
-rw-r--r-- | modules/calendar/e-memo-shell-view-actions.c | 72 | ||||
-rw-r--r-- | modules/calendar/e-memo-shell-view-actions.h | 4 | ||||
-rw-r--r-- | modules/calendar/e-task-shell-content.c | 111 | ||||
-rw-r--r-- | modules/calendar/e-task-shell-content.h | 6 | ||||
-rw-r--r-- | modules/calendar/e-task-shell-view-actions.c | 68 | ||||
-rw-r--r-- | modules/calendar/e-task-shell-view-actions.h | 4 | ||||
-rw-r--r-- | modules/mail/e-mail-shell-content.c | 15 | ||||
-rw-r--r-- | modules/mail/e-mail-shell-view-actions.c | 2 | ||||
-rw-r--r-- | ui/evolution-memos.ui | 9 | ||||
-rw-r--r-- | ui/evolution-tasks.ui | 9 | ||||
-rw-r--r-- | widgets/misc/e-paned.c | 1 |
14 files changed, 419 insertions, 95 deletions
diff --git a/calendar/gui/apps_evolution_calendar.schemas.in b/calendar/gui/apps_evolution_calendar.schemas.in index 6a3b68a25f..b232c60cce 100644 --- a/calendar/gui/apps_evolution_calendar.schemas.in +++ b/calendar/gui/apps_evolution_calendar.schemas.in @@ -289,29 +289,106 @@ <long>Position of the vertical pane, between the calendar lists and the date navigator calendar.</long> </locale> </schema> + <schema> - <key>/schemas/apps/evolution/calendar/display/show_task_preview</key> - <applyto>/apps/evolution/calendar/display/show_task_preview</applyto> + <key>/schemas/apps/evolution/calendar/display/memo_layout</key> + <applyto>/apps/evolution/calendar/display/memo_layout</applyto> + <type>int</type> + <default>0</default> + <locale name="C"> + <short>Memo layout style</short> + <long> + The layout style determines where to place the preview pane + in relation to the memo list. "0" (Classic View) places the + preview pane below the memo list. "1" (Vertical View) places + the preview pane next to the memo list. + </long> + </locale> + </schema> + + <schema> + <key>/schemas/apps/evolution/calendar/display/show_memo_preview</key> + <applyto>/apps/evolution/calendar/display/show_memo_preview</applyto> <owner>evolution-calendar</owner> <type>bool</type> <default>true</default> <locale name="C"> - <short>Show the "Preview" pane</short> + <short>Show the memo preview pane</short> <long> - Show the "Preview" pane. + If "true", show the memo preview pane in the main window. </long> </locale> </schema> <schema> + <key>/schemas/apps/evolution/calendar/display/memo_hpane_position</key> + <applyto>/apps/evolution/calendar/display/memo_hpane_position</applyto> + <owner>evolution-calendar</owner> + <type>int</type> + <default>200</default> + <locale name="C"> + <short>Memo preview pane position (horizontal)</short> + <long> + Position of the task preview pane when oriented horizontally. + </long> + </locale> + </schema> + + <schema> <key>/schemas/apps/evolution/calendar/display/memo_vpane_position</key> <applyto>/apps/evolution/calendar/display/memo_vpane_position</applyto> <owner>evolution-calendar</owner> <type>int</type> <default>400</default> <locale name="C"> - <short>Memos vertical pane position</short> - <long>Position of the vertical pane, between the memo list and the memo preview pane, in pixels.</long> + <short>Memo preview pane position (vertical)</short> + <long> + Position of the memo preview pane when oriented vertically. + </long> + </locale> + </schema> + + <schema> + <key>/schemas/apps/evolution/calendar/display/task_layout</key> + <applyto>/apps/evolution/calendar/display/task_layout</applyto> + <type>int</type> + <default>0</default> + <locale name="C"> + <short>Task layout style</short> + <long> + The layout style determines where to place the preview pane + in relation to the task list. "0" (Classic View) places the + preview pane below the task list. "1" (Vertical View) places + the preview pane next to the task list. + </long> + </locale> + </schema> + + <schema> + <key>/schemas/apps/evolution/calendar/display/show_task_preview</key> + <applyto>/apps/evolution/calendar/display/show_task_preview</applyto> + <owner>evolution-calendar</owner> + <type>bool</type> + <default>true</default> + <locale name="C"> + <short>Show the task preview pane</short> + <long> + If "true", show the task preview pane in the main window. + </long> + </locale> + </schema> + + <schema> + <key>/schemas/apps/evolution/calendar/display/task_hpane_position</key> + <applyto>/apps/evolution/calendar/display/task_hpane_position</applyto> + <owner>evolution-calendar</owner> + <type>int</type> + <default>200</default> + <locale name="C"> + <short>Task preview pane position (horizontal)</short> + <long> + Position of the task preview pane when oriented horizontally. + </long> </locale> </schema> @@ -322,8 +399,10 @@ <type>int</type> <default>400</default> <locale name="C"> - <short>Tasks vertical pane position</short> - <long>Position of the vertical pane, between the task list and the task preview pane, in pixels.</long> + <short>Task preview pane position (vertical)</short> + <long> + Position of the task preview pane when oriented vertically. + </long> </locale> </schema> diff --git a/modules/calendar/e-memo-shell-content.c b/modules/calendar/e-memo-shell-content.c index 7c7b84f3fb..2f4e436056 100644 --- a/modules/calendar/e-memo-shell-content.c +++ b/modules/calendar/e-memo-shell-content.c @@ -23,14 +23,15 @@ #include <glib/gi18n.h> +#include "e-util/e-binding.h" #include "e-util/gconf-bridge.h" +#include "widgets/menus/gal-view-etable.h" +#include "widgets/misc/e-paned.h" #include "calendar/gui/comp-util.h" #include "calendar/gui/e-cal-model-memos.h" #include "calendar/gui/e-memo-table.h" -#include "widgets/menus/gal-view-etable.h" - #define E_MEMO_SHELL_CONTENT_GET_PRIVATE(obj) \ (G_TYPE_INSTANCE_GET_PRIVATE \ ((obj), E_TYPE_MEMO_SHELL_CONTENT, EMemoShellContentPrivate)) @@ -51,13 +52,17 @@ struct _EMemoShellContentPrivate { ECalModel *memo_model; GalViewInstance *view_instance; + GtkOrientation orientation; gchar *current_uid; + + guint preview_visible : 1; }; enum { PROP_0, PROP_MODEL, + PROP_ORIENTATION, PROP_PREVIEW_VISIBLE }; @@ -258,6 +263,21 @@ memo_shell_content_model_row_changed_cb (EMemoShellContent *memo_shell_content, memo_shell_content_cursor_change_cb (memo_shell_content, 0, table); } +static GtkOrientation +memo_shell_content_get_orientation (EMemoShellContent *memo_shell_content) +{ + return memo_shell_content->priv->orientation; +} + +static void +memo_shell_content_set_orientation (EMemoShellContent *memo_shell_content, + GtkOrientation orientation) +{ + memo_shell_content->priv->orientation = orientation; + + g_object_notify (G_OBJECT (memo_shell_content), "orientation"); +} + static void memo_shell_content_set_property (GObject *object, guint property_id, @@ -265,6 +285,12 @@ memo_shell_content_set_property (GObject *object, GParamSpec *pspec) { switch (property_id) { + case PROP_ORIENTATION: + memo_shell_content_set_orientation ( + E_MEMO_SHELL_CONTENT (object), + g_value_get_enum (value)); + return; + case PROP_PREVIEW_VISIBLE: e_memo_shell_content_set_preview_visible ( E_MEMO_SHELL_CONTENT (object), @@ -284,13 +310,22 @@ memo_shell_content_get_property (GObject *object, switch (property_id) { case PROP_MODEL: g_value_set_object ( - value, e_memo_shell_content_get_memo_model ( + value, + e_memo_shell_content_get_memo_model ( + E_MEMO_SHELL_CONTENT (object))); + return; + + case PROP_ORIENTATION: + g_value_set_enum ( + value, + memo_shell_content_get_orientation ( E_MEMO_SHELL_CONTENT (object))); return; case PROP_PREVIEW_VISIBLE: g_value_set_boolean ( - value, e_memo_shell_content_get_preview_visible ( + value, + e_memo_shell_content_get_preview_visible ( E_MEMO_SHELL_CONTENT (object))); return; } @@ -385,11 +420,15 @@ memo_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 = e_memo_table_new (shell_view, priv->memo_model); @@ -406,6 +445,10 @@ memo_shell_content_constructed (GObject *object) 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 = e_cal_component_preview_new (); @@ -467,8 +510,12 @@ memo_shell_content_constructed (GObject *object) bridge = gconf_bridge_get (); object = G_OBJECT (priv->paned); + key = "/apps/evolution/calendar/display/memo_hpane_position"; + gconf_bridge_bind_property_delayed (bridge, key, object, "hposition"); + + object = G_OBJECT (priv->paned); key = "/apps/evolution/calendar/display/memo_vpane_position"; - gconf_bridge_bind_property_delayed (bridge, key, object, "position"); + gconf_bridge_bind_property_delayed (bridge, key, object, "vposition"); } static guint32 @@ -553,7 +600,11 @@ memo_shell_content_class_init (EMemoShellContentClass *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 @@ -587,9 +638,19 @@ e_memo_shell_content_register_type (GTypeModule *type_module) NULL /* value_table */ }; + static const GInterfaceInfo orientable_info = { + (GInterfaceInitFunc) NULL, + (GInterfaceFinalizeFunc) NULL, + NULL /* interface_data */ + }; + memo_shell_content_type = g_type_module_register_type ( type_module, E_TYPE_SHELL_CONTENT, "EMemoShellContent", &type_info, 0); + + g_type_module_add_interface ( + type_module, memo_shell_content_type, + GTK_TYPE_ORIENTABLE, &orientable_info); } GtkWidget * @@ -630,46 +691,31 @@ e_memo_shell_content_get_memo_table (EMemoShellContent *memo_shell_content) return E_MEMO_TABLE (memo_shell_content->priv->memo_table); } -GalViewInstance * -e_memo_shell_content_get_view_instance (EMemoShellContent *memo_shell_content) -{ - g_return_val_if_fail ( - E_IS_MEMO_SHELL_CONTENT (memo_shell_content), NULL); - - return memo_shell_content->priv->view_instance; -} - gboolean e_memo_shell_content_get_preview_visible (EMemoShellContent *memo_shell_content) { - GtkPaned *paned; - GtkWidget *child; - g_return_val_if_fail ( E_IS_MEMO_SHELL_CONTENT (memo_shell_content), FALSE); - paned = GTK_PANED (memo_shell_content->priv->paned); - child = gtk_paned_get_child2 (paned); - - return GTK_WIDGET_VISIBLE (child); + return memo_shell_content->priv->preview_visible; } void e_memo_shell_content_set_preview_visible (EMemoShellContent *memo_shell_content, gboolean preview_visible) { - GtkPaned *paned; - GtkWidget *child; - g_return_if_fail (E_IS_MEMO_SHELL_CONTENT (memo_shell_content)); - paned = GTK_PANED (memo_shell_content->priv->paned); - child = gtk_paned_get_child2 (paned); - - if (preview_visible) - gtk_widget_show (child); - else - gtk_widget_hide (child); + memo_shell_content->priv->preview_visible = preview_visible; g_object_notify (G_OBJECT (memo_shell_content), "preview-visible"); } + +GalViewInstance * +e_memo_shell_content_get_view_instance (EMemoShellContent *memo_shell_content) +{ + g_return_val_if_fail ( + E_IS_MEMO_SHELL_CONTENT (memo_shell_content), NULL); + + return memo_shell_content->priv->view_instance; +} diff --git a/modules/calendar/e-memo-shell-content.h b/modules/calendar/e-memo-shell-content.h index 84c22d6ce4..ae2710e148 100644 --- a/modules/calendar/e-memo-shell-content.h +++ b/modules/calendar/e-memo-shell-content.h @@ -82,14 +82,14 @@ ECalComponentPreview * (EMemoShellContent *memo_shell_content); EMemoTable * e_memo_shell_content_get_memo_table (EMemoShellContent *memo_shell_content); -GalViewInstance * - e_memo_shell_content_get_view_instance - (EMemoShellContent *memo_shell_content); gboolean e_memo_shell_content_get_preview_visible (EMemoShellContent *memo_shell_content); void e_memo_shell_content_set_preview_visible (EMemoShellContent *memo_shell_content, gboolean preview_visible); +GalViewInstance * + e_memo_shell_content_get_view_instance + (EMemoShellContent *memo_shell_content); G_END_DECLS diff --git a/modules/calendar/e-memo-shell-view-actions.c b/modules/calendar/e-memo-shell-view-actions.c index 2d6713a7a8..0161eeb198 100644 --- a/modules/calendar/e-memo-shell-view-actions.c +++ b/modules/calendar/e-memo-shell-view-actions.c @@ -528,6 +528,32 @@ action_memo_search_cb (GtkRadioAction *action, } static void +action_memo_view_cb (GtkRadioAction *action, + GtkRadioAction *current, + EMemoShellView *memo_shell_view) +{ + EMemoShellContent *memo_shell_content; + GtkOrientable *orientable; + GtkOrientation orientation; + + memo_shell_content = memo_shell_view->priv->memo_shell_content; + orientable = GTK_ORIENTABLE (memo_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_search_execute_cb (GtkAction *action, EMemoShellView *memo_shell_view) { @@ -662,7 +688,16 @@ static GtkActionEntry memo_entries[] = { N_("_Save as iCalendar..."), NULL, NULL, /* XXX Add a tooltip! */ - G_CALLBACK (action_memo_save_as_cb) } + G_CALLBACK (action_memo_save_as_cb) }, + + /*** Menus ***/ + + { "memo-preview-menu", + NULL, + N_("_Preview"), + NULL, + NULL, + NULL } }; static EPopupActionEntry memo_popup_entries[] = { @@ -731,6 +766,33 @@ static GtkToggleActionEntry memo_toggle_entries[] = { TRUE } }; +static GtkRadioActionEntry memo_view_entries[] = { + + /* This action represents the initial active memo view. + * It should not be visible in the UI, nor should it be + * possible to switch to it from another shell view. */ + { "memo-view-initial", + NULL, + NULL, + NULL, + NULL, + -1 }, + + { "memo-view-classic", + NULL, + N_("_Classic View"), + NULL, + N_("Show memo preview below the memo list"), + 0 }, + + { "memo-view-vertical", + NULL, + N_("_Vertical View"), + NULL, + N_("Show memo preview alongside the memo list"), + 1 } +}; + static GtkRadioActionEntry memo_filter_entries[] = { { "memo-filter-any-category", @@ -829,6 +891,10 @@ e_memo_shell_view_actions_init (EMemoShellView *memo_shell_view) action_group, memo_toggle_entries, G_N_ELEMENTS (memo_toggle_entries), memo_shell_view); gtk_action_group_add_radio_actions ( + action_group, memo_view_entries, + G_N_ELEMENTS (memo_view_entries), -1, + G_CALLBACK (action_memo_view_cb), memo_shell_view); + gtk_action_group_add_radio_actions ( action_group, memo_search_entries, G_N_ELEMENTS (memo_search_entries), MEMO_SEARCH_SUMMARY_CONTAINS, @@ -851,6 +917,10 @@ e_memo_shell_view_actions_init (EMemoShellView *memo_shell_view) key = "/apps/evolution/calendar/display/show_memo_preview"; gconf_bridge_bind_property (bridge, key, object, "active"); + object = G_OBJECT (ACTION (MEMO_VIEW_VERTICAL)); + key = "/apps/evolution/calendar/display/memo_layout"; + gconf_bridge_bind_property (bridge, key, object, "current-value"); + /* Fine tuning. */ action = ACTION (MEMO_DELETE); diff --git a/modules/calendar/e-memo-shell-view-actions.h b/modules/calendar/e-memo-shell-view-actions.h index d6fd3ca514..d43d0239d9 100644 --- a/modules/calendar/e-memo-shell-view-actions.h +++ b/modules/calendar/e-memo-shell-view-actions.h @@ -47,6 +47,10 @@ E_SHELL_WINDOW_ACTION ((window), "memo-print") #define E_SHELL_WINDOW_ACTION_MEMO_SAVE_AS(window) \ E_SHELL_WINDOW_ACTION ((window), "memo-save-as") +#define E_SHELL_WINDOW_ACTION_MEMO_VIEW_CLASSIC(window) \ + E_SHELL_WINDOW_ACTION ((window), "memo-view-classic") +#define E_SHELL_WINDOW_ACTION_MEMO_VIEW_VERTICAL(window) \ + E_SHELL_WINDOW_ACTION ((window), "memo-view-vertical") /* Memo List Actions */ #define E_SHELL_WINDOW_ACTION_MEMO_LIST_COPY(window) \ diff --git a/modules/calendar/e-task-shell-content.c b/modules/calendar/e-task-shell-content.c index c1333727bf..a095003978 100644 --- a/modules/calendar/e-task-shell-content.c +++ b/modules/calendar/e-task-shell-content.c @@ -25,13 +25,13 @@ #include "e-util/e-binding.h" #include "e-util/gconf-bridge.h" +#include "widgets/menus/gal-view-etable.h" +#include "widgets/misc/e-paned.h" #include "calendar/gui/comp-util.h" #include "calendar/gui/e-cal-model-tasks.h" #include "calendar/gui/e-calendar-table.h" -#include "widgets/menus/gal-view-etable.h" - #define E_TASK_SHELL_CONTENT_GET_PRIVATE(obj) \ (G_TYPE_INSTANCE_GET_PRIVATE \ ((obj), E_TYPE_TASK_SHELL_CONTENT, ETaskShellContentPrivate)) @@ -53,13 +53,17 @@ struct _ETaskShellContentPrivate { ECalModel *task_model; GalViewInstance *view_instance; + GtkOrientation orientation; gchar *current_uid; + + guint preview_visible : 1; }; enum { PROP_0, PROP_MODEL, + PROP_ORIENTATION, PROP_PREVIEW_VISIBLE }; @@ -258,6 +262,21 @@ task_shell_content_model_row_changed_cb (ETaskShellContent *task_shell_content, task_shell_content_cursor_change_cb (task_shell_content, 0, table); } +static GtkOrientation +task_shell_content_get_orientation (ETaskShellContent *task_shell_content) +{ + return task_shell_content->priv->orientation; +} + +static void +task_shell_content_set_orientation (ETaskShellContent *task_shell_content, + GtkOrientation orientation) +{ + task_shell_content->priv->orientation = orientation; + + g_object_notify (G_OBJECT (task_shell_content), "orientation"); +} + static void task_shell_content_set_property (GObject *object, guint property_id, @@ -265,6 +284,12 @@ task_shell_content_set_property (GObject *object, GParamSpec *pspec) { switch (property_id) { + case PROP_ORIENTATION: + task_shell_content_set_orientation ( + E_TASK_SHELL_CONTENT (object), + g_value_get_enum (value)); + return; + case PROP_PREVIEW_VISIBLE: e_task_shell_content_set_preview_visible ( E_TASK_SHELL_CONTENT (object), @@ -284,13 +309,22 @@ task_shell_content_get_property (GObject *object, switch (property_id) { case PROP_MODEL: g_value_set_object ( - value, e_task_shell_content_get_task_model ( + value, + e_task_shell_content_get_task_model ( + E_TASK_SHELL_CONTENT (object))); + return; + + case PROP_ORIENTATION: + g_value_set_enum ( + value, + task_shell_content_get_orientation ( E_TASK_SHELL_CONTENT (object))); return; case PROP_PREVIEW_VISIBLE: g_value_set_boolean ( - value, e_task_shell_content_get_preview_visible ( + value, + e_task_shell_content_get_preview_visible ( E_TASK_SHELL_CONTENT (object))); return; } @@ -384,11 +418,15 @@ task_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 = e_calendar_table_new (shell_view, priv->task_model); @@ -405,6 +443,10 @@ task_shell_content_constructed (GObject *object) 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 = e_cal_component_preview_new (); @@ -466,8 +508,12 @@ task_shell_content_constructed (GObject *object) bridge = gconf_bridge_get (); object = G_OBJECT (priv->paned); + key = "/apps/evolution/calendar/display/task_hpane_position"; + gconf_bridge_bind_property_delayed (bridge, key, object, "hposition"); + + object = G_OBJECT (priv->paned); key = "/apps/evolution/calendar/display/task_vpane_position"; - gconf_bridge_bind_property_delayed (bridge, key, object, "position"); + gconf_bridge_bind_property_delayed (bridge, key, object, "vposition"); } static guint32 @@ -577,7 +623,11 @@ task_shell_content_class_init (ETaskShellContentClass *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 @@ -611,9 +661,19 @@ e_task_shell_content_register_type (GTypeModule *type_module) NULL /* value_table */ }; + static const GInterfaceInfo orientable_info = { + (GInterfaceInitFunc) NULL, + (GInterfaceFinalizeFunc) NULL, + NULL /* interface_data */ + }; + task_shell_content_type = g_type_module_register_type ( type_module, E_TYPE_SHELL_CONTENT, "ETaskShellContent", &type_info, 0); + + g_type_module_add_interface ( + type_module, task_shell_content_type, + GTK_TYPE_ORIENTABLE, &orientable_info); } GtkWidget * @@ -654,46 +714,31 @@ e_task_shell_content_get_task_table (ETaskShellContent *task_shell_content) return E_CALENDAR_TABLE (task_shell_content->priv->task_table); } -GalViewInstance * -e_task_shell_content_get_view_instance (ETaskShellContent *task_shell_content) -{ - g_return_val_if_fail ( - E_IS_TASK_SHELL_CONTENT (task_shell_content), NULL); - - return task_shell_content->priv->view_instance; -} - gboolean e_task_shell_content_get_preview_visible (ETaskShellContent *task_shell_content) { - GtkPaned *paned; - GtkWidget *child; - g_return_val_if_fail ( E_IS_TASK_SHELL_CONTENT (task_shell_content), FALSE); - paned = GTK_PANED (task_shell_content->priv->paned); - child = gtk_paned_get_child2 (paned); - - return GTK_WIDGET_VISIBLE (child); + return task_shell_content->priv->preview_visible; } void e_task_shell_content_set_preview_visible (ETaskShellContent *task_shell_content, gboolean preview_visible) { - GtkPaned *paned; - GtkWidget *child; - g_return_if_fail (E_IS_TASK_SHELL_CONTENT (task_shell_content)); - paned = GTK_PANED (task_shell_content->priv->paned); - child = gtk_paned_get_child2 (paned); - - if (preview_visible) - gtk_widget_show (child); - else - gtk_widget_hide (child); + task_shell_content->priv->preview_visible = preview_visible; g_object_notify (G_OBJECT (task_shell_content), "preview-visible"); } + +GalViewInstance * +e_task_shell_content_get_view_instance (ETaskShellContent *task_shell_content) +{ + g_return_val_if_fail ( + E_IS_TASK_SHELL_CONTENT (task_shell_content), NULL); + + return task_shell_content->priv->view_instance; +} diff --git a/modules/calendar/e-task-shell-content.h b/modules/calendar/e-task-shell-content.h index 7e0b2128a7..f5d4fc9665 100644 --- a/modules/calendar/e-task-shell-content.h +++ b/modules/calendar/e-task-shell-content.h @@ -86,14 +86,14 @@ ECalComponentPreview * (ETaskShellContent *task_shell_content); ECalendarTable *e_task_shell_content_get_task_table (ETaskShellContent *task_shell_content); -GalViewInstance * - e_task_shell_content_get_view_instance - (ETaskShellContent *task_shell_content); gboolean e_task_shell_content_get_preview_visible (ETaskShellContent *task_shell_content); void e_task_shell_content_set_preview_visible (ETaskShellContent *task_shell_content, gboolean preview_visible); +GalViewInstance * + e_task_shell_content_get_view_instance + (ETaskShellContent *task_shell_content); G_END_DECLS diff --git a/modules/calendar/e-task-shell-view-actions.c b/modules/calendar/e-task-shell-view-actions.c index d1354026cb..d4fb94c2e5 100644 --- a/modules/calendar/e-task-shell-view-actions.c +++ b/modules/calendar/e-task-shell-view-actions.c @@ -675,6 +675,32 @@ action_task_search_cb (GtkRadioAction *action, e_shell_content_set_search_hint (shell_content, search_hint); } +static void +action_task_view_cb (GtkRadioAction *action, + GtkRadioAction *current, + ETaskShellView *task_shell_view) +{ + ETaskShellContent *task_shell_content; + GtkOrientable *orientable; + GtkOrientation orientation; + + task_shell_content = task_shell_view->priv->task_shell_content; + orientable = GTK_ORIENTABLE (task_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 GtkActionEntry task_entries[] = { { "task-assign", @@ -817,6 +843,13 @@ static GtkActionEntry task_entries[] = { N_("_Actions"), NULL, NULL, + NULL }, + + { "task-preview-menu", + NULL, + N_("_Preview"), + NULL, + NULL, NULL } }; @@ -898,6 +931,33 @@ static GtkToggleActionEntry task_toggle_entries[] = { TRUE } }; +static GtkRadioActionEntry task_view_entries[] = { + + /* This action represents the inital active memo view. + * It should not be visible in the UI, nor should it be + * possible to switch to it from another shell view. */ + { "task-view-initial", + NULL, + NULL, + NULL, + NULL, + -1 }, + + { "task-view-classic", + NULL, + N_("_Classic View"), + NULL, + N_("Show task preview below the task list"), + 0 }, + + { "task-view-vertical", + NULL, + N_("_Vertical View"), + NULL, + N_("Show task preview alongside the task list"), + 1 } +}; + static GtkRadioActionEntry task_filter_entries[] = { { "task-filter-active-tasks", @@ -1031,6 +1091,10 @@ e_task_shell_view_actions_init (ETaskShellView *task_shell_view) action_group, task_toggle_entries, G_N_ELEMENTS (task_toggle_entries), task_shell_view); gtk_action_group_add_radio_actions ( + action_group, task_view_entries, + G_N_ELEMENTS (task_view_entries), -1, + G_CALLBACK (action_task_view_cb), task_shell_view); + gtk_action_group_add_radio_actions ( action_group, task_search_entries, G_N_ELEMENTS (task_search_entries), TASK_SEARCH_SUMMARY_CONTAINS, @@ -1053,6 +1117,10 @@ e_task_shell_view_actions_init (ETaskShellView *task_shell_view) key = "/apps/evolution/calendar/display/show_task_preview"; gconf_bridge_bind_property (bridge, key, object, "active"); + object = G_OBJECT (ACTION (TASK_VIEW_VERTICAL)); + key = "/apps/evolution/calendar/display/task_layout"; + gconf_bridge_bind_property (bridge, key, object, "current-value"); + /* Fine tuning. */ action = ACTION (TASK_DELETE); diff --git a/modules/calendar/e-task-shell-view-actions.h b/modules/calendar/e-task-shell-view-actions.h index d7db39bcc9..daa70c36da 100644 --- a/modules/calendar/e-task-shell-view-actions.h +++ b/modules/calendar/e-task-shell-view-actions.h @@ -55,6 +55,10 @@ E_SHELL_WINDOW_ACTION ((window), "task-purge") #define E_SHELL_WINDOW_ACTION_TASK_SAVE_AS(window) \ E_SHELL_WINDOW_ACTION ((window), "task-save-as") +#define E_SHELL_WINDOW_ACTION_TASK_VIEW_CLASSIC(window) \ + E_SHELL_WINDOW_ACTION ((window), "task-view-classic") +#define E_SHELL_WINDOW_ACTION_TASK_VIEW_VERTICAL(window) \ + E_SHELL_WINDOW_ACTION ((window), "task-view-vertical") /* Task List Actions */ #define E_SHELL_WINDOW_ACTION_TASK_LIST_COPY(window) \ diff --git a/modules/mail/e-mail-shell-content.c b/modules/mail/e-mail-shell-content.c index 9bea68f9cb..3a4f5aed74 100644 --- a/modules/mail/e-mail-shell-content.c +++ b/modules/mail/e-mail-shell-content.c @@ -463,6 +463,10 @@ mail_shell_content_constructed (GObject *object) 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 = gtk_scrolled_window_new (NULL, NULL); @@ -783,22 +787,11 @@ void e_mail_shell_content_set_preview_visible (EMailShellContent *mail_shell_content, gboolean preview_visible) { - GtkPaned *paned; - GtkWidget *child; - g_return_if_fail (E_IS_MAIL_SHELL_CONTENT (mail_shell_content)); if (preview_visible == mail_shell_content->priv->preview_visible) return; - paned = GTK_PANED (mail_shell_content->priv->paned); - child = gtk_paned_get_child2 (paned); - - if (preview_visible) - gtk_widget_show (child); - else - gtk_widget_hide (child); - /* If we're showing the preview, tell EMailReader to reload the * selected message. This should force it to download the full * message if necessary, so we don't get an empty preview. */ diff --git a/modules/mail/e-mail-shell-view-actions.c b/modules/mail/e-mail-shell-view-actions.c index 22bd86320b..08a8d12aa0 100644 --- a/modules/mail/e-mail-shell-view-actions.c +++ b/modules/mail/e-mail-shell-view-actions.c @@ -1322,7 +1322,7 @@ static GtkRadioActionEntry mail_view_entries[] = { /* This action represents the initial active mail view. * It should not be visible in the UI, nor should it be * possible to switch to it from another shell view. */ - { "mail-view-internal", + { "mail-view-initial", NULL, NULL, NULL, diff --git a/ui/evolution-memos.ui b/ui/evolution-memos.ui index 28abc7e997..f4d4129371 100644 --- a/ui/evolution-memos.ui +++ b/ui/evolution-memos.ui @@ -19,7 +19,14 @@ </placeholder> </menu> <menu action='view-menu'> - <menuitem action='memo-preview'/> + <placeholder name='view-custom-menus'> + <menu action='memo-preview-menu'> + <menuitem action='memo-preview'/> + <separator/> + <menuitem action='memo-view-classic'/> + <menuitem action='memo-view-vertical'/> + </menu> + </placeholder> </menu> </menubar> <toolbar name='main-toolbar'> diff --git a/ui/evolution-tasks.ui b/ui/evolution-tasks.ui index 073f7d450a..e8d6f768eb 100644 --- a/ui/evolution-tasks.ui +++ b/ui/evolution-tasks.ui @@ -22,7 +22,14 @@ </placeholder> </menu> <menu action='view-menu'> - <menuitem action='task-preview'/> + <placeholder name='view-custom-menus'> + <menu action='task-preview-menu'> + <menuitem action='task-preview'/> + <separator/> + <menuitem action='task-view-classic'/> + <menuitem action='task-view-vertical'/> + </menu> + </placeholder> </menu> <placeholder name='custom-menus'> <menu action='task-actions-menu'> diff --git a/widgets/misc/e-paned.c b/widgets/misc/e-paned.c index 350042413a..2c8a1820d7 100644 --- a/widgets/misc/e-paned.c +++ b/widgets/misc/e-paned.c @@ -47,6 +47,7 @@ static gpointer parent_class; static void paned_notify_orientation_cb (EPaned *paned) { + /* Ignore the next "notify::position" emission. */ paned->priv->sync_position = TRUE; gtk_widget_queue_resize (GTK_WIDGET (paned)); |