[gnome-bluetooth] Add finishing page



commit 3335c7cf0eeca5c9faf83d819cef7088b0cf881d
Author: Bastien Nocera <hadess hadess net>
Date:   Tue Jun 16 17:25:14 2009 +0100

    Add finishing page
    
    To show a "finishing setup" label and nice spinner, until we
    finish connecting to the device.

 wizard/main.c    |   54 ++++++++++++++++++++++++++++++-------
 wizard/wizard.ui |   77 ++++++++++++++++++++++++++++++++++++++++++++++-------
 2 files changed, 109 insertions(+), 22 deletions(-)
---
diff --git a/wizard/main.c b/wizard/main.c
index e4892cd..34f380c 100644
--- a/wizard/main.c
+++ b/wizard/main.c
@@ -56,6 +56,7 @@ enum {
 	PAGE_SETUP,
 	PAGE_SSP_SETUP,
 	PAGE_FAILURE,
+	PAGE_FINISHING,
 	PAGE_SUMMARY
 };
 
@@ -81,12 +82,13 @@ static GtkBuilder *builder = NULL;
 
 static GtkAssistant *window_assistant = NULL;
 static GtkWidget *page_search = NULL;
+static GtkWidget *page_connecting = NULL;
 static GtkWidget *page_setup = NULL;
 static GtkWidget *page_ssp_setup = NULL;
 static GtkWidget *page_failure = NULL;
+static GtkWidget *page_finishing = NULL;
 static GtkWidget *page_summary = NULL;
 
-static GtkWidget *page_connecting = NULL;
 static GtkWidget *label_connecting = NULL;
 static GtkWidget *spinner_connecting = NULL;
 
@@ -100,6 +102,9 @@ static GtkWidget *matches_button = NULL;
 
 static GtkWidget *label_failure = NULL;
 
+static GtkWidget *label_finishing = NULL;
+static GtkWidget *spinner_finishing = NULL;
+
 static GtkWidget *label_summary = NULL;
 static GtkWidget *extra_config_vbox = NULL;
 static GtkWidget *extra_config_frame = NULL;
@@ -392,14 +397,7 @@ create_callback (BluetoothClient *_client,
 	data->timer = g_timer_new ();
 
 	if (bluetooth_client_connect_service(client, path, connect_callback, data) != FALSE) {
-		//FIXME
-		/*
-		char *text;
-		text = g_strdup_printf (_("Please wait while finishing setup on '%s'..."),
-					target_name);
-		gtk_label_set_text (GTK_LABEL (label_finishing), text);
-		g_free (text);
-		*/
+		gtk_assistant_set_current_page (window_assistant, PAGE_FINISHING);
 	} else {
 		gtk_assistant_set_current_page (window_assistant, PAGE_SUMMARY);
 		g_timer_destroy (data->timer);
@@ -476,6 +474,15 @@ prepare_idle_cb (gpointer data)
 		gtk_widget_hide (assistant->close);
 		gtk_widget_hide (assistant->cancel);
 	}
+	if (page == PAGE_FINISHING) {
+		gtk_widget_hide (assistant->forward);
+		gtk_widget_hide (assistant->back);
+		gtk_widget_hide (assistant->apply);
+		gtk_widget_hide (assistant->last);
+		gtk_widget_hide (assistant->cancel);
+		gtk_widget_show (assistant->close);
+		gtk_widget_set_sensitive (assistant->close, FALSE);
+	}
 	return FALSE;
 }
 
@@ -558,13 +565,31 @@ void prepare_callback (GtkWidget *assistant,
 		}
 	}
 
+	if (page == page_finishing) {
+		char *text;
+
+		complete = FALSE;
+
+		bling_spinner_start (BLING_SPINNER (spinner_finishing));
+
+		/* translators:
+		 * The '%s' is the device name, for example:
+		 * Please wait while finishing setup on 'Sony Bluetooth Headset'...
+		 */
+		text = g_strdup_printf (_("Please wait while finishing setup on '%s'..."), target_name);
+		gtk_label_set_text (GTK_LABEL (label_finishing), text);
+		g_free (text);
+	} else {
+		bling_spinner_stop (BLING_SPINNER (spinner_finishing));
+	}
+
 	if (page == page_summary) {
 		GList *widgets = NULL;
 		GValue value = { 0, };
 		char **uuids, *text;
 
 		bluetooth_chooser_get_selected_device_info (selector, "name", &value);
-		text = g_strdup_printf ("Successfully configured '%s' device", g_value_get_string (&value));
+		text = g_strdup_printf (_("Successfully configured '%s'"), g_value_get_string (&value));
 		g_value_unset (&value);
 		gtk_label_set_text (GTK_LABEL (label_summary), text);
 		g_free (text);
@@ -846,10 +871,12 @@ create_wizard (void)
 	const char *pages[] = {
 		"page_intro",
 		"page_search",
+		"page_connecting",
 		"page_setup",
 		"page_ssp_setup",
 		"page_failure",
-		"page_summary"
+		"page_finishing",
+		"page_summary",
 	};
 	guint i;
 
@@ -920,6 +947,11 @@ create_wizard (void)
 	gtk_assistant_set_page_complete(assistant, page_failure, FALSE);
 	label_failure = W("label_failure");
 
+	/* Finishing page */
+	page_finishing = W("page_finishing");
+	label_finishing = W("label_finishing");
+	spinner_finishing = W("spinner_finishing");
+
 	/* Summary page */
 	page_summary = W("page_summary");
 	label_summary = W("label_summary");
diff --git a/wizard/wizard.ui b/wizard/wizard.ui
index 9c3e64a..168fd60 100644
--- a/wizard/wizard.ui
+++ b/wizard/wizard.ui
@@ -60,7 +60,7 @@
       </object>
       <packing>
         <property name="page_type">intro</property>
-        <property name="title">Introduction</property>
+        <property name="title" translatable="yes">Introduction</property>
       </packing>
     </child>
     <child>
@@ -100,7 +100,7 @@
         </child>
       </object>
       <packing>
-        <property name="title">Device search</property>
+        <property name="title" translatable="yes">Device search</property>
       </packing>
     </child>
     <child>
@@ -112,10 +112,10 @@
           <object class="GtkTable" id="table1">
             <property name="visible">True</property>
             <property name="n_rows">2</property>
-	    <property name="n_columns">2</property>
-	    <property name="row-spacing">12</property>
-	    <property name="column-spacing">12</property>
-	    <property name="border-width">12</property>
+            <property name="n_columns">2</property>
+            <property name="row-spacing">12</property>
+            <property name="column-spacing">12</property>
+            <property name="border-width">12</property>
             <child>
               <object class="GtkLabel" id="label_connecting">
                 <property name="visible">True</property>
@@ -155,7 +155,7 @@
         </child>
       </object>
       <packing>
-        <property name="title">Device Setup</property>
+        <property name="title" translatable="yes">Device Setup</property>
       </packing>
     </child>
     <child>
@@ -187,7 +187,7 @@
         </child>
       </object>
       <packing>
-        <property name="title">Device Setup</property>
+        <property name="title" translatable="yes">Device Setup</property>
       </packing>
     </child>
     <child>
@@ -219,7 +219,7 @@
         </child>
       </object>
       <packing>
-        <property name="title">Device Setup</property>
+        <property name="title" translatable="yes">Device Setup</property>
       </packing>
     </child>
     <child>
@@ -241,7 +241,62 @@
         </child>
       </object>
       <packing>
-        <property name="title">Device Setup Failed</property>
+        <property name="title" translatable="yes">Device Setup Failed</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkVBox" id="page_finishing">
+        <property name="visible">True</property>
+        <property name="orientation">vertical</property>
+        <property name="spacing">6</property>
+        <child>
+          <object class="GtkTable" id="table1">
+            <property name="visible">True</property>
+            <property name="n_rows">2</property>
+            <property name="n_columns">2</property>
+            <property name="row-spacing">12</property>
+            <property name="column-spacing">12</property>
+            <property name="border-width">12</property>
+            <child>
+              <object class="GtkLabel" id="label_finishing">
+                <property name="visible">True</property>
+                <property name="xalign">0</property>
+                <property name="yalign">0</property>
+                <property name="label" translatable="yes">Finishing setup on 'Foobar'...</property>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="right_attach">2</property>
+              </packing>
+            </child>
+            <child>
+              <object class="BlingSpinner" id="spinner_finishing">
+                <property name="visible">True</property>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="right_attach">1</property>
+                <property name="x-options">0</property>
+                <property name="y-options">0</property>
+              </packing>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+          </object>
+          <packing>
+            <property name="position">0</property>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
+            <property name="padding">12</property>
+          </packing>
+        </child>
+      </object>
+      <packing>
+        <property name="title" translatable="yes">Finishing Device Setup</property>
       </packing>
     </child>
     <child>
@@ -315,7 +370,7 @@
       </object>
       <packing>
         <property name="page_type">summary</property>
-        <property name="title">Setup Completed</property>
+        <property name="title" translatable="yes">Setup Completed</property>
       </packing>
     </child>
   </object>



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