aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/e-day-view.c
diff options
context:
space:
mode:
authorDamon Chaplin <damon@ximian.com>2001-03-05 08:11:35 +0800
committerDamon Chaplin <damon@src.gnome.org>2001-03-05 08:11:35 +0800
commitd842e1a20e3ab2fd38582d2ccc863e4bbcb87d0d (patch)
tree9bd19bd8db1552c3f7d66a75f5c98ef2a102d891 /calendar/gui/e-day-view.c
parent7b7acde405898803001e1614e6ffd15df7682391 (diff)
downloadgsoc2013-evolution-d842e1a20e3ab2fd38582d2ccc863e4bbcb87d0d.tar
gsoc2013-evolution-d842e1a20e3ab2fd38582d2ccc863e4bbcb87d0d.tar.gz
gsoc2013-evolution-d842e1a20e3ab2fd38582d2ccc863e4bbcb87d0d.tar.bz2
gsoc2013-evolution-d842e1a20e3ab2fd38582d2ccc863e4bbcb87d0d.tar.lz
gsoc2013-evolution-d842e1a20e3ab2fd38582d2ccc863e4bbcb87d0d.tar.xz
gsoc2013-evolution-d842e1a20e3ab2fd38582d2ccc863e4bbcb87d0d.tar.zst
gsoc2013-evolution-d842e1a20e3ab2fd38582d2ccc863e4bbcb87d0d.zip
keep list of all Tasks folders so we can update the preference settings
2001-03-05 Damon Chaplin <damon@ximian.com> * gui/e-tasks.c: keep list of all Tasks folders so we can update the preference settings when necessary. * gui/gnome-cal.c: configure the TaskPad according to the settings. * gui/e-calendar-table.c: use ECellCombo and ECellDateEdit for fields, so the tasks folders is almost usable now. * gui/calendar-model.c: added support for the Status property. * gui/calendar-config.[hc]: added convenience functions to setup ECalendarTable and ECellDateEdit objects. * gui/calendar-commands.c: connected to "destroy" signal of calendars so we can remove them from all_calendars list. * gui/dialogs/cal-prefs-dialog.c (cal_prefs_dialog_update_config): call e_tasks_update_all_config_settings() to update all the settings in the Tasks folders as well. * cal-util/cal-component.h: added CAL_COMPONENT_FIELD_STATUS. * cal-util/cal-component.c (cal_component_get_transparency): fixed calls to strcasecmp so they check for '== 0'. Applied patch from Miguel... 2001-02-27 Miguel de Icaza <miguel@ximian.com> * gui/e-day-view.c (e_day_view_on_event_right_click): Reorganize the menus to have entries always in a consistent fashion, as reported to the genepool mailing list. (e_day_view_on_event_right_click): Added a FIXME comment to the FIXME comment without a FIXME. Now we use e_popup_menu. This allows us to hide/show items on demand, and to sensitize/de-sensitize items depending on their state. This will also let us add icon support (when we get nice icons for this) * gui/e-week-view.c (e_week_view_show_popup_menu): Ditto. The files popup-menu.c and popup-menu.h can now be removed. svn path=/trunk/; revision=8549
Diffstat (limited to 'calendar/gui/e-day-view.c')
-rw-r--r--calendar/gui/e-day-view.c153
1 files changed, 85 insertions, 68 deletions
diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c
index bbf0732122..537ef44ebc 100644
--- a/calendar/gui/e-day-view.c
+++ b/calendar/gui/e-day-view.c
@@ -38,10 +38,11 @@
#include "e-day-view-top-item.h"
#include "e-day-view-main-item.h"
#include "calendar-commands.h"
-#include "popup-menu.h"
#include <gal/widgets/e-canvas.h>
#include <gal/e-text/e-text.h>
#include <gal/widgets/e-canvas-utils.h>
+#include <gal/widgets/e-gui-utils.h>
+#include <gal/widgets/e-popup-menu.h>
#include "e-meeting-edit.h"
/* Images */
@@ -2989,63 +2990,96 @@ e_day_view_on_event_double_click (EDayView *day_view,
gint day,
gint event_num)
{
-#if 0
- g_print ("In e_day_view_on_event_double_click\n");
-#endif
-
}
+enum {
+ /*
+ * This is used to "flag" events that can not be editted
+ */
+ MASK_EDITABLE = 1,
-static void
-e_day_view_on_event_right_click (EDayView *day_view,
- GdkEventButton *bevent,
- gint day,
- gint event_num)
-{
- EDayViewEvent *event;
- int have_selection, not_being_edited, items, i;
- struct menu_item *context_menu;
-
- static struct menu_item main_items[] = {
- { N_("New appointment..."), (GtkSignalFunc) e_day_view_on_new_appointment, NULL, TRUE }
- };
-
- static struct menu_item child_items[] = {
- { N_("Schedule meeting"), (GtkSignalFunc) e_day_view_on_schedule_meet, NULL, TRUE },
+ /*
+ * To disable recurring actions to be displayed
+ */
+ MASK_RECURRING = 2,
- { NULL, NULL, NULL, TRUE},
+ /*
+ * To disable actions for non-recurring items to be displayed
+ */
+ MASK_SINGLE = 4,
- { N_("Edit this appointment..."), (GtkSignalFunc) e_day_view_on_edit_appointment, NULL, TRUE },
- { N_("Delete this appointment"), (GtkSignalFunc) e_day_view_on_delete_appointment, NULL, TRUE },
+ /*
+ * This is used to when an event is currently being edited
+ * in another window and we want to disable the event
+ * from being edited twice
+ */
+ MASK_EDITING = 8
+};
- { NULL, NULL, NULL, TRUE},
-
- { N_("New appointment..."), (GtkSignalFunc) e_day_view_on_new_appointment, NULL, TRUE }
- };
+static EPopupMenu main_items [] = {
+ { N_("New Appointment..."), NULL,
+ e_day_view_on_new_appointment, NULL, 0 },
+ { NULL, NULL, NULL, NULL, 0 }
+};
- static struct menu_item recur_child_items[] = {
- { N_("Make this appointment movable"), (GtkSignalFunc) e_day_view_on_unrecur_appointment, NULL, TRUE },
- { N_("Schedule meeting"), (GtkSignalFunc) e_day_view_on_schedule_meet, NULL, TRUE },
+static EPopupMenu child_items [] = {
+ { N_("Open"), NULL,
+ e_day_view_on_edit_appointment, NULL, MASK_EDITABLE | MASK_EDITING },
+ { N_("Delete this Appointment"), NULL,
+ e_day_view_on_delete_appointment, NULL, MASK_EDITABLE | MASK_SINGLE | MASK_EDITING },
+ { N_("Schedule Meeting"), NULL,
+ e_day_view_on_schedule_meet, NULL, MASK_EDITING },
+ { "", NULL, NULL, NULL, 0},
- { NULL, NULL, NULL, TRUE},
+ { N_("New Appointment..."), NULL,
+ e_day_view_on_new_appointment, NULL, 0 },
- { N_("Edit this appointment..."), (GtkSignalFunc) e_day_view_on_edit_appointment, NULL, TRUE },
- { N_("Delete this occurrence"), (GtkSignalFunc) e_day_view_on_delete_occurrence, NULL, TRUE },
- { N_("Delete all occurrences"), (GtkSignalFunc) e_day_view_on_delete_appointment, NULL, TRUE },
+ { "", NULL, NULL, NULL, MASK_SINGLE},
- { NULL, NULL, NULL, TRUE},
+ /*
+ * The following are only shown if this is a recurring event
+ */
+ { "", NULL, NULL, NULL, MASK_SINGLE},
+ { N_("Make this Occurrence Movable"), NULL,
+ e_day_view_on_unrecur_appointment, NULL, MASK_RECURRING | MASK_EDITING },
+ { N_("Delete this Occurrence"), NULL,
+ e_day_view_on_delete_occurrence, NULL, MASK_RECURRING | MASK_EDITING },
+ { N_("Delete all Occurrences"), NULL,
+ e_day_view_on_delete_appointment, NULL, MASK_RECURRING | MASK_EDITING },
+
+ { NULL, NULL, NULL, NULL, 0 }
+};
- { N_("New appointment..."), (GtkSignalFunc) e_day_view_on_new_appointment, NULL, TRUE },
- };
+static void
+e_day_view_on_event_right_click (EDayView *day_view,
+ GdkEventButton *bevent,
+ gint day,
+ gint event_num)
+{
+ EDayViewEvent *event;
+ int have_selection;
+ gboolean being_edited;
+ EPopupMenu *context_menu;
+ int hide_mask = 0;
+ int disable_mask = 0;
+ /*
+ * FIXME:
+ * This used to be set only if the event wasn't being edited
+ * in the event editor, but we can't check that at present.
+ * We could possibly set up another method of checking it.
+ */
+
+ being_edited = FALSE;
+
have_selection = GTK_WIDGET_HAS_FOCUS (day_view)
&& day_view->selection_start_day != -1;
- if (event_num == -1) {
- items = 1;
- context_menu = &main_items[0];
- context_menu[0].sensitive = have_selection;
- } else {
+ if (event_num == -1)
+ context_menu = main_items;
+ else {
+ context_menu = child_items;
+
if (day == E_DAY_VIEW_LONG_EVENT)
event = &g_array_index (day_view->long_events,
EDayViewEvent, event_num);
@@ -3053,36 +3087,19 @@ e_day_view_on_event_right_click (EDayView *day_view,
event = &g_array_index (day_view->events[day],
EDayViewEvent, event_num);
- /* This used to be set only if the event wasn't being edited
- in the event editor, but we can't check that at present.
- We could possibly set up another method of checking it. */
- not_being_edited = TRUE;
-
- if (cal_component_has_recurrences (event->comp)) {
- items = 8;
- context_menu = &recur_child_items[0];
- context_menu[0].sensitive = not_being_edited;
- context_menu[1].sensitive = not_being_edited;
- context_menu[3].sensitive = not_being_edited;
- context_menu[4].sensitive = not_being_edited;
- context_menu[5].sensitive = not_being_edited;
- context_menu[7].sensitive = have_selection;
- } else {
- items = 6;
- context_menu = &child_items[0];
- context_menu[0].sensitive = not_being_edited;
- context_menu[2].sensitive = not_being_edited;
- context_menu[3].sensitive = not_being_edited;
- context_menu[5].sensitive = have_selection;
- }
+ if (cal_component_has_recurrences (event->comp))
+ hide_mask |= MASK_SINGLE;
+ else
+ hide_mask |= MASK_RECURRING;
}
- for (i = 0; i < items; i++)
- context_menu[i].data = day_view;
+ if (being_edited)
+ disable_mask |= MASK_EDITING;
day_view->popup_event_day = day;
day_view->popup_event_num = event_num;
- popup_menu (context_menu, items, bevent);
+
+ e_popup_menu_run (context_menu, (GdkEvent *) bevent, disable_mask, hide_mask, day_view);
}