static void tracker_controller_dbus_stop (TrackerController *controller) { TrackerControllerPrivate *priv; priv = controller->priv; if (priv->registration_id != 0) { g_dbus_connection_unregister_object (priv->d_connection, priv->registration_id); } if (priv->bus_name_id != 0) { g_bus_unown_name (priv->bus_name_id); } if (priv->introspection_data) { g_dbus_node_info_unref (priv->introspection_data); } if (priv->d_connection) { g_object_unref (priv->d_connection); } if (priv->connection) { g_object_unref (priv->connection); } }
/** * cd_sensor_finalize: **/ static void cd_sensor_finalize (GObject *object) { CdSensor *sensor = CD_SENSOR (object); CdSensorPrivate *priv = sensor->priv; if (priv->registration_id > 0) { g_debug ("CdSensor: Unregister interface %i on %s", priv->registration_id, priv->object_path); g_dbus_connection_unregister_object (priv->connection, priv->registration_id); } if (priv->watcher_id != 0) g_bus_unwatch_name (priv->watcher_id); g_free (priv->model); g_free (priv->vendor); g_free (priv->serial); g_free (priv->id); g_free (priv->object_path); g_hash_table_unref (priv->options); g_hash_table_unref (priv->metadata); #ifdef HAVE_GUSB g_object_unref (priv->usb_ctx); g_object_unref (priv->device_list); #endif #ifdef HAVE_GUDEV if (priv->device != NULL) g_object_unref (priv->device); #endif G_OBJECT_CLASS (cd_sensor_parent_class)->finalize (object); }
static void unexport_all (GDBusObjectManagerServer *manager, gboolean only_manager) { GHashTableIter iter; RegistrationData *data; GHashTableIter iface_iter; GDBusInterfaceSkeleton *iface; g_return_if_fail (manager->priv->connection != NULL); g_warn_if_fail (manager->priv->manager_reg_id > 0); if (manager->priv->manager_reg_id > 0) { g_warn_if_fail (g_dbus_connection_unregister_object (manager->priv->connection, manager->priv->manager_reg_id)); manager->priv->manager_reg_id = 0; } if (only_manager) goto out; g_hash_table_iter_init (&iter, manager->priv->map_object_path_to_data); while (g_hash_table_iter_next (&iter, NULL, (gpointer) &data)) { g_hash_table_iter_init (&iface_iter, data->map_iface_name_to_iface); while (g_hash_table_iter_next (&iface_iter, NULL, (gpointer) &iface)) { g_warn_if_fail (g_dbus_interface_skeleton_get_connection (iface) != NULL); g_dbus_interface_skeleton_unexport (iface); } } out: ; }
static void impl_deactivate(PeasActivatable *activatable) { XmrMprisPlugin *plugin; plugin = XMR_MPRIS_PLUGIN(activatable); g_signal_handlers_disconnect_by_func(plugin->window, track_changed, plugin); g_signal_handlers_disconnect_by_func(plugin->player, player_tick, plugin); g_signal_handlers_disconnect_by_func(plugin->player, player_state_changed, plugin); if (plugin->root_id != 0) { g_dbus_connection_unregister_object(plugin->connection, plugin->root_id); plugin->root_id = 0; } if (plugin->player_id != 0) { g_dbus_connection_unregister_object(plugin->connection, plugin->player_id); plugin->player_id = 0; } if (plugin->name_own_id > 0) { g_bus_unown_name(plugin->name_own_id); plugin->name_own_id = 0; } if (plugin->connection != NULL) { g_object_unref(plugin->connection); plugin->connection = NULL; } if (plugin->current_song) { song_info_free(plugin->current_song); plugin->current_song = NULL; } g_object_unref(plugin->window); g_object_unref(plugin->player); }
void AbstractDBusInterface::unregisterObject() { if(regId) { DebugOut()<<__FUNCTION__<<endl; g_dbus_connection_unregister_object(mConnection, regId); } regId=0; }
static void tts_cleanup(wrtc_t *wrtc) { if (wrtc->gtts != 0) { g_dbus_connection_unregister_object(wrtc->gdbus, wrtc->gtts); wrtc->gtts = 0; } if (wrtc->intr != NULL) { g_dbus_node_info_unref(wrtc->intr); wrtc->intr = NULL; } }
static void prv_connector_unpublish_object(dleyna_connector_id_t connection, guint object_id) { DLEYNA_LOG_DEBUG("Enter, object_id = %u", object_id); g_dbus_connection_unregister_object((GDBusConnection *)connection, object_id); (void) g_hash_table_remove(g_context.objects, &object_id); DLEYNA_LOG_DEBUG("Exit"); }
void ev_application_shutdown (EvApplication *application) { if (application->uri) { #ifdef ENABLE_DBUS ev_application_unregister_uri (application, application->uri); #endif g_free (application->uri); application->uri = NULL; } ev_application_accel_map_save (application); g_object_unref (application->scr_saver); application->scr_saver = NULL; #ifdef ENABLE_DBUS if (application->keys) { g_object_unref (application->keys); application->keys = NULL; } if (application->registration_id != 0) { g_dbus_connection_unregister_object (application->connection, application->registration_id); application->registration_id = 0; } if (application->connection != NULL) { g_object_unref (application->connection); application->connection = NULL; } if (introspection_data) { g_dbus_node_info_ref (introspection_data); introspection_data = NULL; } #endif /* ENABLE_DBUS */ g_free (application->dot_dir); application->dot_dir = NULL; g_free (application->data_dir); application->data_dir = NULL; g_free (application->filechooser_open_uri); application->filechooser_open_uri = NULL; g_free (application->filechooser_save_uri); application->filechooser_save_uri = NULL; g_object_unref (application); instance = NULL; gtk_main_quit (); }
void mpris_base_unregister(mpris *inst) { gulong *current_sig_id = inst->base_sig_id_list; while(current_sig_id && *current_sig_id > 0) { g_signal_handler_disconnect( inst->gmpv_ctx->gui, *current_sig_id ); current_sig_id++; } g_dbus_connection_unregister_object( inst->session_bus_conn, inst->base_reg_id ); g_hash_table_remove_all(inst->base_prop_table); g_hash_table_unref(inst->base_prop_table); g_free(inst->base_sig_id_list); }
static void finalize(GObject* object) { ZathuraDbus* dbus = ZATHURA_DBUS(object); private_t* priv = GET_PRIVATE(dbus); if (priv->connection != NULL && priv->registration_id > 0) { g_dbus_connection_unregister_object(priv->connection, priv->registration_id); } if (priv->owner_id > 0) { g_bus_unown_name(priv->owner_id); } if (priv->introspection_data != NULL) { g_dbus_node_info_unref(priv->introspection_data); } G_OBJECT_CLASS(zathura_dbus_parent_class)->finalize(object); }
static void evd_dbus_agent_free_reg_obj_data (gpointer data) { ObjectData *obj_data; RegObjData *reg_obj_data = (RegObjData *) data; obj_data = reg_obj_data->obj_data; g_dbus_connection_unregister_object (reg_obj_data->dbus_conn, reg_obj_data->reg_id); g_hash_table_remove (obj_data->reg_objs, ®_obj_data->reg_str_id); g_free (reg_obj_data->obj_path); g_dbus_interface_info_unref (reg_obj_data->iface_info); g_object_unref (reg_obj_data->dbus_conn); g_hash_table_destroy (reg_obj_data->invocations); g_slice_free (RegObjData, reg_obj_data); }
static void gtlm_nfc_dispose(GObject *object) { GTlmNfc* self = GTLM_NFC (object); if (self->system_bus) { GError* error = NULL; GVariant* agent_register_response = g_dbus_connection_call_sync (self->system_bus, "org.neard", "/org/neard", "org.neard.AgentManager", "UnregisterNDEFAgent", g_variant_new("(os)", "/org/tlmnfc/agent", "application/gtlm-nfc"), NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error); if (agent_register_response == NULL) { g_debug ("Error unregistering an agent with neard: %s", error->message); g_error_free (error); } g_variant_unref(agent_register_response); } if (self->agent_registration_id > 0) if (g_dbus_connection_unregister_object(self->system_bus, self->agent_registration_id) == FALSE) g_debug("Error unregistering agent object"); if (self->neard_manager) { g_object_unref(self->neard_manager); self->neard_manager = NULL; } if (self->system_bus) { g_object_unref(self->system_bus); self->system_bus = NULL; } G_OBJECT_CLASS (gtlm_nfc_parent_class)->dispose (object); }
void AbstractDBusInterface::unregisterObject() { g_dbus_connection_unregister_object(mConnection, regId); }
/** * g_dbus_connection_unexport_menu_model: * @connection: a #GDBusConnection * @export_id: the ID from g_dbus_connection_export_menu_model() * * Reverses the effect of a previous call to * g_dbus_connection_export_menu_model(). * * It is an error to call this function with an ID that wasn't returned * from g_dbus_connection_export_menu_model() or to call it with the * same ID more than once. * * Since: 2.32 */ void g_dbus_connection_unexport_menu_model (GDBusConnection *connection, guint export_id) { g_dbus_connection_unregister_object (connection, export_id); }
void unregister_agent_callbacks(GError **error) { if (_bt_agent_registration_id) g_dbus_connection_unregister_object(g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, error), _bt_agent_registration_id); }
AutomotiveManager::~AutomotiveManager() { g_dbus_connection_unregister_object(mConnection, regId); }
int main (int argc, char *argv[]) { GOptionContext *opt_ctx = NULL; GError *error = NULL; NMConnectionList *list = NULL; guint owner_id = 0, registration_id = 0; GDBusConnection *bus = NULL; gs_free char *type = NULL, *uuid = NULL, *import = NULL; gboolean create = FALSE, show = FALSE; int ret = 1; GOptionEntry entries[] = { { ARG_TYPE, 't', 0, G_OPTION_ARG_STRING, &type, "Type of connection to show or create", NM_SETTING_WIRED_SETTING_NAME }, { ARG_CREATE, 'c', 0, G_OPTION_ARG_NONE, &create, "Create a new connection", NULL }, { ARG_SHOW, 's', 0, G_OPTION_ARG_NONE, &show, "Show a given connection type page", NULL }, { "edit", 'e', 0, G_OPTION_ARG_STRING, &uuid, "Edit an existing connection with a given UUID", "UUID" }, { ARG_IMPORT, 'i', 0, G_OPTION_ARG_STRING, &import, "Import a VPN connection from given file", NULL }, /* This is not passed over D-Bus. */ { "keep-above", 0, G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_NONE, &nm_ce_keep_above, NULL, NULL }, { NULL } }; bindtextdomain (GETTEXT_PACKAGE, NMALOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); gtk_init (&argc, &argv); textdomain (GETTEXT_PACKAGE); opt_ctx = g_option_context_new (NULL); g_option_context_set_summary (opt_ctx, "Allows users to view and edit network connection settings"); g_option_context_add_main_entries (opt_ctx, entries, NULL); if (!g_option_context_parse (opt_ctx, &argc, &argv, &error)) { g_printerr ("Failed to parse options: %s\n", error->message); goto out; } /* Just one page for both CDMA & GSM, handle that here */ if (g_strcmp0 (type, NM_SETTING_CDMA_SETTING_NAME) == 0) { g_free (type); type = g_strdup (NM_SETTING_GSM_SETTING_NAME); } bus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL); if (bus) { /* Check for an existing instance on the bus, and if there * is one, send the arguments to it and exit instead of opening * a second instance of the connection editor. */ if (try_existing_instance (bus, type, create, show, uuid, import)) { /* success */ ret = 0; goto out; } } loop = g_main_loop_new (NULL, FALSE); list = nm_connection_list_new (); if (!list) { g_warning ("Failed to initialize the UI, exiting..."); goto out; } g_signal_connect_swapped (list, "done", G_CALLBACK (g_main_loop_quit), loop); owner_id = start_service (bus, list, ®istration_id); /* Figure out what page or editor window we'll show initially */ if (handle_arguments (list, type, create, show, uuid, import, (create || show || uuid || import))) nm_connection_list_present (list); g_unix_signal_add (SIGTERM, signal_handler, GINT_TO_POINTER (SIGTERM)); g_unix_signal_add (SIGINT, signal_handler, GINT_TO_POINTER (SIGINT)); g_main_loop_run (loop); ret = 0; out: if (owner_id) g_bus_unown_name (owner_id); if (registration_id) g_dbus_connection_unregister_object (bus, registration_id); if (introspection_data) g_dbus_node_info_unref (introspection_data); g_clear_error (&error); if (opt_ctx) g_option_context_free (opt_ctx); g_clear_object (&list); g_clear_object (&bus); return ret; }
static void handle_method_call (GDBusConnection *connection, const gchar *sender, const gchar *object_path, const gchar *interface_name, const gchar *method_name, GVariant *parameters, GDBusMethodInvocation *invocation, gpointer user_data) { if (g_strcmp0 (method_name, "RegisterMe") == 0) { GError *error; gchar *nickname; gint registration_id; gint i; gchar *client_object; gchar *response; gboolean unregistered; gboolean unique_username; GUser user; g_variant_get (parameters, "(&s)", &nickname); client_object = g_strdup_printf ("%s/%s", OBJECT_PATH,nickname); error = NULL; unique_username = TRUE; for (i = 0 ; i < users->len; i++) { user = g_array_index (users, GUser, i); if (g_strcmp0(user.nickname, nickname) == 0) { unique_username = FALSE; break; } } if (unique_username == FALSE) { g_print ("%s already registered, not registering the new one!\n",nickname); response = g_strdup (®ISTRATION_RESPONSE_NOT_OK); g_dbus_method_invocation_return_value (invocation, g_variant_new ("(s)", response)); g_free (response); return; } unregistered = g_dbus_connection_unregister_object(connection,temp_registration_id); if (unregistered == FALSE) { g_printerr ("Error unregistering the temp object!\n"); } registration_id = g_dbus_connection_register_object (connection, client_object, introspection_data->interfaces[0], &interface_vtable, NULL, NULL, &error); if (registration_id <= 0) { g_print ("%s not registered!\n",nickname); response = g_strdup (®ISTRATION_RESPONSE_NOT_OK); g_dbus_method_invocation_return_value (invocation, g_variant_new ("(s)", response)); g_free (response); } else if (error == NULL) { gint iter; user.registration_id = registration_id; i = 0; for (; i < MAX_CHAR; i++) { user.nickname[i] = nickname[i]; if (nickname[i] == 0) break; } user.connection = connection; g_print ("%s joined the chat.\n",user.nickname); g_array_append_val(users, user); for (iter = 0; iter < users->len ; iter++) { user = g_array_index (users, GUser, iter); if (g_strcmp0(nickname,user.nickname) == 0) continue; object_path = g_strdup_printf("%s/%s", OBJECT_PATH, &user.nickname); g_dbus_connection_emit_signal(user.connection, NULL, object_path, INTERFACE_PATH, "joined_chat", g_variant_new ("(s)", nickname), &error); } response = g_strdup (®ISTRATION_RESPONSE_OK); g_dbus_method_invocation_return_value (invocation, g_variant_new ("(s)", response)); g_free (response); } } else if (g_strcmp0 (method_name, "SendMessage") == 0) { gchar *nick; gchar *content; gchar *object_path; gint iter; GError *error; GUser user; g_variant_get (parameters, "(&s&s)", &nick, &content); error = NULL; g_print ("%s: %s\n", nick, content); for (iter = 0; iter < users->len ; iter++) { user = g_array_index (users, GUser, iter); if (g_strcmp0(nick,user.nickname) == 0) continue; object_path = g_strdup_printf("%s/%s", OBJECT_PATH, &user.nickname); g_dbus_connection_emit_signal(user.connection, NULL, object_path, INTERFACE_PATH, "message", g_variant_new ("(ss)", nick, content), &error); } } else if (g_strcmp0 (method_name, "ListUsers") == 0) { gchar *list; GError *error; gchar *nickname; GUser user; gint iter; list = get_users_list(); error = NULL; g_variant_get (parameters, "(&s)", &nickname); object_path = g_strdup_printf ("%s/%s", OBJECT_PATH,nickname); for (iter = 0; iter < users->len; iter++) { user = g_array_index (users, GUser, iter); if (g_strcmp0(nickname,user.nickname) == 0) { g_dbus_connection_emit_signal(user.connection, NULL, object_path, INTERFACE_PATH, "users_list", g_variant_new ("(s)", list), &error); break; } } } else if (g_strcmp0 (method_name, "QuitChat") == 0) { gchar *list; GError *error; gchar *nickname; GUser user; gint iter; gint position; gboolean unregistered; position = 0; list = get_users_list(); error = NULL; g_variant_get (parameters, "(&s)", &nickname); for (iter = 0; iter < users->len; iter++) { user = g_array_index (users, GUser, iter); if (g_strcmp0(nickname,user.nickname) == 0) { // Save position for later position = iter; // Unregister object on dbus unregistered = g_dbus_connection_unregister_object(connection, user.registration_id); if (unregistered == FALSE) { g_printerr ("Error unregistering the object!\n"); } // Unref the connection g_object_unref (user.connection); } else { object_path = g_strdup_printf ("%s/%s", OBJECT_PATH,&user.nickname); g_dbus_connection_emit_signal(user.connection, NULL, object_path, INTERFACE_PATH, "left_chat", g_variant_new ("(s)", nickname), &error); } } // Remove the user from users list g_array_remove_index(users,position); g_print ("%s left the chat!\n", nickname); } else { g_printerr ("Unknown method!\n"); } }