aboutsummaryrefslogtreecommitdiffstats
path: root/modules/calendar/e-task-shell-content.c
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2009-08-28 01:38:17 +0800
committerMatthew Barnes <mbarnes@redhat.com>2009-08-28 05:35:21 +0800
commit7dc82b2dcbab7f85504c3061ef45cc4249821e42 (patch)
treec54a1b8936775cfb12d4401f8c18ce85f504aa1d /modules/calendar/e-task-shell-content.c
parent0e1066b431b3d172c18b7be8744875942515e117 (diff)
downloadgsoc2013-evolution-7dc82b2dcbab7f85504c3061ef45cc4249821e42.tar.gz
gsoc2013-evolution-7dc82b2dcbab7f85504c3061ef45cc4249821e42.tar.zst
gsoc2013-evolution-7dc82b2dcbab7f85504c3061ef45cc4249821e42.zip
Add vertical view to Memos and Tasks.
Diffstat (limited to 'modules/calendar/e-task-shell-content.c')
-rw-r--r--modules/calendar/e-task-shell-content.c111
1 files changed, 78 insertions, 33 deletions
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;
+}