wifi-dialog: fix widget hiding logic (rh #1665653)
This commit is contained in:
parent
c30457b402
commit
5f32380834
149
0003-wifi-dialog-fixes.patch
Normal file
149
0003-wifi-dialog-fixes.patch
Normal file
@ -0,0 +1,149 @@
|
||||
From 381bf2e84fbd5728dbe967a1ab4efda95654a3e4 Mon Sep 17 00:00:00 2001
|
||||
From: Beniamino Galvani <bgalvani@redhat.com>
|
||||
Date: Sat, 12 Jan 2019 21:43:21 +0100
|
||||
Subject: [PATCH 1/2] wifi-dialog: remember the specific_connection construct
|
||||
parameter
|
||||
|
||||
The specific_connection parameter is passed to
|
||||
connection_combo_init(), which stores the connection in
|
||||
priv->connection. When the user changes device, device_combo_changed()
|
||||
calls again connection_combo_init() passing a NULL argument and so the
|
||||
specific connection gets lost.
|
||||
|
||||
Store the specific_connection in the dialog private data and use it
|
||||
when the connection combo is re-initialized.
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1665653
|
||||
(cherry picked from commit 348cc284bf3497dcef6394e8438a9c4a8411852e)
|
||||
---
|
||||
src/libnma/nma-wifi-dialog.c | 19 ++++++++++++-------
|
||||
1 file changed, 12 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/src/libnma/nma-wifi-dialog.c b/src/libnma/nma-wifi-dialog.c
|
||||
index 3ac5fd68..8d05e585 100644
|
||||
--- a/src/libnma/nma-wifi-dialog.c
|
||||
+++ b/src/libnma/nma-wifi-dialog.c
|
||||
@@ -48,6 +48,7 @@ typedef struct {
|
||||
|
||||
GtkBuilder *builder;
|
||||
|
||||
+ NMConnection *specific_connection;
|
||||
NMConnection *connection;
|
||||
NMDevice *device;
|
||||
NMAccessPoint *ap;
|
||||
@@ -421,7 +422,7 @@ alphabetize_connections (NMConnection *a, NMConnection *b)
|
||||
}
|
||||
|
||||
static gboolean
|
||||
-connection_combo_init (NMAWifiDialog *self, NMConnection *connection)
|
||||
+connection_combo_init (NMAWifiDialog *self)
|
||||
{
|
||||
NMAWifiDialogPrivate *priv = NMA_WIFI_DIALOG_GET_PRIVATE (self);
|
||||
GtkListStore *store;
|
||||
@@ -439,8 +440,8 @@ connection_combo_init (NMAWifiDialog *self, NMConnection *connection)
|
||||
store = gtk_list_store_new (4, G_TYPE_STRING, G_TYPE_OBJECT, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN);
|
||||
priv->connection_model = GTK_TREE_MODEL (store);
|
||||
|
||||
- if (connection) {
|
||||
- s_con = nm_connection_get_setting_connection (connection);
|
||||
+ if (priv->specific_connection) {
|
||||
+ s_con = nm_connection_get_setting_connection (priv->specific_connection);
|
||||
g_assert (s_con);
|
||||
id = nm_setting_connection_get_id (s_con);
|
||||
if (id == NULL) {
|
||||
@@ -454,7 +455,7 @@ connection_combo_init (NMAWifiDialog *self, NMConnection *connection)
|
||||
gtk_list_store_append (store, &tree_iter);
|
||||
gtk_list_store_set (store, &tree_iter,
|
||||
C_NAME_COLUMN, id,
|
||||
- C_CON_COLUMN, connection, -1);
|
||||
+ C_CON_COLUMN, priv->specific_connection, -1);
|
||||
} else {
|
||||
GSList *to_add = NULL, *iter;
|
||||
const GPtrArray *connections;
|
||||
@@ -551,7 +552,7 @@ connection_combo_init (NMAWifiDialog *self, NMConnection *connection)
|
||||
gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 0);
|
||||
g_signal_connect (G_OBJECT (widget), "changed",
|
||||
G_CALLBACK (connection_combo_changed), self);
|
||||
- if (connection || !num_added) {
|
||||
+ if (priv->specific_connection || !num_added) {
|
||||
gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (priv->builder, "connection_label")));
|
||||
gtk_widget_hide (widget);
|
||||
}
|
||||
@@ -579,7 +580,7 @@ device_combo_changed (GtkWidget *combo,
|
||||
g_object_unref (priv->device);
|
||||
gtk_tree_model_get (model, &iter, D_DEV_COLUMN, &priv->device, -1);
|
||||
|
||||
- if (!connection_combo_init (self, NULL)) {
|
||||
+ if (!connection_combo_init (self)) {
|
||||
g_warning ("Couldn't change connection combo box.");
|
||||
return;
|
||||
}
|
||||
@@ -1053,6 +1054,9 @@ internal_init (NMAWifiDialog *self,
|
||||
else
|
||||
icon_name = "network-wireless";
|
||||
|
||||
+ if (specific_connection)
|
||||
+ priv->specific_connection = g_object_ref (specific_connection);
|
||||
+
|
||||
gtk_window_set_icon_name (GTK_WINDOW (self), icon_name);
|
||||
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "image1"));
|
||||
gtk_image_set_from_icon_name (GTK_IMAGE (widget), icon_name, GTK_ICON_SIZE_DIALOG);
|
||||
@@ -1104,7 +1108,7 @@ internal_init (NMAWifiDialog *self,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
- if (!connection_combo_init (self, specific_connection)) {
|
||||
+ if (!connection_combo_init (self)) {
|
||||
g_warning ("Couldn't set up connection combo box.");
|
||||
return FALSE;
|
||||
}
|
||||
@@ -1401,6 +1405,7 @@ dispose (GObject *object)
|
||||
|
||||
g_clear_object (&priv->group);
|
||||
|
||||
+ g_clear_object (&priv->specific_connection);
|
||||
g_clear_object (&priv->connection);
|
||||
|
||||
g_clear_object (&priv->device);
|
||||
--
|
||||
2.20.1
|
||||
|
||||
From b972be7df89f127bc64342f221b7a31197eff8bf Mon Sep 17 00:00:00 2001
|
||||
From: Beniamino Galvani <bgalvani@redhat.com>
|
||||
Date: Sat, 12 Jan 2019 22:35:10 +0100
|
||||
Subject: [PATCH 2/2] wifi-dialog: fix connection combo signals
|
||||
|
||||
We need to connect to "changed" signal only when the widget is
|
||||
displayed. Also, connection_combo_init() can be called multiple times
|
||||
and so we need to clear previous handlers registration or the
|
||||
function can be called multiple times.
|
||||
|
||||
(cherry picked from commit cf176a76898e6e06a1524f3f98bfcfdf842747f6)
|
||||
---
|
||||
src/libnma/nma-wifi-dialog.c | 7 +++++--
|
||||
1 file changed, 5 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/libnma/nma-wifi-dialog.c b/src/libnma/nma-wifi-dialog.c
|
||||
index 8d05e585..6b68e601 100644
|
||||
--- a/src/libnma/nma-wifi-dialog.c
|
||||
+++ b/src/libnma/nma-wifi-dialog.c
|
||||
@@ -550,11 +550,14 @@ connection_combo_init (NMAWifiDialog *self)
|
||||
NULL);
|
||||
|
||||
gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 0);
|
||||
- g_signal_connect (G_OBJECT (widget), "changed",
|
||||
- G_CALLBACK (connection_combo_changed), self);
|
||||
+
|
||||
+ g_signal_handlers_disconnect_by_func (widget, connection_combo_changed, self);
|
||||
if (priv->specific_connection || !num_added) {
|
||||
gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (priv->builder, "connection_label")));
|
||||
gtk_widget_hide (widget);
|
||||
+ } else {
|
||||
+ g_signal_connect (widget, "changed",
|
||||
+ G_CALLBACK (connection_combo_changed), self);
|
||||
}
|
||||
if (gtk_tree_model_get_iter_first (priv->connection_model, &tree_iter))
|
||||
gtk_tree_model_get (priv->connection_model, &tree_iter, C_CON_COLUMN, &priv->connection, -1);
|
||||
--
|
||||
2.20.1
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
%global rpm_version 1.8.18
|
||||
%global real_version 1.8.18
|
||||
%global release_version 2
|
||||
%global release_version 3
|
||||
|
||||
%global real_version_major %(printf '%s' '%{real_version}' | sed -n 's/^\\([1-9][0-9]*\\.[1-9][0-9]*\\)\\.[1-9][0-9]*$/\\1/p')
|
||||
|
||||
@ -27,6 +27,7 @@ Obsoletes: NetworkManager-gnome < %{obsoletes_ver}
|
||||
Source: https://download.gnome.org/sources/network-manager-applet/%{real_version_major}/%{name}-%{real_version}.tar.xz
|
||||
Patch1: 0001-nm-applet-no-notifications.patch
|
||||
Patch2: 0002-no-show-all.patch
|
||||
Patch3: 0003-wifi-dialog-fixes.patch
|
||||
|
||||
Requires: NetworkManager >= %{nm_version}
|
||||
Requires: libnotify >= 0.4.3
|
||||
@ -218,6 +219,9 @@ desktop-file-validate $RPM_BUILD_ROOT%{_datadir}/applications/nm-connection-edit
|
||||
|
||||
|
||||
%changelog
|
||||
* Sat Jan 19 2019 Beniamino Galvani <bgalvani@redhat.com> - 1.8.18-3
|
||||
- wifi-dialog: fix widget hiding logic (rh #1665653)
|
||||
|
||||
* Fri Sep 21 2018 Thomas Haller <thaller@redhat.com> - 1.8.18-2
|
||||
- libnma: fix wrongly showing hidden GUI elements (rh #1626397) (2)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user