Root/gjay/patches/0012-Don-t-show-the-Music-Player-.-combo-box-unless-multi.patch

Source at commit 1b3135c created 9 years 10 days ago.
By Xiangfu Liu, new package: SDL-widgets: a GUI toolkit on top of the SDL libraries
1From c52d500e6834815d4425b376f66895eb9e517896 Mon Sep 17 00:00:00 2001
2From: Joshua Judson Rosen <rozzin@geekspace.com>
3Date: Wed, 27 Apr 2011 00:32:27 -0400
4Subject: [PATCH 12/17] Don't show the `Music Player: ...' combo-box unless multiple choices are actually available.
5
6---
7 ui_prefs_view.c | 72 +++++++++++++++++++++++++++++++++++--------------------
8 1 files changed, 46 insertions(+), 26 deletions(-)
9
10diff --git a/ui_prefs_view.c b/ui_prefs_view.c
11index e65981c..90e025d 100644
12--- a/ui_prefs_view.c
13+++ b/ui_prefs_view.c
14@@ -73,6 +73,7 @@ GtkWidget * make_prefs_window ( void )
15   GtkWidget * hseparator, * hbox1, *max_working_set_entry, *table;
16   char buffer[BUFFER_SIZE];
17   int i;
18+ int table_row = 0;
19 
20   window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
21   gtk_window_set_title(GTK_WINDOW(window), _("GJay Preferences"));
22@@ -88,31 +89,44 @@ GtkWidget * make_prefs_window ( void )
23     gtk_label_set_markup(GTK_LABEL(label),_("<b>General</b>"));
24     gtk_box_pack_start(GTK_BOX(vbox2), label, TRUE, TRUE, 0);
25 
26- table = gtk_table_new(3,2,TRUE);
27- gtk_box_pack_start(GTK_BOX(vbox1), table, TRUE, TRUE, 2);
28+ table = gtk_table_new(2, 2, TRUE);
29+ gtk_box_pack_start(GTK_BOX(vbox1), table, TRUE, TRUE, 2);
30+
31+ if (music_player_names[1] != NULL) {
32+ /* There's always, at least, the "None" player.
33+ If there are also other plays beyond that,
34+ present the user with a menu.
35+ */
36+
37+ /* Make room in the table for this row: */
38+ gtk_table_resize(table, 3, 2);
39+
40+ /* Player selection combo box */
41+ label = gtk_label_new(_("Music Player:"));
42+
43+ player_cbox = gtk_combo_box_new_text();
44+ i=0;
45+ while (music_player_names[i] != NULL)
46+ {
47+ gtk_combo_box_append_text(GTK_COMBO_BOX(player_cbox), music_player_names[i]);
48+ i++;
49+ }
50+ gtk_combo_box_set_active(GTK_COMBO_BOX(player_cbox), gjay->prefs->music_player);
51 
52- /* Player selection combo box */
53- label = gtk_label_new(_("Music Player:"));
54+ alignment = gtk_alignment_new(0, 0, 0, 0);
55+ gtk_container_add(GTK_CONTAINER(alignment), label);
56+ gtk_table_attach(GTK_TABLE(table), alignment,
57+ 0, 1, table_row, table_row+1,
58+ (GTK_EXPAND|GTK_FILL),(GTK_EXPAND|GTK_FILL),6,0);
59+ table_row++;
60+ alignment = gtk_alignment_new(0, 0, 0, 0);
61 
62- player_cbox = gtk_combo_box_new_text();
63- i=0;
64- while (music_player_names[i] != NULL)
65- {
66- gtk_combo_box_append_text(GTK_COMBO_BOX(player_cbox), music_player_names[i]);
67- i++;
68+ gtk_container_add(GTK_CONTAINER(alignment), player_cbox);
69+ gtk_table_attach(GTK_TABLE(table), alignment, 1, 2, 0, 1,
70+ (GTK_EXPAND|GTK_FILL),(GTK_EXPAND|GTK_FILL),6,0);
71+ g_signal_connect (G_OBJECT (player_cbox), "changed",
72+ G_CALLBACK (player_combo_box_changed), NULL);
73   }
74- gtk_combo_box_set_active(GTK_COMBO_BOX(player_cbox), gjay->prefs->music_player);
75-
76- alignment = gtk_alignment_new(0, 0, 0, 0);
77- gtk_container_add(GTK_CONTAINER(alignment), label);
78- gtk_table_attach(GTK_TABLE(table), alignment, 0, 1, 0, 1,
79- (GTK_EXPAND|GTK_FILL),(GTK_EXPAND|GTK_FILL),6,0);
80- alignment = gtk_alignment_new(0, 0, 0, 0);
81- gtk_container_add(GTK_CONTAINER(alignment), player_cbox);
82- gtk_table_attach(GTK_TABLE(table), alignment, 1, 2, 0, 1,
83- (GTK_EXPAND|GTK_FILL),(GTK_EXPAND|GTK_FILL),6,0);
84- g_signal_connect (G_OBJECT (player_cbox), "changed",
85- G_CALLBACK (player_combo_box_changed), NULL);
86 
87     /* Song Ratings checkbox */
88     label = gtk_label_new(_("Use song ratings"));
89@@ -125,12 +139,15 @@ GtkWidget * make_prefs_window ( void )
90 
91     alignment = gtk_alignment_new(0, 0, 0, 0);
92     gtk_container_add(GTK_CONTAINER(alignment), label);
93- gtk_table_attach(GTK_TABLE(table), alignment, 0, 1, 1, 2,
94+ gtk_table_attach(GTK_TABLE(table), alignment,
95+ 0, 1, table_row, table_row+1,
96         (GTK_EXPAND|GTK_FILL),(GTK_EXPAND|GTK_FILL),6,0);
97     alignment = gtk_alignment_new(0, 0, 0, 0);
98     gtk_container_add(GTK_CONTAINER(alignment), button);
99- gtk_table_attach(GTK_TABLE(table), alignment, 1, 2, 1, 2,
100+ gtk_table_attach(GTK_TABLE(table), alignment,
101+ 1, 2, table_row, table_row+1,
102         (GTK_EXPAND|GTK_FILL),(GTK_EXPAND|GTK_FILL),6,0);
103+ table_row++;
104 
105     /* Maximum working set box */
106     label = gtk_label_new(_("Max working set"));
107@@ -147,12 +164,15 @@ GtkWidget * make_prefs_window ( void )
108 
109     alignment = gtk_alignment_new(0, 0, 0, 0);
110     gtk_container_add(GTK_CONTAINER(alignment), label);
111- gtk_table_attach(GTK_TABLE(table), alignment, 0, 1, 2, 3,
112+ gtk_table_attach(GTK_TABLE(table), alignment,
113+ 0, 1, table_row, table_row+1,
114         (GTK_EXPAND|GTK_FILL),(GTK_EXPAND|GTK_FILL),6,0);
115     alignment = gtk_alignment_new(0, 0, 0, 0);
116     gtk_container_add(GTK_CONTAINER(alignment), max_working_set_entry);
117- gtk_table_attach(GTK_TABLE(table), alignment, 1, 2, 2, 3,
118+ gtk_table_attach(GTK_TABLE(table), alignment,
119+ 1, 2, table_row, table_row+1,
120         (GTK_EXPAND|GTK_FILL),(GTK_EXPAND|GTK_FILL),6,0);
121+ table_row++;
122 
123     hseparator = gtk_hseparator_new();
124     gtk_box_pack_start(GTK_BOX(vbox1), hseparator, TRUE, TRUE, 2);
125--
1261.7.2.5
127
128

Archive Download this file



interactive