[gnome-control-center] network: Update the hotspot dialog
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] network: Update the hotspot dialog
- Date: Mon, 22 May 2017 15:28:52 +0000 (UTC)
commit 9cc065bb044c59b26693a6f057ec17c37944cab8
Author: Jonathan Kang <jonathan121537 gmail com>
Date: Tue Apr 4 15:35:27 2017 +0800
network: Update the hotspot dialog
Update the hotspot dialog according to the new redesigned Network
panel[1].
[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 | 62 ++++++++++++++------
panels/network/network-wifi.ui | 118 --------------------------------------
2 files changed, 44 insertions(+), 136 deletions(-)
---
diff --git a/panels/network/net-device-wifi.c b/panels/network/net-device-wifi.c
index 4a11aa2..214a3be 100644
--- a/panels/network/net-device-wifi.c
+++ b/panels/network/net-device-wifi.c
@@ -56,7 +56,6 @@ struct _NetDeviceWifiPrivate
{
GtkBuilder *builder;
GtkWidget *details_dialog;
- GtkWidget *hotspot_dialog;
GtkSwitch *hotspot_switch;
gboolean updating_device;
gchar *selected_ssid_title;
@@ -1212,7 +1211,7 @@ start_hotspot_response_cb (GtkWidget *dialog, gint response, NetDeviceWifi *devi
if (response == GTK_RESPONSE_OK) {
start_shared_connection (device_wifi);
}
- gtk_widget_hide (dialog);
+ gtk_widget_destroy (dialog);
}
static void
@@ -1224,7 +1223,8 @@ start_hotspot (GtkButton *button, NetDeviceWifi *device_wifi)
NMClient *client;
GtkWidget *dialog;
GtkWidget *window;
- GtkWidget *widget;
+ GtkWidget *message_area;
+ GtkWidget *label;
GString *str;
active_ssid = NULL;
@@ -1252,11 +1252,7 @@ start_hotspot (GtkButton *button, NetDeviceWifi *device_wifi)
window = gtk_widget_get_toplevel (GTK_WIDGET (button));
- dialog = device_wifi->priv->hotspot_dialog;
- gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (window));
-
- str = g_string_new (_("If you have a connection to the Internet other than wireless, you can set up
a wireless hotspot to share the connection with others."));
- g_string_append (str, "\n\n");
+ str = g_string_new ("");
if (active_ssid) {
g_string_append_printf (str, _("Switching on the wireless hotspot will disconnect you from
<b>%s</b>."), active_ssid);
@@ -1265,17 +1261,52 @@ start_hotspot (GtkButton *button, NetDeviceWifi *device_wifi)
g_string_append (str, _("It is not possible to access the Internet through your wireless while the
hotspot is active."));
- widget = GTK_WIDGET (gtk_builder_get_object (device_wifi->priv->builder, "hotspot-dialog-content"));
- gtk_label_set_markup (GTK_LABEL (widget), str->str);
- g_string_free (str, TRUE);
+ dialog = gtk_message_dialog_new_with_markup (GTK_WINDOW (window),
+ GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_OTHER,
+ GTK_BUTTONS_NONE,
+ "<big><b>%s</b></big>",
+ _("Turn On Wi-Fi Hotspot?"));
+
+ /* Because we can't control the text alignment with markup, add
+ * the strings as labels directly */
+ message_area = gtk_message_dialog_get_message_area (GTK_MESSAGE_DIALOG (dialog));
+
+ label = g_object_new (GTK_TYPE_LABEL,
+ "use-markup", TRUE,
+ "xalign", 0.5,
+ "max-width-chars", 50,
+ "wrap", TRUE,
+ "label", str->str,
+ "justify", GTK_JUSTIFY_CENTER,
+ "halign", GTK_ALIGN_CENTER,
+ NULL);
+ gtk_container_add (GTK_CONTAINER (message_area), label);
+
+ label = g_object_new (GTK_TYPE_LABEL,
+ "use-markup", TRUE,
+ "xalign", 0.5,
+ "max-width-chars", 50,
+ "wrap", TRUE,
+ "label", _("Wi-Fi hotspots are usually used to share an additional Internet
connection over Wi-Fi."),
+ "justify", GTK_JUSTIFY_CENTER,
+ "halign", GTK_ALIGN_CENTER,
+ NULL);
+ gtk_style_context_add_class (gtk_widget_get_style_context (label), "dim-label");
+ gtk_container_add (GTK_CONTAINER (message_area), label);
+ gtk_widget_show_all (message_area);
+
+ gtk_dialog_add_buttons (GTK_DIALOG (dialog),
+ _("_Cancel"), GTK_RESPONSE_CANCEL,
+ _("_Turn On"), GTK_RESPONSE_OK,
+ NULL);
g_signal_connect (dialog, "response",
G_CALLBACK (start_hotspot_response_cb), device_wifi);
- g_signal_connect (dialog, "delete-event",
- G_CALLBACK (gtk_widget_hide_on_delete), NULL);
gtk_window_present (GTK_WINDOW (dialog));
g_free (active_ssid);
+ g_string_free (str, TRUE);
}
static void
@@ -1474,7 +1505,6 @@ net_device_wifi_finalize (GObject *object)
NetDeviceWifiPrivate *priv = device_wifi->priv;
g_clear_pointer (&priv->details_dialog, gtk_widget_destroy);
- g_clear_pointer (&priv->hotspot_dialog, gtk_widget_destroy);
g_object_unref (priv->builder);
g_free (priv->selected_ssid_title);
g_free (priv->selected_connection_id);
@@ -2120,10 +2150,6 @@ net_device_wifi_init (NetDeviceWifi *device_wifi)
"details_dialog"));
device_wifi->priv->details_dialog = widget;
- widget = GTK_WIDGET (gtk_builder_get_object (device_wifi->priv->builder,
- "hotspot-dialog"));
- device_wifi->priv->hotspot_dialog = widget;
-
/* setup wifi views */
widget = GTK_WIDGET (gtk_builder_get_object (device_wifi->priv->builder,
"device_off_switch"));
diff --git a/panels/network/network-wifi.ui b/panels/network/network-wifi.ui
index 71c5b7b..5d62ebc 100644
--- a/panels/network/network-wifi.ui
+++ b/panels/network/network-wifi.ui
@@ -1478,124 +1478,6 @@ here</property>
</row>
</data>
</object>
- <object class="GtkDialog" id="hotspot-dialog">
- <property name="can_focus">False</property>
- <property name="border_width">5</property>
- <property name="resizable">False</property>
- <property name="modal">True</property>
- <property name="title" translatable="no"></property>
- <property name="destroy_with_parent">True</property>
- <property name="type_hint">dialog</property>
- <child internal-child="vbox">
- <object class="GtkBox" id="hotspot-dialog-vbox1">
- <property name="can_focus">False</property>
- <property name="orientation">vertical</property>
- <property name="spacing">14</property>
- <child>
- <object class="GtkBox" id="hotspot-dialog-box1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="border_width">5</property>
- <property name="spacing">12</property>
- <child>
- <object class="GtkImage" id="hotspot-dialog-image">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="icon_name">network-wireless</property>
- <property name="icon-size">6</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="hotspot-dialog-title">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Wi-Fi Hotspot</property>
- <attributes>
- <attribute name="weight" value="bold"/>
- <attribute name="scale" value="1.2"/>
- </attributes>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="hotspot-dialog-content">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="wrap">True</property>
- <property name="width_chars">60</property>
- <property name="max_width_chars">60</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child internal-child="action_area">
- <object class="GtkButtonBox" id="hotspot-dialog-action_area1">
- <property name="can_focus">False</property>
- <property name="layout_style">end</property>
- <child>
- <object class="GtkButton" id="hotspot-cancel-button">
- <property name="label" translatable="yes">_Cancel</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="use_underline">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="hotspot-turn-on-button">
- <property name="label" translatable="yes">_Turn On</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="can_default">True</property>
- <property name="has_default">True</property>
- <property name="receives_default">True</property>
- <property name="use_underline">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="pack_type">end</property>
- <property name="position">2</property>
- </packing>
- </child>
- </object>
- </child>
- <action-widgets>
- <action-widget response="-6">hotspot-cancel-button</action-widget>
- <action-widget response="-5">hotspot-turn-on-button</action-widget>
- </action-widgets>
- </object>
<object class="GtkNotebook" id="notebook_view">
<property name="visible">True</property>
<property name="can_focus">True</property>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]