[gnome-control-center] network: Adapt forget button label according to connection type



commit 3458566f7cc572c1b8ce64434bf6aca8ba3db14b
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Sun May 21 15:40:33 2017 -0300

    network: Adapt forget button label according to connection type
    
    Per the mockup [1], the Forget button has different labels depending
    on the connection type. For example, when editing a VPN connection,
    the Forget button reads "Remove VPN", while when editing a Wi-Fi
    connection reads "Forget Connection".
    
    This patch adapts the forget button label according to the connection
    type.
    
    [1] 
https://raw.githubusercontent.com/gnome-design-team/gnome-mockups/master/system-settings/network/aday2/network-wires.png
    
    https://bugzilla.gnome.org/show_bug.cgi?id=779841

 panels/network/connection-editor/ce-page-details.c |   11 +++++++++++
 panels/network/connection-editor/details-page.ui   |    1 -
 2 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/panels/network/connection-editor/ce-page-details.c 
b/panels/network/connection-editor/ce-page-details.c
index b8505a5..2d85836 100644
--- a/panels/network/connection-editor/ce-page-details.c
+++ b/panels/network/connection-editor/ce-page-details.c
@@ -141,6 +141,7 @@ connect_details_page (CEPageDetails *page)
         NMDeviceState state;
         NMAccessPoint *active_ap;
         const gchar *str;
+        const gchar *type;
         gboolean device_is_active;
 
         if (NM_IS_DEVICE_WIFI (page->device))
@@ -241,6 +242,16 @@ connect_details_page (CEPageDetails *page)
         /* Forget button */
         widget = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder, "button_forget"));
         g_signal_connect (widget, "clicked", G_CALLBACK (forget_cb), page);
+
+        type = nm_setting_connection_get_connection_type (sc);
+        if (g_str_equal (type, NM_SETTING_WIRELESS_SETTING_NAME))
+                gtk_button_set_label (GTK_BUTTON (widget), _("Forget Connection"));
+        else if (g_str_equal (type, NM_SETTING_WIRED_SETTING_NAME))
+                gtk_button_set_label (GTK_BUTTON (widget), _("Remove Connection Profile"));
+        else if (g_str_equal (type, NM_SETTING_VPN_SETTING_NAME))
+                gtk_button_set_label (GTK_BUTTON (widget), _("Remove VPN"));
+        else
+                gtk_widget_hide (widget);
 }
 
 static void
diff --git a/panels/network/connection-editor/details-page.ui 
b/panels/network/connection-editor/details-page.ui
index ed6e3c5..3b1c716 100644
--- a/panels/network/connection-editor/details-page.ui
+++ b/panels/network/connection-editor/details-page.ui
@@ -357,7 +357,6 @@
     </child>
     <child>
       <object class="GtkButton" id="button_forget">
-        <property name="label" translatable="yes">_Forget</property>
         <property name="visible">True</property>
         <property name="can_focus">True</property>
         <property name="use_underline">True</property>


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