From 5217903da12f3c554dff11d1ed4c5c3bdfb5c9f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20H=C3=A4cker?= Date: Fri, 29 Jul 2016 14:00:37 +0200 Subject: [PATCH] fixed settings dialog; added new dark mode; only show the menu button in ubuntu unity --- data/ui/main-window.ui | 5 +- data/ui/main-window.ui~ | 261 ++++++++++++++++++++++++++++++++ data/ui/settings-dialog.ui | 12 +- data/ui/settings-dialog.ui~ | 157 +++++++++++++++++++ po/gradio.pot | 6 +- src/Widgets/MainWindow.vala | 13 +- src/Widgets/SettingsDialog.vala | 6 +- 7 files changed, 443 insertions(+), 17 deletions(-) create mode 100644 data/ui/main-window.ui~ create mode 100644 data/ui/settings-dialog.ui~ diff --git a/data/ui/main-window.ui b/data/ui/main-window.ui index e39dc4fe..fa712786 100644 --- a/data/ui/main-window.ui +++ b/data/ui/main-window.ui @@ -207,8 +207,6 @@ True True True - center - center @@ -224,7 +222,6 @@ center center 16 - True view-grid-symbolic @@ -237,8 +234,8 @@ True False - 16 True + 16 view-list-symbolic diff --git a/data/ui/main-window.ui~ b/data/ui/main-window.ui~ new file mode 100644 index 00000000..e39dc4fe --- /dev/null +++ b/data/ui/main-window.ui~ @@ -0,0 +1,261 @@ + + + + + + diff --git a/data/ui/settings-dialog.ui b/data/ui/settings-dialog.ui index c449b3af..a6423c15 100644 --- a/data/ui/settings-dialog.ui +++ b/data/ui/settings-dialog.ui @@ -72,9 +72,9 @@ - False - True + True True + True start True @@ -85,7 +85,7 @@ - false + True False end Use dark design: @@ -100,7 +100,7 @@ True False end - Only show playable radio stations: + Hide broken stations: 0 @@ -134,6 +134,7 @@ True True + start 1 @@ -149,5 +150,8 @@ + + + diff --git a/data/ui/settings-dialog.ui~ b/data/ui/settings-dialog.ui~ new file mode 100644 index 00000000..04889e44 --- /dev/null +++ b/data/ui/settings-dialog.ui~ @@ -0,0 +1,157 @@ + + + + + + diff --git a/po/gradio.pot b/po/gradio.pot index 08ad216a..254959aa 100644 --- a/po/gradio.pot +++ b/po/gradio.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2016-07-28 13:59+0200\n" +"POT-Creation-Date: 2016-07-29 13:59+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -25,10 +25,10 @@ msgstr "" msgid "About Gradio" msgstr "" -#: src/Widgets/MainWindow.vala:48 +#: src/Widgets/MainWindow.vala:55 msgid "Library" msgstr "" -#: src/Widgets/MainWindow.vala:49 +#: src/Widgets/MainWindow.vala:56 msgid "Discover" msgstr "" diff --git a/src/Widgets/MainWindow.vala b/src/Widgets/MainWindow.vala index 6f172ed8..43668daa 100644 --- a/src/Widgets/MainWindow.vala +++ b/src/Widgets/MainWindow.vala @@ -40,6 +40,13 @@ namespace Gradio{ this.set_default_size(width, height); this.move(pos_x, pos_y); + var gtk_settings = Gtk.Settings.get_default (); + if (App.settings.get_boolean ("use-dark-design")) { + gtk_settings.gtk_application_prefer_dark_theme = true; + } else { + gtk_settings.gtk_application_prefer_dark_theme = false; + } + player_toolbar = new PlayerToolbar(); player_toolbar.set_visible(false); discover_box = new DiscoverBox(); @@ -52,10 +59,10 @@ namespace Gradio{ var app_menu = builder.get_object ("app-menu") as GLib.MenuModel; MenuButton.set_menu_model(app_menu); - if(GLib.Environment.get_variable("DESKTOP_SESSION") == "gnome") - MenuButton.set_visible (false); - else + if(GLib.Environment.get_variable("DESKTOP_SESSION") == "unity") MenuButton.set_visible (true); + else + MenuButton.set_visible (false); message("Desktop session is: " + GLib.Environment.get_variable("DESKTOP_SESSION")); // Load css diff --git a/src/Widgets/SettingsDialog.vala b/src/Widgets/SettingsDialog.vala index 97363bbb..3afa6cc9 100644 --- a/src/Widgets/SettingsDialog.vala +++ b/src/Widgets/SettingsDialog.vala @@ -21,19 +21,19 @@ namespace Gradio{ OnlyShowWorkingStationsSwitch.notify["active"].connect (() => { if (OnlyShowWorkingStationsSwitch.active) { settings.set_boolean ("only-show-working-stations", true); - gtk_settings.gtk_application_prefer_dark_theme = true; } else { settings.set_boolean ("only-show-working-stations", false); - gtk_settings.gtk_application_prefer_dark_theme = false; } - + }); UseDarkDesignSwitch.notify["active"].connect (() => { if (UseDarkDesignSwitch.active) { settings.set_boolean ("use-dark-design", true); + gtk_settings.gtk_application_prefer_dark_theme = true; } else { settings.set_boolean ("use-dark-design", false); + gtk_settings.gtk_application_prefer_dark_theme = false; } });