diff options
author | Viren.l <lviren@novel.com> | 2005-07-25 15:53:18 +0800 |
---|---|---|
committer | Chenthill Palanisamy <pchen@src.gnome.org> | 2005-07-25 15:53:18 +0800 |
commit | bd035bcd8ccb4e85e9a0ac2a63f800c2cc4b5057 (patch) | |
tree | 90e94ec09edb61e155a8186c34489976a04a1410 /calendar | |
parent | dca96e14ddba2d5e1327dd2931389b930c0b6cc3 (diff) | |
download | gsoc2013-evolution-bd035bcd8ccb4e85e9a0ac2a63f800c2cc4b5057.tar.gz gsoc2013-evolution-bd035bcd8ccb4e85e9a0ac2a63f800c2cc4b5057.tar.zst gsoc2013-evolution-bd035bcd8ccb4e85e9a0ac2a63f800c2cc4b5057.zip |
Fixes:248126 Added 2 Bonobo UI verbs for Assign Task and Forward as
2005-07-25 Viren.l <lviren@novel.com>
Fixes:248126
* gui/tasks-control.c (tasks_control_assign_cmd)
(tasks_control_forward_cmd): Added 2 Bonobo UI verbs for Assign Task and Forward as iCalendar
and the definitions to commands.
* gui/e-calendar-table.[ch] (e_calendar_table_open_task)
(e_calendar_table_get_selected_comp): renamed static functions open_task and get_selected_comp
and made them public.
svn path=/trunk/; revision=29881
Diffstat (limited to 'calendar')
-rw-r--r-- | calendar/ChangeLog | 10 | ||||
-rw-r--r-- | calendar/gui/e-calendar-table.c | 32 | ||||
-rw-r--r-- | calendar/gui/e-calendar-table.h | 4 | ||||
-rw-r--r-- | calendar/gui/tasks-control.c | 72 |
4 files changed, 98 insertions, 20 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 283f3e1322..5807065a25 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,13 @@ +2005-07-25 Viren.l <lviren@novel.com> + + Fixes:248126 + * gui/tasks-control.c (tasks_control_assign_cmd) + (tasks_control_forward_cmd): Added 2 Bonobo UI verbs for Assign Task and Forward as iCalendar + and the definitions to commands. + * gui/e-calendar-table.[ch] (e_calendar_table_open_task) + (e_calendar_table_get_selected_comp): renamed static functions open_task and get_selected_comp + and made them public. + 2005-07-23 Chenthill Palanisamy <pchenthill@novell.com> * gui/e-cal-popup.[ch]: (needs_to_accept), diff --git a/calendar/gui/e-calendar-table.c b/calendar/gui/e-calendar-table.c index 5b11c4420a..63408e9a29 100644 --- a/calendar/gui/e-calendar-table.c +++ b/calendar/gui/e-calendar-table.c @@ -88,8 +88,6 @@ static gint e_calendar_table_on_key_press (ETable *table, static struct tm e_calendar_table_get_current_time (ECellDateEdit *ecde, gpointer data); static void mark_row_complete_cb (int model_row, gpointer data); -static ECalModelComponent *get_selected_comp (ECalendarTable *cal_table); -static void open_task (ECalendarTable *cal_table, ECalModelComponent *comp_data, gboolean assign); /* Signal IDs */ enum { @@ -594,7 +592,7 @@ e_calendar_table_open_selected (ECalendarTable *cal_table) comp_data = get_selected_comp (cal_table); prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_ATTENDEE_PROPERTY); if (comp_data != NULL) - open_task (cal_table, comp_data, prop ? TRUE : FALSE); + e_calendar_table_open_task (cal_table, comp_data, prop ? TRUE : FALSE); } /** @@ -630,8 +628,8 @@ get_selected_row_cb (int model_row, gpointer data) /* Returns the component that is selected in the table; only works if there is * one and only one selected row. */ -static ECalModelComponent * -get_selected_comp (ECalendarTable *cal_table) +ECalModelComponent * +e_calendar_table_get_selected_comp (ECalendarTable *cal_table) { ETable *etable; int row; @@ -732,7 +730,7 @@ e_calendar_table_delete_selected (ECalendarTable *cal_table) return; if (n_selected == 1) - comp_data = get_selected_comp (cal_table); + comp_data = e_calendar_table_get_selected_comp (cal_table); else comp_data = NULL; @@ -935,8 +933,8 @@ e_calendar_table_paste_clipboard (ECalendarTable *cal_table) } /* Opens a task in the task editor */ -static void -open_task (ECalendarTable *cal_table, ECalModelComponent *comp_data, gboolean assign) +void +e_calendar_table_open_task (ECalendarTable *cal_table, ECalModelComponent *comp_data, gboolean assign) { CompEditor *tedit; const char *uid; @@ -970,7 +968,7 @@ open_task_by_row (ECalendarTable *cal_table, int row) comp_data = e_cal_model_get_component_at (cal_table->model, row); prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_ATTENDEE_PROPERTY); - open_task (cal_table, comp_data, prop ? TRUE : FALSE); + e_calendar_table_open_task (cal_table, comp_data, prop ? TRUE : FALSE); } static void @@ -992,10 +990,10 @@ e_calendar_table_on_open_task (EPopup *ep, EPopupItem *pitem, void *data) 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) - open_task (cal_table, comp_data, prop ? TRUE : FALSE); + e_calendar_table_open_task (cal_table, comp_data, prop ? TRUE : FALSE); } static void @@ -1007,7 +1005,7 @@ e_calendar_table_on_save_as (EPopup *ep, EPopupItem *pitem, void *data) char *ical_string; FILE *file; - comp_data = get_selected_comp (cal_table); + comp_data = e_calendar_table_get_selected_comp (cal_table); if (comp_data == NULL) return; @@ -1039,7 +1037,7 @@ e_calendar_table_on_print_task (EPopup *ep, EPopupItem *pitem, void *data) ECalModelComponent *comp_data; ECalComponent *comp; - comp_data = get_selected_comp (cal_table); + comp_data = e_calendar_table_get_selected_comp (cal_table); if (comp_data == NULL) return; @@ -1080,9 +1078,9 @@ e_calendar_table_on_assign (EPopup *ep, EPopupItem *pitem, void *data) ECalendarTable *cal_table = data; ECalModelComponent *comp_data; - comp_data = get_selected_comp (cal_table); + comp_data = e_calendar_table_get_selected_comp (cal_table); if (comp_data) - open_task (cal_table, comp_data, TRUE); + e_calendar_table_open_task (cal_table, comp_data, TRUE); } static void @@ -1091,7 +1089,7 @@ e_calendar_table_on_forward (EPopup *ep, EPopupItem *pitem, void *data) ECalendarTable *cal_table = data; ECalModelComponent *comp_data; - comp_data = get_selected_comp (cal_table); + comp_data = e_calendar_table_get_selected_comp (cal_table); if (comp_data) { ECalComponent *comp; @@ -1132,7 +1130,7 @@ open_url_cb (EPopup *ep, EPopupItem *pitem, void *data) ECalModelComponent *comp_data; icalproperty *prop; - comp_data = get_selected_comp (cal_table); + comp_data = e_calendar_table_get_selected_comp (cal_table); if (!comp_data) return; diff --git a/calendar/gui/e-calendar-table.h b/calendar/gui/e-calendar-table.h index 9c8d7087d0..04006f1157 100644 --- a/calendar/gui/e-calendar-table.h +++ b/calendar/gui/e-calendar-table.h @@ -104,6 +104,10 @@ void e_calendar_table_set_activity_handler (ECalendarTable *cal_table, void e_calendar_table_set_status_message (ECalendarTable *cal_table, const gchar *message, int percent); +void e_calendar_table_open_task (ECalendarTable *cal_table, + ECalModelComponent *comp_data, + gboolean assign); +ECalModelComponent * e_calendar_table_get_selected_comp (ECalendarTable *cal_table); G_END_DECLS diff --git a/calendar/gui/tasks-control.c b/calendar/gui/tasks-control.c index 27a378d439..0931215112 100644 --- a/calendar/gui/tasks-control.c +++ b/calendar/gui/tasks-control.c @@ -54,6 +54,7 @@ #include "tasks-control.h" #include "evolution-shell-component-utils.h" #include "e-util/e-menu.h" +#include "itip-utils.h" #define FIXED_MARGIN .05 @@ -91,8 +92,15 @@ static void tasks_control_print_cmd (BonoboUIComponent *uic, static void tasks_control_print_preview_cmd (BonoboUIComponent *uic, gpointer data, const char *path); +static void tasks_control_assign_cmd (BonoboUIComponent *uic, + gpointer data, + const char *path); +static void tasks_control_forward_cmd (BonoboUIComponent *uic, + gpointer data, + const char *path); + BonoboControl * tasks_control_new (void) { @@ -142,6 +150,10 @@ tasks_control_sensitize_commands (BonoboControl *control, ETasks *tasks, int n_s gboolean read_only = TRUE; ECal *ecal; ECalModel *model; + ECalendarTable *cal_table; + ECalModelComponent *comp_data; + icalproperty *prop; + gboolean is_assigned = FALSE; uic = bonobo_control_get_ui_component (control); g_assert (uic != NULL); @@ -149,10 +161,20 @@ tasks_control_sensitize_commands (BonoboControl *control, ETasks *tasks, int n_s if (bonobo_ui_component_get_container (uic) == CORBA_OBJECT_NIL) return; - model = e_calendar_table_get_model (e_tasks_get_calendar_table (tasks)); + cal_table = e_tasks_get_calendar_table (tasks); + model = e_calendar_table_get_model (cal_table); + + 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) + + 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", @@ -175,6 +197,12 @@ tasks_control_sensitize_commands (BonoboControl *control, ETasks *tasks, int n_s 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); } /* Callback used when the selection in the table changes */ @@ -199,7 +227,9 @@ static BonoboUIVerb verbs [] = { BONOBO_UI_VERB ("TasksPurge", tasks_control_purge_cmd), BONOBO_UI_VERB ("TasksPrint", tasks_control_print_cmd), BONOBO_UI_VERB ("TasksPrintPreview", tasks_control_print_preview_cmd), - + BONOBO_UI_VERB ("TasksAssign", tasks_control_assign_cmd), + BONOBO_UI_VERB ("TasksForward", tasks_control_forward_cmd), + BONOBO_UI_VERB_END }; @@ -436,3 +466,39 @@ tasks_control_print_preview_cmd (BonoboUIComponent *uic, print_tasks (tasks, TRUE); } +static void +tasks_control_assign_cmd (BonoboUIComponent *uic, + gpointer data, + const char *path) +{ + ETasks *tasks; + ECalendarTable *cal_table; + ECalModelComponent *comp_data; + + tasks = E_TASKS (data); + cal_table = e_tasks_get_calendar_table (tasks); + comp_data = e_calendar_table_get_selected_comp (cal_table); + if (comp_data) + e_calendar_table_open_task (cal_table, comp_data, TRUE); +} + +static void +tasks_control_forward_cmd (BonoboUIComponent *uic, + gpointer data, + const char *path) +{ + ETasks *tasks; + ECalendarTable *cal_table; + ECalModelComponent *comp_data; + + tasks = E_TASKS (data); + cal_table = e_tasks_get_calendar_table (tasks); + comp_data = e_calendar_table_get_selected_comp (cal_table); + if (comp_data) { + ECalComponent *comp; + comp = e_cal_component_new (); + e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (comp_data->icalcomp)); + itip_send_comp (E_CAL_COMPONENT_METHOD_PUBLISH, comp, comp_data->client, NULL, NULL); + g_object_unref (comp); + } +} |