[gnome-flashback] power-applet: initial version



commit 7d6c7559f6128ead9a51cf98a740656d871cca06
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Mon Sep 7 02:03:35 2015 +0300

    power-applet: initial version
    
    https://bugzilla.gnome.org/show_bug.cgi?id=753425

 configure.ac                                      |    5 ++
 data/org.gnome.gnome-flashback.gschema.xml.in.in  |    5 ++
 gnome-flashback/Makefile.am                       |    2 +
 gnome-flashback/flashback-application.c           |    4 ++
 gnome-flashback/libpower-applet/Makefile.am       |   29 ++++++++++++++
 gnome-flashback/libpower-applet/gf-power-applet.c |   43 +++++++++++++++++++++
 gnome-flashback/libpower-applet/gf-power-applet.h |   32 +++++++++++++++
 7 files changed, 120 insertions(+), 0 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 6b1c6ca..1c19e0e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -71,6 +71,10 @@ PKG_CHECK_MODULES(POLKIT, gtk+-3.0 >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED p
 AC_SUBST(POLKIT_CFLAGS)
 AC_SUBST(POLKIT_LIBS)
 
+PKG_CHECK_MODULES(POWER_APPLET, gtk+-3.0 >= $GTK_REQUIRED)
+AC_SUBST(POWER_APPLET_CFLAGS)
+AC_SUBST(POWER_APPLET_LIBS)
+
 PKG_CHECK_MODULES(SCREENCAST, gtk+-3.0 >= $GTK_REQUIRED)
 AC_SUBST(SCREENCAST_CFLAGS)
 AC_SUBST(SCREENCAST_LIBS)
@@ -107,6 +111,7 @@ gnome-flashback/libdisplay-config/Makefile
 gnome-flashback/libend-session-dialog/Makefile
 gnome-flashback/libidle-monitor/Makefile
 gnome-flashback/libpolkit/Makefile
+gnome-flashback/libpower-applet/Makefile
 gnome-flashback/libscreencast/Makefile
 gnome-flashback/libscreenshot/Makefile
 gnome-flashback/libshell/Makefile
diff --git a/data/org.gnome.gnome-flashback.gschema.xml.in.in 
b/data/org.gnome.gnome-flashback.gschema.xml.in.in
index 6261287..c4018a6 100644
--- a/data/org.gnome.gnome-flashback.gschema.xml.in.in
+++ b/data/org.gnome.gnome-flashback.gschema.xml.in.in
@@ -35,6 +35,11 @@
                        <_summary>Authentication agent for polkit</_summary>
                        <_description>This is the same authentication agent that was provided by 
PolicyKit-gnome.</_description>
                </key>
+               <key name="power-applet" type="b">
+                       <default>true</default>
+                       <_summary>Power applet</_summary>
+                       <_description>If set to true, then GNOME Flashback application will be used to show a 
power applet.</_description>
+               </key>
                <key name="screencast" type="b">
                        <default>true</default>
                        <_summary>Screencasts</_summary>
diff --git a/gnome-flashback/Makefile.am b/gnome-flashback/Makefile.am
index bf18eec..9229434 100644
--- a/gnome-flashback/Makefile.am
+++ b/gnome-flashback/Makefile.am
@@ -8,6 +8,7 @@ SUBDIRS = \
        libend-session-dialog \
        libidle-monitor \
        libpolkit \
+       libpower-applet \
        libscreencast \
        libscreenshot \
        libshell \
@@ -50,6 +51,7 @@ gnome_flashback_LDADD = \
        $(top_builddir)/gnome-flashback/libend-session-dialog/libend-session-dialog.la \
        $(top_builddir)/gnome-flashback/libidle-monitor/libidle-monitor.la \
        $(top_builddir)/gnome-flashback/libpolkit/libpolkit.la \
+       $(top_builddir)/gnome-flashback/libpower-applet/libpower-applet.la \
        $(top_builddir)/gnome-flashback/libscreencast/libscreencast.la \
        $(top_builddir)/gnome-flashback/libscreenshot/libscreenshot.la \
        $(top_builddir)/gnome-flashback/libshell/libshell.la \
diff --git a/gnome-flashback/flashback-application.c b/gnome-flashback/flashback-application.c
index d298c7e..ddb3125 100644
--- a/gnome-flashback/flashback-application.c
+++ b/gnome-flashback/flashback-application.c
@@ -28,6 +28,7 @@
 #include "libend-session-dialog/flashback-end-session-dialog.h"
 #include "libidle-monitor/flashback-idle-monitor.h"
 #include "libpolkit/flashback-polkit.h"
+#include "libpower-applet/gf-power-applet.h"
 #include "libscreencast/flashback-screencast.h"
 #include "libscreenshot/flashback-screenshot.h"
 #include "libshell/flashback-shell.h"
@@ -54,6 +55,7 @@ struct _FlashbackApplication
   FlashbackScreenshot       *screenshot;
   FlashbackShell            *shell;
   GfBluetoothApplet         *bluetooth;
+  GfPowerApplet             *power;
   GvcApplet                 *applet;
   FlashbackWorkarounds      *workarounds;
 };
@@ -144,6 +146,7 @@ settings_changed (GSettings   *settings,
   SETTING_CHANGED (screenshot, "screenshot", flashback_screenshot_new)
   SETTING_CHANGED (shell, "shell", flashback_shell_new)
   SETTING_CHANGED (bluetooth, "bluetooth-applet", gf_bluetooth_applet_new)
+  SETTING_CHANGED (power, "power-applet", gf_power_applet_new)
   SETTING_CHANGED (applet, "sound-applet", gvc_applet_new)
   SETTING_CHANGED (workarounds, "workarounds", flashback_workarounds_new)
 
@@ -180,6 +183,7 @@ flashback_application_finalize (GObject *object)
   g_clear_object (&application->screenshot);
   g_clear_object (&application->shell);
   g_clear_object (&application->bluetooth);
+  g_clear_object (&application->power);
   g_clear_object (&application->applet);
   g_clear_object (&application->workarounds);
 
diff --git a/gnome-flashback/libpower-applet/Makefile.am b/gnome-flashback/libpower-applet/Makefile.am
new file mode 100644
index 0000000..10a7dcf
--- /dev/null
+++ b/gnome-flashback/libpower-applet/Makefile.am
@@ -0,0 +1,29 @@
+NULL =
+
+noinst_LTLIBRARIES = \
+       libpower-applet.la \
+       $(NULL)
+
+libpower_applet_la_CFLAGS = \
+       $(POWER_APPLET_CFLAGS) \
+       $(WARN_CFLAGS) \
+       $(AM_CFLAGS) \
+       -I$(top_builddir)/gnome-flashback/libpower-applet \
+       -DGNOMELOCALEDIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \
+       $(NULL)
+
+libpower_applet_la_SOURCES = \
+  gf-power-applet.c \
+       gf-power-applet.h \
+       $(NULL)
+
+libpower_applet_la_LDFLAGS = \
+       $(WARN_LDFLAGS) \
+       $(AM_LDFLAGS) \
+       $(NULL)
+
+libpower_applet_la_LIBADD = \
+       $(POWER_APPLET_LIBS) \
+       $(NULL)
+
+-include $(top_srcdir)/git.mk
diff --git a/gnome-flashback/libpower-applet/gf-power-applet.c 
b/gnome-flashback/libpower-applet/gf-power-applet.c
new file mode 100644
index 0000000..3d05485
--- /dev/null
+++ b/gnome-flashback/libpower-applet/gf-power-applet.c
@@ -0,0 +1,43 @@
+/*
+ * 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 "gf-power-applet.h"
+
+struct _GfPowerApplet
+{
+  GObject parent;
+};
+
+G_DEFINE_TYPE (GfPowerApplet, gf_power_applet, G_TYPE_OBJECT)
+
+static void
+gf_power_applet_class_init (GfPowerAppletClass *applet_class)
+{
+}
+
+static void
+gf_power_applet_init (GfPowerApplet *applet)
+{
+}
+
+GfPowerApplet *
+gf_power_applet_new (void)
+{
+  return g_object_new (GF_TYPE_POWER_APPLET, NULL);
+}
diff --git a/gnome-flashback/libpower-applet/gf-power-applet.h 
b/gnome-flashback/libpower-applet/gf-power-applet.h
new file mode 100644
index 0000000..1a5b97f
--- /dev/null
+++ b/gnome-flashback/libpower-applet/gf-power-applet.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_POWER_APPLET_H
+#define GF_POWER_APPLET_H
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define GF_TYPE_POWER_APPLET gf_power_applet_get_type ()
+G_DECLARE_FINAL_TYPE (GfPowerApplet, gf_power_applet, GF, POWER_APPLET, GObject)
+
+GfPowerApplet *gf_power_applet_new (void);
+
+G_END_DECLS
+
+#endif


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