diff --git a/fastiv-sidebar.c b/fastiv-sidebar.c index f15ecd3..5d78667 100644 --- a/fastiv-sidebar.c +++ b/fastiv-sidebar.c @@ -129,11 +129,10 @@ update_location(FastivSidebar *self, GFile *location) create_row(parent, "go-up-symbolic")); } - // Another option would be "folder-open-symbolic", - // "*-visiting-*" is mildly inappropriate (means: open in another window). - // TODO(p): Try out "circle-filled-symbolic". + // Other options are "folder-{visiting,open}-symbolic", though the former + // is mildly inappropriate (means: open in another window). gtk_container_add(GTK_CONTAINER(self->listbox), - create_row(self->location, "folder-visiting-symbolic")); + create_row(self->location, "circle-filled-symbolic")); GFileEnumerator *enumerator = g_file_enumerate_children(self->location, G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME @@ -339,25 +338,64 @@ fastiv_sidebar_init(FastivSidebar *self) GTK_POLICY_NEVER, GTK_POLICY_NEVER); // Fill up what would otherwise be wasted space, - // as it is in the example of Nautilus and Thunar. - GtkWidget *superbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); - gtk_container_add( - GTK_CONTAINER(superbox), GTK_WIDGET(self->places)); - gtk_container_add( - GTK_CONTAINER(superbox), gtk_separator_new(GTK_ORIENTATION_VERTICAL)); + // as it is in the examples of Nautilus and Thunar. + GtkWidget *plus = gtk_button_new_from_icon_name("zoom-in-symbolic", + GTK_ICON_SIZE_BUTTON); + gtk_widget_set_tooltip_text(plus, "Larger thumbnails"); + GtkWidget *minus = gtk_button_new_from_icon_name("zoom-out-symbolic", + GTK_ICON_SIZE_BUTTON); + gtk_widget_set_tooltip_text(minus, "Smaller thumbnails"); + + GtkWidget *zoom_group = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); + gtk_style_context_add_class( + gtk_widget_get_style_context(zoom_group), GTK_STYLE_CLASS_LINKED); + gtk_box_pack_start(GTK_BOX(zoom_group), plus, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(zoom_group), minus, FALSE, FALSE, 0); + + GtkWidget *funnel = gtk_toggle_button_new(); + gtk_container_add(GTK_CONTAINER(funnel), + gtk_image_new_from_icon_name("funnel-symbolic", GTK_ICON_SIZE_BUTTON)); + gtk_widget_set_tooltip_text(funnel, "Hide unsupported files"); + + // None of GtkActionBar, GtkToolbar, .inline-toolbar is appropriate. + // It is either borders or padding. + GtkWidget *buttons = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 12); + gtk_style_context_add_class( + gtk_widget_get_style_context(buttons), GTK_STYLE_CLASS_TOOLBAR); + gtk_box_pack_start(GTK_BOX(buttons), zoom_group, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(buttons), funnel, FALSE, FALSE, 0); + gtk_widget_set_halign(buttons, GTK_ALIGN_CENTER); + + // TODO(p): Implement. Probably fill `buttons` in externally. + gtk_widget_set_sensitive(plus, FALSE); + gtk_widget_set_sensitive(minus, FALSE); + gtk_widget_set_sensitive(funnel, FALSE); self->listbox = gtk_list_box_new(); gtk_list_box_set_selection_mode( GTK_LIST_BOX(self->listbox), GTK_SELECTION_NONE); g_signal_connect(self->listbox, "row-activated", G_CALLBACK(on_open_breadcrumb), self); - gtk_container_add(GTK_CONTAINER(superbox), self->listbox); + + GtkWidget *superbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); + gtk_container_add( + GTK_CONTAINER(superbox), GTK_WIDGET(self->places)); + gtk_container_add( + GTK_CONTAINER(superbox), gtk_separator_new(GTK_ORIENTATION_VERTICAL)); + gtk_container_add( + GTK_CONTAINER(superbox), buttons); + gtk_container_add( + GTK_CONTAINER(superbox), gtk_separator_new(GTK_ORIENTATION_VERTICAL)); + gtk_container_add( + GTK_CONTAINER(superbox), self->listbox); + gtk_container_add(GTK_CONTAINER(self), superbox); gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW(self), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); gtk_style_context_add_class(gtk_widget_get_style_context(GTK_WIDGET(self)), GTK_STYLE_CLASS_SIDEBAR); - gtk_container_add(GTK_CONTAINER(self), superbox); + gtk_style_context_add_class(gtk_widget_get_style_context(GTK_WIDGET(self)), + "fastiv"); } // --- Public interface -------------------------------------------------------- diff --git a/fastiv.c b/fastiv.c index d0bed31..ba713f2 100644 --- a/fastiv.c +++ b/fastiv.c @@ -482,11 +482,15 @@ main(int argc, char *argv[]) const gchar *path_arg = path_args ? path_args[0] : NULL; gtk_window_set_default_icon_name(PROJECT_NAME); + gtk_icon_theme_add_resource_path( + gtk_icon_theme_get_default(), "/org/gnome/design/IconLibrary/"); // This is incredibly broken https://stackoverflow.com/a/51054396/76313 // thus resolving the problem using overlaps. const char *style = "@define-color fastiv-tile #3c3c3c; \ fastiv-view, fastiv-browser { background: #222; } \ + placessidebar.fastiv .toolbar { padding: 2px 6px; } \ + placessidebar.fastiv box > separator { margin: 4px 0; } \ fastiv-browser { padding: 5px; } \ fastiv-browser.item { \ border: 1px solid rgba(255, 255, 255, 0.375); \ diff --git a/meson.build b/meson.build index 61f3f52..970f81a 100644 --- a/meson.build +++ b/meson.build @@ -36,8 +36,15 @@ configure_file( configuration : conf, ) +gnome = import('gnome') +resources = gnome.compile_resources('resources', + 'resources/resources.gresource.xml', + source_dir : 'resources', + c_name : 'resources', +) + exe = executable('fastiv', 'fastiv.c', 'fastiv-view.c', 'fastiv-io.c', - 'fastiv-browser.c', 'fastiv-sidebar.c', 'xdg.c', + 'fastiv-browser.c', 'fastiv-sidebar.c', 'xdg.c', resources, install : true, dependencies : [dependencies]) diff --git a/resources/LICENSE b/resources/LICENSE new file mode 100644 index 0000000..4e56629 --- /dev/null +++ b/resources/LICENSE @@ -0,0 +1,5 @@ +Symbolic icons originate from the Icon Development Kit[0]. +The authors have disclaimed most of their rights to the works under CC0 1.0[1]. + +[0] https://gitlab.gnome.org/Teams/Design/icon-development-kit/ +[1] https://creativecommons.org/publicdomain/zero/1.0/ diff --git a/resources/circle-filled-symbolic.svg b/resources/circle-filled-symbolic.svg new file mode 100644 index 0000000..fe1a288 --- /dev/null +++ b/resources/circle-filled-symbolic.svg @@ -0,0 +1,150 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/funnel-symbolic.svg b/resources/funnel-symbolic.svg new file mode 100644 index 0000000..e0eba8a --- /dev/null +++ b/resources/funnel-symbolic.svg @@ -0,0 +1,150 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/resources.gresource.xml b/resources/resources.gresource.xml new file mode 100644 index 0000000..b229292 --- /dev/null +++ b/resources/resources.gresource.xml @@ -0,0 +1,7 @@ + + + + circle-filled-symbolic.svg + funnel-symbolic.svg + +