Exemplo n.º 1
0
void epris_dbus_proxy_set_conn (EprisDBusProxy* self, DBusGConnection* value) {
	DBusGConnection* _tmp1_;
	DBusGConnection* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp1_ = NULL;
	_tmp0_ = NULL;
	self->priv->_conn = (_tmp1_ = (_tmp0_ = value, (_tmp0_ == NULL) ? NULL : dbus_g_connection_ref (_tmp0_)), (self->priv->_conn == NULL) ? NULL : (self->priv->_conn = (dbus_g_connection_unref (self->priv->_conn), NULL)), _tmp1_);
	g_object_notify ((GObject *) self, "conn");
}
Exemplo n.º 2
0
/**
 * Create a new counter factory for a particular connection.
 */
GlimCounterFactory *
glim_counter_factory_new (DBusGConnection *connection)
{
  GlimCounterFactory *self = 
    (GlimCounterFactory *) g_object_new (GLIM_TYPE_COUNTER_FACTORY, NULL);
  self->connection = connection;
  dbus_g_connection_ref (connection);
  self->count = 0;
  return self;
} // glim_counter_factory_new
static void
setup (Test *test,
    gconstpointer data)
{
  GError *error = NULL;
  GQuark features[] = { TP_CONNECTION_FEATURE_CONNECTED, 0 };

  tp_debug_set_flags ("all");
  test->dbus = tp_tests_dbus_daemon_dup_or_die ();

  test->mainloop = g_main_loop_new (NULL, FALSE);
  test->error = NULL;

  test->client_libdbus = dbus_bus_get_private (DBUS_BUS_STARTER, NULL);
  g_assert (test->client_libdbus != NULL);
  dbus_connection_setup_with_g_main (test->client_libdbus, NULL);
  dbus_connection_set_exit_on_disconnect (test->client_libdbus, FALSE);
  test->client_dbusglib = dbus_connection_get_g_connection (
      test->client_libdbus);
  dbus_g_connection_ref (test->client_dbusglib);
  test->client_bus = tp_dbus_daemon_new (test->client_dbusglib);
  g_assert (test->client_bus != NULL);

  test->service_conn = tp_tests_object_new_static_class (
        EXAMPLE_TYPE_CONTACT_LIST_CONNECTION,
        "account", "*****@*****.**",
        "protocol", "simple-protocol",
        NULL);
  test->service_conn_as_base = TP_BASE_CONNECTION (test->service_conn);
  g_assert (test->service_conn != NULL);
  g_assert (test->service_conn_as_base != NULL);

  g_assert (tp_base_connection_register (test->service_conn_as_base, "simple",
        &test->conn_name, &test->conn_path, &error));
  g_assert_no_error (error);

  test->cwr_ready = FALSE;
  test->cwr_error = NULL;

  test->conn = tp_connection_new (test->client_bus, test->conn_name,
      test->conn_path, &error);
  g_assert (test->conn != NULL);
  g_assert_no_error (error);

  tp_cli_connection_call_connect (test->conn, -1, NULL, NULL, NULL, NULL);

  g_assert (!tp_proxy_is_prepared (test->conn, TP_CONNECTION_FEATURE_CORE));
  g_assert (!tp_proxy_is_prepared (test->conn,
        TP_CONNECTION_FEATURE_CONNECTED));
  g_assert (!tp_proxy_is_prepared (test->conn, TP_CONNECTION_FEATURE_BALANCE));

  tp_tests_proxy_run_until_prepared (test->conn, features);
}
Exemplo n.º 4
0
DBusGConnection *
nm_vpn_plugin_get_connection (NMVPNPlugin *plugin)
{
	DBusGConnection *connection;

	g_return_val_if_fail (NM_IS_VPN_PLUGIN (plugin), NULL);

	connection = NM_VPN_PLUGIN_GET_PRIVATE (plugin)->connection;

	if (connection)
		dbus_g_connection_ref (connection);

	return connection;
}
static void
names_model_set_connection (NamesModel      *names_model,
                            DBusGConnection *connection)
{
  g_return_if_fail (IS_NAMES_MODEL (names_model));
  
  if (connection == names_model->connection)
    return;

  if (names_model->connection)
    {
      dbus_g_proxy_disconnect_signal (names_model->driver_proxy,
                                      "NameOwnerChanged",
                                      G_CALLBACK (name_owner_changed),
                                      names_model);
      
      g_object_unref (names_model->driver_proxy);
      names_model->driver_proxy = NULL;
      dbus_g_connection_unref (names_model->connection);
      names_model->connection = NULL;
    }
  
  if (connection)
    {
      names_model->connection = connection;
      dbus_g_connection_ref (names_model->connection);
      
      names_model->driver_proxy =
        dbus_g_proxy_new_for_name (names_model->connection,
                                   DBUS_SERVICE_DBUS,
                                   DBUS_PATH_DBUS,
                                   DBUS_INTERFACE_DBUS);
      g_assert (names_model->driver_proxy);

      dbus_g_proxy_add_signal (names_model->driver_proxy,
                               "NameOwnerChanged",
                               G_TYPE_STRING,
                               G_TYPE_STRING,
                               G_TYPE_STRING,
			       G_TYPE_INVALID);
      
      dbus_g_proxy_connect_signal (names_model->driver_proxy,
                                   "NameOwnerChanged", 
                                   G_CALLBACK (name_owner_changed),
                                   names_model,
                                   NULL);
    }

  names_model_reload (names_model);
}
Exemplo n.º 6
0
static void
set_property (GObject *object, guint prop_id,
              const GValue *value, GParamSpec *pspec)
{
	BMRemoteSettingsPrivate *priv = BM_REMOTE_SETTINGS_GET_PRIVATE (object);

	switch (prop_id) {
	case PROP_BUS:
		/* Construct only */
		priv->bus = dbus_g_connection_ref ((DBusGConnection *) g_value_get_boxed (value));
		break;
	case PROP_SCOPE:
		priv->scope = (BMConnectionScope) g_value_get_uint (value);
		break;
	default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
		break;
	}
}
Exemplo n.º 7
0
static void
set_property (GObject *object, guint prop_id,
              const GValue *value, GParamSpec *pspec)
{
	NMRemoteSettingsPrivate *priv = NM_REMOTE_SETTINGS_GET_PRIVATE (object);
	DBusGConnection *connection;

	switch (prop_id) {
	case PROP_BUS:
		/* Construct only */
		connection = (DBusGConnection *) g_value_get_boxed (value);
		if (!connection)
			connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, NULL);
		priv->bus = dbus_g_connection_ref (connection);
		break;
	default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
		break;
	}
}
Exemplo n.º 8
0
static void
gypsy_server_init (GypsyServer *gps)
{
	GypsyServerPrivate *priv = GET_PRIVATE (gps);
	GError *error = NULL;

	priv->connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error);
	if (priv->connection == NULL) {
		g_warning ("Error connecting to system bus:\n%s",
			   error->message);
		g_error_free (error);
		return;
	}
	dbus_g_connection_ref (priv->connection);

	priv->connections = g_hash_table_new_full (g_str_hash, g_str_equal,
						   g_free, NULL);

	priv->client_count = 0;
	priv->terminate_id = 0;
}
static void
set_property (GObject *object, guint prop_id,
              const GValue *value, GParamSpec *pspec)
{
	NMSettingsServicePrivate *priv = NM_SETTINGS_SERVICE_GET_PRIVATE (object);
	DBusGConnection *bus;

	switch (prop_id) {
	case PROP_BUS:
		/* Construct only */
		bus = g_value_get_boxed (value);
		if (bus)
			priv->bus = dbus_g_connection_ref (bus);
		break;
	case PROP_SCOPE:
		/* Construct only */
		priv->scope = g_value_get_uint (value);
		break;
	default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
		break;
	}
}