[empathy] add EMPATHY_WEBKIT_MENU_INSPECT flag



commit 9db3e4d18cc032bf1246caf80115af291d672bf5
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date:   Wed Sep 19 13:41:47 2012 +0200

    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(+), 0 deletions(-)
---
diff --git a/libempathy-gtk/empathy-webkit-utils.c b/libempathy-gtk/empathy-webkit-utils.c
index f419408..d221e5f 100644
--- a/libempathy-gtk/empathy-webkit-utils.c
+++ b/libempathy-gtk/empathy-webkit-utils.c
@@ -208,6 +208,13 @@ empathy_webkit_open_address_cb (GtkMenuItem *menuitem,
 }
 
 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 9ab02ee..034e3bf 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);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]