summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorJörg Frings-Fürst <jff@merkur>2014-07-23 11:40:08 +0200
committerJörg Frings-Fürst <jff@merkur>2014-07-23 11:40:08 +0200
commit6edfb34cb3eee958e392a433ae9ac4f240279d09 (patch)
treed33f9e9032809dba2ccb1b8c9ccc928507c38cf6 /src/gui
parent1f6f24308e96040962794c5a9ffd81597b5e072a (diff)
Imported Upstream version 0.5.5upstream/0.5.5
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/iconSelectWindow.vala38
-rw-r--r--src/gui/piePreviewDeleteSign.vala14
-rw-r--r--src/gui/piePreviewSliceRenderer.vala36
3 files changed, 44 insertions, 44 deletions
diff --git a/src/gui/iconSelectWindow.vala b/src/gui/iconSelectWindow.vala
index 174c23d..9159f15 100644
--- a/src/gui/iconSelectWindow.vala
+++ b/src/gui/iconSelectWindow.vala
@@ -140,24 +140,24 @@ public class IconSelectWindow : GLib.Object {
try {
this.load_queue = new GLib.AsyncQueue<ListEntry?>();
- if (this.icon_list == null) {
- this.icon_list = new Gtk.ListStore(3, typeof(string), // icon name
+ if (IconSelectWindow.icon_list == null) {
+ IconSelectWindow.icon_list = new Gtk.ListStore(3, typeof(string), // icon name
typeof(IconContext), // icon type
typeof(Gdk.Pixbuf)); // the icon itself
// disable sorting until all icons are loaded
// else loading becomes horribly slow
- this.icon_list.set_default_sort_func(() => {return 0;});
+ IconSelectWindow.icon_list.set_default_sort_func(() => {return 0;});
// reload if icon theme changes
Gtk.IconTheme.get_default().changed.connect(() => {
if (this.window.visible) load_icons();
- else need_reload = true;
+ else IconSelectWindow.need_reload = true;
});
}
// make the icon_view filterable
- this.icon_list_filtered = new Gtk.TreeModelFilter(this.icon_list, null);
+ this.icon_list_filtered = new Gtk.TreeModelFilter(IconSelectWindow.icon_list, null);
Gtk.Builder builder = new Gtk.Builder();
@@ -303,16 +303,16 @@ public class IconSelectWindow : GLib.Object {
this.window.show_all();
this.spinner.hide();
- if (this.need_reload) {
- this.need_reload = false;
+ if (IconSelectWindow.need_reload) {
+ IconSelectWindow.need_reload = false;
this.load_icons();
}
}
public static void clear_icons() {
- if (icon_list != null) {
- need_reload = true;
- icon_list.clear();
+ if (IconSelectWindow.icon_list != null) {
+ IconSelectWindow.need_reload = true;
+ IconSelectWindow.icon_list.clear();
}
}
@@ -366,16 +366,16 @@ public class IconSelectWindow : GLib.Object {
private void load_icons() {
// only if it's not loading currently
- if (!this.loading) {
- this.loading = true;
- this.icon_list.clear();
+ if (!IconSelectWindow.loading) {
+ IconSelectWindow.loading = true;
+ IconSelectWindow.icon_list.clear();
// display the spinner
if (spinner != null)
this.spinner.visible = true;
// disable sorting of the icon_view - else it's horribly slow
- this.icon_list.set_sort_column_id(-1, Gtk.SortType.ASCENDING);
+ IconSelectWindow.icon_list.set_sort_column_id(-1, Gtk.SortType.ASCENDING);
this.load_all.begin();
@@ -384,15 +384,15 @@ public class IconSelectWindow : GLib.Object {
while (this.load_queue.length() > 0) {
var new_entry = this.load_queue.pop();
Gtk.TreeIter current;
- icon_list.append(out current);
- icon_list.set(current, 0, new_entry.name,
+ IconSelectWindow.icon_list.append(out current);
+ IconSelectWindow.icon_list.set(current, 0, new_entry.name,
1, new_entry.context,
2, new_entry.pixbuf);
}
// enable sorting of the icon_view if loading finished
- if (!this.loading) {
- icon_list.set_sort_column_id(0, Gtk.SortType.ASCENDING);
+ if (!IconSelectWindow.loading) {
+ IconSelectWindow.icon_list.set_sort_column_id(0, Gtk.SortType.ASCENDING);
}
return loading;
@@ -449,7 +449,7 @@ public class IconSelectWindow : GLib.Object {
}
// finished loading
- this.loading = false;
+ IconSelectWindow.loading = false;
// hide the spinner
if (spinner != null)
diff --git a/src/gui/piePreviewDeleteSign.vala b/src/gui/piePreviewDeleteSign.vala
index 2ff3321..500d876 100644
--- a/src/gui/piePreviewDeleteSign.vala
+++ b/src/gui/piePreviewDeleteSign.vala
@@ -42,9 +42,9 @@ public class PiePreviewDeleteSign : GLib.Object {
/// Some constants determining the look and behaviour of this Slice.
/////////////////////////////////////////////////////////////////////
- private const int radius = 18;
- private const double globale_scale = 0.8;
- private const double click_cancel_treshold = 5;
+ private static const int radius = 18;
+ private static const double globale_scale = 0.8;
+ private static const double click_cancel_treshold = 5;
/////////////////////////////////////////////////////////////////////
/// True, when the add sign is currently visible.
@@ -85,7 +85,7 @@ public class PiePreviewDeleteSign : GLib.Object {
/////////////////////////////////////////////////////////////////////
public void load() {
- this.icon = new Icon("stock_delete", radius*2);
+ this.icon = new Icon("stock_delete", PiePreviewDeleteSign.radius*2);
}
/////////////////////////////////////////////////////////////////////
@@ -133,7 +133,7 @@ public class PiePreviewDeleteSign : GLib.Object {
// transform the context
double scale = (this.size.val*this.clicked.val
- + this.activity.val*0.2 - 0.2)*globale_scale;
+ + this.activity.val*0.2 - 0.2)*PiePreviewDeleteSign.globale_scale;
ctx.scale(scale, scale);
// paint the image
@@ -150,11 +150,11 @@ public class PiePreviewDeleteSign : GLib.Object {
public bool on_mouse_move(double x, double y) {
if (this.clicked.end == 0.9) {
double dist = GLib.Math.pow(x-this.clicked_x, 2) + GLib.Math.pow(y-this.clicked_y, 2);
- if (dist > this.click_cancel_treshold*this.click_cancel_treshold)
+ if (dist > PiePreviewDeleteSign.click_cancel_treshold*PiePreviewDeleteSign.click_cancel_treshold)
this.clicked.reset_target(1.0, 0.1);
}
- if (GLib.Math.fabs(x) <= radius*globale_scale && GLib.Math.fabs(y) <= radius*globale_scale) {
+ if (GLib.Math.fabs(x) <= PiePreviewDeleteSign.radius*PiePreviewDeleteSign.globale_scale && GLib.Math.fabs(y) <= PiePreviewDeleteSign.radius*PiePreviewDeleteSign.globale_scale) {
this.activity.reset_target(1.0, 0.2);
return true;
}
diff --git a/src/gui/piePreviewSliceRenderer.vala b/src/gui/piePreviewSliceRenderer.vala
index af39c1f..6a12a47 100644
--- a/src/gui/piePreviewSliceRenderer.vala
+++ b/src/gui/piePreviewSliceRenderer.vala
@@ -72,11 +72,11 @@ public class PiePreviewSliceRenderer : GLib.Object {
/// Some constants determining the look and behaviour of this Slice.
/////////////////////////////////////////////////////////////////////
- private const double pie_radius = 126;
- private const double radius = 24;
- private const double delete_x = 13;
- private const double delete_y = -13;
- private const double click_cancel_treshold = 5;
+ private static const double pie_radius = 126;
+ private static const double radius = 24;
+ private static const double delete_x = 13;
+ private static const double delete_y = -13;
+ private static const double click_cancel_treshold = 5;
/////////////////////////////////////////////////////////////////////
/// Storing the position where a mouse click was executed. Useful for
@@ -120,10 +120,10 @@ public class PiePreviewSliceRenderer : GLib.Object {
// if it's a custom ActionGroup
if (group.get_type().depth() == 2 && group.actions.size > 0) {
- this.icon = new Icon(group.actions[0].icon, (int)(radius*2));
+ this.icon = new Icon(group.actions[0].icon, (int)(PiePreviewSliceRenderer.radius*2));
this.name = group.actions[0].name;
} else {
- this.icon = new Icon(GroupRegistry.descriptions[group.get_type().name()].icon, (int)(radius*2));
+ this.icon = new Icon(GroupRegistry.descriptions[group.get_type().name()].icon, (int)(PiePreviewSliceRenderer.radius*2));
this.name = GroupRegistry.descriptions[group.get_type().name()].name;
}
}
@@ -174,7 +174,7 @@ public class PiePreviewSliceRenderer : GLib.Object {
ctx.save();
// transform the context
- ctx.translate(cos(this.angle.val)*pie_radius, sin(this.angle.val)*pie_radius);
+ ctx.translate(cos(this.angle.val)*PiePreviewSliceRenderer.pie_radius, sin(this.angle.val)*PiePreviewSliceRenderer.pie_radius);
double scale = this.size.val*this.clicked.val
+ this.activity.val*0.1 - 0.1;
@@ -187,7 +187,7 @@ public class PiePreviewSliceRenderer : GLib.Object {
ctx.restore();
- ctx.translate(delete_x*this.size.val, delete_y*this.size.val);
+ ctx.translate(PiePreviewSliceRenderer.delete_x*this.size.val, PiePreviewSliceRenderer.delete_y*this.size.val);
this.delete_sign.draw(frame_time, ctx);
ctx.restore();
@@ -216,14 +216,14 @@ public class PiePreviewSliceRenderer : GLib.Object {
if (this.clicked.end == 0.9) {
double dist = GLib.Math.pow(x-this.clicked_x, 2) + GLib.Math.pow(y-this.clicked_y, 2);
- if (dist > this.click_cancel_treshold*this.click_cancel_treshold)
+ if (dist > PiePreviewSliceRenderer.click_cancel_treshold*PiePreviewSliceRenderer.click_cancel_treshold)
this.clicked.reset_target(1.0, 0.1);
}
- double own_x = cos(this.angle.val)*pie_radius;
- double own_y = sin(this.angle.val)*pie_radius;
- this.delete_hovered = this.delete_sign.on_mouse_move(x - own_x - delete_x*this.size.val,
- y - own_y - delete_y*this.size.val);
+ double own_x = cos(this.angle.val)*PiePreviewSliceRenderer.pie_radius;
+ double own_y = sin(this.angle.val)*PiePreviewSliceRenderer.pie_radius;
+ this.delete_hovered = this.delete_sign.on_mouse_move(x - own_x - PiePreviewSliceRenderer.delete_x*this.size.val,
+ y - own_y - PiePreviewSliceRenderer.delete_y*this.size.val);
return active;
}
@@ -244,10 +244,10 @@ public class PiePreviewSliceRenderer : GLib.Object {
public void on_button_press(double x, double y) {
bool delete_pressed = false;
if (this.activity.end == 1.0) {
- double own_x = cos(this.angle.val)*pie_radius;
- double own_y = sin(this.angle.val)*pie_radius;
- delete_pressed = this.delete_sign.on_button_press(x - own_x - delete_x*this.size.val,
- y - own_y - delete_y*this.size.val);
+ double own_x = cos(this.angle.val)*PiePreviewSliceRenderer.pie_radius;
+ double own_y = sin(this.angle.val)*PiePreviewSliceRenderer.pie_radius;
+ delete_pressed = this.delete_sign.on_button_press(x - own_x - PiePreviewSliceRenderer.delete_x*this.size.val,
+ y - own_y - PiePreviewSliceRenderer.delete_y*this.size.val);
}
if (!delete_pressed && this.activity.end == 1.0) {