Пример #1
0
static void info_bar_response_cb(GtkInfoBar *info_bar, gint response_id, gpointer user_data)
{
	GSList *library_dir = NULL;

	struct con_win *cwin = user_data;
	const gchar *dir = g_get_user_special_dir(G_USER_DIRECTORY_MUSIC);

	gtk_widget_destroy(GTK_WIDGET(info_bar));

	switch (response_id)
	{
		case GTK_RESPONSE_CANCEL:
			break;
		case GTK_RESPONSE_YES:
			library_dir = g_slist_append(library_dir, g_strdup(dir));
			pragha_preferences_set_filename_list(cwin->preferences,
				                             GROUP_LIBRARY,
				                             KEY_LIBRARY_DIR,
				                             library_dir);
			free_str_list(library_dir);

			pragha_scanner_scan_library(cwin->scanner);
			break;
		default:
			g_warn_if_reached();
	}
}
Пример #2
0
static void
pragha_application_provider_want_upgrade (PraghaDatabaseProvider *provider,
                                          gint                    provider_id,
                                          PraghaApplication      *pragha)
{
	PraghaDatabase *database;
	PraghaScanner *scanner;
	PraghaPreparedStatement *statement;
	const gchar *sql, *provider_type = NULL;

	sql = "SELECT name FROM provider_type WHERE id IN (SELECT type FROM provider WHERE id = ?)";

	database = pragha_application_get_database (pragha);
	statement = pragha_database_create_statement (database, sql);
	pragha_prepared_statement_bind_int (statement, 1, provider_id);
	if (pragha_prepared_statement_step (statement))
		provider_type = pragha_prepared_statement_get_string (statement, 0);

	if (g_ascii_strcasecmp (provider_type, "local") == 0)
	{
		scanner = pragha_application_get_scanner (pragha);
		pragha_scanner_scan_library (scanner);
	}
	pragha_prepared_statement_free (statement);
}