Initial support for the Web Inspector
This commit is contained in:
parent
d8edb2f05d
commit
96ddc8ae0a
3 changed files with 177 additions and 26 deletions
|
@ -58,6 +58,9 @@ struct _MidoriBrowser
|
||||||
GtkWidget* panel_pageholder;
|
GtkWidget* panel_pageholder;
|
||||||
GtkWidget* notebook;
|
GtkWidget* notebook;
|
||||||
|
|
||||||
|
GtkWidget* inspector;
|
||||||
|
GtkWidget* inspector_view;
|
||||||
|
|
||||||
GtkWidget* find;
|
GtkWidget* find;
|
||||||
GtkWidget* find_text;
|
GtkWidget* find_text;
|
||||||
GtkToolItem* find_case;
|
GtkToolItem* find_case;
|
||||||
|
@ -259,7 +262,8 @@ _midori_browser_update_interface (MidoriBrowser* browser)
|
||||||
"stock-id", GTK_STOCK_STOP,
|
"stock-id", GTK_STOCK_STOP,
|
||||||
"tooltip", _("Stop loading the current page"), NULL);
|
"tooltip", _("Stop loading the current page"), NULL);
|
||||||
gtk_widget_show (browser->progressbar);
|
gtk_widget_show (browser->progressbar);
|
||||||
if (!GTK_WIDGET_VISIBLE (browser->statusbar) && !GTK_WIDGET_VISIBLE (browser->navigationbar))
|
if (!GTK_WIDGET_VISIBLE (browser->statusbar)
|
||||||
|
&& !GTK_WIDGET_VISIBLE (browser->navigationbar))
|
||||||
gtk_widget_show (browser->navigationbar);
|
gtk_widget_show (browser->navigationbar);
|
||||||
action = _action_by_name (browser, "Location");
|
action = _action_by_name (browser, "Location");
|
||||||
midori_location_action_set_progress (MIDORI_LOCATION_ACTION (action),
|
midori_location_action_set_progress (MIDORI_LOCATION_ACTION (action),
|
||||||
|
@ -655,6 +659,17 @@ midori_view_console_message_cb (GtkWidget* view,
|
||||||
message, line, source_id);
|
message, line, source_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
midori_view_attach_inspector_cb (GtkWidget* view,
|
||||||
|
GtkWidget* inspector_view,
|
||||||
|
MidoriBrowser* browser)
|
||||||
|
{
|
||||||
|
GtkWidget* scrolled = gtk_widget_get_parent (browser->inspector_view);
|
||||||
|
gtk_container_remove (GTK_CONTAINER (scrolled), browser->inspector_view);
|
||||||
|
gtk_container_add (GTK_CONTAINER (scrolled), inspector_view);
|
||||||
|
browser->inspector_view = inspector_view;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
midori_view_new_tab_cb (GtkWidget* view,
|
midori_view_new_tab_cb (GtkWidget* view,
|
||||||
const gchar* uri,
|
const gchar* uri,
|
||||||
|
@ -774,6 +789,8 @@ _midori_browser_add_tab (MidoriBrowser* browser,
|
||||||
midori_view_activate_action_cb, browser,
|
midori_view_activate_action_cb, browser,
|
||||||
"signal::console-message",
|
"signal::console-message",
|
||||||
midori_view_console_message_cb, browser,
|
midori_view_console_message_cb, browser,
|
||||||
|
"signal::attach-inspector",
|
||||||
|
midori_view_attach_inspector_cb, browser,
|
||||||
"signal::new-tab",
|
"signal::new-tab",
|
||||||
midori_view_new_tab_cb, browser,
|
midori_view_new_tab_cb, browser,
|
||||||
"signal::new-window",
|
"signal::new-window",
|
||||||
|
@ -3038,7 +3055,8 @@ static const GtkActionEntry entries[] = {
|
||||||
N_("Find the next occurrence of a word or phrase"), G_CALLBACK (_action_find_next_activate) },
|
N_("Find the next occurrence of a word or phrase"), G_CALLBACK (_action_find_next_activate) },
|
||||||
{ "FindPrevious", GTK_STOCK_GO_BACK,
|
{ "FindPrevious", GTK_STOCK_GO_BACK,
|
||||||
N_("Find _Previous"), "<Ctrl><Shift>g",
|
N_("Find _Previous"), "<Ctrl><Shift>g",
|
||||||
N_("Find the previous occurrence of a word or phrase"), G_CALLBACK (_action_find_previous_activate) },
|
N_("Find the previous occurrence of a word or phrase"),
|
||||||
|
G_CALLBACK (_action_find_previous_activate) },
|
||||||
{ "FindQuick", GTK_STOCK_FIND,
|
{ "FindQuick", GTK_STOCK_FIND,
|
||||||
N_("_Quick Find"), "period",
|
N_("_Quick Find"), "period",
|
||||||
N_("Quickly jump to a word or phrase"), NULL/*G_CALLBACK (_action_find_quick_activate)*/ },
|
N_("Quickly jump to a word or phrase"), NULL/*G_CALLBACK (_action_find_quick_activate)*/ },
|
||||||
|
@ -3071,7 +3089,8 @@ static const GtkActionEntry entries[] = {
|
||||||
N_("View the source code of the page"), G_CALLBACK (_action_source_view_activate) },
|
N_("View the source code of the page"), G_CALLBACK (_action_source_view_activate) },
|
||||||
{ "SelectionSourceView", NULL,
|
{ "SelectionSourceView", NULL,
|
||||||
N_("View Selection Source"), "",
|
N_("View Selection Source"), "",
|
||||||
N_("View the source code of the selection"), NULL/*G_CALLBACK (_action_selection_source_view_activate)*/ },
|
N_("View the source code of the selection"),
|
||||||
|
NULL/*G_CALLBACK (_action_selection_source_view_activate)*/ },
|
||||||
{ "Fullscreen", GTK_STOCK_FULLSCREEN,
|
{ "Fullscreen", GTK_STOCK_FULLSCREEN,
|
||||||
NULL, "F11",
|
NULL, "F11",
|
||||||
N_("Toggle fullscreen view"), G_CALLBACK (_action_fullscreen_activate) },
|
N_("Toggle fullscreen view"), G_CALLBACK (_action_fullscreen_activate) },
|
||||||
|
@ -3113,7 +3132,8 @@ static const GtkActionEntry entries[] = {
|
||||||
N_("Clear the entire history"), G_CALLBACK (_action_history_clear_activate) },
|
N_("Clear the entire history"), G_CALLBACK (_action_history_clear_activate) },
|
||||||
{ "HistoryAddBookmark", STOCK_BOOKMARK_ADD,
|
{ "HistoryAddBookmark", STOCK_BOOKMARK_ADD,
|
||||||
NULL, "",
|
NULL, "",
|
||||||
N_("Add the selected history item as a bookmark"), G_CALLBACK (_action_history_add_bookmark_activate) },
|
N_("Add the selected history item as a bookmark"),
|
||||||
|
G_CALLBACK (_action_history_add_bookmark_activate) },
|
||||||
{ "Tools", NULL, N_("_Tools") },
|
{ "Tools", NULL, N_("_Tools") },
|
||||||
{ "ManageSearchEngines", GTK_STOCK_PROPERTIES,
|
{ "ManageSearchEngines", GTK_STOCK_PROPERTIES,
|
||||||
N_("_Manage Search Engines"), "<Ctrl><Alt>s",
|
N_("_Manage Search Engines"), "<Ctrl><Alt>s",
|
||||||
|
@ -3147,7 +3167,8 @@ static const GtkActionEntry entries[] = {
|
||||||
static const GtkToggleActionEntry toggle_entries[] = {
|
static const GtkToggleActionEntry toggle_entries[] = {
|
||||||
{ "PrivateBrowsing", NULL,
|
{ "PrivateBrowsing", NULL,
|
||||||
N_("P_rivate Browsing"), "",
|
N_("P_rivate Browsing"), "",
|
||||||
N_("Don't save any private data while browsing"), NULL/*G_CALLBACK (_action_private_browsing_activate)*/,
|
N_("Don't save any private data while browsing"),
|
||||||
|
NULL/*G_CALLBACK (_action_private_browsing_activate)*/,
|
||||||
FALSE },
|
FALSE },
|
||||||
|
|
||||||
{ "Menubar", NULL,
|
{ "Menubar", NULL,
|
||||||
|
@ -3360,9 +3381,26 @@ midori_browser_toolbar_item_button_press_event_cb (GtkWidget* toolitem,
|
||||||
static void
|
static void
|
||||||
midori_browser_init (MidoriBrowser* browser)
|
midori_browser_init (MidoriBrowser* browser)
|
||||||
{
|
{
|
||||||
GtkToolItem* toolitem;
|
GtkWidget* vbox;
|
||||||
GtkRcStyle* rcstyle;
|
GtkUIManager* ui_manager;
|
||||||
|
GError* error;
|
||||||
GtkAction* action;
|
GtkAction* action;
|
||||||
|
GtkWidget* menuitem;
|
||||||
|
GtkSettings* gtk_settings;
|
||||||
|
GtkWidget* hbox;
|
||||||
|
GtkWidget* hpaned;
|
||||||
|
GtkWidget* vpaned;
|
||||||
|
GtkWidget* box;
|
||||||
|
GtkTreeViewColumn* column;
|
||||||
|
GtkCellRenderer* renderer_text;
|
||||||
|
GtkCellRenderer* renderer_pixbuf;
|
||||||
|
GtkTreeStore* treestore;
|
||||||
|
GtkWidget* treeview;
|
||||||
|
GtkWidget* toolbar;
|
||||||
|
GtkToolItem* toolitem;
|
||||||
|
GtkWidget* panel;
|
||||||
|
GtkRcStyle* rcstyle;
|
||||||
|
GtkWidget* scrolled;
|
||||||
|
|
||||||
browser->net = katze_net_new ();
|
browser->net = katze_net_new ();
|
||||||
|
|
||||||
|
@ -3384,7 +3422,7 @@ midori_browser_init (MidoriBrowser* browser)
|
||||||
G_CALLBACK (midori_browser_destroy_cb), NULL);
|
G_CALLBACK (midori_browser_destroy_cb), NULL);
|
||||||
gtk_window_set_icon_name (GTK_WINDOW (browser), "web-browser");
|
gtk_window_set_icon_name (GTK_WINDOW (browser), "web-browser");
|
||||||
gtk_window_set_title (GTK_WINDOW (browser), g_get_application_name ());
|
gtk_window_set_title (GTK_WINDOW (browser), g_get_application_name ());
|
||||||
GtkWidget* vbox = gtk_vbox_new (FALSE, 0);
|
vbox = gtk_vbox_new (FALSE, 0);
|
||||||
gtk_container_add (GTK_CONTAINER (browser), vbox);
|
gtk_container_add (GTK_CONTAINER (browser), vbox);
|
||||||
gtk_widget_show (vbox);
|
gtk_widget_show (vbox);
|
||||||
|
|
||||||
|
@ -3395,12 +3433,12 @@ midori_browser_init (MidoriBrowser* browser)
|
||||||
entries, entries_n, browser);
|
entries, entries_n, browser);
|
||||||
gtk_action_group_add_toggle_actions (browser->action_group,
|
gtk_action_group_add_toggle_actions (browser->action_group,
|
||||||
toggle_entries, toggle_entries_n, browser);
|
toggle_entries, toggle_entries_n, browser);
|
||||||
GtkUIManager* ui_manager = gtk_ui_manager_new ();
|
ui_manager = gtk_ui_manager_new ();
|
||||||
gtk_ui_manager_insert_action_group (ui_manager, browser->action_group, 0);
|
gtk_ui_manager_insert_action_group (ui_manager, browser->action_group, 0);
|
||||||
gtk_window_add_accel_group (GTK_WINDOW (browser),
|
gtk_window_add_accel_group (GTK_WINDOW (browser),
|
||||||
gtk_ui_manager_get_accel_group (ui_manager));
|
gtk_ui_manager_get_accel_group (ui_manager));
|
||||||
|
|
||||||
GError* error = NULL;
|
error = NULL;
|
||||||
if (!gtk_ui_manager_add_ui_from_string (ui_manager, ui_markup, -1, &error))
|
if (!gtk_ui_manager_add_ui_from_string (ui_manager, ui_markup, -1, &error))
|
||||||
{
|
{
|
||||||
/* TODO: Should this be a message dialog? When does this happen? */
|
/* TODO: Should this be a message dialog? When does this happen? */
|
||||||
|
@ -3525,7 +3563,7 @@ midori_browser_init (MidoriBrowser* browser)
|
||||||
|
|
||||||
/* Create the menubar */
|
/* Create the menubar */
|
||||||
browser->menubar = gtk_ui_manager_get_widget (ui_manager, "/menubar");
|
browser->menubar = gtk_ui_manager_get_widget (ui_manager, "/menubar");
|
||||||
GtkWidget* menuitem = gtk_menu_item_new ();
|
menuitem = gtk_menu_item_new ();
|
||||||
gtk_widget_show (menuitem);
|
gtk_widget_show (menuitem);
|
||||||
browser->throbber = katze_throbber_new ();
|
browser->throbber = katze_throbber_new ();
|
||||||
gtk_widget_show (browser->throbber);
|
gtk_widget_show (browser->throbber);
|
||||||
|
@ -3552,7 +3590,7 @@ midori_browser_init (MidoriBrowser* browser)
|
||||||
browser->navigationbar = gtk_ui_manager_get_widget (
|
browser->navigationbar = gtk_ui_manager_get_widget (
|
||||||
ui_manager, "/toolbar_navigation");
|
ui_manager, "/toolbar_navigation");
|
||||||
/* FIXME: settings should be connected with screen changes */
|
/* FIXME: settings should be connected with screen changes */
|
||||||
GtkSettings* gtk_settings = gtk_widget_get_settings (GTK_WIDGET (browser));
|
gtk_settings = gtk_widget_get_settings (GTK_WIDGET (browser));
|
||||||
if (gtk_settings)
|
if (gtk_settings)
|
||||||
g_signal_connect (gtk_settings, "notify::gtk-toolbar-style",
|
g_signal_connect (gtk_settings, "notify::gtk-toolbar-style",
|
||||||
G_CALLBACK (midori_browser_navigationbar_notify_style_cb), browser);
|
G_CALLBACK (midori_browser_navigationbar_notify_style_cb), browser);
|
||||||
|
@ -3575,12 +3613,11 @@ midori_browser_init (MidoriBrowser* browser)
|
||||||
G_CALLBACK (midori_browser_toolbar_popup_context_menu_cb), browser);
|
G_CALLBACK (midori_browser_toolbar_popup_context_menu_cb), browser);
|
||||||
|
|
||||||
/* Superuser warning */
|
/* Superuser warning */
|
||||||
GtkWidget* hbox;
|
|
||||||
if ((hbox = sokoke_superuser_warning_new ()))
|
if ((hbox = sokoke_superuser_warning_new ()))
|
||||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
||||||
|
|
||||||
/* Create the panel */
|
/* Create the panel */
|
||||||
GtkWidget* hpaned = gtk_hpaned_new ();
|
hpaned = gtk_hpaned_new ();
|
||||||
g_signal_connect (hpaned, "notify::position",
|
g_signal_connect (hpaned, "notify::position",
|
||||||
G_CALLBACK (midori_panel_notify_position_cb),
|
G_CALLBACK (midori_panel_notify_position_cb),
|
||||||
browser);
|
browser);
|
||||||
|
@ -3595,12 +3632,9 @@ midori_browser_init (MidoriBrowser* browser)
|
||||||
gtk_paned_pack1 (GTK_PANED (hpaned), browser->panel, FALSE, FALSE);
|
gtk_paned_pack1 (GTK_PANED (hpaned), browser->panel, FALSE, FALSE);
|
||||||
|
|
||||||
/* Bookmarks */
|
/* Bookmarks */
|
||||||
GtkWidget* box = gtk_vbox_new (FALSE, 0);
|
box = gtk_vbox_new (FALSE, 0);
|
||||||
GtkTreeViewColumn* column;
|
treestore = gtk_tree_store_new (1, KATZE_TYPE_ITEM);
|
||||||
GtkCellRenderer* renderer_text;
|
treeview = gtk_tree_view_new_with_model (GTK_TREE_MODEL (treestore));
|
||||||
GtkCellRenderer* renderer_pixbuf;
|
|
||||||
GtkTreeStore* treestore = gtk_tree_store_new (1, KATZE_TYPE_ITEM);
|
|
||||||
GtkWidget* treeview = gtk_tree_view_new_with_model (GTK_TREE_MODEL (treestore));
|
|
||||||
gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (treeview), FALSE);
|
gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (treeview), FALSE);
|
||||||
column = gtk_tree_view_column_new ();
|
column = gtk_tree_view_column_new ();
|
||||||
renderer_pixbuf = gtk_cell_renderer_pixbuf_new ();
|
renderer_pixbuf = gtk_cell_renderer_pixbuf_new ();
|
||||||
|
@ -3632,8 +3666,7 @@ midori_browser_init (MidoriBrowser* browser)
|
||||||
gtk_box_pack_start (GTK_BOX (box), treeview, TRUE, TRUE, 0);
|
gtk_box_pack_start (GTK_BOX (box), treeview, TRUE, TRUE, 0);
|
||||||
browser->panel_bookmarks = treeview;
|
browser->panel_bookmarks = treeview;
|
||||||
gtk_widget_show_all (box);
|
gtk_widget_show_all (box);
|
||||||
GtkWidget* toolbar = gtk_ui_manager_get_widget (ui_manager,
|
toolbar = gtk_ui_manager_get_widget (ui_manager, "/toolbar_bookmarks");
|
||||||
"/toolbar_bookmarks");
|
|
||||||
_action_set_sensitive (browser, "BookmarkAdd", FALSE);
|
_action_set_sensitive (browser, "BookmarkAdd", FALSE);
|
||||||
gtk_toolbar_set_icon_size (GTK_TOOLBAR (toolbar), GTK_ICON_SIZE_MENU);
|
gtk_toolbar_set_icon_size (GTK_TOOLBAR (toolbar), GTK_ICON_SIZE_MENU);
|
||||||
gtk_widget_show_all (toolbar);
|
gtk_widget_show_all (toolbar);
|
||||||
|
@ -3642,7 +3675,7 @@ midori_browser_init (MidoriBrowser* browser)
|
||||||
STOCK_BOOKMARKS, _("Bookmarks"));
|
STOCK_BOOKMARKS, _("Bookmarks"));
|
||||||
|
|
||||||
/* Transfers */
|
/* Transfers */
|
||||||
GtkWidget* panel = midori_view_new (browser->net);
|
panel = midori_view_new (browser->net);
|
||||||
gtk_widget_show (panel);
|
gtk_widget_show (panel);
|
||||||
midori_panel_append_page (MIDORI_PANEL (browser->panel),
|
midori_panel_append_page (MIDORI_PANEL (browser->panel),
|
||||||
panel, NULL,
|
panel, NULL,
|
||||||
|
@ -3731,6 +3764,9 @@ midori_browser_init (MidoriBrowser* browser)
|
||||||
STOCK_EXTENSIONS, _("Extensions"));
|
STOCK_EXTENSIONS, _("Extensions"));
|
||||||
|
|
||||||
/* Notebook, containing all views */
|
/* Notebook, containing all views */
|
||||||
|
vpaned = gtk_vpaned_new ();
|
||||||
|
gtk_paned_pack2 (GTK_PANED (hpaned), vpaned, FALSE, FALSE);
|
||||||
|
gtk_widget_show (vpaned);
|
||||||
browser->notebook = gtk_notebook_new ();
|
browser->notebook = gtk_notebook_new ();
|
||||||
/* Remove the inner border between scrollbars and the window border */
|
/* Remove the inner border between scrollbars and the window border */
|
||||||
rcstyle = gtk_rc_style_new ();
|
rcstyle = gtk_rc_style_new ();
|
||||||
|
@ -3738,12 +3774,28 @@ midori_browser_init (MidoriBrowser* browser)
|
||||||
gtk_widget_modify_style (browser->notebook, rcstyle);
|
gtk_widget_modify_style (browser->notebook, rcstyle);
|
||||||
g_object_unref (rcstyle);
|
g_object_unref (rcstyle);
|
||||||
gtk_notebook_set_scrollable (GTK_NOTEBOOK (browser->notebook), TRUE);
|
gtk_notebook_set_scrollable (GTK_NOTEBOOK (browser->notebook), TRUE);
|
||||||
gtk_paned_pack2 (GTK_PANED (hpaned), browser->notebook, FALSE, FALSE);
|
gtk_paned_pack2 (GTK_PANED (vpaned), browser->notebook, FALSE, FALSE);
|
||||||
g_signal_connect_after (browser->notebook, "switch-page",
|
g_signal_connect_after (browser->notebook, "switch-page",
|
||||||
G_CALLBACK (gtk_notebook_switch_page_cb),
|
G_CALLBACK (gtk_notebook_switch_page_cb),
|
||||||
browser);
|
browser);
|
||||||
gtk_widget_show (browser->notebook);
|
gtk_widget_show (browser->notebook);
|
||||||
|
|
||||||
|
/* Inspector container */
|
||||||
|
browser->inspector = gtk_vbox_new (FALSE, 0);
|
||||||
|
gtk_paned_pack2 (GTK_PANED (vpaned), browser->inspector, TRUE, TRUE);
|
||||||
|
scrolled = gtk_scrolled_window_new (NULL, NULL);
|
||||||
|
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled),
|
||||||
|
GTK_POLICY_AUTOMATIC,
|
||||||
|
GTK_POLICY_AUTOMATIC);
|
||||||
|
GTK_WIDGET_SET_FLAGS (scrolled, GTK_CAN_FOCUS);
|
||||||
|
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled),
|
||||||
|
GTK_SHADOW_ETCHED_IN);
|
||||||
|
gtk_box_pack_start (GTK_BOX (browser->inspector),
|
||||||
|
scrolled, TRUE, TRUE, 0);
|
||||||
|
browser->inspector_view = webkit_web_view_new ();
|
||||||
|
gtk_container_add (GTK_CONTAINER (scrolled), browser->inspector_view);
|
||||||
|
gtk_widget_show_all (browser->inspector);
|
||||||
|
|
||||||
/* Incremental findbar */
|
/* Incremental findbar */
|
||||||
browser->find = gtk_toolbar_new ();
|
browser->find = gtk_toolbar_new ();
|
||||||
gtk_toolbar_set_icon_size (GTK_TOOLBAR (browser->find), GTK_ICON_SIZE_MENU);
|
gtk_toolbar_set_icon_size (GTK_TOOLBAR (browser->find), GTK_ICON_SIZE_MENU);
|
||||||
|
|
|
@ -423,10 +423,17 @@ midori_preferences_set_settings (MidoriPreferences* preferences,
|
||||||
button = katze_property_proxy (settings, "enable-plugins", NULL);
|
button = katze_property_proxy (settings, "enable-plugins", NULL);
|
||||||
gtk_button_set_label (GTK_BUTTON (button), _("Enable scripts"));
|
gtk_button_set_label (GTK_BUTTON (button), _("Enable scripts"));
|
||||||
SPANNED_ADD (button, 1, 2, 2, 3);
|
SPANNED_ADD (button, 1, 2, 2, 3);
|
||||||
|
#ifdef WEBKIT_CHECK_VERSION
|
||||||
|
#if WEBKIT_CHECK_VERSION (1, 0, 3)
|
||||||
|
button = katze_property_proxy (settings, "enable-developer-extras", NULL);
|
||||||
|
gtk_button_set_label (GTK_BUTTON (button), _("Developer tools"));
|
||||||
|
SPANNED_ADD (button, 0, 1, 3, 4);
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
label = katze_property_label (settings, "location-entry-search");
|
label = katze_property_label (settings, "location-entry-search");
|
||||||
INDENTED_ADD (label, 0, 1, 3, 4);
|
INDENTED_ADD (label, 0, 1, 4, 5);
|
||||||
entry = katze_property_proxy (settings, "location-entry-search", NULL);
|
entry = katze_property_proxy (settings, "location-entry-search", NULL);
|
||||||
FILLED_ADD (entry, 1, 2, 3, 4);
|
FILLED_ADD (entry, 1, 2, 4, 5);
|
||||||
|
|
||||||
/* Page "Interface" */
|
/* Page "Interface" */
|
||||||
PAGE_NEW (GTK_STOCK_CONVERT, _("Interface"));
|
PAGE_NEW (GTK_STOCK_CONVERT, _("Interface"));
|
||||||
|
|
|
@ -106,6 +106,7 @@ enum
|
||||||
enum {
|
enum {
|
||||||
ACTIVATE_ACTION,
|
ACTIVATE_ACTION,
|
||||||
CONSOLE_MESSAGE,
|
CONSOLE_MESSAGE,
|
||||||
|
ATTACH_INSPECTOR,
|
||||||
WINDOW_OBJECT_CLEARED,
|
WINDOW_OBJECT_CLEARED,
|
||||||
NEW_TAB,
|
NEW_TAB,
|
||||||
NEW_WINDOW,
|
NEW_WINDOW,
|
||||||
|
@ -280,6 +281,17 @@ midori_view_class_init (MidoriViewClass* class)
|
||||||
G_TYPE_INT,
|
G_TYPE_INT,
|
||||||
G_TYPE_STRING);
|
G_TYPE_STRING);
|
||||||
|
|
||||||
|
signals[ATTACH_INSPECTOR] = g_signal_new (
|
||||||
|
"attach-inspector",
|
||||||
|
G_TYPE_FROM_CLASS (class),
|
||||||
|
(GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
NULL,
|
||||||
|
g_cclosure_marshal_VOID__OBJECT,
|
||||||
|
G_TYPE_NONE, 1,
|
||||||
|
GTK_TYPE_WIDGET);
|
||||||
|
|
||||||
signals[WINDOW_OBJECT_CLEARED] = g_signal_new (
|
signals[WINDOW_OBJECT_CLEARED] = g_signal_new (
|
||||||
"window-object-cleared",
|
"window-object-cleared",
|
||||||
G_TYPE_FROM_CLASS (class),
|
G_TYPE_FROM_CLASS (class),
|
||||||
|
@ -1215,10 +1227,80 @@ midori_view_get_progress (MidoriView* view)
|
||||||
return view->progress;
|
return view->progress;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef WEBKIT_CHECK_VERSION
|
||||||
|
#if WEBKIT_CHECK_VERSION (1, 0, 3)
|
||||||
|
static WebKitWebView*
|
||||||
|
webkit_web_inspector_inspect_web_view_cb (WebKitWebInspector* inspector,
|
||||||
|
WebKitWebView* web_view,
|
||||||
|
MidoriView* view)
|
||||||
|
{
|
||||||
|
gchar* title;
|
||||||
|
GtkWidget* window;
|
||||||
|
GtkWidget* toplevel;
|
||||||
|
GdkScreen* screen;
|
||||||
|
gint width, height;
|
||||||
|
GtkIconTheme* icon_theme;
|
||||||
|
GdkPixbuf* icon;
|
||||||
|
GdkPixbuf* gray_icon;
|
||||||
|
GtkWidget* inspector_view;
|
||||||
|
|
||||||
|
title = g_strdup_printf (_("Inspect page - %s"), "");
|
||||||
|
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||||
|
gtk_window_set_title (GTK_WINDOW (window), title);
|
||||||
|
g_free (title);
|
||||||
|
|
||||||
|
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (view));
|
||||||
|
if (GTK_WIDGET_TOPLEVEL (toplevel))
|
||||||
|
{
|
||||||
|
gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (toplevel));
|
||||||
|
screen = gtk_window_get_screen (GTK_WINDOW (toplevel));
|
||||||
|
width = gdk_screen_get_width (screen) / 1.7;
|
||||||
|
height = gdk_screen_get_height (screen) / 1.7;
|
||||||
|
gtk_window_set_default_size (GTK_WINDOW (window), width, height);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Attempt to make a gray version of the icon on the fly */
|
||||||
|
icon_theme = gtk_icon_theme_get_for_screen (
|
||||||
|
gtk_widget_get_screen (GTK_WIDGET (view)));
|
||||||
|
icon = gtk_icon_theme_load_icon (icon_theme, "midori", 32,
|
||||||
|
GTK_ICON_LOOKUP_USE_BUILTIN, NULL);
|
||||||
|
if (icon)
|
||||||
|
{
|
||||||
|
gray_icon = gdk_pixbuf_copy (icon);
|
||||||
|
if (gray_icon)
|
||||||
|
{
|
||||||
|
gdk_pixbuf_saturate_and_pixelate (gray_icon, gray_icon, 0.1, FALSE);
|
||||||
|
gtk_window_set_icon (GTK_WINDOW (window), gray_icon);
|
||||||
|
g_object_unref (gray_icon);
|
||||||
|
}
|
||||||
|
g_object_unref (icon);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
gtk_window_set_icon_name (GTK_WINDOW (window), "midori");
|
||||||
|
inspector_view = webkit_web_view_new ();
|
||||||
|
gtk_container_add (GTK_CONTAINER (window), inspector_view);
|
||||||
|
|
||||||
|
/* FIXME: Implement web inspector signals properly
|
||||||
|
FIXME: Save and restore window size
|
||||||
|
FIXME: Update window title with URI */
|
||||||
|
gtk_widget_show_all (window);
|
||||||
|
/* inspector_view = webkit_web_view_new ();
|
||||||
|
gtk_widget_show (inspector_view);
|
||||||
|
g_signal_emit (view, signals[ATTACH_INSPECTOR], 0, inspector_view); */
|
||||||
|
return WEBKIT_WEB_VIEW (inspector_view);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
static void
|
static void
|
||||||
midori_view_construct_web_view (MidoriView* view)
|
midori_view_construct_web_view (MidoriView* view)
|
||||||
{
|
{
|
||||||
WebKitWebFrame* web_frame;
|
WebKitWebFrame* web_frame;
|
||||||
|
#ifdef WEBKIT_CHECK_VERSION
|
||||||
|
#if WEBKIT_CHECK_VERSION (1, 0, 3)
|
||||||
|
WebKitWebInspector* inspector;
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
view->web_view = webkit_web_view_new ();
|
view->web_view = webkit_web_view_new ();
|
||||||
|
|
||||||
|
@ -1261,6 +1343,16 @@ midori_view_construct_web_view (MidoriView* view)
|
||||||
|
|
||||||
gtk_widget_show (view->web_view);
|
gtk_widget_show (view->web_view);
|
||||||
gtk_container_add (GTK_CONTAINER (view), view->web_view);
|
gtk_container_add (GTK_CONTAINER (view), view->web_view);
|
||||||
|
|
||||||
|
#ifdef WEBKIT_CHECK_VERSION
|
||||||
|
#if WEBKIT_CHECK_VERSION (1, 0, 3)
|
||||||
|
inspector = webkit_web_view_get_inspector (WEBKIT_WEB_VIEW (view->web_view));
|
||||||
|
g_object_connect (inspector,
|
||||||
|
"signal::inspect-web-view",
|
||||||
|
webkit_web_inspector_inspect_web_view_cb, view,
|
||||||
|
NULL);
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue