diff options
-rw-r--r-- | libempathy-gtk/empathy-presence-chooser.c | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/libempathy-gtk/empathy-presence-chooser.c b/libempathy-gtk/empathy-presence-chooser.c index 8ca4770de..d58be5171 100644 --- a/libempathy-gtk/empathy-presence-chooser.c +++ b/libempathy-gtk/empathy-presence-chooser.c @@ -275,10 +275,30 @@ set_status_editing (EmpathyPresenceChooser *self, gboolean editing) gtk_entry_set_icon_sensitive (GTK_ENTRY (entry), GTK_ENTRY_ICON_PRIMARY, TRUE); + + // FIXME - move the focus somewhere } } static void +entry_icon_release_cb (EmpathyPresenceChooser *self, + GtkEntryIconPosition icon_pos, + GdkEvent *event, + GtkEntry *entry) +{ + set_status_editing (self, FALSE); +} + +static void +entry_activate_cb (EmpathyPresenceChooser *self, + GtkEntry *entry) +{ + g_print ("ACTIVATE! (form of a dragon)\n"); + + set_status_editing (self, FALSE); +} + +static void changed_cb (GtkComboBox *self, gpointer user_data) { g_print ("Changed\n"); @@ -290,7 +310,8 @@ changed_cb (GtkComboBox *self, gpointer user_data) GtkTreeModel *model = gtk_combo_box_get_model (self); if (!gtk_combo_box_get_active_iter (self, &iter)) { - g_print ("not an iter!\n"); + /* the combo is being edited to a custom entry */ + set_status_editing (self, TRUE); return; } @@ -310,6 +331,12 @@ changed_cb (GtkComboBox *self, gpointer user_data) gtk_widget_grab_focus (entry); set_status_editing (self, TRUE); } + else + { + /* just in case we were setting a new status when + * things were changed */ + set_status_editing (self, FALSE); + } g_free (icon_name); } @@ -333,6 +360,12 @@ empathy_presence_chooser_init (EmpathyPresenceChooser *chooser) GtkWidget *entry = gtk_bin_get_child (GTK_BIN (chooser)); gtk_entry_set_icon_activatable (GTK_ENTRY (entry), GTK_ENTRY_ICON_PRIMARY, FALSE); + g_signal_connect_object (entry, "icon-release", + G_CALLBACK (entry_icon_release_cb), chooser, + G_CONNECT_SWAPPED); + g_signal_connect_object (entry, "activate", + G_CALLBACK (entry_activate_cb), chooser, + G_CONNECT_SWAPPED); GtkCellRenderer *renderer; gtk_cell_layout_clear (GTK_CELL_LAYOUT (chooser)); |