aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/modules/e-task-shell-content.c
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@src.gnome.org>2008-10-25 07:02:33 +0800
committerMatthew Barnes <mbarnes@src.gnome.org>2008-10-25 07:02:33 +0800
commite7a31c5035a0afeed6c1675e30487c1e2bdc139f (patch)
treeeb1e733a6fe69773498725efa64304a9234270bc /calendar/modules/e-task-shell-content.c
parent95cae9b166587d19db3aadde6a21cc12c30da6e6 (diff)
downloadgsoc2013-evolution-e7a31c5035a0afeed6c1675e30487c1e2bdc139f.tar
gsoc2013-evolution-e7a31c5035a0afeed6c1675e30487c1e2bdc139f.tar.gz
gsoc2013-evolution-e7a31c5035a0afeed6c1675e30487c1e2bdc139f.tar.bz2
gsoc2013-evolution-e7a31c5035a0afeed6c1675e30487c1e2bdc139f.tar.lz
gsoc2013-evolution-e7a31c5035a0afeed6c1675e30487c1e2bdc139f.tar.xz
gsoc2013-evolution-e7a31c5035a0afeed6c1675e30487c1e2bdc139f.tar.zst
gsoc2013-evolution-e7a31c5035a0afeed6c1675e30487c1e2bdc139f.zip
Commit recent work so I can merge from trunk.
svn path=/branches/kill-bonobo/; revision=36684
Diffstat (limited to 'calendar/modules/e-task-shell-content.c')
-rw-r--r--calendar/modules/e-task-shell-content.c74
1 files changed, 74 insertions, 0 deletions
diff --git a/calendar/modules/e-task-shell-content.c b/calendar/modules/e-task-shell-content.c
index 9599e35d3b..40b8372c46 100644
--- a/calendar/modules/e-task-shell-content.c
+++ b/calendar/modules/e-task-shell-content.c
@@ -417,10 +417,81 @@ task_shell_content_constructed (GObject *object)
gconf_bridge_bind_property_delayed (bridge, key, object, "position");
}
+static guint32
+task_shell_content_check_state (EShellContent *shell_content)
+{
+ ETaskShellContent *task_shell_content;
+ ECalendarTable *task_table;
+ ETable *table;
+ GSList *list, *iter;
+ gboolean assignable = TRUE;
+ gboolean editable = TRUE;
+ gboolean has_url = FALSE;
+ gint n_selected;
+ gint n_complete = 0;
+ gint n_incomplete = 0;
+ guint32 state = 0;
+
+ task_shell_content = E_TASK_SHELL_CONTENT (shell_content);
+ task_table = e_task_shell_content_get_task_table (task_shell_content);
+
+ table = e_calendar_table_get_table (task_table);
+ n_selected = e_table_selected_count (table);
+
+ list = e_calendar_table_get_selected (task_table);
+ for (iter = list; iter != NULL; iter = iter->next) {
+ ECalModelComponent *comp_data = iter->data;
+ icalproperty *prop;
+ const gchar *cap;
+ gboolean read_only;
+
+ e_cal_is_read_only (comp_data->client, &read_only, NULL);
+ editable &= !read_only;
+
+ cap = CAL_STATIC_CAPABILITY_NO_TASK_ASSIGNMENT;
+ if (e_cal_get_static_capability (comp_data->client, cap))
+ assignable = FALSE;
+
+ cap = CAL_STATIC_CAPABILITY_NO_CONV_TO_ASSIGN_TASK;
+ if (e_cal_get_static_capability (comp_data->client, cap))
+ assignable = FALSE;
+
+ prop = icalcomponent_get_first_property (
+ comp_data->icalcomp, ICAL_URL_PROPERTY);
+ has_url |= (prop != NULL);
+
+ prop = icalcomponent_get_first_property (
+ comp_data->icalcomp, ICAL_COMPLETED_PROPERTY);
+ if (prop != NULL)
+ n_complete++;
+ else
+ n_incomplete++;
+ }
+ g_slist_free (list);
+
+ if (n_selected == 1)
+ state |= E_TASK_SHELL_CONTENT_SELECTION_SINGLE;
+ if (n_selected > 1)
+ state |= E_TASK_SHELL_CONTENT_SELECTION_MULTIPLE;
+ if (assignable)
+ state |= E_TASK_SHELL_CONTENT_SELECTION_CAN_ASSIGN;
+ if (editable)
+ state |= E_TASK_SHELL_CONTENT_SELECTION_CAN_EDIT;
+ if (n_complete > 0)
+ state |= E_TASK_SHELL_CONTENT_SELECTION_HAS_COMPLETE;
+ if (n_incomplete > 0)
+ state |= E_TASK_SHELL_CONTENT_SELECTION_HAS_INCOMPLETE;
+ if (has_url)
+ state |= E_TASK_SHELL_CONTENT_SELECTION_HAS_URL;
+
+ return state;
+}
+
static void
task_shell_content_class_init (ETaskShellContentClass *class)
{
GObjectClass *object_class;
+ EShellContentClass *shell_content_class;
parent_class = g_type_class_peek_parent (class);
g_type_class_add_private (class, sizeof (ETaskShellContentPrivate));
@@ -432,6 +503,9 @@ task_shell_content_class_init (ETaskShellContentClass *class)
object_class->finalize = task_shell_content_finalize;
object_class->constructed = task_shell_content_constructed;
+ shell_content_class = E_SHELL_CONTENT_CLASS (class);
+ shell_content_class->check_state = task_shell_content_check_state;
+
g_object_class_install_property (
object_class,
PROP_PREVIEW_VISIBLE,