aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2009-08-18 22:00:23 +0800
committerMatthew Barnes <mbarnes@redhat.com>2009-08-18 22:00:23 +0800
commitde528db6c18b7ecee83bb8b52850d935c1244ebf (patch)
treee5c153870853da0f9e317f8eb5e78394e00bd528 /mail
parent9ff9063fe66817737f89decc3fdadb473fa51278 (diff)
downloadgsoc2013-evolution-de528db6c18b7ecee83bb8b52850d935c1244ebf.tar.gz
gsoc2013-evolution-de528db6c18b7ecee83bb8b52850d935c1244ebf.tar.zst
gsoc2013-evolution-de528db6c18b7ecee83bb8b52850d935c1244ebf.zip
BugĀ 567260 - Migrate from GnomeDruid to GtkAssistant
Diffstat (limited to 'mail')
-rw-r--r--mail/em-account-editor.c172
-rw-r--r--mail/em-account-editor.h4
-rw-r--r--mail/em-config.h2
-rw-r--r--mail/mail-config.glade145
4 files changed, 86 insertions, 237 deletions
diff --git a/mail/em-account-editor.c b/mail/em-account-editor.c
index 782cbec2de..af4be14a69 100644
--- a/mail/em-account-editor.c
+++ b/mail/em-account-editor.c
@@ -26,7 +26,7 @@
work before merge can occur:
verify behaviour.
- work out what to do with the startup druid.
+ work out what to do with the startup assistant.
also need to work out:
how to remove unecessary items from a service url once
@@ -48,9 +48,6 @@
#include <glade/glade.h>
-#include <libgnomeui/gnome-druid.h>
-#include <libgnomeui/gnome-druid-page-standard.h>
-
#include "shell/e-shell.h"
#include "e-util/e-error.h"
#include "e-util/e-account-utils.h"
@@ -190,7 +187,7 @@ struct _EMAccountEditorPrivate {
const gchar *widgets_name[5];
gint widgets_index;
- /* for druid page preparation */
+ /* for assistant page preparation */
guint identity_set:1;
guint receive_set:1;
guint send_set:1;
@@ -2071,6 +2068,60 @@ emae_setup_service (EMAccountEditor *emae, EMAccountEditorService *service, Glad
camel_url_free (url);
}
+static GtkWidget *
+emae_create_basic_assistant_page (GtkAssistant *assistant, const gchar *page_id)
+{
+ const gchar *title = NULL, *label = NULL;
+ GtkAssistantPageType page_type = GTK_ASSISTANT_PAGE_CONTENT;
+ GtkWidget *vbox, *lbl;
+ gboolean fill_space = FALSE;
+
+ g_return_val_if_fail (page_id != NULL, NULL);
+
+ if (g_ascii_strcasecmp (page_id, "start_page") == 0) {
+ page_type = GTK_ASSISTANT_PAGE_INTRO;
+ fill_space = TRUE;
+ title = _("Mail Configuration");
+ label = _("Welcome to the Evolution Mail Configuration Assistant.\n\nClick \"Forward\" to begin.");
+ } else if (g_ascii_strcasecmp (page_id, "identity_page") == 0) {
+ title = _("Identity");
+ label = _("Please enter your name and email address below. The \"optional\" fields below do not need to be filled in, unless you wish to include this information in email you send.");
+ } else if (g_ascii_strcasecmp (page_id, "source_page") == 0) {
+ title = _("Receiving Email");
+ label = _("Please configure the following account settings.");
+ } else if (g_ascii_strcasecmp (page_id, "transport_page") == 0) {
+ title = _("Sending Email");
+ label = _("Please enter information about the way you will send mail. If you are not sure, ask your system administrator or Internet Service Provider.");
+ } else if (g_ascii_strcasecmp (page_id, "management_page") == 0) {
+ title = _("Account Management");
+ label = _("Please enter a descriptive name for this account in the space below.\nThis name will be used for display purposes only.");
+ } else if (g_ascii_strcasecmp (page_id, "finish_page") == 0) {
+ page_type = GTK_ASSISTANT_PAGE_CONFIRM;
+ fill_space = TRUE;
+ title = _("Done");
+ label = _("Congratulations, your mail configuration is complete.\n\nYou are now ready to send and receive email using Evolution.\n\nClick \"Apply\" to save your settings.");
+ } else {
+ g_return_val_if_reached (NULL);
+ }
+
+ vbox = gtk_vbox_new (FALSE, 12);
+ gtk_container_set_border_width (GTK_CONTAINER (vbox), 12);
+
+ lbl = gtk_label_new (label);
+ gtk_misc_set_alignment (GTK_MISC (lbl), 0.0, 0.5);
+ gtk_label_set_line_wrap (GTK_LABEL (lbl), TRUE);
+
+ gtk_box_pack_start (GTK_BOX (vbox), lbl, fill_space, fill_space, 0);
+
+ gtk_widget_show_all (vbox);
+
+ gtk_assistant_append_page (assistant, vbox);
+ gtk_assistant_set_page_title (assistant, vbox, title);
+ gtk_assistant_set_page_type (assistant, vbox, page_type);
+
+ return vbox;
+}
+
/* do not re-order these, the order is used by various code to look up emae->priv->identity_entries[] */
static struct {
const gchar *name;
@@ -2126,7 +2177,7 @@ emae_identity_page (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget
xml = glade_xml_new (gladefile, item->label, NULL);
g_free (gladefile);
- /* Management & Identity fields, in the druid the management frame is relocated to the last page later on */
+ /* Management & Identity fields, in the assistant the management frame is relocated to the last page later on */
for (i=0;i<sizeof (emae_identity_entries)/sizeof (emae_identity_entries[0]);i++)
gui->identity_entries[i] = emae_account_entry (emae, emae_identity_entries[i].name, emae_identity_entries[i].item, xml);
@@ -2152,22 +2203,12 @@ emae_identity_page (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget
w = glade_xml_get_widget (xml, item->label);
if (emae->type == EMAE_PAGES) {
gtk_box_pack_start ((GtkBox *)emae->pages[0], w, TRUE, TRUE, 0);
- } else if (((EConfig *)gui->config)->type == E_CONFIG_DRUID) {
- GladeXML *druidxml;
- GtkWidget *page;
-
- gladefile = g_build_filename (EVOLUTION_GLADEDIR,
- "mail-config.glade",
- NULL);
- druidxml = glade_xml_new (gladefile, "identity_page", NULL);
- g_free (gladefile);
+ } else if (((EConfig *)gui->config)->type == E_CONFIG_ASSISTANT) {
+ GtkWidget *page = emae_create_basic_assistant_page (GTK_ASSISTANT (parent), "identity_page");
- page = glade_xml_get_widget (druidxml, "identity_page");
+ gtk_box_pack_start (GTK_BOX (page), w, TRUE, TRUE, 0);
- gtk_box_pack_start ((GtkBox*)((GnomeDruidPageStandard *)page)->vbox, w, TRUE, TRUE, 0);
w = page;
- g_object_unref (druidxml);
- gnome_druid_append_page ((GnomeDruid *)parent, (GnomeDruidPage *)page);
} else {
gtk_notebook_append_page ((GtkNotebook *)parent, w, gtk_label_new (_("Identity")));
}
@@ -2203,22 +2244,12 @@ emae_receive_page (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget
w = glade_xml_get_widget (xml, item->label);
if (emae->type == EMAE_PAGES) {
gtk_box_pack_start ((GtkBox *)emae->pages[1], w, TRUE, TRUE, 0);
- } else if (((EConfig *)gui->config)->type == E_CONFIG_DRUID) {
- GladeXML *druidxml;
- GtkWidget *page;
+ } else if (((EConfig *)gui->config)->type == E_CONFIG_ASSISTANT) {
+ GtkWidget *page = emae_create_basic_assistant_page (GTK_ASSISTANT (parent), "source_page");
- gladefile = g_build_filename (EVOLUTION_GLADEDIR,
- "mail-config.glade",
- NULL);
- druidxml = glade_xml_new (gladefile, "source_page", NULL);
- g_free (gladefile);
+ gtk_box_pack_start (GTK_BOX (page), w, TRUE, TRUE, 0);
- page = glade_xml_get_widget (druidxml, "source_page");
-
- gtk_box_pack_start ((GtkBox*)((GnomeDruidPageStandard *)page)->vbox, w, TRUE, TRUE, 0);
w = page;
- g_object_unref (druidxml);
- gnome_druid_append_page ((GnomeDruid *)parent, (GnomeDruidPage *)page);
} else {
gtk_notebook_append_page ((GtkNotebook *)parent, w, gtk_label_new (_("Receiving Email")));
}
@@ -2673,22 +2704,12 @@ emae_send_page (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget *ol
w = glade_xml_get_widget (xml, item->label);
if (emae->type == EMAE_PAGES) {
gtk_box_pack_start ((GtkBox *)emae->pages[2], w, TRUE, TRUE, 0);
- } else if (((EConfig *)gui->config)->type == E_CONFIG_DRUID) {
- GladeXML *druidxml;
- GtkWidget *page;
-
- gladefile = g_build_filename (EVOLUTION_GLADEDIR,
- "mail-config.glade",
- NULL);
- druidxml = glade_xml_new (gladefile, "transport_page", NULL);
- g_free (gladefile);
+ } else if (((EConfig *)gui->config)->type == E_CONFIG_ASSISTANT) {
+ GtkWidget *page = emae_create_basic_assistant_page (GTK_ASSISTANT (parent), "transport_page");
- page = glade_xml_get_widget (druidxml, "transport_page");
+ gtk_box_pack_start (GTK_BOX (page), w, TRUE, TRUE, 0);
- gtk_box_pack_start ((GtkBox*)((GnomeDruidPageStandard *)page)->vbox, w, TRUE, TRUE, 0);
w = page;
- g_object_unref (druidxml);
- gnome_druid_append_page ((GnomeDruid *)parent, (GnomeDruidPage *)page);
} else {
gtk_notebook_append_page ((GtkNotebook *)parent, w, gtk_label_new (_("Sending Email")));
}
@@ -2884,59 +2905,32 @@ emae_management_page (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidg
GtkWidget *w;
w = gui->management_frame;
- if (((EConfig *)gui->config)->type == E_CONFIG_DRUID) {
- GladeXML *druidxml;
- GtkWidget *page;
- gchar *gladefile;
+ if (((EConfig *)gui->config)->type == E_CONFIG_ASSISTANT) {
+ GtkWidget *page = emae_create_basic_assistant_page (GTK_ASSISTANT (parent), "management_page");
- gladefile = g_build_filename (EVOLUTION_GLADEDIR,
- "mail-config.glade",
- NULL);
- druidxml = glade_xml_new (gladefile, "management_page", NULL);
- g_free (gladefile);
+ gtk_widget_reparent (w, page);
- page = glade_xml_get_widget (druidxml, "management_page");
-
- gtk_widget_reparent (w, ((GnomeDruidPageStandard *)page)->vbox);
w = page;
- g_object_unref (druidxml);
- gnome_druid_append_page ((GnomeDruid *)parent, (GnomeDruidPage *)page);
}
return w;
}
static GtkWidget *
-emae_widget_druid_glade (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget *old, gpointer data)
+emae_widget_assistant_page (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget *old, gpointer data)
{
- GladeXML *druidxml;
- GtkWidget *w;
- gchar *gladefile;
EMAccountEditor *emae = (EMAccountEditor *)data;
if (emae->type == EMAE_PAGES)
return NULL;
- gladefile = g_build_filename (EVOLUTION_GLADEDIR,
- "mail-config.glade",
- NULL);
- druidxml = glade_xml_new (gladefile, item->label, NULL);
- g_free (gladefile);
-
- w = glade_xml_get_widget (druidxml, item->label);
- /* i think the glade file has issues, we need to show all on at least the end page */
- gtk_widget_show_all (w);
- g_object_unref (druidxml);
-
- gnome_druid_append_page ((GnomeDruid *)parent, (GnomeDruidPage *)w);
-
- return w;
+ return emae_create_basic_assistant_page (GTK_ASSISTANT (parent), item->label);
}
-/* plugin meta-data for "org.gnome.evolution.mail.config.accountDruid" */
-static EMConfigItem emae_druid_items[] = {
- { E_CONFIG_DRUID, (gchar *) "" },
- { E_CONFIG_PAGE_START, (gchar *) "0.start", (gchar *) "start_page", emae_widget_druid_glade },
+/* plugin meta-data for "org.gnome.evolution.mail.config.accountAssistant" */
+static EMConfigItem emae_assistant_items[] = {
+ { E_CONFIG_ASSISTANT, (gchar *) "" },
+ { E_CONFIG_PAGE_START, (gchar *) "0.start", (gchar *) "start_page", emae_widget_assistant_page },
{ E_CONFIG_PAGE, (gchar *) "00.identity", (gchar *) "vboxIdentityBorder", emae_identity_page },
{ E_CONFIG_SECTION, (gchar *) "00.identity/00.name", (gchar *) "account_vbox", emae_widget_glade },
@@ -2962,10 +2956,10 @@ static EMConfigItem emae_druid_items[] = {
{ E_CONFIG_PAGE, (gchar *) "40.management", (gchar *) "management_frame", emae_management_page },
- { E_CONFIG_PAGE_FINISH, (gchar *) "999.end", (gchar *) "finish_page", emae_widget_druid_glade },
+ { E_CONFIG_PAGE_FINISH, (gchar *) "999.end", (gchar *) "finish_page", emae_widget_assistant_page },
{ 0 },
};
-static gboolean emae_druid_items_translated = FALSE;
+static gboolean emae_assistant_items_translated = FALSE;
static void
emae_free (EConfig *ec, GSList *items, gpointer data)
@@ -3079,9 +3073,9 @@ emae_check_complete (EConfig *ec, const gchar *pageid, gpointer data)
new_account = (original_account == NULL);
/* We use the page-check of various pages to 'prepare' or
- pre-load their values, only in the druid */
+ pre-load their values, only in the assistant */
if (pageid
- && ((EConfig *)emae->priv->config)->type == E_CONFIG_DRUID) {
+ && ((EConfig *)emae->priv->config)->type == E_CONFIG_ASSISTANT) {
if (!strcmp (pageid, "00.identity")) {
if (!emae->priv->identity_set) {
gchar *uname;
@@ -3342,14 +3336,14 @@ em_account_editor_construct (EMAccountEditor *emae, EMAccountEditorType type, co
emae_editor_items_translated = TRUE;
}
} else {
- ec = em_config_new (E_CONFIG_DRUID, id);
- items = emae_druid_items;
- if (!emae_druid_items_translated) {
+ ec = em_config_new (E_CONFIG_ASSISTANT, id);
+ items = emae_assistant_items;
+ if (!emae_assistant_items_translated) {
for (i=0;items[i].path;i++) {
if (items[i].label)
items[i].label = _(items[i].label);
}
- emae_druid_items_translated = TRUE;
+ emae_assistant_items_translated = TRUE;
}
}
diff --git a/mail/em-account-editor.h b/mail/em-account-editor.h
index b8913e2a83..83e9cd4885 100644
--- a/mail/em-account-editor.h
+++ b/mail/em-account-editor.h
@@ -54,7 +54,7 @@ typedef struct _EMAccountEditorPrivate EMAccountEditorPrivate;
typedef enum {
EMAE_NOTEBOOK,
- EMAE_DRUID,
+ EMAE_ASSISTANT,
EMAE_PAGES
} EMAccountEditorType;
@@ -64,7 +64,7 @@ struct _EMAccountEditor {
EMAccountEditorPrivate *priv;
EMAccountEditorType type;
- GtkWidget *editor; /* gtknotebook or druid, depending on type */
+ GtkWidget *editor; /* gtknotebook or gtkassistant, depending on type */
EMConfig *config; /* driver object */
diff --git a/mail/em-config.h b/mail/em-config.h
index 656a40ec38..05401f026f 100644
--- a/mail/em-config.h
+++ b/mail/em-config.h
@@ -67,7 +67,7 @@ struct _EMConfigTargetAccount {
EAccount *account;
/* Need also: working account, not just real account, so changes can be propagated around
- And some mechamism for controlling the gui if we're running inside a druid, e.g. enabling 'next' */
+ And some mechamism for controlling the gui if we're running inside an assistant, e.g. enabling 'next' */
};
typedef struct _EConfigItem EMConfigItem;
diff --git a/mail/mail-config.glade b/mail/mail-config.glade
index 62d19304a9..bc88e6e0b4 100644
--- a/mail/mail-config.glade
+++ b/mail/mail-config.glade
@@ -4,151 +4,6 @@
<!-- interface-requires gnome 2298.56488 -->
<!-- interface-requires gtk+ 2.16 -->
<!-- interface-naming-policy toplevel-contextual -->
- <widget class="GtkWindow" id="account_druid">
- <property name="title" translatable="yes">Evolution Account Assistant</property>
- <child>
- <widget class="GnomeDruid" id="druid">
- <property name="visible">True</property>
- <property name="border_width">4</property>
- <child>
- <widget class="GnomeDruidPageEdge" id="start_page">
- <property name="visible">True</property>
- <property name="position">Edge Start</property>
- <property name="title" translatable="yes">Mail Configuration</property>
- <property name="text" translatable="yes">Welcome to the Evolution Mail Configuration Assistant.
-
-Click "Forward" to begin.</property>
- </widget>
- </child>
- <child>
- <widget class="GnomeDruidPageStandard" id="identity_page">
- <property name="visible">True</property>
- <property name="title" translatable="yes">Identity</property>
- <child internal-child="vbox">
- <widget class="GtkVBox" id="druid_identity_vbox">
- <property name="visible">True</property>
- <property name="border_width">12</property>
- <property name="spacing">12</property>
- <child>
- <widget class="GtkLabel" id="identity_help">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Please enter your name and email address below. The "optional" fields below do not need to be filled in, unless you wish to include this information in email you send.</property>
- <property name="wrap">True</property>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <placeholder/>
- </child>
- </widget>
- </child>
- </widget>
- </child>
- <child>
- <widget class="GnomeDruidPageStandard" id="source_page">
- <property name="visible">True</property>
- <property name="title" translatable="yes">Receiving Email</property>
- <child internal-child="vbox">
- <widget class="GtkVBox" id="druid_source_vbox">
- <property name="visible">True</property>
- <property name="border_width">12</property>
- <property name="spacing">12</property>
- <child>
- <widget class="GtkLabel" id="extra_help">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Please configure the following account settings.</property>
- <property name="wrap">True</property>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <placeholder/>
- </child>
- </widget>
- </child>
- </widget>
- </child>
- <child>
- <widget class="GnomeDruidPageStandard" id="transport_page">
- <property name="visible">True</property>
- <property name="title" translatable="yes">Sending Email</property>
- <child internal-child="vbox">
- <widget class="GtkVBox" id="druid_transport_vbox">
- <property name="visible">True</property>
- <property name="border_width">12</property>
- <property name="spacing">12</property>
- <child>
- <widget class="GtkLabel" id="transport_help">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Please enter information about the way you will send mail. If you are not sure, ask your system administrator or Internet Service Provider.</property>
- <property name="wrap">True</property>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <placeholder/>
- </child>
- </widget>
- </child>
- </widget>
- </child>
- <child>
- <widget class="GnomeDruidPageStandard" id="management_page">
- <property name="visible">True</property>
- <property name="title" translatable="yes">Account Management</property>
- <child internal-child="vbox">
- <widget class="GtkVBox" id="druid_management_vbox">
- <property name="visible">True</property>
- <property name="border_width">12</property>
- <property name="spacing">12</property>
- <child>
- <widget class="GtkLabel" id="management_help">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Please enter a descriptive name for this account in the space below.
-This name will be used for display purposes only.</property>
- <property name="wrap">True</property>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <placeholder/>
- </child>
- </widget>
- </child>
- </widget>
- </child>
- <child>
- <widget class="GnomeDruidPageEdge" id="finish_page">
- <property name="visible">True</property>
- <property name="position">Edge Finish</property>
- <property name="title" translatable="yes">Done</property>
- <property name="text" translatable="yes">Congratulations, your mail configuration is complete.
-
-You are now ready to send and receive email
-using Evolution.
-
-Click "Apply" to save your settings.</property>
- </widget>
- </child>
- </widget>
- </child>
- </widget>
<widget class="GtkWindow" id="account_editor">
<property name="title" translatable="yes">Account Editor</property>
<child>