[evolution] Bug #203853 - Cut/Copy key bindings don't work in day and week views



commit c9f8c3ba925139249e80a251a6758351d0bff0b5
Author: Milan Crha <mcrha redhat com>
Date:   Mon Jul 27 17:43:02 2009 +0200

    Bug #203853 - Cut/Copy key bindings don't work in day and week views

 calendar/gui/calendar-commands.c |    8 ++++----
 calendar/gui/e-day-view.c        |    2 ++
 calendar/gui/gnome-cal.c         |    9 ++++++---
 3 files changed, 12 insertions(+), 7 deletions(-)
---
diff --git a/calendar/gui/calendar-commands.c b/calendar/gui/calendar-commands.c
index 7edf38d..8e50899 100644
--- a/calendar/gui/calendar-commands.c
+++ b/calendar/gui/calendar-commands.c
@@ -367,7 +367,7 @@ sensitize_items(BonoboUIComponent *uic, struct _sensitize_item *items, guint32 m
 
 static struct _sensitize_item calendar_sensitize_table[] = {
 	{ "EventOpen", E_CAL_MENU_SELECT_ONE },
-	{ "Cut", E_CAL_MENU_SELECT_EDITABLE },
+	{ "Cut", E_CAL_MENU_SELECT_EDITABLE | E_CAL_MENU_SELECT_ANY },
 	{ "Copy", E_CAL_MENU_SELECT_ANY },
 	{ "Paste", E_CAL_MENU_SELECT_EDITABLE },
 	{ "Delete", E_CAL_MENU_SELECT_EDITABLE|E_CAL_MENU_SELECT_NONRECURRING },
@@ -413,7 +413,7 @@ calendar_control_sensitize_calendar_commands (BonoboControl *control, GnomeCalen
 
 	t = e_cal_menu_target_new_select(menu, model, events);
 	if (!enable)
-		t->target.mask = ~0;
+		t->target.mask = ~((~t->target.mask) & E_CAL_MENU_SELECT_EDITABLE);
 
 	sensitize_items(uic, calendar_sensitize_table, t->target.mask);
 #if 0
@@ -429,7 +429,7 @@ calendar_control_sensitize_calendar_commands (BonoboControl *control, GnomeCalen
 }
 
 static struct _sensitize_item taskpad_sensitize_table[] = {
-	{ "Cut", E_CAL_MENU_SELECT_EDITABLE },
+	{ "Cut", E_CAL_MENU_SELECT_EDITABLE | E_CAL_MENU_SELECT_ANY },
 	{ "Copy", E_CAL_MENU_SELECT_ANY },
 	{ "Paste", E_CAL_MENU_SELECT_EDITABLE },
 	{ "Delete", E_CAL_MENU_SELECT_EDITABLE },
@@ -465,7 +465,7 @@ sensitize_taskpad_commands (GnomeCalendar *gcal, BonoboControl *control, gboolea
 
 	t = e_cal_menu_target_new_select(menu, model, events);
 	if (!enable)
-		t->target.mask = ~0;
+		t->target.mask = ~((~t->target.mask) & E_CAL_MENU_SELECT_EDITABLE);
 
 	sensitize_items(uic, taskpad_sensitize_table, t->target.mask);
 }
diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c
index 8cc0405..6928a7e 100644
--- a/calendar/gui/e-day-view.c
+++ b/calendar/gui/e-day-view.c
@@ -1774,9 +1774,11 @@ e_day_view_remove_event_cb (EDayView *day_view,
 	if (day == E_DAY_VIEW_LONG_EVENT) {
 		g_array_remove_index (day_view->long_events, event_num);
 		day_view->long_events_need_layout = TRUE;
+		gtk_widget_grab_focus (GTK_WIDGET (day_view->top_canvas));
 	} else {
 		g_array_remove_index (day_view->events[day], event_num);
 		day_view->need_layout[day] = TRUE;
+		gtk_widget_grab_focus (GTK_WIDGET (day_view->main_canvas));
 	}
 	return TRUE;
 }
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index adfcdac..576dfc8 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -766,7 +766,8 @@ get_focus_location (GnomeCalendar *gcal)
 			if (GTK_WIDGET_HAS_FOCUS (dv->top_canvas)
 			    || GNOME_CANVAS (dv->top_canvas)->focused_item != NULL
 			    || GTK_WIDGET_HAS_FOCUS (dv->main_canvas)
-			    || GNOME_CANVAS (dv->main_canvas)->focused_item != NULL)
+			    || GNOME_CANVAS (dv->main_canvas)->focused_item != NULL
+			    || GTK_WIDGET_HAS_FOCUS (dv))
 				return FOCUS_CALENDAR;
 			else
 				return FOCUS_OTHER;
@@ -776,7 +777,8 @@ get_focus_location (GnomeCalendar *gcal)
 			wv = E_WEEK_VIEW (widget);
 
 			if (GTK_WIDGET_HAS_FOCUS (wv->main_canvas)
-			    || GNOME_CANVAS (wv->main_canvas)->focused_item != NULL)
+			    || GNOME_CANVAS (wv->main_canvas)->focused_item != NULL
+			    || GTK_WIDGET_HAS_FOCUS (wv))
 				return FOCUS_CALENDAR;
 			else
 				return FOCUS_OTHER;
@@ -784,7 +786,8 @@ get_focus_location (GnomeCalendar *gcal)
 		case GNOME_CAL_LIST_VIEW:
 			lv = E_CAL_LIST_VIEW (widget);
 
-			if (GTK_WIDGET_HAS_FOCUS (e_table_scrolled_get_table (lv->table_scrolled)))
+			if (GTK_WIDGET_HAS_FOCUS (e_table_scrolled_get_table (lv->table_scrolled))
+			    || GTK_WIDGET_HAS_FOCUS (lv))
 				return FOCUS_CALENDAR;
 			else
 				return FOCUS_OTHER;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]