[evolution] Add an option to (not) have reminder notification dialog always on top



commit 3c3439c744473ed0eacde19096787aa15996cf04
Author: Milan Crha <mcrha redhat com>
Date:   Thu Oct 20 11:15:35 2016 +0200

    Add an option to (not) have reminder notification dialog always on top
    
    When there's set the 'keep-above' flag on the GtkWindow, then the window
    itself cannot be moved below other (regular) windows, which may not always
    make sense. This option lets the user to decide what he/she prefers.

 data/org.gnome.evolution.calendar.gschema.xml.in |    5 ++++
 src/calendar/alarm-notify/alarm-notify-dialog.c  |    3 +-
 src/calendar/alarm-notify/config-data.c          |    8 +++++++
 src/calendar/alarm-notify/config-data.h          |    2 +
 src/modules/calendar/e-calendar-preferences.c    |    6 +++++
 src/modules/calendar/e-calendar-preferences.ui   |   23 ++++++++++++++++++---
 6 files changed, 42 insertions(+), 5 deletions(-)
---
diff --git a/data/org.gnome.evolution.calendar.gschema.xml.in 
b/data/org.gnome.evolution.calendar.gschema.xml.in
index 8663b91..79a0b75 100644
--- a/data/org.gnome.evolution.calendar.gschema.xml.in
+++ b/data/org.gnome.evolution.calendar.gschema.xml.in
@@ -284,6 +284,11 @@
       <_summary>Show display reminders in notification tray</_summary>
       <_description>Whether or not to use the notification tray for display reminders</_description>
     </key>
+    <key name="notify-window-on-top" type="b">
+      <default>true</default>
+      <_summary>Show reminder notification dialog always on top</_summary>
+      <_description>Whether or not to show reminder notification dialog always on top. Note this works only 
as a hint for the window manager, which may or may not obey it.</_description>
+    </key>
     <key name="prefer-new-item" type="s">
       <default>''</default>
       <_summary>Preferred New button item</_summary>
diff --git a/src/calendar/alarm-notify/alarm-notify-dialog.c b/src/calendar/alarm-notify/alarm-notify-dialog.c
index a8a6d68..9e50777 100644
--- a/src/calendar/alarm-notify/alarm-notify-dialog.c
+++ b/src/calendar/alarm-notify/alarm-notify-dialog.c
@@ -350,7 +350,8 @@ notified_alarms_dialog_new (void)
 
        gtk_tree_view_set_model (GTK_TREE_VIEW (an->treeview), model);
 
-       gtk_window_set_keep_above (GTK_WINDOW (an->dialog), TRUE);
+       if (config_data_get_notify_window_on_top ())
+               gtk_window_set_keep_above (GTK_WINDOW (an->dialog), TRUE);
 
        column = gtk_tree_view_column_new_with_attributes (
                _("Start time"),
diff --git a/src/calendar/alarm-notify/config-data.c b/src/calendar/alarm-notify/config-data.c
index a2cc71a..9f209d2 100644
--- a/src/calendar/alarm-notify/config-data.c
+++ b/src/calendar/alarm-notify/config-data.c
@@ -298,6 +298,14 @@ config_data_is_blessed_program (const gchar *program)
        return found;
 }
 
+gboolean
+config_data_get_notify_window_on_top (void)
+{
+       ensure_inited ();
+
+       return g_settings_get_boolean (calendar_settings, "notify-window-on-top");
+}
+
 static gboolean can_debug = FALSE;
 static GRecMutex rec_mutex;
 
diff --git a/src/calendar/alarm-notify/config-data.h b/src/calendar/alarm-notify/config-data.h
index 5cf21bc..57eafa2 100644
--- a/src/calendar/alarm-notify/config-data.h
+++ b/src/calendar/alarm-notify/config-data.h
@@ -46,6 +46,8 @@ time_t                config_data_get_last_notification_time
 void           config_data_save_blessed_program
                                                (const gchar *program);
 gboolean       config_data_is_blessed_program  (const gchar *program);
+gboolean       config_data_get_notify_window_on_top
+                                               (void);
 
 void           config_data_init_debugging      (void);
 gboolean       config_data_start_debugging     (void);
diff --git a/src/modules/calendar/e-calendar-preferences.c b/src/modules/calendar/e-calendar-preferences.c
index 6a0158e..f805687 100644
--- a/src/modules/calendar/e-calendar-preferences.c
+++ b/src/modules/calendar/e-calendar-preferences.c
@@ -1036,6 +1036,12 @@ calendar_preferences_construct (ECalendarPreferences *prefs,
                widget, "active",
                G_SETTINGS_BIND_DEFAULT);
 
+       widget = e_builder_get_widget (prefs->builder, "notify_window_on_top");
+       g_settings_bind (
+               settings, "notify-window-on-top",
+               widget, "active",
+               G_SETTINGS_BIND_DEFAULT);
+
        widget = e_builder_get_widget (prefs->builder, "task_reminder_for_completed");
        g_settings_bind (
                settings, "task-reminder-for-completed",
diff --git a/src/modules/calendar/e-calendar-preferences.ui b/src/modules/calendar/e-calendar-preferences.ui
index a2fe263..bb83ce1 100644
--- a/src/modules/calendar/e-calendar-preferences.ui
+++ b/src/modules/calendar/e-calendar-preferences.ui
@@ -1263,6 +1263,21 @@
                   </packing>
                 </child>
                 <child>
+                  <object class="GtkCheckButton" id="notify_window_on_top">
+                    <property name="label" translatable="yes">Keep reminder notification _window always on 
top</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">False</property>
+                    <property name="use_underline">True</property>
+                    <property name="draw_indicator">True</property>
+                  </object>
+                  <packing>
+                    <property name="fill">False</property>
+                    <property name="expand">False</property>
+                    <property name="position">2</property>
+                  </packing>
+                </child>
+                <child>
                   <object class="GtkCheckButton" id="task_reminder_for_completed">
                     <property name="label" translatable="yes">Display reminders for completed 
_tasks</property>
                     <property name="visible">True</property>
@@ -1274,7 +1289,7 @@
                   <packing>
                     <property name="fill">False</property>
                     <property name="expand">False</property>
-                    <property name="position">2</property>
+                    <property name="position">3</property>
                   </packing>
                 </child>
                 <child>
@@ -1341,7 +1356,7 @@
                   <packing>
                     <property name="fill">False</property>
                     <property name="expand">False</property>
-                    <property name="position">3</property>
+                    <property name="position">4</property>
                   </packing>
                 </child>
                 <child>
@@ -1408,7 +1423,7 @@
                   <packing>
                     <property name="fill">False</property>
                     <property name="expand">False</property>
-                    <property name="position">4</property>
+                    <property name="position">5</property>
                   </packing>
                 </child>
                 <child>
@@ -1445,7 +1460,7 @@
                   <packing>
                     <property name="fill">False</property>
                     <property name="expand">False</property>
-                    <property name="position">5</property>
+                    <property name="position">6</property>
                   </packing>
                 </child>
               </object>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]