From 3c66cb899ff109c7351efaa64c8a88b543a68221 Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Wed, 13 Jun 2007 20:19:28 +0200 Subject: [PATCH] Evil hack to keep the entry context menu working with our title/address behavior. --- lib/sugar-address-entry.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lib/sugar-address-entry.c b/lib/sugar-address-entry.c index 6b6ea0d8..f776e6cc 100644 --- a/lib/sugar-address-entry.c +++ b/lib/sugar-address-entry.c @@ -659,6 +659,21 @@ focus_out_event_cb(GtkWidget *widget, GdkEventFocus *event) return FALSE; } +static void +popup_unmap_cb(GtkWidget *popup, SugarAddressEntry *entry) +{ + g_signal_handlers_unblock_by_func(entry, focus_out_event_cb, NULL); +} + +static void +populate_popup_cb(SugarAddressEntry *entry, GtkWidget *menu) +{ + g_signal_handlers_block_by_func(entry, focus_out_event_cb, NULL); + + g_signal_connect(menu, "unmap", + G_CALLBACK(popup_unmap_cb), entry); +} + static void sugar_address_entry_init(SugarAddressEntry *entry) { @@ -674,4 +689,6 @@ sugar_address_entry_init(SugarAddressEntry *entry) G_CALLBACK(entry_changed_cb), NULL); g_signal_connect(entry, "button-press-event", G_CALLBACK(button_press_event_cb), NULL); + g_signal_connect(entry, "populate-popup", + G_CALLBACK(populate_popup_cb), NULL); }