From 9db3e4d18cc032bf1246caf80115af291d672bf5 Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Wed, 19 Sep 2012 13:41:47 +0200 Subject: add EMPATHY_WEBKIT_MENU_INSPECT flag https://bugzilla.gnome.org/show_bug.cgi?id=684357 --- libempathy-gtk/empathy-webkit-utils.c | 20 ++++++++++++++++++++ libempathy-gtk/empathy-webkit-utils.h | 1 + 2 files changed, 21 insertions(+) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/empathy-webkit-utils.c b/libempathy-gtk/empathy-webkit-utils.c index f4194083b..d221e5f98 100644 --- a/libempathy-gtk/empathy-webkit-utils.c +++ b/libempathy-gtk/empathy-webkit-utils.c @@ -207,6 +207,13 @@ empathy_webkit_open_address_cb (GtkMenuItem *menuitem, g_free (uri); } +static void +empathy_webkit_inspect_cb (GtkMenuItem *menuitem, + WebKitWebView *view) +{ + empathy_webkit_show_inspector (view); +} + static void empathy_webkit_context_menu_selection_done_cb (GtkMenuShell *menu, gpointer user_data) @@ -288,6 +295,19 @@ empathy_webkit_create_context_menu (WebKitWebView *view, gtk_menu_shell_prepend (GTK_MENU_SHELL (menu), item); } + if ((flags & EMPATHY_WEBKIT_MENU_INSPECT) != 0) + { + /* Separator */ + item = gtk_separator_menu_item_new (); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); + + /* Inspector */ + item = gtk_menu_item_new_with_mnemonic (_("Inspect HTML")); + g_signal_connect (item, "activate", + G_CALLBACK (empathy_webkit_inspect_cb), view); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); + } + g_signal_connect (GTK_MENU_SHELL (menu), "selection-done", G_CALLBACK (empathy_webkit_context_menu_selection_done_cb), g_object_ref (hit_test_result)); diff --git a/libempathy-gtk/empathy-webkit-utils.h b/libempathy-gtk/empathy-webkit-utils.h index 9ab02eedd..034e3bf55 100644 --- a/libempathy-gtk/empathy-webkit-utils.h +++ b/libempathy-gtk/empathy-webkit-utils.h @@ -29,6 +29,7 @@ G_BEGIN_DECLS typedef enum { EMPATHY_WEBKIT_MENU_CLEAR = 1 << 0, + EMPATHY_WEBKIT_MENU_INSPECT = 1 << 1, } EmpathyWebKitMenuFlags; EmpathyStringParser * empathy_webkit_get_string_parser (gboolean smileys); -- cgit v1.2.3