network: Remove net_object_emit_removed
This commit is contained in:
parent
577762b60c
commit
2752f38a72
4 changed files with 22 additions and 49 deletions
|
@ -234,17 +234,6 @@ cc_network_panel_get_help_uri (CcPanel *self)
|
|||
return "help:gnome-help/net";
|
||||
}
|
||||
|
||||
static void
|
||||
object_removed_cb (CcNetworkPanel *self, NetObject *object)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
|
||||
/* remove device */
|
||||
widget = g_hash_table_lookup (self->device_to_widget, object);
|
||||
if (widget != NULL)
|
||||
gtk_widget_destroy (widget);
|
||||
}
|
||||
|
||||
static void
|
||||
panel_refresh_device_titles (CcNetworkPanel *self)
|
||||
{
|
||||
|
@ -483,22 +472,22 @@ panel_add_device (CcNetworkPanel *self, NMDevice *device)
|
|||
* be handled by the future Mobile Broadband panel */
|
||||
if (NET_IS_DEVICE_BLUETOOTH (net_device))
|
||||
update_bluetooth_section (self);
|
||||
|
||||
g_signal_connect_object (net_device, "removed",
|
||||
G_CALLBACK (object_removed_cb), self, G_CONNECT_SWAPPED);
|
||||
}
|
||||
|
||||
static void
|
||||
panel_remove_device (CcNetworkPanel *self, NMDevice *device)
|
||||
{
|
||||
NetObject *net_device = NULL;
|
||||
GtkWidget *widget;
|
||||
|
||||
net_device = g_hash_table_lookup (self->nm_device_to_device, device);
|
||||
if (net_device == NULL)
|
||||
return;
|
||||
|
||||
/* NMObject will not fire the "removed" signal, so handle the UI removal explicitly */
|
||||
object_removed_cb (self, net_device);
|
||||
widget = g_hash_table_lookup (self->device_to_widget, device);
|
||||
if (widget != NULL)
|
||||
gtk_widget_destroy (widget);
|
||||
|
||||
g_ptr_array_remove (self->bluetooth_devices, net_device);
|
||||
g_ptr_array_remove (self->ethernet_devices, net_device);
|
||||
g_ptr_array_remove (self->mobile_devices, net_device);
|
||||
|
@ -620,8 +609,7 @@ panel_add_vpn_device (CcNetworkPanel *self, NMConnection *connection)
|
|||
/* add as a VPN object */
|
||||
net_vpn = net_vpn_new (connection,
|
||||
self->client);
|
||||
g_signal_connect_object (net_vpn, "removed",
|
||||
G_CALLBACK (object_removed_cb), self, G_CONNECT_SWAPPED);
|
||||
|
||||
|
||||
/* add as a panel */
|
||||
add_object (self, NET_OBJECT (net_vpn), GTK_CONTAINER (self->box_vpn));
|
||||
|
@ -636,8 +624,7 @@ panel_add_vpn_device (CcNetworkPanel *self, NMConnection *connection)
|
|||
}
|
||||
|
||||
static void
|
||||
add_connection (CcNetworkPanel *self,
|
||||
NMConnection *connection)
|
||||
add_connection (CcNetworkPanel *self, NMConnection *connection)
|
||||
{
|
||||
NMSettingConnection *s_con;
|
||||
const gchar *type, *iface;
|
||||
|
@ -661,9 +648,19 @@ add_connection (CcNetworkPanel *self,
|
|||
}
|
||||
|
||||
static void
|
||||
notify_connection_added_cb (CcNetworkPanel *self, NMRemoteConnection *connection)
|
||||
client_connection_removed_cb (CcNetworkPanel *self, NMConnection *connection)
|
||||
{
|
||||
add_connection (self, NM_CONNECTION (connection));
|
||||
guint i;
|
||||
|
||||
for (i = 0; i < self->vpns->len; i++) {
|
||||
NetVpn *vpn = g_ptr_array_index (self->vpns, i);
|
||||
if (net_vpn_get_connection (vpn) == connection) {
|
||||
GtkWidget *widget = g_hash_table_lookup (self->device_to_widget, vpn);
|
||||
if (widget != NULL)
|
||||
gtk_widget_destroy (widget);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -813,7 +810,9 @@ cc_network_panel_init (CcNetworkPanel *self)
|
|||
|
||||
/* add remote settings such as VPN settings as virtual devices */
|
||||
g_signal_connect_object (self->client, NM_CLIENT_CONNECTION_ADDED,
|
||||
G_CALLBACK (notify_connection_added_cb), self, G_CONNECT_SWAPPED);
|
||||
G_CALLBACK (add_connection), self, G_CONNECT_SWAPPED);
|
||||
g_signal_connect_object (self->client, NM_CLIENT_CONNECTION_REMOVED,
|
||||
G_CALLBACK (client_connection_removed_cb), self, G_CONNECT_SWAPPED);
|
||||
|
||||
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (self));
|
||||
g_signal_connect_after (toplevel, "map", G_CALLBACK (on_toplevel_map), self);
|
||||
|
|
|
@ -39,7 +39,6 @@ enum {
|
|||
|
||||
enum {
|
||||
SIGNAL_CHANGED,
|
||||
SIGNAL_REMOVED,
|
||||
SIGNAL_LAST
|
||||
};
|
||||
|
||||
|
@ -53,13 +52,6 @@ net_object_emit_changed (NetObject *self)
|
|||
g_signal_emit (self, signals[SIGNAL_CHANGED], 0);
|
||||
}
|
||||
|
||||
void
|
||||
net_object_emit_removed (NetObject *self)
|
||||
{
|
||||
g_return_if_fail (NET_IS_OBJECT (self));
|
||||
g_signal_emit (self, signals[SIGNAL_REMOVED], 0);
|
||||
}
|
||||
|
||||
const gchar *
|
||||
net_object_get_title (NetObject *self)
|
||||
{
|
||||
|
@ -165,12 +157,6 @@ net_object_class_init (NetObjectClass *klass)
|
|||
0,
|
||||
NULL, NULL, g_cclosure_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
signals[SIGNAL_REMOVED] =
|
||||
g_signal_new ("removed",
|
||||
G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
|
||||
0,
|
||||
NULL, NULL, g_cclosure_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -46,7 +46,6 @@ const gchar *net_object_get_title (NetObject *object)
|
|||
void net_object_set_title (NetObject *object,
|
||||
const gchar *title);
|
||||
void net_object_emit_changed (NetObject *object);
|
||||
void net_object_emit_removed (NetObject *object);
|
||||
GtkWidget *net_object_get_widget (NetObject *object,
|
||||
GtkSizeGroup *heading_size_group);
|
||||
|
||||
|
|
|
@ -60,13 +60,6 @@ connection_changed_cb (NetVpn *self)
|
|||
nm_device_refresh_vpn_ui (self);
|
||||
}
|
||||
|
||||
static void
|
||||
connection_removed_cb (NetVpn *self, NMConnection *connection)
|
||||
{
|
||||
if (self->connection == connection)
|
||||
net_object_emit_removed (NET_OBJECT (self));
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
vpn_proxy_get_widget (NetObject *object,
|
||||
GtkSizeGroup *heading_size_group)
|
||||
|
@ -261,10 +254,6 @@ net_vpn_new (NMConnection *connection,
|
|||
self->client = g_object_ref (client);
|
||||
self->connection = g_object_ref (connection);
|
||||
|
||||
g_signal_connect_object (self->client,
|
||||
NM_CLIENT_CONNECTION_REMOVED,
|
||||
G_CALLBACK (connection_removed_cb),
|
||||
self, G_CONNECT_SWAPPED);
|
||||
g_signal_connect_object (connection,
|
||||
NM_CONNECTION_CHANGED,
|
||||
G_CALLBACK (connection_changed_cb),
|
||||
|
|
Loading…
Add table
Reference in a new issue