Permalink
Browse files

Add GTK3 version of our custom styles

Although GTK3 still have gtk_rc_parse_string(), it doesn't work anymore
for our overrides, so register proper CSS for them.
  • Loading branch information...
1 parent 7d0adef commit f735e6800bddcffc1819b480601be658560f0256 @b4n b4n committed Sep 28, 2012
Showing with 52 additions and 1 deletion.
  1. +6 −1 Makefile.am
  2. +1 −0 configure.ac
  3. +25 −0 data/geany.css
  4. +20 −0 src/ui_utils.c
View
@@ -24,8 +24,13 @@ SYS_DATA_FILES = \
$(srcdir)/data/templates/* \
$(srcdir)/data/templates/files/* \
$(srcdir)/data/colorschemes/* \
- $(top_srcdir)/data/geany.glade \
+ $(top_srcdir)/data/geany.glade
+
+if GTK3
+ $(top_srcdir)/data/geany.css
+else
$(top_srcdir)/data/geany.gtkrc
+endif
EXTRA_DIST = \
autogen.sh \
View
@@ -67,6 +67,7 @@ AS_IF([test "x$enable_gtk3" = xyes],
gtk_min_version=3.0],
[gtk_package=gtk+-2.0
gtk_min_version=2.16])
+AM_CONDITIONAL([GTK3], [test "x$gtk_package" = "xgtk+-3.0"])
# GTK/GLib/GIO checks
gtk_modules="$gtk_package >= $gtk_min_version glib-2.0 >= 2.20"
View
@@ -0,0 +1,25 @@
+/* custom GTK3 CSS for Geany */
+
+/* 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;
+}
+
+/* use monospaced font in search entries for easier reading of regexp (#1907117) */
+#GeanyDialogSearch GtkEntry {
+ font-family: monospace;
+}
+
+/* set red background for GtkEntries showing unmatched searches */
+#geany-search-entry-no-match {
+ color: #fff;
+ background: #ff6666;
+}
+#geany-search-entry-no-match:selected {
+ background-color: #771111;
+}
View
@@ -2260,10 +2260,30 @@ 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);
+ GtkCssProvider *css = gtk_css_provider_new();
+ GError *error = NULL;
+
+ if (! gtk_css_provider_load_from_path(css, css_file, &error))
+ {
+ g_warning("Failed to load custom CSS: %s", error->message);
+ g_error_free(error);
+ }
+ else
+ {
+ gtk_style_context_add_provider_for_screen(gdk_screen_get_default(),
+ GTK_STYLE_PROVIDER(css), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+ }
+
+ g_object_unref(css);
+ g_free(css_file);
+#else
gchar *gtkrc_file = g_build_filename(app->datadir, "geany.gtkrc", NULL);
gtk_rc_parse(gtkrc_file);
g_free(gtkrc_file);
+#endif
}

0 comments on commit f735e68

Please sign in to comment.