[Spice-devel] [PATCH spice-gtk 08/10] usbredir: Remove spice_usb_device_manager_get main_context argument
Hans de Goede
hdegoede at redhat.com
Mon Dec 19 03:24:41 PST 2011
Now that we no longer use a GUsbSource this is no longer needed.
Note this is a change to our public API, but that is ok since we have not
yet done an official release with usbredir support.
Signed-off-by: Hans de Goede <hdegoede at redhat.com>
---
gtk/channel-usbredir.c | 6 ++----
gtk/spice-gtk-session.c | 2 +-
gtk/spicy.c | 2 +-
gtk/usb-device-manager.c | 28 +---------------------------
gtk/usb-device-manager.h | 1 -
5 files changed, 5 insertions(+), 34 deletions(-)
diff --git a/gtk/channel-usbredir.c b/gtk/channel-usbredir.c
index e14088a..6896aab 100644
--- a/gtk/channel-usbredir.c
+++ b/gtk/channel-usbredir.c
@@ -206,8 +206,7 @@ static gboolean spice_usbredir_channel_open_device(
if (!spice_usb_device_manager_start_event_listening(
spice_usb_device_manager_get(
- spice_channel_get_session(SPICE_CHANNEL(channel)),
- NULL, NULL),
+ spice_channel_get_session(SPICE_CHANNEL(channel)), NULL),
err)) {
usbredirhost_close(priv->host);
priv->host = NULL;
@@ -359,8 +358,7 @@ void spice_usbredir_channel_disconnect(SpiceUsbredirChannel *channel)
*/
spice_usb_device_manager_stop_event_listening(
spice_usb_device_manager_get(
- spice_channel_get_session(SPICE_CHANNEL(channel)),
- NULL, NULL));
+ spice_channel_get_session(SPICE_CHANNEL(channel)), NULL));
/* This also closes the libusb handle we passed to its _open */
usbredirhost_close(priv->host);
priv->host = NULL;
diff --git a/gtk/spice-gtk-session.c b/gtk/spice-gtk-session.c
index afabe8e..32848fa 100644
--- a/gtk/spice-gtk-session.c
+++ b/gtk/spice-gtk-session.c
@@ -799,7 +799,7 @@ void spice_gtk_session_update_keyboard_focus(SpiceGtkSession *self,
if (s->auto_usbredir_enable && s->keyboard_focus)
auto_connect = TRUE;
- manager = spice_usb_device_manager_get(s->session, NULL, NULL);
+ manager = spice_usb_device_manager_get(s->session, NULL);
if (manager) {
g_object_set(manager, "auto-connect", auto_connect, NULL);
}
diff --git a/gtk/spicy.c b/gtk/spicy.c
index 58a9b5c..e37ce82 100644
--- a/gtk/spicy.c
+++ b/gtk/spicy.c
@@ -1519,7 +1519,7 @@ static spice_connection *connection_new(void)
g_signal_connect(conn->session, "notify::migration-state",
G_CALLBACK(migration_state), conn);
- manager = spice_usb_device_manager_get(conn->session, NULL, NULL);
+ manager = spice_usb_device_manager_get(conn->session, NULL);
if (manager) {
g_signal_connect(manager, "auto-connect-failed",
G_CALLBACK(auto_connect_failed), NULL);
diff --git a/gtk/usb-device-manager.c b/gtk/usb-device-manager.c
index 44ed84d..dc0dddd 100644
--- a/gtk/usb-device-manager.c
+++ b/gtk/usb-device-manager.c
@@ -72,7 +72,6 @@ static void channel_destroy(SpiceSession *session, SpiceChannel *channel,
enum {
PROP_0,
PROP_SESSION,
- PROP_MAIN_CONTEXT,
PROP_AUTO_CONNECT,
};
@@ -86,7 +85,6 @@ enum
struct _SpiceUsbDeviceManagerPrivate {
SpiceSession *session;
- GMainContext *main_context;
gboolean auto_connect;
#ifdef USE_USBREDIR
GUsbContext *context;
@@ -214,11 +212,6 @@ static void spice_usb_device_manager_finalize(GObject *gobject)
}
#endif
- if (priv->main_context) {
- g_main_context_unref(priv->main_context);
- priv->main_context = NULL;
- }
-
g_ptr_array_unref(priv->channels);
g_ptr_array_unref(priv->devices);
@@ -244,9 +237,6 @@ static void spice_usb_device_manager_get_property(GObject *gobject,
case PROP_SESSION:
g_value_set_object(value, priv->session);
break;
- case PROP_MAIN_CONTEXT:
- g_value_set_boxed(value, priv->main_context);
- break;
case PROP_AUTO_CONNECT:
g_value_set_boolean(value, priv->auto_connect);
break;
@@ -268,9 +258,6 @@ static void spice_usb_device_manager_set_property(GObject *gobject,
case PROP_SESSION:
priv->session = g_value_get_object(value);
break;
- case PROP_MAIN_CONTEXT:
- priv->main_context = g_value_dup_boxed(value);
- break;
case PROP_AUTO_CONNECT:
priv->auto_connect = g_value_get_boolean(value);
break;
@@ -305,16 +292,6 @@ static void spice_usb_device_manager_class_init(SpiceUsbDeviceManagerClass *klas
G_PARAM_STATIC_STRINGS));
/**
- * SpiceUsbDeviceManager:main-context:
- */
- pspec = g_param_spec_boxed("main-context", "Main Context",
- "GMainContext to use for the event source",
- G_TYPE_MAIN_CONTEXT,
- G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS);
- g_object_class_install_property(gobject_class, PROP_MAIN_CONTEXT, pspec);
-
- /**
* SpiceUsbDeviceManager:auto-connect:
*/
pspec = g_param_spec_boolean("auto-connect", "Auto Connect",
@@ -557,7 +534,6 @@ static SpiceUsbredirChannel *spice_usb_device_manager_get_channel_for_dev(
/**
* spice_usb_device_manager_get:
* @session: #SpiceSession for which to get the #SpiceUsbDeviceManager
- * @main_context: #GMainContext to use. If %NULL, the default context is used.
*
* Gets the #SpiceUsbDeviceManager associated with the passed in #SpiceSession.
* A new #SpiceUsbDeviceManager instance will be created the first time this
@@ -569,7 +545,6 @@ static SpiceUsbredirChannel *spice_usb_device_manager_get_channel_for_dev(
* Returns: (transfer none): a weak reference to the #SpiceUsbDeviceManager associated with the passed in #SpiceSession
*/
SpiceUsbDeviceManager *spice_usb_device_manager_get(SpiceSession *session,
- GMainContext *main_context,
GError **err)
{
SpiceUsbDeviceManager *self;
@@ -581,8 +556,7 @@ SpiceUsbDeviceManager *spice_usb_device_manager_get(SpiceSession *session,
self = session->priv->usb_manager;
if (self == NULL) {
self = g_initable_new(SPICE_TYPE_USB_DEVICE_MANAGER, NULL, err,
- "session", session,
- "main-context", main_context, NULL);
+ "session", session, NULL);
session->priv->usb_manager = self;
}
g_static_mutex_unlock(&mutex);
diff --git a/gtk/usb-device-manager.h b/gtk/usb-device-manager.h
index 2417674..a8b3969 100644
--- a/gtk/usb-device-manager.h
+++ b/gtk/usb-device-manager.h
@@ -90,7 +90,6 @@ GType spice_usb_device_manager_get_type(void);
gchar *spice_usb_device_get_description(SpiceUsbDevice *device);
SpiceUsbDeviceManager *spice_usb_device_manager_get(SpiceSession *session,
- GMainContext *main_context,
GError **err);
GPtrArray *spice_usb_device_manager_get_devices(SpiceUsbDeviceManager *manager);
--
1.7.7.4
More information about the Spice-devel
mailing list