diff options
author | Shakti Sen <shprasad@novell.com> | 2005-08-02 21:50:54 +0800 |
---|---|---|
committer | Shakti Prasad Sen <shaktis@src.gnome.org> | 2005-08-02 21:50:54 +0800 |
commit | 5739bae429a2743066ad644dc9d32f1d8021e6da (patch) | |
tree | 284643bdd1a55ef4013709f746240fdf1239200f /calendar | |
parent | 90d630ecd19935e696b9279ef9d7d4c6a5486739 (diff) | |
download | gsoc2013-evolution-5739bae429a2743066ad644dc9d32f1d8021e6da.tar gsoc2013-evolution-5739bae429a2743066ad644dc9d32f1d8021e6da.tar.gz gsoc2013-evolution-5739bae429a2743066ad644dc9d32f1d8021e6da.tar.bz2 gsoc2013-evolution-5739bae429a2743066ad644dc9d32f1d8021e6da.tar.lz gsoc2013-evolution-5739bae429a2743066ad644dc9d32f1d8021e6da.tar.xz gsoc2013-evolution-5739bae429a2743066ad644dc9d32f1d8021e6da.tar.zst gsoc2013-evolution-5739bae429a2743066ad644dc9d32f1d8021e6da.zip |
Added support for the Target selection for 'Tasks'. Resolved one undefined
2005-08-01 Shakti Sen <shprasad@novell.com>
* gui/tasks-control.c (tasks_control_sensitize_commands): Added support
for the Target selection for 'Tasks'.
* gui/e-calendar-table.c (e_calendar_table_open_selected): Resolved
one undefined symbol.
* gui/e-tasks.c: Renamed the function name from 'e_tasks_get_tasks_menu' to 'e_tasks_get_tasks_menu'
* gui/e-tasks.h: Added the declaration for 'e_tasks_get_tasks_menu'.
Thus fixes few warning messages.
* gui/e-cal-menu.c (e_cal_menu_target_new_select): Set the mask for
E_CAL_MENU_SELECT_ASSIGNABLE.
Fixes bug #231968.
svn path=/trunk/; revision=29957
Diffstat (limited to 'calendar')
-rw-r--r-- | calendar/ChangeLog | 15 | ||||
-rw-r--r-- | calendar/gui/e-cal-menu.c | 9 | ||||
-rw-r--r-- | calendar/gui/e-calendar-table.c | 2 | ||||
-rw-r--r-- | calendar/gui/e-tasks.c | 3 | ||||
-rw-r--r-- | calendar/gui/e-tasks.h | 1 | ||||
-rw-r--r-- | calendar/gui/tasks-control.c | 94 |
6 files changed, 78 insertions, 46 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index af2e04617f..480e58699b 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,18 @@ +2005-08-01 Shakti Sen <shprasad@novell.com> + + * gui/tasks-control.c (tasks_control_sensitize_commands): Added support + for the Target selection for 'Tasks'. + * gui/e-calendar-table.c (e_calendar_table_open_selected): Resolved + one undefined symbol. + * gui/e-tasks.c: Renamed the function name from 'e_tasks_get_tasks_menu' + to 'e_tasks_get_tasks_menu' + * gui/e-tasks.h: Added the declaration for 'e_tasks_get_tasks_menu'. + Thus fixes few warning messages. + * gui/e-cal-menu.c (e_cal_menu_target_new_select): Set the mask for + E_CAL_MENU_SELECT_ASSIGNABLE. + + Fixes bug #231968. + 2005-07-29 Chenthill Palanisamy <pchenthill@novell.com> diff --git a/calendar/gui/e-cal-menu.c b/calendar/gui/e-cal-menu.c index 499b90d11e..7a177d6017 100644 --- a/calendar/gui/e-cal-menu.c +++ b/calendar/gui/e-cal-menu.c @@ -144,6 +144,11 @@ e_cal_menu_target_new_select(ECalMenu *eabp, struct _ECalModel *model, GPtrArray if (icalcomponent_get_first_property (comp_data->icalcomp, ICAL_URL_PROPERTY)) mask &= ~E_CAL_MENU_SELECT_HASURL; + if (!e_cal_get_static_capability (comp_data->client, CAL_STATIC_CAPABILITY_NO_TASK_ASSIGNMENT) + && !e_cal_get_static_capability (comp_data->client, CAL_STATIC_CAPABILITY_NO_CONV_TO_ASSIGN_TASK) + && !icalcomponent_get_first_property (comp_data->icalcomp, ICAL_ATTENDEE_PROPERTY)) + mask &= ~E_CAL_MENU_SELECT_ASSIGNABLE; + if (e_cal_util_component_has_recurrences (comp_data->icalcomp)) mask &= ~E_CAL_MENU_SELECT_RECURRING; else if (e_cal_util_component_is_instance (comp_data->icalcomp)) @@ -175,10 +180,6 @@ e_cal_menu_target_new_select(ECalMenu *eabp, struct _ECalModel *model, GPtrArray e_cal_is_read_only(client, &read_only, NULL); if (!read_only) mask &= ~E_CAL_MENU_SELECT_EDITABLE; - - if (!e_cal_get_static_capability (client, CAL_STATIC_CAPABILITY_NO_TASK_ASSIGNMENT) - && !e_cal_get_static_capability (client, CAL_STATIC_CAPABILITY_NO_CONV_TO_ASSIGN_TASK)) - mask &= ~E_CAL_MENU_SELECT_ASSIGNABLE; } /* This bit isn't implemented ... */ diff --git a/calendar/gui/e-calendar-table.c b/calendar/gui/e-calendar-table.c index 63408e9a29..5cf8065b30 100644 --- a/calendar/gui/e-calendar-table.c +++ b/calendar/gui/e-calendar-table.c @@ -589,7 +589,7 @@ e_calendar_table_open_selected (ECalendarTable *cal_table) ECalModelComponent *comp_data; icalproperty *prop; - comp_data = get_selected_comp (cal_table); + comp_data = e_calendar_table_get_selected_comp (cal_table); prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_ATTENDEE_PROPERTY); if (comp_data != NULL) e_calendar_table_open_task (cal_table, comp_data, prop ? TRUE : FALSE); diff --git a/calendar/gui/e-tasks.c b/calendar/gui/e-tasks.c index d7851290ad..a0f81a0dbd 100644 --- a/calendar/gui/e-tasks.c +++ b/calendar/gui/e-tasks.c @@ -101,7 +101,6 @@ static void update_view (ETasks *tasks); static void config_categories_changed_cb (EConfigListener *config_listener, const char *key, gpointer user_data); static void backend_error_cb (ECal *client, const char *message, gpointer data); -ECalMenu *gnome_tasks_get_tasks_menu (ETasks *tasks); /* Signal IDs */ enum { @@ -167,7 +166,7 @@ table_cursor_change_cb (ETable *etable, int row, gpointer data) } ECalMenu * -gnome_tasks_get_tasks_menu (ETasks *tasks) +e_tasks_get_tasks_menu (ETasks *tasks) { g_return_val_if_fail (E_IS_TASKS (tasks), NULL); diff --git a/calendar/gui/e-tasks.h b/calendar/gui/e-tasks.h index 26a8c37984..3004d09972 100644 --- a/calendar/gui/e-tasks.h +++ b/calendar/gui/e-tasks.h @@ -82,6 +82,7 @@ void e_tasks_delete_completed (ETasks *tasks); void e_tasks_setup_view_menus (ETasks *tasks, BonoboUIComponent *uic); void e_tasks_discard_view_menus (ETasks *tasks); +struct _ECalMenu *e_tasks_get_tasks_menu (ETasks *tasks); ECalendarTable *e_tasks_get_calendar_table (ETasks *tasks); #endif /* _E_TASKS_H_ */ diff --git a/calendar/gui/tasks-control.c b/calendar/gui/tasks-control.c index 0931215112..927035c3a8 100644 --- a/calendar/gui/tasks-control.c +++ b/calendar/gui/tasks-control.c @@ -54,6 +54,8 @@ #include "tasks-control.h" #include "evolution-shell-component-utils.h" #include "e-util/e-menu.h" +#include "e-cal-menu.h" +#include "e-util/e-menu.h" #include "itip-utils.h" #define FIXED_MARGIN .05 @@ -140,6 +142,40 @@ tasks_control_activate_cb (BonoboControl *control, tasks_control_deactivate (control, tasks); } +struct _tasks_sensitize_item { + char *command; + guint32 enable; +}; + +static void +sensitize_items(BonoboUIComponent *uic, struct _tasks_sensitize_item *items, guint32 mask) +{ + while (items->command) { + char command[32]; + + g_assert(strlen(items->command)<21); + sprintf(command, "/commands/%s", items->command); + + bonobo_ui_component_set_prop (uic, command, "sensitive", + (items->enable & mask) == 0 ? "1" : "0", + NULL); + items++; + } +} + +static struct _tasks_sensitize_item tasks_sensitize_table[] = { + { "TasksOpenTask", E_CAL_MENU_SELECT_ONE }, + { "TasksCut", E_CAL_MENU_SELECT_ANY | E_CAL_MENU_SELECT_EDITABLE }, + { "TasksCopy", E_CAL_MENU_SELECT_ANY }, + { "TasksPaste", E_CAL_MENU_SELECT_EDITABLE }, + { "TasksDelete", E_CAL_MENU_SELECT_ANY | E_CAL_MENU_SELECT_EDITABLE }, + { "TasksMarkComplete", E_CAL_MENU_SELECT_ANY | E_CAL_MENU_SELECT_EDITABLE }, + { "TasksPurge", E_CAL_MENU_SELECT_EDITABLE }, + { "TasksAssign", E_CAL_MENU_SELECT_ONE | E_CAL_MENU_SELECT_EDITABLE | E_CAL_MENU_SELECT_ASSIGNABLE }, + { "TasksForward", E_CAL_MENU_SELECT_ONE }, + { 0 } +}; + /* Sensitizes the UI Component menu/toolbar commands based on the number of * selected tasks. */ @@ -150,10 +186,11 @@ tasks_control_sensitize_commands (BonoboControl *control, ETasks *tasks, int n_s gboolean read_only = TRUE; ECal *ecal; ECalModel *model; + ECalMenu *menu; + ECalMenuTargetSelect *t; + GPtrArray *events; + GSList *selected = NULL, *l = NULL; ECalendarTable *cal_table; - ECalModelComponent *comp_data; - icalproperty *prop; - gboolean is_assigned = FALSE; uic = bonobo_control_get_ui_component (control); g_assert (uic != NULL); @@ -161,48 +198,27 @@ tasks_control_sensitize_commands (BonoboControl *control, ETasks *tasks, int n_s if (bonobo_ui_component_get_container (uic) == CORBA_OBJECT_NIL) return; + menu = e_tasks_get_tasks_menu (tasks); cal_table = e_tasks_get_calendar_table (tasks); model = e_calendar_table_get_model (cal_table); + events = g_ptr_array_new (); + selected = e_calendar_table_get_selected (cal_table); + + for (l = selected;l;l = g_slist_next (l)) { + g_ptr_array_add (events, e_cal_model_copy_component_data ((ECalModelComponent *)l->data)); + } + + g_slist_free (selected); + + t = e_cal_menu_target_new_select (menu, model, events); - if (n_selected == 1) { - comp_data = e_calendar_table_get_selected_comp (cal_table); - prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_ATTENDEE_PROPERTY); - is_assigned = prop ? TRUE : FALSE; - } - ecal = e_cal_model_get_default_client (model); if (ecal) e_cal_is_read_only (ecal, &read_only, NULL); - - bonobo_ui_component_set_prop (uic, "/commands/TasksOpenTask", "sensitive", - n_selected != 1 ? "0" : "1", - NULL); - bonobo_ui_component_set_prop (uic, "/commands/TasksCut", "sensitive", - n_selected == 0 || read_only ? "0" : "1", - NULL); - bonobo_ui_component_set_prop (uic, "/commands/TasksCopy", "sensitive", - n_selected == 0 ? "0" : "1", - NULL); - bonobo_ui_component_set_prop (uic, "/commands/TasksPaste", "sensitive", - read_only ? "0" : "1", - NULL); - bonobo_ui_component_set_prop (uic, "/commands/TasksDelete", "sensitive", - n_selected == 0 || read_only ? "0" : "1", - NULL); - bonobo_ui_component_set_prop (uic, "/commands/TasksMarkComplete", "sensitive", - n_selected == 0 || read_only ? "0" : "1", - NULL); - bonobo_ui_component_set_prop (uic, "/commands/TasksPurge", "sensitive", - read_only ? "0" : "1", - NULL); - bonobo_ui_component_set_prop (uic, "/commands/TasksAssign", "sensitive", - (is_assigned || read_only || n_selected != 1) ? "0" : "1", - NULL); - bonobo_ui_component_set_prop (uic, "/commands/TasksForward", "sensitive", - n_selected != 1 ? "0" : "1", - NULL); + sensitize_items (uic, tasks_sensitize_table, t->target.mask); + e_menu_update_target ((EMenu *)menu, (EMenuTarget *)t); } /* Callback used when the selection in the table changes */ @@ -266,7 +282,7 @@ tasks_control_activate (BonoboControl *control, ETasks *tasks) g_signal_connect (tasks, "selection_changed", G_CALLBACK (selection_changed_cb), control); - e_menu_activate ((EMenu *)gnome_tasks_get_tasks_menu (tasks), uic, 1); + e_menu_activate ((EMenu *)e_tasks_get_tasks_menu (tasks), uic, 1); cal_table = e_tasks_get_calendar_table (tasks); etable = e_calendar_table_get_table (cal_table); n_selected = e_table_selected_count (etable); @@ -291,7 +307,7 @@ tasks_control_deactivate (BonoboControl *control, ETasks *tasks) g_assert (uic != NULL); - e_menu_activate ((EMenu *)gnome_tasks_get_tasks_menu (tasks), uic, 0); + e_menu_activate ((EMenu *)e_tasks_get_tasks_menu (tasks), uic, 0); e_tasks_set_ui_component (tasks, NULL); e_tasks_discard_view_menus (tasks); |