[empathy] factor out empathy_webkit_create_context_menu()
- From: Guillaume Desmottes <gdesmott src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [empathy] factor out empathy_webkit_create_context_menu()
- Date: Wed, 26 Dec 2012 08:54:54 +0000 (UTC)
commit ea8cf1e945653b18a866aae586b88446b3899399
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date: Wed Sep 19 11:58:57 2012 +0200
factor out empathy_webkit_create_context_menu()
https://bugzilla.gnome.org/show_bug.cgi?id=684357
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 1ead8f9..bf46c1b 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);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]