settings: let NMSettingsConnection unregister itself

Originally it was to keep logical balance, since NMSettings exports
the NMSettingsConnection to D-Bus, but it's kind of pointless to
spend some LoC just for that.
This commit is contained in:
Dan Williams 2013-06-11 09:27:33 -05:00
parent 3ee0203b8c
commit 2cb9bc9bda
2 changed files with 1 additions and 33 deletions

View file

@ -83,7 +83,6 @@ enum {
enum {
UPDATED,
REMOVED,
UNREGISTER,
LAST_SIGNAL
};
static guint signals[LAST_SIGNAL] = { 0 };
@ -1517,7 +1516,7 @@ nm_settings_connection_signal_remove (NMSettingsConnection *self)
/* And unregistered last to ensure the removed signal goes out before
* we take the connection off the bus.
*/
g_signal_emit_by_name (self, "unregister");
nm_dbus_manager_unregister_object (nm_dbus_manager_get (), G_OBJECT (self));
}
gboolean
@ -1989,16 +1988,6 @@ nm_settings_connection_class_init (NMSettingsConnectionClass *class)
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
/* Not exported */
signals[UNREGISTER] =
g_signal_new ("unregister",
G_TYPE_FROM_CLASS (class),
G_SIGNAL_RUN_FIRST,
0,
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
nm_dbus_manager_register_exported_type (nm_dbus_manager_get (),
G_TYPE_FROM_CLASS (class),
&dbus_glib_nm_settings_connection_object_info);

View file

@ -663,7 +663,6 @@ load_plugins (NMSettings *self, const char **plugins, GError **error)
#define REMOVED_ID_TAG "removed-id-tag"
#define UPDATED_ID_TAG "updated-id-tag"
#define VISIBLE_ID_TAG "visible-id-tag"
#define UNREG_ID_TAG "unreg-id-tag"
static void
connection_removed (NMSettingsConnection *obj, gpointer user_data)
@ -701,21 +700,6 @@ connection_removed (NMSettingsConnection *obj, gpointer user_data)
g_object_unref (connection);
}
static void
connection_unregister (NMSettingsConnection *obj, gpointer user_data)
{
NMSettingsPrivate *priv = NM_SETTINGS_GET_PRIVATE (user_data);
GObject *connection = G_OBJECT (obj);
guint id;
/* Make sure it's unregistered from the bus now that's removed */
nm_dbus_manager_unregister_object (priv->dbus_mgr, connection);
id = GPOINTER_TO_UINT (g_object_get_data (connection, UNREG_ID_TAG));
if (id)
g_signal_handler_disconnect (connection, id);
}
static void
connection_updated (NMSettingsConnection *connection, gpointer user_data)
{
@ -839,11 +823,6 @@ claim_connection (NMSettings *self,
self);
g_object_set_data (G_OBJECT (connection), REMOVED_ID_TAG, GUINT_TO_POINTER (id));
id = g_signal_connect (connection, "unregister",
G_CALLBACK (connection_unregister),
self);
g_object_set_data (G_OBJECT (connection), UNREG_ID_TAG, GUINT_TO_POINTER (id));
id = g_signal_connect (connection, NM_SETTINGS_CONNECTION_UPDATED,
G_CALLBACK (connection_updated),
self);