[eog] Replace deprecated GtkRCStyle usage with a GtkCssProvider
- From: Felix Riemann <friemann src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [eog] Replace deprecated GtkRCStyle usage with a GtkCssProvider
- Date: Wed, 14 Dec 2011 21:05:03 +0000 (UTC)
commit 4c93c41fcfc1cab32c10a66e247d4a0fb3d60a05
Author: Felix Riemann <friemann gnome org>
Date: Wed Dec 14 22:02:36 2011 +0100
Replace deprecated GtkRCStyle usage with a GtkCssProvider
Makes EogThumbNav's scrollbar style similar to pre-3.x versions again.
data/Makefile.am | 4 ++--
data/eog.css | 7 +++++++
data/gtkrc | 9 ---------
src/main.c | 21 +++++++++++++++++++--
4 files changed, 28 insertions(+), 13 deletions(-)
---
diff --git a/data/Makefile.am b/data/Makefile.am
index 99cfe12..d8ad190 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -29,8 +29,8 @@ ui_DATA = eog-image-properties-dialog.ui \
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = eog.pc
-gtkrcdir = $(pkgdatadir)
-gtkrc_DATA = gtkrc
+styledir = $(pkgdatadir)
+style_DATA = eog.css
EXTRA_DIST = \
$(gtkrc_DATA) \
diff --git a/data/eog.css b/data/eog.css
new file mode 100644
index 0000000..7cef526
--- /dev/null
+++ b/data/eog.css
@@ -0,0 +1,7 @@
+GtkScrollbar#eog-image-gallery-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 e83abed..ece7026 100644
--- a/src/main.c
+++ b/src/main.c
@@ -46,6 +46,8 @@
#include <exempi/xmp.h>
#endif
+#define EOG_CSS_FILE_PATH EOG_DATA_DIR G_DIR_SEPARATOR_S "eog.css"
+
static EogStartupFlags flags;
static gboolean fullscreen = FALSE;
@@ -100,6 +102,7 @@ main (int argc, char **argv)
GError *error = NULL;
GOptionContext *ctx;
GtkSettings *settings;
+ GtkCssProvider *provider;
if (!g_thread_supported ())
g_thread_init (NULL);
@@ -108,8 +111,6 @@ main (int argc, char **argv)
bind_textdomain_codeset (PACKAGE, "UTF-8");
textdomain (PACKAGE);
- gtk_rc_parse (EOG_DATA_DIR G_DIR_SEPARATOR_S "gtkrc");
-
ctx = g_option_context_new (_("[FILEâ]"));
g_option_context_add_main_entries (ctx, goption_options, PACKAGE);
/* Option groups are free'd together with the context
@@ -149,6 +150,22 @@ main (int argc, char **argv)
gdk_threads_init ();
eog_thumbnail_init ();
+ /* Load special style properties for EogThumbView's scrollbar */
+ provider = gtk_css_provider_new ();
+ if (G_UNLIKELY (!gtk_css_provider_load_from_path(provider,
+ EOG_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);
+
/* Add application specific icons to search path */
gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (),
EOG_DATA_DIR G_DIR_SEPARATOR_S "icons");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]