Mercurial > audlegacy-plugins
comparison src/bluetooth/scan_gui.c @ 2889:6c53f9fa9029
Backed out changeset 59ff744e1e23
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 12 Aug 2008 20:29:49 +0300 |
parents | 43557eb3180f |
children | 5e97b55f87cf |
comparison
equal
deleted
inserted
replaced
2856:59ff744e1e23 | 2889:6c53f9fa9029 |
---|---|
29 static GtkWidget *progress_bar; | 29 static GtkWidget *progress_bar; |
30 static GtkWidget *rescan_buttton; | 30 static GtkWidget *rescan_buttton; |
31 static GtkWidget *close_button; | 31 static GtkWidget *close_button; |
32 static gint usage=0; | 32 static gint usage=0; |
33 | 33 |
34 gpointer progress() | 34 gpointer progress() { |
35 { | |
36 | 35 |
37 for(;;){ | 36 for(;;){ |
38 if(window){ | 37 if(window){ |
39 gtk_progress_bar_pulse(GTK_PROGRESS_BAR(progress_bar)); | 38 gtk_progress_bar_pulse(GTK_PROGRESS_BAR(progress_bar)); |
40 } | 39 } |
41 sleep(1); | 40 sleep(1); |
42 if(usage == 0){ | 41 if(usage == 0){ |
43 if(discover_finish == 2 ) { | 42 if(discover_finish == 2 ) { |
44 if(window){ | 43 if(window){ |
45 gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progress_bar),1); | 44 gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progress_bar),1); |
45 } | |
46 return 0; | |
47 } | |
48 }else | |
49 { | |
50 if(bonding_finish == 1 ) { | |
51 if(window){ | |
52 gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progress_bar),1); | |
53 show_pairing_ok(); | |
54 } | |
55 return 0; | |
46 } | 56 } |
47 return 0; | 57 } |
48 } | |
49 }else | |
50 { | |
51 if(bonding_finish == 1 ) { | |
52 if(window){ | |
53 gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progress_bar),1); | |
54 show_pairing_ok(); | |
55 } | |
56 return 0; | |
57 } | |
58 } | |
59 } | 58 } |
60 return 0; | 59 return 0; |
61 } | 60 } |
62 | 61 |
63 void show_pairing_ok() | 62 void show_pairing_ok() |
64 { | 63 { |
65 if(window ){ | 64 if(window ){ |
66 gtk_label_set_text(GTK_LABEL(scan_label),_("Bonding finish!")); | 65 gtk_label_set_text(GTK_LABEL(scan_label),_("Bonding finish!")); |
67 } | 66 } |
68 } | 67 } |
69 | 68 |
70 void show_no_devices() | 69 void show_no_devices(){ |
71 { | |
72 if(window ){ | 70 if(window ){ |
73 gtk_label_set_text(GTK_LABEL(scan_label),_("No devices found!")); | 71 gtk_label_set_text(GTK_LABEL(scan_label),_("No devices found!")); |
74 } | 72 } |
75 } | 73 } |
76 void destroy_scan_window() | 74 void destroy_scan_window(){ |
77 { | |
78 gtk_widget_hide(window); | 75 gtk_widget_hide(window); |
79 } | 76 } |
80 void close_window(void) | 77 void close_window(void){ |
81 { | |
82 printf("scan_gui close callback \n"); | 78 printf("scan_gui close callback \n"); |
83 gtk_widget_destroy (window); | 79 gtk_widget_destroy (window); |
84 window = NULL; | 80 window = NULL; |
85 } | 81 } |
82 | |
83 | |
86 void show_scan(gint use) | 84 void show_scan(gint use) |
87 { | 85 { |
88 GThread *th1; | 86 GThread *th1; |
89 gchar *filename; | 87 gchar *filename; |
90 usage = use; | 88 usage = use; |
113 gtk_image_set_pixel_size(GTK_IMAGE(bluetooth_img),-1); | 111 gtk_image_set_pixel_size(GTK_IMAGE(bluetooth_img),-1); |
114 gtk_container_add(GTK_CONTAINER(scanbox),bluetooth_img); | 112 gtk_container_add(GTK_CONTAINER(scanbox),bluetooth_img); |
115 if(usage == 0){ | 113 if(usage == 0){ |
116 scan_label = gtk_label_new_with_mnemonic(_("Scanning...")); | 114 scan_label = gtk_label_new_with_mnemonic(_("Scanning...")); |
117 }else | 115 }else |
118 { | 116 { |
119 scan_label = gtk_label_new_with_mnemonic(_("Pairing...")); | 117 scan_label = gtk_label_new_with_mnemonic(_("Pairing...")); |
120 } | 118 } |
121 | 119 |
122 gtk_container_add(GTK_CONTAINER(scanbox),scan_label); | 120 gtk_container_add(GTK_CONTAINER(scanbox),scan_label); |
123 | 121 |
124 progress_bar = gtk_progress_bar_new(); | 122 progress_bar = gtk_progress_bar_new(); |
125 gtk_progress_bar_pulse(GTK_PROGRESS_BAR(progress_bar)); | 123 gtk_progress_bar_pulse(GTK_PROGRESS_BAR(progress_bar)); |
129 gtk_container_set_border_width(GTK_CONTAINER(buttonsbox),2); | 127 gtk_container_set_border_width(GTK_CONTAINER(buttonsbox),2); |
130 gtk_container_add(GTK_CONTAINER(progressbox),buttonsbox); | 128 gtk_container_add(GTK_CONTAINER(progressbox),buttonsbox); |
131 /* I have to modify the rescan button with a play one | 129 /* I have to modify the rescan button with a play one |
132 * and treat the case when the bounding is not ok | 130 * and treat the case when the bounding is not ok |
133 */ | 131 */ |
134 if(usage == 0){ | 132 rescan_buttton = gtk_button_new_with_mnemonic(_("Rescan")); |
135 rescan_buttton = gtk_button_new_with_mnemonic(_("Rescan")); | 133 g_signal_connect(rescan_buttton,"clicked",G_CALLBACK (refresh_call),NULL); |
136 g_signal_connect(rescan_buttton,"clicked",G_CALLBACK (refresh_call),NULL); | |
137 }else{ | |
138 rescan_buttton = gtk_button_new_with_mnemonic(_("Play")); | |
139 g_signal_connect(rescan_buttton,"clicked",G_CALLBACK (play_call),NULL); | |
140 } | |
141 | |
142 | |
143 | 134 |
144 close_button = gtk_button_new_with_mnemonic(_("Close")); | 135 close_button = gtk_button_new_with_mnemonic(_("Close")); |
145 gtk_container_add(GTK_CONTAINER(buttonsbox),rescan_buttton); | 136 gtk_container_add(GTK_CONTAINER(buttonsbox),rescan_buttton); |
146 gtk_container_add(GTK_CONTAINER(buttonsbox),close_button); | 137 gtk_container_add(GTK_CONTAINER(buttonsbox),close_button); |
147 g_signal_connect(close_button,"clicked",G_CALLBACK (close_window),NULL); | 138 g_signal_connect(close_button,"clicked",G_CALLBACK (close_window),NULL); |