[virt-tools-list] [virt-viewer][PATCH 3/3] virt-viewer-window: Added reconnect button to GUI

Fabiano Fidêncio fabiano at fidencio.org
Tue May 12 11:33:59 UTC 2015


On Tue, May 12, 2015 at 12:21 PM, Lukas Venhoda <lvenhoda at redhat.com> wrote:
> Added a reconnect CheckMenuItem into virt-viewer.xml.
> This button is implicitly set to hidden.
> If compiling virt-viewer, USING_VIRT_VIEWER is defined and
> visibility of the button is set to true in virt_viewer_window_init.
>




> The reconnect button callback gets the button state (true/false) and set
> the reconnect property of virt-viewer to the button state value.

I'd remove these 2 lines from the commit message.

> ---
> The button is in Menu-File-Reconnect for now, but this can be changed.
> ---
>  src/virt-viewer-window.c | 13 +++++++++++++
>  src/virt-viewer.xml      |  9 +++++++++
>  2 files changed, 22 insertions(+)
>
> diff --git a/src/virt-viewer-window.c b/src/virt-viewer-window.c
> index d67fbc1..629c8f4 100644
> --- a/src/virt-viewer-window.c
> +++ b/src/virt-viewer-window.c
> @@ -56,6 +56,7 @@ void virt_viewer_window_menu_help_guest_details(GtkWidget *menu, VirtViewerWindo
>  void virt_viewer_window_menu_view_fullscreen(GtkWidget *menu, VirtViewerWindow *self);
>  void virt_viewer_window_menu_send(GtkWidget *menu, VirtViewerWindow *self);
>  void virt_viewer_window_menu_file_screenshot(GtkWidget *menu, VirtViewerWindow *self);
> +void virt_viewer_window_menu_file_reconnect(GtkWidget *menu, VirtViewerWindow *self);
>  void virt_viewer_window_menu_file_usb_device_selection(GtkWidget *menu, VirtViewerWindow *self);
>  void virt_viewer_window_menu_file_smartcard_insert(GtkWidget *menu, VirtViewerWindow *self);
>  void virt_viewer_window_menu_file_smartcard_remove(GtkWidget *menu, VirtViewerWindow *self);
> @@ -311,6 +312,10 @@ virt_viewer_window_init (VirtViewerWindow *self)
>      gtk_widget_set_sensitive(GTK_WIDGET(gtk_builder_get_object(self->priv->builder, "menu-file-screenshot")), FALSE);
>      gtk_widget_set_sensitive(GTK_WIDGET(gtk_builder_get_object(self->priv->builder, "menu-preferences")), FALSE);
>
> +#ifdef USING_VIRT_VIEWER
> +    gtk_widget_set_visible(GTK_WIDGET(gtk_builder_get_object(self->priv->builder, "menu-file-reconnect")), TRUE);
> +#endif
> +
>      gtk_builder_connect_signals(priv->builder, self);
>
>      priv->accel_group = GTK_ACCEL_GROUP(gtk_builder_get_object(priv->builder, "accelgroup"));
> @@ -1005,6 +1010,14 @@ virt_viewer_window_menu_file_screenshot(GtkWidget *menu G_GNUC_UNUSED,
>  }
>
>  G_MODULE_EXPORT void
> +virt_viewer_window_menu_file_reconnect(GtkWidget *menu, VirtViewerWindow *self)
> +{
> +    gboolean reconnect = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(menu));
> +
> +    g_object_set(self->priv->app, "reconnect", reconnect, NULL);
> +}
> +
> +G_MODULE_EXPORT void
>  virt_viewer_window_menu_file_usb_device_selection(GtkWidget *menu G_GNUC_UNUSED,
>                                                    VirtViewerWindow *self)
>  {
> diff --git a/src/virt-viewer.xml b/src/virt-viewer.xml
> index 07948bd..ed8bdca 100644
> --- a/src/virt-viewer.xml
> +++ b/src/virt-viewer.xml
> @@ -49,6 +49,15 @@
>                        </object>
>                      </child>
>                      <child>
> +                      <object class="GtkCheckMenuItem" id="menu-file-reconnect">
> +                        <property name="visible">False</property>
> +                        <property name="can_focus">False</property>
> +                        <property name="use_action_appearance">False</property>
> +                        <property name="label" translatable="yes">Reconnect</property>
> +                        <signal name="toggled" handler="virt_viewer_window_menu_file_reconnect" swapped="no"/>
> +                      </object>
> +                    </child>
> +                    <child>
>                        <object class="GtkMenuItem" id="menu-file-smartcard-insert">
>                          <property name="can_focus">False</property>
>                          <property name="use_action_appearance">False</property>
> --
> 2.4.0
>
> _______________________________________________
> virt-tools-list mailing list
> virt-tools-list at redhat.com
> https://www.redhat.com/mailman/listinfo/virt-tools-list

The series in general looks good, but I'd go for the button inside the
"Preferences" menu (if it's possible).

Also, I would like to hear from the other maintainers if they agree
with having it inside the "Preferences" menu.

Best Regards,
-- 
Fabiano Fidêncio




More information about the virt-tools-list mailing list