summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWolfgang Ulbrich <[email protected]>2016-01-08 22:04:08 +0100
committerWolfgang Ulbrich <[email protected]>2016-01-13 15:05:42 +0100
commitfa7dd4677f4196750d0c752c7b1823fdd7c54cbb (patch)
treef9aa0f529089303d04a7f891ce22dfa94adb0a55
parent390400e11e888ee65d4620a03615c5aa23e4d089 (diff)
downloadcaja-fa7dd4677f4196750d0c752c7b1823fdd7c54cbb.tar.bz2
caja-fa7dd4677f4196750d0c752c7b1823fdd7c54cbb.tar.xz
GTK3 icon-container: remove useless theming properties
taken from: https://git.gnome.org/browse/nautilus/commit/?id=e2ca42cac78cb0287a1bbb73030e7bba8b171970
-rw-r--r--libcaja-private/caja-icon-canvas-item.c16
-rw-r--r--libcaja-private/caja-icon-container.c57
2 files changed, 41 insertions, 32 deletions
diff --git a/libcaja-private/caja-icon-canvas-item.c b/libcaja-private/caja-icon-canvas-item.c
index 476b8839..4dcd2566 100644
--- a/libcaja-private/caja-icon-canvas-item.c
+++ b/libcaja-private/caja-icon-canvas-item.c
@@ -1410,7 +1410,11 @@ draw_label_text (CajaIconCanvasItem *item,
GdkColor *label_color;
#endif
gboolean have_editable, have_additional;
+#if GTK_CHECK_VERSION(3,0,0)
+ gboolean needs_highlight, prelight_label, is_rtl_label_beside;
+#else
gboolean needs_frame, needs_highlight, prelight_label, is_rtl_label_beside;
+#endif
EelIRect text_rect;
int x;
int max_text_width;
@@ -1502,10 +1506,16 @@ draw_label_text (CajaIconCanvasItem *item,
prepare_pango_layout_for_draw (item, editable_layout);
gtk_widget_style_get (GTK_WIDGET (container),
+#if !GTK_CHECK_VERSION(3,0,0)
"frame_text", &needs_frame,
+#endif
"activate_prelight_icon_label", &prelight_label,
NULL);
+#if GTK_CHECK_VERSION(3,0,0)
+ if (!needs_highlight && details->text_width > 0 && details->text_height > 0)
+#else
if (needs_frame && !needs_highlight && details->text_width > 0 && details->text_height > 0)
+#endif
{
if (!(prelight_label && item->details->is_prelit))
{
@@ -2058,6 +2068,7 @@ real_map_pixbuf (CajaIconCanvasItem *icon_item)
g_object_unref (old_pixbuf);
}
+#if !GTK_CHECK_VERSION(3,0,0)
if (!icon_item->details->is_active
&& !icon_item->details->is_prelit
&& !icon_item->details->is_highlighted_for_selection
@@ -2079,14 +2090,11 @@ real_map_pixbuf (CajaIconCanvasItem *icon_item)
saturation,
brightness,
lighten,
-#if GTK_CHECK_VERSION(3,0,0)
- &container->details->normal_icon_color_rgba);
-#else
container->details->normal_icon_color_rgba);
-#endif
g_object_unref (old_pixbuf);
}
}
+#endif
return temp_pixbuf;
}
diff --git a/libcaja-private/caja-icon-container.c b/libcaja-private/caja-icon-container.c
index 9aa26dac..1bad9f26 100644
--- a/libcaja-private/caja-icon-container.c
+++ b/libcaja-private/caja-icon-container.c
@@ -4647,21 +4647,21 @@ style_set (GtkWidget *widget,
GtkStyle *previous_style)
{
CajaIconContainer *container;
+#if !GTK_CHECK_VERSION(3,0,0)
gboolean frame_text;
+#endif
container = CAJA_ICON_CONTAINER (widget);
#if GTK_CHECK_VERSION(3,0,0)
- gtk_style_context_get_style (gtk_widget_get_style_context (GTK_WIDGET (container)),
- "frame_text", &frame_text,
- NULL);
+ container->details->use_drop_shadows = container->details->drop_shadows_requested;
#else
gtk_widget_style_get (GTK_WIDGET (container),
"frame_text", &frame_text,
NULL);
-#endif
container->details->use_drop_shadows = container->details->drop_shadows_requested && !frame_text;
+#endif
caja_icon_container_theme_changed (CAJA_ICON_CONTAINER (widget));
@@ -6633,15 +6633,8 @@ caja_icon_container_class_init (CajaIconContainerClass *class)
class->start_interactive_search = caja_icon_container_start_interactive_search;
- gtk_widget_class_install_style_property (widget_class,
- g_param_spec_boolean ("frame_text",
- "Frame Text",
- "Draw a frame around unselected text",
- FALSE,
- G_PARAM_READABLE));
-
- gtk_widget_class_install_style_property (widget_class,
#if GTK_CHECK_VERSION(3,0,0)
+ gtk_widget_class_install_style_property (widget_class,
g_param_spec_boxed ("selection_box_rgba",
"Selection Box RGBA",
"Color of the selection box",
@@ -6659,7 +6652,15 @@ caja_icon_container_class_init (CajaIconContainerClass *class)
"Dark Info RGBA",
"Color used for information text against a light background",
GDK_TYPE_RGBA,
+ G_PARAM_READABLE));
#else
+ gtk_widget_class_install_style_property (widget_class,
+ g_param_spec_boolean ("frame_text",
+ "Frame Text",
+ "Draw a frame around unselected text",
+ FALSE,
+ G_PARAM_READABLE));
+ gtk_widget_class_install_style_property (widget_class,
g_param_spec_boxed ("selection_box_color",
"Selection Box Color",
"Color of the selection box",
@@ -6705,7 +6706,6 @@ caja_icon_container_class_init (CajaIconContainerClass *class)
"Dark Info Color",
"Color used for information text against a light background",
GDK_TYPE_COLOR,
-#endif
G_PARAM_READABLE));
gtk_widget_class_install_style_property (widget_class,
@@ -6715,6 +6715,7 @@ caja_icon_container_class_init (CajaIconContainerClass *class)
0, 3,
DEFAULT_NORMAL_ICON_RENDER_MODE,
G_PARAM_READABLE));
+#endif
gtk_widget_class_install_style_property (widget_class,
g_param_spec_uint ("prelight_icon_render_mode",
"Prelight Icon Render Mode",
@@ -6722,8 +6723,8 @@ caja_icon_container_class_init (CajaIconContainerClass *class)
0, 3,
DEFAULT_PRELIGHT_ICON_RENDER_MODE,
G_PARAM_READABLE));
- gtk_widget_class_install_style_property (widget_class,
#if GTK_CHECK_VERSION(3,0,0)
+ gtk_widget_class_install_style_property (widget_class,
g_param_spec_boxed ("normal_icon_rgba",
"Icon Normal RGBA",
"Color used for colorizing icons in normal state (default base[NORMAL])",
@@ -6734,7 +6735,9 @@ caja_icon_container_class_init (CajaIconContainerClass *class)
"Icon Prelight RGBA",
"Color used for colorizing prelighted icons (default base[PRELIGHT])",
GDK_TYPE_RGBA,
+ G_PARAM_READABLE));
#else
+ gtk_widget_class_install_style_property (widget_class,
g_param_spec_boxed ("normal_icon_color",
"Icon Normal Color",
"Color used for colorizing icons in normal state (default base[NORMAL])",
@@ -6745,7 +6748,6 @@ caja_icon_container_class_init (CajaIconContainerClass *class)
"Icon Prelight Color",
"Color used for colorizing prelighted icons (default base[PRELIGHT])",
GDK_TYPE_COLOR,
-#endif
G_PARAM_READABLE));
gtk_widget_class_install_style_property (widget_class,
g_param_spec_uint ("normal_icon_saturation",
@@ -6754,6 +6756,7 @@ caja_icon_container_class_init (CajaIconContainerClass *class)
0, 255,
DEFAULT_NORMAL_ICON_SATURATION,
G_PARAM_READABLE));
+#endif
gtk_widget_class_install_style_property (widget_class,
g_param_spec_uint ("prelight_icon_saturation",
"Prelight Icon Saturation",
@@ -6761,6 +6764,7 @@ caja_icon_container_class_init (CajaIconContainerClass *class)
0, 255,
DEFAULT_PRELIGHT_ICON_SATURATION,
G_PARAM_READABLE));
+#if !GTK_CHECK_VERSION(3,0,0)
gtk_widget_class_install_style_property (widget_class,
g_param_spec_uint ("normal_icon_brightness",
"Normal Icon Brightness",
@@ -6768,6 +6772,7 @@ caja_icon_container_class_init (CajaIconContainerClass *class)
0, 255,
DEFAULT_NORMAL_ICON_BRIGHTNESS,
G_PARAM_READABLE));
+#endif
gtk_widget_class_install_style_property (widget_class,
g_param_spec_uint ("prelight_icon_brightness",
"Prelight Icon Brightness",
@@ -6775,6 +6780,7 @@ caja_icon_container_class_init (CajaIconContainerClass *class)
0, 255,
DEFAULT_PRELIGHT_ICON_BRIGHTNESS,
G_PARAM_READABLE));
+#if !GTK_CHECK_VERSION(3,0,0)
gtk_widget_class_install_style_property (widget_class,
g_param_spec_uint ("normal_icon_lighten",
"Normal Icon Lighten",
@@ -6782,6 +6788,7 @@ caja_icon_container_class_init (CajaIconContainerClass *class)
0, 255,
DEFAULT_NORMAL_ICON_LIGHTEN,
G_PARAM_READABLE));
+#endif
gtk_widget_class_install_style_property (widget_class,
g_param_spec_uint ("prelight_icon_lighten",
"Prelight Icon Lighten",
@@ -9467,7 +9474,6 @@ setup_label_gcs (CajaIconContainer *container)
GtkWidget *widget;
#if GTK_CHECK_VERSION(3,0,0)
GdkRGBA *light_info_color, *dark_info_color;
- gboolean frame_text;
GtkStyleContext *style;
GdkRGBA color;
#else
@@ -9525,14 +9531,7 @@ setup_label_gcs (CajaIconContainer *container)
LABEL_INFO_COLOR_ACTIVE,
eel_gdk_rgba_is_dark (&color) ? light_info_color : dark_info_color);
- /* If CajaIconContainer::frame_text is set, we can safely
- * use the foreground color from the theme, because it will
- * always be displayed against the gtk background */
- gtk_style_context_get_style (gtk_widget_get_style_context (GTK_WIDGET (container)),
- "frame_text", &frame_text,
- NULL);
-
- if (frame_text /* || !eel_background_is_set(background) */)
+ if (!caja_icon_container_get_is_desktop (container))
{
gtk_style_context_get_color (style, GTK_STATE_FLAG_ACTIVE, &color);
setup_gc_with_fg (container, LABEL_COLOR, &color);
@@ -9704,15 +9703,13 @@ void
caja_icon_container_set_use_drop_shadows (CajaIconContainer *container,
gboolean use_drop_shadows)
{
+#if !GTK_CHECK_VERSION(3,0,0)
gboolean frame_text;
-#if GTK_CHECK_VERSION(3,0,0)
- gtk_style_context_get_style (gtk_widget_get_style_context (GTK_WIDGET (container)),
-#else
gtk_widget_style_get (GTK_WIDGET (container),
-#endif
"frame_text", &frame_text,
NULL);
+#endif
if (container->details->drop_shadows_requested == use_drop_shadows)
{
@@ -9720,7 +9717,11 @@ caja_icon_container_set_use_drop_shadows (CajaIconContainer *container,
}
container->details->drop_shadows_requested = use_drop_shadows;
+#if GTK_CHECK_VERSION(3,0,0)
+ container->details->use_drop_shadows = use_drop_shadows;
+#else
container->details->use_drop_shadows = use_drop_shadows && !frame_text;
+#endif
gtk_widget_queue_draw (GTK_WIDGET (container));
}