show tooltip when connect button is disabled due to invalid connection (rh #1247885)

This commit is contained in:
Thomas Haller 2015-09-02 13:57:41 +02:00
parent 9859b59476
commit 195c54ef2c
2 changed files with 153 additions and 1 deletions

View File

@ -11,7 +11,7 @@
Name: network-manager-applet
Summary: A network control and status applet for NetworkManager
Version: %{realversion}
Release: 3%{snapshot}%{?dist}
Release: 4%{snapshot}%{?dist}
Group: Applications/System
License: GPLv2+
URL: http://www.gnome.org/projects/NetworkManager/
@ -20,6 +20,7 @@ Obsoletes: NetworkManager-gnome < %{obsoletes_ver}
Source: https://download.gnome.org/sources/network-manager-applet/1.0/%{name}-%{realversion}%{snapshot}.tar.xz
Patch0: nm-applet-no-notifications.patch
Patch1: rh1254043-applet-password-crash.patch
Patch2: rh1247885-tooltip-for-connect-button.patch
Requires: NetworkManager >= %{nm_version}
Requires: NetworkManager-glib >= %{nm_version}
@ -96,6 +97,7 @@ nm-applet, nm-connection-editor, and the GNOME control center.
%setup -q -n network-manager-applet-%{realversion}
%patch0 -p1 -b .no-notifications
%patch1 -p1 -b .rh1254043-applet-password-crash
%patch2 -p1
%build
autoreconf -i -f
@ -210,6 +212,9 @@ glib-compile-schemas %{_datadir}/glib-2.0/schemas &>/dev/null || :
%{_datadir}/gir-1.0/NMGtk-1.0.gir
%changelog
* Wed Sep 2 2015 Thomas Haller <thaller@redhat.com> - 1.0.6-4
- show tooltip when connect button is disabled due to invalid connection (rh #1247885)
* Tue Sep 1 2015 Jiří Klimeš <jklimes@redhat.com> - 1.0.6-3
- libnm-gtk: fix a possible crash on password widget destroy (rh #1254043)

View File

@ -0,0 +1,147 @@
From 065c32650a324527d56b810ac3eafb4638868f2a Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Tue, 1 Sep 2015 15:40:15 +0200
Subject: [PATCH 1/1] wifi-dialog: add tooltip to password dialog to help with
disabled "Connect" button
If the connection is invalid, the "Connect" button in the Wi-Fi password
dialog stays disabled and makes it hard for the user to understand the
reason.
Especially when connecting to certain EAP-typed Wi-Fi connections, the
connection might have no CA certificate set. However, if the connection
was not previously edited with nm-connection-editor, the connection is
considered invalid by nm-applet because "No CA certificate is required"
is unchecked.
As this flag is only stored in the gsetting of the user, NetworkManager
and nm-applet disagree about whether the connection is valid.
Add a tooltip to the connect button to indicate to the user that the
connection must be modified first.
Steps to reproduce:
- create a Wi-Fi connection of type EAP (PEAP, TLS, or TTLS) outside
of nm-applet/nm-connection-editor. Or alternatively, clear the
gsettings entry with:
dconf reset -f /org/gnome/nm-applet/eap/
- try to connect to the Wi-Fi. Note that the "Connect" button of the
password dialog is diabled (just like the "Save" button in nm-ce).
https://bugzilla.gnome.org/show_bug.cgi?id=754172
https://bugzilla.redhat.com/show_bug.cgi?id=1247885
(cherry picked from commit 53e801f362fefa52d0f538f530be91c8140e5e7b)
(cherry picked from commit 74759ef83d4db81156abe33b4e500fb0fa59e8d3)
---
src/libnm-gtk/nm-wifi-dialog.c | 45 ++++++++++++++++++++++++++++++++++--------
1 file changed, 37 insertions(+), 8 deletions(-)
diff --git a/src/libnm-gtk/nm-wifi-dialog.c b/src/libnm-gtk/nm-wifi-dialog.c
index ace323b..48310b0 100644
--- a/src/libnm-gtk/nm-wifi-dialog.c
+++ b/src/libnm-gtk/nm-wifi-dialog.c
@@ -67,6 +67,7 @@ typedef struct {
GtkTreeModel *connection_model;
GtkSizeGroup *group;
GtkWidget *sec_combo;
+ GtkWidget *ok_response_button;
gboolean network_name_focus;
@@ -125,6 +126,32 @@ size_group_clear (GtkSizeGroup *group)
}
static void
+_set_response_sensitive (NMAWifiDialog *self,
+ int response_id,
+ gboolean is_sensitive)
+{
+ switch (response_id) {
+ case GTK_RESPONSE_CANCEL:
+ case GTK_RESPONSE_OK:
+ gtk_dialog_set_response_sensitive (GTK_DIALOG (self), response_id, is_sensitive);
+
+ if (response_id == GTK_RESPONSE_OK) {
+ NMAWifiDialogPrivate *priv = NMA_WIFI_DIALOG_GET_PRIVATE (self);
+
+ if (priv->ok_response_button) {
+ gtk_widget_set_tooltip_text (priv->ok_response_button,
+ is_sensitive
+ ? _("Click to connect")
+ : _("Either a password is missing or the connection is invalid. In the latter case, you have to edit the connection with nm-connection-editor first"));
+ }
+ }
+ break;
+ default:
+ g_return_if_reached ();
+ }
+}
+
+static void
size_group_add_permanent (GtkSizeGroup *group,
GtkBuilder *builder)
{
@@ -273,7 +300,7 @@ stuff_changed_cb (WirelessSecurity *sec, gpointer user_data)
if (priv->secrets_info)
valid = FALSE;
- gtk_dialog_set_response_sensitive (GTK_DIALOG (self), GTK_RESPONSE_OK, valid);
+ _set_response_sensitive (self, GTK_RESPONSE_OK, valid);
}
static void
@@ -315,7 +342,7 @@ out:
if (priv->secrets_info)
valid = FALSE;
- gtk_dialog_set_response_sensitive (GTK_DIALOG (self), GTK_RESPONSE_OK, valid);
+ _set_response_sensitive (self, GTK_RESPONSE_OK, valid);
}
static void
@@ -752,8 +779,8 @@ get_secrets_cb (NMRemoteConnection *connection,
/* Buttons should only be re-enabled if this secrets response is the
* in-progress one.
*/
- gtk_dialog_set_response_sensitive (GTK_DIALOG (info->self), GTK_RESPONSE_CANCEL, TRUE);
- gtk_dialog_set_response_sensitive (GTK_DIALOG (info->self), GTK_RESPONSE_OK, TRUE);
+ _set_response_sensitive (info->self, GTK_RESPONSE_CANCEL, TRUE);
+ _set_response_sensitive (info->self, GTK_RESPONSE_OK, TRUE);
}
if (error) {
@@ -984,8 +1011,8 @@ security_combo_init (NMAWifiDialog *self, gboolean secrets_only)
/* Desensitize the dialog's buttons while we wait for the secrets
* operation to complete.
*/
- gtk_dialog_set_response_sensitive (GTK_DIALOG (self), GTK_RESPONSE_OK, FALSE);
- gtk_dialog_set_response_sensitive (GTK_DIALOG (self), GTK_RESPONSE_CANCEL, FALSE);
+ _set_response_sensitive (self, GTK_RESPONSE_OK, FALSE);
+ _set_response_sensitive (self, GTK_RESPONSE_CANCEL, FALSE);
info = g_malloc0 (sizeof (GetSecretsInfo));
info->self = self;
@@ -1054,8 +1081,10 @@ internal_init (NMAWifiDialog *self,
gtk_widget_show (widget);
gtk_dialog_add_action_widget (GTK_DIALOG (self), widget, GTK_RESPONSE_OK);
- } else
+ } else {
widget = gtk_dialog_add_button (GTK_DIALOG (self), GTK_STOCK_CONNECT, GTK_RESPONSE_OK);
+ priv->ok_response_button = widget;
+ }
gtk_box_set_child_packing (GTK_BOX (gtk_dialog_get_action_area (GTK_DIALOG (self))), widget,
FALSE, TRUE, 0, GTK_PACK_END);
@@ -1087,7 +1116,7 @@ internal_init (NMAWifiDialog *self,
priv->network_name_focus = TRUE;
}
- gtk_dialog_set_response_sensitive (GTK_DIALOG (self), GTK_RESPONSE_OK, FALSE);
+ _set_response_sensitive (self, GTK_RESPONSE_OK, FALSE);
if (!device_combo_init (self, specific_device)) {
g_warning ("No Wi-Fi devices available.");
--
2.4.3