[gnome-flashback] watcher: initial version
- From: Alberts MuktupÄvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-flashback] watcher: initial version
- Date: Wed, 9 Dec 2015 14:57:50 +0000 (UTC)
commit 59ebbbbc4105779bd36936bea5a35d2c787b0f87
Author: Alberts MuktupÄvels <alberts muktupavels gmail com>
Date: Wed Dec 9 16:53:50 2015 +0200
watcher: initial version
configure.ac | 24 +++++++-
data/schemas/org.gnome.gnome-flashback.gschema.xml | 6 ++
gnome-flashback/Makefile.am | 8 +++
gnome-flashback/gf-application.c | 16 +++++
gnome-flashback/libwatcher/Makefile.am | 31 +++++++++
gnome-flashback/libwatcher/gf-watcher.c | 65 ++++++++++++++++++++
gnome-flashback/libwatcher/gf-watcher.h | 32 ++++++++++
modulesets/gnome-flashback-3.20.modules | 4 +-
8 files changed, 184 insertions(+), 2 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 615b0dd..9ef8e78 100644
--- a/configure.ac
+++ b/configure.ac
@@ -82,7 +82,7 @@ dnl **************************************************************************
GLIB_GSETTINGS
dnl **************************************************************************
-dnl Check forrequired packages
+dnl Check for required packages
dnl **************************************************************************
GTK_REQUIRED=3.15.2
@@ -197,6 +197,25 @@ PKG_CHECK_MODULES([WORKAROUNDS], [
])
dnl **************************************************************************
+dnl Build with libstatus-notifier (experimental)
+dnl **************************************************************************
+
+AC_ARG_WITH([libstatus-notifier],
+ [AS_HELP_STRING([--with-libstatus-notifier],
+ [Build with libstatus-notifier (experimental)])],
+ [with_libstatus_notifier="$withval"],
+ [with_libstatus_notifier=no])
+
+AS_IF([test "x$with_libstatus_notifier" = "xyes"], [
+ PKG_CHECK_MODULES([WATCHER], [libstatus-notifier-3.0])
+ AC_DEFINE([WITH_LIBSTATUS_NOTIFIER], [1],
+ [Define to 1 if libstatus-notifier is available])
+])
+
+AM_CONDITIONAL([WITH_LIBSTATUS_NOTIFIER],
+ [test "x$with_libstatus_notifier" = "xyes"])
+
+dnl **************************************************************************
dnl Define XKB base directory
dnl **************************************************************************
@@ -250,6 +269,7 @@ AC_CONFIG_FILES([
gnome-flashback/libshell/Makefile
gnome-flashback/libsound-applet/Makefile
gnome-flashback/libsound-applet/gvc/Makefile
+ gnome-flashback/libwatcher/Makefile
gnome-flashback/libworkarounds/Makefile
po/Makefile.in
@@ -276,3 +296,5 @@ echo " libdir ......................: ${libdir}"
echo " sysconfdir ..................: ${sysconfdir}"
echo " libexecdir ..................: ${libexecdir}"
echo ""
+echo " with libstatus-notifier .....: ${with_libstatus_notifier}"
+echo ""
diff --git a/data/schemas/org.gnome.gnome-flashback.gschema.xml
b/data/schemas/org.gnome.gnome-flashback.gschema.xml
index dce188f..5d6b56c 100644
--- a/data/schemas/org.gnome.gnome-flashback.gschema.xml
+++ b/data/schemas/org.gnome.gnome-flashback.gschema.xml
@@ -79,6 +79,12 @@
<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="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 c901ba7..06ec724 100644
--- a/gnome-flashback/Makefile.am
+++ b/gnome-flashback/Makefile.am
@@ -18,6 +18,10 @@ SUBDIRS = \
libworkarounds \
$(NULL)
+if WITH_LIBSTATUS_NOTIFIER
+SUBDIRS += libwatcher
+endif
+
bin_PROGRAMS = \
gnome-flashback \
$(NULL)
@@ -62,6 +66,10 @@ gnome_flashback_LDADD = \
$(top_builddir)/gnome-flashback/libworkarounds/libworkarounds.la \
$(NULL)
+if WITH_LIBSTATUS_NOTIFIER
+gnome_flashback_LDADD += $(top_builddir)/gnome-flashback/libwatcher/libwatcher.la
+endif
+
gf-resources.c: flashback.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir)
--generate-dependencies $(srcdir)/flashback.gresource.xml)
$(AM_V_GEN)$(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir) --generate --c-name gf $<
diff --git a/gnome-flashback/gf-application.c b/gnome-flashback/gf-application.c
index 0fe846b..655df98 100644
--- a/gnome-flashback/gf-application.c
+++ b/gnome-flashback/gf-application.c
@@ -36,6 +36,10 @@
#include "libsound-applet/gf-sound-applet.h"
#include "libworkarounds/gf-workarounds.h"
+#ifdef WITH_LIBSTATUS_NOTIFIER
+#include "libwatcher/gf-watcher.h"
+#endif
+
struct _GfApplication
{
GObject parent;
@@ -60,6 +64,10 @@ struct _GfApplication
GfScreenshot *screenshot;
GfSoundApplet *sound;
GfWorkarounds *workarounds;
+
+#ifdef WITH_LIBSTATUS_NOTIFIER
+ GfWatcher *watcher;
+#endif
};
G_DEFINE_TYPE (GfApplication, gf_application, G_TYPE_OBJECT)
@@ -153,6 +161,10 @@ settings_changed (GSettings *settings,
SETTING_CHANGED (sound, "sound-applet", gf_sound_applet_new)
SETTING_CHANGED (workarounds, "workarounds", gf_workarounds_new)
+#ifdef WITH_LIBSTATUS_NOTIFIER
+ SETTING_CHANGED (watcher, "watcher", gf_watcher_new)
+#endif
+
#undef SETTING_CHANGED
if (application->shell)
@@ -193,6 +205,10 @@ gf_application_dispose (GObject *object)
g_clear_object (&application->sound);
g_clear_object (&application->workarounds);
+#ifdef WITH_LIBSTATUS_NOTIFIER
+ g_clear_object (&application->watcher);
+#endif
+
G_OBJECT_CLASS (gf_application_parent_class)->dispose (object);
}
diff --git a/gnome-flashback/libwatcher/Makefile.am b/gnome-flashback/libwatcher/Makefile.am
new file mode 100644
index 0000000..8abb2bb
--- /dev/null
+++ b/gnome-flashback/libwatcher/Makefile.am
@@ -0,0 +1,31 @@
+NULL =
+
+noinst_LTLIBRARIES = \
+ libwatcher.la \
+ $(NULL)
+
+libwatcher_la_CPPFLAGS = \
+ -I$(top_builddir)/gnome-flashback/libwatcher \
+ $(NULL)
+
+libwatcher_la_CFLAGS = \
+ $(WATCHER_CFLAGS) \
+ $(WARN_CFLAGS) \
+ $(AM_CFLAGS) \
+ $(NULL)
+
+libwatcher_la_SOURCES = \
+ gf-watcher.c \
+ gf-watcher.h \
+ $(NULL)
+
+libwatcher_la_LDFLAGS = \
+ $(WARN_LDFLAGS) \
+ $(AM_LDFLAGS) \
+ $(NULL)
+
+libwatcher_la_LIBADD = \
+ $(WATCHER_LIBS) \
+ $(NULL)
+
+-include $(top_srcdir)/git.mk
diff --git a/gnome-flashback/libwatcher/gf-watcher.c b/gnome-flashback/libwatcher/gf-watcher.c
new file mode 100644
index 0000000..3e868c9
--- /dev/null
+++ b/gnome-flashback/libwatcher/gf-watcher.c
@@ -0,0 +1,65 @@
+/*
+ * 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 "gf-watcher.h"
+
+struct _GfWatcher
+{
+ GObject parent;
+
+ SnWatcher *watcher;
+};
+
+G_DEFINE_TYPE (GfWatcher, gf_watcher, G_TYPE_OBJECT)
+
+static void
+gf_watcher_finalize (GObject *object)
+{
+ GfWatcher *watcher;
+
+ watcher = GF_WATCHER (object);
+
+ g_clear_object (&watcher->watcher);
+
+ G_OBJECT_CLASS (gf_watcher_parent_class)->finalize (object);
+}
+
+static void
+gf_watcher_class_init (GfWatcherClass *watcher_class)
+{
+ GObjectClass *object_class;
+
+ object_class = G_OBJECT_CLASS (watcher_class);
+
+ object_class->finalize = gf_watcher_finalize;
+}
+
+static void
+gf_watcher_init (GfWatcher *watcher)
+{
+ watcher->watcher = sn_watcher_new ();
+}
+
+GfWatcher *
+gf_watcher_new (void)
+{
+ return g_object_new (GF_TYPE_WATCHER, NULL);
+}
diff --git a/gnome-flashback/libwatcher/gf-watcher.h b/gnome-flashback/libwatcher/gf-watcher.h
new file mode 100644
index 0000000..3efc26b
--- /dev/null
+++ b/gnome-flashback/libwatcher/gf-watcher.h
@@ -0,0 +1,32 @@
+/*
+ * 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 GF_WATCHER_H
+#define GF_WATCHER_H
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define GF_TYPE_WATCHER gf_watcher_get_type ()
+G_DECLARE_FINAL_TYPE (GfWatcher, gf_watcher, GF, WATCHER, GObject)
+
+GfWatcher *gf_watcher_new (void);
+
+G_END_DECLS
+
+#endif
diff --git a/modulesets/gnome-flashback-3.20.modules b/modulesets/gnome-flashback-3.20.modules
index df93eac..ff82212 100644
--- a/modulesets/gnome-flashback-3.20.modules
+++ b/modulesets/gnome-flashback-3.20.modules
@@ -77,12 +77,13 @@
</after>
</autotools>
- <autotools id="gnome-flashback">
+ <autotools id="gnome-flashback" autogenargs="--with-libstatus-notifier=yes">
<branch />
<dependencies>
<dep package="intltool" />
<dep package="gnome-desktop" />
<dep package="gtk+" />
+ <dep package="libstatus-notifier" />
<dep package="m4-common" />
</dependencies>
</autotools>
@@ -112,6 +113,7 @@
<dependencies>
<dep package="glib" />
<dep package="gtk-doc" />
+ <dep package="gtk+" />
<dep package="m4-common" />
</dependencies>
</autotools>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]