After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 709118 - network: Update forget button sensitivity when rows are destroyed
network: Update forget button sensitivity when rows are destroyed
Status: RESOLVED FIXED
Product: gnome-control-center
Classification: Core
Component: Network
unspecified
Other All
: Normal normal
: ---
Assigned To: Control-Center Maintainers
Control-Center Maintainers
Depends on:
Blocks:
 
 
Reported: 2013-09-30 17:05 UTC by Rui Matos
Modified: 2013-10-01 13:12 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
network: Update forget button sensitivity when rows are destroyed (2.62 KB, patch)
2013-09-30 17:05 UTC, Rui Matos
reviewed Details | Review
network: Update forget button sensitivity when rows are destroyed (1.85 KB, patch)
2013-10-01 09:31 UTC, Rui Matos
committed Details | Review

Description Rui Matos 2013-09-30 17:05:33 UTC
Another bug I noticed in this area. Also applies to 3.8.
Comment 1 Rui Matos 2013-09-30 17:05:36 UTC
Created attachment 256119 [details] [review]
network: Update forget button sensitivity when rows are destroyed

Doesn't make sense to keep it sensitive after the dialog returns OK.

This also avoids using finalized objects if the forget button is
clicked after some previously checked rows were destroyed because
their connection got removed elsewhere.
Comment 2 Bastien Nocera 2013-09-30 17:59:24 UTC
Review of attachment 256119 [details] [review]:

::: panels/network/net-device-wifi.c
@@ +1445,3 @@
+        rows = g_object_steal_data (G_OBJECT (forget), "rows");
+        rows = g_list_remove (rows, where_row_was);
+        g_object_set_data_full (G_OBJECT (forget), "rows", rows, (GDestroyNotify)g_list_free);

Wouldn't it be better to have a destroy notify function that unref'ed the elements, rather than doing that separately.

g_object_set_data_full (G_OBJECT (forget), "rows", rows, (GDestroyNotify)free_rows);

static void
free_rows (gpointer data)
{
  rows = ...;
  g_list_foreach (rows, row_weak_unref, ...);
  g_list_free (rows);
}
?
Comment 3 Bastien Nocera 2013-09-30 18:11:47 UTC
(In reply to comment #2)
>   g_list_foreach (rows, row_weak_unref, ...);
>   g_list_free (rows);

And those last 2 can actually be:
g_list_free_full(rows, row_weak_unref, ...);
Comment 4 Rui Matos 2013-10-01 09:31:22 UTC
Created attachment 256167 [details] [review]
network: Update forget button sensitivity when rows are destroyed

--

It's actually much simpler with g_signal_connect_object() (again...)
Comment 5 Bastien Nocera 2013-10-01 12:39:36 UTC
Review of attachment 256167 [details] [review]:

Looks fine.
Comment 6 Rui Matos 2013-10-01 13:12:05 UTC
Attachment 256167 [details] pushed as fb9d98b - network: Update forget button sensitivity when rows are destroyed