[sound-juicer] Move focus when 'Enter' is pressed
- From: Phillip Wood <pwood src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [sound-juicer] Move focus when 'Enter' is pressed
- Date: Fri, 15 Aug 2014 13:26:42 +0000 (UTC)
commit d05202b5b680fe63338d18547824bc601916b0ab
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 f1f38cb..13d288a 100644
--- a/data/sound-juicer.ui
+++ b/data/sound-juicer.ui
@@ -160,6 +160,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>
@@ -192,6 +193,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>
@@ -228,6 +230,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>
@@ -268,6 +271,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>
@@ -298,6 +302,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>
@@ -330,6 +335,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 e2232fd..2db6f3e 100644
--- a/src/sj-main.c
+++ b/src/sj-main.c
@@ -65,6 +65,7 @@ G_MODULE_EXPORT void on_person_edit_changed(GtkEditable *widget, gpointer user_d
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 submit_bar_response_cb (GtkInfoBar *infobar, int response_id, gpointer user_data);
+G_MODULE_EXPORT void on_activate_move_focus (GtkWidget *widget, gpointer data);
GtkBuilder *builder;
@@ -1505,6 +1506,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]