Mercurial > audlegacy-plugins
comparison src/bluetooth/scan_gui.c @ 2756:d3d71539d675
rescan functionality
author | Paula Stanciu <paula.stanciu@gmail.com> |
---|---|
date | Tue, 01 Jul 2008 19:35:16 +0300 |
parents | 1a27c497e526 |
children | d45b4beadf6c |
comparison
equal
deleted
inserted
replaced
2755:5a0f5e9af5ef | 2756:d3d71539d675 |
---|---|
1 #include "scan_gui.h" | 1 #include "scan_gui.h" |
2 #include "bluetooth.h" | 2 #include "bluetooth.h" |
3 static GtkWidget *window = NULL; | 3 static GtkWidget *window = NULL; |
4 static GtkWidget *winbox; | 4 static GtkWidget *winbox; |
5 static GtkWidget *scanbox; | 5 static GtkWidget *scanbox; |
6 static GtkWidget *buttonsbox; | |
6 static GtkWidget *progressbox; | 7 static GtkWidget *progressbox; |
7 static GtkWidget *bluetooth_img; | 8 static GtkWidget *bluetooth_img; |
8 static GtkWidget *scan_label; | 9 static GtkWidget *scan_label; |
9 static GtkWidget *progress_bar; | 10 static GtkWidget *progress_bar; |
10 | 11 static GtkWidget *rescan_buttton; |
12 static GtkWidget *close_button; | |
11 gpointer progress() { | 13 gpointer progress() { |
12 | 14 |
13 for(;;){ | 15 for(;;){ |
14 if(window){ | 16 if(window){ |
15 gtk_progress_bar_pulse(GTK_PROGRESS_BAR(progress_bar)); | 17 gtk_progress_bar_pulse(GTK_PROGRESS_BAR(progress_bar)); |
31 } | 33 } |
32 } | 34 } |
33 void destroy_scan_window(){ | 35 void destroy_scan_window(){ |
34 gtk_widget_hide(window); | 36 gtk_widget_hide(window); |
35 } | 37 } |
38 void close_window(void){ | |
39 printf("scan_gui close callback \n"); | |
40 gtk_widget_destroy (window); | |
41 window = NULL; | |
42 } | |
43 | |
36 | 44 |
37 void show_scan() | 45 void show_scan() |
38 { | 46 { |
39 GThread *th1; | 47 GThread *th1; |
40 gchar *filename; | 48 gchar *filename; |
67 gtk_container_add(GTK_CONTAINER(progressbox),progress_bar); | 75 gtk_container_add(GTK_CONTAINER(progressbox),progress_bar); |
68 th1 = g_thread_create((GThreadFunc)progress, NULL,TRUE,NULL); | 76 th1 = g_thread_create((GThreadFunc)progress, NULL,TRUE,NULL); |
69 /* I have to add a button for Rescan when there are | 77 /* I have to add a button for Rescan when there are |
70 * no devices found and not currently scanning | 78 * no devices found and not currently scanning |
71 */ | 79 */ |
72 gtk_window_set_default_size (GTK_WINDOW (window), 50, 40); | 80 buttonsbox = gtk_hbox_new(FALSE,2); |
81 gtk_container_set_border_width(GTK_CONTAINER(buttonsbox),2); | |
82 gtk_container_add(GTK_CONTAINER(progressbox),buttonsbox); | |
83 rescan_buttton = gtk_button_new_with_mnemonic("Rescan"); | |
84 g_signal_connect(rescan_buttton,"clicked",G_CALLBACK (refresh_call),NULL); | |
85 | |
86 close_button = gtk_button_new_with_mnemonic("Close"); | |
87 gtk_container_add(GTK_CONTAINER(buttonsbox),rescan_buttton); | |
88 gtk_container_add(GTK_CONTAINER(buttonsbox),close_button); | |
89 g_signal_connect(close_button,"clicked",G_CALLBACK (close_window),NULL); | |
90 | |
91 gtk_window_set_default_size (GTK_WINDOW (window), 60, 40); | |
92 gtk_window_set_resizable(GTK_WINDOW(window),FALSE); | |
73 if (!GTK_WIDGET_VISIBLE (window)) | 93 if (!GTK_WIDGET_VISIBLE (window)) |
74 gtk_widget_show_all (window); | 94 gtk_widget_show_all (window); |
75 else | 95 else |
76 { | 96 { |
77 gtk_widget_destroy (window); | 97 gtk_widget_destroy (window); |