[gnome-power-manager] Remove the interface that gnome-shell uses, it's moved to gnome-settings-daemon
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-power-manager] Remove the interface that gnome-shell uses, it's moved to gnome-settings-daemon
- Date: Mon, 25 Jul 2011 13:22:04 +0000 (UTC)
commit fb5b07019f06de12df68724fd9aef2fd57a631da
Author: Richard Hughes <richard hughsie com>
Date: Mon Jul 4 12:33:29 2011 +0100
Remove the interface that gnome-shell uses, it's moved to gnome-settings-daemon
src/gpm-manager.c | 199 -----------------------------------------------------
1 files changed, 0 insertions(+), 199 deletions(-)
---
diff --git a/src/gpm-manager.c b/src/gpm-manager.c
index eb7132e..e6b4d73 100644
--- a/src/gpm-manager.c
+++ b/src/gpm-manager.c
@@ -54,25 +54,6 @@
#include "gpm-engine.h"
#include "gpm-upower.h"
-static const gchar *power_manager_introspection = ""
-"<?xml version=\"1.0\" encoding=\"utf-8\"?>"
-"<node name=\"/org/gnome/PowerManager\">"
- "<interface name=\"org.gnome.PowerManager\">"
- "<property name='Icon' type='s' access='read'>"
- "</property>"
- "<property name='Tooltip' type='s' access='read'>"
- "</property>"
- "<signal name=\"Changed\">"
- "</signal>"
- "<method name=\"GetPrimaryDevice\">"
- "<arg name=\"device\" type=\"(susdut)\" direction=\"out\" />"
- "</method>"
- "<method name=\"GetDevices\">"
- "<arg name=\"devices\" type=\"a(susdut)\" direction=\"out\" />"
- "</method>"
- "</interface>"
-"</node>";
-
static void gpm_manager_finalize (GObject *object);
#define GPM_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GPM_TYPE_MANAGER, GpmManagerPrivate))
@@ -1883,193 +1864,13 @@ gpm_manager_control_resume_cb (GpmControl *control, GpmControlAction action, Gpm
}
/**
- * gpm_manager_device_to_variant_blob:
- **/
-static GVariant *
-gpm_manager_device_to_variant_blob (UpDevice *device)
-{
- UpDeviceKind kind;
- UpDeviceState state;
- gdouble percentage;
- guint64 time_state = 0;
- guint64 time_empty, time_full;
- GVariant *value;
- GIcon *icon;
- gchar *device_icon;
- const gchar *object_path;
-
- icon = gpm_upower_get_device_icon (device, TRUE);
- device_icon = g_icon_to_string (icon);
- g_object_get (device,
- "kind", &kind,
- "percentage", &percentage,
- "state", &state,
- "time-to-empty", &time_empty,
- "time-to-full", &time_full,
- NULL);
-
- /* only return time for these simple states */
- if (state == UP_DEVICE_STATE_DISCHARGING)
- time_state = time_empty;
- else if (state == UP_DEVICE_STATE_CHARGING)
- time_state = time_full;
-
- /* get an object path, even for the composite device */
- object_path = up_device_get_object_path (device);
- if (object_path == NULL)
- object_path = "/org/gnome/PowerManager";
-
- /* format complex object */
- value = g_variant_new ("(susdut)",
- object_path,
- kind,
- device_icon,
- percentage,
- state,
- time_state);
- g_free (device_icon);
- return value;
-}
-
-/**
- * gpm_manager_dbus_method_call:
- **/
-static void
-gpm_manager_dbus_method_call (GDBusConnection *connection,
- const gchar *sender, const gchar *object_path,
- const gchar *interface_name, const gchar *method_name,
- GVariant *parameters,
- GDBusMethodInvocation *invocation,
- gpointer user_data)
-{
- GpmManager *manager = GPM_MANAGER (user_data);
- UpDevice *device;
- GVariant *value = NULL;
- GVariant *tuple = NULL;
- GPtrArray *array = NULL;
- guint i;
- GVariantBuilder *builder;
-
- /* return object */
- if (g_strcmp0 (method_name, "GetPrimaryDevice") == 0) {
-
- /* get the virtual device */
- device = gpm_engine_get_primary_device (manager->priv->engine);
- if (device == NULL) {
- g_dbus_method_invocation_return_dbus_error (invocation,
- "org.gnome.PowerManager.Failed",
- "There is no primary device to reflect system state (don't show any UI)");
- goto out;
- }
-
- /* return the value */
- value = gpm_manager_device_to_variant_blob (device);
- tuple = g_variant_new_tuple (&value, 1);
- g_dbus_method_invocation_return_value (invocation, tuple);
- goto out;
- }
-
- /* return array */
- if (g_strcmp0 (method_name, "GetDevices") == 0) {
-
- /* create builder */
- builder = g_variant_builder_new (G_VARIANT_TYPE("a(susdut)"));
-
- /* add each tuple to the array */
- array = gpm_engine_get_devices (manager->priv->engine);
- for (i=0; i<array->len; i++) {
- device = g_ptr_array_index (array, i);
- value = gpm_manager_device_to_variant_blob (device);
- g_variant_builder_add_value (builder, value);
- }
-
- /* return the value */
- value = g_variant_builder_end (builder);
- tuple = g_variant_new_tuple (&value, 1);
- g_dbus_method_invocation_return_value (invocation, tuple);
- g_variant_builder_unref (builder);
- }
-out:
- if (array != NULL)
- g_ptr_array_unref (array);
-}
-
-/**
- * gpm_manager_dbus_property_get:
- **/
-static GVariant *
-gpm_manager_dbus_property_get (GDBusConnection *connection,
- const gchar *sender, const gchar *object_path,
- const gchar *interface_name, const gchar *property_name,
- GError **error, gpointer user_data)
-{
- GpmManager *manager = GPM_MANAGER (user_data);
- gchar *tooltip = NULL;
- GIcon *icon = NULL;
- GVariant *retval = NULL;
-
- if (g_strcmp0 (property_name, "Icon") == 0) {
- icon = gpm_engine_get_icon (manager->priv->engine);
- if (icon != NULL)
- tooltip = g_icon_to_string (icon);
- retval = g_variant_new_string (tooltip != NULL ? tooltip : "");
- goto out;
- }
- if (g_strcmp0 (property_name, "Tooltip") == 0) {
- tooltip = gpm_engine_get_summary (manager->priv->engine);
- retval = g_variant_new_string (tooltip != NULL ? tooltip : "");
- goto out;
- }
-out:
- if (icon != NULL)
- g_object_unref (icon);
- g_free (tooltip);
- return retval;
-}
-
-/**
- * gpm_manager_dbus_property_set:
- **/
-static gboolean
-gpm_manager_dbus_property_set (GDBusConnection *connection,
- const gchar *sender, const gchar *object_path,
- const gchar *interface_name, const gchar *property_name,
- GVariant *value,
- GError **invocation, gpointer user_data)
-{
- /* GpmManager *manager = GPM_MANAGER (user_data); */
- /* do nothing, no properties defined (yet) */
- return FALSE;
-}
-
-/**
* gpm_manager_bus_acquired_cb:
**/
static void
gpm_manager_bus_acquired_cb (GDBusConnection *connection,
const gchar *name, gpointer user_data)
{
- GDBusNodeInfo *node_info;
- GDBusInterfaceInfo *interface_info;
GpmManager *manager = GPM_MANAGER (user_data);
- GDBusInterfaceVTable interface_vtable = {
- gpm_manager_dbus_method_call,
- gpm_manager_dbus_property_get,
- gpm_manager_dbus_property_set
- };
-
- node_info = g_dbus_node_info_new_for_xml (power_manager_introspection, NULL);
- interface_info = g_dbus_node_info_lookup_interface (node_info, GPM_DBUS_INTERFACE);
-
- manager->priv->bus_connection = (GDBusConnection*) g_object_ref ((GObject*) connection);
- manager->priv->bus_object_id = g_dbus_connection_register_object (connection,
- GPM_DBUS_PATH,
- interface_info,
- &interface_vtable,
- manager,
- NULL,
- NULL);
- g_dbus_node_info_unref (node_info);
if (manager->priv->backlight != NULL) {
gpm_backlight_register_dbus (manager->priv->backlight, connection);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]