*/
#include "config.h"
+#include "empathy-webkit-utils.h"
#include <glib/gi18n-lib.h>
-#include "empathy-webkit-utils.h"
#include "empathy-smiley-manager.h"
-#include "empathy-ui-utils.h"
+#include "empathy-string-parser.h"
#include "empathy-theme-adium.h"
+#include "empathy-ui-utils.h"
#define BORING_DPI_DEFAULT 96
static void
empathy_webkit_match_newline (const gchar *text,
gssize len,
- EmpathyStringReplace replace_func,
- EmpathyStringParser *sub_parsers,
+ TpawStringReplace replace_func,
+ TpawStringParser *sub_parsers,
gpointer user_data)
{
GString *string = user_data;
{
if (text[i] == '\n')
{
- empathy_string_parser_substr (text + prev, i - prev,
+ tpaw_string_parser_substr (text + prev, i - prev,
sub_parsers, user_data);
g_string_append (string, "<br/>");
prev = i + 1;
}
}
- empathy_string_parser_substr (text + prev, i - prev,
+ tpaw_string_parser_substr (text + prev, i - prev,
sub_parsers, user_data);
}
hit->path, (int)len, text, (int)len, text);
}
-static EmpathyStringParser string_parsers[] = {
- { empathy_string_match_link, empathy_string_replace_link },
+static TpawStringParser string_parsers[] = {
+ { tpaw_string_match_link, tpaw_string_replace_link },
{ empathy_webkit_match_newline, NULL },
- { empathy_string_match_all, empathy_string_replace_escaped },
+ { tpaw_string_match_all, tpaw_string_replace_escaped },
{ NULL, NULL}
};
-static EmpathyStringParser string_parsers_with_smiley[] = {
- { empathy_string_match_link, empathy_string_replace_link },
+static TpawStringParser string_parsers_with_smiley[] = {
+ { tpaw_string_match_link, tpaw_string_replace_link },
{ empathy_string_match_smiley, empathy_webkit_replace_smiley },
{ empathy_webkit_match_newline, NULL },
- { empathy_string_match_all, empathy_string_replace_escaped },
+ { tpaw_string_match_all, tpaw_string_replace_escaped },
{ NULL, NULL }
};
-EmpathyStringParser *
+TpawStringParser *
empathy_webkit_get_string_parser (gboolean smileys)
{
if (smileys)
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)
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));
g_object_unref (hit_test_result);
}
+
+void
+empathy_webkit_show_inspector (WebKitWebView *view)
+{
+ WebKitWebInspector *inspector;
+
+ g_object_set (G_OBJECT (webkit_web_view_get_settings (view)),
+ "enable-developer-extras", TRUE, NULL);
+
+ inspector = webkit_web_view_get_inspector (view);
+ webkit_web_inspector_show (inspector);
+}