Integrate panel toolbars properly outside scrolled areas.
This commit is contained in:
parent
a580cf281b
commit
2e580f0503
6 changed files with 83 additions and 36 deletions
|
@ -85,7 +85,8 @@ enum
|
||||||
PROP_TRASH
|
PROP_TRASH
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum
|
||||||
|
{
|
||||||
NEW_WINDOW,
|
NEW_WINDOW,
|
||||||
STATUSBAR_TEXT_CHANGED,
|
STATUSBAR_TEXT_CHANGED,
|
||||||
ELEMENT_MOTION,
|
ELEMENT_MOTION,
|
||||||
|
@ -2487,9 +2488,6 @@ midori_browser_init (MidoriBrowser* browser)
|
||||||
|
|
||||||
// Bookmarks
|
// Bookmarks
|
||||||
GtkWidget* box = gtk_vbox_new (FALSE, 0);
|
GtkWidget* box = gtk_vbox_new (FALSE, 0);
|
||||||
GtkWidget* toolbar = gtk_ui_manager_get_widget (ui_manager, "/toolbar_bookmarks");
|
|
||||||
gtk_toolbar_set_icon_size (GTK_TOOLBAR (toolbar), GTK_ICON_SIZE_MENU);
|
|
||||||
gtk_box_pack_start (GTK_BOX (box), toolbar, FALSE, FALSE, 0);
|
|
||||||
GtkTreeViewColumn* column;
|
GtkTreeViewColumn* column;
|
||||||
GtkCellRenderer* renderer_text;
|
GtkCellRenderer* renderer_text;
|
||||||
GtkCellRenderer* renderer_pixbuf;
|
GtkCellRenderer* renderer_pixbuf;
|
||||||
|
@ -2527,9 +2525,13 @@ 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);
|
||||||
priv->panel_bookmarks = treeview;
|
priv->panel_bookmarks = treeview;
|
||||||
gtk_widget_show_all (box);
|
gtk_widget_show_all (box);
|
||||||
|
GtkWidget* toolbar = gtk_ui_manager_get_widget (ui_manager,
|
||||||
|
"/toolbar_bookmarks");
|
||||||
|
gtk_toolbar_set_icon_size (GTK_TOOLBAR (toolbar), GTK_ICON_SIZE_MENU);
|
||||||
|
gtk_widget_show_all (toolbar);
|
||||||
midori_panel_append_page (MIDORI_PANEL (priv->panel),
|
midori_panel_append_page (MIDORI_PANEL (priv->panel),
|
||||||
box, "vcard", _("Bookmarks"));
|
box, toolbar,
|
||||||
action = _action_by_name (browser, "PanelBookmarks");
|
"vcard", _("Bookmarks"));
|
||||||
|
|
||||||
// Transfers
|
// Transfers
|
||||||
priv->panel_pageholder = g_object_new (MIDORI_TYPE_WEB_VIEW,
|
priv->panel_pageholder = g_object_new (MIDORI_TYPE_WEB_VIEW,
|
||||||
|
@ -2537,14 +2539,16 @@ midori_browser_init (MidoriBrowser* browser)
|
||||||
NULL);
|
NULL);
|
||||||
gtk_widget_show (priv->panel_pageholder);
|
gtk_widget_show (priv->panel_pageholder);
|
||||||
midori_panel_append_page (MIDORI_PANEL (priv->panel),
|
midori_panel_append_page (MIDORI_PANEL (priv->panel),
|
||||||
priv->panel_pageholder,
|
priv->panel_pageholder, NULL,
|
||||||
"package", _("Transfers"));
|
"package", _("Transfers"));
|
||||||
|
|
||||||
// Console
|
// Console
|
||||||
priv->panel_console = midori_console_new ();
|
priv->panel_console = midori_console_new ();
|
||||||
gtk_widget_show (priv->panel_console);
|
gtk_widget_show (priv->panel_console);
|
||||||
|
toolbar = midori_console_get_toolbar (MIDORI_CONSOLE (priv->panel_console));
|
||||||
|
gtk_widget_show (toolbar);
|
||||||
midori_panel_append_page (MIDORI_PANEL (priv->panel),
|
midori_panel_append_page (MIDORI_PANEL (priv->panel),
|
||||||
priv->panel_console,
|
priv->panel_console, toolbar,
|
||||||
"terminal", _("Console"));
|
"terminal", _("Console"));
|
||||||
|
|
||||||
// History
|
// History
|
||||||
|
@ -2553,7 +2557,7 @@ midori_browser_init (MidoriBrowser* browser)
|
||||||
NULL);
|
NULL);
|
||||||
gtk_widget_show (priv->panel_pageholder);
|
gtk_widget_show (priv->panel_pageholder);
|
||||||
midori_panel_append_page (MIDORI_PANEL (priv->panel),
|
midori_panel_append_page (MIDORI_PANEL (priv->panel),
|
||||||
priv->panel_pageholder,
|
priv->panel_pageholder, NULL,
|
||||||
"document-open-recent", _("History"));
|
"document-open-recent", _("History"));
|
||||||
|
|
||||||
// Pageholder
|
// Pageholder
|
||||||
|
@ -2562,7 +2566,7 @@ midori_browser_init (MidoriBrowser* browser)
|
||||||
NULL);
|
NULL);
|
||||||
gtk_widget_show (priv->panel_pageholder);
|
gtk_widget_show (priv->panel_pageholder);
|
||||||
midori_panel_append_page (MIDORI_PANEL (priv->panel),
|
midori_panel_append_page (MIDORI_PANEL (priv->panel),
|
||||||
priv->panel_pageholder,
|
priv->panel_pageholder, NULL,
|
||||||
GTK_STOCK_CONVERT, _("Pageholder"));
|
GTK_STOCK_CONVERT, _("Pageholder"));
|
||||||
|
|
||||||
// Notebook, containing all web_views
|
// Notebook, containing all web_views
|
||||||
|
@ -3081,8 +3085,6 @@ void
|
||||||
midori_browser_activate_action (MidoriBrowser* browser,
|
midori_browser_activate_action (MidoriBrowser* browser,
|
||||||
const gchar* name)
|
const gchar* name)
|
||||||
{
|
{
|
||||||
MidoriBrowserPrivate* priv = browser->priv;
|
|
||||||
|
|
||||||
GtkAction* action = _action_by_name (browser, name);
|
GtkAction* action = _action_by_name (browser, name);
|
||||||
if (action)
|
if (action)
|
||||||
gtk_action_activate (action);
|
gtk_action_activate (action);
|
||||||
|
|
|
@ -100,26 +100,6 @@ midori_console_init (MidoriConsole* console)
|
||||||
|
|
||||||
MidoriConsolePrivate* priv = console->priv;
|
MidoriConsolePrivate* priv = console->priv;
|
||||||
|
|
||||||
// Create the toolbar
|
|
||||||
GtkWidget* toolbar = gtk_toolbar_new ();
|
|
||||||
gtk_toolbar_set_style (GTK_TOOLBAR (toolbar), GTK_TOOLBAR_BOTH_HORIZ);
|
|
||||||
gtk_toolbar_set_icon_size (GTK_TOOLBAR (toolbar), GTK_ICON_SIZE_BUTTON);
|
|
||||||
GtkToolItem* toolitem = gtk_tool_item_new ();
|
|
||||||
// TODO: What about a find entry here that filters e.g. by url?
|
|
||||||
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), toolitem, -1);
|
|
||||||
toolitem = gtk_separator_tool_item_new ();
|
|
||||||
gtk_separator_tool_item_set_draw (GTK_SEPARATOR_TOOL_ITEM (toolitem),
|
|
||||||
FALSE);
|
|
||||||
gtk_tool_item_set_expand (toolitem, TRUE);
|
|
||||||
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), toolitem, -1);
|
|
||||||
toolitem = gtk_tool_button_new_from_stock (GTK_STOCK_CLEAR);
|
|
||||||
gtk_tool_item_set_is_important (toolitem, TRUE);
|
|
||||||
g_signal_connect (toolitem, "clicked",
|
|
||||||
G_CALLBACK (midori_console_button_clear_clicked_cb), console);
|
|
||||||
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), toolitem, -1);
|
|
||||||
gtk_widget_show_all (toolbar);
|
|
||||||
gtk_box_pack_start (GTK_BOX (console), toolbar, FALSE, FALSE, 0);
|
|
||||||
|
|
||||||
// Create the treeview
|
// Create the treeview
|
||||||
GtkTreeViewColumn* column;
|
GtkTreeViewColumn* column;
|
||||||
GtkCellRenderer* renderer_text;
|
GtkCellRenderer* renderer_text;
|
||||||
|
@ -165,6 +145,49 @@ midori_console_new (void)
|
||||||
return GTK_WIDGET (console);
|
return GTK_WIDGET (console);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* midori_console_get_toolbar:
|
||||||
|
*
|
||||||
|
* Retrieves the toolbar of the console. A new widget is created on
|
||||||
|
* the first call of this function.
|
||||||
|
*
|
||||||
|
* Return value: a new #MidoriConsole
|
||||||
|
**/
|
||||||
|
GtkWidget*
|
||||||
|
midori_console_get_toolbar (MidoriConsole* console)
|
||||||
|
{
|
||||||
|
g_return_if_fail (MIDORI_IS_CONSOLE (console));
|
||||||
|
|
||||||
|
MidoriConsolePrivate* priv = console->priv;
|
||||||
|
|
||||||
|
static GtkWidget* toolbar = NULL;
|
||||||
|
|
||||||
|
if (!toolbar)
|
||||||
|
{
|
||||||
|
toolbar = gtk_toolbar_new ();
|
||||||
|
gtk_toolbar_set_style (GTK_TOOLBAR (toolbar), GTK_TOOLBAR_BOTH_HORIZ);
|
||||||
|
gtk_toolbar_set_icon_size (GTK_TOOLBAR (toolbar), GTK_ICON_SIZE_BUTTON);
|
||||||
|
GtkToolItem* toolitem = gtk_tool_item_new ();
|
||||||
|
// TODO: What about a find entry here that filters e.g. by url?
|
||||||
|
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), toolitem, -1);
|
||||||
|
gtk_widget_show (toolitem);
|
||||||
|
toolitem = gtk_separator_tool_item_new ();
|
||||||
|
gtk_separator_tool_item_set_draw (GTK_SEPARATOR_TOOL_ITEM (toolitem),
|
||||||
|
FALSE);
|
||||||
|
gtk_tool_item_set_expand (toolitem, TRUE);
|
||||||
|
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), toolitem, -1);
|
||||||
|
gtk_widget_show (toolitem);
|
||||||
|
toolitem = gtk_tool_button_new_from_stock (GTK_STOCK_CLEAR);
|
||||||
|
gtk_tool_item_set_is_important (toolitem, TRUE);
|
||||||
|
g_signal_connect (toolitem, "clicked",
|
||||||
|
G_CALLBACK (midori_console_button_clear_clicked_cb), console);
|
||||||
|
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), toolitem, -1);
|
||||||
|
gtk_widget_show (toolitem);
|
||||||
|
}
|
||||||
|
|
||||||
|
return toolbar;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* midori_console_add:
|
* midori_console_add:
|
||||||
* @console: a #MidoriConsole
|
* @console: a #MidoriConsole
|
||||||
|
|
|
@ -53,8 +53,11 @@ midori_console_get_type (void);
|
||||||
GtkWidget*
|
GtkWidget*
|
||||||
midori_console_new (void);
|
midori_console_new (void);
|
||||||
|
|
||||||
|
GtkWidget*
|
||||||
|
midori_console_get_toolbar (MidoriConsole* console);
|
||||||
|
|
||||||
void
|
void
|
||||||
midori_console_add (MidoriConsole* panel,
|
midori_console_add (MidoriConsole* console,
|
||||||
const gchar* message,
|
const gchar* message,
|
||||||
gint line,
|
gint line,
|
||||||
const gchar* source_id);
|
const gchar* source_id);
|
||||||
|
|
|
@ -21,6 +21,7 @@ struct _MidoriPanelPrivate
|
||||||
GtkWidget* toolbar;
|
GtkWidget* toolbar;
|
||||||
GtkWidget* toolbar_label;
|
GtkWidget* toolbar_label;
|
||||||
GtkWidget* frame;
|
GtkWidget* frame;
|
||||||
|
GtkWidget* toolbook;
|
||||||
GtkWidget* notebook;
|
GtkWidget* notebook;
|
||||||
GSList* group;
|
GSList* group;
|
||||||
GtkMenu* menu;
|
GtkMenu* menu;
|
||||||
|
@ -216,6 +217,13 @@ midori_panel_init (MidoriPanel* panel)
|
||||||
gtk_box_pack_start (GTK_BOX (vbox), labelbar, FALSE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (vbox), labelbar, FALSE, FALSE, 0);
|
||||||
gtk_widget_show_all (vbox);
|
gtk_widget_show_all (vbox);
|
||||||
|
|
||||||
|
// Create the toolbook
|
||||||
|
priv->toolbook = gtk_notebook_new ();
|
||||||
|
gtk_notebook_set_show_border (GTK_NOTEBOOK (priv->toolbook), FALSE);
|
||||||
|
gtk_notebook_set_show_tabs (GTK_NOTEBOOK (priv->toolbook), FALSE);
|
||||||
|
gtk_box_pack_start (GTK_BOX (vbox), priv->toolbook, FALSE, FALSE, 0);
|
||||||
|
gtk_widget_show (priv->toolbook);
|
||||||
|
|
||||||
// Create the notebook
|
// Create the notebook
|
||||||
priv->notebook = gtk_notebook_new ();
|
priv->notebook = gtk_notebook_new ();
|
||||||
gtk_notebook_set_show_border (GTK_NOTEBOOK (priv->notebook), FALSE);
|
gtk_notebook_set_show_border (GTK_NOTEBOOK (priv->notebook), FALSE);
|
||||||
|
@ -325,10 +333,12 @@ midori_panel_menu_item_activate_cb (GtkWidget* widget,
|
||||||
* midori_panel_append_page:
|
* midori_panel_append_page:
|
||||||
* @panel: a #MidoriPanel
|
* @panel: a #MidoriPanel
|
||||||
* @child: the child widget
|
* @child: the child widget
|
||||||
|
* @toolbar: a toolbar widget, or %NULL
|
||||||
* @icon: a stock ID or icon name, or %NULL
|
* @icon: a stock ID or icon name, or %NULL
|
||||||
* @label: a string to use as the label, or %NULL
|
* @label: a string to use as the label, or %NULL
|
||||||
*
|
*
|
||||||
* Appends a new page to the panel.
|
* Appends a new page to the panel. If @toolbar is specified it will
|
||||||
|
* be packaged above @child.
|
||||||
*
|
*
|
||||||
* If @icon is an icon name, the according image is used as an
|
* If @icon is an icon name, the according image is used as an
|
||||||
* icon for this page.
|
* icon for this page.
|
||||||
|
@ -342,11 +352,13 @@ midori_panel_menu_item_activate_cb (GtkWidget* widget,
|
||||||
gint
|
gint
|
||||||
midori_panel_append_page (MidoriPanel* panel,
|
midori_panel_append_page (MidoriPanel* panel,
|
||||||
GtkWidget* child,
|
GtkWidget* child,
|
||||||
|
GtkWidget* toolbar,
|
||||||
const gchar* icon,
|
const gchar* icon,
|
||||||
const gchar* label)
|
const gchar* label)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (MIDORI_IS_PANEL (panel), -1);
|
g_return_val_if_fail (MIDORI_IS_PANEL (panel), -1);
|
||||||
g_return_val_if_fail (GTK_IS_WIDGET (child), -1);
|
g_return_val_if_fail (GTK_IS_WIDGET (child), -1);
|
||||||
|
g_return_val_if_fail (!toolbar || GTK_IS_WIDGET (toolbar), -1);
|
||||||
|
|
||||||
MidoriPanelPrivate* priv = panel->priv;
|
MidoriPanelPrivate* priv = panel->priv;
|
||||||
|
|
||||||
|
@ -369,6 +381,11 @@ midori_panel_append_page (MidoriPanel* panel,
|
||||||
gtk_container_add (GTK_CONTAINER (scrolled), widget);
|
gtk_container_add (GTK_CONTAINER (scrolled), widget);
|
||||||
gtk_container_add (GTK_CONTAINER (priv->notebook), scrolled);
|
gtk_container_add (GTK_CONTAINER (priv->notebook), scrolled);
|
||||||
|
|
||||||
|
if (!toolbar)
|
||||||
|
toolbar = gtk_event_box_new ();
|
||||||
|
gtk_widget_show (toolbar);
|
||||||
|
gtk_container_add (GTK_CONTAINER (priv->toolbook), toolbar);
|
||||||
|
|
||||||
guint n = midori_panel_page_num (panel, child);
|
guint n = midori_panel_page_num (panel, child);
|
||||||
|
|
||||||
const gchar* text = label ? label : _("Untitled");
|
const gchar* text = label ? label : _("Untitled");
|
||||||
|
@ -533,6 +550,7 @@ midori_panel_set_current_page (MidoriPanel* panel,
|
||||||
|
|
||||||
MidoriPanelPrivate* priv = panel->priv;
|
MidoriPanelPrivate* priv = panel->priv;
|
||||||
|
|
||||||
|
gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->toolbook), n);
|
||||||
gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->notebook), n);
|
gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->notebook), n);
|
||||||
GtkWidget* child = midori_panel_get_nth_page (panel, n);
|
GtkWidget* child = midori_panel_get_nth_page (panel, n);
|
||||||
if (child)
|
if (child)
|
||||||
|
|
|
@ -64,6 +64,7 @@ midori_panel_new (void);
|
||||||
gint
|
gint
|
||||||
midori_panel_append_page (MidoriPanel* panel,
|
midori_panel_append_page (MidoriPanel* panel,
|
||||||
GtkWidget* child,
|
GtkWidget* child,
|
||||||
|
GtkWidget* toolbar,
|
||||||
const gchar* icon,
|
const gchar* icon,
|
||||||
const gchar* label);
|
const gchar* label);
|
||||||
|
|
||||||
|
|
|
@ -570,7 +570,7 @@ midori_web_view_settings_notify (MidoriWebSettings* web_settings,
|
||||||
priv->middle_click_opens_selection = g_value_get_boolean (&value);
|
priv->middle_click_opens_selection = g_value_get_boolean (&value);
|
||||||
else if (!g_object_class_find_property (G_OBJECT_GET_CLASS (web_settings),
|
else if (!g_object_class_find_property (G_OBJECT_GET_CLASS (web_settings),
|
||||||
name))
|
name))
|
||||||
g_warning("Unexpected setting '%s'", name);
|
g_warning (_("Unexpected setting '%s'"), name);
|
||||||
g_value_unset (&value);
|
g_value_unset (&value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1036,7 +1036,7 @@ midori_web_view_get_progress (MidoriWebView* web_view)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* midori_web_view_get_uri:
|
* midori_web_view_get_display_uri:
|
||||||
* @web_view: a #MidoriWebView
|
* @web_view: a #MidoriWebView
|
||||||
*
|
*
|
||||||
* Retrieves a string that is suitable for displaying, particularly an
|
* Retrieves a string that is suitable for displaying, particularly an
|
||||||
|
|
Loading…
Reference in a new issue