parent
ad29013e44
commit
24f9d21ca7
99
fastiv.c
99
fastiv.c
|
@ -52,7 +52,7 @@ exit_fatal(const gchar *format, ...)
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- Help --------------------------------------------------------------------
|
// --- Keyboard shortcuts ------------------------------------------------------
|
||||||
// Fuck XML, this can be easily represented in static structures.
|
// Fuck XML, this can be easily represented in static structures.
|
||||||
// Though it would be nice if the accelerators could be customized.
|
// 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[] = {
|
static struct key_group help_keys_browser[] = {
|
||||||
{"Browser", "browser", (struct key_group[]) {
|
|
||||||
{"General", help_keys_general},
|
{"General", help_keys_general},
|
||||||
{"View", (struct key[]) {
|
{"View", (struct key[]) {
|
||||||
{"F9", "Toggle navigation sidebar"},
|
{"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},
|
{"General", help_keys_general},
|
||||||
{"View", (struct key[]) {
|
{"View", (struct key[]) {
|
||||||
{"F8", "Toggle toolbar"},
|
{"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;
|
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
|
int
|
||||||
main(int argc, char *argv[])
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
@ -1165,45 +1206,9 @@ main(int argc, char *argv[])
|
||||||
gtk_icon_theme_add_resource_path(
|
gtk_icon_theme_add_resource_path(
|
||||||
gtk_icon_theme_get_default(), "/org/gnome/design/IconLibrary/");
|
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();
|
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_context_add_provider_for_screen(gdk_screen_get_default(),
|
||||||
GTK_STYLE_PROVIDER(provider), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
|
GTK_STYLE_PROVIDER(provider), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
|
||||||
g_object_unref(provider);
|
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_hadjustment(GTK_CONTAINER(browser_port), NULL);
|
||||||
gtk_container_set_focus_vadjustment(GTK_CONTAINER(browser_port), NULL);
|
gtk_container_set_focus_vadjustment(GTK_CONTAINER(browser_port), NULL);
|
||||||
|
|
||||||
// TODO(p): As with GtkFileChooserWidget, bind:
|
// TODO(p): As with GtkFileChooserWidget, bind C-h to filtering,
|
||||||
// - C-h to filtering,
|
// and mayhaps forward the rest to the sidebar, somehow.
|
||||||
// - M-Up to going a level above,
|
|
||||||
// - mayhaps forward the rest to the sidebar, somehow.
|
|
||||||
g.browser_sidebar = g_object_new(FIV_TYPE_SIDEBAR, NULL);
|
g.browser_sidebar = g_object_new(FIV_TYPE_SIDEBAR, NULL);
|
||||||
g_signal_connect(g.browser_sidebar, "open-location",
|
g_signal_connect(g.browser_sidebar, "open-location",
|
||||||
G_CALLBACK(on_open_location), NULL);
|
G_CALLBACK(on_open_location), NULL);
|
||||||
|
|
Loading…
Reference in New Issue