[virt-tools-list] [PATCH virt-viewer 07/10] about-dialog: Use GtkHeaderBar

Eduardo Lima (Etrunko) etrunko at redhat.com
Thu Feb 9 19:22:48 UTC 2017


For this one, we use the application version as the subtitle.

Signed-off-by: Eduardo Lima (Etrunko) <etrunko at redhat.com>
---
 src/resources/ui/virt-viewer-about.ui | 20 ++++++++++++++------
 src/virt-viewer-window.c              |  9 ++++++---
 2 files changed, 20 insertions(+), 9 deletions(-)

diff --git a/src/resources/ui/virt-viewer-about.ui b/src/resources/ui/virt-viewer-about.ui
index 28e38c8..a742ba8 100644
--- a/src/resources/ui/virt-viewer-about.ui
+++ b/src/resources/ui/virt-viewer-about.ui
@@ -1,10 +1,10 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.20.0 -->
 <interface>
-  <!-- interface-requires gtk+ 2.12 -->
+  <requires lib="gtk+" version="3.12"/>
   <object class="GtkAboutDialog" id="about">
     <property name="can_focus">False</property>
-    <property name="border_width">5</property>
-    <property name="title" translatable="yes">About Virt-Viewer</property>
+    <property name="border_width">6</property>
     <property name="resizable">False</property>
     <property name="modal">True</property>
     <property name="window_position">center-on-parent</property>
@@ -36,6 +36,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 Marc-André Lureau
 </property>
     <property name="translator_credits" translatable="yes">The Fedora Translation Team</property>
+    <property name="logo_icon_name">image-missing</property>
     <signal name="delete-event" handler="virt_viewer_app_about_delete" swapped="no"/>
     <signal name="response" handler="virt_viewer_app_about_close" swapped="no"/>
     <child internal-child="vbox">
@@ -57,10 +58,17 @@ Marc-André Lureau
             <property name="position">0</property>
           </packing>
         </child>
-        <child>
-          <placeholder/>
-        </child>
       </object>
     </child>
   </object>
+  <object class="GtkHeaderBar" id="headerbar">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="title">About Virtual Machine Viewer</property>
+    <property name="show_close_button">True</property>
+    <property name="decoration_layout">:close</property>
+    <child>
+      <placeholder/>
+    </child>
+  </object>
 </interface>
diff --git a/src/virt-viewer-window.c b/src/virt-viewer-window.c
index c75e75b..f7a7560 100644
--- a/src/virt-viewer-window.c
+++ b/src/virt-viewer-window.c
@@ -1034,14 +1034,17 @@ virt_viewer_window_menu_help_about(GtkWidget *menu G_GNUC_UNUSED,
                                    VirtViewerWindow *self)
 {
     GtkBuilder *about;
-    GtkWidget *dialog;
+    GtkWidget *dialog, *headerbar;
     GdkPixbuf *icon;
+    gchar *version = g_strdup_printf("%s %s %s", _("Version"), VERSION, BUILDID);
 
     about = virt_viewer_util_load_ui("virt-viewer-about.ui");
 
     dialog = GTK_WIDGET(gtk_builder_get_object(about, "about"));
-
-    gtk_about_dialog_set_version(GTK_ABOUT_DIALOG(dialog), VERSION BUILDID);
+    headerbar = GTK_WIDGET(gtk_builder_get_object(about, "headerbar"));
+    gtk_window_set_titlebar(GTK_WINDOW(dialog), headerbar);
+    gtk_header_bar_set_subtitle(GTK_HEADER_BAR(headerbar), version);
+    g_free(version);
 
     icon = gdk_pixbuf_new_from_resource(VIRT_VIEWER_RESOURCE_PREFIX"/icons/48x48/virt-viewer.png", NULL);
     if (icon != NULL) {
-- 
2.9.3




More information about the virt-tools-list mailing list