pidgin/gtkaccount.c

branch
soc.2013.gobjectification.plugins
changeset 37108
73c5fb6d78b3
parent 37075
cf3f735b09b7
parent 35510
0e6c78789caa
child 37109
94d1a2589d5a
--- a/pidgin/gtkaccount.c	Mon Feb 10 03:17:49 2014 +0530
+++ b/pidgin/gtkaccount.c	Mon Feb 10 16:22:00 2014 +0530
@@ -530,7 +530,12 @@
 static void
 update_editable(PurpleConnection *gc, AccountPrefsDialog *dialog)
 {
+#if GTK_CHECK_VERSION(3,0,0)
+	GtkStyleContext *style;
+	GdkRGBA color;
+#else
 	GtkStyle *style;
+#endif
 	gboolean set;
 	GList *l;
 
@@ -543,16 +548,36 @@
 	set = !(purple_account_is_connected(dialog->account) || purple_account_is_connecting(dialog->account));
 	gtk_widget_set_sensitive(dialog->protocol_menu, set);
 	gtk_editable_set_editable(GTK_EDITABLE(dialog->username_entry), set);
+#if GTK_CHECK_VERSION(3,0,0)
+	style = set ? NULL : gtk_widget_get_style_context(dialog->username_entry);
+	if (style) {
+		gtk_style_context_get_background_color(style, GTK_STATE_FLAG_INSENSITIVE, &color);
+		gtk_widget_override_background_color(dialog->username_entry, GTK_STATE_FLAG_NORMAL, &color);
+	} else {
+		gtk_widget_override_background_color(dialog->username_entry, GTK_STATE_FLAG_NORMAL, NULL);
+	}
+#else
 	style = set ? NULL : gtk_widget_get_style(dialog->username_entry);
 	gtk_widget_modify_base(dialog->username_entry, GTK_STATE_NORMAL,
 			style ? &style->base[GTK_STATE_INSENSITIVE] : NULL);
+#endif
 
 	for (l = dialog->user_split_entries ; l != NULL ; l = l->next) {
 		if (GTK_IS_EDITABLE(l->data)) {
 			gtk_editable_set_editable(GTK_EDITABLE(l->data), set);
+#if GTK_CHECK_VERSION(3,0,0)
+			style = set ? NULL : gtk_widget_get_style_context(GTK_WIDGET(l->data));
+			if (style) {
+				gtk_style_context_get_background_color(style, GTK_STATE_FLAG_INSENSITIVE, &color);
+				gtk_widget_override_background_color(GTK_WIDGET(l->data), GTK_STATE_FLAG_NORMAL, &color);
+			} else {
+				gtk_widget_override_background_color(GTK_WIDGET(l->data), GTK_STATE_FLAG_NORMAL, NULL);
+			}
+#else
 			style = set ? NULL : gtk_widget_get_style(GTK_WIDGET(l->data));
 			gtk_widget_modify_base(GTK_WIDGET(l->data), GTK_STATE_NORMAL,
 					style ? &style->base[GTK_STATE_INSENSITIVE] : NULL);
+#endif
 		} else {
 			gtk_widget_set_sensitive(GTK_WIDGET(l->data), set);
 		}

mercurial