[Xfce4-commits] [apps/xfce4-notifyd] 04/04: Make slideout depend on fadeout in the settings UI

noreply at xfce.org noreply at xfce.org
Thu Sep 7 00:40:52 CEST 2017


This is an automated email from the git hooks/post-receive script.

o   c   h   o   s   i       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository apps/xfce4-notifyd.

commit 5c338e872b9289bc21eadd8fa65e3fbbd2e0422c
Author: Simon Steinbeiss <simon.steinbeiss at elfenbeinturm.at>
Date:   Thu Sep 7 00:35:23 2017 +0200

    Make slideout depend on fadeout in the settings UI
---
 xfce4-notifyd-config/main.c                     | 33 ++++++++++++++++++++++---
 xfce4-notifyd-config/xfce4-notifyd-config.glade | 28 +++++++++++++++------
 2 files changed, 51 insertions(+), 10 deletions(-)

diff --git a/xfce4-notifyd-config/main.c b/xfce4-notifyd-config/main.c
index 99a5491..2e783b5 100644
--- a/xfce4-notifyd-config/main.c
+++ b/xfce4-notifyd-config/main.c
@@ -53,6 +53,12 @@ typedef struct
     GtkToolbar *log_toolbar;
 } NotificationLogWidgets;
 
+typedef struct
+{
+    GtkWidget  *do_slideout;
+    GtkWidget  *do_slideout_label;
+} NotificationSlideoutWidgets;
+
 static void
 xfce_notifyd_config_show_notification_callback(NotifyNotification *notification,
                                                const char         *action,
@@ -455,6 +461,20 @@ xfce4_notifyd_do_not_disturb_activated (GtkSwitch *do_not_disturb_switch,
     gtk_switch_set_active (GTK_SWITCH (do_not_disturb_switch), state);
 }
 
+static void
+xfce4_notifyd_do_fadeout_activated (GtkSwitch *do_fadeout,
+                                    gboolean state,
+                                    gpointer user_data)
+{
+    NotificationSlideoutWidgets *slideout_widgets = user_data;
+
+    /* The sliding out animation is only available along with fade-out */
+    if (state == FALSE)
+        gtk_switch_set_active (GTK_SWITCH (slideout_widgets->do_slideout), FALSE);
+    gtk_widget_set_sensitive (slideout_widgets->do_slideout, state);
+    gtk_widget_set_sensitive (slideout_widgets->do_slideout_label, state);
+    gtk_switch_set_active (GTK_SWITCH (do_fadeout), state);
+}
 
 static void
 xfce4_notifyd_log_activated (GtkSwitch *log_switch,
@@ -729,12 +749,12 @@ xfce4_notifyd_config_setup_dialog(GtkBuilder *builder)
     GtkWidget *icon;
     GtkWidget *primary_monitor;
     GtkWidget *do_fadeout;
-    GtkWidget *do_slideout;
     GtkAdjustment *adj;
     GError *error = NULL;
     gchar *current_theme;
     GKeyFile *notification_log;
     NotificationLogWidgets log_widgets;
+    NotificationSlideoutWidgets slideout_widgets;
 
     gtk_builder_connect_signals(builder, NULL);
 
@@ -813,9 +833,16 @@ xfce4_notifyd_config_setup_dialog(GtkBuilder *builder)
     xfconf_g_property_bind(channel, "/do-fadeout", G_TYPE_BOOLEAN,
                            G_OBJECT(do_fadeout), "active");
 
-    do_slideout = GTK_WIDGET(gtk_builder_get_object(builder, "do_slideout"));
+    slideout_widgets.do_slideout_label = GTK_WIDGET(gtk_builder_get_object(builder, "do_slideout_label"));
+    slideout_widgets.do_slideout = GTK_WIDGET(gtk_builder_get_object(builder, "do_slideout"));
     xfconf_g_property_bind(channel, "/do-slideout", G_TYPE_BOOLEAN,
-                           G_OBJECT(do_slideout), "active");
+                           G_OBJECT(slideout_widgets.do_slideout), "active");
+    g_signal_connect (G_OBJECT (do_fadeout), "state-set",
+                      G_CALLBACK (xfce4_notifyd_do_fadeout_activated), &slideout_widgets);
+    if (gtk_switch_get_active (GTK_SWITCH (do_fadeout)) == FALSE) {
+        gtk_widget_set_sensitive (slideout_widgets.do_slideout_label, FALSE);
+        gtk_widget_set_sensitive (slideout_widgets.do_slideout, FALSE);
+    }
 
     btn = GTK_WIDGET(gtk_builder_get_object(builder, "preview_button"));
     g_signal_connect(G_OBJECT(btn), "clicked",
diff --git a/xfce4-notifyd-config/xfce4-notifyd-config.glade b/xfce4-notifyd-config/xfce4-notifyd-config.glade
index b52785f..7a91464 100644
--- a/xfce4-notifyd-config/xfce4-notifyd-config.glade
+++ b/xfce4-notifyd-config/xfce4-notifyd-config.glade
@@ -362,7 +362,7 @@
                       </object>
                       <packing>
                         <property name="left_attach">1</property>
-                        <property name="top_attach">10</property>
+                        <property name="top_attach">11</property>
                       </packing>
                     </child>
                     <child>
@@ -445,7 +445,7 @@
                       </object>
                       <packing>
                         <property name="left_attach">1</property>
-                        <property name="top_attach">8</property>
+                        <property name="top_attach">9</property>
                       </packing>
                     </child>
                     <child>
@@ -458,21 +458,21 @@
                       </object>
                       <packing>
                         <property name="left_attach">0</property>
-                        <property name="top_attach">8</property>
+                        <property name="top_attach">9</property>
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkLabel" id="label12">
+                      <object class="GtkLabel" id="do_slideout_label">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <property name="margin_left">12</property>
-                        <property name="label" translatable="yes">_Sliding out animation</property>
+                        <property name="label" translatable="yes">_Slide out</property>
                         <property name="use_underline">True</property>
                         <property name="xalign">0</property>
                       </object>
                       <packing>
                         <property name="left_attach">0</property>
-                        <property name="top_attach">9</property>
+                        <property name="top_attach">10</property>
                       </packing>
                     </child>
                     <child>
@@ -484,7 +484,7 @@
                       </object>
                       <packing>
                         <property name="left_attach">1</property>
-                        <property name="top_attach">9</property>
+                        <property name="top_attach">10</property>
                       </packing>
                     </child>
                     <child>
@@ -603,6 +603,20 @@
                       </packing>
                     </child>
                     <child>
+                      <object class="GtkLabel">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="margin_top">12</property>
+                        <property name="label" translatable="yes"><b>Animations</b></property>
+                        <property name="use_markup">True</property>
+                        <property name="xalign">0</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">0</property>
+                        <property name="top_attach">8</property>
+                      </packing>
+                    </child>
+                    <child>
                       <object class="GtkComboBox" id="primary_monitor">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list