diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2012-09-19 17:58:57 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2012-12-26 16:48:52 +0800 |
commit | ea8cf1e945653b18a866aae586b88446b3899399 (patch) | |
tree | ffc41402f805b5f1dd6c5099e95551365b2c1d53 /libempathy-gtk | |
parent | 8ad4b14d78dc19c513ca82d95390e8adf58b6b1a (diff) | |
download | gsoc2013-empathy-ea8cf1e945653b18a866aae586b88446b3899399.tar gsoc2013-empathy-ea8cf1e945653b18a866aae586b88446b3899399.tar.gz gsoc2013-empathy-ea8cf1e945653b18a866aae586b88446b3899399.tar.bz2 gsoc2013-empathy-ea8cf1e945653b18a866aae586b88446b3899399.tar.lz gsoc2013-empathy-ea8cf1e945653b18a866aae586b88446b3899399.tar.xz gsoc2013-empathy-ea8cf1e945653b18a866aae586b88446b3899399.tar.zst gsoc2013-empathy-ea8cf1e945653b18a866aae586b88446b3899399.zip |
factor out empathy_webkit_create_context_menu()
https://bugzilla.gnome.org/show_bug.cgi?id=684357
Diffstat (limited to 'libempathy-gtk')
-rw-r--r-- | libempathy-gtk/empathy-webkit-utils.c | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/libempathy-gtk/empathy-webkit-utils.c b/libempathy-gtk/empathy-webkit-utils.c index 1ead8f9ee..bf46c1b73 100644 --- a/libempathy-gtk/empathy-webkit-utils.c +++ b/libempathy-gtk/empathy-webkit-utils.c @@ -216,17 +216,15 @@ empathy_webkit_context_menu_selection_done_cb (GtkMenuShell *menu, g_object_unref (hit_test_result); } -void -empathy_webkit_context_menu_for_event (WebKitWebView *view, - GdkEventButton *event, +static GtkWidget * +empathy_webkit_create_context_menu (WebKitWebView *view, + WebKitHitTestResult *hit_test_result, EmpathyWebKitMenuFlags flags) { - WebKitHitTestResult *hit_test_result; WebKitHitTestResultContext context; GtkWidget *menu; GtkWidget *item; - hit_test_result = webkit_web_view_get_hit_test_result (view, event); g_object_get (G_OBJECT (hit_test_result), "context", &context, NULL); @@ -292,10 +290,26 @@ empathy_webkit_context_menu_for_event (WebKitWebView *view, g_signal_connect (GTK_MENU_SHELL (menu), "selection-done", G_CALLBACK (empathy_webkit_context_menu_selection_done_cb), - hit_test_result); + g_object_ref (hit_test_result)); + + return menu; +} + +void +empathy_webkit_context_menu_for_event (WebKitWebView *view, + GdkEventButton *event, + EmpathyWebKitMenuFlags flags) +{ + GtkWidget *menu; + WebKitHitTestResult *hit_test_result; + + hit_test_result = webkit_web_view_get_hit_test_result (view, event); + + menu = empathy_webkit_create_context_menu (view, hit_test_result, flags); - /* Display the menu */ gtk_widget_show_all (menu); gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, event->button, event->time); + + g_object_unref (hit_test_result); } |