theme switcher
This commit is contained in:
parent
5a74722c39
commit
d61c4b0b7f
5 changed files with 19 additions and 105 deletions
|
@ -33,6 +33,14 @@
|
||||||
</screenshot>
|
</screenshot>
|
||||||
</screenshots>
|
</screenshots>
|
||||||
<releases>
|
<releases>
|
||||||
|
<release version="1.0.3" date="2018-11-15">
|
||||||
|
<description>
|
||||||
|
<p>New:</p>
|
||||||
|
<ul>
|
||||||
|
<li>Theme switcher</li>
|
||||||
|
</ul>
|
||||||
|
</description>
|
||||||
|
</release>
|
||||||
<release version="1.0.2" date="2018-11-02">
|
<release version="1.0.2" date="2018-11-02">
|
||||||
<description>
|
<description>
|
||||||
<p>New:</p>
|
<p>New:</p>
|
||||||
|
|
|
@ -4,6 +4,5 @@ src/Widgets/Views/Editor.vala
|
||||||
src/Widgets/Browser.vala
|
src/Widgets/Browser.vala
|
||||||
src/Windows/WebApp.vala
|
src/Windows/WebApp.vala
|
||||||
src/Objects/DesktopFile.vala
|
src/Objects/DesktopFile.vala
|
||||||
src/Dialogs/Preferences.vala
|
|
||||||
src/Services/DesktopFilesManager.vala
|
src/Services/DesktopFilesManager.vala
|
||||||
src/MainWindow.vala
|
src/MainWindow.vala
|
|
@ -1,77 +0,0 @@
|
||||||
/*-
|
|
||||||
* Copyright (c) 2017 Artem Anufrij <artem.anufrij@live.de>
|
|
||||||
*
|
|
||||||
* This program 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 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
* The Noise authors hereby grant permission for non-GPL compatible
|
|
||||||
* GStreamer plugins to be used and distributed together with GStreamer
|
|
||||||
* and Noise. This permission is above and beyond the permissions granted
|
|
||||||
* by the GPL license by which Noise is covered. If you modify this code
|
|
||||||
* you may extend this exception to your version of the code, but you are not
|
|
||||||
* obligated to do so. If you do not wish to do so, delete this exception
|
|
||||||
* statement from your version.
|
|
||||||
*
|
|
||||||
* Authored by: Artem Anufrij <artem.anufrij@live.de>
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Webpin.Dialogs {
|
|
||||||
public class Preferences : Gtk.Dialog {
|
|
||||||
Webpin.Settings settings;
|
|
||||||
|
|
||||||
construct {
|
|
||||||
settings = Webpin.Settings.get_default ();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Preferences (Gtk.Window parent) {
|
|
||||||
Object (
|
|
||||||
transient_for: parent
|
|
||||||
);
|
|
||||||
build_ui ();
|
|
||||||
|
|
||||||
this.response.connect ((source, response_id) => {
|
|
||||||
switch (response_id) {
|
|
||||||
case Gtk.ResponseType.CLOSE:
|
|
||||||
destroy ();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private void build_ui () {
|
|
||||||
this.resizable = false;
|
|
||||||
var content = get_content_area () as Gtk.Box;
|
|
||||||
|
|
||||||
var grid = new Gtk.Grid ();
|
|
||||||
grid.column_spacing = 12;
|
|
||||||
grid.row_spacing = 12;
|
|
||||||
grid.margin = 12;
|
|
||||||
|
|
||||||
var use_dark_theme_label = new Gtk.Label (_("Use Dark Theme"));
|
|
||||||
use_dark_theme_label.halign = Gtk.Align.START;
|
|
||||||
var use_dark_theme = new Gtk.Switch ();
|
|
||||||
use_dark_theme.active = settings.use_dark_theme;
|
|
||||||
use_dark_theme.notify["active"].connect (() => {
|
|
||||||
settings.use_dark_theme = use_dark_theme.active;
|
|
||||||
});
|
|
||||||
|
|
||||||
grid.attach (use_dark_theme_label, 0, 0);
|
|
||||||
grid.attach (use_dark_theme, 1, 0);
|
|
||||||
|
|
||||||
content.pack_start (grid, false, false, 0);
|
|
||||||
|
|
||||||
this.add_button (_("_Close"), Gtk.ResponseType.CLOSE);
|
|
||||||
this.show_all ();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -34,7 +34,6 @@ namespace Webpin {
|
||||||
Gtk.HeaderBar headerbar;
|
Gtk.HeaderBar headerbar;
|
||||||
Gtk.Button back_button;
|
Gtk.Button back_button;
|
||||||
Gtk.Button add_button;
|
Gtk.Button add_button;
|
||||||
Gtk.MenuButton app_menu;
|
|
||||||
|
|
||||||
Widgets.Views.Editor editor;
|
Widgets.Views.Editor editor;
|
||||||
Widgets.Views.WebItemsView web_items_view;
|
Widgets.Views.WebItemsView web_items_view;
|
||||||
|
@ -43,11 +42,6 @@ namespace Webpin {
|
||||||
settings = Settings.get_default ();
|
settings = Settings.get_default ();
|
||||||
settings.notify["use-dark-theme"].connect (() => {
|
settings.notify["use-dark-theme"].connect (() => {
|
||||||
Gtk.Settings.get_default ().gtk_application_prefer_dark_theme = settings.use_dark_theme;
|
Gtk.Settings.get_default ().gtk_application_prefer_dark_theme = settings.use_dark_theme;
|
||||||
if (settings.use_dark_theme) {
|
|
||||||
app_menu.set_image (new Gtk.Image.from_icon_name ("open-menu-symbolic", Gtk.IconSize.LARGE_TOOLBAR));
|
|
||||||
} else {
|
|
||||||
app_menu.set_image (new Gtk.Image.from_icon_name ("open-menu", Gtk.IconSize.LARGE_TOOLBAR));
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,26 +69,7 @@ namespace Webpin {
|
||||||
add_button.tooltip_text = _("Add a new Web App");
|
add_button.tooltip_text = _("Add a new Web App");
|
||||||
headerbar.pack_start (add_button);
|
headerbar.pack_start (add_button);
|
||||||
|
|
||||||
// SETTINGS MENU
|
header_build_style_switcher ();
|
||||||
app_menu = new Gtk.MenuButton ();
|
|
||||||
if (settings.use_dark_theme) {
|
|
||||||
app_menu.set_image (new Gtk.Image.from_icon_name ("open-menu-symbolic", Gtk.IconSize.LARGE_TOOLBAR));
|
|
||||||
} else {
|
|
||||||
app_menu.set_image (new Gtk.Image.from_icon_name ("open-menu", Gtk.IconSize.LARGE_TOOLBAR));
|
|
||||||
}
|
|
||||||
|
|
||||||
var settings_menu = new Gtk.Menu ();
|
|
||||||
var menu_item_preferences = new Gtk.MenuItem.with_label (_("Preferences"));
|
|
||||||
menu_item_preferences.activate.connect (() => {
|
|
||||||
var preferences = new Dialogs.Preferences (this);
|
|
||||||
preferences.run ();
|
|
||||||
});
|
|
||||||
|
|
||||||
settings_menu.append (menu_item_preferences);
|
|
||||||
settings_menu.show_all ();
|
|
||||||
|
|
||||||
app_menu.popup = settings_menu;
|
|
||||||
headerbar.pack_end (app_menu);
|
|
||||||
|
|
||||||
var welcome = new Granite.Widgets.Welcome (_("No Web Apps Available"), _("Manage your web apps."));
|
var welcome = new Granite.Widgets.Welcome (_("No Web Apps Available"), _("Manage your web apps."));
|
||||||
welcome.append ("document-new", _("Create App"), _("Create a new web app with Webpin"));
|
welcome.append ("document-new", _("Create App"), _("Create a new web app with Webpin"));
|
||||||
|
@ -171,6 +146,16 @@ namespace Webpin {
|
||||||
this.present ();
|
this.present ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void header_build_style_switcher () {
|
||||||
|
var mode_switch = new Granite.ModeSwitch.from_icon_name ("display-brightness-symbolic", "weather-clear-night-symbolic");
|
||||||
|
mode_switch.valign = Gtk.Align.CENTER;
|
||||||
|
mode_switch.active = settings.use_dark_theme;
|
||||||
|
mode_switch.notify["active"].connect (() => {
|
||||||
|
settings.use_dark_theme = mode_switch.active;
|
||||||
|
});
|
||||||
|
headerbar.pack_end (mode_switch);
|
||||||
|
}
|
||||||
|
|
||||||
public void show_assistant (DesktopFile? desktop_file = null) {
|
public void show_assistant (DesktopFile? desktop_file = null) {
|
||||||
stack.set_transition_type (Gtk.StackTransitionType.SLIDE_LEFT);
|
stack.set_transition_type (Gtk.StackTransitionType.SLIDE_LEFT);
|
||||||
stack.set_visible_child_name("editor");
|
stack.set_visible_child_name("editor");
|
||||||
|
|
|
@ -5,7 +5,6 @@ sources = files(
|
||||||
'Widgets/Browser.vala',
|
'Widgets/Browser.vala',
|
||||||
'Windows/WebApp.vala',
|
'Windows/WebApp.vala',
|
||||||
'Objects/DesktopFile.vala',
|
'Objects/DesktopFile.vala',
|
||||||
'Dialogs/Preferences.vala',
|
|
||||||
'Services/DesktopFilesManager.vala',
|
'Services/DesktopFilesManager.vala',
|
||||||
'Settings.vala',
|
'Settings.vala',
|
||||||
'MainWindow.vala',
|
'MainWindow.vala',
|
||||||
|
|
Loading…
Reference in a new issue