[gnome-flashback] system-indicators: initial version



commit 8851723cb9beb7e7d78423e4b65c379109d2ecc4
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Tue Dec 17 16:32:29 2019 +0200

    system-indicators: initial version

 Makefile.am                   |  1 +
 configure.ac                  | 31 +++++++++++++++++++++++
 po/POTFILES.in                |  1 +
 system-indicators/Makefile.am | 37 +++++++++++++++++++++++++++
 system-indicators/si-applet.c | 58 +++++++++++++++++++++++++++++++++++++++++++
 system-indicators/si-applet.h | 30 ++++++++++++++++++++++
 system-indicators/si-module.c | 57 ++++++++++++++++++++++++++++++++++++++++++
 7 files changed, 215 insertions(+)
---
diff --git a/Makefile.am b/Makefile.am
index 0c48de7..2492290 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -5,6 +5,7 @@ SUBDIRS = \
        dbus \
        backends \
        gnome-flashback \
+       system-indicators \
        po \
        $(NULL)
 
diff --git a/configure.ac b/configure.ac
index e9b059f..fa6495f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -309,6 +309,34 @@ AS_IF([test "x$enable_systemd_session" = "xyes"], [
 AM_CONDITIONAL([ENABLE_SYSTEMD_SESSION], [test "x$enable_systemd_session" = "xyes"])
 AC_SUBST([HIDDEN_UNDER_SYSTEMD])
 
+dnl **************************************************************************
+dnl System indicators
+dnl **************************************************************************
+
+AC_ARG_WITH([system-indicators],
+            [AS_HELP_STRING([--with-system-indicators], [build with System indicators])],
+            [with_system_indicators="$withval"], [with_system_indicators="auto"])
+
+AS_IF([test "x$with_system_indicators" != "xno"], [
+  PKG_CHECK_EXISTS([libgnome-panel],
+                   [found_libgnome_panel="yes"], [found_libgnome_panel="no"])
+
+  AS_IF([test "x$found_libgnome_panel" = "xyes"], [
+    GNOME_PANEL_MODULES_DIR=`$PKG_CONFIG --variable=modulesdir libgnome-panel`
+    AC_SUBST([GNOME_PANEL_MODULES_DIR], [$GNOME_PANEL_MODULES_DIR])
+
+    PKG_CHECK_MODULES([SYSTEM_INDICATORS], [
+      libgnome-panel
+    ])
+  ], [
+    AS_IF([test "x$with_system_indicators" = "xyes"], [
+      AC_MSG_ERROR([System indicators requested but libgnome-panel not found])
+    ])
+  ])
+], [found_libgnome_panel=no])
+
+AM_CONDITIONAL(WITH_SYSTEM_INDICATORS, [test "x$found_libgnome_panel" = "xyes"])
+
 dnl **************************************************************************
 dnl Compiz session
 dnl **************************************************************************
@@ -395,6 +423,8 @@ AC_CONFIG_FILES([
   gnome-flashback/libsound-applet/gvc/Makefile
   gnome-flashback/libstatus-notifier-watcher/Makefile
 
+  system-indicators/Makefile
+
   po/Makefile.in
 ])
 
@@ -419,5 +449,6 @@ echo "  libdir ......................: ${libdir}"
 echo "  sysconfdir ..................: ${sysconfdir}"
 echo "  libexecdir ..................: ${libexecdir}"
 echo ""
+echo "  System indicators ...........: ${found_libgnome_panel}"
 echo "  Compiz session ..............: ${found_compiz}"
 echo ""
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 8d8e8ce..514ee40 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -44,3 +44,4 @@ gnome-flashback/libsound-applet/gf-sound-applet.c
 gnome-flashback/libsound-applet/gvc-channel-bar.c
 gnome-flashback/libsound-applet/gvc/gvc-mixer-control.c
 gnome-flashback/libsound-applet/gvc-stream-status-icon.c
+system-indicators/si-module.c
diff --git a/system-indicators/Makefile.am b/system-indicators/Makefile.am
new file mode 100644
index 0000000..fd6e15e
--- /dev/null
+++ b/system-indicators/Makefile.am
@@ -0,0 +1,37 @@
+NULL =
+
+if WITH_SYSTEM_INDICATORS
+system_indicators_libdir = $(GNOME_PANEL_MODULES_DIR)
+system_indicators_lib_LTLIBRARIES = system_indicators.la
+
+system_indicators_la_CPPFLAGS = \
+       -DG_LOG_DOMAIN=\"system-indicators\" \
+       -DG_LOG_USE_STRUCTURED=1 \
+       -DLOCALE_DIR=\"$(localedir)\" \
+       $(AM_CPPFLAGS) \
+       $(NULL)
+
+system_indicators_la_CFLAGS = \
+       $(SYSTEM_INDICATORS_CFLAGS) \
+       $(WARN_CFLAGS) \
+       $(AM_CFLAGS) \
+       $(NULL)
+
+system_indicators_la_SOURCES = \
+       si-applet.c \
+       si-applet.h \
+       si-module.c \
+       $(NULL)
+
+system_indicators_la_LIBADD = \
+       $(SYSTEM_INDICATORS_LIBS) \
+       $(NULL)
+
+system_indicators_la_LDFLAGS = \
+       -module -avoid-version \
+       $(WARN_LDFLAGS) \
+       $(AM_LDFLAGS) \
+       $(NULL)
+endif
+
+-include $(top_srcdir)/git.mk
diff --git a/system-indicators/si-applet.c b/system-indicators/si-applet.c
new file mode 100644
index 0000000..6792a35
--- /dev/null
+++ b/system-indicators/si-applet.c
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2019 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 "si-applet.h"
+
+struct _SiApplet
+{
+  GpApplet parent;
+};
+
+G_DEFINE_TYPE (SiApplet, si_applet, GP_TYPE_APPLET)
+
+static void
+setup_applet (SiApplet *self)
+{
+}
+
+static void
+si_applet_constructed (GObject *object)
+{
+  G_OBJECT_CLASS (si_applet_parent_class)->constructed (object);
+  setup_applet (SI_APPLET (object));
+}
+
+static void
+si_applet_class_init (SiAppletClass *self_class)
+{
+  GObjectClass *object_class;
+
+  object_class = G_OBJECT_CLASS (self_class);
+
+  object_class->constructed = si_applet_constructed;
+}
+
+static void
+si_applet_init (SiApplet *self)
+{
+  GpAppletFlags flags;
+
+  flags = GP_APPLET_FLAGS_EXPAND_MINOR;
+
+  gp_applet_set_flags (GP_APPLET (self), flags);
+}
diff --git a/system-indicators/si-applet.h b/system-indicators/si-applet.h
new file mode 100644
index 0000000..512869a
--- /dev/null
+++ b/system-indicators/si-applet.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2019 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 SI_APPLET_H
+#define SI_APPLET_H
+
+#include <libgnome-panel/gp-applet.h>
+
+G_BEGIN_DECLS
+
+#define SI_TYPE_APPLET (si_applet_get_type ())
+G_DECLARE_FINAL_TYPE (SiApplet, si_applet, SI, APPLET, GpApplet)
+
+G_END_DECLS
+
+#endif
diff --git a/system-indicators/si-module.c b/system-indicators/si-module.c
new file mode 100644
index 0000000..9ad4d9b
--- /dev/null
+++ b/system-indicators/si-module.c
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2019 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 <glib/gi18n-lib.h>
+#include <libgnome-panel/gp-module.h>
+
+#include "si-applet.h"
+
+static GpAppletInfo *
+si_get_applet_info (const char *id)
+{
+  const char *name;
+  const char *description;
+  const char *icon;
+  GpAppletInfo *info;
+
+  name = _("System Indicators");
+  description = _("This applet contains system indicators");
+  icon = "applications-system";
+
+  info = gp_applet_info_new (si_applet_get_type, name, description, icon);
+
+  return info;
+}
+
+void
+gp_module_load (GpModule *module)
+{
+  bindtextdomain (GETTEXT_PACKAGE, LOCALE_DIR);
+  bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+  gp_module_set_gettext_domain (module, GETTEXT_PACKAGE);
+
+  gp_module_set_abi_version (module, GP_MODULE_ABI_VERSION);
+
+  gp_module_set_id (module, "org.gnome.gnome-flashback.system-indicators");
+  gp_module_set_version (module, PACKAGE_VERSION);
+
+  gp_module_set_applet_ids (module, "system-indicators", NULL);
+
+  gp_module_set_get_applet_info (module, si_get_applet_info);
+}


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