[gnome-panel] status-notifier: initial version



commit f10ecc71ee785fcbc4c114d7b238a6b08a4e310d
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Wed Dec 9 22:08:13 2015 +0200

    status-notifier: initial version

 applets/Makefile.am                                |   17 +++--
 applets/status-notifier/Makefile.am                |   61 ++++++++++++++++
 .../org.gnome.panel.SnApplet.panel-applet.in.in    |   16 ++++
 applets/status-notifier/sn-applet.c                |   74 ++++++++++++++++++++
 applets/status-notifier/sn-applet.h                |   44 ++++++++++++
 configure.ac                                       |   20 +++++
 6 files changed, 227 insertions(+), 5 deletions(-)
---
diff --git a/applets/Makefile.am b/applets/Makefile.am
index e1e952d..1cf1359 100644
--- a/applets/Makefile.am
+++ b/applets/Makefile.am
@@ -1,7 +1,14 @@
-SUBDIRS =                      \
-       clock                   \
-       fish                    \
-       notification_area       \
-       wncklet
+NULL =
+
+SUBDIRS = \
+       clock \
+       fish \
+       notification_area \
+       wncklet \
+       $(NULL)
+
+if WITH_LIBSTATUS_NOTIFIER
+SUBDIRS += status-notifier
+endif
 
 -include $(top_srcdir)/git.mk
diff --git a/applets/status-notifier/Makefile.am b/applets/status-notifier/Makefile.am
new file mode 100644
index 0000000..c8821dd
--- /dev/null
+++ b/applets/status-notifier/Makefile.am
@@ -0,0 +1,61 @@
+NULL =
+
+libsn_applet_la_CPPFLAGS = \
+       -DGNOMELOCALEDIR=\""$(localedir)"\" \
+       -I$(srcdir) \
+       -I$(srcdir)/../../libpanel-applet \
+       -I$(top_builddir)/libpanel-applet \
+       $(NULL)
+
+libsn_applet_la_CFLAGS = \
+       $(LIBPANEL_APPLET_CFLAGS) \
+       $(STATUS_NOTIFIER_CFLAGS) \
+       $(WARN_CFLAGS) \
+       $(AM_CFLAGS) \
+       $(NULL)
+
+libsn_applet_la_SOURCES = \
+       sn-applet.c \
+       sn-applet.h \
+       $(NULL)
+
+libsn_applet_la_LIBADD = \
+       ../../libpanel-applet/libpanel-applet.la \
+       $(LIBPANEL_APPLET_LIBS) \
+       $(STATUS_NOTIFIER_LIBS) \
+       $(NULL)
+
+libsn_applet_la_LDFLAGS = \
+       -module \
+       -avoid-version \
+       $(WARN_LDFLAGS) \
+       $(AM_LDFLAGS) \
+       $(NULL)
+
+APPLET_LOCATION = $(pkglibdir)/$(LIBPANEL_APPLET_API_VERSION)/libsn-applet.so
+
+sn_applet_libdir = $(pkglibdir)/$(LIBPANEL_APPLET_API_VERSION)
+sn_applet_lib_LTLIBRARIES = libsn-applet.la
+
+appletdir = $(appletsdir)
+applet_in_files = org.gnome.panel.SnApplet.panel-applet.in
+applet_DATA = $(applet_in_files:.panel-applet.in=.panel-applet)
+
+$(applet_in_files): $(applet_in_files).in Makefile
+       $(AM_V_GEN)sed \
+               -e "s|\ LOCATION\@|$(APPLET_LOCATION)|" \
+               -e "s|\ VERSION\@|$(PACKAGE_VERSION)|" \
+               $< > $@
+
+ PANEL_INTLTOOL_PANEL_APPLET_RULE@
+
+EXTRA_DIST = \
+       org.gnome.panel.SnApplet.panel-applet.in.in \
+       $(NULL)
+
+CLEANFILES = \
+       $(applet_DATA) \
+       $(applet_DATA).in \
+       $(NULL)
+
+-include $(top_srcdir)/git.mk
diff --git a/applets/status-notifier/org.gnome.panel.SnApplet.panel-applet.in.in 
b/applets/status-notifier/org.gnome.panel.SnApplet.panel-applet.in.in
new file mode 100644
index 0000000..79736d3
--- /dev/null
+++ b/applets/status-notifier/org.gnome.panel.SnApplet.panel-applet.in.in
@@ -0,0 +1,16 @@
+[Applet Factory]
+Id=SnAppletFactory
+InProcess=true
+Location= LOCATION@
+_Name=Status Notifier Host Applet Factory
+_Description=Factory for status notifier host applet
+
+[SnApplet]
+_Name=Status Notifier Host
+_Description=Display all Status Notifier Items
+Icon=
+X-GNOME-Bugzilla-Bugzilla=GNOME
+X-GNOME-Bugzilla-Product=gnome-panel
+X-GNOME-Bugzilla-Component=sn-applet
+X-GNOME-Bugzilla-Version= VERSION@
+X-GNOME-Bugzilla-OtherBinaries=sn-applet
diff --git a/applets/status-notifier/sn-applet.c b/applets/status-notifier/sn-applet.c
new file mode 100644
index 0000000..d668803
--- /dev/null
+++ b/applets/status-notifier/sn-applet.c
@@ -0,0 +1,74 @@
+/*
+ * 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 2 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 "sn-applet.h"
+
+struct _SnApplet
+{
+  PanelApplet parent;
+};
+
+G_DEFINE_TYPE (SnApplet, sn_applet, PANEL_TYPE_APPLET)
+
+static gboolean
+sn_applet_fill (SnApplet *applet)
+{
+  GtkWidget *label;
+
+  label = gtk_label_new ("Status Notifier Host");
+
+  gtk_container_add (GTK_CONTAINER (applet), label);
+  gtk_widget_show (label);
+
+  gtk_widget_show (GTK_WIDGET (applet));
+
+  return TRUE;
+}
+
+static gboolean
+sn_applet_factory (PanelApplet *applet,
+                   const gchar *iid,
+                   gpointer     user_data)
+{
+  if (g_strcmp0 (iid, "SnApplet") == 0)
+    return sn_applet_fill (SN_APPLET (applet));
+
+  return FALSE;
+}
+
+static void
+sn_applet_class_init (SnAppletClass *applet_class)
+{
+}
+
+static void
+sn_applet_init (SnApplet *applet)
+{
+  PanelApplet *panel_applet;
+
+  panel_applet = PANEL_APPLET (applet);
+
+  panel_applet_set_flags (panel_applet, PANEL_APPLET_HAS_HANDLE |
+                          PANEL_APPLET_EXPAND_MINOR);
+}
+
+PANEL_APPLET_IN_PROCESS_FACTORY ("SnAppletFactory", SN_TYPE_APPLET,
+                                 sn_applet_factory, NULL);
diff --git a/applets/status-notifier/sn-applet.h b/applets/status-notifier/sn-applet.h
new file mode 100644
index 0000000..db97c66
--- /dev/null
+++ b/applets/status-notifier/sn-applet.h
@@ -0,0 +1,44 @@
+/*
+ * 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 2 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 SN_APPLET_H
+#define SN_APPLET_H
+
+#include <panel-applet.h>
+
+G_BEGIN_DECLS
+
+#define SN_TYPE_APPLET            (sn_applet_get_type())
+#define SN_APPLET(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), SN_TYPE_APPLET, SnApplet))
+#define SN_APPLET_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass),  SN_TYPE_APPLET, SnAppletClass))
+#define SN_IS_APPLET(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SN_TYPE_APPLET))
+#define SN_IS_APPLET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),  SN_TYPE_APPLET))
+#define SN_APPLET_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj),   SN_TYPE_APPLET, SnAppletClass))
+
+typedef struct _SnApplet      SnApplet;
+typedef struct _SnAppletClass SnAppletClass;
+
+struct _SnAppletClass
+{
+  PanelAppletClass parent_class;
+};
+
+GType sn_applet_get_type (void);
+
+G_END_DECLS
+
+#endif
diff --git a/configure.ac b/configure.ac
index 73b0778..890719a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -184,6 +184,23 @@ AM_CONDITIONAL(ENABLE_EDS, test "$enable_eds" = "yes")
 AC_SUBST(CLOCK_EDS_ICONDIR)
 
 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([STATUS_NOTIFIER], [libstatus-notifier-3.0])
+])
+
+AM_CONDITIONAL([WITH_LIBSTATUS_NOTIFIER],
+               [test "x$with_libstatus_notifier" = "xyes"])
+
+dnl **************************************************************************
 dnl Check if struct dirent contains a d_type member, for run dialog
 dnl **************************************************************************
 
@@ -282,6 +299,7 @@ AC_CONFIG_FILES([
   applets/clock/pixmaps/Makefile
   applets/fish/Makefile
   applets/notification_area/Makefile
+  applets/status-notifier/Makefile
   applets/wncklet/Makefile
 
   doc/Makefile
@@ -327,3 +345,5 @@ echo "  XRandr support ..................: ${have_randr}"
 echo "  Build introspection support .....: ${found_introspection}"
 echo "  Build gtk-doc documentation .....: ${enable_gtk_doc}"
 echo ""
+echo "  Build with libstatus-notifier ...: ${with_libstatus_notifier}"
+echo ""


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