aboutsummaryrefslogtreecommitdiff
path: root/fastiv-sidebar.c
diff options
context:
space:
mode:
Diffstat (limited to 'fastiv-sidebar.c')
-rw-r--r--fastiv-sidebar.c47
1 files changed, 14 insertions, 33 deletions
diff --git a/fastiv-sidebar.c b/fastiv-sidebar.c
index 279139f..bb62c2e 100644
--- a/fastiv-sidebar.c
+++ b/fastiv-sidebar.c
@@ -22,6 +22,7 @@
struct _FastivSidebar {
GtkScrolledWindow parent_instance;
GtkPlacesSidebar *places;
+ GtkWidget *toolbar;
GtkWidget *listbox;
GFile *location;
};
@@ -358,56 +359,29 @@ fastiv_sidebar_init(FastivSidebar *self)
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(self->places),
GTK_POLICY_NEVER, GTK_POLICY_NEVER);
- // Fill up what would otherwise be wasted space,
- // 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);
+ // It is either side-favouring borders or excess button padding.
+ self->toolbar = 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);
+ gtk_widget_get_style_context(self->toolbar), GTK_STYLE_CLASS_TOOLBAR);
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_list_box_set_sort_func(
GTK_LIST_BOX(self->listbox), listbox_sort, self, NULL);
+ // Fill up what would otherwise be wasted space,
+ // as it is in the examples 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));
gtk_container_add(
- GTK_CONTAINER(superbox), buttons);
+ GTK_CONTAINER(superbox), self->toolbar);
gtk_container_add(
GTK_CONTAINER(superbox), gtk_separator_new(GTK_ORIENTATION_VERTICAL));
gtk_container_add(
@@ -437,3 +411,10 @@ fastiv_sidebar_show_enter_location(FastivSidebar *self)
g_return_if_fail(FASTIV_IS_SIDEBAR(self));
g_signal_emit_by_name(self->places, "show-enter-location");
}
+
+GtkBox *
+fastiv_sidebar_get_toolbar(FastivSidebar *self)
+{
+ g_return_val_if_fail(FASTIV_IS_SIDEBAR(self), NULL);
+ return GTK_BOX(self->toolbar);
+}