summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWolfgang Ulbrich <[email protected]>2016-01-07 04:53:29 +0100
committerWolfgang Ulbrich <[email protected]>2016-01-13 15:05:41 +0100
commit39ce5849c81c688c53245316584489db5bc354ab (patch)
treeb7577e10d57a56a4eb89aeb1eed3e34cb0ba09ac
parent2139cadd1b2143797287afd200dc4b6a6d687aee (diff)
downloadcaja-39ce5849c81c688c53245316584489db5bc354ab.tar.bz2
caja-39ce5849c81c688c53245316584489db5bc354ab.tar.xz
GTK3 location-bar: port to GtkStyleContext
taken from: https://git.gnome.org/browse/nautilus/commit/?h=gnome-3-0&id=5fc40ad
-rw-r--r--src/caja-location-bar.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/caja-location-bar.c b/src/caja-location-bar.c
index 965da186..e2a70104 100644
--- a/src/caja-location-bar.c
+++ b/src/caja-location-bar.c
@@ -614,6 +614,21 @@ caja_location_bar_update_label (CajaLocationBar *bar)
void
caja_location_bar_set_active(CajaLocationBar *location_bar, gboolean is_active)
{
+#if GTK_CHECK_VERSION (3, 0, 0)
+ if (is_active)
+ {
+ /* reset style to default */
+ gtk_widget_override_background_color (GTK_WIDGET (location_bar->details->entry), GTK_STATE_FLAG_NORMAL, NULL);
+ }
+ else
+ {
+ GtkStyleContext *style;
+ GdkRGBA color;
+
+ style = gtk_widget_get_style_context (GTK_WIDGET (location_bar->details->entry));
+ gtk_style_context_get_background_color (style, GTK_STATE_FLAG_INSENSITIVE, &color);
+ gtk_widget_override_background_color (GTK_WIDGET (location_bar->details->entry), GTK_STATE_FLAG_ACTIVE, &color);
+#else
if(is_active)
{
/* reset style to default */
@@ -626,6 +641,7 @@ caja_location_bar_set_active(CajaLocationBar *location_bar, gboolean is_active)
style = gtk_widget_get_style (GTK_WIDGET (location_bar->details->entry));
color = style->base[GTK_STATE_INSENSITIVE];
gtk_widget_modify_base(GTK_WIDGET (location_bar->details->entry), GTK_STATE_NORMAL, &color);
+#endif
}
}