[gthumb] use different css for different versions of gtk+
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gthumb] use different css for different versions of gtk+
- Date: Sun, 29 Mar 2015 20:32:12 +0000 (UTC)
commit 8633276e30a85fa8f1491d32acc8bc6ead108ad4
Author: Paolo Bacchilega <paobac src gnome org>
Date: Sun Mar 29 22:23:11 2015 +0200
use different css for different versions of gtk+
gthumb/gth-window.c | 27 +++++++++++++++++++--------
gthumb/gthumb.gresource.xml | 2 ++
gthumb/resources/Makefile.am | 2 ++
gthumb/resources/gthumb-gtk312.css | 7 +++++++
gthumb/resources/gthumb-gtk314.css | 7 +++++++
gthumb/resources/gthumb.css | 8 --------
6 files changed, 37 insertions(+), 16 deletions(-)
---
diff --git a/gthumb/gth-window.c b/gthumb/gth-window.c
index a63f5f9..ef8a8c6 100644
--- a/gthumb/gth-window.c
+++ b/gthumb/gth-window.c
@@ -252,21 +252,17 @@ gth_window_real_set_current_page (GthWindow *window,
static void
-gth_window_realize (GtkWidget *widget)
+_gth_window_add_css_provider (GtkWidget *widget,
+ const char *path)
{
- GdkScreen *screen;
GBytes *bytes;
gconstpointer css_data;
gsize css_data_size;
GtkCssProvider *css_provider;
GError *error = NULL;
- GTK_WIDGET_CLASS (gth_window_parent_class)->realize (widget);
-
- screen = gtk_widget_get_screen (widget);
- gtk_icon_theme_append_search_path (gtk_icon_theme_get_for_screen (screen), GTHUMB_ICON_DIR);
- bytes = g_resources_lookup_data ("/org/gnome/gThumb/resources/gthumb.css", 0, &error);
+ bytes = g_resources_lookup_data (path, 0, &error);
if (bytes == NULL) {
g_warning ("%s", error->message);
g_error_free (error);
@@ -279,7 +275,7 @@ gth_window_realize (GtkWidget *widget)
g_warning ("%s", error->message);
g_error_free (error);
}
- gtk_style_context_add_provider_for_screen (screen,
+ gtk_style_context_add_provider_for_screen (gtk_widget_get_screen (widget),
GTK_STYLE_PROVIDER (css_provider),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
@@ -289,6 +285,21 @@ gth_window_realize (GtkWidget *widget)
static void
+gth_window_realize (GtkWidget *widget)
+{
+ GTK_WIDGET_CLASS (gth_window_parent_class)->realize (widget);
+
+ gtk_icon_theme_append_search_path (gtk_icon_theme_get_for_screen (gtk_widget_get_screen (widget)),
GTHUMB_ICON_DIR);
+
+ _gth_window_add_css_provider (widget, "/org/gnome/gThumb/resources/gthumb.css");
+ if ((gtk_major_version >= 3) && (gtk_minor_version >= 14))
+ _gth_window_add_css_provider (widget, "/org/gnome/gThumb/resources/gthumb-gtk314.css");
+ else if ((gtk_major_version >= 3) && (gtk_minor_version >= 10))
+ _gth_window_add_css_provider (widget, "/org/gnome/gThumb/resources/gthumb-gtk312.css");
+}
+
+
+static void
gth_window_class_init (GthWindowClass *klass)
{
GObjectClass *gobject_class;
diff --git a/gthumb/gthumb.gresource.xml b/gthumb/gthumb.gresource.xml
index 78a7c4d..5d508e1 100644
--- a/gthumb/gthumb.gresource.xml
+++ b/gthumb/gthumb.gresource.xml
@@ -7,6 +7,8 @@
<file compressed="true">resources/folder-menu.ui</file>
<file compressed="true">resources/gears-menu.ui</file>
<file compressed="true">resources/gthumb.css</file>
+ <file compressed="true">resources/gthumb-gtk312.css</file>
+ <file compressed="true">resources/gthumb-gtk314.css</file>
<file compressed="true">resources/history-menu.ui</file>
</gresource>
</gresources>
diff --git a/gthumb/resources/Makefile.am b/gthumb/resources/Makefile.am
index a9037db..58b771d 100644
--- a/gthumb/resources/Makefile.am
+++ b/gthumb/resources/Makefile.am
@@ -5,6 +5,8 @@ EXTRA_DIST = \
folder-menu.ui \
gears-menu.ui \
gthumb.css \
+ gthumb-gtk312.css \
+ gthumb-gtk314.css \
history-menu.ui
-include $(top_srcdir)/git.mk
\ No newline at end of file
diff --git a/gthumb/resources/gthumb-gtk312.css b/gthumb/resources/gthumb-gtk312.css
new file mode 100644
index 0000000..6a51363
--- /dev/null
+++ b/gthumb/resources/gthumb-gtk312.css
@@ -0,0 +1,7 @@
+/* -- preview button in the filter grid -- */
+
+GtkButton.filter-preview:active {
+ background-image: none;
+ background-color: @theme_selected_bg_color;
+ color: @theme_selected_fg_color;
+}
diff --git a/gthumb/resources/gthumb-gtk314.css b/gthumb/resources/gthumb-gtk314.css
new file mode 100644
index 0000000..b797a5a
--- /dev/null
+++ b/gthumb/resources/gthumb-gtk314.css
@@ -0,0 +1,7 @@
+/* -- preview button in the filter grid -- */
+
+GtkButton.filter-preview:checked {
+ background-image: none;
+ background-color: @theme_selected_bg_color;
+ color: @theme_selected_fg_color;
+}
diff --git a/gthumb/resources/gthumb.css b/gthumb/resources/gthumb.css
index f6876c6..8e799ff 100644
--- a/gthumb/resources/gthumb.css
+++ b/gthumb/resources/gthumb.css
@@ -138,14 +138,6 @@ GtkLabel.extension-description {
background-color: #000;
}
-/* -- preview button in the filter grid -- */
-
-GtkButton.filter-preview:checked {
- background-image: none;
- background-color: @theme_unfocused_selected_bg_color;
- color: @theme_unfocused_selected_fg_color;
-}
-
/* -- header-bar inside the toolbox -- */
GthToolbox .header-bar {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]