G_MODULE_EXPORT void webkit_web_extension_initialize_with_user_data (WebKitWebExtension *extension, GVariant *user_data) { EphyWebExtension *web_extension; char *service_name; const char *extension_id; const char *dot_dir; gboolean private_profile; GError *error = NULL; g_variant_get (user_data, "(&s&sb)", &extension_id, &dot_dir, &private_profile); if (!ephy_file_helpers_init (dot_dir, 0, &error)) { g_printerr ("Failed to initialize file helpers: %s\n", error->message); g_error_free (error); } ephy_debug_init (); web_extension = ephy_web_extension_get (); ephy_web_extension_initialize (web_extension, extension, dot_dir, private_profile); service_name = g_strdup_printf ("%s-%s", EPHY_WEB_EXTENSION_SERVICE_NAME, extension_id); g_bus_own_name (G_BUS_TYPE_SESSION, service_name, G_BUS_NAME_OWNER_FLAGS_NONE, NULL, (GBusNameAcquiredCallback)name_acquired_cb, NULL, web_extension, NULL); g_free (service_name); }
static void mex_mpris_plugin_init (MexMprisPlugin *self) { MexMprisPluginPrivate *priv = self->priv = MPRIS_PLUGIN_PRIVATE (self); GError *error=NULL; priv->player = mex_player_get_default (); priv->media = mex_player_get_clutter_media (priv->player); g_signal_connect (priv->media, "notify::in-seek", G_CALLBACK (_check_if_seeked), self); g_bus_own_name (G_BUS_TYPE_SESSION, MPRIS_BUS_NAME_PREFIX ".media-explorer", G_BUS_NAME_OWNER_FLAGS_NONE, NULL, NULL, NULL, NULL, NULL); if (!(priv->introspection_data = g_dbus_node_info_new_for_xml (mpris_introspection_xml, &error))) g_warning ("Error %s", error->message); g_bus_get (G_BUS_TYPE_SESSION, NULL, on_bus_acquired, self); priv->mimes_supported = g_strsplit (MEX_MIME_TYPES, ";", -1); }
G_MODULE_EXPORT void webkit_web_extension_initialize_with_user_data (WebKitWebExtension *wk_extension, GVariant *user_data) { EEditorWebExtension *extension; const gchar *service_name; g_return_if_fail (user_data != NULL); service_name = g_variant_get_string (user_data, NULL); camel_debug_init (); extension = e_editor_web_extension_get_default (); e_editor_web_extension_initialize (extension, wk_extension); g_bus_own_name ( G_BUS_TYPE_SESSION, service_name, G_BUS_NAME_OWNER_FLAGS_NONE, (GBusAcquiredCallback) bus_acquired_cb, NULL, /* GBusNameAcquiredCallback */ NULL, /* GBusNameLostCallback */ g_object_ref (extension), (GDestroyNotify) g_object_unref); }
static void korva_server_init (KorvaServer *self) { self->priv = korva_server_get_instance_private (self); self->priv->loop = g_main_loop_new (NULL, FALSE); self->priv->bus_id = g_bus_own_name (G_BUS_TYPE_SESSION, "org.jensge.Korva", G_BUS_NAME_OWNER_FLAGS_NONE, korva_server_on_bus_aquired, korva_server_on_name_aquired, korva_server_on_name_lost, g_object_ref (self), g_object_unref); self->priv->tags = g_hash_table_new_full (g_str_hash, (GEqualFunc) g_str_equal, g_free, g_free); #ifdef G_OS_UNIX g_unix_signal_add (SIGINT, korva_server_signal_handler, self); #endif korva_server_reset_timeout (self); }
gboolean init_gdbus (void) { GError *error = NULL; connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error); if (error) { g_warning ("could not get system bus: %s\n", error->message); g_error_free (error); return FALSE; } g_dbus_connection_set_exit_on_close (connection, FALSE); g_signal_connect (connection, "closed", G_CALLBACK (connection_closed_cb), NULL); g_bus_own_name (G_BUS_TYPE_SESSION, RSS_DBUS_SERVICE, G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT, on_bus_acquired, on_name_acquired, on_name_lost, NULL, NULL); return FALSE; }
int main(int argc, char *argv[]) { GMainLoop *loop; guint bus; loop = g_main_loop_new(NULL, FALSE); bus = g_bus_own_name(G_BUS_TYPE_SYSTEM, "org.freedesktop.login1", G_BUS_NAME_OWNER_FLAGS_NONE, on_bus_acquired, on_name_acquired, on_name_lost, loop, NULL); /* create /run/systemd/seats, since that's how GDM checks whether logind is * running - see LOGIND_RUNNING() */ if (-1 == g_mkdir_with_parents("/run/systemd/seats", 0755)) goto cleanup; g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, "entering the main loop"); g_main_loop_run(loop); g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, "exited the main loop"); cleanup: signals_unsubscribe(); bus_close(); g_main_loop_unref(loop); g_bus_unown_name(bus); return 0; }
int main (int argc, char *argv[]) { guint owner_id; GMainLoop *loop; g_type_init (); /* We are lazy here - we don't want to manually provide * the introspection data structures - so we just build * them from XML. */ introspection_data = g_dbus_node_info_new_for_xml (introspection_xml, NULL); g_assert (introspection_data != NULL); owner_id = g_bus_own_name (G_BUS_TYPE_SESSION, "org.gtk.GDBus.TestServer", G_BUS_NAME_OWNER_FLAGS_NONE, on_bus_acquired, on_name_acquired, on_name_lost, NULL, NULL); loop = g_main_loop_new (NULL, FALSE); g_main_loop_run (loop); g_bus_unown_name (owner_id); g_dbus_node_info_unref (introspection_data); return 0; }
/* Builds up the core objects and puts us spinning into a main loop. */ int main (int argc, char ** argv) { guint nameownership = g_bus_own_name(G_BUS_TYPE_SESSION, INDICATOR_APPLICATION_DBUS_ADDR, G_BUS_NAME_OWNER_FLAGS_NONE, bus_acquired, name_acquired, name_lost, NULL, NULL); /* Building and executing our main loop */ mainloop = g_main_loop_new(NULL, FALSE); g_main_loop_run(mainloop); g_debug("Finishing Main Loop"); g_bus_unown_name(nameownership); /* Unref'ing all the objects */ g_main_loop_unref(mainloop); g_object_unref(G_OBJECT(watcher)); g_object_unref(G_OBJECT(appstore)); return 0; }
int main (int argc, char ** argv) { GMainLoop * loop = NULL; bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); setlocale (LC_ALL, ""); bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR); /* Build Mainloop */ loop = g_main_loop_new(NULL, FALSE); g_unix_signal_add(SIGTERM, sigterm_handler, loop); /* Initialize libnotify */ notify_init ("indicator-sound"); g_bus_own_name(G_BUS_TYPE_SESSION, "com.canonical.indicator.sound", G_BUS_NAME_OWNER_FLAGS_NONE, on_bus_acquired, NULL, /* name acquired */ on_name_lost, loop, NULL); g_main_loop_run(loop); g_clear_object(&service); g_clear_pointer(&pgloop, pa_glib_mainloop_free); notify_uninit(); return 0; }
int main (int argc, char *argv[]) { guint owner_id; GMainLoop *loop; GBusNameOwnerFlags flags; gboolean opt_replace; gboolean opt_allow_replacement; gchar *opt_name; GOptionContext *opt_context; GError *error; GOptionEntry opt_entries[] = { { "replace", 'r', 0, G_OPTION_ARG_NONE, &opt_replace, "Replace existing name if possible", NULL }, { "allow-replacement", 'a', 0, G_OPTION_ARG_NONE, &opt_allow_replacement, "Allow replacement", NULL }, { "name", 'n', 0, G_OPTION_ARG_STRING, &opt_name, "Name to acquire", NULL }, { NULL} }; g_type_init (); error = NULL; opt_name = NULL; opt_replace = FALSE; opt_allow_replacement = FALSE; opt_context = g_option_context_new ("g_bus_own_name() example"); g_option_context_add_main_entries (opt_context, opt_entries, NULL); if (!g_option_context_parse (opt_context, &argc, &argv, &error)) { g_printerr ("Error parsing options: %s", error->message); return 1; } if (opt_name == NULL) { g_printerr ("Incorrect usage, try --help.\n"); return 1; } flags = G_BUS_NAME_OWNER_FLAGS_NONE; if (opt_replace) flags |= G_BUS_NAME_OWNER_FLAGS_REPLACE; if (opt_allow_replacement) flags |= G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT; owner_id = g_bus_own_name (G_BUS_TYPE_SESSION, opt_name, flags, on_bus_acquired, on_name_acquired, on_name_lost, NULL, NULL); loop = g_main_loop_new (NULL, FALSE); g_main_loop_run (loop); g_bus_unown_name (owner_id); return 0; }
int main(int argc, char * argv[]) { guint owner_id; GMainLoop *loop; introspection_data = g_dbus_node_info_new_for_xml (introspection_xml, NULL); g_assert (introspection_data != NULL); printf("g_bus_own_name\n"); owner_id = g_bus_own_name (G_BUS_TYPE_SESSION, GSTSWITCH_BUS_NAME, G_BUS_NAME_OWNER_FLAGS_NONE, &bus_acquired_cb, &bus_name_acquired_cb, &bus_name_lost_cb, /*user_data*/ NULL, /*user_data_free_func*/ NULL); printf("g_bus_own_name done, entering mainloop\n"); loop = g_main_loop_new (NULL, FALSE); g_main_loop_run (loop); g_bus_unown_name (owner_id); g_dbus_node_info_unref (introspection_data); return 0; }
int main (int argc, char *argv[]) { GMainLoop *loop = NULL; guint name_owner_id = 0; GduSdMonitor *monitor = NULL; notify_init ("test-gdusdplugin"); loop = g_main_loop_new (NULL, FALSE); /* The reason for claiming a unique name is so it's easier to test * code changes - it helps ensure that only one instance of * GduSdMonitor is running at any one time. See also * gdusdplugin.c:impl_activate(). */ name_owner_id = g_bus_own_name (G_BUS_TYPE_SESSION, "org.gnome.Disks.NotificationMonitor", G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT | G_BUS_NAME_OWNER_FLAGS_REPLACE, NULL, /* bus_acquired_handler */ name_acquired_handler, name_lost_handler, &monitor, NULL); /* GDestroyNotify */ g_main_loop_run (loop); g_bus_unown_name (name_owner_id); g_main_loop_unref (loop); g_object_unref (monitor); return 0; }
gint main (gint argc, const gchar * const argv[]) { EmerDaemon *daemon = make_daemon (argc, argv); if (daemon == NULL) return EXIT_FAILURE; GMainLoop *main_loop = g_main_loop_new (NULL, TRUE); // Shut down on any of these signals. g_unix_signal_add (SIGHUP, (GSourceFunc) quit_main_loop, main_loop); g_unix_signal_add (SIGINT, (GSourceFunc) quit_main_loop, main_loop); g_unix_signal_add (SIGTERM, (GSourceFunc) quit_main_loop, main_loop); g_unix_signal_add (SIGUSR1, (GSourceFunc) quit_main_loop, main_loop); g_unix_signal_add (SIGUSR2, (GSourceFunc) quit_main_loop, main_loop); guint name_id = g_bus_own_name (G_BUS_TYPE_SYSTEM, "com.endlessm.Metrics", G_BUS_NAME_OWNER_FLAGS_NONE, on_bus_acquired, NULL /* name_acquired_callback */, on_name_lost, daemon, NULL /* user data free func */); g_main_loop_run (main_loop); g_object_unref (daemon); g_bus_unown_name (name_id); g_main_loop_unref (main_loop); return EXIT_SUCCESS; }
int main (int argc, char **argv) { GError *error; GOptionContext *opt_context = NULL; gint ret = 1; guint name_owner_id = 0; setlocale (LC_ALL, ""); bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); opt_context = g_option_context_new ("GNOME Online Accounts daemon"); g_option_context_add_main_entries (opt_context, opt_entries, NULL); error = NULL; if (!g_option_context_parse (opt_context, &argc, &argv, &error)) { g_critical ("Error parsing options: %s", error->message); g_error_free (error); goto out; } g_message ("goa-daemon version %s starting", PACKAGE_VERSION); loop = g_main_loop_new (NULL, FALSE); if (!opt_no_sigint) { g_unix_signal_add (SIGINT, on_sigint, NULL); } name_owner_id = g_bus_own_name (G_BUS_TYPE_SESSION, "org.gnome.OnlineAccounts", G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT | (opt_replace ? G_BUS_NAME_OWNER_FLAGS_REPLACE : 0), on_bus_acquired, on_name_acquired, on_name_lost, NULL, NULL); g_debug ("Entering main event loop"); g_main_loop_run (loop); ret = 0; out: g_clear_object (&the_daemon); if (name_owner_id != 0) g_bus_unown_name (name_owner_id); g_clear_pointer (&loop, (GDestroyNotify) g_main_loop_unref); g_clear_pointer (&opt_context, (GDestroyNotify) g_option_context_free); g_message ("goa-daemon version %s exiting", PACKAGE_VERSION); return ret; }
gint main (gint argc, gchar *argv[]) { GMainLoop *loop; cmdline cmd; cmd.argc = argc; cmd.argv = argv; guint id; loop = g_main_loop_new (NULL, FALSE); id = g_bus_own_name (DBUS_TYPE, dbus_name, G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT | G_BUS_NAME_OWNER_FLAGS_REPLACE, on_bus_acquired, on_name_acquired, on_name_lost, &cmd, NULL); g_main_loop_run (loop); g_bus_unown_name (id); g_main_loop_unref (loop); return 0; }
int main (int argc, char **argv) { guint name_owner_id; g_type_init (); introspection_data = g_dbus_node_info_new_for_xml (introspection_xml, NULL); g_assert (introspection_data != NULL); ensure_autoquit_on (); loop = g_main_loop_new (NULL, FALSE); name_owner_id = g_bus_own_name (G_BUS_TYPE_SESSION, BUS_NAME, 0, on_bus_acquired, on_name_acquired, on_name_lost, NULL, NULL); g_main_loop_run (loop); if (name_owner_id != 0) g_bus_unown_name (name_owner_id); if (loop != NULL) g_main_loop_unref (loop); return 0; }
gint main(gint argc, gchar *argv[]) { GMainLoop *loop; ObjectSkeleton *newobject; newobject = object_skeleton_new(object_name); guint id; loop = g_main_loop_new(NULL, FALSE); id = g_bus_own_name(DBUS_TYPE, dbus_name, G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT | G_BUS_NAME_OWNER_FLAGS_REPLACE, on_bus_acquired, on_name_acquired, on_name_lost, newobject, NULL); g_main_loop_run(loop); g_bus_unown_name(id); g_object_unref(newobject); g_main_loop_unref(loop); return 0; }
void bus_server_init (void) { dbus = bus_dbus_impl_get_default (); ibus = bus_ibus_impl_get_default (); bus_dbus_impl_register_object (dbus, (IBusService *)ibus); /* init server */ GDBusServerFlags flags = G_DBUS_SERVER_FLAGS_AUTHENTICATION_ALLOW_ANONYMOUS; gchar *guid = g_dbus_generate_guid (); server = g_dbus_server_new_sync ( g_address, /* the place where the socket file lives, e.g. /tmp, abstract namespace, etc. */ flags, guid, NULL /* observer */, NULL /* cancellable */, NULL /* error */); g_free (guid); g_signal_connect (server, "new-connection", G_CALLBACK (bus_new_connection_cb), NULL); g_dbus_server_start (server); address = g_strdup_printf ("%s,guid=%s", g_dbus_server_get_client_address (server), g_dbus_server_get_guid (server)); /* write address to file */ ibus_write_address (address); /* own a session bus name so that third parties can easily track our life-cycle */ g_bus_own_name (G_BUS_TYPE_SESSION, IBUS_SERVICE_IBUS, G_BUS_NAME_OWNER_FLAGS_NONE, NULL, NULL, NULL, NULL, NULL); }
static void * connman_thread(void *aux) { GError *err; GDBusProxy *mgr; GMainContext *ctx = g_main_context_new(); GMainLoop *mainloop = g_main_loop_new(ctx, FALSE); connman_courier = glib_courier_create(ctx); g_main_context_push_thread_default(ctx); again: err = NULL; mgr = g_dbus_proxy_new_for_bus_sync(G_BUS_TYPE_SYSTEM, G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START , NULL, "net.connman", "/", "net.connman.Manager", NULL, &err); if(mgr == NULL) { TRACE(TRACE_ERROR, "CONNMAN", "Unable to connect to connman -- %s", err->message); g_error_free(err); sleep(5); goto again; } g_signal_connect(G_OBJECT(mgr), "g-signal", G_CALLBACK(connman_mgr_signal), NULL); g_bus_own_name(G_BUS_TYPE_SYSTEM, "com.showtimemediacenter.showtime.network.agent", G_BUS_NAME_OWNER_FLAGS_NONE, on_bus_acquired, on_name_acquired, on_name_lost, mgr, NULL); connman_getpropreties(mgr); connman_getservices(mgr); connman_gettechnologies(mgr); if(have_wifi) { setting_create(SETTING_BOOL, connman_settings, SETTINGS_INITIAL_UPDATE, SETTING_TITLE(_p("Enable Wi-Fi")), SETTING_CALLBACK(set_wifi_enable, NULL), SETTING_STORE("connman", "enable_wifi"), NULL); } g_main_loop_run(mainloop); return NULL; }
static gpointer infinoted_plugin_dbus_thread_func(gpointer plugin_info) { InfinotedPluginDbus* plugin; plugin = (InfinotedPluginDbus*)plugin_info; g_mutex_lock(&plugin->mutex); if(plugin->thread == NULL) { g_mutex_unlock(&plugin->mutex); return NULL; } plugin->context = g_main_context_new(); g_main_context_push_thread_default(plugin->context); plugin->loop = g_main_loop_new(plugin->context, FALSE); g_mutex_unlock(&plugin->mutex); plugin->id = g_bus_own_name( plugin->bus_type, plugin->bus_name, G_BUS_NAME_OWNER_FLAGS_NONE, infinoted_plugin_dbus_bus_acquired_func, infinoted_plugin_dbus_name_acquired_func, infinoted_plugin_dbus_name_lost_func, plugin, NULL ); g_main_loop_run(plugin->loop); g_bus_unown_name(plugin->id); plugin->id = 0; /* TODO: This is an enormous hack. Apparently, g_bus_own_name starts some * thread internally, and that thread is not stopped by g_bus_unown_name. * When the plugin is then unloaded, it leads to a crash because the thread * is still doing some cleanup work. I don't see a possibility for us here * to wait for that thread to finish, so we simply wait 100ms. * * Waiting with quitting the main loop until either bus_acquired or * name_lost are called does not help. * * A solution might be to not use the g_bus_own_name and g_bus_unown_name * APIs, but some more low-level APIs. */ g_usleep(100000); g_mutex_lock(&plugin->mutex); g_main_loop_unref(plugin->loop); plugin->loop = NULL; g_main_context_unref(plugin->context); plugin->context = NULL; g_mutex_unlock(&plugin->mutex); return NULL; }
int main (int argc, char *argv[]) { guint owner_id; g_autoptr(GError) error = NULL; GDBusConnection *session_bus; GOptionContext *context; setlocale (LC_ALL, ""); bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); /* Avoid even loading gvfs to avoid accidental confusion */ g_setenv ("GIO_USE_VFS", "local", TRUE); gtk_init (&argc, &argv); context = g_option_context_new ("- file chooser portal"); g_option_context_add_main_entries (context, entries, NULL); if (!g_option_context_parse (context, &argc, &argv, &error)) { g_printerr ("option parsing failed: %s\n", error->message); return 1; } if (opt_verbose) g_log_set_handler (NULL, G_LOG_LEVEL_DEBUG, message_handler, NULL); g_set_prgname (argv[0]); loop = g_main_loop_new (NULL, FALSE); outstanding_handles = g_hash_table_new (g_str_hash, g_str_equal); session_bus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error); if (session_bus == NULL) { g_printerr ("No session bus: %s\n", error->message); return 2; } owner_id = g_bus_own_name (G_BUS_TYPE_SESSION, "org.freedesktop.impl.portal.desktop.gtk", G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT | (opt_replace ? G_BUS_NAME_OWNER_FLAGS_REPLACE : 0), on_bus_acquired, on_name_acquired, on_name_lost, NULL, NULL); g_main_loop_run (loop); g_bus_unown_name (owner_id); return 0; }
static void tcmmd_dbus_init (TcmmdDbus *self) { self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, TCMMD_TYPE_DBUS, TcmmdDbusPrivate); self->priv->own_name_id = g_bus_own_name (G_BUS_TYPE_SYSTEM, "org.tcmmd", G_BUS_NAME_OWNER_FLAGS_NONE, on_bus_acquired, NULL, on_name_lost, self, NULL); }
int main (int argc, char **argv) { guint owner_id; GMainLoop *loop; GOptionContext *context; g_autoptr(GError) error = NULL; setlocale (LC_ALL, ""); g_setenv ("GIO_USE_VFS", "local", TRUE); g_set_prgname (argv[0]); flatpak_migrate_from_xdg_app (); g_set_printerr_handler (printerr_handler); context = g_option_context_new ("- permission store"); g_option_context_add_main_entries (context, entries, NULL); if (!g_option_context_parse (context, &argc, &argv, &error)) { g_printerr ("Option parsing failed: %s", error->message); return 1; } if (opt_version) { g_print ("%s\n", PACKAGE_STRING); exit (EXIT_SUCCESS); } if (opt_verbose) g_log_set_handler (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, message_handler, NULL); g_set_prgname (argv[0]); owner_id = g_bus_own_name (G_BUS_TYPE_SESSION, "org.freedesktop.impl.portal.PermissionStore", G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT | (opt_replace ? G_BUS_NAME_OWNER_FLAGS_REPLACE : 0), on_bus_acquired, on_name_acquired, on_name_lost, NULL, NULL); loop = g_main_loop_new (NULL, FALSE); g_main_loop_run (loop); g_bus_unown_name (owner_id); return 0; }
int main (int argc, char *argv[]) { guint owner_id; g_autoptr(GError) error = NULL; GDBusConnection *session_bus; GOptionContext *context; setlocale (LC_ALL, ""); /* Avoid even loading gvfs to avoid accidental confusion */ g_setenv ("GIO_USE_VFS", "local", TRUE); g_set_printerr_handler (printerr_handler); context = g_option_context_new ("- desktop portal"); g_option_context_add_main_entries (context, entries, NULL); if (!g_option_context_parse (context, &argc, &argv, &error)) { g_printerr ("Option parsing failed: %s", error->message); return 1; } if (opt_verbose) g_log_set_handler (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, message_handler, NULL); g_set_prgname (argv[0]); load_installed_portals (); loop = g_main_loop_new (NULL, FALSE); session_bus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error); if (session_bus == NULL) { g_printerr ("No session bus: %s", error->message); return 2; } owner_id = g_bus_own_name (G_BUS_TYPE_SESSION, "org.freedesktop.portal.Desktop", G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT | (opt_replace ? G_BUS_NAME_OWNER_FLAGS_REPLACE : 0), on_bus_acquired, on_name_acquired, on_name_lost, NULL, NULL); g_main_loop_run (loop); g_bus_unown_name (owner_id); return 0; }
static void bus_register (void) { name_id = g_bus_own_name (G_BUS_TYPE_SESSION, CSD_DBUS_NAME, G_BUS_NAME_OWNER_FLAGS_NONE, NULL, (GBusNameAcquiredCallback) name_acquired_handler, (GBusNameLostCallback) name_lost_handler, NULL, NULL); gnome_name_id = g_bus_own_name (G_BUS_TYPE_SESSION, GSD_DBUS_NAME, G_BUS_NAME_OWNER_FLAGS_NONE, NULL, (GBusNameAcquiredCallback) name_acquired_handler, (GBusNameLostCallback) name_lost_handler, NULL, NULL); }
extern "C" void webkit_web_extension_initialize(WebKitWebExtension* extension) { g_bus_own_name( G_BUS_TYPE_SESSION, "org.webkit.gtk.WebExtensionTest", G_BUS_NAME_OWNER_FLAGS_NONE, busAcquiredCallback, 0, 0, g_object_ref(extension), static_cast<GDestroyNotify>(g_object_unref)); }
static guint acquire_name (void) { return g_bus_own_name (G_BUS_TYPE_SESSION, GSM_DBUS_NAME, G_BUS_NAME_OWNER_FLAGS_NONE, on_bus_acquired, NULL, on_name_lost, NULL, NULL); }
int main (int argc, char **argv) { guint owner_id; GError *error = NULL; GOptionContext *context; GClueConfig *config; setlocale (LC_ALL, ""); textdomain (GETTEXT_PACKAGE); bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); g_set_application_name (_("GeoClue")); context = g_option_context_new ("- Geoclue D-Bus service"); g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE); if (!g_option_context_parse (context, &argc, &argv, &error)) { g_critical ("option parsing failed: %s\n", error->message); exit (-1); } g_option_context_free (context); if (version) { g_print ("%s\n", PACKAGE_VERSION); exit (0); } config = gclue_config_get_singleton (); if (submit_data) gclue_config_set_wifi_submit_data (config, submit_data); if (submit_nick != NULL) gclue_config_set_wifi_submit_nick (config, submit_nick); owner_id = g_bus_own_name (G_BUS_TYPE_SYSTEM, BUS_NAME, G_BUS_NAME_OWNER_FLAGS_NONE, on_bus_acquired, NULL, on_name_lost, NULL, NULL); main_loop = g_main_loop_new (NULL, FALSE); g_main_loop_run (main_loop); if (manager != NULL) g_object_unref (manager); g_bus_unown_name (owner_id); g_main_loop_unref (main_loop); return 0; }
static void gst_switch_controller_export (GstSwitchController * controller) { controller->owner_id = g_bus_own_name (G_BUS_TYPE_SESSION, SWITCH_CONTROLLER_OBJECT_NAME, G_BUS_NAME_OWNER_FLAGS_NONE, gst_switch_controller_bus_acquired, gst_switch_controller_name_acquired, gst_switch_controller_name_lost, controller, NULL); INFO ("TODO: export"); }
static void nautilus_freedesktop_dbus_init (NautilusFreedesktopDBus *fdb) { fdb->owner_id = g_bus_own_name (G_BUS_TYPE_SESSION, NAUTILUS_FDO_DBUS_NAME, G_BUS_NAME_OWNER_FLAGS_NONE, bus_acquired_cb, name_acquired_cb, name_lost_cb, fdb, NULL); }