diff options
author | Milan Crha <mcrha@redhat.com> | 2009-08-18 22:00:23 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2009-08-18 22:00:23 +0800 |
commit | de528db6c18b7ecee83bb8b52850d935c1244ebf (patch) | |
tree | e5c153870853da0f9e317f8eb5e78394e00bd528 /plugins | |
parent | 9ff9063fe66817737f89decc3fdadb473fa51278 (diff) | |
download | gsoc2013-evolution-de528db6c18b7ecee83bb8b52850d935c1244ebf.tar gsoc2013-evolution-de528db6c18b7ecee83bb8b52850d935c1244ebf.tar.gz gsoc2013-evolution-de528db6c18b7ecee83bb8b52850d935c1244ebf.tar.bz2 gsoc2013-evolution-de528db6c18b7ecee83bb8b52850d935c1244ebf.tar.lz gsoc2013-evolution-de528db6c18b7ecee83bb8b52850d935c1244ebf.tar.xz gsoc2013-evolution-de528db6c18b7ecee83bb8b52850d935c1244ebf.tar.zst gsoc2013-evolution-de528db6c18b7ecee83bb8b52850d935c1244ebf.zip |
BugĀ 567260 - Migrate from GnomeDruid to GtkAssistant
Diffstat (limited to 'plugins')
7 files changed, 98 insertions, 80 deletions
diff --git a/plugins/backup-restore/backup-restore.c b/plugins/backup-restore/backup-restore.c index 560fa5c63c..6df2763698 100644 --- a/plugins/backup-restore/backup-restore.c +++ b/plugins/backup-restore/backup-restore.c @@ -31,8 +31,6 @@ #include <gtk/gtk.h> #include <glib/gi18n.h> #include <glib/gstdio.h> -#include <libgnomeui/gnome-druid.h> -#include <libgnomeui/gnome-druid-page-standard.h> #include "mail/em-config.h" #include "mail/em-account-editor.h" #include "e-util/e-error.h" @@ -105,7 +103,7 @@ dialog_prompt_user(GtkWindow *parent, const gchar *string, const gchar *tag, con /* We should hardcode this to true */ gtk_toggle_button_set_active ((GtkToggleButton *)check, TRUE); gtk_container_set_border_width((GtkContainer *)check, 12); - gtk_box_pack_start ((GtkBox *)((GtkDialog *) mbox)->vbox, check, TRUE, TRUE, 0); + gtk_box_pack_start ((GtkBox *)gtk_dialog_get_content_area ((GtkDialog *) mbox), check, TRUE, TRUE, 0); gtk_widget_show (check); button = gtk_dialog_run ((GtkDialog *) mbox); @@ -235,77 +233,74 @@ action_settings_restore_cb (GtkAction *action, } static void -check_toggled (GtkToggleButton *button, GnomeDruid *druid) +check_toggled (GtkToggleButton *button, GtkAssistant *assistant) { - GtkWidget *box = g_object_get_data ((GObject *)button, "box"); - gboolean state = gtk_toggle_button_get_active ((GtkToggleButton *)button); - gchar *prevfile = g_object_get_data ((GObject *)druid, "restore-file"); + GtkWidget *box = g_object_get_data ((GObject *)button, "box"); + gboolean state = gtk_toggle_button_get_active ((GtkToggleButton *)button); gtk_widget_set_sensitive (box, state); - gnome_druid_set_show_finish (druid, state); - if (state && !prevfile) - gnome_druid_set_buttons_sensitive (druid, TRUE, FALSE, TRUE, TRUE); - else - gnome_druid_set_buttons_sensitive (druid, TRUE, TRUE, TRUE, TRUE); - g_object_set_data ((GObject *)druid, "restore", GINT_TO_POINTER (state?1:0)); + g_object_set_data ((GObject *)assistant, "restore", GINT_TO_POINTER (state?1:0)); + e_config_target_changed ((EConfig *) g_object_get_data ((GObject *)assistant, "restore-config"), E_CONFIG_TARGET_CHANGED_STATE); } static void -restore_wizard (GnomeDruidPage *druidpage, GnomeDruid *druid, gpointer user_data) +file_changed (GtkFileChooser *chooser, GtkAssistant *assistant) { - gboolean state = GPOINTER_TO_INT(g_object_get_data((GObject *)druid, "restore")) ? TRUE:FALSE; - gchar *file = g_object_get_data ((GObject *)druid, "restore-file"); + gchar *file = NULL, *prevfile = NULL; + gchar *uri = NULL; - if (state) { - if (!file ||!sanity_check (file)) { - e_error_run ((GtkWindow *)druid, "org.gnome.backup-restore:invalid-backup", NULL); - } else - restore (file, TRUE); + uri = gtk_file_chooser_get_current_folder_uri (GTK_FILE_CHOOSER (chooser)); + e_file_update_save_path (uri, TRUE); - } + file = gtk_file_chooser_get_filename (chooser); + prevfile = g_object_get_data ((GObject *)assistant, "restore-file"); + g_object_set_data ((GObject *)assistant, "restore-file", file); + g_free (prevfile); + + e_config_target_changed ((EConfig *) g_object_get_data ((GObject *)assistant, "restore-config"), E_CONFIG_TARGET_CHANGED_STATE); } -static void -file_changed (GtkFileChooser *chooser, GnomeDruid *druid) +static gboolean +backup_restore_check (EConfig *ec, const gchar *pageid, gpointer data) { - gchar *file = NULL, *prevfile=NULL; - gchar *uri = NULL; + GtkAssistant *assistant = data; + gint do_restore; + gchar *file; - uri = gtk_file_chooser_get_current_folder_uri(GTK_FILE_CHOOSER (chooser)); - e_file_update_save_path(uri, TRUE); + g_return_val_if_fail (data != NULL, FALSE); + g_return_val_if_fail (GTK_IS_ASSISTANT (data), FALSE); - file = gtk_file_chooser_get_filename (chooser); - prevfile = g_object_get_data ((GObject *)druid, "restore-file"); - g_object_set_data ((GObject *)druid, "restore-file", file); - g_free (prevfile); - if (file) { - gnome_druid_set_buttons_sensitive (druid, TRUE, TRUE, TRUE, TRUE); - } else - gnome_druid_set_buttons_sensitive (druid, TRUE, FALSE, TRUE, TRUE); + do_restore = GPOINTER_TO_INT (g_object_get_data ((GObject *)assistant, "restore")); + file = g_object_get_data ((GObject *)assistant, "restore-file"); + e_config_set_page_is_finish (ec, "0.startup_page.10.backup_restore", do_restore); + + return !do_restore || file; } + GtkWidget * backup_restore_page (EPlugin *ep, EConfigHookItemFactoryData *hook_data) { - GtkWidget *page; - GtkWidget *box, *hbox, *label, *cbox, *button; + GtkWidget *page, *hbox, *label, *cbox, *button; + GtkAssistant *assistant = GTK_ASSISTANT (hook_data->parent); + + page = gtk_vbox_new (FALSE, 6); + gtk_container_set_border_width (GTK_CONTAINER (page), 12); - page = gnome_druid_page_standard_new_with_vals (_("Restore from backup"), NULL, NULL); hbox = gtk_hbox_new (FALSE, 6); label = gtk_label_new (_("You can restore Evolution from your backup. It can restore all the Mails, Calendars, Tasks, Memos, Contacts. It also restores all your personal settings, mail filters etc.")); gtk_label_set_line_wrap ((GtkLabel *)label, TRUE); gtk_label_set_single_line_mode ((GtkLabel *)label, FALSE); gtk_box_pack_start ((GtkBox *)hbox, label, FALSE, FALSE, 6); - box = gtk_vbox_new (FALSE, 6); - gtk_box_pack_start ((GtkBox *)box, hbox, FALSE, FALSE, 0); + gtk_box_pack_start ((GtkBox *)page, hbox, FALSE, FALSE, 0); hbox = gtk_hbox_new (FALSE, 6); cbox = gtk_check_button_new_with_mnemonic (_("_Restore Evolution from the backup file")); - g_signal_connect (cbox, "toggled", G_CALLBACK (check_toggled), hook_data->parent); + g_signal_connect (cbox, "toggled", G_CALLBACK (check_toggled), assistant); gtk_box_pack_start ((GtkBox *)hbox, cbox, FALSE, FALSE, 6); - gtk_box_pack_start ((GtkBox *)box, hbox, FALSE, FALSE, 0); + gtk_box_pack_start ((GtkBox *)page, hbox, FALSE, FALSE, 0); hbox = gtk_hbox_new (FALSE, 6); g_object_set_data ((GObject *)cbox, "box", hbox); @@ -313,24 +308,37 @@ backup_restore_page (EPlugin *ep, EConfigHookItemFactoryData *hook_data) gtk_box_pack_start ((GtkBox *)hbox, label, FALSE, FALSE, 12); button = gtk_file_chooser_button_new (_("Choose a file to restore"), GTK_FILE_CHOOSER_ACTION_OPEN); - g_signal_connect (button, "selection-changed", G_CALLBACK (file_changed), hook_data->parent); + g_signal_connect (button, "selection-changed", G_CALLBACK (file_changed), assistant); gtk_file_chooser_button_set_width_chars ((GtkFileChooserButton *)button, 20); gtk_box_pack_start ((GtkBox *)hbox, button, FALSE, FALSE, 0); - gtk_box_pack_start ((GtkBox *)box, hbox, FALSE, FALSE, 0); + gtk_box_pack_start ((GtkBox *)page, hbox, FALSE, FALSE, 0); gtk_widget_set_sensitive (hbox, FALSE); - gtk_container_add ((GtkContainer *) GNOME_DRUID_PAGE_STANDARD (page)->vbox, box); - gtk_widget_show_all (box); - gnome_druid_append_page (GNOME_DRUID (hook_data->parent), GNOME_DRUID_PAGE (page)); - g_object_set_data ((GObject *)hook_data->parent, "restore", GINT_TO_POINTER (FALSE)); - g_signal_connect (page, "finish", G_CALLBACK (restore_wizard), NULL); + gtk_assistant_append_page (assistant, page); + gtk_assistant_set_page_title (assistant, page, _("Restore from backup")); + gtk_widget_show_all (page); + + g_object_set_data ((GObject *)assistant, "restore", GINT_TO_POINTER (FALSE)); + g_object_set_data ((GObject *)assistant, "restore-config", hook_data->config); + + e_config_add_page_check (hook_data->config, "0.startup_page.10.backup_restore", backup_restore_check, assistant); + return GTK_WIDGET (page); } void backup_restore_commit (EPlugin *ep, EMConfigTargetAccount *target) { - /* Nothing really */ - printf("commit\n"); + GtkWidget *assistant = target->target.config->widget; + gboolean state = GPOINTER_TO_INT (g_object_get_data ((GObject *)assistant, "restore")) ? TRUE : FALSE; + gchar *file = g_object_get_data ((GObject *)assistant, "restore-file"); + + if (state) { + if (!file || !sanity_check (file)) { + e_error_run ((GtkWindow *)assistant, "org.gnome.backup-restore:invalid-backup", NULL); + } else { + restore (file, TRUE); + } + } } void diff --git a/plugins/backup-restore/org-gnome-backup-restore.eplug.xml b/plugins/backup-restore/org-gnome-backup-restore.eplug.xml index 6d92cf48ae..c78b376296 100644 --- a/plugins/backup-restore/org-gnome-backup-restore.eplug.xml +++ b/plugins/backup-restore/org-gnome-backup-restore.eplug.xml @@ -24,7 +24,7 @@ <hook class="org.gnome.evolution.mail.config:1.0"> <group target="account" id="org.gnome.evolution.mail.config.accountWizard" commit="backup_restore_commit" abort="backup_restore_abort"> - <item type="page" path="0.startup_page.10" factory="backup_restore_page"/> + <item type="page" path="0.startup_page.10.backup_restore" factory="backup_restore_page"/> </group> </hook> diff --git a/plugins/exchange-operations/exchange-account-setup.c b/plugins/exchange-operations/exchange-account-setup.c index 296e44282c..5943d5f3df 100644 --- a/plugins/exchange-operations/exchange-account-setup.c +++ b/plugins/exchange-operations/exchange-account-setup.c @@ -668,7 +668,7 @@ construct_owa_url (CamelURL *url) return owa_url; } -/* used by editor and druid - same code */ +/* used by editor and assistant - same code */ GtkWidget * org_gnome_exchange_owa_url(EPlugin *epl, EConfigHookItemFactoryData *data) { @@ -734,7 +734,7 @@ org_gnome_exchange_owa_url(EPlugin *epl, EConfigHookItemFactoryData *data) /* url has hostname but not owa_url. * Account has been created using x-c-s or evo is upgraded to 2.2 - * When invoked from druid, hostname will get set after validation, + * When invoked from assistant, hostname will get set after validation, * so this condition will never be true during account creation. */ owa_url = construct_owa_url (url); diff --git a/plugins/exchange-operations/org-gnome-exchange-operations.eplug.xml b/plugins/exchange-operations/org-gnome-exchange-operations.eplug.xml index 381ac94e4c..063d5c98c6 100644 --- a/plugins/exchange-operations/org-gnome-exchange-operations.eplug.xml +++ b/plugins/exchange-operations/org-gnome-exchange-operations.eplug.xml @@ -33,7 +33,7 @@ <group target="account" - id="org.gnome.evolution.mail.config.accountDruid" + id="org.gnome.evolution.mail.config.accountAssistant" check="org_gnome_exchange_check_options"> <item type="item_table" path="10.receive/10.config/20.owa" diff --git a/plugins/groupwise-account-setup/org-gnome-gw-account-setup.eplug.xml b/plugins/groupwise-account-setup/org-gnome-gw-account-setup.eplug.xml index 16947d89c7..f99606f8a4 100644 --- a/plugins/groupwise-account-setup/org-gnome-gw-account-setup.eplug.xml +++ b/plugins/groupwise-account-setup/org-gnome-gw-account-setup.eplug.xml @@ -6,7 +6,7 @@ <_description>Add Novell GroupWise support to Evolution.</_description> <hook class="org.gnome.evolution.mail.config:1.0"> - <group target="account" id="org.gnome.evolution.mail.config.accountDruid"> + <group target="account" id="org.gnome.evolution.mail.config.accountAssistant"> <item type="item_table" path="20.receive_options/30.soapport/50.dummy" factory="org_gnome_groupwise_account_setup"/> </group> </hook> diff --git a/plugins/hula-account-setup/org-gnome-evolution-hula-account-setup.eplug.xml b/plugins/hula-account-setup/org-gnome-evolution-hula-account-setup.eplug.xml index 68ae2fe8dd..e90ce650cb 100644 --- a/plugins/hula-account-setup/org-gnome-evolution-hula-account-setup.eplug.xml +++ b/plugins/hula-account-setup/org-gnome-evolution-hula-account-setup.eplug.xml @@ -6,7 +6,7 @@ <_description>Add Hula support to Evolution.</_description> <hook class="org.gnome.evolution.mail.config:1.0"> - <group target="account" id="org.gnome.evolution.mail.config.accountDruid"> + <group target="account" id="org.gnome.evolution.mail.config.accountAssistant"> <item type="item_table" path="20.receive_options/30.soapport/50.dummy" factory="org_gnome_evolution_hula_account_setup"/> </group> </hook> diff --git a/plugins/startup-wizard/startup-wizard.c b/plugins/startup-wizard/startup-wizard.c index 9c7ffe699b..14c4c6cffe 100644 --- a/plugins/startup-wizard/startup-wizard.c +++ b/plugins/startup-wizard/startup-wizard.c @@ -24,9 +24,6 @@ #include <gconf/gconf-client.h> #include <glib/gi18n.h> #include <gtk/gtk.h> -#include <libgnomeui/gnome-druid.h> -#include <libgnomeui/gnome-druid-page-edge.h> -#include <libgnomeui/gnome-druid-page-standard.h> #include "e-util/e-error.h" #include "e-util/e-import.h" #include "shell/e-shell.h" @@ -57,9 +54,11 @@ void startup_wizard (EPlugin *ep, ESEventTargetUpgrade *target) { EMAccountEditor *emae; - GnomeDruidPageEdge *start_page; + GtkWidget *start_page; GConfClient *client; GSList *accounts; + EConfig *config; + GList *page_children; client = gconf_client_get_default (); accounts = gconf_client_get_list (client, "/apps/evolution/mail/accounts", GCONF_VALUE_STRING, NULL); @@ -74,28 +73,36 @@ startup_wizard (EPlugin *ep, ESEventTargetUpgrade *target) /** @HookPoint-EMConfig: New Mail Account Wizard * @Id: org.gnome.evolution.mail.config.accountWizard - * @Type: E_CONFIG_DRUID + * @Type: E_CONFIG_ASSISTANT * @Class: org.gnome.evolution.mail.config:1.0 * @Target: EMConfigTargetAccount * - * The new mail account druid. + * The new mail account assistant. */ emae = em_account_editor_new ( - NULL, EMAE_DRUID, + NULL, EMAE_ASSISTANT, "org.gnome.evolution.mail.config.accountWizard"); gtk_window_set_title ( GTK_WINDOW (emae->editor), _("Evolution Setup Assistant")); - start_page = GNOME_DRUID_PAGE_EDGE ( - e_config_page_get ((EConfig *) emae->config, "0.start")); - gnome_druid_page_edge_set_title (start_page, _("Welcome")); - gnome_druid_page_edge_set_text ( - start_page, _("" - "Welcome to Evolution. The next few screens will allow Evolution to connect " - "to your email accounts, and to import files from other applications. \n" - "\n" - "Please click the \"Forward\" button to continue. ")); + config = (EConfig *) emae->config; + start_page = e_config_page_get (config, "0.start"); + + gtk_assistant_set_page_title (GTK_ASSISTANT (config->widget), start_page, _("Welcome")); + page_children = gtk_container_get_children (GTK_CONTAINER (start_page)); + if (page_children) { + GtkLabel *label = GTK_LABEL (page_children->data); + if (label) { + gtk_label_set_text (label, _("" + "Welcome to Evolution. The next few screens will allow Evolution to connect " + "to your email accounts, and to import files from other applications. \n" + "\n" + "Please click the \"Forward\" button to continue. ")); + } + + g_list_free (page_children); + } g_signal_connect ( emae->editor, "delete-event", @@ -122,13 +129,14 @@ startup_wizard_importer_page (EPlugin *ep, EConfigHookItemFactoryData *hook_data if (import_importers == NULL) return NULL; - page = gnome_druid_page_standard_new_with_vals (_("Importing files"), NULL, NULL); + page = gtk_vbox_new (FALSE, 0); + gtk_container_set_border_width (GTK_CONTAINER (page), 12); label = gtk_label_new (_("Please select the information that you would like to import:")); - gtk_box_pack_start (GTK_BOX (GNOME_DRUID_PAGE_STANDARD (page)->vbox), label, FALSE, FALSE, 3); + gtk_box_pack_start (GTK_BOX (page), label, FALSE, FALSE, 3); sep = gtk_hseparator_new (); - gtk_box_pack_start (GTK_BOX (GNOME_DRUID_PAGE_STANDARD (page)->vbox), sep, FALSE, FALSE, 3); + gtk_box_pack_start (GTK_BOX (page), sep, FALSE, FALSE, 3); table = gtk_table_new(g_slist_length(import_importers), 2, FALSE); for (l = import_importers; l; l = l->next) { @@ -151,10 +159,12 @@ startup_wizard_importer_page (EPlugin *ep, EConfigHookItemFactoryData *hook_data gtk_table_attach((GtkTable *)table, w, 1, 2, row, row+1, GTK_FILL, 0, 3, 0); row++; } - gtk_widget_show(table); - gtk_box_pack_start((GtkBox *)((GnomeDruidPageStandard *)page)->vbox, table, FALSE, FALSE, 3); - gnome_druid_append_page (GNOME_DRUID (hook_data->parent), GNOME_DRUID_PAGE (page)); + gtk_box_pack_start (GTK_BOX (page), table, FALSE, FALSE, 3); + + gtk_widget_show_all (page); + gtk_assistant_append_page (GTK_ASSISTANT (hook_data->parent), page); + gtk_assistant_set_page_title (GTK_ASSISTANT (hook_data->parent), page, _("Importing files")); return page; } |