[gnome-flashback] power-applet: move D-Bus interface files to libdbus
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-flashback] power-applet: move D-Bus interface files to libdbus
- Date: Tue, 17 Dec 2019 15:24:16 +0000 (UTC)
commit 06965783a7c996360a62175826f0d6dc35a14268
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Tue Dec 17 14:26:47 2019 +0200
power-applet: move D-Bus interface files to libdbus
dbus/Makefile.am | 9 +++++
.../org.freedesktop.UPower.Device.xml | 6 ++--
gnome-flashback/libpower-applet/Makefile.am | 25 ++-----------
gnome-flashback/libpower-applet/gf-power-applet.c | 42 +++++++++++-----------
4 files changed, 36 insertions(+), 46 deletions(-)
---
diff --git a/dbus/Makefile.am b/dbus/Makefile.am
index b4ca2b6..6d80624 100644
--- a/dbus/Makefile.am
+++ b/dbus/Makefile.am
@@ -75,6 +75,12 @@ gf-nautilus-gen.c: org.gnome.Nautilus.FileOperations.xml
--generate-c-code gf-nautilus-gen \
$(srcdir)/org.gnome.Nautilus.FileOperations.xml
+gf-upower-device-gen.h:
+gf-upower-device-gen.c: org.freedesktop.UPower.Device.xml
+ $(AM_V_GEN) $(GDBUS_CODEGEN) --c-namespace Gf \
+ --generate-c-code gf-upower-device-gen \
+ $(srcdir)/org.freedesktop.UPower.Device.xml
+
gf-screencast-gen.h:
gf-screencast-gen.c: org.gnome.Shell.Screencast.xml
$(AM_V_GEN) $(GDBUS_CODEGEN) --c-namespace Gf \
@@ -128,6 +134,8 @@ BUILT_SOURCES = \
gf-login-session-gen.h \
gf-nautilus-gen.c \
gf-nautilus-gen.h \
+ gf-upower-device-gen.c \
+ gf-upower-device-gen.h \
gf-screencast-gen.c \
gf-screencast-gen.h \
gf-screensaver-gen.c \
@@ -150,6 +158,7 @@ EXTRA_DIST = \
org.freedesktop.login1.Manager.xml \
org.freedesktop.login1.Seat.xml \
org.freedesktop.login1.Session.xml \
+ org.freedesktop.UPower.Device.xml \
org.gnome.Nautilus.FileOperations.xml \
org.gnome.ScreenSaver.xml \
org.gnome.SessionManager.Presence.xml \
diff --git a/gnome-flashback/libpower-applet/org.freedesktop.UPower.Device.xml
b/dbus/org.freedesktop.UPower.Device.xml
similarity index 89%
rename from gnome-flashback/libpower-applet/org.freedesktop.UPower.Device.xml
rename to dbus/org.freedesktop.UPower.Device.xml
index be17cbb..0234d2f 100644
--- a/gnome-flashback/libpower-applet/org.freedesktop.UPower.Device.xml
+++ b/dbus/org.freedesktop.UPower.Device.xml
@@ -1,7 +1,9 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
+"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node>
<interface name="org.freedesktop.UPower.Device">
-
- <annotation name="org.gtk.GDBus.C.Name" value="UPowerDevice" />
+ <annotation name="org.gtk.GDBus.C.Name" value="UPowerDeviceGen" />
<method name="Refresh">
</method>
diff --git a/gnome-flashback/libpower-applet/Makefile.am b/gnome-flashback/libpower-applet/Makefile.am
index 54baf46..fdfd048 100644
--- a/gnome-flashback/libpower-applet/Makefile.am
+++ b/gnome-flashback/libpower-applet/Makefile.am
@@ -7,8 +7,8 @@ noinst_LTLIBRARIES = \
libpower_applet_la_CPPFLAGS = \
-DG_LOG_DOMAIN=\"power-applet\" \
-DG_LOG_USE_STRUCTURED=1 \
- -I$(top_builddir)/gnome-flashback/libpower-applet \
-I$(top_srcdir) \
+ $(AM_CPPFLAGS) \
$(NULL)
libpower_applet_la_CFLAGS = \
@@ -20,7 +20,6 @@ libpower_applet_la_CFLAGS = \
libpower_applet_la_SOURCES = \
gf-power-applet.c \
gf-power-applet.h \
- $(BUILT_SOURCES) \
$(NULL)
libpower_applet_la_LDFLAGS = \
@@ -29,28 +28,8 @@ libpower_applet_la_LDFLAGS = \
$(NULL)
libpower_applet_la_LIBADD = \
+ $(top_builddir)/dbus/libdbus.la \
$(POWER_APPLET_LIBS) \
$(NULL)
-gf-upower-device.h:
-gf-upower-device.c: org.freedesktop.UPower.Device.xml
- $(AM_V_GEN) gdbus-codegen \
- --interface-prefix org.freedesktop.UPower.Device. \
- --c-namespace Gf \
- --generate-c-code gf-upower-device \
- $(srcdir)/org.freedesktop.UPower.Device.xml
-
-BUILT_SOURCES = \
- gf-upower-device.c \
- gf-upower-device.h \
- $(NULL)
-
-EXTRA_DIST = \
- org.freedesktop.UPower.Device.xml \
- $(NULL)
-
-CLEANFILES = \
- $(BUILT_SOURCES) \
- $(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
index bf71aa4..977aab1 100644
--- a/gnome-flashback/libpower-applet/gf-power-applet.c
+++ b/gnome-flashback/libpower-applet/gf-power-applet.c
@@ -16,26 +16,26 @@
*/
#include "config.h"
+#include "gf-power-applet.h"
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include <libupower-glib/upower.h>
#include <math.h>
-#include "gf-power-applet.h"
-#include "gf-upower-device.h"
+#include "dbus/gf-upower-device-gen.h"
#define UPOWER_DBUS_NAME "org.freedesktop.UPower"
#define UPOWER_DEVICE_DBUS_PATH "/org/freedesktop/UPower/devices/DisplayDevice"
struct _GfPowerApplet
{
- GObject parent;
+ GObject parent;
- gint bus_name_id;
+ gint bus_name_id;
- GtkStatusIcon *status_icon;
- GfUPowerDevice *device;
+ GtkStatusIcon *status_icon;
+ GfUPowerDeviceGen *device;
};
G_DEFINE_TYPE (GfPowerApplet, gf_power_applet, G_TYPE_OBJECT)
@@ -150,7 +150,7 @@ get_icon_name (GfPowerApplet *applet)
gchar *icon_name;
gchar *symbolic;
- icon_name = g_strdup (gf_upower_device_get_icon_name (applet->device));
+ icon_name = g_strdup (gf_upower_device_gen_get_icon_name (applet->device));
if (icon_name == NULL || icon_name[0] == '\0')
{
@@ -176,16 +176,16 @@ get_tooltip_text (GfPowerApplet *applet)
gdouble hours;
gdouble percentage;
- state = gf_upower_device_get_state (applet->device);
+ state = gf_upower_device_gen_get_state (applet->device);
if (state == UP_DEVICE_STATE_FULLY_CHARGED)
return g_strdup (_("Fully Charged"));
else if (state == UP_DEVICE_STATE_EMPTY)
return g_strdup (_("Empty"));
else if (state == UP_DEVICE_STATE_CHARGING)
- seconds = gf_upower_device_get_time_to_full (applet->device);
+ seconds = gf_upower_device_gen_get_time_to_full (applet->device);
else if (state == UP_DEVICE_STATE_DISCHARGING)
- seconds = gf_upower_device_get_time_to_empty (applet->device);
+ seconds = gf_upower_device_gen_get_time_to_empty (applet->device);
else if (state == UP_DEVICE_STATE_PENDING_CHARGE)
return g_strdup (_("Not Charging"));
else
@@ -198,7 +198,7 @@ get_tooltip_text (GfPowerApplet *applet)
minutes = fmod (time, 60);
hours = floor (time / 60);
- percentage = gf_upower_device_get_percentage (applet->device);
+ percentage = gf_upower_device_gen_get_percentage (applet->device);
if (state == UP_DEVICE_STATE_DISCHARGING)
{
@@ -222,7 +222,7 @@ get_title (GfPowerApplet *applet)
{
UpDeviceKind type;
- type = gf_upower_device_get_type_ (applet->device);
+ type = gf_upower_device_gen_get_type_ (applet->device);
if (type == UP_DEVICE_KIND_UPS)
return _("UPS");
@@ -259,7 +259,7 @@ gf_power_applet_sync (GfPowerApplet *applet)
title = get_title (applet);
gtk_status_icon_set_title (applet->status_icon, title);
- is_present = gf_upower_device_get_is_present (applet->device);
+ is_present = gf_upower_device_gen_get_is_present (applet->device);
gtk_status_icon_set_visible (applet->status_icon, is_present);
G_GNUC_END_IGNORE_DEPRECATIONS
@@ -289,7 +289,7 @@ device_proxy_ready_cb (GObject *source_object,
applet = GF_POWER_APPLET (user_data);
error = NULL;
- applet->device = gf_upower_device_proxy_new_for_bus_finish (res, &error);
+ applet->device = gf_upower_device_gen_proxy_new_for_bus_finish (res, &error);
if (error != NULL)
{
@@ -311,13 +311,13 @@ name_appeared_handler (GDBusConnection *connection,
const gchar *name_owner,
gpointer user_data)
{
- gf_upower_device_proxy_new_for_bus (G_BUS_TYPE_SYSTEM,
- G_DBUS_PROXY_FLAGS_NONE,
- UPOWER_DBUS_NAME,
- UPOWER_DEVICE_DBUS_PATH,
- NULL,
- device_proxy_ready_cb,
- user_data);
+ gf_upower_device_gen_proxy_new_for_bus (G_BUS_TYPE_SYSTEM,
+ G_DBUS_PROXY_FLAGS_NONE,
+ UPOWER_DBUS_NAME,
+ UPOWER_DEVICE_DBUS_PATH,
+ NULL,
+ device_proxy_ready_cb,
+ user_data);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]