]> git.0d.be Git - empathy.git/commitdiff
Add /inspector command to show webkit inspector
authorXavier Claessens <xclaesse@gmail.com>
Fri, 23 Sep 2011 13:31:58 +0000 (15:31 +0200)
committerXavier Claessens <xclaesse@gmail.com>
Mon, 26 Sep 2011 10:33:37 +0000 (12:33 +0200)
libempathy-gtk/empathy-chat.c
libempathy-gtk/empathy-theme-adium.c
libempathy-gtk/empathy-theme-adium.h

index 570d73b691f2ad711d93e5324289af6e0411300c..c9f6dd9d5d8c831e1bceeccc270f1210391cd3e0 100644 (file)
@@ -56,6 +56,7 @@
 #include "empathy-input-text-view.h"
 #include "empathy-search-bar.h"
 #include "empathy-theme-manager.h"
+#include "empathy-theme-adium.h"
 #include "empathy-smiley-manager.h"
 #include "empathy-ui-utils.h"
 #include "empathy-string-parser.h"
@@ -1042,6 +1043,16 @@ chat_command_babywhale (EmpathyChat *chat,
        g_object_unref (message);
 }
 
+static void
+chat_command_inspector (EmpathyChat *chat,
+                   GStrv        strv)
+{
+       if (EMPATHY_IS_THEME_ADIUM (chat->view)) {
+               empathy_theme_adium_show_inspector (
+                       EMPATHY_THEME_ADIUM (chat->view));
+       }
+}
+
 static void chat_command_help (EmpathyChat *chat, GStrv strv);
 
 typedef void (*ChatCommandFunc) (EmpathyChat *chat, GStrv strv);
@@ -1097,6 +1108,8 @@ static ChatCommandItem commands[] = {
         N_("/help [<command>]: show all supported commands. "
            "If <command> is defined, show its usage.")},
 
+       {"inspector", 1, 1, chat_command_inspector, NULL, NULL},
+
        {"whale", 1, 1, chat_command_whale, NULL, NULL},
        {"babywhale", 1, 1, chat_command_babywhale, NULL, NULL},
 };
index f81329b7912f3f2d8f38bbd7fb32fdbb5a3ee574..8877a2796f4ee72bcb355d19b000ddfcd330510b 100644 (file)
@@ -1654,6 +1654,20 @@ empathy_theme_adium_set_variant (EmpathyThemeAdium *theme,
        g_object_notify (G_OBJECT (theme), "variant");
 }
 
+void
+empathy_theme_adium_show_inspector (EmpathyThemeAdium *theme)
+{
+       WebKitWebView      *web_view = WEBKIT_WEB_VIEW (theme);
+       WebKitWebInspector *inspector;
+
+       g_object_set (G_OBJECT (webkit_web_view_get_settings (web_view)),
+                     "enable-developer-extras", TRUE,
+                     NULL);
+
+       inspector = webkit_web_view_get_inspector (web_view);
+       webkit_web_inspector_show (inspector);
+}
+
 gboolean
 empathy_adium_path_is_valid (const gchar *path)
 {
index 1c01b7b37e5858565c0e7d91acfbfe212c3e310b..6f7573b04ad486331a2b94be4b189e146452d811 100644 (file)
@@ -53,6 +53,7 @@ EmpathyThemeAdium *empathy_theme_adium_new      (EmpathyAdiumData *data,
                                                 const gchar *variant);
 void               empathy_theme_adium_set_variant (EmpathyThemeAdium *theme,
                                                    const gchar *variant);
+void               empathy_theme_adium_show_inspector (EmpathyThemeAdium *theme);
 
 gboolean           empathy_adium_path_is_valid (const gchar *path);