[geany/geany] 1f392b: ui-utils: Load per-version GTK+ CSS file

Quentin Glidic git-noreply at xxxxx
Mon May 2 22:33:44 UTC 2016


Branch:      refs/heads/master
Author:      Quentin Glidic <sardemff7+git at sardemff7.net>
Committer:   Quentin Glidic <sardemff7+git at sardemff7.net>
Date:        Thu, 14 Apr 2016 11:17:12 UTC
Commit:      1f392b75bfda21255349e48163ba5afe220ed55f
             https://github.com/geany/geany/commit/1f392b75bfda21255349e48163ba5afe220ed55f

Log Message:
-----------
ui-utils: Load per-version GTK+ CSS file

Signed-off-by: Quentin Glidic <sardemff7+git at sardemff7.net>


Modified Paths:
--------------
    data/Makefile.am
    data/geany-3.0.css
    data/geany-3.20.css
    data/geany.css
    geany.nsi.in
    src/ui_utils.c

Modified: data/Makefile.am
5 lines changed, 4 insertions(+), 1 deletions(-)
===================================================================
@@ -113,7 +113,10 @@ nobase_dist_pkgdata_DATA = \
 	geany.glade
 
 if GTK3
-nobase_dist_pkgdata_DATA += geany.css
+nobase_dist_pkgdata_DATA += \
+	geany-3.0.css \
+	geany-3.20.css \
+	geany.css
 else
 nobase_dist_pkgdata_DATA += geany.gtkrc
 endif


Modified: data/geany-3.0.css
10 lines changed, 10 insertions(+), 0 deletions(-)
===================================================================
@@ -0,0 +1,10 @@
+ at 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;
+}


Modified: data/geany-3.20.css
8 lines changed, 8 insertions(+), 0 deletions(-)
===================================================================
@@ -0,0 +1,8 @@
+ at import "geany.css";
+
+/* make close button on the editor's tabs smaller */
+#geany-close-tab-button {
+	outline-offset: 0;
+	outline-width: 0;
+	border: 0;
+}


Modified: data/geany.css
5 lines changed, 0 insertions(+), 5 deletions(-)
===================================================================
@@ -2,11 +2,6 @@
 
 /* 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;
 	padding: 0;
 }
 #geany-close-tab-button GtkImage {


Modified: geany.nsi.in
1 lines changed, 1 insertions(+), 0 deletions(-)
===================================================================
@@ -138,6 +138,7 @@ Section "!Program Files" SEC01
 	File "${RESOURCEDIR}\data\filetype_extensions.conf"
 	File "${RESOURCEDIR}\data\geany.glade"
 !if ${GTK_VERSION} >= 3
+	File "${RESOURCEDIR}\data\geany-3.20.css"
 	File "${RESOURCEDIR}\data\geany.css"
 !else
 	File "${RESOURCEDIR}\data\geany.gtkrc"


Modified: src/ui_utils.c
20 lines changed, 19 insertions(+), 1 deletions(-)
===================================================================
@@ -2477,10 +2477,28 @@ void ui_init_builder(void)
 static void init_custom_style(void)
 {
 #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();
 	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))
 	{
 		g_warning("Failed to load custom CSS: %s", error->message);



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Commits mailing list