[empathy] factor out build_error_page
- From: Guillaume Desmottes <gdesmott src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [empathy] factor out build_error_page
- Date: Mon, 25 Jan 2010 14:14:48 +0000 (UTC)
commit 5321b5a3fca104ceeb265c053da7460a1809a53f
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date: Thu Jan 21 15:28:32 2010 +0000
factor out build_error_page
src/empathy-account-assistant.c | 52 ++++++++++++++++++++++++---------------
1 files changed, 32 insertions(+), 20 deletions(-)
---
diff --git a/src/empathy-account-assistant.c b/src/empathy-account-assistant.c
index 4cd7aa9..9ae1616 100644
--- a/src/empathy-account-assistant.c
+++ b/src/empathy-account-assistant.c
@@ -111,13 +111,11 @@ static void account_assistant_finish_enter_or_create_page (
static void do_constructed (GObject *object);
static GtkWidget *
-account_assistant_build_error_page (EmpathyAccountAssistant *self,
- GError *error, gint page_num)
+build_error_page (const gchar *primary_message,
+ const gchar *secondary_message)
{
GtkWidget *main_vbox, *w, *hbox;
- const char *message;
PangoAttrList *list;
- EmpathyAccountAssistantPriv *priv = GET_PRIV (self);
main_vbox = gtk_vbox_new (FALSE, 12);
gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 12);
@@ -132,18 +130,7 @@ account_assistant_build_error_page (EmpathyAccountAssistant *self,
gtk_box_pack_start (GTK_BOX (hbox), w, FALSE, FALSE, 0);
gtk_widget_show (w);
- if (page_num == PAGE_IMPORT)
- message = _("There was an error while importing the accounts.");
- else if (page_num >= PAGE_ENTER_CREATE &&
- priv->first_resp == RESPONSE_ENTER_ACCOUNT)
- message = _("There was an error while parsing the account details.");
- else if (page_num >= PAGE_ENTER_CREATE &&
- priv->first_resp == RESPONSE_CREATE_ACCOUNT)
- message = _("There was an error while creating the account.");
- else
- message = _("There was an error.");
-
- w = gtk_label_new (message);
+ w = gtk_label_new (primary_message);
gtk_box_pack_start (GTK_BOX (hbox), w, FALSE, FALSE, 0);
list = pango_attr_list_new ();
pango_attr_list_insert (list, pango_attr_scale_new (PANGO_SCALE_LARGE));
@@ -155,15 +142,40 @@ account_assistant_build_error_page (EmpathyAccountAssistant *self,
pango_attr_list_unref (list);
- message = g_markup_printf_escaped
- (_("The error message was: <span style=\"italic\">%s</span>"),
- error->message);
- w = gtk_label_new (message);
+ w = gtk_label_new (secondary_message);
gtk_label_set_use_markup (GTK_LABEL (w), TRUE);
gtk_box_pack_start (GTK_BOX (main_vbox), w, FALSE, FALSE, 0);
gtk_misc_set_alignment (GTK_MISC (w), 0, 0.5);
gtk_widget_show (w);
+ return main_vbox;
+}
+
+static GtkWidget *
+account_assistant_build_error_page (EmpathyAccountAssistant *self,
+ GError *error, gint page_num)
+{
+ GtkWidget *main_vbox, *w;
+ const char *primary_message, *secondary_message;
+ EmpathyAccountAssistantPriv *priv = GET_PRIV (self);
+
+ if (page_num == PAGE_IMPORT)
+ primary_message = _("There was an error while importing the accounts.");
+ else if (page_num >= PAGE_ENTER_CREATE &&
+ priv->first_resp == RESPONSE_ENTER_ACCOUNT)
+ primary_message = _("There was an error while parsing the account details.");
+ else if (page_num >= PAGE_ENTER_CREATE &&
+ priv->first_resp == RESPONSE_CREATE_ACCOUNT)
+ primary_message = _("There was an error while creating the account.");
+ else
+ primary_message = _("There was an error.");
+
+ secondary_message = g_markup_printf_escaped
+ (_("The error message was: <span style=\"italic\">%s</span>"),
+ error->message);
+
+ main_vbox = build_error_page (primary_message, secondary_message);
+
w = gtk_label_new (_("You can either go back and try to enter your "
"accounts' details again or quit this assistant and add accounts "
"later from the Edit menu."));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]