From 0b07840e26f7c793939ec8226695ffca19aa1bfb Mon Sep 17 00:00:00 2001 From: Federico Mena Quintero Date: Mon, 26 Apr 2010 18:13:24 -0500 Subject: Don't use gconf to store the names of widgets to hide That was just for development. Now we hardcode the lists of widgets. Signed-off-by: Federico Mena Quintero --- calendar/gui/apps_evolution_calendar.schemas.in | 20 ------------- calendar/gui/dialogs/cal-prefs-dialog.c | 11 ++++++- mail/evolution-mail.schemas.in | 38 ------------------------- modules/mail/em-composer-prefs.c | 7 ++++- modules/mail/em-mailer-prefs.c | 8 +++++- shell/e-shell-utils.c | 38 +++++++++++-------------- shell/e-shell-utils.h | 3 +- 7 files changed, 42 insertions(+), 83 deletions(-) diff --git a/calendar/gui/apps_evolution_calendar.schemas.in b/calendar/gui/apps_evolution_calendar.schemas.in index 66c2467a76..70590ee0ca 100644 --- a/calendar/gui/apps_evolution_calendar.schemas.in +++ b/calendar/gui/apps_evolution_calendar.schemas.in @@ -802,25 +802,5 @@ - - - - - /schemas/apps/evolution/calendar/express_preferences_hidden - /apps/evolution/calendar/express_preferences_hidden - evolution-calendar - list - string - [label_second_zone,hbox_second_zone,timezone,timezone_label,hbox_use_system_timezone,hbox_time_divisions,show_end_times,month_scroll_by_week] - - List of controls to hide when in Express mode - - 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 calendar preferences in cal-prefs-dialog.ui. - - - diff --git a/calendar/gui/dialogs/cal-prefs-dialog.c b/calendar/gui/dialogs/cal-prefs-dialog.c index e778b6cbcd..21675b4a0d 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.c +++ b/calendar/gui/dialogs/cal-prefs-dialog.c @@ -778,7 +778,16 @@ calendar_prefs_dialog_construct (CalendarPrefsDialog *prefs, e_datetime_format_add_setup_widget (table, 1, "calendar", "table", DTFormatKindDate, _("Date only:")); /* Hide senseless preferences when running in Express mode */ - e_shell_hide_widgets_for_express_mode (shell, prefs->builder, "/apps/evolution/calendar/express_preferences_hidden"); + e_shell_hide_widgets_for_express_mode (shell, prefs->builder, + "label_second_zone", + "hbox_second_zone", + "timezone", + "timezone_label", + "hbox_use_system_timezone", + "hbox_time_divisions", + "show_end_times", + "month_scroll_by_week", + NULL); /* HACK: GTK+ 2.18 and 2.20 has a GtkTable which includes row/column spacing even for empty rows/columns. * When Evo runs in Express mode, we hide all the rows in the Time section of the calendar's General diff --git a/mail/evolution-mail.schemas.in b/mail/evolution-mail.schemas.in index 3bc4e35700..09d875a361 100644 --- a/mail/evolution-mail.schemas.in +++ b/mail/evolution-mail.schemas.in @@ -1528,43 +1528,5 @@ - - - - /schemas/apps/evolution/mail/express_preferences_hidden - /apps/evolution/mail/express_preferences_hidden - evolution-mail - list - string - [hboxReadTimeout,hboxMailSizeLimit,hboxShrinkAddresses,magic_spacebar_checkbox,hboxEnableSearchFolders] - - List of controls to hide when in Express mode - - 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. - - - - - - /schemas/apps/evolution/mail/composer/express_preferences_hidden - /apps/evolution/mail/composer/express_preferences_hidden - evolution-mail - list - string - [chkOutlookFilenames,vboxTopPosting,labelAlerts,chkPromptEmptySubject] - - List of controls to hide when in Express mode - - 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. - - - - diff --git a/modules/mail/em-composer-prefs.c b/modules/mail/em-composer-prefs.c index 72c5d18b25..49f2fda5b6 100644 --- a/modules/mail/em-composer-prefs.c +++ b/modules/mail/em-composer-prefs.c @@ -554,7 +554,12 @@ em_composer_prefs_construct (EMComposerPrefs *prefs, 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"); + e_shell_hide_widgets_for_express_mode (shell, prefs->builder, + "chkOutlookFilenames", + "vboxTopPosting", + "labelAlerts", + "chkPromptEmptySubject", + NULL); /* get our toplevel widget */ target = em_config_target_new_prefs (ec, client); diff --git a/modules/mail/em-mailer-prefs.c b/modules/mail/em-mailer-prefs.c index e2605c8ff5..ed5e82d7ea 100644 --- a/modules/mail/em-mailer-prefs.c +++ b/modules/mail/em-mailer-prefs.c @@ -1208,7 +1208,13 @@ em_mailer_prefs_construct (EMMailerPrefs *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"); + e_shell_hide_widgets_for_express_mode (shell, prefs->builder, + "hboxReadTimeout", + "hboxMailSizeLimit", + "hboxShrinkAddresses", + "magic_spacebar_checkbox", + "hboxEnableSearchFolders", + NULL); /* get our toplevel widget */ target = em_config_target_new_prefs(ec, prefs->gconf); diff --git a/shell/e-shell-utils.c b/shell/e-shell-utils.c index 12283b185c..2a9f6f4f72 100644 --- a/shell/e-shell-utils.c +++ b/shell/e-shell-utils.c @@ -353,13 +353,13 @@ e_shell_utils_import_uris (EShell *shell, gchar **uris, gboolean preview) * 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. + * @widget_name: NULL-terminated list of strings * * 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. + * Express mode), then this function will hide a list of widgets, based on their + * specified names. The list of names must be NULL-terminated, 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. @@ -369,30 +369,25 @@ 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) + const char *widget_name, + ...) { - GConfClient *client; - GSList *names; - GSList *l; + va_list args; + const char *name; 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); - + g_return_if_fail (widget_name != 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; + va_start (args, widget_name); - for (l = names; l; l = l->next) { - const char *name; + name = va_arg (args, const char *); + while (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); @@ -400,9 +395,10 @@ e_shell_hide_widgets_for_express_mode (EShell *shell, } gtk_widget_hide (GTK_WIDGET (object)); + + name = va_arg (args, const char *); } - g_slist_foreach (names, (GFunc) g_free, NULL); - g_slist_free (names); + va_end (args); } diff --git a/shell/e-shell-utils.h b/shell/e-shell-utils.h index 6e8b83c973..e552cc2e19 100644 --- a/shell/e-shell-utils.h +++ b/shell/e-shell-utils.h @@ -52,7 +52,8 @@ guint e_shell_utils_import_uris (EShell *shell, void e_shell_hide_widgets_for_express_mode (EShell *shell, GtkBuilder *builder, - const char *key_with_widget_names); + const char *widget_name, + ...) G_GNUC_NULL_TERMINATED; G_END_DECLS -- cgit v1.2.3