summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2010-02-01 15:51:03 +0000
committerBastien Nocera <hadess@hadess.net>2010-02-01 15:51:03 +0000
commitb4f5bea82a3dcf3b11ab91c7008ecc7a6ece291d (patch)
tree2f3a2462273ddabbe8ac50aa51ec796a3dd80838
parentdd954cc0376e68c446b0ee8cfc67998be5a325e2 (diff)
downloadnautilus-sendto-b4f5bea82a3dcf3b11ab91c7008ecc7a6ece291d.tar.gz
Update EContactEntry from contact-lookup-applet
To fix the first contact always being selected from the completion popup when activating the entry with "Enter".
-rw-r--r--src/plugins/evolution/e-contact-entry.c27
-rw-r--r--src/plugins/evolution/evolution.c4
2 files changed, 17 insertions, 14 deletions
diff --git a/src/plugins/evolution/e-contact-entry.c b/src/plugins/evolution/e-contact-entry.c
index 41388e2..69ffa3d 100644
--- a/src/plugins/evolution/e-contact-entry.c
+++ b/src/plugins/evolution/e-contact-entry.c
@@ -85,7 +85,7 @@ struct EContactEntryPriv {
GDestroyNotify display_destroy;
};
-/*
+/**
* Struct containing details of the sources we are searching.
*/
typedef struct _EntryLookup {
@@ -96,7 +96,7 @@ typedef struct _EntryLookup {
EBookView *bookview;
} EntryLookup;
-/*
+/**
* List store columns.
*/
enum {
@@ -115,8 +115,9 @@ static EBookQuery* create_query (EContactEntry *entry, const char* s);
static guint entry_height (GtkWidget *widget);
static const char* stringify_ebook_error (const EBookStatus status);
static void e_contact_entry_item_free (EContactEntyItem *item);
+static void entry_changed_cb (GtkEditable *editable, gpointer user_data);
-/*
+/**
* The entry was activated. Take the first contact found and signal the user.
*/
static void
@@ -164,7 +165,7 @@ entry_activate_cb (EContactEntry *entry, gpointer user_data)
}
}
-/*
+/**
* A contact was selected in the completion drop-down, so send a signal.
*/
static gboolean
@@ -187,8 +188,10 @@ completion_match_selected_cb (GtkEntryCompletion *completion, GtkTreeModel *mode
g_free (message);
return FALSE;
}
+ g_signal_handlers_block_by_func (G_OBJECT (entry), entry_changed_cb, NULL);
gtk_entry_set_text (GTK_ENTRY (entry), "");
g_signal_emit (G_OBJECT (entry), signals[CONTACT_SELECTED], 0, contact, identifier);
+ g_signal_handlers_unblock_by_func (G_OBJECT (entry), entry_changed_cb, NULL);
g_object_unref (contact);
g_free (uid);
g_free (identifier);
@@ -235,7 +238,7 @@ e_contact_entry_display_func (EContact *contact)
/* This is the maximum number of entries that GTK+ will show */
#define MAX_ENTRIES 15
-/*
+/**
* Callback from the EBookView that more contacts matching the query have been found. Add these to
* the model if we still want more contacts, or stop the view.
*/
@@ -332,7 +335,7 @@ view_contacts_added_cb (EBook *book, GList *contacts, gpointer user_data)
}
}
-/*
+/**
* The query on the EBookView has completed.
*/
static void
@@ -348,7 +351,7 @@ view_completed_cb (EBookView *book_view, EBookViewStatus status, gpointer user_d
g_object_unref (lookup->bookview);
}
-/*
+/**
* The EBookView to lookup the completions with has been created.
*/
static void
@@ -779,7 +782,7 @@ lookup_entry_free (EntryLookup *lookup)
g_free (lookup);
}
-/*
+/**
* Split a string of tokens separated by whitespace into an array of tokens.
*/
static GArray *
@@ -809,7 +812,7 @@ split_query_string (const gchar *str)
return parts;
}
-/*
+/**
* Create a query which looks for the specified string in a contact's full name, email addresses and
* nick name.
*/
@@ -847,7 +850,7 @@ create_query (EContactEntry *entry, const char* s)
return query;
}
-/*
+/**
* Given a widget, determines the height that text will normally be drawn.
*/
static guint
@@ -861,7 +864,7 @@ entry_height (GtkWidget *widget)
return bound;
}
-/*
+/**
* Free a EContactEntyItem struct.
*/
static void
@@ -872,7 +875,7 @@ e_contact_entry_item_free (EContactEntyItem *item)
g_free (item);
}
-/*
+/**
* Return a string representing a given EBook status code.
*/
static const char*
diff --git a/src/plugins/evolution/evolution.c b/src/plugins/evolution/evolution.c
index 5210a65..a25ade1 100644
--- a/src/plugins/evolution/evolution.c
+++ b/src/plugins/evolution/evolution.c
@@ -113,8 +113,8 @@ init (NstPlugin *plugin)
return TRUE;
}
-static
-void contacts_selected_cb (GtkWidget *entry, EContact *contact, const char *identifier, NstPlugin *plugin)
+static void
+contacts_selected_cb (GtkWidget *entry, EContact *contact, const char *identifier, NstPlugin *plugin)
{
char *text;