aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavyd Madeley <davyd@madeley.id.au>2009-04-11 00:54:25 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2009-04-11 00:54:25 +0800
commitdc526407b94e5fb6c3ad87de5d76520780396adb (patch)
treecdbe7d09fd50a08348004f4d53d3892556aa1918
parentecd39985a3892959e1bfe7aa24a9450163a47d32 (diff)
downloadgsoc2013-empathy-dc526407b94e5fb6c3ad87de5d76520780396adb.tar
gsoc2013-empathy-dc526407b94e5fb6c3ad87de5d76520780396adb.tar.gz
gsoc2013-empathy-dc526407b94e5fb6c3ad87de5d76520780396adb.tar.bz2
gsoc2013-empathy-dc526407b94e5fb6c3ad87de5d76520780396adb.tar.lz
gsoc2013-empathy-dc526407b94e5fb6c3ad87de5d76520780396adb.tar.xz
gsoc2013-empathy-dc526407b94e5fb6c3ad87de5d76520780396adb.tar.zst
gsoc2013-empathy-dc526407b94e5fb6c3ad87de5d76520780396adb.zip
Fix reset status on Esc
From: Davyd Madeley <davyd@madeley.id.au> svn path=/trunk/; revision=2789
-rw-r--r--libempathy-gtk/empathy-presence-chooser.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/libempathy-gtk/empathy-presence-chooser.c b/libempathy-gtk/empathy-presence-chooser.c
index e8dbdfc61..d791cab4d 100644
--- a/libempathy-gtk/empathy-presence-chooser.c
+++ b/libempathy-gtk/empathy-presence-chooser.c
@@ -318,6 +318,13 @@ ui_set_custom_state (EmpathyPresenceChooser *self,
}
static void
+reset_status (EmpathyPresenceChooser *self)
+{
+ /* recover the status that was unset */
+ presence_chooser_presence_changed_cb (self);
+}
+
+static void
entry_icon_release_cb (EmpathyPresenceChooser *self,
GtkEntryIconPosition icon_pos,
GdkEvent *event,
@@ -346,7 +353,7 @@ entry_key_press_event_cb (EmpathyPresenceChooser *self,
{
/* the user pressed Escape, undo the editing */
set_status_editing (self, FALSE);
- presence_chooser_presence_changed_cb (self);
+ reset_status (self);
return TRUE;
}
@@ -363,6 +370,7 @@ changed_cb (GtkComboBox *self, gpointer user_data)
GtkTreeIter iter;
char *icon_name;
+ McPresence new_state;
gboolean customisable = TRUE;
int type = -1;
@@ -379,7 +387,7 @@ changed_cb (GtkComboBox *self, gpointer user_data)
gtk_tree_model_get (model, &iter,
COL_STATE_ICON_NAME, &icon_name,
- COL_STATE, &priv->state,
+ COL_STATE, &new_state,
COL_STATUS_CUSTOMISABLE, &customisable,
COL_TYPE, &type,
-1);
@@ -394,18 +402,12 @@ changed_cb (GtkComboBox *self, gpointer user_data)
if (type != ENTRY_TYPE_EDIT_CUSTOM)
{
gtk_editable_set_editable (GTK_EDITABLE (entry), customisable);
+ priv->state = new_state;
}
if (type == ENTRY_TYPE_EDIT_CUSTOM)
{
- /* recover the status that was unset because COL_STATUS_TEXT
- * is "". Unfortunately if you try and set COL_STATUS_TEXT to
- * NULL, it generates a g_critical. I wonder if there is a
- * better way around this. */
- const char *status = empathy_idle_get_status (priv->idle);
- priv->block_set_editing++;
- gtk_entry_set_text (GTK_ENTRY (entry), status);
- priv->block_set_editing--;
+ reset_status (EMPATHY_PRESENCE_CHOOSER (self));
/* attempt to get the toplevel for this widget */
GtkWidget *window = gtk_widget_get_toplevel (GTK_WIDGET (self));
@@ -473,7 +475,7 @@ focus_out_cb (EmpathyPresenceChooser *chooser, GdkEventFocus *event,
if (priv->editing_status)
{
- entry_activate_cb (chooser, entry);
+ // entry_activate_cb (chooser, entry);
}
return FALSE;