diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2010-01-21 23:28:32 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2010-01-25 22:13:40 +0800 |
commit | 5321b5a3fca104ceeb265c053da7460a1809a53f (patch) | |
tree | 4bb5b88768c45940acae6ddbee5bb19e74bec20a /src/empathy-account-assistant.c | |
parent | c4cdb393343d6c7a18364d01202f8b150233c145 (diff) | |
download | gsoc2013-empathy-5321b5a3fca104ceeb265c053da7460a1809a53f.tar gsoc2013-empathy-5321b5a3fca104ceeb265c053da7460a1809a53f.tar.gz gsoc2013-empathy-5321b5a3fca104ceeb265c053da7460a1809a53f.tar.bz2 gsoc2013-empathy-5321b5a3fca104ceeb265c053da7460a1809a53f.tar.lz gsoc2013-empathy-5321b5a3fca104ceeb265c053da7460a1809a53f.tar.xz gsoc2013-empathy-5321b5a3fca104ceeb265c053da7460a1809a53f.tar.zst gsoc2013-empathy-5321b5a3fca104ceeb265c053da7460a1809a53f.zip |
factor out build_error_page
Diffstat (limited to 'src/empathy-account-assistant.c')
-rw-r--r-- | 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 4cd7aa901..9ae16163a 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.")); |