aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWill Thompson <will.thompson@collabora.co.uk>2011-09-06 18:25:26 +0800
committerWill Thompson <will.thompson@collabora.co.uk>2011-09-07 01:34:18 +0800
commit4c56f91672941396112202617345b1b0445c29e0 (patch)
treea6dccfb729ec52243f5f5aa59de04c24e684fadf
parent36ef8807996629af42cec57fdb2adf4799b1cba4 (diff)
downloadgsoc2013-empathy-4c56f91672941396112202617345b1b0445c29e0.tar
gsoc2013-empathy-4c56f91672941396112202617345b1b0445c29e0.tar.gz
gsoc2013-empathy-4c56f91672941396112202617345b1b0445c29e0.tar.bz2
gsoc2013-empathy-4c56f91672941396112202617345b1b0445c29e0.tar.lz
gsoc2013-empathy-4c56f91672941396112202617345b1b0445c29e0.tar.xz
gsoc2013-empathy-4c56f91672941396112202617345b1b0445c29e0.tar.zst
gsoc2013-empathy-4c56f91672941396112202617345b1b0445c29e0.zip
ContactSelector: mark standard action as the default.
This allows Gtk+ to style the button differently to indicate that it will be pressed when the user hits Enter; it also fixes hitting enter in the New Conversation dialog, which does not consider GTK_RESPONSE_ACCEPT to be a reasonable response and ignores it. So we get a bug fix and better styling in exchange for less code! https://bugzilla.gnome.org/show_bug.cgi?id=658343
-rw-r--r--libempathy-gtk/empathy-contact-selector-dialog.c21
1 files changed, 5 insertions, 16 deletions
diff --git a/libempathy-gtk/empathy-contact-selector-dialog.c b/libempathy-gtk/empathy-contact-selector-dialog.c
index a4747b488..59d5e071d 100644
--- a/libempathy-gtk/empathy-contact-selector-dialog.c
+++ b/libempathy-gtk/empathy-contact-selector-dialog.c
@@ -233,19 +233,6 @@ contact_selector_change_state_button_cb (GtkEditable *editable,
}
static void
-entry_activate_cb (GtkEntry *entry,
- gpointer self)
-{
- const gchar *id;
-
- id = gtk_entry_get_text (entry);
- if (EMP_STR_EMPTY (id))
- return;
-
- gtk_dialog_response (GTK_DIALOG (self), GTK_RESPONSE_ACCEPT);
-}
-
-static void
account_chooser_filter (TpAccount *account,
EmpathyAccountChooserFilterResultCallback callback,
gpointer callback_data,
@@ -311,9 +298,7 @@ empathy_contact_selector_dialog_init (EmpathyContactSelectorDialog *dialog)
NULL);
g_free (filename);
- empathy_builder_connect (gui, dialog,
- "entry_id", "activate", entry_activate_cb,
- NULL);
+ gtk_entry_set_activates_default (GTK_ENTRY (priv->entry_id), TRUE);
content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
gtk_container_add (GTK_CONTAINER (content_area), dialog->vbox);
@@ -439,8 +424,12 @@ empathy_contact_selector_dialog_set_property (GObject *self,
static void
empathy_contact_selector_dialog_constructed (GObject *dialog)
{
+ EmpathyContactSelectorDialog *self = EMPATHY_CONTACT_SELECTOR_DIALOG (dialog);
EmpathyContactSelectorDialogPriv *priv = GET_PRIV (dialog);
+ gtk_widget_set_can_default (self->button_action, TRUE);
+ gtk_widget_grab_default (self->button_action);
+
if (EMPATHY_CONTACT_SELECTOR_DIALOG_GET_CLASS (dialog)->contact_filter)
{
GtkEntryCompletion *completion;