[PATCH virt-viewer 10/10] usb_device_selection: Use GtkHeaderBar

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We could get rid of the auxiliary text and present it as the subtitle of
the dialog, but this is handled by the widget itself. In this case, all
we have to do is to set the "use-headerbar" property, and like other
dialogs, the close button is not necessary anymore.

Signed-off-by: Eduardo Lima (Etrunko) <etrunko@xxxxxxxxxx>
---
 src/virt-viewer-session-spice.c | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/src/virt-viewer-session-spice.c b/src/virt-viewer-session-spice.c
index 9b52ec0..8177bcb 100644
--- a/src/virt-viewer-session-spice.c
+++ b/src/virt-viewer-session-spice.c
@@ -794,16 +794,20 @@ virt_viewer_session_spice_usb_device_selection(VirtViewerSession *session,
 {
     VirtViewerSessionSpice *self = VIRT_VIEWER_SESSION_SPICE(session);
     VirtViewerSessionSpicePrivate *priv = self->priv;
-    GtkWidget *dialog, *area, *usb_device_widget;
+    GtkWidget *dialog, *area, *usb_device_widget, *headerbar;
 
     /* Create the widgets */
-    dialog = gtk_dialog_new_with_buttons(_("Select USB devices for redirection"), parent,
-                                         GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
-                                         _("_Close"), GTK_RESPONSE_ACCEPT,
-                                         NULL);
-    gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT);
-    gtk_container_set_border_width(GTK_CONTAINER(dialog), 12);
-    gtk_box_set_spacing(GTK_BOX(gtk_bin_get_child(GTK_BIN(dialog))), 12);
+    dialog = g_object_new(GTK_TYPE_DIALOG,
+                          "title", _("Select USB devices for redirection"),
+                          "transient-for", parent,
+                          "use-header-bar", TRUE,
+                          "border-width", 12,
+                          "content-area-spacing", 12,
+                          NULL);
+
+    headerbar = gtk_dialog_get_header_bar(GTK_DIALOG(dialog));
+    gtk_header_bar_set_show_close_button(GTK_HEADER_BAR(headerbar), TRUE);
+    gtk_header_bar_set_decoration_layout(GTK_HEADER_BAR(headerbar), ":close");
 
     area = gtk_dialog_get_content_area(GTK_DIALOG(dialog));
 
-- 
2.9.3

_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list



[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux