Example #1
0
static void
pk_backend_repo_disable_thread (PkBackendJob *job, GVariant *params, gpointer user_data)
{
	const alpm_list_t *i;
	const gchar *repo;

	GError *error = NULL;

	repo = pk_backend_get_string (self, "repo_id");

	for (i = alpm_option_get_syncdbs (); i != NULL; i = i->next) {
		pmdb_t *db = (pmdb_t *) i->data;
		const gchar *name = alpm_db_get_name (db);

		if (g_strcmp0 (repo, name) == 0) {
			if (alpm_db_unregister (db) < 0) {
				g_set_error (&error, ALPM_ERROR, pm_errno,
					     "[%s]: %s", repo,
					     alpm_strerrorlast ());
			} else {
				g_hash_table_insert (disabled, g_strdup (repo),
						     GINT_TO_POINTER (1));
			}
			break;
		}
	}

	if (i == NULL) {
		int code = PM_ERR_DB_NULL;
		g_set_error (&error, ALPM_ERROR, code, "[%s]: %s", repo,
			     alpm_strerror (code));
	}

	if (error != NULL) {
		pk_backend_error (self, error);
		g_error_free (error);
	}

	pk_backend_job_finished (self);
}
Example #2
0
VALUE
db_unregister ( VALUE self )
{
    INITDBPTR;
    NEGISERR( alpm_db_unregister( db ));
}