[gnome-control-center/wip/gbsneto/wifi-dialog: 3/3] network: Make the history dialog use a headerbar



commit e129f71c20cf8932c9ec9de886de221bc6199987
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Fri Mar 3 21:10:36 2017 -0300

    network: Make the history dialog use a headerbar
    
    In order to start moving towards the new redesigned Network
    panel [1], it is necessary to make the dialogs use a headerbar.
    
    Currently, however, they don't, making the dialog sinconsistent
    with the rest of the panels, and the GNOME desktop as a whole.
    
    Fix that by setting the headerbar to the History dialog.
    
    [1] 
https://github.com/gnome-design-team/gnome-mockups/blob/master/system-settings/network/aday2/network-wires.png
    
    https://bugzilla.gnome.org/show_bug.cgi?id=779841

 panels/network/net-device-wifi.c |   17 +++++++----------
 1 files changed, 7 insertions(+), 10 deletions(-)
---
diff --git a/panels/network/net-device-wifi.c b/panels/network/net-device-wifi.c
index 948f388..50e05d3 100644
--- a/panels/network/net-device-wifi.c
+++ b/panels/network/net-device-wifi.c
@@ -1886,7 +1886,7 @@ open_history (NetDeviceWifi *device_wifi)
         GtkSizeGroup *rows;
         GtkSizeGroup *icons;
 
-        dialog = gtk_dialog_new ();
+        dialog = g_object_new (GTK_TYPE_DIALOG, "use-header-bar", 1, NULL);
         panel = net_object_get_panel (NET_OBJECT (device_wifi));
         window = gtk_widget_get_toplevel (GTK_WIDGET (panel));
         gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (window));
@@ -1894,23 +1894,20 @@ open_history (NetDeviceWifi *device_wifi)
         gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
         gtk_window_set_default_size (GTK_WINDOW (dialog), 600, 400);
 
-        button = gtk_button_new_with_mnemonic (_("_Close"));
-        gtk_widget_set_can_default (button, TRUE);
-        gtk_widget_show (button);
-        gtk_dialog_add_action_widget (GTK_DIALOG (dialog), button, 0);
-        g_signal_connect_swapped (button, "clicked",
-                                  G_CALLBACK (gtk_widget_destroy), dialog);
-
         /* translators: This is the label for the "Forget wireless network" functionality */
         forget = gtk_button_new_with_mnemonic (C_("Wi-Fi Network", "_Forget"));
         gtk_widget_show (forget);
         gtk_widget_set_sensitive (forget, FALSE);
-        gtk_dialog_add_action_widget (GTK_DIALOG (dialog), forget, 0);
+
+        /* GTK_RESPONSE_HELP is needed to move the button to the start of the headerbar
+         * without hiding the close button. */
+        gtk_dialog_add_action_widget (GTK_DIALOG (dialog), forget, GTK_RESPONSE_HELP);
         g_signal_connect (forget, "clicked",
                           G_CALLBACK (forget_selected), device_wifi);
-        gtk_container_child_set (GTK_CONTAINER (gtk_widget_get_parent (forget)), forget, "secondary", TRUE, 
NULL);
         g_object_set_data (G_OBJECT (forget), "net", device_wifi);
 
+        gtk_style_context_add_class (gtk_widget_get_style_context (forget), "destructive-action");
+
         swin = gtk_scrolled_window_new (NULL, NULL);
         gtk_widget_show (swin);
         gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swin), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);


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