Merge branch 'gtk-version-specific-css' into gtk-3-20-fixes

Merges pull request #994.
This commit is contained in:
Colomban Wendling 2016-05-02 15:21:36 +02:00
commit 5851f5616e
6 changed files with 45 additions and 7 deletions

View File

@ -113,7 +113,10 @@ nobase_dist_pkgdata_DATA = \
geany.glade geany.glade
if GTK3 if GTK3
nobase_dist_pkgdata_DATA += geany.css nobase_dist_pkgdata_DATA += \
geany-3.0.css \
geany-3.20.css \
geany.css
else else
nobase_dist_pkgdata_DATA += geany.gtkrc nobase_dist_pkgdata_DATA += geany.gtkrc
endif endif

10
data/geany-3.0.css Normal file
View File

@ -0,0 +1,10 @@
@import "geany.css";
/* make close button on the editor's tabs smaller */
#geany-close-tab-button {
-GtkWidget-focus-padding: 0;
-GtkWidget-focus-line-width: 0;
-GtkButton-default-border: 0;
-GtkButton-default-outside-border: 0;
-GtkButton-inner-border: 0;
}

11
data/geany-3.20.css Normal file
View File

@ -0,0 +1,11 @@
@import "geany.css";
/* make close button on the editor's tabs smaller */
#geany-close-tab-button {
outline-offset: 0;
outline-width: 0;
margin: 0;
margin-left: 0.5em;
min-width: 0;
min-height: 0;
}

View File

@ -2,11 +2,6 @@
/* make close button on the editor's tabs smaller */ /* make close button on the editor's tabs smaller */
#geany-close-tab-button { #geany-close-tab-button {
-GtkWidget-focus-padding: 0;
-GtkWidget-focus-line-width: 0;
-GtkButton-default-border: 0;
-GtkButton-default-outside-border: 0;
-GtkButton-inner-border: 0;
padding: 0; padding: 0;
} }
#geany-close-tab-button GtkImage { #geany-close-tab-button GtkImage {

View File

@ -138,6 +138,7 @@ Section "!Program Files" SEC01
File "${RESOURCEDIR}\data\filetype_extensions.conf" File "${RESOURCEDIR}\data\filetype_extensions.conf"
File "${RESOURCEDIR}\data\geany.glade" File "${RESOURCEDIR}\data\geany.glade"
!if ${GTK_VERSION} >= 3 !if ${GTK_VERSION} >= 3
File "${RESOURCEDIR}\data\geany-3.20.css"
File "${RESOURCEDIR}\data\geany.css" File "${RESOURCEDIR}\data\geany.css"
!else !else
File "${RESOURCEDIR}\data\geany.gtkrc" File "${RESOURCEDIR}\data\geany.gtkrc"

View File

@ -2475,10 +2475,28 @@ void ui_init_builder(void)
static void init_custom_style(void) static void init_custom_style(void)
{ {
#if GTK_CHECK_VERSION(3, 0, 0) #if GTK_CHECK_VERSION(3, 0, 0)
gchar *css_file = g_build_filename(app->datadir, "geany.css", NULL); const struct {
guint version;
const gchar *file;
} css_files[] = {
/*
* Keep these from newest to oldest,
* and make sure 0 remains last
*/
{ 20, "geany-3.20.css" },
{ 0, "geany-3.0.css" },
};
guint gtk_version = gtk_get_minor_version();
gsize i = 0;
gchar *css_file;
GtkCssProvider *css = gtk_css_provider_new(); GtkCssProvider *css = gtk_css_provider_new();
GError *error = NULL; GError *error = NULL;
/* gtk_version will never be smaller than 0 */
while (css_files[i].version > gtk_version)
++i;
css_file = g_build_filename(app->datadir, css_files[i].file, NULL);
if (! gtk_css_provider_load_from_path(css, css_file, &error)) if (! gtk_css_provider_load_from_path(css, css_file, &error))
{ {
g_warning("Failed to load custom CSS: %s", error->message); g_warning("Failed to load custom CSS: %s", error->message);