[Xfce4-commits] [apps/xfce4-notifyd] 01/01: Show warning in settings dialog if notifyd is not running (Bug #13417)

noreply at xfce.org noreply at xfce.org
Tue Aug 15 01:12: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 a0e8487336d9c9eb54548a73f8d17a13267fa8fe
Author: Simon Steinbeiss <simon.steinbeiss at elfenbeinturm.at>
Date:   Tue Aug 15 01:12:21 2017 +0200

    Show warning in settings dialog if notifyd is not running (Bug #13417)
---
 xfce4-notifyd-config/main.c                     | 31 ++++++++++
 xfce4-notifyd-config/xfce4-notifyd-config.glade | 76 ++++++++++++++++++++++++-
 2 files changed, 104 insertions(+), 3 deletions(-)

diff --git a/xfce4-notifyd-config/main.c b/xfce4-notifyd-config/main.c
index cfd0845..373f77c 100644
--- a/xfce4-notifyd-config/main.c
+++ b/xfce4-notifyd-config/main.c
@@ -645,6 +645,25 @@ static void xfce4_notifyd_show_help(GtkButton *button,
     xfce_dialog_show_help_with_version(GTK_WINDOW(dialog), "notifyd", "start", NULL, NULL);
 }
 
+static void xfce_notify_bus_name_appeared_cb (GDBusConnection *connection,
+                                              const gchar *name,
+                                              const gchar *name_owner,
+                                              gpointer user_data)
+{
+    GtkWidget  *notifyd_running = user_data;
+
+    gtk_revealer_set_reveal_child (GTK_REVEALER (notifyd_running), FALSE);
+}
+
+static void xfce_notify_bus_name_vanished_cb (GDBusConnection *connection,
+                                              const gchar *name,
+                                              gpointer user_data)
+{
+    GtkWidget *notifyd_running = user_data;
+
+    gtk_revealer_set_reveal_child (GTK_REVEALER (notifyd_running), TRUE);
+}
+
 GtkWidget *
 placeholder_label_new (gchar *place_holder_text)
 {
@@ -857,9 +876,11 @@ main(int argc,
      char **argv)
 {
     GtkWidget *settings_dialog = NULL;
+    GtkWidget *notifyd_running;
     GtkBuilder *builder;
     gboolean opt_version = FALSE;
     gint32 opt_socket_id = 0;
+    guint watch_handle_id;
     GOptionEntry option_entries[] = {
         { "version", 'V', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, &opt_version, N_("Display version information"), NULL },
         { "socket-id", 's', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_INT, &opt_socket_id, N_("Settings manager socket"), N_("SOCKET_ID") },
@@ -907,6 +928,15 @@ main(int argc,
 
     settings_dialog = xfce4_notifyd_config_setup_dialog(builder);
 
+    notifyd_running = GTK_WIDGET (gtk_builder_get_object (builder, "notifyd_running"));
+    watch_handle_id = g_bus_watch_name (G_BUS_TYPE_SESSION,
+                                        "org.freedesktop.Notifications",
+                                        G_BUS_NAME_WATCHER_FLAGS_NONE,
+                                        xfce_notify_bus_name_appeared_cb,
+                                        xfce_notify_bus_name_vanished_cb,
+                                        notifyd_running,
+                                        NULL);
+
     if(opt_socket_id) {
         GtkWidget *plug, *plug_child;
 
@@ -932,6 +962,7 @@ main(int argc,
         gtk_dialog_run(GTK_DIALOG(settings_dialog));
     }
 
+    g_bus_unwatch_name (watch_handle_id);
     notify_uninit();
     xfconf_shutdown();
 
diff --git a/xfce4-notifyd-config/xfce4-notifyd-config.glade b/xfce4-notifyd-config/xfce4-notifyd-config.glade
index c52aa1a..c27f8c1 100644
--- a/xfce4-notifyd-config/xfce4-notifyd-config.glade
+++ b/xfce4-notifyd-config/xfce4-notifyd-config.glade
@@ -148,6 +148,76 @@
             <property name="border_width">6</property>
             <property name="orientation">vertical</property>
             <child>
+              <object class="GtkRevealer" id="notifyd_running">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="transition_type">none</property>
+                <property name="reveal_child">True</property>
+                <child>
+                  <object class="GtkInfoBar" id="infobar2">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="message_type">warning</property>
+                    <child internal-child="action_area">
+                      <object class="GtkButtonBox">
+                        <property name="can_focus">False</property>
+                        <property name="spacing">6</property>
+                        <property name="layout_style">end</property>
+                        <child>
+                          <placeholder/>
+                        </child>
+                        <child>
+                          <placeholder/>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child internal-child="content_area">
+                      <object class="GtkBox">
+                        <property name="can_focus">False</property>
+                        <property name="spacing">16</property>
+                        <child>
+                          <object class="GtkLabel">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="label" translatable="yes">The notification service is not running. No notifications will be shown.</property>
+                          </object>
+                          <packing>
+                            <property name="expand">True</property>
+                            <property name="fill">True</property>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <placeholder/>
+                        </child>
+                        <child>
+                          <placeholder/>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
               <object class="GtkRevealer" id="do_not_disturb_info">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
@@ -233,7 +303,7 @@
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">True</property>
-                <property name="position">0</property>
+                <property name="position">1</property>
               </packing>
             </child>
             <child>
@@ -248,7 +318,7 @@
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">False</property>
-                <property name="position">1</property>
+                <property name="position">2</property>
               </packing>
             </child>
             <child>
@@ -736,7 +806,7 @@
               <packing>
                 <property name="expand">True</property>
                 <property name="fill">True</property>
-                <property name="position">2</property>
+                <property name="position">3</property>
               </packing>
             </child>
           </object>

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


More information about the Xfce4-commits mailing list