From 10c84b9050149d838167662b010bf8e2ef2989f4 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Mon, 15 Oct 2012 19:50:59 +0200 Subject: [PATCH] Bug #681314 - Add address dialog should follow composer's view settings --- configure.ac | 2 +- libedataserverui/e-name-selector-dialog.c | 58 +++++++++++++++++++++++++++++++ libedataserverui/e-name-selector-dialog.h | 7 ++++ 3 files changed, 66 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 7651d2c..9f38083 100644 --- a/configure.ac +++ b/configure.ac @@ -91,7 +91,7 @@ LIBEDATASERVER_CURRENT=17 LIBEDATASERVER_REVISION=0 LIBEDATASERVER_AGE=0 -LIBEDATASERVERUI_CURRENT=4 +LIBEDATASERVERUI_CURRENT=5 LIBEDATASERVERUI_REVISION=0 LIBEDATASERVERUI_AGE=0 diff --git a/libedataserverui/e-name-selector-dialog.c b/libedataserverui/e-name-selector-dialog.c index b079134..a52af24 100644 --- a/libedataserverui/e-name-selector-dialog.c +++ b/libedataserverui/e-name-selector-dialog.c @@ -1752,3 +1752,61 @@ e_name_selector_dialog_set_scrolling_policy (ENameSelectorDialog *name_selector_ gtk_scrolled_window_set_policy (win, hscrollbar_policy, vscrollbar_policy); } + +/** + * e_name_selector_dialog_set_section_visible: + * @name_selector_dialog: an #ENameSelectorDialog + * @name: name of the section + * @visible: whether to show or hide the section + * + * Shows or hides section named @name in the dialog. + * + * Since: 3.8 + **/ +void +e_name_selector_dialog_set_section_visible (ENameSelectorDialog *name_selector_dialog, + const gchar *name, + gboolean visible) +{ + Section *section; + gint index; + + g_return_if_fail (E_IS_NAME_SELECTOR_DIALOG (name_selector_dialog)); + g_return_if_fail (name != NULL); + + index = find_section_by_name (name_selector_dialog, name); + g_return_if_fail (index != -1); + + section = &g_array_index (name_selector_dialog->priv->sections, Section, index); + + if (visible) + gtk_widget_show (GTK_WIDGET (section->section_box)); + else + gtk_widget_hide (GTK_WIDGET (section->section_box)); +} + +/** + * e_name_selector_dialog_get_section_visible: + * @name_selector_dialog: an #ENameSelectorDialog + * @name: name of the section + * + * Returns: whether section named @name is visible in the dialog. + * + * Since: 3.8 + **/ +gboolean +e_name_selector_dialog_get_section_visible (ENameSelectorDialog *name_selector_dialog, + const gchar *name) +{ + Section *section; + gint index; + + g_return_val_if_fail (E_IS_NAME_SELECTOR_DIALOG (name_selector_dialog), FALSE); + g_return_val_if_fail (name != NULL, FALSE); + + index = find_section_by_name (name_selector_dialog, name); + g_return_val_if_fail (index != -1, FALSE); + + section = &g_array_index (name_selector_dialog->priv->sections, Section, index); + return gtk_widget_get_visible (GTK_WIDGET (section->section_box)); +} diff --git a/libedataserverui/e-name-selector-dialog.h b/libedataserverui/e-name-selector-dialog.h index ee78ff9..e670517 100644 --- a/libedataserverui/e-name-selector-dialog.h +++ b/libedataserverui/e-name-selector-dialog.h @@ -87,6 +87,13 @@ void e_name_selector_dialog_set_scrolling_policy (ENameSelectorDialog *name_selector_dialog, GtkPolicyType hscrollbar_policy, GtkPolicyType vscrollbar_policy); +void e_name_selector_dialog_set_section_visible + (ENameSelectorDialog *name_selector_dialog, + const gchar *name, + gboolean visible); +gboolean e_name_selector_dialog_get_section_visible + (ENameSelectorDialog *name_selector_dialog, + const gchar *name); G_END_DECLS -- 2.7.4