From f8726defb71d6b1777a38887524adc99638f0d09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Wed, 4 Nov 2015 08:56:33 +0100 Subject: Imported Upstream version 0.6.8 --- resources/themes/simple_clock/gloss.svg | 230 +++++ resources/themes/simple_clock/hour.svg | 183 ++++ resources/themes/simple_clock/icon.svg | 412 +++++++++ resources/themes/simple_clock/icon_gloss.svg | 231 ++++++ resources/themes/simple_clock/icon_mask.svg | 215 +++++ .../themes/simple_clock/icon_mask_caption.svg | 239 ++++++ resources/themes/simple_clock/minute.svg | 183 ++++ resources/themes/simple_clock/preview.png | Bin 0 -> 1866 bytes resources/themes/simple_clock/ring.svg | 923 +++++++++++++++++++++ resources/themes/simple_clock/second.svg | 207 +++++ resources/themes/simple_clock/theme.xml | 42 + resources/themes/space_clock/center.svg | 278 +++++++ resources/themes/space_clock/hour.svg | 182 ++++ resources/themes/space_clock/icon.svg | 245 ++++++ resources/themes/space_clock/icon_highlight.svg | 248 ++++++ resources/themes/space_clock/icon_mask.svg | 218 +++++ resources/themes/space_clock/icon_mask_caption.svg | 239 ++++++ resources/themes/space_clock/minute.svg | 182 ++++ resources/themes/space_clock/pointer.svg | 207 +++++ resources/themes/space_clock/preview.png | Bin 0 -> 1490 bytes resources/themes/space_clock/second.svg | 188 +++++ resources/themes/space_clock/theme.xml | 39 + resources/ui/preferences.ui | 111 ++- src/daemon.vala | 262 ++++++ src/deamon.vala | 260 ------ src/gui/aboutWindow.vala | 2 +- src/gui/preferencesWindow.vala | 29 +- src/gui/themeList.vala | 1 + src/renderers/centerRenderer.vala | 55 +- src/themes/centerLayer.vala | 13 +- src/themes/theme.vala | 26 + 31 files changed, 5353 insertions(+), 297 deletions(-) create mode 100644 resources/themes/simple_clock/gloss.svg create mode 100644 resources/themes/simple_clock/hour.svg create mode 100644 resources/themes/simple_clock/icon.svg create mode 100644 resources/themes/simple_clock/icon_gloss.svg create mode 100644 resources/themes/simple_clock/icon_mask.svg create mode 100644 resources/themes/simple_clock/icon_mask_caption.svg create mode 100644 resources/themes/simple_clock/minute.svg create mode 100644 resources/themes/simple_clock/preview.png create mode 100644 resources/themes/simple_clock/ring.svg create mode 100644 resources/themes/simple_clock/second.svg create mode 100644 resources/themes/simple_clock/theme.xml create mode 100644 resources/themes/space_clock/center.svg create mode 100644 resources/themes/space_clock/hour.svg create mode 100644 resources/themes/space_clock/icon.svg create mode 100644 resources/themes/space_clock/icon_highlight.svg create mode 100644 resources/themes/space_clock/icon_mask.svg create mode 100644 resources/themes/space_clock/icon_mask_caption.svg create mode 100644 resources/themes/space_clock/minute.svg create mode 100644 resources/themes/space_clock/pointer.svg create mode 100644 resources/themes/space_clock/preview.png create mode 100644 resources/themes/space_clock/second.svg create mode 100644 resources/themes/space_clock/theme.xml create mode 100644 src/daemon.vala delete mode 100644 src/deamon.vala diff --git a/resources/themes/simple_clock/gloss.svg b/resources/themes/simple_clock/gloss.svg new file mode 100644 index 0000000..3846431 --- /dev/null +++ b/resources/themes/simple_clock/gloss.svg @@ -0,0 +1,230 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + diff --git a/resources/themes/simple_clock/hour.svg b/resources/themes/simple_clock/hour.svg new file mode 100644 index 0000000..b03a01a --- /dev/null +++ b/resources/themes/simple_clock/hour.svg @@ -0,0 +1,183 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/resources/themes/simple_clock/icon.svg b/resources/themes/simple_clock/icon.svg new file mode 100644 index 0000000..0bd550c --- /dev/null +++ b/resources/themes/simple_clock/icon.svg @@ -0,0 +1,412 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/themes/simple_clock/icon_gloss.svg b/resources/themes/simple_clock/icon_gloss.svg new file mode 100644 index 0000000..91af759 --- /dev/null +++ b/resources/themes/simple_clock/icon_gloss.svg @@ -0,0 +1,231 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + diff --git a/resources/themes/simple_clock/icon_mask.svg b/resources/themes/simple_clock/icon_mask.svg new file mode 100644 index 0000000..08e50e7 --- /dev/null +++ b/resources/themes/simple_clock/icon_mask.svg @@ -0,0 +1,215 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/resources/themes/simple_clock/icon_mask_caption.svg b/resources/themes/simple_clock/icon_mask_caption.svg new file mode 100644 index 0000000..7747979 --- /dev/null +++ b/resources/themes/simple_clock/icon_mask_caption.svg @@ -0,0 +1,239 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/resources/themes/simple_clock/minute.svg b/resources/themes/simple_clock/minute.svg new file mode 100644 index 0000000..6cb2076 --- /dev/null +++ b/resources/themes/simple_clock/minute.svg @@ -0,0 +1,183 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/resources/themes/simple_clock/preview.png b/resources/themes/simple_clock/preview.png new file mode 100644 index 0000000..60c8f98 Binary files /dev/null and b/resources/themes/simple_clock/preview.png differ diff --git a/resources/themes/simple_clock/ring.svg b/resources/themes/simple_clock/ring.svg new file mode 100644 index 0000000..31aa4da --- /dev/null +++ b/resources/themes/simple_clock/ring.svg @@ -0,0 +1,923 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/themes/simple_clock/second.svg b/resources/themes/simple_clock/second.svg new file mode 100644 index 0000000..cab5f54 --- /dev/null +++ b/resources/themes/simple_clock/second.svg @@ -0,0 +1,207 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/resources/themes/simple_clock/theme.xml b/resources/themes/simple_clock/theme.xml new file mode 100644 index 0000000..e271b4b --- /dev/null +++ b/resources/themes/simple_clock/theme.xml @@ -0,0 +1,42 @@ + + + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
+
+ diff --git a/resources/themes/space_clock/center.svg b/resources/themes/space_clock/center.svg new file mode 100644 index 0000000..ed6766b --- /dev/null +++ b/resources/themes/space_clock/center.svg @@ -0,0 +1,278 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/resources/themes/space_clock/hour.svg b/resources/themes/space_clock/hour.svg new file mode 100644 index 0000000..e2e8a19 --- /dev/null +++ b/resources/themes/space_clock/hour.svg @@ -0,0 +1,182 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/resources/themes/space_clock/icon.svg b/resources/themes/space_clock/icon.svg new file mode 100644 index 0000000..577fc54 --- /dev/null +++ b/resources/themes/space_clock/icon.svg @@ -0,0 +1,245 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/resources/themes/space_clock/icon_highlight.svg b/resources/themes/space_clock/icon_highlight.svg new file mode 100644 index 0000000..16019c8 --- /dev/null +++ b/resources/themes/space_clock/icon_highlight.svg @@ -0,0 +1,248 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/resources/themes/space_clock/icon_mask.svg b/resources/themes/space_clock/icon_mask.svg new file mode 100644 index 0000000..790b51f --- /dev/null +++ b/resources/themes/space_clock/icon_mask.svg @@ -0,0 +1,218 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/resources/themes/space_clock/icon_mask_caption.svg b/resources/themes/space_clock/icon_mask_caption.svg new file mode 100644 index 0000000..3267701 --- /dev/null +++ b/resources/themes/space_clock/icon_mask_caption.svg @@ -0,0 +1,239 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/resources/themes/space_clock/minute.svg b/resources/themes/space_clock/minute.svg new file mode 100644 index 0000000..cc87870 --- /dev/null +++ b/resources/themes/space_clock/minute.svg @@ -0,0 +1,182 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/resources/themes/space_clock/pointer.svg b/resources/themes/space_clock/pointer.svg new file mode 100644 index 0000000..76bef59 --- /dev/null +++ b/resources/themes/space_clock/pointer.svg @@ -0,0 +1,207 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/resources/themes/space_clock/preview.png b/resources/themes/space_clock/preview.png new file mode 100644 index 0000000..3bc6be0 Binary files /dev/null and b/resources/themes/space_clock/preview.png differ diff --git a/resources/themes/space_clock/second.svg b/resources/themes/space_clock/second.svg new file mode 100644 index 0000000..e4773dd --- /dev/null +++ b/resources/themes/space_clock/second.svg @@ -0,0 +1,188 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/resources/themes/space_clock/theme.xml b/resources/themes/space_clock/theme.xml new file mode 100644 index 0000000..8e85441 --- /dev/null +++ b/resources/themes/space_clock/theme.xml @@ -0,0 +1,39 @@ + + + + +
+ + + + + +
+ + + + + + + + + + + + + + + + +
+
+ diff --git a/resources/ui/preferences.ui b/resources/ui/preferences.ui index 866836d..8f9eebc 100644 --- a/resources/ui/preferences.ui +++ b/resources/ui/preferences.ui @@ -305,6 +305,7 @@ True False list-add-symbolic + True 1 @@ -315,6 +316,55 @@ 0 + + + True + True + False + Reload all themes. + + + True + False + view-refresh-symbolic + True + 1 + + + + + False + True + 1 + + + + + + + False + False + + + + + True + False + False + + + False + False + + + + + True + False + + + True + False True @@ -326,6 +376,7 @@ True False list-remove-symbolic + True 1 @@ -333,7 +384,7 @@ False True - 1 + 0 @@ -343,10 +394,11 @@ False Export the selected theme for sharing. - + True False document-save-as-symbolic + True 1 @@ -354,7 +406,7 @@ False True - 2 + 1 @@ -366,7 +418,56 @@ - + + True + False + False + + + False + False + + + + + True + False + + + True + False + + + True + True + False + Open the theme's files in your file browser. + + + True + False + document-open-symbolic + True + 1 + + + + + False + True + 0 + + + + + + + False + False + + + + True False False @@ -394,7 +495,7 @@ True False - help + help-info-symbolic 1 diff --git a/src/daemon.vala b/src/daemon.vala new file mode 100644 index 0000000..c5912b3 --- /dev/null +++ b/src/daemon.vala @@ -0,0 +1,262 @@ +///////////////////////////////////////////////////////////////////////// +// Copyright (c) 2011-2015 by Simon Schneegans +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 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 +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +///////////////////////////////////////////////////////////////////////// + +namespace GnomePie { + +///////////////////////////////////////////////////////////////////////// +/// This class runs in the background. It has an Indicator sitting in the +/// user's panel. It initializes everything and guarantees that there is +/// only one instance of Gnome-Pie running. +///////////////////////////////////////////////////////////////////////// + +public class Daemon : GLib.Application { + + ///////////////////////////////////////////////////////////////////// + /// The current version of Gnome-Pie + ///////////////////////////////////////////////////////////////////// + + public static string version; + + ///////////////////////////////////////////////////////////////////// + /// Varaibles set by the commend line parser. + ///////////////////////////////////////////////////////////////////// + + public static bool disable_header_bar = false; + public static bool disable_stack_switcher = false; + + + ///////////////////////////////////////////////////////////////////// + /// true if init_pies() has been called already + ///////////////////////////////////////////////////////////////////// + private bool initialized = false; + + ///////////////////////////////////////////////////////////////////// + /// The beginning of everything. + ///////////////////////////////////////////////////////////////////// + + public static int main(string[] args) { + version = "0.6.8"; + + // disable overlay scrollbar --- hacky workaround for black / + // transparent background + GLib.Environment.set_variable("LIBOVERLAY_SCROLLBAR", "0", true); + + Logger.init(); + Gtk.init(ref args); + Paths.init(); + + // create the Daemon and run it + var deamon = new GnomePie.Daemon(); + deamon.run(args); + + return 0; + } + + ///////////////////////////////////////////////////////////////////// + /// The AppIndicator of Gnome-Pie. + ///////////////////////////////////////////////////////////////////// + + private Indicator indicator = null; + + ///////////////////////////////////////////////////////////////////// + /// Varaibles set by the commend line parser. + ///////////////////////////////////////////////////////////////////// + + private static string open_pie = null; + private static bool reset = false; + private static bool print_ids = false; + + private static bool handled_local_args = false; + + ///////////////////////////////////////////////////////////////////// + /// Available command line options. + ///////////////////////////////////////////////////////////////////// + + private const GLib.OptionEntry[] options = { + { "open", 'o', 0, GLib.OptionArg.STRING, + out open_pie, + "Open the Pie with the given ID", "ID" }, + { "reset", 'r', 0, GLib.OptionArg.NONE, + out reset, + "Reset all options to default values" }, + { "no-header-bar", 'b', 0, GLib.OptionArg.NONE, + out disable_header_bar, + "Disables the usage of GTK.HeaderBar" }, + { "no-stack-switcher", 's', 0, GLib.OptionArg.NONE, + out disable_stack_switcher, + "Disables the usage of GTK.StackSwitcher" }, + { "print-ids", 'p', 0, GLib.OptionArg.NONE, + out print_ids, + "Prints all Pie names with their according IDs" }, + { null } + }; + + ///////////////////////////////////////////////////////////////////// + /// C'tor of the Daemon. It checks whether it's the first running + /// instance of Gnome-Pie. + ///////////////////////////////////////////////////////////////////// + + public Daemon() { + Object(application_id: "org.gnome.gnomepie", + flags: GLib.ApplicationFlags.HANDLES_COMMAND_LINE); + + // init locale support + Intl.bindtextdomain("gnomepie", Paths.locales); + Intl.textdomain("gnomepie"); + + // connect SigHandlers + Posix.signal(Posix.SIGINT, sig_handler); + Posix.signal(Posix.SIGTERM, sig_handler); + + this.startup.connect(()=>{ + + message("Welcome to Gnome-Pie " + version + "!"); + + this.init_pies(); + + // launch the indicator + this.indicator = new Indicator(); + + if (open_pie != null && open_pie != "") { + PieManager.open_pie(open_pie); + open_pie = ""; + } + + // finished loading... so run the prog! + message("Started happily..."); + hold(); + }); + } + + ///////////////////////////////////////////////////////////////////// + /// Call handle_command_line on program launch. + ///////////////////////////////////////////////////////////////////// + + protected override bool local_command_line( + ref unowned string[] args, out int exit_status) { + + exit_status = 0; + + // copy command line + string*[] _args = new string[args.length]; + for (int i = 0; i < args.length; i++) { + _args[i] = args[i]; + } + return handle_command_line(_args, false); + } + + ///////////////////////////////////////////////////////////////////// + /// Call handle_command_line when a remote instance was launched. + ///////////////////////////////////////////////////////////////////// + + protected override int command_line(GLib.ApplicationCommandLine cmd) { + if (handled_local_args) { + string[] tmp = cmd.get_arguments(); + unowned string[] remote_args = tmp; + handle_command_line(remote_args, true); + } + handled_local_args = true; + return 0; + } + + ///////////////////////////////////////////////////////////////////// + /// Print a nifty message when the prog is killed. + ///////////////////////////////////////////////////////////////////// + + private static void sig_handler(int sig) { + stdout.printf("\n"); + message("Caught signal (%d), bye!".printf(sig)); + GLib.Application.get_default().release(); + } + + ///////////////////////////////////////////////////////////////////// + /// Print a nifty message when the prog is killed. + ///////////////////////////////////////////////////////////////////// + + private void init_pies() { + if (!this.initialized) { + + // init static stuff + ActionRegistry.init(); + GroupRegistry.init(); + + // load all pies + PieManager.init(); + + // initialize icon cache + Icon.init(); + + this.initialized = true; + } + } + + ///////////////////////////////////////////////////////////////////// + /// Handles command line parameters. + ///////////////////////////////////////////////////////////////////// + + private bool handle_command_line(string[] args, bool called_from_remote) { + + var context = new GLib.OptionContext(" - Launches the pie menu for linux."); + context.add_main_entries(options, null); + context.add_group(Gtk.get_option_group(false)); + + try { + context.parse(ref args); + } catch(GLib.OptionError error) { + warning(error.message); + message("Run '%s' to launch Gnome-Pie or run '%s --help' to" + + " see a full list of available command line options.\n", + args[0], args[0]); + } + + if (reset) { + if (GLib.FileUtils.remove(Paths.pie_config) == 0) { + message("Removed file \"%s\"", Paths.pie_config); + } + if (GLib.FileUtils.remove(Paths.settings) == 0) { + message("Removed file \"%s\"", Paths.settings); + } + + // do not notify the already running instance (if any) + return true; + } + + if (print_ids) { + this.init_pies(); + PieManager.print_ids(); + print_ids = false; + + // do not notify the already running instance (if any) + return true; + } + + + if (called_from_remote) { + if (open_pie != null && open_pie != "") { + PieManager.open_pie(open_pie); + open_pie = ""; + } else { + this.indicator.show_preferences(); + } + } + + // notify the already running instance (if any) + return false; + } +} + +} diff --git a/src/deamon.vala b/src/deamon.vala deleted file mode 100644 index 5430a09..0000000 --- a/src/deamon.vala +++ /dev/null @@ -1,260 +0,0 @@ -///////////////////////////////////////////////////////////////////////// -// Copyright (c) 2011-2015 by Simon Schneegans -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 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 -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -///////////////////////////////////////////////////////////////////////// - -namespace GnomePie { - -///////////////////////////////////////////////////////////////////////// -/// This class runs in the background. It has an Indicator sitting in the -/// user's panel. It initializes everything and guarantees that there is -/// only one instance of Gnome-Pie running. -///////////////////////////////////////////////////////////////////////// - -public class Deamon : GLib.Application { - - ///////////////////////////////////////////////////////////////////// - /// The current version of Gnome-Pie - ///////////////////////////////////////////////////////////////////// - - public static string version; - - ///////////////////////////////////////////////////////////////////// - /// Varaibles set by the commend line parser. - ///////////////////////////////////////////////////////////////////// - - public static bool disable_header_bar = false; - public static bool disable_stack_switcher = false; - - - ///////////////////////////////////////////////////////////////////// - /// true if init_pies() has been called already - ///////////////////////////////////////////////////////////////////// - private bool initialized = false; - - ///////////////////////////////////////////////////////////////////// - /// The beginning of everything. - ///////////////////////////////////////////////////////////////////// - - public static int main(string[] args) { - version = "0.6.7"; - - // disable overlay scrollbar --- hacky workaround for black / - // transparent background - GLib.Environment.set_variable("LIBOVERLAY_SCROLLBAR", "0", true); - - Logger.init(); - Gtk.init(ref args); - Paths.init(); - - // create the Deamon and run it - var deamon = new GnomePie.Deamon(); - deamon.run(args); - - return 0; - } - - ///////////////////////////////////////////////////////////////////// - /// The AppIndicator of Gnome-Pie. - ///////////////////////////////////////////////////////////////////// - - private Indicator indicator = null; - - ///////////////////////////////////////////////////////////////////// - /// Varaibles set by the commend line parser. - ///////////////////////////////////////////////////////////////////// - - private static string open_pie = null; - private static bool reset = false; - private static bool print_ids = false; - - private static bool handled_local_args = false; - - ///////////////////////////////////////////////////////////////////// - /// Available command line options. - ///////////////////////////////////////////////////////////////////// - - private const GLib.OptionEntry[] options = { - { "open", 'o', 0, GLib.OptionArg.STRING, - out open_pie, - "Open the Pie with the given ID", "ID" }, - { "reset", 'r', 0, GLib.OptionArg.NONE, - out reset, - "Reset all options to default values" }, - { "no-header-bar", 'b', 0, GLib.OptionArg.NONE, - out disable_header_bar, - "Disables the usage of GTK.HeaderBar" }, - { "no-stack-switcher", 's', 0, GLib.OptionArg.NONE, - out disable_stack_switcher, - "Disables the usage of GTK.StackSwitcher" }, - { "print-ids", 'p', 0, GLib.OptionArg.NONE, - out print_ids, - "Prints all Pie names with their according IDs" }, - { null } - }; - - ///////////////////////////////////////////////////////////////////// - /// C'tor of the Deamon. It checks whether it's the first running - /// instance of Gnome-Pie. - ///////////////////////////////////////////////////////////////////// - - public Deamon() { - Object(application_id: "org.gnome.gnomepie", - flags: GLib.ApplicationFlags.HANDLES_COMMAND_LINE); - - // init locale support - Intl.bindtextdomain("gnomepie", Paths.locales); - Intl.textdomain("gnomepie"); - - // connect SigHandlers - Posix.signal(Posix.SIGINT, sig_handler); - Posix.signal(Posix.SIGTERM, sig_handler); - - this.startup.connect(()=>{ - - message("Welcome to Gnome-Pie " + version + "!"); - - this.init_pies(); - - // launch the indicator - this.indicator = new Indicator(); - - if (open_pie != null && open_pie != "") { - PieManager.open_pie(open_pie); - } - - // finished loading... so run the prog! - message("Started happily..."); - hold(); - }); - } - - ///////////////////////////////////////////////////////////////////// - /// Call handle_command_line on program launch. - ///////////////////////////////////////////////////////////////////// - - protected override bool local_command_line( - ref unowned string[] args, out int exit_status) { - - exit_status = 0; - - // copy command line - string*[] _args = new string[args.length]; - for (int i = 0; i < args.length; i++) { - _args[i] = args[i]; - } - return handle_command_line(_args, false); - } - - ///////////////////////////////////////////////////////////////////// - /// Call handle_command_line when a remote instance was launched. - ///////////////////////////////////////////////////////////////////// - - protected override int command_line(GLib.ApplicationCommandLine cmd) { - if (handled_local_args) { - string[] tmp = cmd.get_arguments(); - unowned string[] remote_args = tmp; - handle_command_line(remote_args, true); - } - handled_local_args = true; - return 0; - } - - ///////////////////////////////////////////////////////////////////// - /// Print a nifty message when the prog is killed. - ///////////////////////////////////////////////////////////////////// - - private static void sig_handler(int sig) { - stdout.printf("\n"); - message("Caught signal (%d), bye!".printf(sig)); - GLib.Application.get_default().release(); - } - - ///////////////////////////////////////////////////////////////////// - /// Print a nifty message when the prog is killed. - ///////////////////////////////////////////////////////////////////// - - private void init_pies() { - if (!this.initialized) { - - // init static stuff - ActionRegistry.init(); - GroupRegistry.init(); - - // load all pies - PieManager.init(); - - // initialize icon cache - Icon.init(); - - this.initialized = true; - } - } - - ///////////////////////////////////////////////////////////////////// - /// Handles command line parameters. - ///////////////////////////////////////////////////////////////////// - - private bool handle_command_line(string[] args, bool called_from_remote) { - - var context = new GLib.OptionContext(" - Launches the pie menu for linux."); - context.add_main_entries(options, null); - context.add_group(Gtk.get_option_group(false)); - - try { - context.parse(ref args); - } catch(GLib.OptionError error) { - warning(error.message); - message("Run '%s' to launch Gnome-Pie or run '%s --help' to" + - " see a full list of available command line options.\n", - args[0], args[0]); - } - - if (reset) { - if (GLib.FileUtils.remove(Paths.pie_config) == 0) { - message("Removed file \"%s\"", Paths.pie_config); - } - if (GLib.FileUtils.remove(Paths.settings) == 0) { - message("Removed file \"%s\"", Paths.settings); - } - - // do not notify the already running instance (if any) - return true; - } - - if (print_ids) { - this.init_pies(); - PieManager.print_ids(); - print_ids = false; - - // do not notify the already running instance (if any) - return true; - } - - - if (called_from_remote) { - if (open_pie != null && open_pie != "") { - PieManager.open_pie(open_pie); - } else { - this.indicator.show_preferences(); - } - } - - // notify the already running instance (if any) - return false; - } -} - -} diff --git a/src/gui/aboutWindow.vala b/src/gui/aboutWindow.vala index fd38c8c..73fb1be 100644 --- a/src/gui/aboutWindow.vala +++ b/src/gui/aboutWindow.vala @@ -76,7 +76,7 @@ public class AboutWindow: Gtk.AboutDialog { logo_icon_name: "gnome-pie", website: "http://simmesimme.github.io/gnome-pie.html", website_label: "Homepage", - version: Deamon.version + version: Daemon.version ); } } diff --git a/src/gui/preferencesWindow.vala b/src/gui/preferencesWindow.vala index 09d8a3c..fff8168 100644 --- a/src/gui/preferencesWindow.vala +++ b/src/gui/preferencesWindow.vala @@ -72,7 +72,7 @@ public class PreferencesWindow : GLib.Object { Gdk.EventMask.KEY_PRESS_MASK | Gdk.EventMask.POINTER_MOTION_MASK); - if (!Deamon.disable_header_bar) { + if (!Daemon.disable_header_bar) { var headerbar = new Gtk.HeaderBar(); headerbar.show_close_button = true; headerbar.title = _("Gnome-Pie Settings"); @@ -82,7 +82,7 @@ public class PreferencesWindow : GLib.Object { this.notebook = builder.get_object("notebook") as Gtk.Notebook; - if (!Deamon.disable_stack_switcher) { + if (!Daemon.disable_stack_switcher) { var main_box = builder.get_object("main-box") as Gtk.Box; var pie_settings = builder.get_object("pie-settings") as Gtk.Box; var general_settings = builder.get_object("general-settings") as Gtk.Box; @@ -170,6 +170,8 @@ public class PreferencesWindow : GLib.Object { (builder.get_object("theme-export-button") as Gtk.Button).clicked.connect(on_export_theme_button_clicked); (builder.get_object("theme-import-button") as Gtk.Button).clicked.connect(on_import_theme_button_clicked); + (builder.get_object("theme-reload-button") as Gtk.Button).clicked.connect(on_reload_theme_button_clicked); + (builder.get_object("theme-open-button") as Gtk.Button).clicked.connect(on_open_theme_button_clicked); this.theme_delete_button = (builder.get_object("theme-delete-button") as Gtk.Button); this.theme_delete_button.clicked.connect(on_delete_theme_button_clicked); @@ -298,7 +300,7 @@ public class PreferencesWindow : GLib.Object { this.theme_delete_button.sensitive = false; } - if (!Deamon.disable_stack_switcher) { + if (!Daemon.disable_stack_switcher) { this.stack.set_visible_child_full("2", Gtk.StackTransitionType.NONE); } else { this.notebook.set_current_page(1); @@ -462,6 +464,27 @@ public class PreferencesWindow : GLib.Object { dialog.destroy(); } + ///////////////////////////////////////////////////////////////////// + /// Reloads all themes. + ///////////////////////////////////////////////////////////////////// + + private void on_reload_theme_button_clicked(Gtk.Button button) { + Config.global.load_themes(Config.global.theme.name); + this.theme_list.reload(); + } + + ///////////////////////////////////////////////////////////////////// + /// Opens the loaction of the them in the file browser. + ///////////////////////////////////////////////////////////////////// + + private void on_open_theme_button_clicked(Gtk.Button button) { + try{ + GLib.AppInfo.launch_default_for_uri("file://" + Config.global.theme.directory, null); + } catch (Error e) { + warning(e.message); + } + } + ///////////////////////////////////////////////////////////////////// /// Shows or hides the indicator. ///////////////////////////////////////////////////////////////////// diff --git a/src/gui/themeList.vala b/src/gui/themeList.vala index e6ecb3c..786c305 100644 --- a/src/gui/themeList.vala +++ b/src/gui/themeList.vala @@ -109,6 +109,7 @@ class ThemeList : Gtk.TreeView { + ""); if(theme == Config.global.theme) { get_selection().select_iter(current); + this.scroll_to_cell(get_selection().get_selected_rows(null).nth_data(0), null, true, 0.5f, 0.5f); } } } diff --git a/src/renderers/centerRenderer.vala b/src/renderers/centerRenderer.vala index e94714f..c146216 100644 --- a/src/renderers/centerRenderer.vala +++ b/src/renderers/centerRenderer.vala @@ -107,42 +107,50 @@ public class CenterRenderer : GLib.Object { ctx.save(); // calculate all values needed for animation/drawing - double active_speed = (layer.active_rotation_mode == CenterLayer.RotationMode.TO_MOUSE) ? - 0.0 : layer.active_rotation_speed; - double inactive_speed = (layer.inactive_rotation_mode == CenterLayer.RotationMode.TO_MOUSE) ? - 0.0 : layer.inactive_rotation_speed; double max_scale = layer.active_scale*this.activity.val + layer.inactive_scale*(1.0-this.activity.val); double max_alpha = layer.active_alpha*this.activity.val + layer.inactive_alpha*(1.0-this.activity.val); double colorize = ((layer.active_colorize == true) ? this.activity.val : 0.0) + ((layer.inactive_colorize == true) ? 1.0 - this.activity.val : 0.0); - double max_rotation_speed = active_speed*this.activity.val - + inactive_speed*(1.0-this.activity.val); + double max_rotation_speed = layer.active_rotation_speed*this.activity.val + + layer.inactive_rotation_speed*(1.0-this.activity.val); CenterLayer.RotationMode rotation_mode = ((this.activity.val > 0.5) ? layer.active_rotation_mode : layer.inactive_rotation_mode); - if (rotation_mode == CenterLayer.RotationMode.TO_MOUSE) { - double diff = angle-layer.rotation; - max_rotation_speed = layer.active_rotation_speed*this.activity.val - + layer.inactive_rotation_speed*(1.0-this.activity.val); - double smoothy = fabs(diff) < 0.9 ? fabs(diff) + 0.1 : 1.0; - double step = max_rotation_speed*frame_time*smoothy; + double direction = 0; - if (fabs(diff) <= step || fabs(diff) >= 2.0*PI - step) - layer.rotation = angle; - else { - if ((diff > 0 && diff < PI) || diff < -PI) layer.rotation += step; - else layer.rotation -= step; - } + if (rotation_mode == CenterLayer.RotationMode.TO_MOUSE) { + direction = angle; } else if (rotation_mode == CenterLayer.RotationMode.TO_ACTIVE) { - max_rotation_speed *= this.activity.val; - double slice_angle = parent.total_slice_count > 0 ? 2*PI/parent.total_slice_count : 0; - double direction = (int)((angle+0.5*slice_angle) / (slice_angle))*slice_angle; + direction = (int)((angle+0.5*slice_angle) / (slice_angle))*slice_angle; + + } else if (rotation_mode == CenterLayer.RotationMode.TO_SECOND) { + var now = new DateTime.now_local(); + direction = 2*PI*(now.get_second()+60-15)/60; + + } else if (rotation_mode == CenterLayer.RotationMode.TO_MINUTE) { + var now = new DateTime.now_local(); + direction = 2*PI*(now.get_minute()+60-15)/60; + + } else if (rotation_mode == CenterLayer.RotationMode.TO_HOUR_24) { + var now = new DateTime.now_local(); + direction = 2*PI*(now.get_hour()+24-6)/24 + 2*PI*(now.get_minute())/(60*24); + + } else if (rotation_mode == CenterLayer.RotationMode.TO_HOUR_12) { + var now = new DateTime.now_local(); + direction = 2*PI*(now.get_hour()+12-3)/12 + 2*PI*(now.get_minute())/(60*12); + } + + if (rotation_mode == CenterLayer.RotationMode.AUTO) { + layer.rotation += max_rotation_speed*frame_time; + } else { + direction = Math.fmod(direction, 2*PI); double diff = direction-layer.rotation; - double step = max_rotation_speed*frame_time; + double smoothy = fabs(diff) < 0.9 ? fabs(diff) + 0.1 : 1.0; + double step = max_rotation_speed*frame_time*smoothy; if (fabs(diff) <= step || fabs(diff) >= 2.0*PI - step) layer.rotation = direction; @@ -150,8 +158,7 @@ public class CenterRenderer : GLib.Object { if ((diff > 0 && diff < PI) || diff < -PI) layer.rotation += step; else layer.rotation -= step; } - - } else layer.rotation += max_rotation_speed*frame_time; + } layer.rotation = fmod(layer.rotation+2*PI, 2*PI); diff --git a/src/themes/centerLayer.vala b/src/themes/centerLayer.vala index 59f37ed..34d473e 100644 --- a/src/themes/centerLayer.vala +++ b/src/themes/centerLayer.vala @@ -26,12 +26,17 @@ public class CenterLayer : GLib.Object { ///////////////////////////////////////////////////////////////////// /// Possible rotation modes. - /// AUTO: Turns the layer continously. - /// TO_MOUSE: Turns the layer always to the pointer. - /// TO_ACTIVE: Turns the layer to the active slice. + /// AUTO: Turns the layer continously. + /// TO_MOUSE: Turns the layer always to the pointer. + /// TO_ACTIVE: Turns the layer to the active slice. + /// TO_HOUR_12: Turns the layer to the position of the current hour. + /// TO_HOUR_24: Turns the layer to the position of the current hour. + /// TO_MINUTE: Turns the layer to the position of the current minute. + /// TO_SECOND: Turns the layer to the position of the current second. ///////////////////////////////////////////////////////////////////// - public enum RotationMode {AUTO, TO_MOUSE, TO_ACTIVE} + public enum RotationMode {AUTO, TO_MOUSE, TO_ACTIVE, TO_HOUR_12, + TO_HOUR_24, TO_MINUTE, TO_SECOND} ///////////////////////////////////////////////////////////////////// /// Information on the contained image. diff --git a/src/themes/theme.vala b/src/themes/theme.vala index 2e256f9..ccf38c2 100644 --- a/src/themes/theme.vala +++ b/src/themes/theme.vala @@ -424,6 +424,19 @@ public class Theme : GLib.Object { case "turn_to_mouse": active_rotation_mode = CenterLayer.RotationMode.TO_MOUSE; break; + case "turn_to_hour": + case "turn_to_hour_12": + active_rotation_mode = CenterLayer.RotationMode.TO_HOUR_12; + break; + case "turn_to_hour_24": + active_rotation_mode = CenterLayer.RotationMode.TO_HOUR_24; + break; + case "turn_to_minute": + active_rotation_mode = CenterLayer.RotationMode.TO_MINUTE; + break; + case "turn_to_second": + active_rotation_mode = CenterLayer.RotationMode.TO_SECOND; + break; default: warning("Invalid value \"" + attr_content + "\" for attribute \"" + attr_name + "\" in element!"); break; @@ -452,6 +465,19 @@ public class Theme : GLib.Object { case "turn_to_mouse": inactive_rotation_mode = CenterLayer.RotationMode.TO_MOUSE; break; + case "turn_to_hour": + case "turn_to_hour_12": + inactive_rotation_mode = CenterLayer.RotationMode.TO_HOUR_12; + break; + case "turn_to_hour_24": + inactive_rotation_mode = CenterLayer.RotationMode.TO_HOUR_24; + break; + case "turn_to_minute": + inactive_rotation_mode = CenterLayer.RotationMode.TO_MINUTE; + break; + case "turn_to_second": + inactive_rotation_mode = CenterLayer.RotationMode.TO_SECOND; + break; default: warning("Invalid value \"" + attr_content + "\" for attribute \"" + attr_name + "\" in element!"); break; -- cgit v1.2.3