[gnome-bluetooth/gnome-3-2] wizard: Don't display "Device Setup Failed" in sidebar
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-bluetooth/gnome-3-2] wizard: Don't display "Device Setup Failed" in sidebar
- Date: Wed, 18 Jan 2012 14:46:19 +0000 (UTC)
commit ef008a79d0f09f957f2333675b415e98ea2da7ec
Author: Bastien Nocera <hadess hadess net>
Date: Wed Jan 18 14:39:30 2012 +0000
wizard: Don't display "Device Setup Failed" in sidebar
Seeing as the page names are now visible before we get to the
page, we should try as hard as possible to not show this
sort of page in the UI.
https://bugzilla.gnome.org/show_bug.cgi?id=660453
Conflicts:
wizard/main.c
wizard/main.c | 34 +++++++++++++++++-----------------
wizard/wizard.ui | 27 +--------------------------
2 files changed, 18 insertions(+), 43 deletions(-)
---
diff --git a/wizard/main.c b/wizard/main.c
index 7a7aa7f..53a1b36 100644
--- a/wizard/main.c
+++ b/wizard/main.c
@@ -54,7 +54,6 @@ enum {
PAGE_CONNECTING,
PAGE_SETUP,
PAGE_SSP_SETUP,
- PAGE_FAILURE,
PAGE_FINISHING,
PAGE_SUMMARY
};
@@ -87,7 +86,6 @@ 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;
@@ -102,11 +100,10 @@ static GtkWidget *label_ssp_pin = NULL;
static GtkWidget *does_not_match_button = NULL;
static GtkWidget *matches_button = NULL;
-static GtkWidget *label_failure = NULL;
-
static GtkWidget *label_finishing = NULL;
static GtkWidget *spinner_finishing = NULL;
+static gboolean summary_failure = FALSE;
static GtkWidget *label_summary = NULL;
static GtkWidget *extra_config_vbox = NULL;
@@ -182,6 +179,7 @@ restart_button_clicked (GtkButton *button,
target_address = NULL;
g_free (target_name);
target_name = NULL;
+ summary_failure = FALSE;
g_object_set (selector,
"device-category-filter", BLUETOOTH_CATEGORY_NOT_PAIRED_OR_TRUSTED,
@@ -198,14 +196,15 @@ does_not_match_cb (GtkButton *button,
GError *error = NULL;
char *text;
- gtk_assistant_set_current_page (window_assistant, PAGE_FAILURE);
+ summary_failure = TRUE;
+ gtk_assistant_set_current_page (window_assistant, PAGE_SUMMARY);
/* translators:
* The '%s' is the device name, for example:
* Pairing with 'Sony Bluetooth Headset' cancelled
*/
text = g_strdup_printf(_("Pairing with '%s' cancelled"), target_name);
- gtk_label_set_text(GTK_LABEL(label_failure), text);
+ gtk_label_set_text(GTK_LABEL(label_summary), text);
g_free(text);
context = g_object_get_data (G_OBJECT (button), "context");
@@ -319,14 +318,15 @@ cancel_callback (DBusGMethodInvocation *context,
create_started = FALSE;
- gtk_assistant_set_current_page (window_assistant, PAGE_FAILURE);
+ summary_failure = TRUE;
+ gtk_assistant_set_current_page (window_assistant, PAGE_SUMMARY);
/* translators:
* The '%s' is the device name, for example:
* Pairing with 'Sony Bluetooth Headset' cancelled
*/
text = g_strdup_printf(_("Pairing with '%s' cancelled"), target_name);
- gtk_label_set_text(GTK_LABEL(label_failure), text);
+ gtk_label_set_text(GTK_LABEL(label_summary), text);
g_free(text);
dbus_g_method_return(context);
@@ -375,7 +375,8 @@ create_callback (BluetoothClient *_client,
if (path == NULL) {
char *text;
- gtk_assistant_set_current_page (window_assistant, PAGE_FAILURE);
+ summary_failure = TRUE;
+ gtk_assistant_set_current_page (window_assistant, PAGE_SUMMARY);
/* translators:
* The '%s' is the device name, for example:
@@ -383,7 +384,10 @@ create_callback (BluetoothClient *_client,
*/
text = g_strdup_printf(_("Setting up '%s' failed"), target_name);
- gtk_label_set_markup(GTK_LABEL(label_failure), text);
+ g_warning ("Setting up '%s' failed: %s", target_name, error->message);
+
+ gtk_label_set_markup(GTK_LABEL(label_summary), text);
+ g_free (text);
return;
}
@@ -511,7 +515,7 @@ void prepare_callback (GtkWidget *assistant,
gtk_spinner_stop (GTK_SPINNER (spinner_finishing));
}
- if (page == page_summary) {
+ if (page == page_summary && summary_failure == FALSE) {
GList *widgets = NULL;
GValue value = { 0, };
char **uuids, *text;
@@ -545,10 +549,11 @@ void prepare_callback (GtkWidget *assistant,
g_list_free (widgets);
gtk_widget_show_all (extra_config_vbox);
}
+ gtk_widget_show (button_close);
}
/* Setup the buttons some */
- if (page == page_failure) {
+ if (page == page_summary && summary_failure) {
complete = FALSE;
gtk_assistant_add_action_widget (GTK_ASSISTANT (assistant), W("restart_button"));
gtk_widget_show (button_close);
@@ -924,11 +929,6 @@ create_wizard (void)
does_not_match_button = W("does_not_match_button");
matches_button = W("matches_button");
- /* Failure page */
- page_failure = W("page_failure");
- 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");
diff --git a/wizard/wizard.ui b/wizard/wizard.ui
index 5c8b289..3102cc9 100644
--- a/wizard/wizard.ui
+++ b/wizard/wizard.ui
@@ -236,31 +236,6 @@
</packing>
</child>
<child>
- <object class="GtkBox" id="page_failure">
- <property name="orientation">vertical</property>
- <property name="visible">True</property>
- <property name="border_width">24</property>
- <property name="spacing">6</property>
- <child>
- <object class="GtkLabel" id="label_failure">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="yalign">0</property>
- <property name="label">Setting up 'Foobar' failed</property>
- <property name="wrap">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="title" translatable="yes">Device Setup Failed</property>
- <property name="page_type">custom</property>
- </packing>
- </child>
- <child>
<object class="GtkBox" id="page_finishing">
<property name="visible">True</property>
<property name="orientation">vertical</property>
@@ -365,7 +340,7 @@
</child>
</object>
<packing>
- <property name="page_type">summary</property>
+ <property name="page_type">custom</property>
<property name="title" translatable="yes">Setup Completed</property>
</packing>
</child>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]