gnome-bluetooth r600 - in trunk: . wizard



Author: hadess
Date: Thu Apr  9 23:16:33 2009
New Revision: 600
URL: http://svn.gnome.org/viewvc/gnome-bluetooth?rev=600&view=rev

Log:
Use GtkBuilder to setup the signals (Closes: #573375)


Modified:
   trunk/configure.ac
   trunk/wizard/main.c
   trunk/wizard/wizard.ui

Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac	(original)
+++ trunk/configure.ac	Thu Apr  9 23:16:33 2009
@@ -94,6 +94,7 @@
 dnl Requires for the wizard dialogue
 PKG_CHECK_MODULES(WIZARD,
 		  dbus-glib-1 >= $DBUS_GLIB_REQUIRED
+		  gmodule-export-2.0
 		  gtk+-2.0
 		  unique-1.0)
 

Modified: trunk/wizard/main.c
==============================================================================
--- trunk/wizard/main.c	(original)
+++ trunk/wizard/main.c	Thu Apr  9 23:16:33 2009
@@ -75,6 +75,17 @@
 static GtkWidget *radio_custom = NULL;
 static GtkWidget *entry_custom = NULL;
 
+/* Signals */
+void close_callback(GtkWidget *assistant, gpointer data);
+void prepare_callback(GtkWidget *assistant, GtkWidget *page, gpointer data);
+void select_device_changed(BluetoothChooser *selector, gchar *address, gpointer user_data);
+void device_selected_name_cb (GObject *object, GParamSpec *spec, gpointer user_data);
+gboolean entry_custom_event(GtkWidget *entry, GdkEventKey *event);
+void set_user_pincode(GtkWidget *button);
+void toggle_set_sensitive(GtkWidget *button, gpointer data);
+void passkey_option_button_clicked (GtkButton *button, gpointer data);
+void entry_custom_changed(GtkWidget *entry);
+
 static void
 set_large_label (GtkLabel *label, const char *text)
 {
@@ -252,15 +263,16 @@
 	gtk_assistant_set_page_complete(assistant, page_setup, complete);
 }
 
-static void close_callback(GtkWidget *assistant, gpointer data)
+void close_callback(GtkWidget *assistant, gpointer data)
 {
 	gtk_widget_destroy(assistant);
 
 	gtk_main_quit();
 }
 
-static void prepare_callback(GtkWidget *assistant,
-                             GtkWidget *page, gpointer data)
+void prepare_callback(GtkWidget *assistant,
+		      GtkWidget *page,
+		      gpointer data)
 {
 	gboolean complete = TRUE;
 	const char *path = AGENT_PATH;
@@ -342,7 +354,8 @@
 	return complete;
 }
 
-static gboolean entry_custom_event(GtkWidget *entry, GdkEventKey *event)
+gboolean
+entry_custom_event(GtkWidget *entry, GdkEventKey *event)
 {
 	if (event->length == 0)
 		return FALSE;
@@ -354,7 +367,8 @@
 	return TRUE;
 }
 
-static void entry_custom_changed(GtkWidget *entry)
+void
+entry_custom_changed(GtkWidget *entry)
 {
 	user_pincode = g_strdup (gtk_entry_get_text(GTK_ENTRY(entry)));
 	gtk_dialog_set_response_sensitive (GTK_DIALOG (passkey_dialog),
@@ -362,7 +376,8 @@
 					   gtk_entry_get_text_length (GTK_ENTRY (entry)) >= 1);
 }
 
-static void toggle_set_sensitive(GtkWidget *button, gpointer data)
+void
+toggle_set_sensitive(GtkWidget *button, gpointer data)
 {
 	gboolean active;
 
@@ -374,7 +389,8 @@
 						   GTK_RESPONSE_ACCEPT, TRUE);
 }
 
-static void set_user_pincode(GtkWidget *button)
+void
+set_user_pincode(GtkWidget *button)
 {
 	GSList *list, *l;
 
@@ -415,21 +431,21 @@
 	}
 }
 
-static void device_selected_name_cb (GObject *object,
-				     GParamSpec *spec,
-				     gpointer user_data)
+void device_selected_name_cb (GObject *object,
+			      GParamSpec *spec,
+			      gpointer user_data)
 {
 	set_page_search_complete ();
 }
 
-static void select_device_changed(BluetoothChooser *selector,
-				  gchar *address,
-				  gpointer user_data)
+void select_device_changed(BluetoothChooser *selector,
+			   gchar *address,
+			   gpointer user_data)
 {
 	set_page_search_complete ();
 }
 
-static void
+void
 passkey_option_button_clicked (GtkButton *button, gpointer data)
 {
 	GtkWidget *radio;
@@ -517,11 +533,6 @@
 		      "device-category-filter", BLUETOOTH_CATEGORY_NOT_PAIRED_OR_TRUSTED,
 		      NULL);
 
-	g_signal_connect(selector, "selected-device-changed",
-			 G_CALLBACK(select_device_changed), NULL);
-	g_signal_connect(selector, "notify::device-selected-name",
-			 G_CALLBACK(device_selected_name_cb), NULL);
-
 	/* Setup page */
 	page_setup = GTK_WIDGET(gtk_builder_get_object(builder, "page_setup"));
 	label_setup = GTK_WIDGET(gtk_builder_get_object(builder, "label_setup"));
@@ -555,38 +566,7 @@
 	g_object_set_data (G_OBJECT (radio_1234), "pin", "1234");
 	g_object_set_data (G_OBJECT (radio_custom), "entry", entry_custom);
 
-	g_signal_connect(radio_auto, "toggled",
-			 G_CALLBACK(set_user_pincode), NULL);
-	g_signal_connect(radio_0000, "toggled",
-			 G_CALLBACK(set_user_pincode), NULL);
-	g_signal_connect(radio_1111, "toggled",
-			 G_CALLBACK(set_user_pincode), NULL);
-	g_signal_connect(radio_1234, "toggled",
-			 G_CALLBACK(set_user_pincode), NULL);
-	g_signal_connect(radio_custom, "toggled",
-			 G_CALLBACK(set_user_pincode), NULL);
-
-	g_signal_connect (entry_custom, "key-press-event",
-			  G_CALLBACK (entry_custom_event), NULL);
-	g_signal_connect (entry_custom, "changed",
-			  G_CALLBACK (entry_custom_changed), NULL);
-	g_signal_connect (radio_custom, "toggled",
-			  G_CALLBACK(toggle_set_sensitive), NULL);
-
-	/* Connect signals.  Autoconnect could be used if the build process
-         * was changed.  Set the GtkBuilder documentation for details.
-         * Check all signals are in the .ui files before removing manual
-         * connections. */
-	/*gtk_builder_connect_signals(builder, NULL);*/
-
-	g_signal_connect(G_OBJECT(assistant), "close",
-					G_CALLBACK(close_callback), NULL);
-	g_signal_connect(G_OBJECT(assistant), "cancel",
-					G_CALLBACK(close_callback), NULL);
-	g_signal_connect(G_OBJECT(assistant), "prepare",
-					G_CALLBACK(prepare_callback), NULL);
-	g_signal_connect (gtk_builder_get_object(builder, "passkey_option_button"), "clicked",
-			  G_CALLBACK (passkey_option_button_clicked), NULL);
+	gtk_builder_connect_signals(builder, NULL);
 
 	gtk_widget_show (GTK_WIDGET(assistant));
 

Modified: trunk/wizard/wizard.ui
==============================================================================
--- trunk/wizard/wizard.ui	(original)
+++ trunk/wizard/wizard.ui	Thu Apr  9 23:16:33 2009
@@ -61,6 +61,8 @@
             <property name="show-device-type">True</property>
             <property name="show-device-category">False</property>
             <property name="visible">True</property>
+            <signal name="selected-device-changed" handler="select_device_changed"/>
+            <signal name="notify::device-selected-name" handler="device_selected_name_cb"/>
           </object>
           <packing>
             <property name="position">0</property>
@@ -201,6 +203,7 @@
                 <property name="use_underline">True</property>
                 <property name="active">True</property>
                 <property name="draw_indicator">True</property>
+                <signal name="toggled" handler="set_user_pincode"/>
               </object>
               <packing>
                 <property name="position">0</property>
@@ -226,6 +229,7 @@
                 <property name="active">True</property>
                 <property name="draw_indicator">True</property>
                 <property name="group">radio_auto</property>
+                <signal name="toggled" handler="set_user_pincode"/>
               </object>
               <packing>
                 <property name="position">2</property>
@@ -240,6 +244,7 @@
                 <property name="active">True</property>
                 <property name="draw_indicator">True</property>
                 <property name="group">radio_auto</property>
+                <signal name="toggled" handler="set_user_pincode"/>
               </object>
               <packing>
                 <property name="position">3</property>
@@ -254,6 +259,7 @@
                 <property name="active">True</property>
                 <property name="draw_indicator">True</property>
                 <property name="group">radio_auto</property>
+                <signal name="toggled" handler="set_user_pincode"/>
               </object>
               <packing>
                 <property name="position">4</property>
@@ -272,6 +278,8 @@
                     <property name="active">True</property>
                     <property name="draw_indicator">True</property>
                     <property name="group">radio_auto</property>
+                    <signal name="toggled" handler="set_user_pincode"/>
+                    <signal name="toggled" handler="toggle_set_sensitive"/>
                   </object>
                   <packing>
                     <property name="expand">False</property>
@@ -284,8 +292,9 @@
                     <property name="sensitive">False</property>
                     <property name="can_focus">True</property>
                     <property name="max_length">20</property>
-                    <property name="invisible_char">&#x25CF;</property>
                     <property name="width_chars">20</property>
+                    <signal name="key-press-event" handler="entry_custom_event"/>
+                    <signal name="changed" handler="entry_custom_changed"/>
                   </object>
                   <packing>
                     <property name="position">1</property>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]