summaryrefslogtreecommitdiff
path: root/src/virt-viewer-app.c
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@gmail.com>2015-02-15 17:05:00 +0100
committerMarc-André Lureau <marcandre.lureau@gmail.com>2015-03-05 21:31:31 +0100
commit7254b0256a06c564b7f3136fd919afd30408484c (patch)
treec0ad90789257eac6f94686f178fd4a4bbf324058 /src/virt-viewer-app.c
parent31b23e7f0a5d497d40f8af79634008bc115a4d48 (diff)
Sync preferences widgets with session properties
Diffstat (limited to 'src/virt-viewer-app.c')
-rw-r--r--src/virt-viewer-app.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/virt-viewer-app.c b/src/virt-viewer-app.c
index 0b11aa1..7a9da52 100644
--- a/src/virt-viewer-app.c
+++ b/src/virt-viewer-app.c
@@ -113,6 +113,7 @@ struct _VirtViewerAppPrivate {
GHashTable *initial_display_map;
gchar *clipboard;
GtkWidget *preferences;
+ GtkFileChooser *preferences_shared_folder;
gboolean direct;
gboolean verbose;
gboolean enable_accel;
@@ -2405,12 +2406,26 @@ virt_viewer_app_get_windows(VirtViewerApp *self)
return self->priv->windows;
}
+static void
+share_folder_changed(VirtViewerApp *self)
+{
+ gchar *folder;
+
+ folder = gtk_file_chooser_get_filename(self->priv->preferences_shared_folder);
+
+ g_object_set(virt_viewer_app_get_session(self),
+ "shared-folder", folder, NULL);
+
+ g_free(folder);
+}
+
void
virt_viewer_app_show_preferences(VirtViewerApp *self, GtkWidget *parent)
{
GtkWidget *preferences = self->priv->preferences;
if (!preferences) {
+ gchar *path;
GtkBuilder *builder = virt_viewer_util_load_ui("virt-viewer-preferences.xml");
gtk_builder_connect_signals(builder, self);
@@ -2418,6 +2433,32 @@ virt_viewer_app_show_preferences(VirtViewerApp *self, GtkWidget *parent)
preferences = GTK_WIDGET(gtk_builder_get_object(builder, "preferences"));
self->priv->preferences = preferences;
+ g_object_bind_property(virt_viewer_app_get_session(self),
+ "share-folder",
+ gtk_builder_get_object(builder, "cbsharefolder"),
+ "active",
+ G_BINDING_BIDIRECTIONAL|G_BINDING_SYNC_CREATE);
+
+ g_object_bind_property(virt_viewer_app_get_session(self),
+ "share-folder-ro",
+ gtk_builder_get_object(builder, "cbsharefolderro"),
+ "active",
+ G_BINDING_BIDIRECTIONAL|G_BINDING_SYNC_CREATE);
+
+ self->priv->preferences_shared_folder =
+ GTK_FILE_CHOOSER(gtk_builder_get_object(builder, "fcsharefolder"));
+
+ g_object_get(virt_viewer_app_get_session(self),
+ "shared-folder", &path, NULL);
+
+ gtk_file_chooser_set_filename(self->priv->preferences_shared_folder, path);
+ g_free(path);
+
+ virt_viewer_signal_connect_object(self->priv->preferences_shared_folder,
+ "file-set",
+ G_CALLBACK(share_folder_changed), self,
+ G_CONNECT_SWAPPED);
+
g_object_unref(builder);
}