[virt-tools-list] [PATCH virt-viewer 08/10] Sync preferences widgets with session properties

Fabiano Fidêncio fidencio at redhat.com
Mon Feb 16 07:35:38 UTC 2015


On Sun, 2015-02-15 at 17:18 +0100, Marc-André Lureau wrote:
> ---
>  src/virt-viewer-app.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 44 insertions(+)
> 
> diff --git a/src/virt-viewer-app.c b/src/virt-viewer-app.c
> index 7416d89..4958864 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;
> @@ -2404,6 +2405,19 @@ 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)
>  {
> @@ -2419,6 +2433,36 @@ 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"));
> +
> +    gchar *path;
> +    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);
> +
> +present:
>      gtk_window_set_transient_for(GTK_WINDOW(preferences),
>                                   GTK_WINDOW(parent));
>  

Hmm. Here it is ...





More information about the virt-tools-list mailing list