Work around an annoying GTK+ issue

This commit is contained in:
Přemysl Eric Janouch 2022-01-07 07:27:33 +01:00
parent 6869816cc4
commit fc559c3d01
Signed by: p
GPG Key ID: A0420B94F92B9493
1 changed files with 14 additions and 1 deletions

View File

@ -53,16 +53,29 @@ fiv_sidebar_dispose(GObject *gobject)
G_OBJECT_CLASS(fiv_sidebar_parent_class)->dispose(gobject);
}
static void
fiv_sidebar_realize(GtkWidget *widget)
{
GTK_WIDGET_CLASS(fiv_sidebar_parent_class)->realize(widget);
// Fucking GTK+. With no bookmarks, the revealer takes up space anyway.
FivSidebar *self = FIV_SIDEBAR(widget);
gtk_places_sidebar_set_drop_targets_visible(self->places, TRUE, NULL);
gtk_places_sidebar_set_drop_targets_visible(self->places, FALSE, NULL);
}
static void
fiv_sidebar_class_init(FivSidebarClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS(klass);
object_class->dispose = fiv_sidebar_dispose;
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass);
widget_class->realize = fiv_sidebar_realize;
// You're giving me no choice, Adwaita.
// Your style is hardcoded to match against the class' CSS name.
// And I need replicate the internal widget structure.
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass);
gtk_widget_class_set_css_name(widget_class, "placessidebar");
// TODO(p): Consider a return value, and using it.