Start work on playlist creation dialog

Started work on the playlist creation dialog. To facilitate my desired UX for dialogs, I changed the immediate child of KotoWindow to being a GtkOverlay, with the "child" being the primary layout GtkBox and the "overlay" being any active dialog.

There is no background on the dialogs yet, or really anything meaningful in it besides the GtkImage to show the playlist image as well as a GtkEntry for the label. Upon clicking the image, you will be presented with a GtkFileChooserNative, which will allow us to support various platforms aside from Linux (if we desire) but more importantly support desktop portals and the appropriate picker for each desktop environment.

This dialog is currently hooked into the + button in the Playlist nav section.

The intent is to also support drag-and-drop when possible, so you can drag an image file onto the GtkImage for it to set it to the playlist image.

Fixed various compiler warnings, such as:

- Unused variables (cast these as void so compiler knows to ignore them).
- Use g_hash_table_add instead of g_hash_table_insert since value does not matter and will complain about not casting TRUE as a pointer.
- Fixed some casting.

Fixed up Desktop file and fleshed out Appstream data. Use validate-relax in the appstream test or it gets cranky about screenshots missing. I know...the app is not ready yet. Get over it AppStream.

Added Visual Studio Code tasks and some C/C++ Extension setting files.
This commit is contained in:
Joshua Strobl 2021-04-07 13:17:33 +03:00
parent e18b8ca100
commit f2164b2ade
18 changed files with 316 additions and 15 deletions

View file

@ -20,6 +20,7 @@
#include "pages/music/music-local.h"
#include "playback/engine.h"
#include "playlist/current.h"
#include "playlist/create-dialog.h"
#include "koto-config.h"
#include "koto-nav.h"
#include "koto-playerbar.h"
@ -33,6 +34,9 @@ struct _KotoWindow {
KotoIndexedLibrary *library;
KotoCurrentPlaylist *current_playlist;
KotoCreatePlaylistDialog *playlist_create_dialog;
GtkWidget *overlay;
GtkWidget *header_bar;
GtkWidget *menu_button;
GtkWidget *search_entry;
@ -61,11 +65,16 @@ static void koto_window_init (KotoWindow *self) {
create_new_headerbar(self); // Create our headerbar
self->overlay = gtk_overlay_new(); // Create our overlay
self->playlist_create_dialog = koto_create_playlist_dialog_new(); // Create our Create Playlist dialog
self->primary_layout = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
gtk_widget_add_css_class(self->primary_layout, "primary-layout");
gtk_widget_set_hexpand(self->primary_layout, TRUE);
gtk_widget_set_vexpand(self->primary_layout, TRUE);
gtk_overlay_set_child(GTK_OVERLAY(self->overlay), self->primary_layout); // Add our primary layout to the overlay
self->content_layout = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
gtk_widget_add_css_class(self->content_layout, "content-layout");
gtk_widget_set_hexpand(self->content_layout, TRUE);
@ -95,7 +104,7 @@ static void koto_window_init (KotoWindow *self) {
gtk_box_append(GTK_BOX(self->primary_layout), playerbar_main);
}
gtk_window_set_child(GTK_WINDOW(self), self->primary_layout);
gtk_window_set_child(GTK_WINDOW(self), self->overlay);
#ifdef GDK_WINDOWING_X11
set_optimal_default_window_size(self);
#endif
@ -127,6 +136,14 @@ void create_new_headerbar(KotoWindow *self) {
gtk_window_set_titlebar(GTK_WINDOW(self), self->header_bar);
}
void koto_window_hide_create_playlist_dialog(KotoWindow *self) {
gtk_overlay_remove_overlay(GTK_OVERLAY(self->overlay), koto_create_playlist_dialog_get_content(self->playlist_create_dialog));
}
void koto_window_show_create_playlist_dialog(KotoWindow *self) {
gtk_overlay_add_overlay(GTK_OVERLAY(self->overlay), koto_create_playlist_dialog_get_content(self->playlist_create_dialog));
}
void load_library(KotoWindow *self) {
KotoIndexedLibrary *lib = koto_indexed_library_new(g_get_user_special_dir(G_USER_DIRECTORY_MUSIC));