/* D-Bus has an upper limit on number of Match rules and it's rather easy * to hit as the proxy likes to add one for each object. Let's remove the Match * rule the proxy added and ensure a less granular rule is present instead. * * Also, don't do this immediately since it has a performance penalty. * Still better than loosing the signals altogether. * * Ideally, we should be able to tell glib not to hook its rules: * https://bugzilla.gnome.org/show_bug.cgi?id=758749 */ static void _nm_dbus_proxy_replace_match (GDBusProxy *proxy) { GDBusConnection *connection = g_dbus_proxy_get_connection (proxy); static unsigned match_counter = 1024; gchar *match; nm_assert (!g_strcmp0 (g_dbus_proxy_get_name (proxy), NM_DBUS_SERVICE)); if (match_counter == 1) { /* If we hit the low matches watermark, install a * less granular one. */ g_dbus_connection_call (connection, "org.freedesktop.DBus", "/org/freedesktop/DBus", "org.freedesktop.DBus", "AddMatch", g_variant_new ("(s)", "type='signal',sender='" NM_DBUS_SERVICE "'"), NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL, NULL); } if (match_counter) match_counter--; if (match_counter) return; /* Remove what this proxy added. */ match = g_strdup_printf ("type='signal',sender='" NM_DBUS_SERVICE "'," "interface='%s',path='%s'", g_dbus_proxy_get_interface_name (proxy), g_dbus_proxy_get_object_path (proxy)); g_dbus_connection_call (connection, "org.freedesktop.DBus", "/org/freedesktop/DBus", "org.freedesktop.DBus", "RemoveMatch", g_variant_new ("(s)", match), NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL, NULL); g_free (match); }
static void libreoffice_missing (NemoPreviewPdfLoader *self) { GApplication *app = g_application_get_default (); GtkWidget *widget = GTK_WIDGET (gtk_application_get_active_window (GTK_APPLICATION (app))); GDBusConnection *connection = g_application_get_dbus_connection (app); guint xid = 0; GdkWindow *gdk_window; const gchar *libreoffice_path[2]; gdk_window = gtk_widget_get_window (widget); if (gdk_window != NULL) xid = GDK_WINDOW_XID (gdk_window); libreoffice_path[0] = "/usr/bin/libreoffice"; libreoffice_path[1] = NULL; g_dbus_connection_call (connection, "org.freedesktop.PackageKit", "/org/freedesktop/PackageKit", "org.freedesktop.PackageKit.Modify", "InstallProvideFiles", g_variant_new ("(u^ass)", xid, libreoffice_path, "hide-confirm-deps"), NULL, G_DBUS_CALL_FLAGS_NONE, G_MAXINT, NULL, libreoffice_missing_ready_cb, self); }
EXPORT_API int tel_req_sap_power_operation(TapiHandle *handle, TelSimSapPowerMode_t power_mode, tapi_response_cb callback, void *user_data) { struct tapi_resp_data *evt_cb_data = NULL; GVariant *param = NULL; gint mode = 0; dbg("Func Entrance w/ power_mode[%d]", power_mode); MAKE_RESP_CB_DATA(evt_cb_data, handle, callback, user_data); switch (power_mode) { case TAPI_SIM_SAP_POWER_SIM_ON_REQ: mode = 0; break; case TAPI_SIM_SAP_POWER_SIM_OFF_REQ: mode =1; break; case TAPI_SIM_SAP_RESET_SIM_REQ: mode = 2; break; default: dbg("not handed value[%d]", power_mode); break; } param = g_variant_new("(i)", mode); g_dbus_connection_call(handle->dbus_connection, DBUS_TELEPHONY_SERVICE, handle->path, DBUS_TELEPHONY_SAP_INTERFACE, "SetPower", param, NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, on_response_sap_power_operation, evt_cb_data); return TAPI_API_SUCCESS; }
void screenshot_select_area_async (SelectAreaCallback callback, gpointer callback_data) { CallbackData *cb_data; GDBusConnection *connection; cb_data = g_slice_new0 (CallbackData); cb_data->callback = callback; cb_data->callback_data = callback_data; connection = g_application_get_dbus_connection (g_application_get_default ()); g_dbus_connection_call (connection, "org.gnome.Shell.Screenshot", "/org/gnome/Shell/Screenshot", "org.gnome.Shell.Screenshot", "SelectArea", NULL, NULL, G_DBUS_CALL_FLAGS_NONE, G_MAXINT, NULL, select_area_done, cb_data); }
EXPORT_API int tel_req_sap_transfer_apdu(TapiHandle *handle, TelSapApduData_t *apdu_data, tapi_response_cb callback, void *user_data) { struct tapi_resp_data *evt_cb_data = NULL; GVariantBuilder *builder = NULL; GVariant *param = NULL; GVariant *inner_gv = NULL; int i = 0; dbg("Func Entrance"); TAPI_RETURN_VAL_IF_FAIL(apdu_data, TAPI_API_INVALID_PTR); MAKE_RESP_CB_DATA(evt_cb_data, handle, callback, user_data); builder = g_variant_builder_new(G_VARIANT_TYPE ("ay")); for (i = 0; i < apdu_data->apdu_len; i++) { dbg("apdu_data->apdu_data[%d][0x%02x]", i,apdu_data->apdu_data[i]); g_variant_builder_add(builder, "y", apdu_data->apdu_data[i]); } inner_gv = g_variant_builder_end(builder); param = g_variant_new("(v)", inner_gv); /*g_variant_builder_unref (builder);*/ g_dbus_connection_call(handle->dbus_connection, DBUS_TELEPHONY_SERVICE, handle->path, DBUS_TELEPHONY_SAP_INTERFACE, "TransferAPDU", param, NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, on_response_sap_transfer_apdu, evt_cb_data); return TAPI_API_SUCCESS; }
void nemo_previewer_call_show_file (NemoPreviewer *self, const gchar *uri, guint xid, gboolean close_if_already_visible) { if (self->priv->connection == NULL) { g_printerr ("No DBus connection available"); return; } g_dbus_connection_call (self->priv->connection, PREVIEWER_DBUS_NAME, PREVIEWER_DBUS_PATH, PREVIEWER_DBUS_IFACE, "ShowFile", g_variant_new ("(sib)", uri, xid, close_if_already_visible), NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, previewer_show_file_ready_cb, g_object_ref (self)); }
static void has_connection (Client *client) { /* listen for disconnection */ client->disconnected_signal_handler_id = g_signal_connect (client->connection, "closed", G_CALLBACK (on_connection_disconnected), client); /* attempt to acquire the name */ g_dbus_connection_call (client->connection, "org.freedesktop.DBus", /* bus name */ "/org/freedesktop/DBus", /* object path */ "org.freedesktop.DBus", /* interface name */ "RequestName", /* method name */ g_variant_new ("(su)", client->name, client->flags), G_VARIANT_TYPE ("(u)"), G_DBUS_CALL_FLAGS_NONE, -1, NULL, (GAsyncReadyCallback) request_name_cb, client_ref (client)); }
void set_system_timezone_async (const gchar *tz, GAsyncReadyCallback callback, gpointer user_data) { GDBusConnection *system_bus; GError *error = NULL; system_bus = get_system_bus (&error); if (system_bus == NULL) { GSimpleAsyncResult *simple; simple = g_simple_async_result_new (NULL, callback, user_data, set_system_timezone_async); g_simple_async_result_set_from_error (simple, error); g_simple_async_result_complete_in_idle (simple); g_object_unref (simple); g_error_free (error); } g_dbus_connection_call (system_bus, MECHANISM_BUS_NAME, MECHANISM_OBJECT_PATH, MECHANISM_INTERFACE, "SetTimezone", g_variant_new ("(s)", tz), NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, callback, user_data); }
static void pdf_load_job_openoffice_missing_unoconv (PdfLoadJob *job) { GApplication *app = g_application_get_default (); GtkWidget *widget = GTK_WIDGET (gtk_application_get_active_window (GTK_APPLICATION (app))); GDBusConnection *connection = g_application_get_dbus_connection (app); guint xid = 0; GdkWindow *gdk_window; const gchar *unoconv_path[2]; gdk_window = gtk_widget_get_window (widget); if (gdk_window != NULL) xid = GDK_WINDOW_XID (gdk_window); unoconv_path[0] = "/usr/bin/unoconv"; unoconv_path[1] = NULL; g_dbus_connection_call (connection, "org.freedesktop.PackageKit", "/org/freedesktop/PackageKit", "org.freedesktop.PackageKit.Modify", "InstallProvideFiles", g_variant_new ("(u^ass)", xid, unoconv_path, "hide-confirm-deps"), NULL, G_DBUS_CALL_FLAGS_NONE, G_MAXINT, job->cancellable, openoffice_missing_unoconv_ready_cb, job); }
static int can_set (Cache *cache, const gchar *method_name) { guint64 now = g_get_monotonic_time (); if (now - cache->stamp > (CACHE_VALIDITY_SEC * 1000000)) { if (!cache->in_progress) { GDBusConnection *system_bus = get_system_bus (NULL); if (system_bus != NULL) g_dbus_connection_call (system_bus, MECHANISM_BUS_NAME, MECHANISM_OBJECT_PATH, MECHANISM_INTERFACE, method_name, NULL, G_VARIANT_TYPE ("(i)"), G_DBUS_CALL_FLAGS_NONE, -1, NULL, can_set_call_finished, cache); /* Even if the system bus was NULL, we want to set this in * order to effectively wedge ourselves from ever trying * again. */ cache->in_progress = TRUE; } } return cache->value; }
void firewall_ui_setup (NMSettingConnection *setting, GtkWidget *combo, GCancellable *cancellable) { GDBusConnection *bus; GetZonesReplyData *d; bus = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, NULL); d = g_new0 (GetZonesReplyData, 1); d->zone = nm_setting_connection_get_zone (setting); d->combo = combo; g_dbus_connection_call (bus, "org.fedoraproject.FirewallD1", "/org/fedoraproject/FirewallD1", "org.fedoraproject.FirewallD1.zone", "getZones", NULL, NULL, 0, G_MAXINT, cancellable, get_zones_reply, d); g_object_unref (bus); }
static void nautilus_application_select (NautilusApplication *self, GFile **files, gint len) { GDBusConnection *connection = g_application_get_dbus_connection (G_APPLICATION (self)); GVariantBuilder builder; gint idx; gchar *uri; g_variant_builder_init (&builder, G_VARIANT_TYPE ("as")); for (idx = 0; idx < len; idx++) { uri = g_file_get_uri (files[idx]); g_variant_builder_add (&builder, "s", uri); g_free (uri); } g_dbus_connection_call (connection, NAUTILUS_FDO_DBUS_NAME, NAUTILUS_FDO_DBUS_PATH, NAUTILUS_FDO_DBUS_IFACE, "ShowItems", g_variant_new ("(ass)", &builder, ""), NULL, G_DBUS_CALL_FLAGS_NONE, G_MAXINT, NULL, select_items_ready_cb, self); g_variant_builder_clear (&builder); }
static void current_service_enabled_cb(GObject *source, GAsyncResult *res, gpointer user_data) { struct cb_data *cbd = user_data; struct ofono_wan_data *od = cbd->user; wan_result_cb cb = cbd->cb; struct wan_error werror; GError *error = 0; GDBusConnection *conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, NULL); GVariant *result = g_dbus_connection_call_finish(conn, res, &error); if (error) { g_warning("Failed to %s current cellular service %s: %s", !od->pending_configuration->disablewan ? "enable" : "disable", od->current_service_path, error->message); g_error_free(error); werror.code = WAN_ERROR_FAILED; cb(&werror, cbd->data); g_free(cbd); return; } g_variant_unref(result); g_dbus_connection_call(conn, "net.connman", od->current_service_path, "net.connman.Service", "SetProperty", g_variant_new("(sv)", "AutoConnect", g_variant_new_boolean(!od->pending_configuration->disablewan)), NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, current_service_autoconnect_set_cb, od); }
static void get_screenshot_async (CcBackgroundPanel *panel) { CcBackgroundPanelPrivate *priv = panel->priv; gchar *path, *tmpname; const gchar *method_name; GVariant *method_params; GtkWidget *widget; ScreenshotData *data; int primary; data = g_new0 (ScreenshotData, 1); data->panel = panel; widget = WID ("background-desktop-drawingarea"); primary = gdk_screen_get_primary_monitor (gtk_widget_get_screen (widget)); gdk_screen_get_monitor_geometry (gtk_widget_get_screen (widget), primary, &data->monitor_rect); gdk_screen_get_monitor_workarea (gtk_widget_get_screen (widget), primary, &data->workarea_rect); if (calculate_contiguous_workarea (data)) { g_debug ("Capturing only a portion of the screen"); } else { g_debug ("Capturing the whole monitor"); data->whole_monitor = TRUE; data->capture_rect = data->monitor_rect; } g_debug ("Trying to capture rectangle %dx%d (at %d,%d)", data->capture_rect.width, data->capture_rect.height, data->capture_rect.x, data->capture_rect.y); path = g_build_filename (g_get_user_cache_dir (), "gnome-control-center", NULL); g_mkdir_with_parents (path, USER_DIR_MODE); tmpname = g_strdup_printf ("scr-%d.png", g_random_int ()); g_free (panel->priv->screenshot_path); panel->priv->screenshot_path = g_build_filename (path, tmpname, NULL); g_free (path); g_free (tmpname); method_name = "ScreenshotArea"; method_params = g_variant_new ("(iiiibs)", data->capture_rect.x, data->capture_rect.y, data->capture_rect.width, data->capture_rect.height, FALSE, /* flash */ panel->priv->screenshot_path); g_dbus_connection_call (panel->priv->connection, "org.gnome.Shell.Screenshot", "/org/gnome/Shell/Screenshot", "org.gnome.Shell.Screenshot", method_name, method_params, NULL, G_DBUS_CALL_FLAGS_NONE, -1, priv->capture_cancellable, on_screenshot_finished, data); }
void _callMethod(const char *bus_name, const char *path, const char *iface, const char *method, GVariant *params) { if (GDBusConnection *conn = getConnection()) { g_dbus_connection_call(conn, bus_name, path, iface, method, params, nullptr, G_DBUS_CALL_FLAGS_NONE, -1, nullptr, nullptr, nullptr); } }
static void switch_current_service_state(struct ofono_wan_data *od, bool enable, wan_result_cb cb, void *data) { GDBusConnection *conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, NULL); g_message("enable %d", enable); g_dbus_connection_call(conn, "net.connman", od->current_service_path, "net.connman.Service", enable ? "Connect" : "Disconnect", NULL, NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, (GAsyncReadyCallback) current_service_enabled_cb, data); }
/* * ev_application_register_uri: * @application: * @uri: * @screen: * @dest: * @mode: * @search_string: * @timestamp: * * Registers @uri with atril-daemon. * */ static void ev_application_register_uri (EvApplication *application, const gchar *uri, GdkScreen *screen, EvLinkDest *dest, EvWindowRunMode mode, const gchar *search_string, guint timestamp) { EvRegisterDocData *data; if (!application->connection) return; if (application->doc_registered) { /* Already registered, reload */ GList *windows, *l; windows = ev_application_get_windows (application); for (l = windows; l != NULL; l = g_list_next (l)) { EvWindow *ev_window = EV_WINDOW (l->data); ev_application_open_uri_in_window (application, uri, ev_window, screen, dest, mode, search_string, timestamp); } g_list_free (windows); return; } data = g_new (EvRegisterDocData, 1); data->uri = g_strdup (uri); data->screen = screen; data->dest = dest ? g_object_ref (dest) : NULL; data->mode = mode; data->search_string = search_string ? g_strdup (search_string) : NULL; data->timestamp = timestamp; g_dbus_connection_call (application->connection, ATRIL_DAEMON_SERVICE, ATRIL_DAEMON_OBJECT_PATH, ATRIL_DAEMON_INTERFACE, "RegisterDocument", g_variant_new ("(s)", uri), G_VARIANT_TYPE ("(s)"), G_DBUS_CALL_FLAGS_NONE, -1, NULL, on_register_uri_cb, data); }
/* * GDBusMenuGroup can be in three states: * * OFFLINE: not subscribed to this group * PENDING: we made the call to subscribe to this group, but the result * has not come back yet * ONLINE: we are fully subscribed * * We can get into some nasty situations where we make a call due to an * activation request but receive a deactivation request before the call * returns. If another activation request occurs then we could risk * sending a Start request even though one is already in progress. For * this reason, we have to carefully consider what to do in each of the * three states for each of the following situations: * * - activation requested * - deactivation requested * - Start call finishes * * To simplify things a bit, we do not have a callback for the Stop * call. We just send it and assume that it takes effect immediately. * * Activation requested: * OFFLINE: make the Start call and transition to PENDING * PENDING: do nothing -- call is already in progress. * ONLINE: this should not be possible * * Deactivation requested: * OFFLINE: this should not be possible * PENDING: do nothing -- handle it when the Start call finishes * ONLINE: send the Stop call and move to OFFLINE immediately * * Start call finishes: * OFFLINE: this should not be possible * PENDING: * If we should be active (ie: active count > 0): move to ONLINE * If not: send Stop call and move to OFFLINE immediately * ONLINE: this should not be possible * * We have to take care with regards to signal subscriptions (ie: * activation of the GDBusMenuPath). The signal subscription is always * established when transitioning from OFFLINE to PENDING and taken down * when transitioning to OFFLINE (from either PENDING or ONLINE). * * Since there are two places where we transition to OFFLINE, we split * that code out into a separate function. */ static void g_dbus_menu_group_go_offline (GDBusMenuGroup *group) { g_dbus_menu_path_deactivate (group->path); g_dbus_connection_call (group->path->id->connection, group->path->id->bus_name, group->path->id->object_path, "org.gtk.Menus", "End", g_variant_new_parsed ("([ %u ],)", group->id), NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL, NULL); group->state = GROUP_OFFLINE; }
static void content_chooser_done (GObject *object, GAsyncResult *result, gpointer user_data) { g_autoptr(GSubprocess) subprocess = G_SUBPROCESS (object); ContentChooserData *data = user_data; g_autoptr(GBytes) stdout_buf = NULL; g_autoptr(GError) error = NULL; const char *uri = NULL; g_autoptr (GFile) file = NULL; g_autoptr(GDBusConnection) connection = NULL; if (!g_subprocess_communicate_finish (subprocess, result, &stdout_buf, NULL, &error)) { g_dbus_method_invocation_return_error (data->invocation, XDP_ERROR, XDP_ERROR_FAILED, "Content chooser failed: %s", error->message); g_free (data); return; } if (!g_subprocess_get_if_exited (subprocess) || g_subprocess_get_exit_status (subprocess) != 0) { g_dbus_method_invocation_return_error (data->invocation, XDP_ERROR, XDP_ERROR_FAILED, "Content chooser exit %d", g_subprocess_get_exit_status (subprocess)); g_free (data); return; } uri = g_bytes_get_data (stdout_buf, NULL); file = g_file_new_for_uri (uri); data->basename = g_file_get_basename (file); connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL); g_dbus_connection_call (connection, "org.freedesktop.portal.Documents", "/org/freedesktop/portal/documents", "org.freedesktop.portal.Documents", "Add", g_variant_new ("(s)", uri), G_VARIANT_TYPE ("(u)"), G_DBUS_CALL_FLAGS_NONE, 30000, NULL, got_document_handle, data); }
static void g_dbus_action_group_async_init (GDBusActionGroup *group) { if (group->subscription_id != 0) return; group->subscription_id = g_dbus_connection_signal_subscribe (group->connection, group->bus_name, "org.gtk.Actions", "Changed", group->object_path, NULL, G_DBUS_SIGNAL_FLAGS_NONE, g_dbus_action_group_changed, group, NULL); g_dbus_connection_call (group->connection, group->bus_name, group->object_path, "org.gtk.Actions", "DescribeAll", NULL, G_VARIANT_TYPE ("(a{s(bgav)})"), G_DBUS_CALL_FLAGS_NONE, -1, NULL, g_dbus_action_group_describe_all_done, g_object_ref (group)); }
EXPORT_API int tel_req_sap_disconnect(TapiHandle *handle, tapi_response_cb callback, void *user_data) { struct tapi_resp_data *evt_cb_data = NULL; dbg("Func Entrance "); MAKE_RESP_CB_DATA(evt_cb_data, handle, callback, user_data); g_dbus_connection_call(handle->dbus_connection, DBUS_TELEPHONY_SERVICE, handle->path, DBUS_TELEPHONY_SAP_INTERFACE, "Disconnect", NULL, NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, on_response_sap_disconnect, evt_cb_data); return TAPI_API_SUCCESS; }
static void on_join_response (GtkDialog *dialog, gint response, gpointer user_data) { GisAccountPageEnterprise *page = user_data; GisAccountPageEnterprisePrivate *priv = gis_account_page_enterprise_get_instance_private (page); GDBusConnection *connection; GError *error = NULL; gchar hostname[128]; const gchar *name; gtk_widget_hide (GTK_WIDGET (dialog)); if (response != GTK_RESPONSE_OK) { apply_complete (page, FALSE); return; } name = gtk_entry_get_text (GTK_ENTRY (priv->join_computer)); if (gethostname (hostname, sizeof (hostname)) == 0 && !g_str_equal (name, hostname)) { g_debug ("Setting StaticHostname to '%s'", name); connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, priv->cancellable, &error); if (error != NULL) { apply_complete (page, FALSE); g_warning ("Could not get DBus connection: %s", error->message); g_error_free (error); return; } g_dbus_connection_call (connection, "org.freedesktop.hostname1", "/org/freedesktop/hostname1", "org.freedesktop.hostname1", "SetStaticHostname", g_variant_new ("(sb)", name, TRUE), G_VARIANT_TYPE ("()"), G_DBUS_CALL_FLAGS_NONE, G_MAXINT, NULL, on_set_static_hostname, page); } else { name = gtk_entry_get_text (GTK_ENTRY (priv->join_name)); g_debug ("Logging in as admin user: %s", name); /* Prompted for some admin credentials, try to use them to log in */ um_realm_login (priv->realm, name, gtk_entry_get_text (GTK_ENTRY (priv->join_password)), NULL, on_join_login, page); } }
static void systemd_hibernate (void) { GDBusConnection *bus; bus = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, NULL); g_dbus_connection_call (bus, SYSTEMD_DBUS_NAME, SYSTEMD_DBUS_PATH, SYSTEMD_DBUS_INTERFACE, "Hibernate", g_variant_new ("(b)", TRUE), NULL, 0, G_MAXINT, NULL, NULL, NULL); g_object_unref (bus); }
static void invoke_get_name_owner (Client *client) { g_dbus_connection_call (client->connection, "org.freedesktop.DBus", /* bus name */ "/org/freedesktop/DBus", /* object path */ "org.freedesktop.DBus", /* interface name */ "GetNameOwner", /* method name */ g_variant_new ("(s)", client->name), G_VARIANT_TYPE ("(s)"), G_DBUS_CALL_FLAGS_NONE, -1, NULL, (GAsyncReadyCallback) get_name_owner_cb, client_ref (client)); }
EXPORT_API int tel_req_sap_transport_protocol(TapiHandle *handle, TelSimSapProtocol_t protocol, tapi_response_cb callback, void *user_data) { struct tapi_resp_data *evt_cb_data = NULL; GVariant *param = NULL; dbg("Func Entrance w/ protocol[%d]", protocol); MAKE_RESP_CB_DATA(evt_cb_data, handle, callback, user_data); param = g_variant_new("(i)", protocol); g_dbus_connection_call(handle->dbus_connection, DBUS_TELEPHONY_SERVICE, handle->path, DBUS_TELEPHONY_SAP_INTERFACE, "SetProtocol", param, NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, on_response_sap_transport_protocol, evt_cb_data); return TAPI_API_SUCCESS; }
EXPORT_API int tel_req_sap_connect(TapiHandle *handle, int max_msg_size, tapi_response_cb callback, void *user_data) { struct tapi_resp_data *evt_cb_data = NULL; GVariant *param = NULL; dbg("Func Entrance w/ max_msg_size[%d]",max_msg_size); MAKE_RESP_CB_DATA(evt_cb_data, handle, callback, user_data); param = g_variant_new("(i)", max_msg_size); g_dbus_connection_call(handle->dbus_connection, DBUS_TELEPHONY_SERVICE, handle->path, DBUS_TELEPHONY_SAP_INTERFACE, "Connect", param, NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, on_response_sap_connect, evt_cb_data); return TAPI_API_SUCCESS; }
static void names_listed (GObject *object, GAsyncResult *result, gpointer user_data) { NamespaceWatcher *watcher; GError *error = NULL; GVariant *reply; GVariantIter *iter; const gchar *name; reply = g_dbus_connection_call_finish (G_DBUS_CONNECTION (object), result, &error); if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { g_error_free (error); return; } watcher = user_data; if (reply == NULL) { g_warning ("bus_watch_namespace: error calling org.freedesktop.DBus.ListNames: %s", error->message); g_error_free (error); return; } g_variant_get (reply, "(as)", &iter); while (g_variant_iter_next (iter, "&s", &name)) { if (dbus_name_has_namespace (name, watcher->name_space)) { GetNameOwnerData *data = g_slice_new (GetNameOwnerData); data->watcher = watcher; data->name = g_strdup (name); g_dbus_connection_call (watcher->connection, "org.freedesktop.DBus", "/", "org.freedesktop.DBus", "GetNameOwner", g_variant_new ("(s)", name), G_VARIANT_TYPE ("(s)"), G_DBUS_CALL_FLAGS_NONE, -1, watcher->cancellable, got_name_owner, data); } } g_variant_iter_free (iter); g_variant_unref (reply); }
void nm_bluez_device_connect_async (NMBluezDevice *self, NMBluetoothCapabilities connection_bt_type, GAsyncReadyCallback callback, gpointer user_data) { GSimpleAsyncResult *simple; NMBluezDevicePrivate *priv = NM_BLUEZ_DEVICE_GET_PRIVATE (self); const char *dbus_iface; const char *connect_type = BLUETOOTH_CONNECT_NAP; g_return_if_fail (priv->capabilities & connection_bt_type & (NM_BT_CAPABILITY_DUN | NM_BT_CAPABILITY_NAP)); if (priv->bluez_version == 5) { g_return_if_fail (connection_bt_type == NM_BT_CAPABILITY_NAP); dbus_iface = BLUEZ5_NETWORK_INTERFACE; } else if (priv->bluez_version == 4 && connection_bt_type == NM_BT_CAPABILITY_DUN) { dbus_iface = BLUEZ4_SERIAL_INTERFACE; connect_type = BLUETOOTH_CONNECT_DUN; } else { g_return_if_fail (priv->bluez_version == 4 && connection_bt_type == NM_BT_CAPABILITY_NAP); dbus_iface = BLUEZ4_NETWORK_INTERFACE; } simple = g_simple_async_result_new (G_OBJECT (self), callback, user_data, nm_bluez_device_connect_async); g_dbus_connection_call (priv->dbus_connection, BLUEZ_SERVICE, priv->path, dbus_iface, "Connect", g_variant_new ("(s)", connect_type), NULL, G_DBUS_CALL_FLAGS_NONE, 20000, NULL, (GAsyncReadyCallback) bluez_connect_cb, simple); priv->connection_bt_type = connection_bt_type; }
void nautilus_previewer_call_close (void) { GDBusConnection *connection = g_application_get_dbus_connection (g_application_get_default ()); /* don't autostart the previewer if it's not running */ g_dbus_connection_call (connection, PREVIEWER_DBUS_NAME, PREVIEWER_DBUS_PATH, PREVIEWER_DBUS_IFACE, "Close", NULL, NULL, G_DBUS_CALL_FLAGS_NO_AUTO_START, -1, NULL, previewer_close_ready_cb, NULL); }
static void bus_acquired_handler (GDBusConnection *connection, const gchar *name, gpointer user_data) { g_dbus_connection_call (connection, IBUS_SERVICE_PORTAL, IBUS_PATH_IBUS, "org.freedesktop.DBus.Peer", "Ping", g_variant_new ("()"), G_VARIANT_TYPE ("()"), G_DBUS_CALL_FLAGS_NONE, -1, NULL /* cancellable */, (GAsyncReadyCallback) _server_connect_start_portal_cb, NULL); }