static void create_connection (const DMAPMdnsBrowserServiceType protocol, const char *name, const char *host, const guint port) { DMAPRecordFactory *factory; DMAPConnection *conn; DMAPDb *db; db = DMAP_DB (g_object_new (TYPE_DMAPD_DMAP_DB_GHASHTABLE, NULL)); if (db == NULL) { g_error ("Error creating DB"); } /* FIXME: switch on DMAP_MDNS_BROWSER_SERVICE_TYPE_DAAP, _DPAP, _DACP or _INVALID */ if (protocol == DMAP_MDNS_BROWSER_SERVICE_TYPE_DAAP) { factory = DMAP_RECORD_FACTORY (g_object_new (TYPE_DMAPD_DAAP_RECORD_FACTORY, NULL)); if (factory == NULL) { g_error ("Error creating record factory"); } conn = DMAP_CONNECTION (daap_connection_new (name, host, port, db, factory)); } else { factory = DMAP_RECORD_FACTORY (g_object_new (TYPE_DMAPD_DPAP_RECORD_FACTORY, NULL)); if (factory == NULL) { g_error ("Error creating record factory"); } conn = DMAP_CONNECTION (dpap_connection_new (name, host, port, db, factory)); } dmap_connection_connect (DMAP_CONNECTION (conn), (DMAPConnectionCallback) connected_cb, db); }
static void dpap_copy_service_added_cb (DPAPCopy* self, DMAPMdnsBrowserService* service) { DMAPMdnsBrowserService* _tmp0_ = NULL; const gchar* _tmp1_ = NULL; DMAPMdnsBrowserService* _tmp2_ = NULL; const gchar* _tmp3_ = NULL; DMAPMdnsBrowserService* _tmp4_ = NULL; guint _tmp5_ = 0U; ValaDMAPDb* _tmp6_ = NULL; ValaDPAPRecordFactory* _tmp7_ = NULL; DPAPConnection* _tmp8_ = NULL; DMAPConnection* _tmp9_ = NULL; g_return_if_fail (self != NULL); _tmp0_ = service; _tmp1_ = _tmp0_->service_name; _tmp2_ = service; _tmp3_ = _tmp2_->host; _tmp4_ = service; _tmp5_ = _tmp4_->port; _tmp6_ = self->priv->db; _tmp7_ = self->priv->factory; _tmp8_ = dpap_connection_new (_tmp1_, _tmp3_, _tmp5_, (DMAPDb*) _tmp6_, (DMAPRecordFactory*) _tmp7_); _g_object_unref0 (self->priv->connection); self->priv->connection = G_TYPE_CHECK_INSTANCE_CAST (_tmp8_, DMAP_TYPE_CONNECTION, DMAPConnection); _tmp9_ = self->priv->connection; dmap_connection_connect (_tmp9_, _dpap_copy_connected_cb_dmap_connection_callback, self); }
static void grl_dpap_connect (gchar *name, gchar *host, guint port, ResultCbAndArgsAndDb *cb_and_db, DMAPConnectionCallback callback) { DMAPRecordFactory *factory; DMAPConnection *connection; factory = DMAP_RECORD_FACTORY (grl_dpap_record_factory_new ()); connection = DMAP_CONNECTION (dpap_connection_new (name, host, port, DMAP_DB (cb_and_db->db), factory)); dmap_connection_connect (connection, (DMAPConnectionCallback) callback, cb_and_db); }