[Spice-commits] src/map-file src/spice-glib-sym-file src/spice-gtk-session.c src/spice-session.c src/spice-session.h src/spice-session-priv.h

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Sep 10 11:59:52 UTC 2020


 src/map-file             |    1 -
 src/spice-glib-sym-file  |    1 -
 src/spice-gtk-session.c  |   10 ++++++++--
 src/spice-session-priv.h |    1 +
 src/spice-session.c      |   26 ++++++++++++++++++++++++++
 src/spice-session.h      |    3 ---
 6 files changed, 35 insertions(+), 7 deletions(-)

New commits:
commit 7efeb298e005591756ec90d02041a377dbb3038f
Author: Jakub Janků <jjanku at redhat.com>
Date:   Wed Sep 9 16:55:21 2020 +0200

    Revert 4b9092b9 and add SpiceSession:webdav-server property instead
    
    This reverts commit 4b9092b96b8da946ff3d17922b0fcf225c5dc81f
    "session: make spice_session_get_webdav_server() public".
    
    Instead of publishing the function to access the PhodavServer
    from spice-gtk-session.c, install a new read-only property
    "webdav-server" and use g_object_get() to retrieve it.
    
    Signed-off-by: Jakub Janků <jjanku at redhat.com>
    Acked-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Marc-André Lureau <marcandre.lureau at redhat.com>

diff --git a/src/map-file b/src/map-file
index 86f371d..acdd38f 100644
--- a/src/map-file
+++ b/src/map-file
@@ -144,7 +144,6 @@ spice_session_new;
 spice_session_open_fd;
 spice_session_verify_get_type;
 spice_set_session_option;
-spice_session_get_webdav_server;
 spice_smartcard_channel_get_type;
 spice_smartcard_manager_get;
 spice_smartcard_manager_get_readers;
diff --git a/src/spice-glib-sym-file b/src/spice-glib-sym-file
index effcd09..72e6ef0 100644
--- a/src/spice-glib-sym-file
+++ b/src/spice-glib-sym-file
@@ -123,7 +123,6 @@ spice_session_new
 spice_session_open_fd
 spice_session_verify_get_type
 spice_set_session_option
-spice_session_get_webdav_server
 spice_smartcard_channel_get_type
 spice_smartcard_manager_get
 spice_smartcard_manager_get_readers
diff --git a/src/spice-gtk-session.c b/src/spice-gtk-session.c
index dfbd8fa..72b0168 100644
--- a/src/spice-gtk-session.c
+++ b/src/spice-gtk-session.c
@@ -1135,7 +1135,9 @@ static gchar *strv_uris_transform_to_data(SpiceGtkSessionPrivate *s,
     gchar **uris, gsize *size_out, GdkDragAction action)
 {
     SpiceWebdavChannel *webdav;
-    PhodavServer *phodav;
+    /* if there's version mismatch between spice-client-gtk and spice-client-glib,
+     * "webdav-server" property might not be present, so phodav must be initialized to NULL */
+    PhodavServer *phodav = NULL;
     PhodavVirtualDir *root;
 
     gchar **uri_ptr, *path, **paths, *data;
@@ -1154,8 +1156,12 @@ static gchar *strv_uris_transform_to_data(SpiceGtkSessionPrivate *s,
         return NULL;
     }
 
-    phodav = spice_session_get_webdav_server(s->session);
+    g_object_get(s->session, "webdav-server", &phodav, NULL);
+    if (!phodav) {
+        return NULL;
+    }
     g_object_get(phodav, "root-file", &root, NULL);
+    g_object_unref(phodav);
 
     paths = g_new0(gchar *, g_strv_length(uris) + 2);
 
diff --git a/src/spice-session-priv.h b/src/spice-session-priv.h
index 5b52f8d..b4919a4 100644
--- a/src/spice-session-priv.h
+++ b/src/spice-session-priv.h
@@ -87,6 +87,7 @@ gboolean spice_session_get_smartcard_enabled(SpiceSession *session);
 gboolean spice_session_get_usbredir_enabled(SpiceSession *session);
 gboolean spice_session_get_gl_scanout_enabled(SpiceSession *session);
 
+PhodavServer *spice_session_get_webdav_server(SpiceSession *session);
 guint spice_session_get_n_display_channels(SpiceSession *session);
 gboolean spice_session_set_migration_session(SpiceSession *session, SpiceSession *mig_session);
 SpiceAudio *spice_audio_get(SpiceSession *session, GMainContext *context);
diff --git a/src/spice-session.c b/src/spice-session.c
index 8831bc5..ed38182 100644
--- a/src/spice-session.c
+++ b/src/spice-session.c
@@ -196,6 +196,7 @@ enum {
     PROP_SECURE_CHANNELS,
     PROP_SHARED_DIR,
     PROP_SHARE_DIR_RO,
+    PROP_WEBDAV_SERVER,
     PROP_USERNAME,
     PROP_UNIX_PATH,
     PROP_PREF_COMPRESSION,
@@ -705,6 +706,9 @@ static void spice_session_get_property(GObject    *gobject,
     case PROP_SHARE_DIR_RO:
         g_value_set_boolean(value, s->share_dir_ro);
         break;
+    case PROP_WEBDAV_SERVER:
+        g_value_set_object(value, spice_session_get_webdav_server(session));
+        break;
     case PROP_PREF_COMPRESSION:
         g_value_set_enum(value, s->preferred_compression);
         break;
@@ -1484,6 +1488,27 @@ static void spice_session_class_init(SpiceSessionClass *klass)
                               G_PARAM_CONSTRUCT |
                               G_PARAM_STATIC_STRINGS));
 
+    /**
+     * SpiceSession:webdav-server:
+     *
+     * Phodav server that is internally used by #SpiceSession to make
+     * #SpiceSession:shared-dir available to the host.
+     *
+     * Since: 0.39
+     **/
+    g_object_class_install_property
+        (gobject_class, PROP_WEBDAV_SERVER,
+         g_param_spec_object("webdav-server",
+                             "WebDAV server",
+                             "PhodavServer object used for directory sharing",
+#ifdef USE_PHODAV
+                             PHODAV_TYPE_SERVER,
+#else
+                             G_TYPE_OBJECT,
+#endif
+                             G_PARAM_READABLE |
+                             G_PARAM_STATIC_STRINGS));
+
     /**
      * SpiceSession:preferred-compression:
      *
@@ -2807,6 +2832,7 @@ gboolean spice_session_get_smartcard_enabled(SpiceSession *session)
     return session->priv->smartcard;
 }
 
+G_GNUC_INTERNAL
 PhodavServer* spice_session_get_webdav_server(SpiceSession *session)
 {
     SpiceSessionPrivate *priv;
diff --git a/src/spice-session.h b/src/spice-session.h
index 665d2f3..07c7b14 100644
--- a/src/spice-session.h
+++ b/src/spice-session.h
@@ -38,8 +38,6 @@ G_BEGIN_DECLS
 
 #define SPICE_WEBDAV_CLIPBOARD_FOLDER_PATH "/.spice-clipboard"
 
-typedef struct _PhodavServer PhodavServer;
-
 /**
  * SpiceSessionVerify:
  * @SPICE_SESSION_VERIFY_PUBKEY: verify certificate public key matching
@@ -117,7 +115,6 @@ gboolean spice_session_has_channel_type(SpiceSession *session, gint type);
 gboolean spice_session_get_read_only(SpiceSession *session);
 SpiceURI *spice_session_get_proxy_uri(SpiceSession *session);
 gboolean spice_session_is_for_migration(SpiceSession *session);
-PhodavServer *spice_session_get_webdav_server(SpiceSession *session);
 
 G_END_DECLS
 


More information about the Spice-commits mailing list