aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCody Russell <crussell@canonical.com>2010-07-20 10:52:31 +0200
committerCody Russell <crussell@canonical.com>2010-07-20 10:52:31 +0200
commit91975606424c3926d46344fdf3775eab11529bb2 (patch)
tree6ab9f37d15f25748ce526afe651307c1bda3e19b /src
parent8ae5a81a14b919d55970608cb539fd3d91206d22 (diff)
downloadayatana-ido-91975606424c3926d46344fdf3775eab11529bb2.tar.gz
ayatana-ido-91975606424c3926d46344fdf3775eab11529bb2.tar.bz2
ayatana-ido-91975606424c3926d46344fdf3775eab11529bb2.zip
Calendar keyboard navigation.
Diffstat (limited to 'src')
-rw-r--r--src/idocalendarmenuitem.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/idocalendarmenuitem.c b/src/idocalendarmenuitem.c
index f9d1532..9ad68bb 100644
--- a/src/idocalendarmenuitem.c
+++ b/src/idocalendarmenuitem.c
@@ -32,6 +32,9 @@ static gboolean ido_calendar_menu_item_button_release (GtkWidget *widget
GdkEventButton *event);
static gboolean ido_calendar_menu_item_button_press (GtkWidget *widget,
GdkEventButton *event);
+static gboolean ido_calendar_menu_item_key_press (GtkWidget *widget,
+ GdkEventKey *event,
+ gpointer data);
static void ido_calendar_menu_item_send_focus_change (GtkWidget *widget,
gboolean in);
static void calendar_realized_cb (GtkWidget *widget,
@@ -139,6 +142,36 @@ ido_calendar_menu_item_send_focus_change (GtkWidget *widget,
}
static gboolean
+ido_calendar_menu_item_key_press (GtkWidget *widget,
+ GdkEventKey *event,
+ gpointer data)
+{
+ IdoCalendarMenuItem *menuitem = (IdoCalendarMenuItem *)data;
+
+ if (menuitem->priv->selected)
+ {
+ GtkWidget *calendar = menuitem->priv->calendar;
+
+ gtk_widget_event (calendar,
+ ((GdkEvent *)(void*)(event)));
+
+ if (calendar->window != NULL)
+ {
+ gdk_window_raise (calendar->window);
+ }
+
+ if (!gtk_widget_has_focus (calendar))
+ {
+ gtk_widget_grab_focus (calendar);
+ }
+
+ return event->keyval != GDK_Return;
+ }
+
+ return FALSE;
+}
+
+static gboolean
ido_calendar_menu_item_button_press (GtkWidget *widget,
GdkEventButton *event)
{
@@ -203,6 +236,11 @@ calendar_realized_cb (GtkWidget *widget,
gdk_window_raise (widget->window);
}
+ g_signal_connect (GTK_WIDGET (item)->parent,
+ "key-press-event",
+ G_CALLBACK (ido_calendar_menu_item_key_press),
+ item);
+
ido_calendar_menu_item_send_focus_change (widget, TRUE);
}