当前位置: 首页>>代码示例>>C++>>正文


C++ dbus_g_proxy_connect_signal函数代码示例

本文整理汇总了C++中dbus_g_proxy_connect_signal函数的典型用法代码示例。如果您正苦于以下问题:C++ dbus_g_proxy_connect_signal函数的具体用法?C++ dbus_g_proxy_connect_signal怎么用?C++ dbus_g_proxy_connect_signal使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了dbus_g_proxy_connect_signal函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: modem_manager_appeared

static void
modem_manager_appeared (NMModemManager *self, gboolean enumerate_devices)
{
	NMModemManagerPrivate *priv = NM_MODEM_MANAGER_GET_PRIVATE (self);

	if (priv->poke_id) {
		g_source_remove (priv->poke_id);
		priv->poke_id = 0;
	}

	nm_log_info (LOGD_MB, "modem-manager is now available");

	priv->proxy = dbus_g_proxy_new_for_name (nm_dbus_manager_get_connection (priv->dbus_mgr),
											 MM_DBUS_SERVICE, MM_DBUS_PATH, MM_DBUS_INTERFACE);

	dbus_g_proxy_add_signal (priv->proxy, "DeviceAdded", DBUS_TYPE_G_OBJECT_PATH, G_TYPE_INVALID);
	dbus_g_proxy_connect_signal (priv->proxy, "DeviceAdded",
								 G_CALLBACK (modem_added), self,
								 NULL);

	dbus_g_proxy_add_signal (priv->proxy, "DeviceRemoved", DBUS_TYPE_G_OBJECT_PATH, G_TYPE_INVALID);
	dbus_g_proxy_connect_signal (priv->proxy, "DeviceRemoved",
								 G_CALLBACK (modem_removed), self,
								 NULL);

	if (enumerate_devices)
		dbus_g_proxy_begin_call (priv->proxy, "EnumerateDevices", enumerate_devices_done, self, NULL, G_TYPE_INVALID);
}
开发者ID:alfmatos,项目名称:NetworkManager,代码行数:28,代码来源:nm-modem-manager.c

示例2: bluez_connect

static void
bluez_connect (NMBluezManager *self)
{
    NMBluezManagerPrivate *priv = NM_BLUEZ_MANAGER_GET_PRIVATE (self);
    DBusGConnection *connection;

    g_return_if_fail (priv->proxy == NULL);

    connection = nm_dbus_manager_get_connection (priv->dbus_mgr);
    if (!connection)
        return;

    priv->proxy = dbus_g_proxy_new_for_name (connection,
                  BLUEZ_SERVICE,
                  BLUEZ_MANAGER_PATH,
                  BLUEZ_MANAGER_INTERFACE);

    dbus_g_proxy_add_signal (priv->proxy, "AdapterRemoved",
                             DBUS_TYPE_G_OBJECT_PATH, G_TYPE_INVALID);
    dbus_g_proxy_connect_signal (priv->proxy, "AdapterRemoved",
                                 G_CALLBACK (adapter_removed), self, NULL);

    dbus_g_proxy_add_signal (priv->proxy, "DefaultAdapterChanged",
                             DBUS_TYPE_G_OBJECT_PATH, G_TYPE_INVALID);
    dbus_g_proxy_connect_signal (priv->proxy, "DefaultAdapterChanged",
                                 G_CALLBACK (default_adapter_changed), self, NULL);

    query_default_adapter (self);
}
开发者ID:eugeni,项目名称:NetworkManager-mdv,代码行数:29,代码来源:nm-bluez-manager.c

示例3: g_udisks_volume_monitor_init

static void g_udisks_volume_monitor_init(GUDisksVolumeMonitor *self)
{
    self->con = dbus_g_bus_get(DBUS_BUS_SYSTEM, NULL);
    if(self->con)
    {
        GPtrArray* ret;
        /* FIXME: handle disconnecting from dbus */
        self->udisks_proxy = dbus_g_proxy_new_for_name(self->con, "org.freedesktop.UDisks", "/org/freedesktop/UDisks", "org.freedesktop.UDisks");

        if(org_freedesktop_UDisks_enumerate_devices(self->udisks_proxy, &ret, NULL))
        {
            int i;
            char** paths = (char**)ret->pdata;
            for(i=0; i<ret->len;++i)
                add_device(self, self->udisks_proxy, paths[i], FALSE);
            g_ptr_array_free(ret, TRUE);
        }

        dbus_g_proxy_add_signal(self->udisks_proxy, "DeviceAdded", DBUS_TYPE_G_OBJECT_PATH, G_TYPE_INVALID);
        dbus_g_proxy_add_signal(self->udisks_proxy, "DeviceRemoved", DBUS_TYPE_G_OBJECT_PATH, G_TYPE_INVALID);
        dbus_g_proxy_add_signal(self->udisks_proxy, "DeviceChanged", DBUS_TYPE_G_OBJECT_PATH, G_TYPE_INVALID);

        dbus_g_proxy_connect_signal(self->udisks_proxy, "DeviceAdded", G_CALLBACK(on_device_added), self, NULL);
        dbus_g_proxy_connect_signal(self->udisks_proxy, "DeviceRemoved", G_CALLBACK(on_device_removed), self, NULL);
        dbus_g_proxy_connect_signal(self->udisks_proxy, "DeviceChanged", G_CALLBACK(on_device_changed), self, NULL);

        /* find drives for volumes */
        if(self->volumes && self->drives)
            g_list_foreach(self->volumes, (GFunc)update_volume_drive, self);
    }
}
开发者ID:engla,项目名称:libfm,代码行数:31,代码来源:g-udisks-volume-monitor.c

示例4: listen_tracker

static void listen_tracker (GtkListStore *model)
{
#if 0

	DBusGConnection *bus;
	DBusGProxy *wrap;

	bus = dbus_g_bus_get (DBUS_BUS_SESSION, NULL);
	dbus_g_object_register_marshaller (marshal_VOID__BOXED_BOXED, G_TYPE_NONE, G_TYPE_STRV, G_TYPE_STRV, G_TYPE_INVALID);

	wrap = dbus_g_proxy_new_for_name (bus,
					  "org.freedesktop.Tracker1",
					  "/org/freedesktop/Tracker1/Resources/Classes/mfo/FeedChannel",
					  "org.freedesktop.Tracker1.Resources.Class");

	dbus_g_proxy_add_signal (wrap, "SubjectsAdded", G_TYPE_STRV, G_TYPE_INVALID);
	dbus_g_proxy_connect_signal (wrap, "SubjectsAdded", G_CALLBACK (channel_added_cb), model, NULL);

	dbus_g_proxy_add_signal (wrap, "SubjectsChanged", G_TYPE_STRV, G_TYPE_STRV, G_TYPE_INVALID);
	dbus_g_proxy_connect_signal (wrap, "SubjectsChanged", G_CALLBACK (channel_changed_cb), model, NULL);

	dbus_g_proxy_add_signal (wrap, "SubjectsRemoved", G_TYPE_STRV, G_TYPE_INVALID);
	dbus_g_proxy_connect_signal (wrap, "SubjectsRemoved", G_CALLBACK (channel_removed_cb), model, NULL);

#endif
}
开发者ID:madbob,项目名称:Phidias,代码行数:26,代码来源:main.c

示例5: device_add_cb

static void device_add_cb(RoccatConfigWindow *roccat_window, gpointer user_data) {
	IskuconfigWindow *window = ISKUCONFIG_WINDOW(roccat_window);
	IskuconfigWindowPrivate *priv = window->priv;
	GError *local_error = NULL;
	guint i;
	IskuRkp *rkp;
	RoccatDevice *device;
	IskuconfigProfilePage *profile_page;
	guint actual_profile_index;

	device = roccat_config_window_get_device(roccat_window);

	for (i = 0; i < ISKU_PROFILE_NUM; ++i) {
		profile_page = ISKUCONFIG_PROFILE_PAGE(roccat_config_window_get_page(roccat_window, i));
		rkp = iskuconfig_profile_page_get_rkp(profile_page);
		isku_rkp_update_from_device(device, rkp, i);
		iskuconfig_profile_page_set_rkp(profile_page, rkp);
		isku_rkp_free(rkp);
	}

	actual_profile_index = isku_actual_profile_read(device, &local_error);
	if (!roccat_handle_error_dialog(GTK_WINDOW(window), _("Could not read actual profile"), &local_error))
		return;
	roccat_config_window_set_active_page(roccat_window, actual_profile_index);

	dbus_g_proxy_connect_signal(priv->dbus_proxy, "ProfileChanged", G_CALLBACK(actual_profile_changed_from_device_cb), window, NULL);
	dbus_g_proxy_connect_signal(priv->dbus_proxy, "BrightnessChanged", G_CALLBACK(brightness_changed_from_device_cb), window, NULL);
	dbus_g_proxy_connect_signal(priv->dbus_proxy, "MacroChanged", G_CALLBACK(macro_changed_from_device_cb), window, NULL);
}
开发者ID:ngg,项目名称:roccat-tools,代码行数:29,代码来源:iskuconfig_window.c

示例6: cd_quodlibet_start

/* Initialise le backend de QL.
 */
static void cd_quodlibet_start (void)
{
	// register to the signals
	dbus_g_proxy_add_signal(myData.dbus_proxy_player, "paused",
		G_TYPE_INVALID);
	dbus_g_proxy_connect_signal(myData.dbus_proxy_player, "paused",
		G_CALLBACK(on_pause), NULL, NULL);

	dbus_g_proxy_add_signal(myData.dbus_proxy_player, "unpaused",
		G_TYPE_NONE,
		G_TYPE_INVALID);  // idem.
	dbus_g_proxy_connect_signal(myData.dbus_proxy_player, "unpaused",
		G_CALLBACK(on_unpaused), NULL, NULL);

	dbus_g_proxy_add_signal(myData.dbus_proxy_player, "song-started",
		QL_DBUS_TYPE_SONG_METADATA,
		G_TYPE_INVALID);
	dbus_g_proxy_connect_signal(myData.dbus_proxy_player, "song-started",
		G_CALLBACK(onChangeSong), NULL, NULL);
	
	// get the current state.
	_quodlibet_getPlaying ();
	cd_quodlibet_getSongInfos ();
	cd_musicplayer_update_icon ();
}
开发者ID:Cairo-Dock,项目名称:cairo-dock-plug-ins,代码行数:27,代码来源:applet-quodlibet.c

示例7: gpk_session_init

/**
 * gpk_session_init:
 * @session: This class instance
 **/
static void
gpk_session_init (GpkSession *session)
{
	DBusGConnection *connection;
	GError *error = NULL;

	session->priv = GPK_SESSION_GET_PRIVATE (session);
	session->priv->is_idle_old = FALSE;
	session->priv->is_inhibited_old = FALSE;
	session->priv->proxy_client_private = NULL;

	connection = dbus_g_bus_get (DBUS_BUS_SESSION, NULL);

	/* get org.gnome.Session interface */
	session->priv->proxy = dbus_g_proxy_new_for_name_owner (connection, GPK_SESSION_MANAGER_SERVICE,
								GPK_SESSION_MANAGER_PATH,
								GPK_SESSION_MANAGER_INTERFACE, &error);
	if (session->priv->proxy == NULL) {
		g_warning ("DBUS error: %s", error->message);
		g_error_free (error);
		return;
	}

	/* get org.gnome.Session.Presence interface */
	session->priv->proxy_presence = dbus_g_proxy_new_for_name_owner (connection, GPK_SESSION_MANAGER_SERVICE,
									 GPK_SESSION_MANAGER_PRESENCE_PATH,
									 GPK_SESSION_MANAGER_PRESENCE_INTERFACE, &error);
	if (session->priv->proxy_presence == NULL) {
		g_warning ("DBUS error: %s", error->message);
		g_error_free (error);
		return;
	}

	/* get properties interface */
	session->priv->proxy_prop = dbus_g_proxy_new_for_name_owner (connection, GPK_SESSION_MANAGER_SERVICE,
								     GPK_SESSION_MANAGER_PRESENCE_PATH,
								     GPK_DBUS_PROPERTIES_INTERFACE, &error);
	if (session->priv->proxy_prop == NULL) {
		g_warning ("DBUS error: %s", error->message);
		g_error_free (error);
		return;
	}

	/* get StatusChanged */
	dbus_g_proxy_add_signal (session->priv->proxy_presence, "StatusChanged", G_TYPE_UINT, G_TYPE_INVALID);
	dbus_g_proxy_connect_signal (session->priv->proxy_presence, "StatusChanged", G_CALLBACK (gpk_session_presence_status_changed_cb), session, NULL);

	/* get InhibitorAdded */
	dbus_g_proxy_add_signal (session->priv->proxy, "InhibitorAdded", DBUS_TYPE_G_OBJECT_PATH, G_TYPE_INVALID);
	dbus_g_proxy_connect_signal (session->priv->proxy, "InhibitorAdded", G_CALLBACK (gpk_session_inhibit_changed_cb), session, NULL);

	/* get InhibitorRemoved */
	dbus_g_proxy_add_signal (session->priv->proxy, "InhibitorRemoved", DBUS_TYPE_G_OBJECT_PATH, G_TYPE_INVALID);
	dbus_g_proxy_connect_signal (session->priv->proxy, "InhibitorRemoved", G_CALLBACK (gpk_session_inhibit_changed_cb), session, NULL);

	/* coldplug */
	session->priv->is_inhibited_old = gpk_session_is_inhibited (session);
	session->priv->is_idle_old = gpk_session_is_idle (session);
	g_debug ("idle: %i, inhibited: %i", session->priv->is_idle_old, session->priv->is_inhibited_old);
}
开发者ID:ZanderBrown,项目名称:pi-package,代码行数:64,代码来源:gpk-session.c

示例8: start_avahi_service_browser

static void start_avahi_service_browser(DBusGConnection *bus_system){
    GError *error = NULL;
    char *service_browser_path;
    if (!dbus_g_proxy_call(proxy_avahi_service, "ServiceBrowserNew", &error,
            G_TYPE_INT, -1, G_TYPE_INT, -1, G_TYPE_STRING, "_http._tcp",
            G_TYPE_STRING, "local", G_TYPE_UINT, 0, G_TYPE_INVALID,
            DBUS_TYPE_G_OBJECT_PATH, &service_browser_path, G_TYPE_INVALID))
        lose_gerror("Failed to call ServiceBrowserNew", error);

    printf("new service browser (%s) has started.\n", service_browser_path);

    proxy_avahi_service_browser = dbus_g_proxy_new_for_name(bus_system,
            "org.freedesktop.Avahi", service_browser_path,
            "org.freedesktop.Avahi.ServiceBrowser");
    dbus_g_object_register_marshaller(
            _avahi_marshal_VOID__INT_INT_STRING_STRING_STRING_UINT, G_TYPE_NONE,
            G_TYPE_INT, G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
            G_TYPE_UINT, G_TYPE_INVALID);
//    dbus_g_object_register_marshaller(
//            _avahi_marshal_VOID__INT_INT_STRING_STRING_STRING_INT_UINT,
//            G_TYPE_NONE, G_TYPE_INT, G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING,
//            G_TYPE_STRING, G_TYPE_INT, G_TYPE_UINT, G_TYPE_INVALID);
    dbus_g_proxy_add_signal(proxy_avahi_service_browser, "ItemNew", G_TYPE_INT,
            G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
            G_TYPE_UINT, G_TYPE_INVALID);
    dbus_g_proxy_connect_signal(proxy_avahi_service_browser, "ItemNew",
            G_CALLBACK(service_browser_ItemNew), NULL, NULL);
    dbus_g_proxy_add_signal(proxy_avahi_service_browser, "ItemRemove", G_TYPE_INT,
            G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
            G_TYPE_UINT, G_TYPE_INVALID);
    dbus_g_proxy_connect_signal(proxy_avahi_service_browser, "ItemRemove",
            G_CALLBACK(service_browser_ItemRemove), NULL, NULL);    
}
开发者ID:IbpTeam,项目名称:webde_dbus_example,代码行数:33,代码来源:call-avahi-glib.c

示例9: init_network_manager

static void
init_network_manager (GUPnPNetworkManager *manager)
{
        GUPnPNetworkManagerPrivate *priv;
        DBusError derror;
        GMainContext *main_context;

        priv = manager->priv;

        g_object_get (manager, "main-context", &main_context, NULL);

        /* Do fake open to initialize types */
        dbus_g_connection_open ("", NULL);
        dbus_error_init (&derror);
        priv->dbus_connection = dbus_bus_get_private (DBUS_BUS_SYSTEM, &derror);
        if (priv->dbus_connection == NULL) {
                g_message ("Failed to connect to System Bus: %s",
                           derror.message);
                return;
        }

        dbus_connection_setup_with_g_main (priv->dbus_connection, main_context);

        priv->connection =
            dbus_connection_get_g_connection (priv->dbus_connection);

        priv->manager_proxy = dbus_g_proxy_new_for_name (priv->connection,
                                                         DBUS_SERVICE_NM,
                                                         MANAGER_PATH,
                                                         MANAGER_INTERFACE);

        dbus_g_proxy_add_signal (priv->manager_proxy,
                                 "DeviceAdded",
                                 DBUS_TYPE_G_OBJECT_PATH,
                                 G_TYPE_INVALID);
        dbus_g_proxy_connect_signal (priv->manager_proxy,
                                     "DeviceAdded",
                                     G_CALLBACK (on_device_added),
                                     manager,
                                     NULL);

        dbus_g_proxy_add_signal (priv->manager_proxy,
                                 "DeviceRemoved",
                                 DBUS_TYPE_G_OBJECT_PATH,
                                 G_TYPE_INVALID);
        dbus_g_proxy_connect_signal (priv->manager_proxy,
                                     "DeviceRemoved",
                                     G_CALLBACK (on_device_removed),
                                     manager,
                                     NULL);

        dbus_g_proxy_begin_call (priv->manager_proxy,
                                 "GetDevices",
                                 get_devices_cb,
                                 manager,
                                 NULL,
                                 G_TYPE_INVALID);
}
开发者ID:ZachGoldberg,项目名称:gupnp-gi,代码行数:58,代码来源:gupnp-network-manager.c

示例10: _mojito_client_service_setup

gboolean
_mojito_client_service_setup (MojitoClientService  *service,
                              const gchar          *service_name,
                              GError              **error_out)
{
  MojitoClientServicePrivate *priv = GET_PRIVATE (service);
  GError *error = NULL;

  if (!_mojito_client_service_setup_proxy_for_iface (service,
                                                     service_name,
                                                     SERVICE_IFACE,
                                                     &error))
  {
    g_propagate_error (error_out, error);
    return FALSE;
  }

  dbus_g_proxy_add_signal (priv->proxies[SERVICE_IFACE],
                           "AvatarRetrieved",
                           G_TYPE_STRING,
                           G_TYPE_INVALID);
  dbus_g_proxy_connect_signal (priv->proxies[SERVICE_IFACE],
                               "AvatarRetrieved",
                               (GCallback)_avatar_retrieved_cb,
                               service,
                               NULL);

  dbus_g_proxy_add_signal (priv->proxies[SERVICE_IFACE],
                           "CapabilitiesChanged",
                           G_TYPE_STRV,
                           NULL);
  dbus_g_proxy_connect_signal (priv->proxies[SERVICE_IFACE],
                               "CapabilitiesChanged",
                               (GCallback)_capabilities_changed_cb,
                               service,
                               NULL);

  dbus_g_proxy_add_signal (priv->proxies[SERVICE_IFACE],
                           "StatusUpdated",
                           G_TYPE_BOOLEAN,
                           G_TYPE_INVALID);
  dbus_g_proxy_connect_signal (priv->proxies[SERVICE_IFACE],
                               "StatusUpdated",
                               (GCallback)_status_updated_cb,
                               service,
                               NULL);

  dbus_g_proxy_add_signal (priv->proxies[SERVICE_IFACE],
                           "UserChanged",
                           G_TYPE_INVALID);
  dbus_g_proxy_connect_signal (priv->proxies[SERVICE_IFACE],
                               "UserChanged",
                               (GCallback)_user_changed_cb,
                               service,
                               NULL);

  return TRUE;
}
开发者ID:lcp,项目名称:mojito,代码行数:58,代码来源:mojito-client-service.c

示例11: cryptui_keyset_constructor

static GObject*  
cryptui_keyset_constructor (GType type, guint n_props, GObjectConstructParam* props)
{
    DBusGConnection *bus;
    CryptUIKeyset *keyset;
    GError *error = NULL;
    GObject *obj;
    gchar *path;
    
    obj = G_OBJECT_CLASS (cryptui_keyset_parent_class)->constructor (type, n_props, props);
    keyset = CRYPTUI_KEYSET (obj);

    if (!keyset->priv->keytype) {
        g_warning ("no keytype was set on the keyset");
        goto finally;
    }
    
    bus = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
    if (!bus) {
        g_critical ("couldn't get the session bus: %s", error->message);
        g_clear_error (&error);
        goto finally;
    }
    
    path = g_strdup_printf("/org/gnome/seahorse/keys/%s", keyset->priv->keytype);

    keyset->priv->remote_keyset = dbus_g_proxy_new_for_name (bus,
                    "org.gnome.seahorse", path, "org.gnome.seahorse.Keys");
    keyset->priv->remote_service = dbus_g_proxy_new_for_name (bus,
                    "org.gnome.seahorse", "/org/gnome/seahorse/keys", "org.gnome.seahorse.KeyService");
    
    g_free (path);
            
    if (!keyset->priv->remote_keyset || !keyset->priv->remote_service) {
        g_critical ("couldn't connect to the dbus service");
        goto finally;
    }
    
    cryptui_keyset_refresh (keyset);

    dbus_g_proxy_add_signal (keyset->priv->remote_keyset, "KeyAdded", 
                             G_TYPE_STRING, G_TYPE_INVALID);
    dbus_g_proxy_add_signal (keyset->priv->remote_keyset, "KeyRemoved", 
                             G_TYPE_STRING, G_TYPE_INVALID);
    dbus_g_proxy_add_signal (keyset->priv->remote_keyset, "KeyChanged", 
                             G_TYPE_STRING, G_TYPE_INVALID);
    
    dbus_g_proxy_connect_signal (keyset->priv->remote_keyset, "KeyAdded", 
                                 G_CALLBACK (key_added), keyset, NULL);
    dbus_g_proxy_connect_signal (keyset->priv->remote_keyset, "KeyRemoved", 
                                 G_CALLBACK (key_removed), keyset, NULL);
    dbus_g_proxy_connect_signal (keyset->priv->remote_keyset, "KeyChanged", 
                                 G_CALLBACK (key_changed), keyset, NULL);

finally:    
    return obj;
}
开发者ID:GNOME,项目名称:libcryptui,代码行数:57,代码来源:cryptui-keyset.c

示例12: gpm_phone_service_appeared_cb

/**
 * gpm_phone_service_appeared_cb:
 */
static void
gpm_phone_service_appeared_cb (GDBusConnection *connection,
                               const gchar *name, const gchar *name_owner,
                               GpmPhone *phone)
{
    GError *error = NULL;

    g_return_if_fail (GPM_IS_PHONE (phone));

    if (phone->priv->connection == NULL) {
        egg_debug ("get connection");
        g_clear_error (&error);
        phone->priv->connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
        if (error != NULL) {
            egg_warning ("Could not connect to DBUS daemon: %s", error->message);
            g_error_free (error);
            phone->priv->connection = NULL;
            return;
        }
    }
    if (phone->priv->proxy == NULL) {
        egg_debug ("get proxy");
        g_clear_error (&error);
        phone->priv->proxy = dbus_g_proxy_new_for_name_owner (phone->priv->connection,
                             MATE_PHONE_MANAGER_DBUS_SERVICE,
                             MATE_PHONE_MANAGER_DBUS_PATH,
                             MATE_PHONE_MANAGER_DBUS_INTERFACE,
                             &error);
        if (error != NULL) {
            egg_warning ("Cannot connect, maybe the daemon is not running: %s", error->message);
            g_error_free (error);
            phone->priv->proxy = NULL;
            return;
        }

        /* complicated type. ick */
        dbus_g_object_register_marshaller(gpm_marshal_VOID__UINT_UINT_BOOLEAN,
                                          G_TYPE_NONE, G_TYPE_UINT, G_TYPE_UINT,
                                          G_TYPE_BOOLEAN, G_TYPE_INVALID);

        /* get BatteryStateChanged */
        dbus_g_proxy_add_signal (phone->priv->proxy, "BatteryStateChanged",
                                 G_TYPE_UINT, G_TYPE_UINT, G_TYPE_BOOLEAN, G_TYPE_INVALID);
        dbus_g_proxy_connect_signal (phone->priv->proxy, "BatteryStateChanged",
                                     G_CALLBACK (gpm_phone_battery_state_changed),
                                     phone, NULL);

        /* get NumberBatteriesChanged */
        dbus_g_proxy_add_signal (phone->priv->proxy, "NumberBatteriesChanged",
                                 G_TYPE_UINT, G_TYPE_INVALID);
        dbus_g_proxy_connect_signal (phone->priv->proxy, "NumberBatteriesChanged",
                                     G_CALLBACK (gpm_phone_num_batteries_changed),
                                     phone, NULL);

    }
}
开发者ID:mate-desktop,项目名称:mate-power-manager,代码行数:59,代码来源:gpm-phone.c

示例13: gpm_session_register_client

/**
 * gpm_session_register_client:
 **/
gboolean
gpm_session_register_client (GpmSession *session, const gchar *app_id, const gchar *client_startup_id)
{
	gboolean ret = FALSE;
	gchar *client_id = NULL;
	GError *error = NULL;
	DBusGConnection *connection;

	g_return_val_if_fail (GPM_IS_SESSION (session), FALSE);

	/* no mate-session */
	if (session->priv->proxy == NULL) {
		egg_warning ("no mate-session");
		goto out;
	}

	/* find out if this change altered the inhibited state */
	ret = dbus_g_proxy_call (session->priv->proxy, "RegisterClient", &error,
				 G_TYPE_STRING, app_id,
				 G_TYPE_STRING, client_startup_id,
				 G_TYPE_INVALID,
				 DBUS_TYPE_G_OBJECT_PATH, &client_id,
				 G_TYPE_INVALID);
	if (!ret) {
		egg_warning ("failed to register client '%s': %s", client_startup_id, error->message);
		g_error_free (error);
		goto out;
	}

	/* get org.mate.Session.ClientPrivate interface */
	connection = dbus_g_bus_get (DBUS_BUS_SESSION, NULL);
	session->priv->proxy_client_private = dbus_g_proxy_new_for_name_owner (connection, GPM_SESSION_MANAGER_SERVICE,
									       client_id, GPM_SESSION_MANAGER_CLIENT_PRIVATE_INTERFACE, &error);
	if (session->priv->proxy_client_private == NULL) {
		egg_warning ("DBUS error: %s", error->message);
		g_error_free (error);
		goto out;
	}

	/* get Stop */
	dbus_g_proxy_add_signal (session->priv->proxy_client_private, "Stop", G_TYPE_INVALID);
	dbus_g_proxy_connect_signal (session->priv->proxy_client_private, "Stop", G_CALLBACK (gpm_session_stop_cb), session, NULL);

	/* get QueryEndSession */
	dbus_g_proxy_add_signal (session->priv->proxy_client_private, "QueryEndSession", G_TYPE_UINT, G_TYPE_INVALID);
	dbus_g_proxy_connect_signal (session->priv->proxy_client_private, "QueryEndSession", G_CALLBACK (gpm_session_query_end_session_cb), session, NULL);

	/* get EndSession */
	dbus_g_proxy_add_signal (session->priv->proxy_client_private, "EndSession", G_TYPE_UINT, G_TYPE_INVALID);
	dbus_g_proxy_connect_signal (session->priv->proxy_client_private, "EndSession", G_CALLBACK (gpm_session_end_session_cb), session, NULL);

	egg_debug ("registered startup '%s' to client id '%s'", client_startup_id, client_id);
out:
	g_free (client_id);
	return ret;
}
开发者ID:SukkoPera,项目名称:mate-power-manager,代码行数:59,代码来源:gpm-session.c

示例14: get_quodlibet_info

gboolean
get_quodlibet_info(struct TrackInfo* ti)
{
	DBusGConnection *connection;
	DBusGProxy *player, *shell;
	GError *error = 0;
	char buf[100], status[100];
	static gboolean connected = FALSE;

	connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
	if (connection == NULL) {
		trace("Failed to open connection to dbus: %s\n", error->message);
		g_error_free (error);
		return FALSE;
	}

	if (!dbus_g_running(connection, "net.sacredchao.QuodLibet")) {
		ti->status = STATUS_OFF;
		return TRUE;
	}

	player = dbus_g_proxy_new_for_name(connection,
			"net.sacredchao.QuodLibet",
			"/net/sacredchao/QuodLibet",
			"net.sacredchao.QuodLibet");

	if (!connected) {
		dbus_g_proxy_add_signal(player, "Paused", G_TYPE_INVALID);
		dbus_g_proxy_connect_signal(player, "Paused", G_CALLBACK(cb_quodlibet_paused), 
				(gpointer) STATUS_PAUSED, 0);
		dbus_g_proxy_add_signal(player, "Unpaused", G_TYPE_INVALID);
		dbus_g_proxy_connect_signal(player, "Unpaused", G_CALLBACK(cb_quodlibet_paused), 
				(gpointer) STATUS_NORMAL, 0);
		connected = TRUE;
	}

	GHashTable *table;
	if (!dbus_g_proxy_call(player, "CurrentSong", &error,
				G_TYPE_INVALID, 
				dbus_g_type_get_map("GHashTable", G_TYPE_STRING, G_TYPE_STRING), &table,
				G_TYPE_INVALID)) {
		ti->status = STATUS_OFF;
		return TRUE;
	}
	ti->status = g_state;

	quodlibet_hash_str(table, "artist", ti->artist);
	quodlibet_hash_str(table, "album", ti->album);
	quodlibet_hash_str(table, "title", ti->track);
	quodlibet_hash_str(table, "~#length", buf);
	sscanf(buf, "%d", &ti->totalSecs);
	g_hash_table_destroy(table);

	return TRUE;
}
开发者ID:petervizi,项目名称:musictracker,代码行数:55,代码来源:quodlibet.c

示例15: interface_add_done

static void
interface_add_done (NMSupplicantInterface *self, char *path)
{
	NMSupplicantInterfacePrivate *priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (self);

	nm_log_dbg (LOGD_SUPPLICANT, "(%s): interface added to supplicant", priv->dev);

	priv->object_path = path;

	priv->iface_proxy = dbus_g_proxy_new_for_name (nm_dbus_manager_get_connection (priv->dbus_mgr),
	                                               WPAS_DBUS_SERVICE,
	                                               path,
	                                               WPAS_DBUS_IFACE_INTERFACE);

	dbus_g_object_register_marshaller (g_cclosure_marshal_VOID__BOXED,
	                                   G_TYPE_NONE,
	                                   DBUS_TYPE_G_MAP_OF_VARIANT,
	                                   G_TYPE_INVALID);
	dbus_g_proxy_add_signal (priv->iface_proxy, "PropertiesChanged",
	                         DBUS_TYPE_G_MAP_OF_VARIANT, G_TYPE_INVALID);
	dbus_g_proxy_connect_signal (priv->iface_proxy, "PropertiesChanged",
	                             G_CALLBACK (wpas_iface_properties_changed),
	                             self, NULL);

	dbus_g_proxy_add_signal (priv->iface_proxy, "ScanDone",
	                         G_TYPE_BOOLEAN, G_TYPE_INVALID);
	dbus_g_proxy_connect_signal (priv->iface_proxy, "ScanDone",
	                             G_CALLBACK (wpas_iface_scan_done),
	                             self,
	                             NULL);

	dbus_g_object_register_marshaller (_nm_marshal_VOID__STRING_BOXED,
	                                   G_TYPE_NONE,
	                                   DBUS_TYPE_G_OBJECT_PATH, DBUS_TYPE_G_MAP_OF_VARIANT,
	                                   G_TYPE_INVALID);
	dbus_g_proxy_add_signal (priv->iface_proxy, "BSSAdded", 
	                         DBUS_TYPE_G_OBJECT_PATH, DBUS_TYPE_G_MAP_OF_VARIANT,
	                         G_TYPE_INVALID);
	dbus_g_proxy_connect_signal (priv->iface_proxy, "BSSAdded",
	                             G_CALLBACK (wpas_iface_bss_added),
	                             self,
	                             NULL);

	priv->props_proxy = dbus_g_proxy_new_for_name (nm_dbus_manager_get_connection (priv->dbus_mgr),
	                                               WPAS_DBUS_SERVICE,
	                                               path,
	                                               DBUS_INTERFACE_PROPERTIES);
	/* Get initial properties */
	wpas_iface_get_props (self);

	set_state (self, NM_SUPPLICANT_INTERFACE_STATE_READY);
}
开发者ID:alfmatos,项目名称:NetworkManager,代码行数:52,代码来源:nm-supplicant-interface.c


注:本文中的dbus_g_proxy_connect_signal函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。