[sound-juicer/wip/better-editing: 13/13] Move focus when 'Enter' is pressed
- From: Phillip Wood <pwood src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [sound-juicer/wip/better-editing: 13/13] Move focus when 'Enter' is pressed
- Date: Fri, 25 Jul 2014 08:55:23 +0000 (UTC)
commit 063c61003f0c4268a88992ccbb012bcefcc3c69c
Author: Phillip Wood <phillip wood dunelm org uk>
Date: Wed Jun 25 10:25:09 2014 +0100
Move focus when 'Enter' is pressed
When the user presses enter in a GtkEntry move the focus to the next
widget as recommended in GNOME HIG when there is no default widget.
https://bugzilla.gnome.org/show_bug.cgi?id=151469
data/sound-juicer.ui | 6 ++++++
src/sj-main.c | 12 ++++++++++++
2 files changed, 18 insertions(+), 0 deletions(-)
---
diff --git a/data/sound-juicer.ui b/data/sound-juicer.ui
index 3b610e4..e553c3c 100644
--- a/data/sound-juicer.ui
+++ b/data/sound-juicer.ui
@@ -45,6 +45,7 @@
<object class="GtkEntry" id="genre_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <signal name="activate" handler="on_activate_move_focus"/>
<signal name="changed" handler="on_genre_edit_changed"/>
</object>
<packing>
@@ -77,6 +78,7 @@
<property name="can_focus">True</property>
<property name="width_chars">4</property>
<property name="max_width_chars">4</property>
+ <signal name="activate" handler="on_activate_move_focus"/>
<accessibility>
<relation type="labelled-by" target="label4"/>
</accessibility>
@@ -113,6 +115,7 @@
<property name="can_focus">True</property>
<property name="width_chars">2</property>
<property name="max_width_chars">2</property>
+ <signal name="activate" handler="on_activate_move_focus"/>
<accessibility>
<relation type="labelled-by" target="label6"/>
</accessibility>
@@ -153,6 +156,7 @@
<object class="GtkEntry" id="title_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <signal name="activate" handler="on_activate_move_focus"/>
<signal name="changed" handler="on_title_edit_changed" after="yes"/>
</object>
<packing>
@@ -183,6 +187,7 @@
<object class="GtkEntry" id="artist_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <signal name="activate" handler="on_activate_move_focus"/>
<signal name="changed" handler="on_person_edit_changed" after="yes"/>
</object>
<packing>
@@ -215,6 +220,7 @@
<object class="GtkEntry" id="composer_entry">
<property name="visible">False</property>
<property name="can_focus">True</property>
+ <signal name="activate" handler="on_activate_move_focus"/>
<signal name="changed" handler="on_person_edit_changed" after="yes"/>
</object>
<packing>
diff --git a/src/sj-main.c b/src/sj-main.c
index a401464..13536e5 100644
--- a/src/sj-main.c
+++ b/src/sj-main.c
@@ -64,6 +64,7 @@ G_MODULE_EXPORT void on_title_edit_changed(GtkEditable *widget, gpointer user_da
G_MODULE_EXPORT void on_person_edit_changed(GtkEditable *widget, gpointer user_data);
G_MODULE_EXPORT void on_year_edit_changed(GtkEditable *widget, gpointer user_data);
G_MODULE_EXPORT void on_disc_number_edit_changed(GtkEditable *widget, gpointer user_data);
+G_MODULE_EXPORT void on_activate_move_focus (GtkWidget *widget, gpointer data);
GtkBuilder *builder;
@@ -1611,6 +1612,17 @@ static void on_reread_activate (GSimpleAction *action, GVariant *parameter, gpoi
}
/**
+ * Move focus to next widget when GtkEntry is activated
+ */
+G_MODULE_EXPORT void on_activate_move_focus (GtkWidget *widget,
+ gpointer data)
+{
+ gboolean ret_val;
+
+ g_signal_emit_by_name (widget, "move-focus", GTK_DIR_TAB_FORWARD, &ret_val);
+}
+
+/**
* If path is selected call func on all selected rows, if not call
* func only on path.
*/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]