Bug 592364 - Use GUdev rather than deprecated HAL for GIMP
GIMP was probably the only user of libhal on most systems, this had to stop. Ported the linux-input module to GUdev.
This commit is contained in:
30
configure.ac
30
configure.ac
@ -58,7 +58,7 @@ m4_define([pygtk_required_version], [2.10.4])
|
|||||||
m4_define([poppler_required_version], [0.12.4])
|
m4_define([poppler_required_version], [0.12.4])
|
||||||
m4_define([libcurl_required_version], [7.15.1])
|
m4_define([libcurl_required_version], [7.15.1])
|
||||||
m4_define([dbus_glib_required_version], [0.70])
|
m4_define([dbus_glib_required_version], [0.70])
|
||||||
m4_define([libhal_required_version], [0.5.7])
|
m4_define([libgudev_required_version], [167])
|
||||||
m4_define([exif_required_version], [0.6.15])
|
m4_define([exif_required_version], [0.6.15])
|
||||||
m4_define([lcms_required_version], [1.16])
|
m4_define([lcms_required_version], [1.16])
|
||||||
m4_define([libpng_required_version], [1.2.37])
|
m4_define([libpng_required_version], [1.2.37])
|
||||||
@ -1623,27 +1623,27 @@ if test "x$have_dbus_glib" = xyes; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
###############################################
|
####################
|
||||||
# Check for libhal (Hardware Abstraction Layer)
|
# Check for libgudev
|
||||||
###############################################
|
####################
|
||||||
|
|
||||||
AC_ARG_WITH(hal, [ --without-hal build without HAL support])
|
AC_ARG_WITH(gudev, [ --without-gudev build without GUdev support])
|
||||||
|
|
||||||
have_libhal=no
|
have_libgudev=no
|
||||||
|
|
||||||
if test "x$with_hal" = xno; then
|
if test "x$with_gudev" = xno; then
|
||||||
have_libhal="no (disabled)"
|
have_libgudev="no (disabled)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test "x$have_linux_input" = xyes && test "x$have_dbus_glib" = xyes &&
|
if test "x$have_linux_input" = xyes && test "x$have_dbus_glib" = xyes &&
|
||||||
test "x$with_hal" != xno; then
|
test "x$with_gudev" != xno; then
|
||||||
PKG_CHECK_MODULES(HAL, hal >= libhal_required_version,
|
PKG_CHECK_MODULES(GUDEV, gudev-1.0 >= libgudev_required_version,
|
||||||
have_libhal=yes,
|
have_libgudev=yes,
|
||||||
have_libhal="no (libhal not found)")
|
have_libgudev="no (libgudev not found)")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test "x$have_libhal" = xyes; then
|
if test "x$have_libgudev" = xyes; then
|
||||||
AC_DEFINE(HAVE_LIBHAL, 1, [Define to 1 if libhal is available])
|
AC_DEFINE(HAVE_LIBGUDEV, 1, [Define to 1 if libgudev is available])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
@ -2304,7 +2304,7 @@ Plug-In Features:
|
|||||||
|
|
||||||
Optional Modules:
|
Optional Modules:
|
||||||
ALSA (MIDI Input): $have_alsa
|
ALSA (MIDI Input): $have_alsa
|
||||||
Linux Input: $have_linux_input (HAL support: $have_libhal)
|
Linux Input: $have_linux_input (GUdev support: $have_libgudev)
|
||||||
DirectInput (Win32): $have_dx_dinput
|
DirectInput (Win32): $have_dx_dinput
|
||||||
Color Correction: $have_lcms
|
Color Correction: $have_lcms
|
||||||
Soft Proof: $have_lcms
|
Soft Proof: $have_lcms
|
||||||
|
@ -104,13 +104,13 @@ libdisplay_filter_proof_la_LDFLAGS = -avoid-version -module $(no_undefined)
|
|||||||
libdisplay_filter_proof_la_LIBADD = $(display_filter_libadd) $(LCMS_LIBS)
|
libdisplay_filter_proof_la_LIBADD = $(display_filter_libadd) $(LCMS_LIBS)
|
||||||
|
|
||||||
libcontroller_linux_input_la_SOURCES = \
|
libcontroller_linux_input_la_SOURCES = \
|
||||||
gimpinputdevicestore-hal.c \
|
gimpinputdevicestore-gudev.c \
|
||||||
gimpinputdevicestore.h \
|
gimpinputdevicestore.h \
|
||||||
controller-linux-input.c
|
controller-linux-input.c
|
||||||
libcontroller_linux_input_la_CFLAGS = $(DBUS_GLIB_CFLAGS) $(HAL_CFLAGS)
|
libcontroller_linux_input_la_CFLAGS = $(GUDEV_CFLAGS)
|
||||||
libcontroller_linux_input_la_LDFLAGS = -avoid-version -module $(no_undefined)
|
libcontroller_linux_input_la_LDFLAGS = -avoid-version -module $(no_undefined)
|
||||||
libcontroller_linux_input_la_LIBADD = \
|
libcontroller_linux_input_la_LIBADD = \
|
||||||
$(controller_libadd) $(DBUS_GLIB_LIBS) $(HAL_LIBS)
|
$(controller_libadd) $(GUDEV_LIBS)
|
||||||
|
|
||||||
libcontroller_dx_dinput_la_SOURCES = \
|
libcontroller_dx_dinput_la_SOURCES = \
|
||||||
gimpinputdevicestore-dx.c \
|
gimpinputdevicestore-dx.c \
|
||||||
|
@ -218,7 +218,7 @@ controller_linux_input_class_init (ControllerLinuxInputClass *klass)
|
|||||||
_("The name of the device to read Linux Input events from."),
|
_("The name of the device to read Linux Input events from."),
|
||||||
NULL,
|
NULL,
|
||||||
GIMP_CONFIG_PARAM_FLAGS));
|
GIMP_CONFIG_PARAM_FLAGS));
|
||||||
#ifdef HAVE_LIBHAL
|
#ifdef HAVE_LIBGUDEV
|
||||||
g_object_class_install_property (object_class, PROP_DEVICE_STORE,
|
g_object_class_install_property (object_class, PROP_DEVICE_STORE,
|
||||||
g_param_spec_object ("device-values",
|
g_param_spec_object ("device-values",
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
@ -480,11 +480,11 @@ linux_input_get_device_info (ControllerLinuxInput *controller,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
linux_input_device_changed (ControllerLinuxInput *controller,
|
linux_input_device_changed (ControllerLinuxInput *controller,
|
||||||
const gchar *udi)
|
const gchar *identifier)
|
||||||
{
|
{
|
||||||
if (controller->device && strcmp (udi, controller->device) == 0)
|
if (controller->device && strcmp (identifier, controller->device) == 0)
|
||||||
{
|
{
|
||||||
linux_input_set_device (controller, udi);
|
linux_input_set_device (controller, identifier);
|
||||||
g_object_notify (G_OBJECT (controller), "device");
|
g_object_notify (G_OBJECT (controller), "device");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
/* GIMP - The GNU Image Manipulation Program
|
/* GIMP - The GNU Image Manipulation Program
|
||||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||||
*
|
*
|
||||||
* gimpinputdevicestore-hal.c
|
* gimpinputdevicestore-gudev.c
|
||||||
* Input device store based on HAL, the hardware abstraction layer.
|
* Input device store based on GUdev, the hardware abstraction layer.
|
||||||
* Copyright (C) 2007 Sven Neumann <sven@gimp.org>
|
* Copyright (C) 2007 Sven Neumann <sven@gimp.org>
|
||||||
|
* 2011 Michael Natterer <mitch@gimp.org>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -30,16 +31,15 @@
|
|||||||
#include "libgimpmodule/gimpmodule.h"
|
#include "libgimpmodule/gimpmodule.h"
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_LIBHAL
|
#ifdef HAVE_LIBGUDEV
|
||||||
|
|
||||||
#include <dbus/dbus-glib.h>
|
#include <gudev/gudev.h>
|
||||||
#include <dbus/dbus-glib-lowlevel.h>
|
|
||||||
#include <hal/libhal.h>
|
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
COLUMN_UDI,
|
COLUMN_IDENTIFIER,
|
||||||
COLUMN_LABEL,
|
COLUMN_LABEL,
|
||||||
|
COLUMN_DEVICE_FILE,
|
||||||
NUM_COLUMNS
|
NUM_COLUMNS
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ struct _GimpInputDeviceStore
|
|||||||
{
|
{
|
||||||
GtkListStore parent_instance;
|
GtkListStore parent_instance;
|
||||||
|
|
||||||
LibHalContext *context;
|
GUdevClient *client;
|
||||||
GError *error;
|
GError *error;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -72,23 +72,23 @@ struct _GimpInputDeviceStoreClass
|
|||||||
GtkListStoreClass parent_class;
|
GtkListStoreClass parent_class;
|
||||||
|
|
||||||
void (* device_added) (GimpInputDeviceStore *store,
|
void (* device_added) (GimpInputDeviceStore *store,
|
||||||
const gchar *udi);
|
const gchar *identifier);
|
||||||
void (* device_removed) (GimpInputDeviceStore *store,
|
void (* device_removed) (GimpInputDeviceStore *store,
|
||||||
const gchar *udi);
|
const gchar *identifier);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static void gimp_input_device_store_finalize (GObject *object);
|
static void gimp_input_device_store_finalize (GObject *object);
|
||||||
|
|
||||||
static gboolean gimp_input_device_store_add (GimpInputDeviceStore *store,
|
static gboolean gimp_input_device_store_add (GimpInputDeviceStore *store,
|
||||||
const gchar *udi);
|
GUdevDevice *device);
|
||||||
static gboolean gimp_input_device_store_remove (GimpInputDeviceStore *store,
|
static gboolean gimp_input_device_store_remove (GimpInputDeviceStore *store,
|
||||||
const gchar *udi);
|
GUdevDevice *device);
|
||||||
|
|
||||||
static void gimp_input_device_store_device_added (LibHalContext *ctx,
|
static void gimp_input_device_store_uevent (GUdevClient *client,
|
||||||
const char *udi);
|
const gchar *action,
|
||||||
static void gimp_input_device_store_device_removed (LibHalContext *ctx,
|
GUdevDevice *device,
|
||||||
const char *udi);
|
GimpInputDeviceStore *store);
|
||||||
|
|
||||||
|
|
||||||
G_DEFINE_DYNAMIC_TYPE (GimpInputDeviceStore, gimp_input_device_store,
|
G_DEFINE_DYNAMIC_TYPE (GimpInputDeviceStore, gimp_input_device_store,
|
||||||
@ -140,63 +140,31 @@ gimp_input_device_store_class_finalize (GimpInputDeviceStoreClass *klass)
|
|||||||
static void
|
static void
|
||||||
gimp_input_device_store_init (GimpInputDeviceStore *store)
|
gimp_input_device_store_init (GimpInputDeviceStore *store)
|
||||||
{
|
{
|
||||||
GType types[] = { G_TYPE_STRING, G_TYPE_STRING };
|
GType types[] = { G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING };
|
||||||
DBusGConnection *connection;
|
const gchar *subsystems[] = { "input", NULL };
|
||||||
DBusError dbus_error;
|
GList *devices;
|
||||||
|
GList *list;
|
||||||
|
|
||||||
gtk_list_store_set_column_types (GTK_LIST_STORE (store),
|
gtk_list_store_set_column_types (GTK_LIST_STORE (store),
|
||||||
G_N_ELEMENTS (types), types);
|
G_N_ELEMENTS (types), types);
|
||||||
|
|
||||||
connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, &store->error);
|
store->client = g_udev_client_new (subsystems);
|
||||||
|
|
||||||
if (! connection)
|
devices = g_udev_client_query_by_subsystem (store->client, "input");
|
||||||
return;
|
|
||||||
|
|
||||||
store->context = libhal_ctx_new ();
|
for (list = devices; list; list = g_list_next (list))
|
||||||
|
|
||||||
libhal_ctx_set_dbus_connection (store->context,
|
|
||||||
dbus_g_connection_get_connection (connection));
|
|
||||||
dbus_g_connection_unref (connection);
|
|
||||||
|
|
||||||
dbus_error_init (&dbus_error);
|
|
||||||
|
|
||||||
if (libhal_ctx_init (store->context, &dbus_error))
|
|
||||||
{
|
{
|
||||||
char **devices;
|
GUdevDevice *device = list->data;
|
||||||
int i, num_devices;
|
|
||||||
|
|
||||||
devices = libhal_find_device_by_capability (store->context, "input",
|
gimp_input_device_store_add (store, device);
|
||||||
&num_devices, NULL);
|
g_object_unref (device);
|
||||||
|
|
||||||
for (i = 0; i < num_devices; i++)
|
|
||||||
gimp_input_device_store_add (store, devices[i]);
|
|
||||||
|
|
||||||
libhal_free_string_array (devices);
|
|
||||||
|
|
||||||
libhal_ctx_set_user_data (store->context, store);
|
|
||||||
|
|
||||||
libhal_ctx_set_device_added (store->context,
|
|
||||||
gimp_input_device_store_device_added);
|
|
||||||
libhal_ctx_set_device_removed (store->context,
|
|
||||||
gimp_input_device_store_device_removed);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (dbus_error_is_set (&dbus_error))
|
|
||||||
{
|
|
||||||
dbus_set_g_error (&store->error, &dbus_error);
|
|
||||||
dbus_error_free (&dbus_error);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
g_set_error_literal (&store->error,
|
|
||||||
GIMP_MODULE_ERROR, GIMP_MODULE_FAILED,
|
|
||||||
"Unable to connect to hald");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
libhal_ctx_free (store->context);
|
g_list_free (devices);
|
||||||
store->context = NULL;
|
|
||||||
}
|
g_signal_connect (store->client, "uevent",
|
||||||
|
G_CALLBACK (gimp_input_device_store_uevent),
|
||||||
|
store);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -204,11 +172,10 @@ gimp_input_device_store_finalize (GObject *object)
|
|||||||
{
|
{
|
||||||
GimpInputDeviceStore *store = GIMP_INPUT_DEVICE_STORE (object);
|
GimpInputDeviceStore *store = GIMP_INPUT_DEVICE_STORE (object);
|
||||||
|
|
||||||
if (store->context)
|
if (store->client)
|
||||||
{
|
{
|
||||||
libhal_ctx_shutdown (store->context, NULL);
|
g_object_unref (store->client);
|
||||||
libhal_ctx_free (store->context);
|
store->client = NULL;
|
||||||
store->context = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (store->error)
|
if (store->error)
|
||||||
@ -222,7 +189,7 @@ gimp_input_device_store_finalize (GObject *object)
|
|||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gimp_input_device_store_lookup (GimpInputDeviceStore *store,
|
gimp_input_device_store_lookup (GimpInputDeviceStore *store,
|
||||||
const gchar *udi,
|
const gchar *identifier,
|
||||||
GtkTreeIter *iter)
|
GtkTreeIter *iter)
|
||||||
{
|
{
|
||||||
GtkTreeModel *model = GTK_TREE_MODEL (store);
|
GtkTreeModel *model = GTK_TREE_MODEL (store);
|
||||||
@ -235,11 +202,11 @@ gimp_input_device_store_lookup (GimpInputDeviceStore *store,
|
|||||||
{
|
{
|
||||||
const gchar *str;
|
const gchar *str;
|
||||||
|
|
||||||
gtk_tree_model_get_value (model, iter, COLUMN_UDI, &value);
|
gtk_tree_model_get_value (model, iter, COLUMN_IDENTIFIER, &value);
|
||||||
|
|
||||||
str = g_value_get_string (&value);
|
str = g_value_get_string (&value);
|
||||||
|
|
||||||
if (strcmp (str, udi) == 0)
|
if (strcmp (str, identifier) == 0)
|
||||||
{
|
{
|
||||||
g_value_unset (&value);
|
g_value_unset (&value);
|
||||||
break;
|
break;
|
||||||
@ -254,8 +221,9 @@ gimp_input_device_store_lookup (GimpInputDeviceStore *store,
|
|||||||
/* insert in alphabetic order */
|
/* insert in alphabetic order */
|
||||||
static void
|
static void
|
||||||
gimp_input_device_store_insert (GimpInputDeviceStore *store,
|
gimp_input_device_store_insert (GimpInputDeviceStore *store,
|
||||||
const gchar *udi,
|
const gchar *identifier,
|
||||||
const gchar *label)
|
const gchar *label,
|
||||||
|
const gchar *device_file)
|
||||||
{
|
{
|
||||||
GtkTreeModel *model = GTK_TREE_MODEL (store);
|
GtkTreeModel *model = GTK_TREE_MODEL (store);
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
@ -283,72 +251,90 @@ gimp_input_device_store_insert (GimpInputDeviceStore *store,
|
|||||||
}
|
}
|
||||||
|
|
||||||
gtk_list_store_insert_with_values (GTK_LIST_STORE (store), &iter, pos,
|
gtk_list_store_insert_with_values (GTK_LIST_STORE (store), &iter, pos,
|
||||||
COLUMN_UDI, udi,
|
COLUMN_IDENTIFIER, identifier,
|
||||||
COLUMN_LABEL, label,
|
COLUMN_LABEL, label,
|
||||||
|
COLUMN_DEVICE_FILE, device_file,
|
||||||
-1);
|
-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gimp_input_device_store_add (GimpInputDeviceStore *store,
|
gimp_input_device_store_add (GimpInputDeviceStore *store,
|
||||||
const gchar *udi)
|
GUdevDevice *device)
|
||||||
{
|
{
|
||||||
gboolean added = FALSE;
|
const gchar *device_file = g_udev_device_get_device_file (device);
|
||||||
char **caps;
|
#if 0
|
||||||
gint i;
|
const gchar *path = g_udev_device_get_sysfs_path (device);
|
||||||
|
#endif
|
||||||
|
const gchar *name = g_udev_device_get_sysfs_attr (device, "name");
|
||||||
|
|
||||||
caps = libhal_device_get_property_strlist (store->context,
|
#if 0
|
||||||
udi, "info.capabilities",
|
g_printerr ("\ndevice added: %s, %s, %s\n",
|
||||||
NULL);
|
name ? name : "NULL",
|
||||||
|
device_file ? device_file : "NULL",
|
||||||
|
path);
|
||||||
|
#endif
|
||||||
|
|
||||||
for (i = 0; caps && caps[i] && !added; i++)
|
if (device_file)
|
||||||
{
|
{
|
||||||
char *str;
|
if (name)
|
||||||
|
|
||||||
if (strcmp (caps[i], "input") != 0)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
/* skip "PC Speaker" (why is this an input device at all?) */
|
|
||||||
str = libhal_device_get_property_string (store->context,
|
|
||||||
udi, "input.physical_device",
|
|
||||||
NULL);
|
|
||||||
if (str)
|
|
||||||
{
|
{
|
||||||
gboolean speaker =
|
GtkTreeIter unused;
|
||||||
strcmp (str, "/org/freedesktop/Hal/devices/platform_pcspkr") == 0;
|
|
||||||
|
|
||||||
libhal_free_string (str);
|
if (! gimp_input_device_store_lookup (store, name, &unused))
|
||||||
|
{
|
||||||
|
gimp_input_device_store_insert (store, name, name, device_file);
|
||||||
|
|
||||||
if (speaker)
|
g_signal_emit (store, store_signals[DEVICE_ADDED], 0,
|
||||||
continue;
|
name);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
str = libhal_device_get_property_string (store->context,
|
else
|
||||||
udi, "input.product",
|
|
||||||
NULL);
|
|
||||||
if (str)
|
|
||||||
{
|
{
|
||||||
gimp_input_device_store_insert (store, udi, str);
|
GUdevDevice *parent = g_udev_device_get_parent (device);
|
||||||
|
const gchar *parent_name;
|
||||||
|
|
||||||
libhal_free_string (str);
|
parent_name = g_udev_device_get_sysfs_attr (parent, "name");
|
||||||
|
|
||||||
added = TRUE;
|
if (parent_name)
|
||||||
|
{
|
||||||
|
GtkTreeIter unused;
|
||||||
|
|
||||||
|
if (! gimp_input_device_store_lookup (store, parent_name, &unused))
|
||||||
|
{
|
||||||
|
gimp_input_device_store_insert (store, parent_name, parent_name,
|
||||||
|
device_file);
|
||||||
|
|
||||||
|
g_signal_emit (store, store_signals[DEVICE_ADDED], 0,
|
||||||
|
parent_name);
|
||||||
|
|
||||||
|
g_object_unref (parent);
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
libhal_free_string_array (caps);
|
g_object_unref (parent);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return added;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gimp_input_device_store_remove (GimpInputDeviceStore *store,
|
gimp_input_device_store_remove (GimpInputDeviceStore *store,
|
||||||
const gchar *udi)
|
GUdevDevice *device)
|
||||||
{
|
{
|
||||||
|
const gchar *name = g_udev_device_get_sysfs_attr (device, "name");
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
|
|
||||||
if (gimp_input_device_store_lookup (store, udi, &iter))
|
if (gimp_input_device_store_lookup (store, name, &iter))
|
||||||
{
|
{
|
||||||
gtk_list_store_remove (GTK_LIST_STORE (store), &iter);
|
gtk_list_store_remove (GTK_LIST_STORE (store), &iter);
|
||||||
|
|
||||||
|
g_signal_emit (store, store_signals[DEVICE_REMOVED], 0, name);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -356,26 +342,18 @@ gimp_input_device_store_remove (GimpInputDeviceStore *store,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gimp_input_device_store_device_added (LibHalContext *ctx,
|
gimp_input_device_store_uevent (GUdevClient *client,
|
||||||
const char *udi)
|
const gchar *action,
|
||||||
|
GUdevDevice *device,
|
||||||
|
GimpInputDeviceStore *store)
|
||||||
{
|
{
|
||||||
GimpInputDeviceStore *store = libhal_ctx_get_user_data (ctx);
|
if (! strcmp (action, "add"))
|
||||||
|
|
||||||
if (gimp_input_device_store_add (store, udi))
|
|
||||||
{
|
{
|
||||||
g_signal_emit (store, store_signals[DEVICE_ADDED], 0, udi);
|
gimp_input_device_store_add (store, device);
|
||||||
}
|
}
|
||||||
}
|
else if (! strcmp (action, "remove"))
|
||||||
|
|
||||||
static void
|
|
||||||
gimp_input_device_store_device_removed (LibHalContext *ctx,
|
|
||||||
const char *udi)
|
|
||||||
{
|
|
||||||
GimpInputDeviceStore *store = libhal_ctx_get_user_data (ctx);
|
|
||||||
|
|
||||||
if (gimp_input_device_store_remove (store, udi))
|
|
||||||
{
|
{
|
||||||
g_signal_emit (store, store_signals[DEVICE_REMOVED], 0, udi);
|
gimp_input_device_store_remove (store, device);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -387,30 +365,26 @@ gimp_input_device_store_new (void)
|
|||||||
|
|
||||||
gchar *
|
gchar *
|
||||||
gimp_input_device_store_get_device_file (GimpInputDeviceStore *store,
|
gimp_input_device_store_get_device_file (GimpInputDeviceStore *store,
|
||||||
const gchar *udi)
|
const gchar *identifier)
|
||||||
{
|
{
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
|
|
||||||
g_return_val_if_fail (GIMP_IS_INPUT_DEVICE_STORE (store), NULL);
|
g_return_val_if_fail (GIMP_IS_INPUT_DEVICE_STORE (store), NULL);
|
||||||
g_return_val_if_fail (udi != NULL, NULL);
|
g_return_val_if_fail (identifier != NULL, NULL);
|
||||||
|
|
||||||
if (! store->context)
|
if (! store->client)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (gimp_input_device_store_lookup (store, udi, &iter))
|
if (gimp_input_device_store_lookup (store, identifier, &iter))
|
||||||
{
|
{
|
||||||
char *str = libhal_device_get_property_string (store->context,
|
GtkTreeModel *model = GTK_TREE_MODEL (store);
|
||||||
udi, "input.device",
|
gchar *device_file;
|
||||||
NULL);
|
|
||||||
|
|
||||||
if (str)
|
gtk_tree_model_get (model, &iter,
|
||||||
{
|
COLUMN_DEVICE_FILE, &device_file,
|
||||||
gchar *retval = g_strdup (str);
|
-1);
|
||||||
|
|
||||||
libhal_free_string (str);
|
return device_file;
|
||||||
|
|
||||||
return retval;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -424,7 +398,7 @@ gimp_input_device_store_get_error (GimpInputDeviceStore *store)
|
|||||||
return store->error ? g_error_copy (store->error) : NULL;
|
return store->error ? g_error_copy (store->error) : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#else /* HAVE_LIBHAL */
|
#else /* HAVE_LIBGUDEV */
|
||||||
|
|
||||||
void
|
void
|
||||||
gimp_input_device_store_register_types (GTypeModule *module)
|
gimp_input_device_store_register_types (GTypeModule *module)
|
||||||
@ -445,7 +419,7 @@ gimp_input_device_store_new (void)
|
|||||||
|
|
||||||
gchar *
|
gchar *
|
||||||
gimp_input_device_store_get_device_file (GimpInputDeviceStore *store,
|
gimp_input_device_store_get_device_file (GimpInputDeviceStore *store,
|
||||||
const gchar *udi)
|
const gchar *identifier)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -456,4 +430,4 @@ gimp_input_device_store_get_error (GimpInputDeviceStore *store)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* HAVE_LIBHAL */
|
#endif /* HAVE_LIBGUDEV */
|
Reference in New Issue
Block a user