I#1792 - Contacts: Option to preview Personal section before Work
Closes https://gitlab.gnome.org/GNOME/evolution/-/issues/1792
This commit is contained 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>
|
||||
|
||||
@@ -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 *
|
||||
|
||||
@@ -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>");
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user