[gnome-flashback/wip/status-notifier] snw: initial version



commit cc1294901393a7c87d0abb5127fae5f7d2af8180
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Sun Jun 21 20:16:22 2015 +0300

    snw: initial version

 configure.ac                                     |    6 ++
 data/org.gnome.gnome-flashback.gschema.xml.in.in |    5 ++
 gnome-flashback/Makefile.am                      |    2 +
 gnome-flashback/flashback-application.c          |    4 ++
 gnome-flashback/libsnw/Makefile.am               |   15 +++++
 gnome-flashback/libsnw/flashback-snw.c           |   64 ++++++++++++++++++++++
 gnome-flashback/libsnw/flashback-snw.h           |   33 +++++++++++
 7 files changed, 129 insertions(+), 0 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 0f15854..392ff64 100644
--- a/configure.ac
+++ b/configure.ac
@@ -29,6 +29,7 @@ GLIB_GSETTINGS
 
 GTK_REQUIRED=3.15.2
 LIBGNOME_DESKTOP_REQUIRED=3.12.0
+LIBSTATUS_NOTIFIER_REQUIRED=3.17.0
 CANBERRA_REQUIRED=0.13
 GLIB_REQUIRED=2.44.0
 GSETTINGS_DESKTOP_SCHEMAS_REQUIRED=3.12.0
@@ -69,6 +70,10 @@ PKG_CHECK_MODULES(SHELL, gtk+-3.0 >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED gn
 AC_SUBST(SHELL_CFLAGS)
 AC_SUBST(SHELL_LIBS)
 
+PKG_CHECK_MODULES(SNW, libstatus-notifier-3.0 >= $LIBSTATUS_NOTIFIER_REQUIRED)
+AC_SUBST(SNW_CFLAGS)
+AC_SUBST(SNW_LIBS)
+
 PKG_CHECK_MODULES(GVC, gobject-2.0 libpulse libpulse-mainloop-glib)
 AM_CONDITIONAL(HAVE_INTROSPECTION, false)
 
@@ -92,6 +97,7 @@ gnome-flashback/libidle-monitor/Makefile
 gnome-flashback/libscreencast/Makefile
 gnome-flashback/libscreenshot/Makefile
 gnome-flashback/libshell/Makefile
+gnome-flashback/libsnw/Makefile
 gnome-flashback/libsound-applet/Makefile
 gnome-flashback/libsound-applet/gvc/Makefile
 gnome-flashback/libworkarounds/Makefile
diff --git a/data/org.gnome.gnome-flashback.gschema.xml.in.in 
b/data/org.gnome.gnome-flashback.gschema.xml.in.in
index 764128c..593849a 100644
--- a/data/org.gnome.gnome-flashback.gschema.xml.in.in
+++ b/data/org.gnome.gnome-flashback.gschema.xml.in.in
@@ -45,6 +45,11 @@
                        <_summary>Sound applet</_summary>
                        <_description>If set to true, then GNOME Flashback application will be used to show a 
sound applet. This is the same sound applet that used to be a part of GNOME Control Center.</_description>
                </key>
+               <key name="status-notifier-watcher" type="b">
+                       <default>true</default>
+                       <_summary>Status Notifier Watcher</_summary>
+                       <_description>If set to true, then GNOME Flashback application will be used as Status 
Notifier Watcher.</_description>
+               </key>
                <key name="workarounds" type="b">
                        <default>true</default>
                        <_summary>Workarounds</_summary>
diff --git a/gnome-flashback/Makefile.am b/gnome-flashback/Makefile.am
index 18a77bd..2cf6cd0 100644
--- a/gnome-flashback/Makefile.am
+++ b/gnome-flashback/Makefile.am
@@ -9,6 +9,7 @@ SUBDIRS = \
        libscreencast \
        libscreenshot \
        libshell \
+       libsnw \
        libsound-applet \
        libworkarounds \
        $(NULL)
@@ -39,6 +40,7 @@ gnome_flashback_LDADD = \
        $(top_builddir)/gnome-flashback/libscreencast/libscreencast.la \
        $(top_builddir)/gnome-flashback/libscreenshot/libscreenshot.la \
        $(top_builddir)/gnome-flashback/libshell/libshell.la \
+       $(top_builddir)/gnome-flashback/libsnw/libsnw.la \
        $(top_builddir)/gnome-flashback/libsound-applet/libsound-applet.la \
        $(top_builddir)/gnome-flashback/libworkarounds/libworkarounds.la \
        $(NULL)
diff --git a/gnome-flashback/flashback-application.c b/gnome-flashback/flashback-application.c
index 55440ca..b83d1ab 100644
--- a/gnome-flashback/flashback-application.c
+++ b/gnome-flashback/flashback-application.c
@@ -28,6 +28,7 @@
 #include "libscreenshot/flashback-screenshot.h"
 #include "libshell/flashback-shell.h"
 #include "libsound-applet/gvc-applet.h"
+#include "libsnw/flashback-snw.h"
 #include "libworkarounds/flashback-workarounds.h"
 
 struct _FlashbackApplication
@@ -48,6 +49,7 @@ struct _FlashbackApplication
   FlashbackScreencast       *screencast;
   FlashbackScreenshot       *screenshot;
   FlashbackShell            *shell;
+  FlashbackSnw              *snw;
   GvcApplet                 *applet;
   FlashbackWorkarounds      *workarounds;
 };
@@ -136,6 +138,7 @@ settings_changed (GSettings   *settings,
   SETTING_CHANGED (screencast, "screencast", flashback_screencast_new)
   SETTING_CHANGED (screenshot, "screenshot", flashback_screenshot_new)
   SETTING_CHANGED (shell, "shell", flashback_shell_new)
+  SETTING_CHANGED (snw, "status-notifier-watcher", flashback_snw_new)
   SETTING_CHANGED (applet, "sound-applet", gvc_applet_new)
   SETTING_CHANGED (workarounds, "workarounds", flashback_workarounds_new)
 
@@ -170,6 +173,7 @@ flashback_application_finalize (GObject *object)
   g_clear_object (&application->screencast);
   g_clear_object (&application->screenshot);
   g_clear_object (&application->shell);
+  g_clear_object (&application->snw);
   g_clear_object (&application->applet);
   g_clear_object (&application->workarounds);
 
diff --git a/gnome-flashback/libsnw/Makefile.am b/gnome-flashback/libsnw/Makefile.am
new file mode 100644
index 0000000..41055cb
--- /dev/null
+++ b/gnome-flashback/libsnw/Makefile.am
@@ -0,0 +1,15 @@
+noinst_LTLIBRARIES = \
+       libsnw.la
+
+AM_CPPFLAGS = \
+       $(SNW_CFLAGS) \
+       -I$(top_builddir)/gnome-flashback/libsnw
+
+libsnw_la_SOURCES = \
+       flashback-snw.c \
+       flashback-snw.h
+
+libsnw_la_LIBADD = \
+       $(SNW_LIBS)
+
+-include $(top_srcdir)/git.mk
diff --git a/gnome-flashback/libsnw/flashback-snw.c b/gnome-flashback/libsnw/flashback-snw.c
new file mode 100644
index 0000000..08c9b75
--- /dev/null
+++ b/gnome-flashback/libsnw/flashback-snw.c
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2015 Alberts Muktupāvels
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "config.h"
+
+#include <libstatus-notifier/sn.h>
+
+#include "flashback-snw.h"
+
+struct _FlashbackSnw
+{
+  GObject    parent;
+  SnWatcher *watcher;
+};
+
+G_DEFINE_TYPE (FlashbackSnw, flashback_snw, G_TYPE_OBJECT)
+
+static void
+flashback_snw_finalize (GObject *object)
+{
+  FlashbackSnw *snw;
+
+  snw = FLASHBACK_SNW (object);
+
+  g_clear_object (&snw->watcher);
+
+  G_OBJECT_CLASS (flashback_snw_parent_class)->finalize (object);
+}
+
+static void
+flashback_snw_class_init (FlashbackSnwClass *snw_class)
+{
+  GObjectClass *object_class;
+
+  object_class = G_OBJECT_CLASS (snw_class);
+
+  object_class->finalize = flashback_snw_finalize;
+}
+
+static void
+flashback_snw_init (FlashbackSnw *snw)
+{
+  snw->watcher = sn_watcher_new ();
+}
+
+FlashbackSnw *
+flashback_snw_new (void)
+{
+       return g_object_new (FLASHBACK_TYPE_SNW, NULL);
+}
diff --git a/gnome-flashback/libsnw/flashback-snw.h b/gnome-flashback/libsnw/flashback-snw.h
new file mode 100644
index 0000000..f199027
--- /dev/null
+++ b/gnome-flashback/libsnw/flashback-snw.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2015 Alberts Muktupāvels
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef FLASHBACK_SNW_H
+#define FLASHBACK_SNW_H
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define FLASHBACK_TYPE_SNW flashback_snw_get_type ()
+G_DECLARE_FINAL_TYPE (FlashbackSnw, flashback_snw,
+                      FLASHBACK, SNW, GObject)
+
+FlashbackSnw *flashback_snw_new (void);
+
+G_END_DECLS
+
+#endif


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