diff options
-rw-r--r-- | mail/evolution-mail.schemas.in | 38 | ||||
-rw-r--r-- | mail/mail-config.ui | 8 | ||||
-rw-r--r-- | modules/mail/em-composer-prefs.c | 4 | ||||
-rw-r--r-- | modules/mail/em-mailer-prefs.c | 4 | ||||
-rw-r--r-- | shell/e-shell-utils.c | 58 | ||||
-rw-r--r-- | shell/e-shell-utils.h | 4 |
6 files changed, 112 insertions, 4 deletions
diff --git a/mail/evolution-mail.schemas.in b/mail/evolution-mail.schemas.in index 09d875a361..3bc4e35700 100644 --- a/mail/evolution-mail.schemas.in +++ b/mail/evolution-mail.schemas.in @@ -1528,5 +1528,43 @@ </locale> </schema> + <!-- Widgets to hide in Express mode --> + + <schema> + <key>/schemas/apps/evolution/mail/express_preferences_hidden</key> + <applyto>/apps/evolution/mail/express_preferences_hidden</applyto> + <owner>evolution-mail</owner> + <type>list</type> + <list_type>string</list_type> + <default>[hboxReadTimeout,hboxMailSizeLimit,hboxShrinkAddresses,magic_spacebar_checkbox,hboxEnableSearchFolders]</default> + <locale name="C"> + <short>List of controls to hide when in Express mode</short> + <long> + List of names for the controls in the user interface, + which should be hidden when Evolution is running in Express + mode. + This pertains to the mailer preferences in mail-config.ui. + </long> + </locale> + </schema> + + <schema> + <key>/schemas/apps/evolution/mail/composer/express_preferences_hidden</key> + <applyto>/apps/evolution/mail/composer/express_preferences_hidden</applyto> + <owner>evolution-mail</owner> + <type>list</type> + <list_type>string</list_type> + <default>[chkOutlookFilenames,vboxTopPosting,labelAlerts,chkPromptEmptySubject]</default> + <locale name="C"> + <short>List of controls to hide when in Express mode</short> + <long> + List of names for the controls in the user interface, + which should be hidden when Evolution is running in Express + mode. + This pertains to the mailer preferences in mail-config.ui. + </long> + </locale> + </schema> + </schemalist> </gconfschemafile> diff --git a/mail/mail-config.ui b/mail/mail-config.ui index 55f5ee6227..8f8935bd0e 100644 --- a/mail/mail-config.ui +++ b/mail/mail-config.ui @@ -2923,7 +2923,7 @@ For example: "Work" or "Personal"</property> </packing> </child> <child> - <object class="GtkHBox" id="hbox234"> + <object class="GtkHBox" id="hboxMailSizeLimit"> <property name="visible">True</property> <property name="spacing">4</property> <child> @@ -2972,7 +2972,7 @@ For example: "Work" or "Personal"</property> </packing> </child> <child> - <object class="GtkHBox" id="hbox233"> + <object class="GtkHBox" id="hboxShrinkAddresses"> <property name="visible">True</property> <child> <object class="GtkCheckButton" id="address_checkbox"> @@ -4481,7 +4481,7 @@ For example: "Work" or "Personal"</property> <property name="visible">True</property> <property name="spacing">2</property> <child> - <object class="GtkVBox" id="vbox207"> + <object class="GtkVBox" id="vboxTopPosting"> <property name="visible">True</property> <property name="orientation">vertical</property> <property name="spacing">8</property> @@ -4540,7 +4540,7 @@ For example: "Work" or "Personal"</property> </packing> </child> <child> - <object class="GtkLabel" id="label506"> + <object class="GtkLabel" id="labelAlerts"> <property name="visible">True</property> <property name="xalign">0</property> <property name="label" translatable="yes">Alerts</property> diff --git a/modules/mail/em-composer-prefs.c b/modules/mail/em-composer-prefs.c index 53a9888a47..72c5d18b25 100644 --- a/modules/mail/em-composer-prefs.c +++ b/modules/mail/em-composer-prefs.c @@ -36,6 +36,7 @@ #include "em-composer-prefs.h" #include "composer/e-msg-composer.h" +#include "shell/e-shell-utils.h" #include <camel/camel-iconv.h> @@ -552,6 +553,9 @@ em_composer_prefs_construct (EMComposerPrefs *prefs, signature_tree_view, "selected", widget, "signature"); + /* Sanitize the dialog for Express mode */ + e_shell_hide_widgets_for_express_mode (shell, prefs->builder, "/apps/evolution/mail/composer/express_preferences_hidden"); + /* get our toplevel widget */ target = em_config_target_new_prefs (ec, client); e_config_set_target ((EConfig *)ec, (EConfigTarget *)target); diff --git a/modules/mail/em-mailer-prefs.c b/modules/mail/em-mailer-prefs.c index f32fbbf284..e2605c8ff5 100644 --- a/modules/mail/em-mailer-prefs.c +++ b/modules/mail/em-mailer-prefs.c @@ -43,6 +43,7 @@ #include "e-util/e-datetime-format.h" #include "e-util/e-util-private.h" #include "widgets/misc/e-charset-combo-box.h" +#include "shell/e-shell-utils.h" #include "e-mail-label-manager.h" #include "mail-config.h" @@ -1206,6 +1207,9 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs, g_signal_connect (G_OBJECT (prefs->junk_header_add), "clicked", G_CALLBACK (jh_add_cb), prefs); g_signal_connect (G_OBJECT (prefs->junk_header_remove), "clicked", G_CALLBACK (jh_remove_cb), prefs); + /* Sanitize the dialog for Express mode */ + e_shell_hide_widgets_for_express_mode (shell, prefs->builder, "/apps/evolution/mail/express_preferences_hidden"); + /* get our toplevel widget */ target = em_config_target_new_prefs(ec, prefs->gconf); e_config_set_target((EConfig *)ec, (EConfigTarget *)target); diff --git a/shell/e-shell-utils.c b/shell/e-shell-utils.c index 4bc9c480cb..12283b185c 100644 --- a/shell/e-shell-utils.c +++ b/shell/e-shell-utils.c @@ -348,3 +348,61 @@ e_shell_utils_import_uris (EShell *shell, gchar **uris, gboolean preview) return g_strv_length (uris); } + +/** + * e_shell_hide_widgets_for_express_mode: + * @shell: an #EShell + * @builder: a #GtkBuilder + * @key_with_widget_names: The name of a GConf key; see below. + * + * If Evolution is running in Express mode (i.e. if the specified @shell is in + * Express mode), then this function will first read the specified GConf key. + * This key must contain a string list, and each element of that list must be + * the name of a widget present in @builder. Those widgets will then get + * hidden. + * + * This can be used to simplify preference dialogs and such in an easy fashion, for use + * in Express mode. + * + * If Evolution is not running in Express mode, this function does nothing. + */ +void +e_shell_hide_widgets_for_express_mode (EShell *shell, + GtkBuilder *builder, + const char *key_with_widget_names) +{ + GConfClient *client; + GSList *names; + GSList *l; + + g_return_if_fail (E_IS_SHELL (shell)); + g_return_if_fail (GTK_IS_BUILDER (builder)); + g_return_if_fail (key_with_widget_names != NULL); + + if (!e_shell_get_express_mode (shell)) + return; + + client = e_shell_get_gconf_client (shell); + + names = gconf_client_get_list (client, key_with_widget_names, GCONF_VALUE_STRING, NULL); /* NULL-GError */ + if (!names) + return; + + for (l = names; l; l = l->next) { + const char *name; + GObject *object; + + name = l->data; + object = gtk_builder_get_object (builder, name); + if (!object || !GTK_IS_WIDGET (object)) { + g_error ("Object '%s' was not found in the builder file, or it is not a GtkWidget", name); + g_assert_not_reached (); + } + + gtk_widget_hide (GTK_WIDGET (object)); + } + + g_slist_foreach (names, (GFunc) g_free, NULL); + g_slist_free (names); +} + diff --git a/shell/e-shell-utils.h b/shell/e-shell-utils.h index 428d49a836..6e8b83c973 100644 --- a/shell/e-shell-utils.h +++ b/shell/e-shell-utils.h @@ -50,6 +50,10 @@ guint e_shell_utils_import_uris (EShell *shell, gchar **uris, gboolean preview); +void e_shell_hide_widgets_for_express_mode (EShell *shell, + GtkBuilder *builder, + const char *key_with_widget_names); + G_END_DECLS #endif /* E_SHELL_UTILS_H */ |