Get rid of undesired indentation.
This commit is contained in:
Přemysl Eric Janouch 2021-12-21 08:36:11 +01:00
parent ad29013e44
commit 24f9d21ca7
Signed by: p
GPG Key ID: A0420B94F92B9493
1 changed files with 115 additions and 112 deletions

View File

@ -52,7 +52,7 @@ exit_fatal(const gchar *format, ...)
exit(EXIT_FAILURE);
}
// --- Help --------------------------------------------------------------------
// --- Keyboard shortcuts ------------------------------------------------------
// Fuck XML, this can be easily represented in static structures.
// Though it would be nice if the accelerators could be customized.
@ -81,8 +81,7 @@ static struct key help_keys_general[] = {
{}
};
static struct key_section help_keys[] = {
{"Browser", "browser", (struct key_group[]) {
static struct key_group help_keys_browser[] = {
{"General", help_keys_general},
{"View", (struct key[]) {
{"F9", "Toggle navigation sidebar"},
@ -99,8 +98,9 @@ static struct key_section help_keys[] = {
{}
}},
{}
}},
{"View", "view", (struct key_group[]) {
};
static struct key_group help_keys_view[] = {
{"General", help_keys_general},
{"View", (struct key[]) {
{"F8", "Toggle toolbar"},
@ -150,7 +150,11 @@ static struct key_section help_keys[] = {
{}
}},
{}
}},
};
static struct key_section help_keys[] = {
{"Browser", "browser", help_keys_browser},
{"View", "view", help_keys_view},
{}
};
@ -1119,6 +1123,43 @@ make_view_toolbar(void)
return view_toolbar;
}
// This is incredibly broken https://stackoverflow.com/a/51054396/76313
// thus resolving the problem using overlaps.
// We're trying to be universal for light and dark themes both. It's hard.
static const char stylesheet[] = "@define-color fiv-tile @content_view_bg; \
fiv-view, fiv-browser { background: @content_view_bg; } \
placessidebar.fiv .toolbar { padding: 2px 6px; } \
placessidebar.fiv box > separator { margin: 4px 0; } \
#toolbar button { padding-left: 0; padding-right: 0; } \
#toolbar > button:first-child { padding-left: 4px; } \
#toolbar > button:last-child { padding-right: 4px; } \
#toolbar separator { \
background: mix(@insensitive_fg_color, \
@insensitive_bg_color, 0.4); margin: 6px 10px; \
} \
fiv-browser { padding: 5px; } \
fiv-browser.item { \
color: mix(#000, @content_view_bg, 0.625); margin: 8px; \
border: 2px solid #fff; \
} \
fiv-browser.item, fiv-view.checkerboard { \
background: @theme_bg_color; background-image: \
linear-gradient(45deg, @fiv-tile 26%, transparent 26%), \
linear-gradient(-45deg, @fiv-tile 26%, transparent 26%), \
linear-gradient(45deg, transparent 74%, @fiv-tile 74%), \
linear-gradient(-45deg, transparent 74%, @fiv-tile 74%); \
background-size: 40px 40px; \
background-position: 0 0, 0 20px, 20px -20px, -20px 0px; \
} \
fiv-browser.item:backdrop { \
color: mix(#000, @content_view_bg, 0.875); \
border-color: mix(#fff, @content_view_bg, 0.5); \
} \
fiv-browser.item.symbolic { \
border-color: transparent; color: shade(@theme_bg_color, 0.875); \
background: @theme_bg_color; background-image: none; \
}";
int
main(int argc, char *argv[])
{
@ -1165,45 +1206,9 @@ main(int argc, char *argv[])
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.
// We're trying to be universal for light and dark themes both. It's hard.
const char *style = "@define-color fiv-tile @content_view_bg; \
fiv-view, fiv-browser { background: @content_view_bg; } \
placessidebar.fiv .toolbar { padding: 2px 6px; } \
placessidebar.fiv box > separator { margin: 4px 0; } \
#toolbar button { padding-left: 0; padding-right: 0; } \
#toolbar > button:first-child { padding-left: 4px; } \
#toolbar > button:last-child { padding-right: 4px; } \
#toolbar separator { \
background: mix(@insensitive_fg_color, \
@insensitive_bg_color, 0.4); margin: 6px 10px; \
} \
fiv-browser { padding: 5px; } \
fiv-browser.item { \
color: mix(#000, @content_view_bg, 0.625); margin: 8px; \
border: 2px solid #fff; \
} \
fiv-browser.item, fiv-view.checkerboard { \
background: @theme_bg_color; background-image: \
linear-gradient(45deg, @fiv-tile 26%, transparent 26%), \
linear-gradient(-45deg, @fiv-tile 26%, transparent 26%), \
linear-gradient(45deg, transparent 74%, @fiv-tile 74%), \
linear-gradient(-45deg, transparent 74%, @fiv-tile 74%); \
background-size: 40px 40px; \
background-position: 0 0, 0 20px, 20px -20px, -20px 0px; \
} \
fiv-browser.item:backdrop { \
color: mix(#000, @content_view_bg, 0.875); \
border-color: mix(#fff, @content_view_bg, 0.5); \
} \
fiv-browser.item.symbolic { \
border-color: transparent; color: shade(@theme_bg_color, 0.875); \
background: @theme_bg_color; background-image: none; \
}";
GtkCssProvider *provider = gtk_css_provider_new();
gtk_css_provider_load_from_data(provider, style, strlen(style), NULL);
gtk_css_provider_load_from_data(
provider, stylesheet, sizeof stylesheet - 1, NULL);
gtk_style_context_add_provider_for_screen(gdk_screen_get_default(),
GTK_STYLE_PROVIDER(provider), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
g_object_unref(provider);
@ -1238,10 +1243,8 @@ main(int argc, char *argv[])
gtk_container_set_focus_hadjustment(GTK_CONTAINER(browser_port), NULL);
gtk_container_set_focus_vadjustment(GTK_CONTAINER(browser_port), NULL);
// TODO(p): As with GtkFileChooserWidget, bind:
// - C-h to filtering,
// - M-Up to going a level above,
// - mayhaps forward the rest to the sidebar, somehow.
// TODO(p): As with GtkFileChooserWidget, bind C-h to filtering,
// and mayhaps forward the rest to the sidebar, somehow.
g.browser_sidebar = g_object_new(FIV_TYPE_SIDEBAR, NULL);
g_signal_connect(g.browser_sidebar, "open-location",
G_CALLBACK(on_open_location), NULL);