summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2014-11-25 12:02:06 +0100
committerMarc-André Lureau <marcandre.lureau@redhat.com>2014-12-01 17:29:56 +0100
commite0514dc3f8ebcdd2d97bcc5e561a391a0deae61f (patch)
tree745c07be9b2dec7ac156e8e1fc74517c8d71259f
parente02733abe9b43b6b84da1e240bf037a656ab98c3 (diff)
gtk: do not require glib session private fields
Use GObject object association for session helpers. GtkSession and DesktopIntegration are in the gtk library SpiceSession is in glib one. So far we had the SessionPriv structure shared between the two libraries, so they could fit their pointers there. But this is no longer possible when moving the private structure in .c. We could add more accessors, but they would need to be in public API, and this isn't supposed to be accessed by API users.
-rw-r--r--gtk/desktop-integration.c7
-rw-r--r--gtk/spice-gtk-session.c4
-rw-r--r--gtk/spice-session-priv.h2
-rw-r--r--gtk/spice-session.c2
4 files changed, 4 insertions, 11 deletions
diff --git a/gtk/desktop-integration.c b/gtk/desktop-integration.c
index 145fa6a..c366fd0 100644
--- a/gtk/desktop-integration.c
+++ b/gtk/desktop-integration.c
@@ -187,9 +187,6 @@ static void spice_desktop_integration_class_init(SpiceDesktopIntegrationClass *k
g_type_class_add_private(klass, sizeof(SpiceDesktopIntegrationPrivate));
}
-/* ------------------------------------------------------------------ */
-/* public methods */
-
SpiceDesktopIntegration *spice_desktop_integration_get(SpiceSession *session)
{
SpiceDesktopIntegration *self;
@@ -198,10 +195,10 @@ SpiceDesktopIntegration *spice_desktop_integration_get(SpiceSession *session)
g_return_val_if_fail(session != NULL, NULL);
g_static_mutex_lock(&mutex);
- self = session->priv->desktop_integration;
+ self = g_object_get_data(G_OBJECT(session), "spice-desktop");
if (self == NULL) {
self = g_object_new(SPICE_TYPE_DESKTOP_INTEGRATION, NULL);
- session->priv->desktop_integration = self;
+ g_object_set_data_full(G_OBJECT(session), "spice-desktop", self, g_object_unref);
}
g_static_mutex_unlock(&mutex);
diff --git a/gtk/spice-gtk-session.c b/gtk/spice-gtk-session.c
index 701950d..de01358 100644
--- a/gtk/spice-gtk-session.c
+++ b/gtk/spice-gtk-session.c
@@ -1119,10 +1119,10 @@ SpiceGtkSession *spice_gtk_session_get(SpiceSession *session)
static GStaticMutex mutex = G_STATIC_MUTEX_INIT;
g_static_mutex_lock(&mutex);
- self = session->priv->gtk_session;
+ self = g_object_get_data(G_OBJECT(session), "spice-gtk-session");
if (self == NULL) {
self = g_object_new(SPICE_TYPE_GTK_SESSION, "session", session, NULL);
- session->priv->gtk_session = self;
+ g_object_set_data_full(G_OBJECT(session), "spice-gtk-session", self, g_object_unref);
}
g_static_mutex_unlock(&mutex);
diff --git a/gtk/spice-session-priv.h b/gtk/spice-session-priv.h
index 98c3f72..c9efba3 100644
--- a/gtk/spice-session-priv.h
+++ b/gtk/spice-session-priv.h
@@ -115,8 +115,6 @@ struct _SpiceSessionPrivate {
/* associated objects */
SpiceAudio *audio_manager;
- SpiceDesktopIntegration *desktop_integration;
- SpiceGtkSession *gtk_session;
SpiceUsbDeviceManager *usb_manager;
SpicePlaybackChannel *playback_channel;
PhodavServer *webdav;
diff --git a/gtk/spice-session.c b/gtk/spice-session.c
index 02ebd74..5ddcd5c 100644
--- a/gtk/spice-session.c
+++ b/gtk/spice-session.c
@@ -186,8 +186,6 @@ spice_session_dispose(GObject *gobject)
g_warn_if_fail(s->after_main_init == 0);
g_clear_object(&s->audio_manager);
- g_clear_object(&s->desktop_integration);
- g_clear_object(&s->gtk_session);
g_clear_object(&s->usb_manager);
g_clear_object(&s->proxy);
g_clear_object(&s->webdav);