[virt-tools-list] [virt-viewer][PATCH 3/3 v2] virt-viewer-app: Added reconnect button to preferences

Lukas Venhoda lvenhoda at redhat.com
Tue May 12 15:10:43 UTC 2015


Added a new preferences tab, and a reconnect CheckButton into
virt-viewer-preferences.xml. They are implicitly set to hidden.

If compiling virt-viewer, USING_VIRT_VIEWER is defined and their
visibility is set to true in virt_viewer_app_get_preferences().
---
Changes since v1:
 - Added a new preferences tab "General"
 - Moved the reconnect button into preferences under General tab.
 - Moved all of visibility and binding code into virt-viewer-app.
---
 src/virt-viewer-app.c           | 11 ++++++++
 src/virt-viewer-preferences.xml | 59 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 70 insertions(+)

diff --git a/src/virt-viewer-app.c b/src/virt-viewer-app.c
index e212831..08d3df7 100644
--- a/src/virt-viewer-app.c
+++ b/src/virt-viewer-app.c
@@ -2511,6 +2511,17 @@ virt_viewer_app_get_preferences(VirtViewerApp *self)
     preferences = GTK_WIDGET(gtk_builder_get_object(builder, "preferences"));
     self->priv->preferences = preferences;

+    #ifdef USING_VIRT_VIEWER
+        g_object_set (gtk_builder_get_object(builder, "cbreconnect"), "visible", TRUE, NULL);
+        g_object_set (gtk_builder_get_object(builder, "preferences-general-vbox"), "visible", TRUE, NULL);
+
+        g_object_bind_property(self,
+                               "reconnect",
+                               gtk_builder_get_object(builder, "cbreconnect"),
+                               "active",
+                               G_BINDING_BIDIRECTIONAL|G_BINDING_SYNC_CREATE);
+    #endif
+
     g_object_set (gtk_builder_get_object(builder, "cbsharefolder"),
                   "sensitive", can_share_folder, NULL);
     g_object_set (gtk_builder_get_object(builder, "cbsharefolderro"),
diff --git a/src/virt-viewer-preferences.xml b/src/virt-viewer-preferences.xml
index f9738c5..9e6d088 100644
--- a/src/virt-viewer-preferences.xml
+++ b/src/virt-viewer-preferences.xml
@@ -121,6 +121,65 @@
                 <property name="tab_fill">False</property>
               </packing>
             </child>
+            <child>
+              <object class="GtkVBox" id="preferences-general-vbox">
+                <property name="visible">False</property>
+                <property name="can_focus">False</property>
+                <property name="border_width">18</property>
+                <property name="spacing">6</property>
+                <child>
+                  <object class="GtkLabel" id="label4">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="xalign">0</property>
+                    <property name="label" translatable="yes">Connection</property>
+                    <attributes>
+                      <attribute name="weight" value="bold"/>
+                    </attributes>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkTable" id="table2">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="border_width">6</property>
+                    <property name="n_rows">2</property>
+                    <property name="n_columns">2</property>
+                    <property name="column_spacing">12</property>
+                    <property name="row_spacing">6</property>
+                    <child>
+                      <object class="GtkCheckButton" id="cbreconnect">
+                        <property name="label" translatable="yes">Reconnect</property>
+                        <property name="visible">False</property>
+                        <property name="can_focus">False</property>
+                        <property name="receives_default">False</property>
+                        <property name="draw_indicator">True</property>
+                      </object>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+              </object>
+            </child>
+            <child type="tab">
+              <object class="GtkLabel" id="label3">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes">General</property>
+              </object>
+              <packing>
+                <property name="tab_fill">False</property>
+              </packing>
+            </child>
           </object>
           <packing>
             <property name="expand">True</property>
--
2.4.0




More information about the virt-tools-list mailing list