Mercurial > audlegacy-plugins
annotate src/bluetooth/gui.c @ 2891:c27da2c06805
initial code for bookmarks
author | Calin Crisan ccrisan@gmail.com |
---|---|
date | Tue, 12 Aug 2008 23:49:32 +0200 |
parents | 7a1bc6c600e0 |
children |
rev | line source |
---|---|
2839 | 1 /* |
2 * Audacious Bluetooth headset suport plugin | |
3 * | |
4 * Copyright (c) 2008 Paula Stanciu paula.stanciu@gmail.com | |
5 * | |
6 * This program is free software; you can redistribute it and/or modify | |
7 * it under the terms of the GNU General Public License as published by | |
8 * the Free Software Foundation; under version 3 of the License. | |
9 * | |
10 * This program is distributed in the hope that it will be useful, | |
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 * GNU General Public License for more details. | |
14 * | |
15 * You should have received a copy of the GNU General Public License | |
16 * along with this program. If not, see <http://www.gnu.org/licenses>. | |
17 */ | |
18 | |
2644 | 19 #include "gui.h" |
20 #include "bluetooth.h" | |
21 | |
22 static GtkWidget *window = NULL; | |
23 static GtkTreeModel *model; | |
2728 | 24 static GtkWidget *mainbox; |
25 static GtkWidget *hbox_top; | |
26 static GtkWidget *hbox_bottom; | |
27 static GtkWidget *box_about; | |
28 static GtkWidget *box_about_left; | |
29 static GtkWidget *box_about_right; | |
30 static GtkWidget *headset_frame; | |
31 static GtkWidget *about_frame; | |
32 static GtkWidget *refresh; | |
33 static GtkWidget *connect_button; | |
34 static GtkWidget *close_button; | |
35 static GtkWidget *treeview; | |
36 static GtkWidget *label_p; | |
37 static GtkWidget *label_c; | |
38 static GtkWidget *label_a; | |
39 static GtkWidget *label_prod; | |
40 static GtkWidget *label_class; | |
41 static GtkWidget *label_address; | |
42 static GList * dev = NULL; | |
43 gchar *status = NULL; | |
2644 | 44 enum{ |
45 COLUMN_PRODUCER, | |
46 NUM_COLUMNS | |
47 }; | |
48 | |
49 static GtkTreeModel * create_model(void) | |
50 { | |
51 GtkListStore *store; | |
52 GtkTreeIter iter; | |
2728 | 53 /* create list store */ |
2644 | 54 store = gtk_list_store_new(NUM_COLUMNS, |
55 G_TYPE_STRING); | |
2728 | 56 dev = audio_devices; |
57 if(dev == NULL) { | |
58 /*if we are scanning for devices now then print the Scanning message, | |
59 * else we print the "no devices found message */ | |
60 if(discover_finish == 1) | |
61 /*we are scanning*/ | |
2732
1a27c497e526
indentation and some small bug fixing
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2728
diff
changeset
|
62 status = g_strdup_printf("Scanning"); |
1a27c497e526
indentation and some small bug fixing
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2728
diff
changeset
|
63 else |
1a27c497e526
indentation and some small bug fixing
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2728
diff
changeset
|
64 status = g_strdup_printf("No devices found!"); |
1a27c497e526
indentation and some small bug fixing
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2728
diff
changeset
|
65 /* add the status to the list */ |
2728 | 66 gtk_list_store_append(store,&iter); |
67 gtk_list_store_set(store,&iter, COLUMN_PRODUCER,status,-1); | |
68 return GTK_TREE_MODEL(store); | |
2732
1a27c497e526
indentation and some small bug fixing
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2728
diff
changeset
|
69 } |
2728 | 70 while(dev != NULL) |
2644 | 71 { |
72 gtk_list_store_append(store,&iter); | |
2728 | 73 gtk_list_store_set(store,&iter, COLUMN_PRODUCER, |
2732
1a27c497e526
indentation and some small bug fixing
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2728
diff
changeset
|
74 ((DeviceData*)(dev->data))-> name,-1); |
2728 | 75 dev = g_list_next(dev); |
2646
7fbff3287a56
added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2644
diff
changeset
|
76 } |
7fbff3287a56
added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2644
diff
changeset
|
77 |
2728 | 78 return GTK_TREE_MODEL(store); |
2646
7fbff3287a56
added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2644
diff
changeset
|
79 } |
7fbff3287a56
added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2644
diff
changeset
|
80 static GtkTreeModel * rebuild_model(void) |
7fbff3287a56
added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2644
diff
changeset
|
81 { |
7fbff3287a56
added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2644
diff
changeset
|
82 |
7fbff3287a56
added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2644
diff
changeset
|
83 GtkListStore *store; |
7fbff3287a56
added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2644
diff
changeset
|
84 GtkTreeIter iter; |
7fbff3287a56
added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2644
diff
changeset
|
85 gint dev_no=0; |
7fbff3287a56
added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2644
diff
changeset
|
86 GList *dev; |
2871
455e6e37feae
removed the warnings
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2839
diff
changeset
|
87 if(!window) |
2649
d891ba4be5a5
fixed crash when prefs window was closed while scanning
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2646
diff
changeset
|
88 return NULL; |
2728 | 89 /* create list store */ |
2646
7fbff3287a56
added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2644
diff
changeset
|
90 store = gtk_list_store_new(NUM_COLUMNS, |
7fbff3287a56
added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2644
diff
changeset
|
91 G_TYPE_STRING); |
2728 | 92 |
2646
7fbff3287a56
added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2644
diff
changeset
|
93 /*add inf to test_data from audio_devices */ |
7fbff3287a56
added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2644
diff
changeset
|
94 dev_no = g_list_length(audio_devices); |
7fbff3287a56
added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2644
diff
changeset
|
95 dev = audio_devices; |
2732
1a27c497e526
indentation and some small bug fixing
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2728
diff
changeset
|
96 if(dev == NULL || discover_finish == 0) { |
2728 | 97 /*if we are scanning for devices now then print the Scanning message, |
98 * else we print the "no devices found message */ | |
99 printf("discover: %d\n",discover_finish); | |
100 if(discover_finish == 1) { | |
101 /*we are scanning*/ | |
2732
1a27c497e526
indentation and some small bug fixing
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2728
diff
changeset
|
102 status = g_strdup_printf("Scanning"); |
2728 | 103 } else |
2732
1a27c497e526
indentation and some small bug fixing
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2728
diff
changeset
|
104 status = g_strdup_printf("No devices found!"); |
1a27c497e526
indentation and some small bug fixing
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2728
diff
changeset
|
105 /* add the status to the list */ |
2728 | 106 gtk_list_store_append(store,&iter); |
107 gtk_list_store_set(store,&iter, COLUMN_PRODUCER,status,-1); | |
108 gtk_label_set_text(GTK_LABEL(label_prod),status); | |
109 return GTK_TREE_MODEL(store); | |
2732
1a27c497e526
indentation and some small bug fixing
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2728
diff
changeset
|
110 } |
1a27c497e526
indentation and some small bug fixing
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2728
diff
changeset
|
111 |
2728 | 112 /* add data to the list store */ |
2646
7fbff3287a56
added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2644
diff
changeset
|
113 while(dev != NULL) |
7fbff3287a56
added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2644
diff
changeset
|
114 { |
2728 | 115 gtk_list_store_append(store,&iter); |
116 gtk_list_store_set(store,&iter, COLUMN_PRODUCER, | |
2732
1a27c497e526
indentation and some small bug fixing
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2728
diff
changeset
|
117 ((DeviceData*)(dev->data))-> name,-1); |
2728 | 118 dev = g_list_next(dev); |
2646
7fbff3287a56
added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2644
diff
changeset
|
119 } |
2871
455e6e37feae
removed the warnings
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2839
diff
changeset
|
120 /*set the labels */ |
455e6e37feae
removed the warnings
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2839
diff
changeset
|
121 /* temp = g_strdup_printf("0x%x",((DeviceData*)(dev->data))->class); */ |
2728 | 122 gtk_label_set_text(GTK_LABEL(label_prod),((DeviceData*)(dev->data))->name); |
2871
455e6e37feae
removed the warnings
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2839
diff
changeset
|
123 /* gtk_label_set_text(GTK_LABEL(label_class),temp); */ |
2728 | 124 gtk_label_set_text(GTK_LABEL(label_address),((DeviceData*)(dev->data))->address); |
2871
455e6e37feae
removed the warnings
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2839
diff
changeset
|
125 /* g_free(temp); */ |
2728 | 126 return GTK_TREE_MODEL(store); |
2646
7fbff3287a56
added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2644
diff
changeset
|
127 |
2644 | 128 } |
129 | |
2646
7fbff3287a56
added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2644
diff
changeset
|
130 |
7fbff3287a56
added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2644
diff
changeset
|
131 void refresh_tree() |
7fbff3287a56
added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2644
diff
changeset
|
132 { |
2649
d891ba4be5a5
fixed crash when prefs window was closed while scanning
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2646
diff
changeset
|
133 if(!window) |
d891ba4be5a5
fixed crash when prefs window was closed while scanning
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2646
diff
changeset
|
134 return; |
2728 | 135 model = rebuild_model(); |
136 gtk_tree_view_set_model(GTK_TREE_VIEW(treeview),GTK_TREE_MODEL(model)); | |
2646
7fbff3287a56
added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2644
diff
changeset
|
137 } |
7fbff3287a56
added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2644
diff
changeset
|
138 |
7fbff3287a56
added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2644
diff
changeset
|
139 |
2644 | 140 static void add_columns(GtkTreeView *treeview) |
141 { | |
142 GtkCellRenderer *renderer; | |
143 GtkTreeViewColumn *column; | |
144 // GtkTreeModel *model = gtk_tree_view_get_model (treeview); | |
145 | |
146 /* column for producer */ | |
147 renderer = gtk_cell_renderer_text_new (); | |
2764
d45b4beadf6c
Made "bluetooth" and "streambrowser" plugins translatable.
Stany HENRY <StrassBoy@gmail.com>
parents:
2756
diff
changeset
|
148 column = gtk_tree_view_column_new_with_attributes (_("Producer"), |
2644 | 149 renderer, |
150 "text", | |
151 COLUMN_PRODUCER, | |
152 NULL); | |
153 gtk_tree_view_column_set_sort_column_id (column,COLUMN_PRODUCER); | |
154 gtk_tree_view_append_column (treeview, column); | |
155 | |
156 } | |
157 | |
158 void close_call(void){ | |
159 printf("close callback \n"); | |
160 gtk_widget_destroy (window); | |
161 window = NULL; | |
162 } | |
163 void select_row(GtkWidget *treeview){ | |
164 | |
165 GtkTreeIter iter; | |
166 gint sel; | |
2646
7fbff3287a56
added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2644
diff
changeset
|
167 gchar *temp; |
2728 | 168 gint i; |
2644 | 169 printf("select\n"); |
170 GtkTreeSelection *selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(treeview)); | |
171 if(gtk_tree_selection_get_selected (selection, NULL,&iter)){ | |
2646
7fbff3287a56
added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2644
diff
changeset
|
172 GtkTreePath *path; |
7fbff3287a56
added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2644
diff
changeset
|
173 path = gtk_tree_model_get_path (model, &iter); |
7fbff3287a56
added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2644
diff
changeset
|
174 sel = gtk_tree_path_get_indices (path)[0]; |
7fbff3287a56
added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2644
diff
changeset
|
175 printf("i=%d\n",sel); |
2838
22a2ffe86750
added passkey agent and basic pairing functionality
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2764
diff
changeset
|
176 selected_dev = audio_devices; |
2728 | 177 for(i=0;i<sel;i++) |
2838
22a2ffe86750
added passkey agent and basic pairing functionality
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2764
diff
changeset
|
178 selected_dev = g_list_next(dev); |
2728 | 179 if(dev != NULL) { |
2838
22a2ffe86750
added passkey agent and basic pairing functionality
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2764
diff
changeset
|
180 temp = g_strdup_printf("0x%x",((DeviceData*)(selected_dev->data))->class); |
22a2ffe86750
added passkey agent and basic pairing functionality
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2764
diff
changeset
|
181 gtk_label_set_text(GTK_LABEL(label_prod),((DeviceData*)(selected_dev->data))->name); |
2732
1a27c497e526
indentation and some small bug fixing
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2728
diff
changeset
|
182 gtk_label_set_text(GTK_LABEL(label_class),temp); |
2838
22a2ffe86750
added passkey agent and basic pairing functionality
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2764
diff
changeset
|
183 gtk_label_set_text(GTK_LABEL(label_address),((DeviceData*)(selected_dev->data))->address); |
2732
1a27c497e526
indentation and some small bug fixing
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2728
diff
changeset
|
184 gtk_tree_path_free (path); |
1a27c497e526
indentation and some small bug fixing
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2728
diff
changeset
|
185 g_free(temp); |
2728 | 186 }else |
187 gtk_label_set_text(GTK_LABEL(label_prod),status); | |
188 g_free(status); | |
2885
7a1bc6c600e0
Disable rescan/connect while scanning / when no device is selected
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2871
diff
changeset
|
189 gtk_widget_set_sensitive(connect_button,TRUE); |
2644 | 190 } |
2728 | 191 } |
2644 | 192 |
2756
d3d71539d675
rescan functionality
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2732
diff
changeset
|
193 void refresh_resultsui(){ |
2838
22a2ffe86750
added passkey agent and basic pairing functionality
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2764
diff
changeset
|
194 gtk_widget_destroy (window); |
22a2ffe86750
added passkey agent and basic pairing functionality
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2764
diff
changeset
|
195 window = NULL; |
2885
7a1bc6c600e0
Disable rescan/connect while scanning / when no device is selected
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2871
diff
changeset
|
196 selected_dev = NULL; |
2838
22a2ffe86750
added passkey agent and basic pairing functionality
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2764
diff
changeset
|
197 refresh_call(); |
2756
d3d71539d675
rescan functionality
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2732
diff
changeset
|
198 } |
2838
22a2ffe86750
added passkey agent and basic pairing functionality
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2764
diff
changeset
|
199 |
2756
d3d71539d675
rescan functionality
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2732
diff
changeset
|
200 |
2728 | 201 void results_ui() |
2644 | 202 { |
2732
1a27c497e526
indentation and some small bug fixing
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2728
diff
changeset
|
203 gchar *temp; |
2644 | 204 if (!window) |
205 { | |
206 window = gtk_window_new (GTK_WINDOW_TOPLEVEL); | |
207 g_signal_connect (window, "destroy",G_CALLBACK (gtk_widget_destroyed), &window); | |
208 | |
209 mainbox = gtk_vbox_new(FALSE,4); | |
210 gtk_container_set_border_width (GTK_CONTAINER (mainbox), 4); | |
211 gtk_container_add (GTK_CONTAINER (window), mainbox); | |
212 | |
213 hbox_top = gtk_hbox_new(FALSE,4); | |
214 gtk_container_set_border_width (GTK_CONTAINER(hbox_top), 4); | |
215 gtk_container_add (GTK_CONTAINER (mainbox), hbox_top); | |
216 | |
217 hbox_bottom = gtk_hbox_new(FALSE,4); | |
218 gtk_container_set_border_width (GTK_CONTAINER (hbox_bottom), 4); | |
219 gtk_container_add (GTK_CONTAINER (mainbox), hbox_bottom); | |
220 | |
2764
d45b4beadf6c
Made "bluetooth" and "streambrowser" plugins translatable.
Stany HENRY <StrassBoy@gmail.com>
parents:
2756
diff
changeset
|
221 headset_frame = gtk_frame_new(_("Available Headsets")); |
2644 | 222 gtk_container_add (GTK_CONTAINER (hbox_top), headset_frame); |
223 | |
2764
d45b4beadf6c
Made "bluetooth" and "streambrowser" plugins translatable.
Stany HENRY <StrassBoy@gmail.com>
parents:
2756
diff
changeset
|
224 about_frame = gtk_frame_new(_("Current Headset")); |
2644 | 225 gtk_container_add(GTK_CONTAINER(hbox_top),about_frame); |
226 | |
2764
d45b4beadf6c
Made "bluetooth" and "streambrowser" plugins translatable.
Stany HENRY <StrassBoy@gmail.com>
parents:
2756
diff
changeset
|
227 refresh = gtk_button_new_with_mnemonic (_("_Refresh")); |
2756
d3d71539d675
rescan functionality
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2732
diff
changeset
|
228 g_signal_connect (refresh, "clicked",G_CALLBACK (refresh_resultsui), NULL); |
2644 | 229 gtk_container_add(GTK_CONTAINER(hbox_bottom),refresh); |
230 | |
2764
d45b4beadf6c
Made "bluetooth" and "streambrowser" plugins translatable.
Stany HENRY <StrassBoy@gmail.com>
parents:
2756
diff
changeset
|
231 connect_button = gtk_button_new_with_mnemonic(_("_Connect")); |
2644 | 232 g_signal_connect(connect_button,"clicked",G_CALLBACK (connect_call), NULL); |
233 gtk_container_add(GTK_CONTAINER(hbox_bottom),connect_button); | |
2885
7a1bc6c600e0
Disable rescan/connect while scanning / when no device is selected
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2871
diff
changeset
|
234 gtk_widget_set_sensitive(connect_button,FALSE); |
7a1bc6c600e0
Disable rescan/connect while scanning / when no device is selected
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2871
diff
changeset
|
235 |
2644 | 236 |
2764
d45b4beadf6c
Made "bluetooth" and "streambrowser" plugins translatable.
Stany HENRY <StrassBoy@gmail.com>
parents:
2756
diff
changeset
|
237 close_button = gtk_button_new_with_mnemonic(_("_Close")); |
2644 | 238 g_signal_connect(close_button,"clicked",G_CALLBACK (close_call),NULL); |
239 gtk_container_add(GTK_CONTAINER(hbox_bottom),close_button); | |
240 /* create tree model */ | |
241 model = create_model (); | |
242 | |
243 /* create tree view */ | |
244 treeview = gtk_tree_view_new_with_model (model); | |
245 gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (treeview), TRUE); | |
246 gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview)),GTK_SELECTION_SINGLE); | |
247 g_object_unref (model); | |
248 gtk_container_add (GTK_CONTAINER (headset_frame), treeview); | |
249 /* add columns to the tree view */ | |
250 add_columns (GTK_TREE_VIEW (treeview)); | |
2728 | 251 |
2644 | 252 g_signal_connect(treeview,"cursor-changed",G_CALLBACK(select_row),treeview); |
253 | |
254 | |
255 box_about = gtk_hbox_new(FALSE,4); | |
256 gtk_container_set_border_width (GTK_CONTAINER (box_about), 4); | |
257 gtk_container_add (GTK_CONTAINER (about_frame), box_about); | |
2646
7fbff3287a56
added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2644
diff
changeset
|
258 |
2644 | 259 /*about box left - vbox */ |
260 | |
261 box_about_left = gtk_vbox_new(FALSE,4); | |
262 gtk_container_set_border_width (GTK_CONTAINER (box_about_left), 4); | |
263 gtk_container_add (GTK_CONTAINER (box_about), box_about_left); | |
2646
7fbff3287a56
added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2644
diff
changeset
|
264 |
2644 | 265 /*about box right - vbox */ |
266 box_about_right = gtk_vbox_new(TRUE,4); | |
267 gtk_container_set_border_width (GTK_CONTAINER (box_about_right), 4); | |
268 gtk_container_add (GTK_CONTAINER (box_about), box_about_right); | |
269 | |
270 /* Left labels */ | |
2764
d45b4beadf6c
Made "bluetooth" and "streambrowser" plugins translatable.
Stany HENRY <StrassBoy@gmail.com>
parents:
2756
diff
changeset
|
271 label_p = gtk_label_new(_("Name:")); |
2644 | 272 gtk_container_add(GTK_CONTAINER(box_about_left),label_p); |
273 | |
2764
d45b4beadf6c
Made "bluetooth" and "streambrowser" plugins translatable.
Stany HENRY <StrassBoy@gmail.com>
parents:
2756
diff
changeset
|
274 label_c = gtk_label_new(_("Class")); |
2646
7fbff3287a56
added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2644
diff
changeset
|
275 gtk_container_add(GTK_CONTAINER(box_about_left),label_c); |
2644 | 276 |
277 | |
2764
d45b4beadf6c
Made "bluetooth" and "streambrowser" plugins translatable.
Stany HENRY <StrassBoy@gmail.com>
parents:
2756
diff
changeset
|
278 label_a = gtk_label_new(_("Address:")); |
2644 | 279 gtk_container_add(GTK_CONTAINER(box_about_left),label_a); |
280 | |
281 | |
282 /*right labels */ | |
2728 | 283 label_prod = gtk_label_new(" "); |
2644 | 284 gtk_container_add(GTK_CONTAINER(box_about_right),label_prod); |
285 | |
2646
7fbff3287a56
added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2644
diff
changeset
|
286 label_class = gtk_label_new(" "); |
7fbff3287a56
added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2644
diff
changeset
|
287 gtk_container_add(GTK_CONTAINER(box_about_right),label_class); |
2644 | 288 |
289 | |
2646
7fbff3287a56
added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2644
diff
changeset
|
290 label_address = gtk_label_new(" "); |
2644 | 291 gtk_container_add(GTK_CONTAINER(box_about_right),label_address); |
2646
7fbff3287a56
added device discovery in the plugin's prefs window
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2644
diff
changeset
|
292 |
2728 | 293 dev = audio_devices; |
294 if(dev != NULL) { | |
2732
1a27c497e526
indentation and some small bug fixing
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2728
diff
changeset
|
295 temp = g_strdup_printf("0x%x",((DeviceData*)(dev->data))->class); |
1a27c497e526
indentation and some small bug fixing
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2728
diff
changeset
|
296 gtk_label_set_text(GTK_LABEL(label_prod),((DeviceData*)(dev->data))->name); |
1a27c497e526
indentation and some small bug fixing
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2728
diff
changeset
|
297 gtk_label_set_text(GTK_LABEL(label_class),temp); |
1a27c497e526
indentation and some small bug fixing
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2728
diff
changeset
|
298 gtk_label_set_text(GTK_LABEL(label_address),((DeviceData*)(dev->data))->address); |
1a27c497e526
indentation and some small bug fixing
Paula Stanciu <paula.stanciu@gmail.com>
parents:
2728
diff
changeset
|
299 g_free(temp); |
2728 | 300 } |
301 | |
302 gtk_window_set_default_size (GTK_WINDOW (window), 460, 150); | |
2644 | 303 if (!GTK_WIDGET_VISIBLE (window)) |
304 gtk_widget_show_all (window); | |
305 else | |
306 { | |
307 gtk_widget_destroy (window); | |
308 window = NULL; | |
309 } | |
310 // return window; | |
311 } | |
312 // return window; | |
313 } | |
314 |