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