summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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