summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac1
-rw-r--r--data/Makefile.am5
-rw-r--r--data/eom.css7
-rw-r--r--src/main.c28
4 files changed, 41 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 1979f6d..e69ce9f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -105,6 +105,7 @@ case "$with_gtk" in
;;
esac
AC_SUBST(GTK_API_VERSION)
+AM_CONDITIONAL([HAVE_GTK3], [test "x$GTK_API_VERSION" = "x3.0"])
GLIB_REQUIRED=2.25.9
GIO_REQUIRED=2.25.9
diff --git a/data/Makefile.am b/data/Makefile.am
index 17331e2..67797eb 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -34,8 +34,13 @@ ui_DATA = \
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = eom.pc
+if HAVE_GTK3
+styledir = $(pkgdatadir)
+style_DATA = eom.css
+else
gtkrcdir = $(pkgdatadir)
gtkrc_DATA = gtkrc
+endif
EXTRA_DIST = \
$(gtkrc_DATA) \
diff --git a/data/eom.css b/data/eom.css
new file mode 100644
index 0000000..33d596f
--- /dev/null
+++ b/data/eom.css
@@ -0,0 +1,7 @@
+EomThumbNav .horizontal.scrollbar {
+ -GtkScrollbar-has-backward-stepper: false;
+ -GtkScrollbar-has-secondary-backward-stepper: false;
+ -GtkScrollbar-has-forward-stepper: false;
+ -GtkScrollbar-has-secondary-forward-stepper: false;
+ -GtkScrollbar-min-slider-length: 60;
+}
diff --git a/src/main.c b/src/main.c
index 99d801a..99d01d2 100644
--- a/src/main.c
+++ b/src/main.c
@@ -50,6 +50,10 @@
#include <exempi/xmp.h>
#endif
+#if GTK_CHECK_VERSION (3, 0, 0)
+#define EOM_CSS_FILE_PATH EOM_DATA_DIR G_DIR_SEPARATOR_S "eom.css"
+#endif
+
static EomStartupFlags flags;
static gboolean fullscreen = FALSE;
@@ -187,12 +191,17 @@ main (int argc, char **argv)
{
GError *error = NULL;
GOptionContext *ctx;
+#if GTK_CHECK_VERSION (3, 0, 0)
+ GtkCssProvider *provider;
+#endif
bindtextdomain (GETTEXT_PACKAGE, EOM_LOCALE_DIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
+#if !GTK_CHECK_VERSION (3, 0, 0)
gtk_rc_parse (EOM_DATA_DIR G_DIR_SEPARATOR_S "gtkrc");
+#endif
ctx = g_option_context_new (NULL);
g_option_context_add_main_entries (ctx, goption_options, PACKAGE);
@@ -238,6 +247,25 @@ main (int argc, char **argv)
eom_job_queue_init ();
gdk_threads_init ();
eom_thumbnail_init ();
+
+#if GTK_CHECK_VERSION (3, 0, 0)
+ /* Load special style properties for EomThumbView's scrollbar */
+ provider = gtk_css_provider_new ();
+ if (G_UNLIKELY (!gtk_css_provider_load_from_path(provider,
+ EOM_CSS_FILE_PATH,
+ &error)))
+ {
+ g_critical ("Could not load CSS data: %s", error->message);
+ g_clear_error (&error);
+ } else {
+ gtk_style_context_add_provider_for_screen (
+ gdk_screen_get_default(),
+ GTK_STYLE_PROVIDER (provider),
+ GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+ }
+ g_object_unref (provider);
+#endif
+
eom_plugin_engine_init ();
/* Add application specific icons to search path */