summaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
authorMonsta <[email protected]>2015-12-25 15:09:44 +0300
committerMonsta <[email protected]>2015-12-25 15:09:44 +0300
commit76853b4981875dedb1f0f21ffc00c0083d294c6d (patch)
treee055715f29158a522381055c2c24d7cfb0ca75c8 /share
parent5906507b88828d3d848f14afb2d14fdecbdb501e (diff)
downloadcaja-extensions-76853b4981875dedb1f0f21ffc00c0083d294c6d.tar.bz2
caja-extensions-76853b4981875dedb1f0f21ffc00c0083d294c6d.tar.xz
GTK+3: fix share name entry color when error or warning is set
color and bg color depend on theme, so e.g. error color won't always be white-on-red as in GTK+2 build
Diffstat (limited to 'share')
-rw-r--r--share/caja-share.c47
1 files changed, 38 insertions, 9 deletions
diff --git a/share/caja-share.c b/share/caja-share.c
index b74496e..07b2195 100644
--- a/share/caja-share.c
+++ b/share/caja-share.c
@@ -441,31 +441,60 @@ get_fullpath_from_fileinfo(CajaFileInfo *fileinfo)
static void
property_page_set_warning (PropertyPage *page)
{
- GdkColor colorYellow;
-
- gtk_label_set_text (GTK_LABEL (page->label_status), _("Share name is too long"));
-
+#if GTK_CHECK_VERSION (3, 0, 0)
+ GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET (page->entry_share_name));
+ if (gtk_style_context_has_class (context, GTK_STYLE_CLASS_ERROR))
+ {
+ gtk_style_context_remove_class (context, GTK_STYLE_CLASS_ERROR);
+ }
+ gtk_style_context_add_class (context, GTK_STYLE_CLASS_WARNING);
+#else
+ GdkColor colorYellow;
gdk_color_parse ("#ECDF62", &colorYellow);
gtk_widget_modify_base (page->entry_share_name, GTK_STATE_NORMAL, &colorYellow);
-}
+#endif
+ gtk_label_set_text (GTK_LABEL (page->label_status), _("Share name is too long"));
+}
static void
property_page_set_error (PropertyPage *page, const char *message)
{
+#if GTK_CHECK_VERSION (3, 0, 0)
+ GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET (page->entry_share_name));
+ if (gtk_style_context_has_class (context, GTK_STYLE_CLASS_WARNING))
+ {
+ gtk_style_context_remove_class (context, GTK_STYLE_CLASS_WARNING);
+ }
+ gtk_style_context_add_class (context, GTK_STYLE_CLASS_ERROR);
+#else
GdkColor colorRed;
-
- gtk_label_set_text (GTK_LABEL (page->label_status), message);
-
gdk_color_parse ("#C1665A", &colorRed);
gtk_widget_modify_base (page->entry_share_name, GTK_STATE_NORMAL, &colorRed);
+#endif
+
+ gtk_label_set_text (GTK_LABEL (page->label_status), message);
}
static void
property_page_set_normal (PropertyPage *page)
{
- gtk_label_set_text (GTK_LABEL (page->label_status), "");
+#if GTK_CHECK_VERSION (3, 0, 0)
+ GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET (page->entry_share_name));
+ if (gtk_style_context_has_class (context, GTK_STYLE_CLASS_WARNING))
+ {
+ gtk_style_context_remove_class (context, GTK_STYLE_CLASS_WARNING);
+ }
+
+ if (gtk_style_context_has_class (context, GTK_STYLE_CLASS_ERROR))
+ {
+ gtk_style_context_remove_class (context, GTK_STYLE_CLASS_ERROR);
+ }
+#else
gtk_widget_modify_base (page->entry_share_name, GTK_STATE_NORMAL, NULL);
+#endif
+
+ gtk_label_set_text (GTK_LABEL (page->label_status), "");
}
static gboolean