gui/collection: Run FileChooserDialog on startup

But only if the library database is empty.  This patch also changes the
prompt of the dialog to "Add Music" so users know what is going on.

Fixes #80: Pop up FileChooserDialog the first time Ocarina is run
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
Anna Schumaker 2016-08-16 13:38:58 -04:00
parent 5964c508ce
commit f855eaea58
1 changed files with 4 additions and 2 deletions

View File

@ -28,7 +28,7 @@ void __collection_choose(GtkButton *button, gpointer data)
filter = gtk_file_filter_new();
gtk_file_filter_add_mime_type(filter, "inode/directory");
dialog = gtk_file_chooser_dialog_new("Chooser a Path",
dialog = gtk_file_chooser_dialog_new("Add Music",
GTK_WINDOW(gui_builder_widget("o_window")),
GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
_("_Cancel"), GTK_RESPONSE_CANCEL,
@ -41,7 +41,6 @@ void __collection_choose(GtkButton *button, gpointer data)
__collection_add(GTK_FILE_CHOOSER(dialog));
gtk_widget_destroy(dialog);
g_object_unref(filter);
}
bool __gui_collection_init_idle()
@ -51,6 +50,9 @@ bool __gui_collection_init_idle()
db_for_each(library, next, library_db_get())
gui_playlist_add_library(LIBRARY(library));
if (library_db_get()->db_size == 0)
__collection_choose(NULL, NULL);
return true;
}