[sound-juicer] Add "{Un,}Select All" button
- From: Christophe Fergeau <teuf src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [sound-juicer] Add "{Un,}Select All" button
- Date: Sat, 1 Sep 2012 17:03:42 +0000 (UTC)
commit 42118ab6f7ec5abf336a3eda8a1640a651bc7658
Author: Christophe Fergeau <cfergeau redhat com>
Date: Sun Aug 12 18:13:48 2012 +0200
Add "{Un,}Select All" button
The Unselect all/Select all menu entries have been removed as part
of the addition of the app menu an were only accessible through a
keyboard shortcut. After a discussion with the design team, readd
a button to provide this functionality.
https://bugzilla.gnome.org/show_bug.cgi?id=675245
data/sound-juicer.ui | 15 +++++++++++++++
src/sj-main.c | 33 ++++++++++++++++++++++++++++++++-
2 files changed, 47 insertions(+), 1 deletions(-)
---
diff --git a/data/sound-juicer.ui b/data/sound-juicer.ui
index 1ff2dff..a074931 100644
--- a/data/sound-juicer.ui
+++ b/data/sound-juicer.ui
@@ -366,6 +366,21 @@ audio-volume-medium</property>
<property name="position">2</property>
</packing>
</child>
+ <child>
+ <object class="GtkButton" id="select_button">
+ <property name="label">placeholder</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="receives_default">False</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="pack_type">end</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="expand">False</property>
diff --git a/src/sj-main.c b/src/sj-main.c
index b4625e9..8532dca 100644
--- a/src/sj-main.c
+++ b/src/sj-main.c
@@ -75,7 +75,7 @@ GConfClient *gconf_client;
GtkWidget *main_window;
static GtkWidget *message_area_eventbox;
static GtkWidget *title_entry, *artist_entry, *duration_label, *genre_entry, *year_entry, *disc_number_entry;
-static GtkWidget *track_listview, *extract_button, *play_button;
+static GtkWidget *track_listview, *extract_button, *play_button, *select_button;
static GtkWidget *status_bar;
GtkListStore *track_store;
GtkCellRenderer *toggle_renderer, *title_renderer, *artist_renderer;
@@ -266,6 +266,9 @@ static void on_select_all_activate (GSimpleAction *action, GVariant *parameter,
set_action_enabled ("select-all", FALSE);
set_action_enabled ("deselect-all", TRUE);
+ gtk_actionable_set_action_name(GTK_ACTIONABLE(select_button), "win.deselect-all");
+ gtk_button_set_label(GTK_BUTTON(select_button), _("Select None"));
+
no_of_tracks_selected = total_no_of_tracks;
}
@@ -277,6 +280,9 @@ static void on_deselect_all_activate (GSimpleAction *action, GVariant *parameter
set_action_enabled ("deselect-all", FALSE);
set_action_enabled ("select-all", TRUE);
+ gtk_actionable_set_action_name(GTK_ACTIONABLE(select_button), "win.select-all");
+ gtk_button_set_label(GTK_BUTTON(select_button), _("Select All"));
+
no_of_tracks_selected = 0;
}
@@ -1718,11 +1724,14 @@ startup_cb (GApplication *app, gpointer user_data)
track_listview = GET_WIDGET ("track_listview");
extract_button = GET_WIDGET ("extract_button");
play_button = GET_WIDGET ("play_button");
+ select_button = GET_WIDGET ("select_button");
status_bar = GET_WIDGET ("status_bar");
g_action_map_add_action_entries (G_ACTION_MAP (main_window),
win_entries, G_N_ELEMENTS (win_entries),
NULL);
+ gtk_button_set_label(GTK_BUTTON(select_button), _("Select None"));
+ gtk_actionable_set_action_name(GTK_ACTIONABLE(select_button), "win.deselect-all");
gtk_actionable_set_action_name(GTK_ACTIONABLE(play_button), "win.play");
/* window actions are only available via shortcuts */
@@ -1759,6 +1768,28 @@ startup_cb (GApplication *app, gpointer user_data)
g_object_unref (G_OBJECT (size_group));
}
+ { /* ensure that the select/unselect button's size is constant */
+ GtkWidget *fake_button1, *fake_button2;
+ GtkSizeGroup *size_group;
+
+ size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
+
+ fake_button1 = gtk_button_new_with_label (_("Select All"));
+ gtk_size_group_add_widget (size_group, fake_button1);
+ g_signal_connect_swapped (select_button, "destroy",
+ G_CALLBACK (gtk_widget_destroy),
+ fake_button1);
+
+ fake_button2 = gtk_button_new_with_label (_("Select None"));
+ gtk_size_group_add_widget (size_group, fake_button2);
+ g_signal_connect_swapped (select_button, "destroy",
+ G_CALLBACK (gtk_widget_destroy),
+ fake_button2);
+
+ gtk_size_group_add_widget (size_group, select_button);
+ g_object_unref (G_OBJECT (size_group));
+ }
+
setup_genre_entry (genre_entry);
track_store = gtk_list_store_new (COLUMN_TOTAL, G_TYPE_INT, G_TYPE_BOOLEAN, G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT, G_TYPE_POINTER);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]