diff --git a/core/browser.vala b/core/browser.vala index 9db122f8a..619cb941e 100644 --- a/core/browser.vala +++ b/core/browser.vala @@ -52,7 +52,7 @@ namespace Midori { [GtkChild] Gtk.HeaderBar panelbar; [GtkChild] - Gtk.Stack panel; + public Gtk.Stack panel; [GtkChild] Gtk.ToggleButton panel_toggle; [GtkChild] @@ -68,7 +68,7 @@ namespace Midori { [GtkChild] Navigationbar navigationbar; [GtkChild] - Gtk.Stack tabs; + public Gtk.Stack tabs; [GtkChild] public Gtk.Overlay overlay; [GtkChild] @@ -141,6 +141,7 @@ namespace Midori { // Plug only after the app is connected and everything is setup var extensions = Plugins.get_default ().plug ("browser", this); extensions.extension_added.connect ((info, extension) => ((BrowserActivatable)extension).activate ()); + extensions.extension_removed.connect ((info, extension) => ((BrowserActivatable)extension).deactivate ()); extensions.foreach ((extensions, info, extension) => { extensions.extension_added (info, extension); }); }); @@ -253,7 +254,19 @@ namespace Midori { } // Reveal panel toggle after panels are added - panel.add.connect ((widget) => { panel_toggle.show (); }); + panel.add.connect ((widget) => { + panel_toggle.show (); + var settings = CoreSettings.get_default (); + if (settings.show_panel) { + lookup_action ("panel").change_state (true); + } + }); + panel.remove.connect ((widget) => { + panel_toggle.visible = panel.get_children ().length () > 0; + if (!panel_toggle.visible) { + panel.hide (); + } + }); } void update_decoration_layout () { @@ -309,6 +322,7 @@ namespace Midori { if (panel_toggle.visible) { action.set_state (state); panel.visible = state.get_boolean (); + CoreSettings.get_default ().show_panel = panel.visible; update_decoration_layout (); } } diff --git a/core/settings.vala b/core/settings.vala index 6875a3c21..a60fd85b0 100644 --- a/core/settings.vala +++ b/core/settings.vala @@ -34,6 +34,12 @@ namespace Midori { set_boolean ("extensions", "lib%s.so".printf (plugin), enabled); } + public bool show_panel { get { + return get_boolean ("settings", "show-panel", false); + } set { + set_boolean ("settings", "show-panel", value, false); + } } + public bool enable_spell_checking { get { return get_boolean ("settings", "enable-spell-checking", true); } set { diff --git a/core/switcher.vala b/core/switcher.vala index 4ba504e8f..a1b93eac5 100644 --- a/core/switcher.vala +++ b/core/switcher.vala @@ -13,7 +13,7 @@ namespace Midori { public class Switcher : Gtk.Box { HashTable buttons; public Gtk.Stack? stack { get; set; } - public bool show_close_buttons { get; protected set; } + internal bool show_close_buttons { get; protected set; } construct { buttons = new HashTable (direct_hash, direct_equal); diff --git a/data/gtk3.css b/data/gtk3.css index 1d7de89d7..3815b3320 100644 --- a/data/gtk3.css +++ b/data/gtk3.css @@ -28,6 +28,9 @@ .titlebar .tab:only-child { box-shadow: none; } +.tab image, .tab spinner { + padding: 0 2px; +} .tab button { padding: 0; margin: 0; diff --git a/extensions/tab-panel.plugin.in b/extensions/tab-panel.plugin.in new file mode 100644 index 000000000..8825a8a93 --- /dev/null +++ b/extensions/tab-panel.plugin.in @@ -0,0 +1,6 @@ +[Plugin] +Module=tab-panel +IAge=3 +Icon=view-list-symbolic +_Name=Tab Panel +_Description=Show tabs in a vertical panel diff --git a/extensions/tab-panel.vala b/extensions/tab-panel.vala new file mode 100644 index 000000000..70eb2c4f9 --- /dev/null +++ b/extensions/tab-panel.vala @@ -0,0 +1,34 @@ +/* + Copyright (C) 2008-2018 Christian Dywan + + 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. +*/ + +namespace TabPanel { + public class Frontend : Object, Midori.BrowserActivatable { + public Midori.Browser browser { owned get; set; } + + public void activate () { + var switcher = new Midori.Switcher (); + switcher.stack = browser.tabs; + switcher.orientation = Gtk.Orientation.VERTICAL; + switcher.show (); + browser.panel.add_titled (switcher, "tab-panel", _("Tab Panel")); + browser.panel.child_set (switcher, "icon-name", "view-list-symbolic"); + deactivate.connect (() => { + switcher.destroy (); + }); + } + } +} + +[ModuleInit] +public void peas_register_types(TypeModule module) { + ((Peas.ObjectModule)module).register_extension_type ( + typeof (Midori.BrowserActivatable), typeof (TabPanel.Frontend)); +} diff --git a/po/POTFILES.in b/po/POTFILES.in index de4dfe2ef..badede126 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -28,6 +28,8 @@ extensions/bookmarks.plugin.in extensions/bookmarks.vala extensions/status-clock.plugin.in extensions/status-clock.vala +extensions/tab-panel.plugin.in +extensions/tab-panel.vala ui/bookmarks-button.ui ui/browser.ui ui/clear-private-data.ui diff --git a/ui/tally.ui b/ui/tally.ui index a0ab6ed24..13a3a7c5f 100644 --- a/ui/tally.ui +++ b/ui/tally.ui @@ -7,6 +7,7 @@ horizontal yes + yes @@ -27,6 +28,7 @@ 8 500 + yes yes