Re: [evolution-patches] calendar, mail and exchange: patch for bug #231968
- From: shakti <shprasad novell com>
- To: chenthill <pchenthill novell com>
- Cc: evolution-patches lists ximian com
- Subject: Re: [evolution-patches] calendar, mail and exchange: patch for bug #231968
- Date: Mon, 01 Aug 2005 17:47:15 +0530
Oh ok, I have done this now. Please review it.
Thanks,
Shakti
On Mon, 2005-08-01 at 17:21 +0530, chenthill wrote:
> if (icalcomponent_get_first_property (comp_data->icalcomp,
> ICAL_ATTENDEE_PROPERTY))
> + mask &= ~E_CAL_MENU_SELECT_ASSIGNABLE;
> The mask should be set only if the task is not assigned one. The
> existing check pasted below should be included.
>
> 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))
>
> thanks, chenthill.
>
>
>
> On Fri, 2005-07-29 at 12:06 +0530, shakti wrote:
> > Yeah, I did a mistake there. Now I am not creating a new mask but
> > setting the mask for 'ICAL_ATTENDEE_PROPERTY' in e-cal-menu.c file.
> >
> > Please review the patch.
> >
> > Thanks,
> > Shakti
> >
> _______________________________________________
> evolution-patches mailing list
> evolution-patches lists ximian com
> http://lists.ximian.com/mailman/listinfo/evolution-patches
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/calendar/ChangeLog,v
retrieving revision 1.2782
diff -u -p -r1.2782 ChangeLog
--- ChangeLog 29 Jul 2005 05:10:11 -0000 1.2782
+++ ChangeLog 1 Aug 2005 12:15:17 -0000
@@ -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>
Index: gui/e-cal-menu.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-cal-menu.c,v
retrieving revision 1.3
diff -u -p -r1.3 e-cal-menu.c
--- gui/e-cal-menu.c 1 Feb 2005 15:51:26 -0000 1.3
+++ gui/e-cal-menu.c 1 Aug 2005 12:15:17 -0000
@@ -144,6 +144,11 @@ e_cal_menu_target_new_select(ECalMenu *e
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 *e
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 ... */
Index: gui/e-calendar-table.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-calendar-table.c,v
retrieving revision 1.136
diff -u -p -r1.136 e-calendar-table.c
--- gui/e-calendar-table.c 25 Jul 2005 07:53:18 -0000 1.136
+++ gui/e-calendar-table.c 1 Aug 2005 12:15:17 -0000
@@ -589,7 +589,7 @@ e_calendar_table_open_selected (ECalenda
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);
Index: gui/e-tasks.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-tasks.c,v
retrieving revision 1.117
diff -u -p -r1.117 e-tasks.c
--- gui/e-tasks.c 22 Jul 2005 07:38:37 -0000 1.117
+++ gui/e-tasks.c 1 Aug 2005 12:15:17 -0000
@@ -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,
}
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);
Index: gui/e-tasks.h
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-tasks.h,v
retrieving revision 1.24
diff -u -p -r1.24 e-tasks.h
--- gui/e-tasks.h 29 Apr 2004 19:36:53 -0000 1.24
+++ gui/e-tasks.h 1 Aug 2005 12:15:17 -0000
@@ -82,6 +82,7 @@ void e_tasks_delete_completed (ET
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_ */
Index: gui/tasks-control.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/tasks-control.c,v
retrieving revision 1.81
diff -u -p -r1.81 tasks-control.c
--- gui/tasks-control.c 25 Jul 2005 07:53:18 -0000 1.81
+++ gui/tasks-control.c 1 Aug 2005 12:15:18 -0000
@@ -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 (BonoboContro
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 (Bonobo
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 (Bonobo
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 *c
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
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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]