diff options
author | Michael Meeks <michael.meeks@novell.com> | 2010-03-03 16:41:00 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2010-03-14 09:52:51 +0800 |
commit | d9be66b527d0d666e2169d11ece578e901101733 (patch) | |
tree | adf9bd26c5d3b904f01c01c74a5d393c83255608 | |
parent | bc77811277060467e27f6375b34953891f2e59da (diff) | |
download | gsoc2013-evolution-d9be66b527d0d666e2169d11ece578e901101733.tar.gz gsoc2013-evolution-d9be66b527d0d666e2169d11ece578e901101733.tar.zst gsoc2013-evolution-d9be66b527d0d666e2169d11ece578e901101733.zip |
Removed obsolete method signatures in em-account-editor.h
Added em_account_editor_get_widget, and cleaned up the widget listing.
Cleaned the startup wizard code to find it's label by name
Added disabling of power-user 'indentity' frame in the first page express capplet.
-rw-r--r-- | capplet/settings/mail-account-view.c | 6 | ||||
-rw-r--r-- | mail/em-account-editor.c | 66 | ||||
-rw-r--r-- | mail/em-account-editor.h | 14 | ||||
-rw-r--r-- | plugins/startup-wizard/startup-wizard.c | 24 | ||||
-rw-r--r-- | shell/e-shell.c | 21 |
5 files changed, 74 insertions, 57 deletions
diff --git a/capplet/settings/mail-account-view.c b/capplet/settings/mail-account-view.c index 94442a98ab..7b4511ea81 100644 --- a/capplet/settings/mail-account-view.c +++ b/capplet/settings/mail-account-view.c @@ -640,6 +640,7 @@ void mail_account_view_construct (MailAccountView *view) { int i; + GtkWidget *advanced_identity; view->scroll = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_policy ((GtkScrolledWindow *)view->scroll, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); @@ -667,6 +668,7 @@ mail_account_view_construct (MailAccountView *view) em_account_editor_check (view->edit, mail_account_pages[0].path); view->pages[0]->done = TRUE; + gtk_widget_hide (em_account_editor_get_widget (view->edit, "identity_optional_frame")); } MailAccountView * @@ -701,10 +703,8 @@ mav_close (GtkButton *w, MailAccountView *mfv) g_signal_emit (mfv, signals[VIEW_CLOSE], 0); } - - GtkWidget * -mail_account_view_get_tab_widget(MailAccountView *mcv) +mail_account_view_get_tab_widget (MailAccountView *mcv) { GdkPixbuf *pbuf = gtk_widget_render_icon ((GtkWidget *)mcv, "gtk-close", GTK_ICON_SIZE_MENU, NULL); diff --git a/mail/em-account-editor.c b/mail/em-account-editor.c index fe876b2563..1648ae2745 100644 --- a/mail/em-account-editor.c +++ b/mail/em-account-editor.c @@ -192,8 +192,8 @@ struct _EMAccountEditorPrivate { GtkButton *smime_encrypt_key_clear; /* for e-config callbacks, each page sets up its widgets, then they are dealed out by the get_widget callback in order*/ - GtkWidget *widgets[5]; - const gchar *widgets_name[5]; + GtkWidget *widgets[16]; + const gchar *widgets_name[16]; gint widgets_index; /* for assistant page preparation */ @@ -212,6 +212,7 @@ enum { PROP_SHELL }; +static void emae_queue_widget (EMAccountEditor *emae, const gchar *name, GtkWidget *widget); static void emae_refresh_authtype (EMAccountEditor *emae, EMAccountEditorService *service); static void em_account_editor_construct (EMAccountEditor *emae, EMAccountEditorType type, const gchar *id); static void emae_account_folder_changed (EMFolderSelectionButton *folder, EMAccountEditor *emae); @@ -389,6 +390,7 @@ emae_init (EMAccountEditor *emae) emae->emae_check_servers = emae_check_servers; emae->priv->source.emae = emae; emae->priv->transport.emae = emae; + emae->priv->widgets_index = 0; } GType @@ -2045,7 +2047,8 @@ emae_setup_service (EMAccountEditor *emae, EMAccountEditorService *service, GtkB } static GtkWidget * -emae_create_basic_assistant_page (GtkAssistant *assistant, const gchar *page_id, GtkWidget *old) +emae_create_basic_assistant_page (EMAccountEditor *emae, GtkAssistant *assistant, + const gchar *page_id, GtkWidget *old) { const gchar *title = NULL, *label = NULL; GtkAssistantPageType page_type = GTK_ASSISTANT_PAGE_CONTENT; @@ -2091,6 +2094,9 @@ emae_create_basic_assistant_page (GtkAssistant *assistant, const gchar *page_id, gtk_box_pack_start (GTK_BOX (vbox), lbl, fill_space, fill_space, 0); gtk_widget_show (lbl); + if (g_ascii_strcasecmp (page_id, "start_page") == 0) + emae_queue_widget (emae, "start_page_label", lbl); + if (old) { /* keep page on its previous index */ gint i, sz = gtk_assistant_get_n_pages (assistant); @@ -2122,23 +2128,28 @@ static struct { /* its a bit obtuse, but its simple */ static void +emae_queue_widget (EMAccountEditor *emae, const gchar *name, GtkWidget *widget) +{ + gint i = emae->priv->widgets_index++; + + g_assert (i + 1 < G_N_ELEMENTS(emae->priv->widgets)); + + emae->priv->widgets_name[i] = name; + emae->priv->widgets[i] = widget; + emae->priv->widgets[i + 1] = NULL; +} + +static void emae_queue_widgets (EMAccountEditor *emae, GtkBuilder *builder, const gchar *first, ...) { - gint i = 0; va_list ap; va_start (ap, first); while (first) { - emae->priv->widgets_name[i] = first; - emae->priv->widgets[i++] = e_builder_get_widget (builder, first); + emae_queue_widget (emae, first, e_builder_get_widget (builder, first)); first = va_arg (ap, const gchar *); } va_end (ap); - - g_return_if_fail (i < G_N_ELEMENTS (emae->priv->widgets)); - - emae->priv->widgets[i] = NULL; - emae->priv->widgets_index = 0; } static GtkWidget * @@ -2191,7 +2202,7 @@ emae_identity_page (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget if (emae->type == EMAE_PAGES) { gtk_box_pack_start ((GtkBox *)emae->pages[0], w, TRUE, TRUE, 0); } else if (((EConfig *)priv->config)->type == E_CONFIG_ASSISTANT) { - GtkWidget *page = emae_create_basic_assistant_page (GTK_ASSISTANT (parent), "identity_page", old); + GtkWidget *page = emae_create_basic_assistant_page (emae, GTK_ASSISTANT (parent), "identity_page", old); gtk_box_pack_start (GTK_BOX (page), w, TRUE, TRUE, 0); @@ -2200,7 +2211,7 @@ emae_identity_page (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget gtk_notebook_append_page ((GtkNotebook *)parent, w, gtk_label_new (_("Identity"))); } - emae_queue_widgets (emae, builder, "account_vbox", "identity_required_table", "identity_optional_table", NULL); + emae_queue_widgets (emae, builder, "account_vbox", "identity_required_table", "identity_optional_table", "identity_optional_frame", NULL); g_object_unref (builder); @@ -2228,7 +2239,7 @@ emae_receive_page (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget if (emae->type == EMAE_PAGES) { gtk_box_pack_start ((GtkBox *)emae->pages[1], w, TRUE, TRUE, 0); } else if (((EConfig *)priv->config)->type == E_CONFIG_ASSISTANT) { - GtkWidget *page = emae_create_basic_assistant_page (GTK_ASSISTANT (parent), "source_page", old); + GtkWidget *page = emae_create_basic_assistant_page (emae, GTK_ASSISTANT (parent), "source_page", old); gtk_box_pack_start (GTK_BOX (page), w, TRUE, TRUE, 0); @@ -2705,7 +2716,7 @@ emae_send_page (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget *ol if (emae->type == EMAE_PAGES) { gtk_box_pack_start ((GtkBox *)emae->pages[3], w, TRUE, TRUE, 0); } else if (((EConfig *)priv->config)->type == E_CONFIG_ASSISTANT) { - GtkWidget *page = emae_create_basic_assistant_page (GTK_ASSISTANT (parent), "transport_page", old); + GtkWidget *page = emae_create_basic_assistant_page (emae, GTK_ASSISTANT (parent), "transport_page", old); gtk_box_pack_start (GTK_BOX (page), w, TRUE, TRUE, 0); @@ -2844,21 +2855,29 @@ emae_security_page (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget return w; } -static GtkWidget * -emae_widget_glade (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget *old, gpointer data) +/* + * Allow some level of post creation customisation in plugins. + */ +GtkWidget * +em_account_editor_get_widget (EMAccountEditor *emae, const gchar *name) { - EMAccountEditor *emae = data; gint i; - for (i=0;emae->priv->widgets[i];i++) - if (!strcmp (emae->priv->widgets_name[i], item->label)) + for (i = 0; emae->priv->widgets[i]; i++) + if (!strcmp (emae->priv->widgets_name[i], name)) return emae->priv->widgets[i]; - g_warning ("Mail account widget '%s' not found", item->label); + g_warning ("Mail account widget '%s' not found", name); return NULL; } +static GtkWidget * +emae_widget_glade (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget *old, gpointer data) +{ + return em_account_editor_get_widget (data, item->label); +} + /* plugin meta-data for "org.gnome.evolution.mail.config.accountEditor" */ static EMConfigItem emae_editor_items[] = { { E_CONFIG_BOOK, (gchar *) "" }, @@ -2904,7 +2923,7 @@ emae_management_page (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidg w = priv->management_frame; if (((EConfig *)priv->config)->type == E_CONFIG_ASSISTANT) { - GtkWidget *page = emae_create_basic_assistant_page (GTK_ASSISTANT (parent), "management_page", old); + GtkWidget *page = emae_create_basic_assistant_page (emae, GTK_ASSISTANT (parent), "management_page", old); gtk_widget_reparent (w, page); @@ -2922,7 +2941,7 @@ emae_widget_assistant_page (EConfig *ec, EConfigItem *item, GtkWidget *parent, G if (emae->type == EMAE_PAGES) return NULL; - return emae_create_basic_assistant_page (GTK_ASSISTANT (parent), item->label, old); + return emae_create_basic_assistant_page (emae, GTK_ASSISTANT (parent), item->label, old); } /* plugin meta-data for "org.gnome.evolution.mail.config.accountAssistant" */ @@ -3418,3 +3437,4 @@ em_account_editor_construct (EMAccountEditor *emae, EMAccountEditorType type, co gtk_widget_hide (noshow); } } + diff --git a/mail/em-account-editor.h b/mail/em-account-editor.h index 7728275e8f..c864f1f3ed 100644 --- a/mail/em-account-editor.h +++ b/mail/em-account-editor.h @@ -110,23 +110,13 @@ gboolean em_account_editor_check (EMAccountEditor *emae, const gchar *page); gboolean em_account_editor_save (EMAccountEditor *emae); void em_account_editor_destroy (EMAccountEditor *emae); -gboolean em_account_editor_identity_complete - (EMAccountEditor *emae, - GtkWidget **incomplete); -gboolean em_account_editor_source_complete - (EMAccountEditor *emae, - GtkWidget **incomplete); -gboolean EMAccountEditorTyperansport_complete - (EMAccountEditor *emae, - GtkWidget **incomplete); -gboolean em_account_editor_management_complete - (EMAccountEditor *emae, - GtkWidget **incomplete); void em_account_editor_build_extra_conf (EMAccountEditor *emae, const gchar *url); void em_account_editor_auto_detect_extra_conf (EMAccountEditor *emae); +GtkWidget * em_account_editor_get_widget (EMAccountEditor *emae, + const gchar *name); G_END_DECLS diff --git a/plugins/startup-wizard/startup-wizard.c b/plugins/startup-wizard/startup-wizard.c index 4d7363873e..5b5c467f69 100644 --- a/plugins/startup-wizard/startup-wizard.c +++ b/plugins/startup-wizard/startup-wizard.c @@ -61,10 +61,10 @@ void startup_wizard (EPlugin *ep, ESEventTargetUpgrade *target) { GtkWidget *start_page; + GtkLabel *start_page_label; GConfClient *client; GSList *accounts; EConfig *config; - GList *page_children; EMAccountEditor *emae; client = gconf_client_get_default (); @@ -79,8 +79,9 @@ startup_wizard (EPlugin *ep, ESEventTargetUpgrade *target) } if (e_shell_get_express_mode (e_shell_get_default ())) { - start_page = (GtkWidget *)mail_capplet_shell_new(0, TRUE, TRUE); + start_page = (GtkWidget *)mail_capplet_shell_new (0, TRUE, TRUE); gtk_widget_show (start_page); + g_signal_connect ( start_page, "delete-event", G_CALLBACK (startup_wizard_terminate), NULL); @@ -112,18 +113,13 @@ startup_wizard (EPlugin *ep, ESEventTargetUpgrade *target) 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); + start_page_label = GTK_LABEL (em_account_editor_get_widget (emae, "start_page_label")); + if (start_page_label) { + gtk_label_set_text (start_page_label, _("" + "ZZZ ! 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_signal_connect ( diff --git a/shell/e-shell.c b/shell/e-shell.c index 1df973aea0..73ea0ac520 100644 --- a/shell/e-shell.c +++ b/shell/e-shell.c @@ -619,6 +619,8 @@ shell_constructed (GObject *object) g_object_add_weak_pointer (object, &default_shell); } + E_SHELL (object)->priv->express = e_shell_get_express_mode (NULL); + /* UniqueApp will have by this point determined whether we're * the only Evolution process running. If so, proceed normally. * Otherwise we just issue commands to the other process. */ @@ -1038,8 +1040,7 @@ shell_init (EShell *shell) shell->priv->backends_by_name = backends_by_name; shell->priv->backends_by_scheme = backends_by_scheme; shell->priv->safe_mode = e_file_lock_exists (); - shell->priv->express = gconf_client_get_bool ( - shell->priv->gconf_client, "/apps/evolution/shell/express_mode", NULL); + g_object_ref_sink (shell->priv->preferences_window); #if defined(NM_SUPPORT) && NM_SUPPORT @@ -1662,7 +1663,7 @@ e_shell_set_online (EShell *shell, /** * e_shell_get_express_mode: - * @shell: an #EShell + * @shell: an #EShell, or NULL for the global value * * Returns %TRUE if Evolution is in express mode, %FALSE if Evolution not. * @@ -1670,9 +1671,19 @@ e_shell_set_online (EShell *shell, gboolean e_shell_get_express_mode (EShell *shell) { - g_return_val_if_fail (E_IS_SHELL (shell), FALSE); + if (shell) + return shell->priv->express; + + if (g_getenv ("EVO_EXPRESS")) + return TRUE; + + shell = e_shell_get_default (); + g_return_val_if_fail (shell != NULL, FALSE); - return shell->priv->express; + return gconf_client_get_bool ( + shell->priv->gconf_client, + "/apps/evolution/shell/express_mode", + NULL); } /** |