ayatana-commits team mailing list archive
-
ayatana-commits team
-
Mailing list archive
-
Message #02420
[Branch ~indicator-applet-developers/indicator-me/trunk] Rev 112: react on focus-out events, to restore the hint when the entry is empty
------------------------------------------------------------
revno: 112
committer: David Barth <david.barth@xxxxxxxxxxxxx>
branch nick: indicator-me
timestamp: Wed 2010-09-22 12:45:47 +0200
message:
react on focus-out events, to restore the hint when the entry is empty
modified:
src/indicator-me.c
--
lp:indicator-me
https://code.launchpad.net/~indicator-applet-developers/indicator-me/trunk
Your team ayatana-commits is subscribed to branch lp:indicator-me.
To unsubscribe from this branch go to https://code.launchpad.net/~indicator-applet-developers/indicator-me/trunk/+edit-subscription
=== modified file 'src/indicator-me.c'
--- src/indicator-me.c 2010-09-22 10:44:42 +0000
+++ src/indicator-me.c 2010-09-22 10:45:47 +0000
@@ -295,6 +295,7 @@
GtkStyle *style = gtk_widget_get_style (GTK_WIDGET (entry));
GdkColor *color = &style->text[state];
gtk_widget_modify_text (GTK_WIDGET (entry), GTK_STATE_NORMAL, color);
+ gtk_widget_queue_draw (GTK_WIDGET (entry));
}
static void
@@ -304,9 +305,16 @@
const gchar *hint = g_object_get_data (G_OBJECT (entry),
DBUSMENU_ENTRY_MENUITEM_PROP_HINT);
- if ((gtk_entry_get_text_length (entry) > 0 &&
- ! entry_hint_is_shown (GTK_WIDGET (entry)))
- || GTK_WIDGET_HAS_FOCUS (entry)) {
+
+ /* enforce style when typing a message */
+ if (GTK_WIDGET_HAS_FOCUS (entry)) {
+ entry_set_style (entry, GTK_STATE_NORMAL);
+ entry_hint_set_shown (GTK_WIDGET (entry), FALSE);
+
+ return;
+ }
+
+ if (gtk_entry_get_text_length (entry) > 0) {
entry_set_style (entry, GTK_STATE_NORMAL);
entry_hint_set_shown (GTK_WIDGET (entry), FALSE);
@@ -316,7 +324,6 @@
gtk_entry_set_text (entry, hint);
entry_set_style (entry, GTK_STATE_INSENSITIVE);
-
entry_hint_set_shown (GTK_WIDGET (entry), TRUE);
}
}
@@ -359,14 +366,14 @@
g_object_set (settings, "gtk-entry-select-on-focus", select_on_focus, NULL);
}
+ entry_hint_set_shown (GTK_WIDGET (entry), FALSE);
entry_set_style (entry, GTK_STATE_NORMAL);
- entry_hint_set_shown (GTK_WIDGET (entry), FALSE);
return FALSE;
}
static gboolean
-entry_focus_ungrab_cb (GtkWidget *widget, GdkEventFocus *event)
+entry_focus_out_cb (GtkWidget *widget, GdkEventFocus *event)
{
GtkEntry *entry = GTK_ENTRY (widget);
@@ -465,7 +472,7 @@
NULL);
g_signal_connect (entry,
- "grab-broken-event", G_CALLBACK (entry_focus_ungrab_cb),
+ "focus-out-event", G_CALLBACK (entry_focus_out_cb),
NULL);
g_signal_connect (newitem,