[evolution] I#1792 - Contacts: Option to preview Personal section before Work
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] I#1792 - Contacts: Option to preview Personal section before Work
- Date: Tue, 1 Feb 2022 09:26:32 +0000 (UTC)
commit a56da82fef5637a57f6a797dcf5dc065daaefb18
Author: Milan Crha <mcrha redhat com>
Date: Tue Feb 1 10:26:00 2022 +0100
I#1792 - Contacts: Option to preview Personal section before Work
Closes https://gitlab.gnome.org/GNOME/evolution/-/issues/1792
.../org.gnome.evolution.addressbook.gschema.xml.in | 5 +++++
src/addressbook/gui/widgets/eab-contact-display.c | 26 ++++++++++++++++++++++
.../gui/widgets/eab-contact-formatter.c | 16 +++++++++++--
src/modules/addressbook/autocompletion-config.c | 9 ++++++++
4 files changed, 54 insertions(+), 2 deletions(-)
---
diff --git a/data/org.gnome.evolution.addressbook.gschema.xml.in
b/data/org.gnome.evolution.addressbook.gschema.xml.in
index b300c89ee8..c413049abb 100644
--- a/data/org.gnome.evolution.addressbook.gschema.xml.in
+++ b/data/org.gnome.evolution.addressbook.gschema.xml.in
@@ -120,5 +120,10 @@
<_summary>Where to open contact locations</_summary>
<_description>Currently supported values are “openstreetmap” and “google”; if unknown set, uses
“openstreetmap”</_description>
</key>
+ <key type="b" name="preview-home-before-work">
+ <_default>false</_default>
+ <summary>Preview Personal before Work information</summary>
+ <_description>Show the Personal information before the Work information in the contact
preview</_description>
+ </key>
</schema>
</schemalist>
diff --git a/src/addressbook/gui/widgets/eab-contact-display.c
b/src/addressbook/gui/widgets/eab-contact-display.c
index 79e2664123..9af181d7ad 100644
--- a/src/addressbook/gui/widgets/eab-contact-display.c
+++ b/src/addressbook/gui/widgets/eab-contact-display.c
@@ -49,6 +49,7 @@ struct _EABContactDisplayPrivate {
EABContactDisplayMode mode;
gboolean show_maps;
+ gboolean home_before_work;
};
enum {
@@ -435,6 +436,24 @@ contact_display_web_process_crashed_cb (EABContactDisplay *display)
e_alert_submit (alert_sink, "addressbook:webkit-web-process-crashed", NULL);
}
+static void
+eab_contact_display_settings_changed_cb (GSettings *settings,
+ const gchar *key,
+ gpointer user_data)
+{
+ EABContactDisplay *display = user_data;
+ gboolean home_before_work;
+
+ g_return_if_fail (EAB_IS_CONTACT_DISPLAY (display));
+
+ home_before_work = g_settings_get_boolean (settings, "preview-home-before-work");
+
+ if (display->priv->contact && (home_before_work ? 1 : 0) != (display->priv->home_before_work ? 1 :
0)) {
+ display->priv->home_before_work = home_before_work;
+ load_contact (display);
+ }
+}
+
static void
eab_contact_display_class_init (EABContactDisplayClass *class)
{
@@ -503,6 +522,7 @@ eab_contact_display_init (EABContactDisplay *display)
EWebView *web_view;
GtkUIManager *ui_manager;
GtkActionGroup *action_group;
+ GSettings *settings;
const gchar *domain = GETTEXT_PACKAGE;
GError *error = NULL;
@@ -537,6 +557,12 @@ eab_contact_display_init (EABContactDisplay *display)
gtk_ui_manager_add_ui_from_string (ui_manager, ui, -1, &error);
if (error != NULL)
g_error ("%s", error->message);
+
+ settings = e_util_ref_settings ("org.gnome.evolution.addressbook");
+ g_signal_connect_object (settings, "changed::preview-home-before-work",
+ G_CALLBACK (eab_contact_display_settings_changed_cb), display, 0);
+ display->priv->home_before_work = g_settings_get_boolean (settings, "preview-home-before-work");
+ g_clear_object (&settings);
}
GtkWidget *
diff --git a/src/addressbook/gui/widgets/eab-contact-formatter.c
b/src/addressbook/gui/widgets/eab-contact-formatter.c
index 9fbf27e4b0..1980d73fc0 100644
--- a/src/addressbook/gui/widgets/eab-contact-formatter.c
+++ b/src/addressbook/gui/widgets/eab-contact-formatter.c
@@ -1120,12 +1120,24 @@ render_contact (EABContactFormatter *formatter,
EContact *contact,
GString *buffer)
{
+ GSettings *settings;
+ gboolean home_before_work;
+
+ settings = e_util_ref_settings ("org.gnome.evolution.addressbook");
+ home_before_work = g_settings_get_boolean (settings, "preview-home-before-work");
+ g_clear_object (&settings);
+
render_title_block (formatter, contact, buffer);
g_string_append (buffer, "<div id=\"columns\">");
render_contact_column (formatter, contact, buffer);
- render_work_column (formatter, contact, buffer);
- render_personal_column (formatter, contact, buffer);
+ if (home_before_work) {
+ render_personal_column (formatter, contact, buffer);
+ render_work_column (formatter, contact, buffer);
+ } else {
+ render_work_column (formatter, contact, buffer);
+ render_personal_column (formatter, contact, buffer);
+ }
render_other_column (formatter, contact, buffer);
g_string_append (buffer, "</div>");
diff --git a/src/modules/addressbook/autocompletion-config.c b/src/modules/addressbook/autocompletion-config.c
index 3e00c03183..726066c5b9 100644
--- a/src/modules/addressbook/autocompletion-config.c
+++ b/src/modules/addressbook/autocompletion-config.c
@@ -135,6 +135,15 @@ get_general_page (EConfig *config,
gtk_box_pack_start (GTK_BOX (itembox), widget, FALSE, FALSE, 0);
gtk_widget_show (widget);
+ widget = gtk_check_button_new_with_mnemonic (
+ _("_Preview Personal information before Work information"));
+ g_settings_bind (
+ settings, "preview-home-before-work",
+ widget, "active",
+ G_SETTINGS_BIND_DEFAULT);
+ gtk_box_pack_start (GTK_BOX (itembox), widget, FALSE, FALSE, 0);
+ gtk_widget_show (widget);
+
container = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
gtk_box_pack_start (GTK_BOX (itembox), container, FALSE, FALSE, 0);
gtk_widget_show (container);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]