[network-manager-applet/nma-1-0] libnma: take weak-ref to passwd_entry in PopupMenuItemInfo
- From: Thomas Haller <thaller src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-applet/nma-1-0] libnma: take weak-ref to passwd_entry in PopupMenuItemInfo
- Date: Sat, 12 Sep 2015 10:53:04 +0000 (UTC)
commit 22252c321b905ac81576c425524b9b25de1f6328
Author: Thomas Haller <thaller redhat com>
Date: Fri Sep 11 12:37:15 2015 +0200
libnma: take weak-ref to passwd_entry in PopupMenuItemInfo
(cherry picked from commit eaf99061fba3cde9b94d3b802ff0e7d17bdfd41b)
src/libnm-gtk/nm-ui-utils.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/src/libnm-gtk/nm-ui-utils.c b/src/libnm-gtk/nm-ui-utils.c
index a5d5c15..90b3b4c 100644
--- a/src/libnm-gtk/nm-ui-utils.c
+++ b/src/libnm-gtk/nm-ui-utils.c
@@ -717,7 +717,6 @@ menu_item_to_secret_flags (MenuItem item)
case ITEM_STORAGE_SYSTEM:
default:
break;
-
}
return flags;
}
@@ -737,6 +736,8 @@ popup_menu_item_info_destroy (gpointer data, GClosure *closure)
if (info->setting)
g_object_unref (info->setting);
g_clear_pointer (&info->password_flags_name, g_free);
+ if (info->passwd_entry)
+ g_object_remove_weak_pointer (G_OBJECT (info->passwd_entry), (gpointer *)
&info->passwd_entry);
g_slice_free (PopupMenuItemInfo, info);
}
@@ -756,7 +757,8 @@ activate_menu_item_cb (GtkMenuItem *menuitem, gpointer user_data)
flags, NULL);
/* Change icon */
- change_password_storage_icon (info->passwd_entry, info->item_number);
+ if (info->passwd_entry)
+ change_password_storage_icon (info->passwd_entry, info->item_number);
}
}
@@ -775,6 +777,9 @@ popup_menu_item_info_register (GtkWidget *item,
info->item_number = item_number;
info->passwd_entry = passwd_entry;
+ if (info->passwd_entry)
+ g_object_add_weak_pointer (G_OBJECT (info->passwd_entry), (gpointer *) &info->passwd_entry);
+
g_signal_connect_data (item, "activate",
G_CALLBACK (activate_menu_item_cb),
info,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]