[Xfce4-commits] <xfce4-power-manager:master> Completely drop the usage of HAL.
Ali Abdallah
noreply at xfce.org
Tue Jan 4 14:44:01 CET 2011
Updating branch refs/heads/master
to de0320e7748ba1a227442887a693a846281977d4 (commit)
from c00ccde6295b1ee8cbf57653bbaf26060d60f002 (commit)
commit de0320e7748ba1a227442887a693a846281977d4
Author: Ali Abdallah <aliov at xfce.org>
Date: Tue Jan 4 14:45:21 2011 +0100
Completely drop the usage of HAL.
Makefile.am | 5 -
common/Makefile.am | 10 -
configure.ac.in | 18 --
libhal/Makefile.am | 40 ----
libhal/hal-device.c | 416 ----------------------------------
libhal/hal-device.h | 87 -------
libhal/hal-manager.c | 282 -----------------------
libhal/hal-manager.h | 69 ------
libhal/hal-marshal.list | 3 -
panel-plugins/brightness/Makefile.am | 10 -
src/xfpm-button.c | 159 -------------
src/xfpm-errors.c | 1 -
src/xfpm-errors.h | 1 -
src/xfpm-main.c | 5 -
14 files changed, 0 insertions(+), 1106 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 7827b2d..328aa68 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -4,14 +4,9 @@ if BUILD_PANEL_PLUGINS
plugins_dir = panel-plugins
endif
-if ENABLE_HAL
-libhal_dir = libhal
-endif
-
SUBDIRS = \
data \
libdbus \
- $(libhal_dir) \
common \
src \
settings \
diff --git a/common/Makefile.am b/common/Makefile.am
index e004a46..8805985 100644
--- a/common/Makefile.am
+++ b/common/Makefile.am
@@ -16,13 +16,3 @@ libxfpmcommon_la_CFLAGS = \
$(GTK_CFLAGS) \
$(GLIB_CFLAGS) \
$(LIBXFCE4UTIL_CFLAGS)
-
-if ENABLE_HAL
-
-libxfpmcommon_la_CFLAGS += \
- $(DBUS_GLIB_CFLAGS) \
- -I$(top_srcdir)/libhal
-
-libxfpmcommon_la_LIBADD = \
- $(top_builddir)/libhal/libxfpmhal.la
-endif
diff --git a/configure.ac.in b/configure.ac.in
index 63d63f1..fcb0c08 100644
--- a/configure.ac.in
+++ b/configure.ac.in
@@ -99,22 +99,6 @@ fi
AM_CONDITIONAL([ENABLE_POLKIT], [test "x$polkit" = "xyes"])
#=======================================================#
-# Use HAL? #
-#=======================================================#
-AC_ARG_ENABLE([hal],
- [AC_HELP_STRING([--disable-hal],
- [Do not enable HAL (default=enabled)])],
- [ac_cv_enable_hal=$enableval],
- [ac_cv_enable_hal=yes])
-if test "x$ac_cv_enable_hal" = "xno"; then
- enable_hal="no"
-else
- enable_hal="yes"
- AC_DEFINE(WITH_HAL, 1 , [HAL support])
-fi
-AM_CONDITIONAL([ENABLE_HAL], [test "x$enable_hal" = "xyes"])
-
-#=======================================================#
# Check for DPMS support #
#=======================================================#
DPMS_LIBS=
@@ -224,7 +208,6 @@ AC_SUBST([PLATFORM_LDFLAGS])
AC_OUTPUT([
Makefile
libdbus/Makefile
-libhal/Makefile
common/Makefile
src/Makefile
settings/Makefile
@@ -264,7 +247,6 @@ echo "
prefix: ${prefix}
xdg autostart: ${sysconfdir/xdg/autostart}
- HAL: ${enable_hal}
POLKIT: ${polkit}
DPMS: ${have_dpms}
Network manager: ${ac_network_manager}
diff --git a/libhal/Makefile.am b/libhal/Makefile.am
deleted file mode 100644
index d6e6853..0000000
--- a/libhal/Makefile.am
+++ /dev/null
@@ -1,40 +0,0 @@
-noinst_LTLIBRARIES = \
- libxfpmhal.la
-
-libxfpmhal_la_SOURCES = \
- hal-manager.c \
- hal-manager.h \
- hal-device.c \
- hal-device.h \
- hal-marshal.c \
- hal-marshal.h
-
-libxfpmhal_la_CFLAGS = \
- -I$(top_srcdir) \
- -I$(top_srcdir)/libdbus \
- $(GLIB_CFLAGS) \
- $(DBUS_GLIB_CFLAGS)
-
-libxfpmhal_la_LIBADD = \
- $(top_builddir)/libdbus/libxfpmdbus.la
-
-if MAINTAINER_MODE
-
-BUILT_SOURCES = \
- hal-marshal.c \
- hal-marshal.h
-
-hal-marshal.c: hal-marshal.list
- echo "#include \"hal-marshal.h\"" > $@ && \
- glib-genmarshal $< --prefix=_hal_marshal --body >> $@
-
-hal-marshal.h: hal-marshal.list
- glib-genmarshal $< --prefix=_hal_marshal --header > $@
-
-endif
-
-EXTRA_DIST = \
- hal-marshal.list
-
-DISTCLEANFILES = \
- $(BUILT_SOURCES)
\ No newline at end of file
diff --git a/libhal/hal-device.c b/libhal/hal-device.c
deleted file mode 100644
index d6da465..0000000
--- a/libhal/hal-device.c
+++ /dev/null
@@ -1,416 +0,0 @@
-/*
- * * Copyright (C) 2008-2009 Ali <aliov at xfce.org>
- *
- * Licensed under the GNU General Public License Version 2
- *
- * 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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/*
- * Based on code from gnome power manager
- * Copyright (C) 2006-2007 Richard Hughes <richard at hughsie.com>
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <dbus/dbus-glib.h>
-
-#include "hal-device.h"
-#include "hal-marshal.h"
-
-static void hal_device_finalize (GObject *object);
-
-#define HAL_DEVICE_GET_PRIVATE(o) \
-(G_TYPE_INSTANCE_GET_PRIVATE((o), HAL_TYPE_DEVICE, HalDevicePrivate))
-
-struct HalDevicePrivate
-{
- DBusGConnection *bus;
- DBusGProxy *proxy;
- gchar *udi;
-
- gboolean watch_added;
- gboolean watch_condition_added;
-};
-
-enum
-{
- DEVICE_CHANGED,
- DEVICE_CONDITION,
- LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL] = { 0 };
-
-G_DEFINE_TYPE(HalDevice, hal_device, G_TYPE_OBJECT)
-
-static void
-hal_device_class_init (HalDeviceClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS(klass);
-
- signals[DEVICE_CHANGED] =
- g_signal_new("device-changed",
- HAL_TYPE_DEVICE,
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET(HalDeviceClass, device_changed),
- NULL, NULL,
- _hal_marshal_VOID__STRING_STRING_BOOLEAN_BOOLEAN,
- G_TYPE_NONE, 4,
- G_TYPE_STRING, G_TYPE_STRING,
- G_TYPE_BOOLEAN, G_TYPE_BOOLEAN);
-
- signals[DEVICE_CONDITION] =
- g_signal_new("device-condition",
- HAL_TYPE_DEVICE,
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET(HalDeviceClass, device_condition),
- NULL, NULL,
- _hal_marshal_VOID__STRING_STRING,
- G_TYPE_NONE, 2,
- G_TYPE_STRING, G_TYPE_STRING);
-
- object_class->finalize = hal_device_finalize;
-
- g_type_class_add_private (klass, sizeof(HalDevicePrivate));
-}
-
-static void
-hal_device_property_modified_cb (DBusGProxy *proxy,
- gint type,
- GPtrArray *properties,
- HalDevice *device)
-{
- GValueArray *array;
- const gchar *udi;
- const gchar *key;
- gboolean is_added;
- gboolean is_removed;
- guint i;
-
- udi = dbus_g_proxy_get_path (proxy);
-
- for ( i = 0; i < properties->len; i++ )
- {
- array = g_ptr_array_index (properties, i);
- if ( array->n_values != 3 )
- continue;
-
- key = g_value_get_string (g_value_array_get_nth (array, 0));
- is_removed = g_value_get_boolean (g_value_array_get_nth (array, 1));
- is_added = g_value_get_boolean (g_value_array_get_nth (array, 2));
- g_signal_emit (G_OBJECT(device), signals[DEVICE_CHANGED], 0, udi, key, is_added, is_removed);
- }
-}
-
-static void
-hal_device_add_watch (HalDevice *device)
-{
- GType array_gtype, gtype;
-
- g_return_if_fail ( DBUS_IS_G_PROXY (device->priv->proxy) );
-
- gtype = dbus_g_type_get_struct ("GValueArray",
- G_TYPE_STRING,
- G_TYPE_BOOLEAN,
- G_TYPE_BOOLEAN,
- G_TYPE_INVALID);
-
- array_gtype = dbus_g_type_get_collection ("GPtrArray", gtype);
-
- dbus_g_object_register_marshaller (_hal_marshal_VOID__INT_BOXED,
- G_TYPE_NONE, G_TYPE_INT,
- array_gtype, G_TYPE_INVALID);
-
-
- dbus_g_proxy_add_signal (device->priv->proxy,
- "PropertyModified",
- G_TYPE_INT,
- array_gtype,
- G_TYPE_INVALID);
-
- dbus_g_proxy_connect_signal (device->priv->proxy, "PropertyModified",
- G_CALLBACK (hal_device_property_modified_cb), device, NULL);
-
- device->priv->watch_added = TRUE;
-}
-
-static void
-hal_device_condition_cb (DBusGProxy *proxy,
- const gchar *condition,
- const gchar *details,
- HalDevice *device)
-{
- g_signal_emit (device, signals [DEVICE_CONDITION], 0, condition, details);
-}
-
-static void
-hal_device_add_watch_condition (HalDevice *device)
-{
- g_return_if_fail ( DBUS_IS_G_PROXY (device->priv->proxy) );
-
- dbus_g_object_register_marshaller (_hal_marshal_VOID__STRING_STRING,
- G_TYPE_NONE, G_TYPE_STRING, G_TYPE_STRING,
- G_TYPE_INVALID);
-
- dbus_g_proxy_add_signal (device->priv->proxy, "Condition",
- G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID);
-
- dbus_g_proxy_connect_signal (device->priv->proxy, "Condition",
- G_CALLBACK (hal_device_condition_cb), device, NULL);
-
- device->priv->watch_condition_added = TRUE;
-}
-
-static void
-hal_device_proxy_destroy_cb (HalDevice *device)
-{
- g_return_if_fail (HAL_IS_DEVICE (device));
-
- device->priv->proxy = NULL;
-}
-
-static void
-hal_device_init (HalDevice *device)
-{
- GError *error = NULL;
-
- device->priv = HAL_DEVICE_GET_PRIVATE(device);
-
- device->priv->proxy = NULL;
- device->priv->udi = NULL;
- device->priv->watch_added = FALSE;
- device->priv->watch_condition_added = FALSE;
-
- device->priv->bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error);
-
- if ( error )
- {
- g_critical ("Unable to get bus system: %s\n", error->message);
- g_error_free (error);
- }
-
-}
-
-static void
-hal_device_finalize (GObject *object)
-{
- HalDevice *device;
-
- device = HAL_DEVICE (object);
-
- if ( device->priv->udi )
- g_free (device->priv->udi);
-
- if ( device->priv->bus )
- dbus_g_connection_unref (device->priv->bus);
-
- if ( device->priv->watch_added && device->priv->proxy )
- dbus_g_proxy_disconnect_signal (device->priv->proxy, "PropertyModified",
- G_CALLBACK(hal_device_property_modified_cb), device);
-
- if ( device->priv->watch_condition_added && device->priv->proxy )
- {
- dbus_g_proxy_disconnect_signal (device->priv->proxy, "Condition",
- G_CALLBACK(hal_device_condition_cb), device);
- }
-
-
- if ( device->priv->proxy )
- g_object_unref (device->priv->proxy);
-
- G_OBJECT_CLASS (hal_device_parent_class)->finalize (object);
-}
-
-HalDevice *
-hal_device_new (void)
-{
- HalDevice *device = NULL;
- device = g_object_new (HAL_TYPE_DEVICE, NULL);
-
- return device;
-}
-
-void hal_device_set_udi (HalDevice *device, const gchar *udi)
-{
- g_return_if_fail (HAL_IS_DEVICE (device));
-
- if ( device->priv->udi )
- {
- g_free (device->priv->udi);
- device->priv->udi = NULL;
- g_object_unref (device->priv->proxy);
- }
-
- g_return_if_fail (udi != NULL);
-
- device->priv->udi = g_strdup (udi);
-
- device->priv->proxy = dbus_g_proxy_new_for_name (device->priv->bus,
- "org.freedesktop.Hal",
- device->priv->udi,
- "org.freedesktop.Hal.Device");
- g_signal_connect_swapped (G_OBJECT (device->priv->proxy), "destroy",
- G_CALLBACK (hal_device_proxy_destroy_cb), device);
-}
-
-const gchar *hal_device_get_udi (HalDevice *device)
-{
- g_return_val_if_fail (HAL_IS_DEVICE(device), NULL);
-
- return device->priv->udi;
-}
-
-gboolean
-hal_device_watch (HalDevice *device)
-{
- g_return_val_if_fail (device->priv->udi != NULL, FALSE);
- hal_device_add_watch(device);
-
- return device->priv->watch_added;
-}
-
-gboolean
-hal_device_watch_condition (HalDevice *device)
-{
- g_return_val_if_fail (device->priv->udi != NULL, FALSE);
-
- hal_device_add_watch_condition (device);
-
- return device->priv->watch_condition_added;
-}
-
-gboolean hal_device_get_property_bool (HalDevice *device, const gchar *property)
-{
- gboolean value = FALSE;
- GError *error = NULL;
-
- g_return_val_if_fail (HAL_IS_DEVICE(device), FALSE);
- g_return_val_if_fail (device->priv->udi != NULL, FALSE);
-
- dbus_g_proxy_call (device->priv->proxy, "GetPropertyBoolean", &error,
- G_TYPE_STRING, property,
- G_TYPE_INVALID,
- G_TYPE_BOOLEAN, &value,
- G_TYPE_INVALID);
-
- if ( error )
- {
- g_critical ("Error getting bool property on device %s: %s\n", device->priv->udi, error->message);
- g_error_free (error);
- }
-
- return value;
-}
-
-gint hal_device_get_property_int (HalDevice *device, const gchar *property)
-{
- gint value = 0;
- GError *error = NULL;
-
- g_return_val_if_fail (HAL_IS_DEVICE(device), 0);
- g_return_val_if_fail (device->priv->udi != NULL, 0);
-
- dbus_g_proxy_call (device->priv->proxy, "GetPropertyInteger", &error,
- G_TYPE_STRING, property,
- G_TYPE_INVALID,
- G_TYPE_INT, &value,
- G_TYPE_INVALID);
-
- if ( error )
- {
- g_critical ("Error getting integer property on device %s: %s\n", device->priv->udi, error->message);
- g_error_free (error);
- }
-
- return value;
-}
-
-gchar *hal_device_get_property_string (HalDevice *device, const gchar *property)
-{
- gchar *value = NULL;
- GError *error = NULL;
-
- g_return_val_if_fail (HAL_IS_DEVICE(device), NULL);
- g_return_val_if_fail (device->priv->udi != NULL, NULL);
-
- dbus_g_proxy_call (device->priv->proxy, "GetPropertyString", &error,
- G_TYPE_STRING, property,
- G_TYPE_INVALID,
- G_TYPE_STRING, &value,
- G_TYPE_INVALID);
-
- if ( error )
- {
- g_critical ("Error getting string property on device %s: %s\n", device->priv->udi, error->message);
- g_error_free (error);
- }
-
- return value;
-}
-
-gboolean hal_device_has_key (HalDevice *device, const gchar *key)
-{
- gboolean value = FALSE;
- GError *error = NULL;
-
- g_return_val_if_fail (HAL_IS_DEVICE(device), FALSE);
- g_return_val_if_fail (device->priv->udi != NULL, FALSE);
-
- dbus_g_proxy_call (device->priv->proxy, "PropertyExists", &error,
- G_TYPE_STRING, key,
- G_TYPE_INVALID,
- G_TYPE_BOOLEAN, &value,
- G_TYPE_INVALID);
-
- if ( error )
- {
- g_critical ("Error getting property exists on device %s: %s\n", device->priv->udi, error->message);
- g_error_free (error);
- }
-
- return value;
-}
-
-
-gboolean hal_device_has_capability (HalDevice *device, const gchar *capability)
-{
- gboolean value = FALSE;
- GError *error = NULL;
-
- g_return_val_if_fail (HAL_IS_DEVICE(device), FALSE);
- g_return_val_if_fail (device->priv->udi != NULL, FALSE);
-
- dbus_g_proxy_call (device->priv->proxy, "QueryCapability", &error,
- G_TYPE_STRING, capability,
- G_TYPE_INVALID,
- G_TYPE_BOOLEAN, &value,
- G_TYPE_INVALID);
-
- if ( error )
- {
- g_critical ("Error getting querying capability on device %s: %s\n", device->priv->udi, error->message);
- g_error_free (error);
- }
-
- return value;
-}
diff --git a/libhal/hal-device.h b/libhal/hal-device.h
deleted file mode 100644
index bd1e161..0000000
--- a/libhal/hal-device.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * * Copyright (C) 2008-2009 Ali <aliov at xfce.org>
- *
- * Licensed under the GNU General Public License Version 2
- *
- * 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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __HAL_DEVICE_H
-#define __HAL_DEVICE_H
-
-#include <glib-object.h>
-
-G_BEGIN_DECLS
-
-#define HAL_TYPE_DEVICE (hal_device_get_type () )
-#define HAL_DEVICE(o) (G_TYPE_CHECK_INSTANCE_CAST((o), HAL_TYPE_DEVICE, HalDevice))
-#define HAL_IS_DEVICE(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), HAL_TYPE_DEVICE))
-
-typedef struct HalDevicePrivate HalDevicePrivate;
-
-typedef struct
-{
- GObject parent;
- HalDevicePrivate *priv;
-
-} HalDevice;
-
-typedef struct
-{
- GObjectClass parent_class;
-
- void (*device_changed) (HalDevice *device,
- const gchar *udi,
- const gchar *key,
- gboolean is_added,
- gboolean is_removed);
-
- void (*device_condition) (HalDevice *device,
- const gchar *condition,
- const gchar *detail);
-
-} HalDeviceClass;
-
-GType hal_device_get_type (void) G_GNUC_CONST;
-
-HalDevice *hal_device_new (void);
-
-void hal_device_set_udi (HalDevice *device,
- const gchar *udi);
-
-const gchar *hal_device_get_udi (HalDevice *device);
-
-gboolean hal_device_watch (HalDevice *device);
-
-gboolean hal_device_watch_condition (HalDevice *device);
-
-gboolean hal_device_get_property_bool (HalDevice *device,
- const gchar *property);
-
-gint hal_device_get_property_int (HalDevice *device,
- const gchar *property);
-
-gchar *hal_device_get_property_string (HalDevice *device,
- const gchar *property);
-
-gboolean hal_device_has_key (HalDevice *device,
- const gchar *key);
-
-gboolean hal_device_has_capability (HalDevice *device,
- const gchar *capability);
-
-G_END_DECLS
-
-#endif /* __HAL_DEVICE_H */
diff --git a/libhal/hal-manager.c b/libhal/hal-manager.c
deleted file mode 100644
index 7ec8a61..0000000
--- a/libhal/hal-manager.c
+++ /dev/null
@@ -1,282 +0,0 @@
-/*
- * * Copyright (C) 2008-2009 Ali <aliov at xfce.org>
- *
- * Licensed under the GNU General Public License Version 2
- *
- * 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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <dbus/dbus-glib.h>
-#include <dbus/dbus-glib-lowlevel.h>
-#include <glib.h>
-
-#include "hal-manager.h"
-#include "hal-device.h"
-
-#include "libdbus/xfpm-dbus-monitor.h"
-#include "libdbus/xfpm-dbus.h"
-
-static void hal_manager_finalize (GObject *object);
-
-#define HAL_MANAGER_GET_PRIVATE(o) \
-(G_TYPE_INSTANCE_GET_PRIVATE((o), HAL_TYPE_MANAGER, HalManagerPrivate))
-
-struct HalManagerPrivate
-{
- XfpmDBusMonitor *monitor;
- DBusGConnection *bus;
- DBusGProxy *proxy;
- gboolean connected;
- gboolean is_laptop;
-
- gulong sig_hal;
-};
-
-enum
-{
- DEVICE_ADDED,
- DEVICE_REMOVED,
- CONNECTION_CHANGED,
- LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL] = { 0 };
-
-G_DEFINE_TYPE (HalManager, hal_manager, G_TYPE_OBJECT)
-
-static void
-hal_manager_device_added_cb (DBusGProxy *proxy, const gchar *udi, HalManager *manager)
-{
- g_signal_emit (G_OBJECT(manager), signals[DEVICE_ADDED], 0, udi);
-}
-
-static void
-hal_manager_device_removed_cb (DBusGProxy *proxy, const gchar *udi, HalManager *manager)
-{
- g_signal_emit (G_OBJECT(manager), signals[DEVICE_REMOVED], 0, udi);
-}
-
-static void
-hal_manager_connect (HalManager *manager)
-{
- GError *error = NULL;
-
- manager->priv->bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error);
-
- if ( error )
- {
- g_critical ("Failed to get bus system %s\n", error->message);
- g_error_free (error);
- goto out;
- }
-
- manager->priv->connected = xfpm_dbus_name_has_owner (dbus_g_connection_get_connection (manager->priv->bus),
- "org.freedesktop.Hal");
-
- if ( !manager->priv->connected )
- goto out;
-
- manager->priv->proxy = dbus_g_proxy_new_for_name (manager->priv->bus,
- "org.freedesktop.Hal",
- "/org/freedesktop/Hal/Manager",
- "org.freedesktop.Hal.Manager");
-
- if ( !manager->priv->proxy )
- {
- g_critical ("Unable to get proxy for \n");
- goto out;
- }
-
- dbus_g_proxy_add_signal (manager->priv->proxy, "DeviceAdded",
- G_TYPE_STRING, G_TYPE_INVALID);
-
- dbus_g_proxy_connect_signal (manager->priv->proxy, "DeviceAdded",
- G_CALLBACK (hal_manager_device_added_cb), manager, NULL);
-
- dbus_g_proxy_add_signal (manager->priv->proxy, "DeviceRemoved",
- G_TYPE_STRING, G_TYPE_INVALID);
-
- dbus_g_proxy_connect_signal (manager->priv->proxy, "DeviceRemoved",
- G_CALLBACK (hal_manager_device_removed_cb), manager, NULL);
-out:
- ;
-}
-
-static void
-hal_manager_service_connection_changed_cb (XfpmDBusMonitor *monitor,
- gchar *service_name,
- gboolean is_connected,
- gboolean on_session,
- HalManager *manager)
-{
- if ( !on_session)
- {
- if (!g_strcmp0 (service_name, "org.freedesktop.Hal") )
- {
- if ( manager->priv->connected != is_connected )
- {
- manager->priv->connected = is_connected;
- g_signal_emit (G_OBJECT (manager), signals [CONNECTION_CHANGED], 0, is_connected);
- }
- }
- }
-}
-
-static void
-hal_manager_class_init (HalManagerClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS(klass);
-
- signals[DEVICE_ADDED] =
- g_signal_new("device-added",
- HAL_TYPE_MANAGER,
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET(HalManagerClass, device_added),
- NULL, NULL,
- g_cclosure_marshal_VOID__STRING,
- G_TYPE_NONE, 1, G_TYPE_STRING);
-
- signals[DEVICE_REMOVED] =
- g_signal_new("device-removed",
- HAL_TYPE_MANAGER,
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET(HalManagerClass, device_removed),
- NULL, NULL,
- g_cclosure_marshal_VOID__STRING,
- G_TYPE_NONE, 1, G_TYPE_STRING);
-
- signals[CONNECTION_CHANGED] =
- g_signal_new("connection-changed",
- HAL_TYPE_MANAGER,
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET(HalManagerClass, connection_changed),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
-
- object_class->finalize = hal_manager_finalize;
-
- g_type_class_add_private (klass,sizeof(HalManagerPrivate));
-}
-
-static void
-hal_manager_init (HalManager *manager)
-{
- manager->priv = HAL_MANAGER_GET_PRIVATE (manager);
-
- manager->priv->bus = NULL;
- manager->priv->proxy = NULL;
- manager->priv->connected = FALSE;
- manager->priv->monitor = xfpm_dbus_monitor_new ();
-
- hal_manager_connect (manager);
-
- xfpm_dbus_monitor_add_service (manager->priv->monitor, DBUS_BUS_SYSTEM, "org.freedesktop.Hal");
-
- manager->priv->sig_hal =
- g_signal_connect (manager->priv->monitor, "service-connection-changed",
- G_CALLBACK (hal_manager_service_connection_changed_cb), manager);
-}
-
-static void
-hal_manager_finalize (GObject *object)
-{
- HalManager *manager;
-
- manager = HAL_MANAGER(object);
-
- if ( g_signal_handler_is_connected (manager->priv->monitor, manager->priv->sig_hal) )
- g_signal_handler_disconnect (manager->priv->monitor, manager->priv->sig_hal);
-
- if ( manager->priv->proxy )
- g_object_unref (manager->priv->proxy);
-
- if ( manager->priv->bus )
- dbus_g_connection_unref (manager->priv->bus);
-
- xfpm_dbus_monitor_remove_service (manager->priv->monitor, DBUS_BUS_SYSTEM, "org.freedesktop.Hal");
-
- g_object_unref (manager->priv->monitor);
-
- G_OBJECT_CLASS(hal_manager_parent_class)->finalize(object);
-}
-
-HalManager *
-hal_manager_new (void)
-{
- static gpointer hal_manager_object = NULL;
-
- if ( hal_manager_object != NULL )
- {
- g_object_ref (hal_manager_object);
- }
- else
- {
- hal_manager_object = g_object_new (HAL_TYPE_MANAGER, NULL);
- g_object_add_weak_pointer (hal_manager_object, &hal_manager_object);
- }
-
- return HAL_MANAGER (hal_manager_object);
-}
-
-gchar **hal_manager_find_device_by_capability (HalManager *manager, const gchar *capability)
-{
- GError *error = NULL;
- gchar **udi = NULL;
-
- g_return_val_if_fail (HAL_IS_MANAGER(manager), NULL);
- g_return_val_if_fail (manager->priv->connected, NULL);
-
- dbus_g_proxy_call (manager->priv->proxy, "FindDeviceByCapability", &error,
- G_TYPE_STRING, capability,
- G_TYPE_INVALID,
- G_TYPE_STRV, &udi,
- G_TYPE_INVALID);
- if ( error )
- {
- g_critical ("Error finding devices by capability %s\n", error->message);
- g_error_free (error);
- }
-
- return udi;
-}
-
-void hal_manager_free_string_array (gchar **array)
-{
- gint i;
-
- if (array == NULL)
- return;
-
- for (i=0; array[i]; i++)
- g_free (array[i]);
-
- g_free (array);
-}
-
-gboolean hal_manager_get_is_connected (HalManager *manager)
-{
- g_return_val_if_fail (HAL_IS_MANAGER (manager), FALSE);
-
- return manager->priv->connected;
-}
diff --git a/libhal/hal-manager.h b/libhal/hal-manager.h
deleted file mode 100644
index 76e94be..0000000
--- a/libhal/hal-manager.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * * Copyright (C) 2008-2009 Ali <aliov at xfce.org>
- *
- * Licensed under the GNU General Public License Version 2
- *
- * 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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __HAL_MANAGER_H
-#define __HAL_MANAGER_H
-
-#include <glib-object.h>
-
-G_BEGIN_DECLS
-
-#define HAL_TYPE_MANAGER (hal_manager_get_type () )
-#define HAL_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST((o), HAL_TYPE_MANAGER, HalManager))
-#define HAL_IS_MANAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), HAL_TYPE_MANAGER))
-
-typedef struct HalManagerPrivate HalManagerPrivate;
-
-typedef struct
-{
- GObject parent;
- HalManagerPrivate *priv;
-
-} HalManager;
-
-typedef struct
-{
- GObjectClass parent_class;
-
- void (*device_added) (HalManager *manager,
- const gchar *udi);
- void (*device_removed) (HalManager *manager,
- const gchar *udi);
-
- void (*connection_changed) (HalManager *manager,
- gboolean connected);
-
-} HalManagerClass;
-
-GType hal_manager_get_type (void) G_GNUC_CONST;
-HalManager *hal_manager_new (void);
-
-gchar **hal_manager_find_device_by_capability (HalManager *manager,
- const gchar *capability);
-
-gboolean hal_manager_get_is_laptop (HalManager *manager) G_GNUC_PURE;
-
-void hal_manager_free_string_array (gchar **array);
-
-gboolean hal_manager_get_is_connected (HalManager *manager);
-
-G_END_DECLS
-
-#endif /* __HAL_MANAGER_H */
diff --git a/libhal/hal-marshal.list b/libhal/hal-marshal.list
deleted file mode 100644
index 60999e3..0000000
--- a/libhal/hal-marshal.list
+++ /dev/null
@@ -1,3 +0,0 @@
-NONE:INT,BOXED
-NONE:STRING,STRING,BOOLEAN,BOOLEAN
-NONE:STRING,STRING
diff --git a/panel-plugins/brightness/Makefile.am b/panel-plugins/brightness/Makefile.am
index 922cc68..33836b0 100644
--- a/panel-plugins/brightness/Makefile.am
+++ b/panel-plugins/brightness/Makefile.am
@@ -32,16 +32,6 @@ xfce4_brightness_plugin_LDADD = \
$(GLIB_LIBS) \
$(XRANDR_LIBS)
-if ENABLE_HAL
-
-xfce4_brightness_plugin_CFLAGS += \
- $(DBUS_GLIB_CFLAGS)
-
-xfce4_brightness_plugin_LDADD += \
- $(DBUS_GLIB_LIBS)
-
-endif
-
#
# Desktop file
#
diff --git a/src/xfpm-button.c b/src/xfpm-button.c
index 1c8fabb..a903311 100644
--- a/src/xfpm-button.c
+++ b/src/xfpm-button.c
@@ -48,11 +48,6 @@
#include "xfpm-enum-types.h"
#include "xfpm-debug.h"
-#ifdef WITH_HAL
-#include "libhal/hal-manager.h"
-#include "libhal/hal-device.h"
-#endif
-
static void xfpm_button_finalize (GObject *object);
#define XFPM_BUTTON_GET_PRIVATE(o) \
@@ -70,9 +65,6 @@ struct XfpmButtonPrivate
GdkWindow *window;
guint8 mapped_buttons;
-#ifdef WITH_HAL
- GPtrArray *array;
-#endif
};
enum
@@ -224,125 +216,6 @@ xfpm_button_setup (XfpmButton *button)
xfpm_button_filter_x_events, button);
}
-#ifdef WITH_HAL
-static void
-xfpm_button_hal_emit_signals (XfpmButton *button, const gchar *condition, const gchar *detail)
-{
- if ( g_strcmp0 (condition, "ButtonPressed") )
- return;
-
- XFPM_DEBUG ("Button press condition %s detail %s", condition, detail);
-
- if ( !g_strcmp0 (detail, "power") )
- g_signal_emit (G_OBJECT (button), signals [BUTTON_PRESSED], 0, BUTTON_POWER_OFF);
- else if ( !g_strcmp0 (detail, "sleep") || !g_strcmp0 (detail, "suspend") )
- g_signal_emit (G_OBJECT (button), signals [BUTTON_PRESSED], 0, BUTTON_SLEEP);
- else if ( !g_strcmp0 (detail, "hibernate"))
- g_signal_emit (G_OBJECT (button), signals [BUTTON_PRESSED], 0, BUTTON_HIBERNATE);
- else if ( !g_strcmp0 (detail, "brightness-up") )
- g_signal_emit (G_OBJECT (button), signals [BUTTON_PRESSED], 0, BUTTON_MON_BRIGHTNESS_UP);
- else if ( !g_strcmp0 (detail, "brightness-down") )
- g_signal_emit (G_OBJECT (button), signals [BUTTON_PRESSED], 0, BUTTON_MON_BRIGHTNESS_DOWN);
-}
-
-static void
-xfpm_button_hal_condition_cb (HalDevice *device, const gchar *condition,
- const gchar *detail, XfpmButton *button)
-{
- xfpm_button_hal_emit_signals (button, condition, detail);
-}
-
-static void
-xfpm_button_add_button_hal (XfpmButton *button, const gchar *udi)
-{
- HalDevice *device;
- gchar *button_type = NULL;
-
- device = hal_device_new ();
-
- hal_device_set_udi (device, udi);
-
- if ( hal_device_has_key (device, "button.type") )
- {
- button_type = hal_device_get_property_string (device, "button.type");
-
- if ( button_type == NULL )
- {
- g_object_unref (device);
- return;
- }
-
- if ( !g_strcmp0 (button_type, "sleep") && !(button->priv->mapped_buttons & SLEEP_KEY))
- button->priv->mapped_buttons |= SLEEP_KEY;
- else if ( !g_strcmp0 (button_type, "suspend") && !(button->priv->mapped_buttons & SLEEP_KEY))
- button->priv->mapped_buttons |= SLEEP_KEY;
- else if ( !g_strcmp0 (button_type, "hibernate") && !(button->priv->mapped_buttons & HIBERNATE_KEY))
- button->priv->mapped_buttons |= HIBERNATE_KEY;
- else if ( !g_strcmp0 (button_type, "power") && !(button->priv->mapped_buttons & POWER_KEY))
- button->priv->mapped_buttons |= POWER_KEY;
- else if ( !g_strcmp0 (button_type, "brightness-up") && !(button->priv->mapped_buttons & BRIGHTNESS_KEY_UP))
- button->priv->mapped_buttons |= BRIGHTNESS_KEY_UP;
- else if ( !g_strcmp0 (button_type, "brightness-down") && !(button->priv->mapped_buttons & BRIGHTNESS_KEY_DOWN))
- button->priv->mapped_buttons |= BRIGHTNESS_KEY_DOWN;
- else
- {
- g_object_unref (device);
- if ( button_type )
- g_free (button_type);
- return;
- }
-
- if ( button_type )
- g_free (button_type);
- }
- else
- {
- g_object_unref (device);
- return;
- }
-
- g_signal_connect (device, "device-condition",
- G_CALLBACK (xfpm_button_hal_condition_cb), button);
-
- hal_device_watch_condition (device);
-
- if ( button->priv->array == NULL )
- {
- button->priv->array = g_ptr_array_new ();
- }
- g_ptr_array_add (button->priv->array, device);
-
-}
-
-static void
-xfpm_button_setup_failed_hal (XfpmButton *button)
-{
- HalManager *manager;
- gchar **udi;
- int i;
-
- XFPM_DEBUG ("Getting missing buttons from HAL");
-
- manager = hal_manager_new ();
-
- udi = hal_manager_find_device_by_capability (manager, "button");
-
- g_object_unref (manager);
-
- if ( udi == NULL || udi[0] == NULL )
- return;
-
- for ( i = 0; udi[i]; i++)
- {
- xfpm_button_add_button_hal (button, udi[i]);
- }
-
- hal_manager_free_string_array (udi);
- if ( button->priv->array )
- XFPM_DEBUG ("Mapped HAL buttons : %u", button->priv->array->len);
-}
-#endif /* WITH_HAL*/
-
static void
xfpm_button_class_init(XfpmButtonClass *klass)
{
@@ -372,31 +245,7 @@ xfpm_button_init (XfpmButton *button)
button->priv->window = NULL;
xfpm_button_setup (button);
-#ifdef WITH_HAL
- if ( !(button->priv->mapped_buttons & BRIGHTNESS_KEY_DOWN ) ||
- !(button->priv->mapped_buttons & BRIGHTNESS_KEY_UP ) ||
- !(button->priv->mapped_buttons & SLEEP_KEY ) ||
- !(button->priv->mapped_buttons & HIBERNATE_KEY) ||
- !(button->priv->mapped_buttons & POWER_KEY ) )
- xfpm_button_setup_failed_hal (button);
-#endif
-
-}
-
-#ifdef WITH_HAL
-static void
-xfpm_button_free_device_array (XfpmButton *button)
-{
- HalDevice *device;
- guint i;
-
- for ( i = 0 ; i<button->priv->array->len; i++)
- {
- device = g_ptr_array_index (button->priv->array, i);
- g_object_unref (device);
- }
}
-#endif
static void
xfpm_button_finalize (GObject *object)
@@ -405,14 +254,6 @@ xfpm_button_finalize (GObject *object)
button = XFPM_BUTTON (object);
-#ifdef WITH_HAL
- if ( button->priv->array )
- {
- xfpm_button_free_device_array (button);
- g_ptr_array_free (button->priv->array, TRUE);
- }
-#endif
-
G_OBJECT_CLASS(xfpm_button_parent_class)->finalize(object);
}
diff --git a/src/xfpm-errors.c b/src/xfpm-errors.c
index d87e56b..7a449f4 100644
--- a/src/xfpm-errors.c
+++ b/src/xfpm-errors.c
@@ -49,7 +49,6 @@ xfpm_error_get_type (void)
{ XFPM_ERROR_NO_HARDWARE_SUPPORT, "XFPM_ERROR_HARDWARE_NOT_SUPPORT", "NoHardwareSupport" },
{ XFPM_ERROR_COOKIE_NOT_FOUND, "XFPM_ERROR_COOKIE_NOT_FOUND", "CookieNotFound" },
{ XFPM_ERROR_INVALID_ARGUMENTS, "XFPM_ERROR_INVALID_ARGUMENTS", "InvalidArguments" },
- { XFPM_ERROR_HAL_DISCONNECTED, "XFPM_ERROR_HAL_DISCONNECTED", "HalDisconnected" },
{ XFPM_ERROR_SLEEP_FAILED, "XFPM_ERROR_SLEEP_FAILED", "SleepFailed" },
{ 0, NULL, NULL }
};
diff --git a/src/xfpm-errors.h b/src/xfpm-errors.h
index 9f990ec..c7ec90d 100644
--- a/src/xfpm-errors.h
+++ b/src/xfpm-errors.h
@@ -36,7 +36,6 @@ typedef enum
XFPM_ERROR_NO_HARDWARE_SUPPORT,
XFPM_ERROR_COOKIE_NOT_FOUND,
XFPM_ERROR_INVALID_ARGUMENTS,
- XFPM_ERROR_HAL_DISCONNECTED,
XFPM_ERROR_SLEEP_FAILED
} XfpmError;
diff --git a/src/xfpm-main.c b/src/xfpm-main.c
index 6ae06a1..809aa14 100644
--- a/src/xfpm-main.c
+++ b/src/xfpm-main.c
@@ -109,11 +109,6 @@ xfpm_dump (GHashTable *hash)
g_print ("---------------------------------------------------\n");
g_print (" Xfce power manager version %s\n", VERSION);
-#ifdef WITH_HAL
- g_print (_("With HAL support\n"));
-#else
- g_print (_("Without HAL support\n"));
-#endif
#ifdef ENABLE_POLKIT
g_print (_("With policykit support\n"));
#else
More information about the Xfce4-commits
mailing list