[evolution-patches] Keybindings for switching between Calendar Views (UI Hackfest)
- From: Harish Krishnaswamy <kharish novell com>
- To: evolution-patches <evolution-patches lists ximian com>
- Subject: [evolution-patches] Keybindings for switching between Calendar Views (UI Hackfest)
- Date: Thu, 21 Jul 2005 15:46:39 +0530
Kindly review the same.
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/calendar/ChangeLog,v
retrieving revision 1.2773
diff -u -p -r1.2773 ChangeLog
--- ChangeLog 20 Jul 2005 12:22:24 -0000 1.2773
+++ ChangeLog 21 Jul 2005 10:06:59 -0000
@@ -1,3 +1,12 @@
+2005-07-21 Harish Krishnaswamy <kharish novell com>
+
+ * gui/gnome-cal.c (gnome_calendar_class_init),
+ (adjust_e_cal_view_sexp), (display_view),
+ (gnome_calendar_view_changed):
+ * gui/gnome-cal.h:
+ Fixes #245331. Keybindings for switching b/w
+ calendar views.
+
2005-07-20 Chenthill Palanisamy <pchenthill novell com>
Fixes #310340
Index: gui/gnome-cal.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/gnome-cal.c,v
retrieving revision 1.382
diff -u -p -r1.382 gnome-cal.c
--- gui/gnome-cal.c 11 Jul 2005 16:23:57 -0000 1.382
+++ gui/gnome-cal.c 21 Jul 2005 10:07:00 -0000
@@ -189,6 +189,7 @@ enum {
GOTO_DATE,
SOURCE_ADDED,
SOURCE_REMOVED,
+ VIEW_CHANGED,
LAST_SIGNAL
};
@@ -207,6 +208,8 @@ static guint gnome_calendar_signals[LAST
static void gnome_calendar_destroy (GtkObject *object);
static void gnome_calendar_goto_date (GnomeCalendar *gcal,
GnomeCalendarGotoDateType goto_date);
+static void gnome_calendar_view_changed (GnomeCalendar *gcal,
+ GnomeCalendarViewType view_type);
static void gnome_calendar_set_pane_positions (GnomeCalendar *gcal);
static void update_view_times (GnomeCalendar *gcal, time_t start_time);
@@ -314,6 +317,17 @@ gnome_calendar_class_init (GnomeCalendar
1,
G_TYPE_INT);
+ gnome_calendar_signals[VIEW_CHANGED] =
+ g_signal_new ("view_changed",
+ G_TYPE_FROM_CLASS (object_class),
+ G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (GnomeCalendarClass, view_changed),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__INT,
+ G_TYPE_NONE,
+ 1,
+ G_TYPE_INT);
+
object_class->destroy = gnome_calendar_destroy;
class->dates_shown_changed = NULL;
@@ -324,6 +338,7 @@ gnome_calendar_class_init (GnomeCalendar
class->source_added = NULL;
class->source_removed = NULL;
class->goto_date = gnome_calendar_goto_date;
+ class->view_changed = gnome_calendar_view_changed;
/*
* Key bindings
@@ -396,6 +411,35 @@ gnome_calendar_class_init (GnomeCalendar
"goto_date",1,
G_TYPE_ENUM,
GNOME_CAL_GOTO_SAME_DAY_OF_NEXT_WEEK);
+
+ /* Ctrl+Alt+ Y/W/E/M/L to switch between
+ * DayView/WorkWeekView/WeekView/MonthView/ListView */
+ gtk_binding_entry_add_signal (binding_set, GDK_y,
+ GDK_CONTROL_MASK | GDK_MOD1_MASK,
+ "view_changed", 1,
+ G_TYPE_ENUM,
+ GNOME_CAL_DAY_VIEW);
+ gtk_binding_entry_add_signal (binding_set, GDK_w,
+ GDK_CONTROL_MASK | GDK_MOD1_MASK,
+ "view_changed", 1,
+ G_TYPE_ENUM,
+ GNOME_CAL_WORK_WEEK_VIEW);
+ gtk_binding_entry_add_signal (binding_set, GDK_e,
+ GDK_CONTROL_MASK | GDK_MOD1_MASK,
+ "view_changed", 1,
+ G_TYPE_ENUM,
+ GNOME_CAL_WEEK_VIEW);
+ gtk_binding_entry_add_signal (binding_set, GDK_m,
+ GDK_CONTROL_MASK | GDK_MOD1_MASK,
+ "view_changed", 1,
+ G_TYPE_ENUM,
+ GNOME_CAL_MONTH_VIEW);
+ gtk_binding_entry_add_signal (binding_set, GDK_l,
+ GDK_CONTROL_MASK | GDK_MOD1_MASK,
+ "view_changed", 1,
+ G_TYPE_ENUM,
+ GNOME_CAL_LIST_VIEW);
+
/* init the accessibility support for gnome_calendar */
gnome_calendar_a11y_init ();
@@ -697,8 +741,6 @@ adjust_e_cal_view_sexp (GnomeCalendar *g
" %s)",
start, end,
sexp);
-
-
g_free (start);
g_free (end);
@@ -1933,6 +1975,14 @@ display_view (GnomeCalendar *gcal, Gnome
g_object_set (G_OBJECT (priv->date_navigator->calitem),
"preserve_day_when_moving", preserve_day,
NULL);
+}
+
+static void gnome_calendar_view_changed (GnomeCalendar *gcal, GnomeCalendarViewType view_type)
+{
+ if (gnome_calendar_get_view(gcal) == view_type)
+ return;
+
+ gnome_calendar_set_view(gcal, view_type);
}
/* Callback used when the view collection asks us to display a particular view */
Index: gui/gnome-cal.h
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/gnome-cal.h,v
retrieving revision 1.104
diff -u -p -r1.104 gnome-cal.h
--- gui/gnome-cal.h 11 Jul 2005 16:23:57 -0000 1.104
+++ gui/gnome-cal.h 21 Jul 2005 10:07:00 -0000
@@ -89,6 +89,8 @@ struct _GnomeCalendarClass {
void (* calendar_focus_change) (GnomeCalendar *gcal, gboolean in);
void (* taskpad_focus_change) (GnomeCalendar *gcal, gboolean in);
+ void (* view_changed) (GnomeCalendar *gcal,
+ GnomeCalendarViewType view_type);
void (* source_added) (GnomeCalendar *gcal, ECalSourceType source_type, ESource *source);
void (* source_removed) (GnomeCalendar *gcal, ECalSourceType source_type, ESource *source);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]