Add common context menu items and cleanup.
Add the actions UndoTabClose, BookmarkNew, SaveAs, SourceView and Print to the context menu. Also add UndoTabClose to the Go menu, remove STOCK_SOURCE_VIEW and remove ui.h which is obsolete.
This commit is contained in:
parent
02d7848c5d
commit
44bc12c305
5 changed files with 40 additions and 30 deletions
|
@ -40,7 +40,6 @@ MidoriWebSettings* webSettings;
|
||||||
#define STOCK_NEWSFEED "gtk-index" // "newsfeed"
|
#define STOCK_NEWSFEED "gtk-index" // "newsfeed"
|
||||||
#define STOCK_PLUGINS GTK_STOCK_CONVERT // "plugin"
|
#define STOCK_PLUGINS GTK_STOCK_CONVERT // "plugin"
|
||||||
#define STOCK_POPUPS_BLOCKED "popup-hidden"
|
#define STOCK_POPUPS_BLOCKED "popup-hidden"
|
||||||
#define STOCK_SOURCE_VIEW "stock_view-html-source" // "view-source"
|
|
||||||
#define STOCK_TAB_CLOSE GTK_STOCK_CLOSE // "tab-close"
|
#define STOCK_TAB_CLOSE GTK_STOCK_CLOSE // "tab-close"
|
||||||
#define STOCK_WINDOW_CLOSE GTK_STOCK_CLOSE // "window-close"
|
#define STOCK_WINDOW_CLOSE GTK_STOCK_CLOSE // "window-close"
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,6 @@ static void stock_items_init(void)
|
||||||
{ STOCK_NEWSFEED, "Newsfeed", 0, 0, NULL },
|
{ STOCK_NEWSFEED, "Newsfeed", 0, 0, NULL },
|
||||||
{ STOCK_PLUGINS, "_Plugins", 0, 0, NULL },
|
{ STOCK_PLUGINS, "_Plugins", 0, 0, NULL },
|
||||||
{ STOCK_POPUPS_BLOCKED, "Blocked Popups", 0, 0, NULL },
|
{ STOCK_POPUPS_BLOCKED, "Blocked Popups", 0, 0, NULL },
|
||||||
{ STOCK_SOURCE_VIEW, "View Source", 0, 0, NULL },
|
|
||||||
{ STOCK_TAB_CLOSE, "C_lose Tab", 0, 0, NULL },
|
{ STOCK_TAB_CLOSE, "C_lose Tab", 0, 0, NULL },
|
||||||
{ STOCK_TAB_NEW, "New _Tab", 0, 0, NULL },
|
{ STOCK_TAB_NEW, "New _Tab", 0, 0, NULL },
|
||||||
{ STOCK_WINDOW_CLOSE, "_Close Window", 0, 0, NULL },
|
{ STOCK_WINDOW_CLOSE, "_Close Window", 0, 0, NULL },
|
||||||
|
|
|
@ -396,13 +396,24 @@ midori_web_view_populate_popup_cb (GtkWidget* web_view,
|
||||||
|
|
||||||
if (!uri && !webkit_web_view_has_selection (WEBKIT_WEB_VIEW (web_view)))
|
if (!uri && !webkit_web_view_has_selection (WEBKIT_WEB_VIEW (web_view)))
|
||||||
{
|
{
|
||||||
// TODO: menu items
|
GtkAction* action = _action_by_name (browser, "UndoTabClose");
|
||||||
// UndoTabClose
|
GtkWidget* menuitem = gtk_action_create_menu_item (action);
|
||||||
// sep
|
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
|
||||||
// BookmarkNew
|
menuitem = gtk_separator_menu_item_new ();
|
||||||
// SaveAs
|
gtk_widget_show (menuitem);
|
||||||
// SourceView
|
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
|
||||||
// Print
|
action = _action_by_name (browser, "BookmarkNew");
|
||||||
|
menuitem = gtk_action_create_menu_item (action);
|
||||||
|
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
|
||||||
|
action = _action_by_name (browser, "SaveAs");
|
||||||
|
menuitem = gtk_action_create_menu_item (action);
|
||||||
|
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
|
||||||
|
action = _action_by_name (browser, "SourceView");
|
||||||
|
menuitem = gtk_action_create_menu_item (action);
|
||||||
|
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
|
||||||
|
action = _action_by_name (browser, "Print");
|
||||||
|
menuitem = gtk_action_create_menu_item (action);
|
||||||
|
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1920,10 +1931,10 @@ static const GtkActionEntry entries[] = {
|
||||||
{ "ZoomNormal", GTK_STOCK_ZOOM_100,
|
{ "ZoomNormal", GTK_STOCK_ZOOM_100,
|
||||||
NULL, "<Ctrl>0",
|
NULL, "<Ctrl>0",
|
||||||
"hm?", NULL/*G_CALLBACK (_action_zoom_normal_activate)*/ },
|
"hm?", NULL/*G_CALLBACK (_action_zoom_normal_activate)*/ },
|
||||||
{ "SourceView", STOCK_SOURCE_VIEW,
|
{ "SourceView", NULL,
|
||||||
NULL, "",
|
"View Source", "",
|
||||||
"hm?", /*G_CALLBACK (_action_source_view_activate)*/ },
|
"hm?", /*G_CALLBACK (_action_source_view_activate)*/ },
|
||||||
{ "SelectionSourceView", STOCK_SOURCE_VIEW,
|
{ "SelectionSourceView", NULL,
|
||||||
"View Selection Source", "",
|
"View Selection Source", "",
|
||||||
"hm?", NULL/*G_CALLBACK (_action_selection_source_view_activate)*/ },
|
"hm?", NULL/*G_CALLBACK (_action_selection_source_view_activate)*/ },
|
||||||
{ "Fullscreen", GTK_STOCK_FULLSCREEN,
|
{ "Fullscreen", GTK_STOCK_FULLSCREEN,
|
||||||
|
@ -2151,6 +2162,7 @@ static const gchar* ui_markup =
|
||||||
"<separator/>"
|
"<separator/>"
|
||||||
"<menuitem action='TrashEmpty'/>"
|
"<menuitem action='TrashEmpty'/>"
|
||||||
"</menu>"
|
"</menu>"
|
||||||
|
"<menuitem action='UndoTabClose'/>"
|
||||||
"<separator/>"
|
"<separator/>"
|
||||||
"<menuitem action='Find'/>"
|
"<menuitem action='Find'/>"
|
||||||
"<menuitem action='FindNext'/>"
|
"<menuitem action='FindNext'/>"
|
||||||
|
@ -2669,7 +2681,9 @@ midori_browser_set_property (GObject* object,
|
||||||
case PROP_SETTINGS:
|
case PROP_SETTINGS:
|
||||||
katze_object_assign (priv->settings, g_value_get_object (value));
|
katze_object_assign (priv->settings, g_value_get_object (value));
|
||||||
g_object_ref (priv->settings);
|
g_object_ref (priv->settings);
|
||||||
// FIXME: Assign settings to each web view
|
gtk_container_foreach (GTK_CONTAINER (priv->notebook),
|
||||||
|
(GtkCallback*) midori_web_view_set_settings,
|
||||||
|
priv->settings);
|
||||||
break;
|
break;
|
||||||
case PROP_TRASH:
|
case PROP_TRASH:
|
||||||
; // FIXME: Disconnect handlers
|
; // FIXME: Disconnect handlers
|
||||||
|
|
|
@ -458,7 +458,6 @@ midori_web_view_menu_new_tab_activate_cb (GtkWidget* widget,
|
||||||
MidoriWebView* web_view)
|
MidoriWebView* web_view)
|
||||||
{
|
{
|
||||||
const gchar* uri = g_object_get_data (G_OBJECT (widget), "uri");
|
const gchar* uri = g_object_get_data (G_OBJECT (widget), "uri");
|
||||||
g_print ("selected: %s\n", uri);
|
|
||||||
g_signal_emit (web_view, signals[NEW_TAB], 0, uri);
|
g_signal_emit (web_view, signals[NEW_TAB], 0, uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -503,7 +502,7 @@ webkit_web_view_populate_popup_cb (GtkWidget* web_view,
|
||||||
G_CALLBACK (midori_web_view_menu_new_tab_activate_cb), web_view);
|
G_CALLBACK (midori_web_view_menu_new_tab_activate_cb), web_view);
|
||||||
gtk_widget_show (menuitem);
|
gtk_widget_show (menuitem);
|
||||||
}
|
}
|
||||||
// FIXME: We are leaking 'text' which is not const be should be.
|
// FIXME: We are leaking 'text' which is not const but should be.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -755,6 +754,20 @@ midori_web_view_new (void)
|
||||||
return GTK_WIDGET (web_view);
|
return GTK_WIDGET (web_view);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* midori_web_view_set_settings:
|
||||||
|
* @web_view: a #MidoriWebView
|
||||||
|
* @web_settings: a #MidoriWebSettings
|
||||||
|
*
|
||||||
|
* Assigns a settings instance to the web view.
|
||||||
|
**/
|
||||||
|
void
|
||||||
|
midori_web_view_set_settings (MidoriWebView* web_view,
|
||||||
|
MidoriWebSettings* web_settings)
|
||||||
|
{
|
||||||
|
g_object_set (web_view, "settings", web_settings, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* midori_web_view_get_proxy_menu_item:
|
* midori_web_view_get_proxy_menu_item:
|
||||||
* @web_view: a #MidoriWebView
|
* @web_view: a #MidoriWebView
|
||||||
|
|
15
src/ui.h
15
src/ui.h
|
@ -1,15 +0,0 @@
|
||||||
/*
|
|
||||||
Copyright (C) 2007 Christian Dywan <christian@twotoasts.de>
|
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
See the file COPYING for the full license text.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __UI_H__
|
|
||||||
#define __UI_H__ 1
|
|
||||||
|
|
||||||
#endif /* !__UI_H__ */
|
|
Loading…
Reference in a new issue