diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/daemon.vala (renamed from src/deamon.vala) | 14 | ||||
| -rw-r--r-- | src/gui/aboutWindow.vala | 2 | ||||
| -rw-r--r-- | src/gui/preferencesWindow.vala | 29 | ||||
| -rw-r--r-- | src/gui/themeList.vala | 1 | ||||
| -rw-r--r-- | src/renderers/centerRenderer.vala | 55 | ||||
| -rw-r--r-- | src/themes/centerLayer.vala | 13 | ||||
| -rw-r--r-- | src/themes/theme.vala | 26 | 
7 files changed, 102 insertions, 38 deletions
| diff --git a/src/deamon.vala b/src/daemon.vala index 5430a09..c5912b3 100644 --- a/src/deamon.vala +++ b/src/daemon.vala @@ -23,7 +23,7 @@ namespace GnomePie {  /// only one instance of Gnome-Pie running.  ///////////////////////////////////////////////////////////////////////// -public class Deamon : GLib.Application { +public class Daemon : GLib.Application {      /////////////////////////////////////////////////////////////////////      /// The current version of Gnome-Pie @@ -49,7 +49,7 @@ public class Deamon : GLib.Application {      /////////////////////////////////////////////////////////////////////      public static int main(string[] args) { -        version = "0.6.7"; +        version = "0.6.8";          // disable overlay scrollbar --- hacky workaround for black /          // transparent background @@ -59,8 +59,8 @@ public class Deamon : GLib.Application {          Gtk.init(ref args);          Paths.init(); -        // create the Deamon and run it -        var deamon = new GnomePie.Deamon(); +        // create the Daemon and run it +        var deamon = new GnomePie.Daemon();          deamon.run(args);          return 0; @@ -106,11 +106,11 @@ public class Deamon : GLib.Application {      };      ///////////////////////////////////////////////////////////////////// -    /// C'tor of the Deamon. It checks whether it's the first running +    /// C'tor of the Daemon. It checks whether it's the first running      /// instance of Gnome-Pie.      ///////////////////////////////////////////////////////////////////// -    public Deamon() { +    public Daemon() {          Object(application_id: "org.gnome.gnomepie",                 flags: GLib.ApplicationFlags.HANDLES_COMMAND_LINE); @@ -133,6 +133,7 @@ public class Deamon : GLib.Application {              if (open_pie != null && open_pie != "") {                  PieManager.open_pie(open_pie); +                open_pie = "";              }              // finished loading... so run the prog! @@ -247,6 +248,7 @@ public class Deamon : GLib.Application {          if (called_from_remote) {              if (open_pie != null && open_pie != "") {                  PieManager.open_pie(open_pie); +                open_pie = "";              } else {                  this.indicator.show_preferences();              } 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); @@ -463,6 +465,27 @@ public class PreferencesWindow : GLib.Object {      }      ///////////////////////////////////////////////////////////////////// +    /// 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 {                                              + "</i></span>");              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 <center_layer> 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 <center_layer> element!");                             break; | 
