diff options
author | Alessandro Ghedini <al3xbio@gmail.com> | 2012-03-05 12:19:59 +0100 |
---|---|---|
committer | Alessandro Ghedini <al3xbio@gmail.com> | 2012-03-05 12:19:59 +0100 |
commit | 98f3ef2689de06e8ab8b46a91acfa7dd2056a3a6 (patch) | |
tree | b98e438ac1082925e12af6dfec6d9ebeb4e3035e /src/pies | |
parent | a824c3e5bdab686901b02667609282e7d596a6af (diff) |
Imported Upstream version 0.5.1
Diffstat (limited to 'src/pies')
-rw-r--r-- | src/pies/load.vala | 2 | ||||
-rw-r--r-- | src/pies/pieManager.vala | 21 | ||||
-rw-r--r-- | src/pies/save.vala | 15 |
3 files changed, 35 insertions, 3 deletions
diff --git a/src/pies/load.vala b/src/pies/load.vala index b606cf5..4a9274d 100644 --- a/src/pies/load.vala +++ b/src/pies/load.vala @@ -36,6 +36,8 @@ namespace Pies { Pies.create_default_config(); return; } + + message("Loading Pies from \"" + Paths.pie_config + "\"."); // load the settings file Xml.Parser.init(); diff --git a/src/pies/pieManager.vala b/src/pies/pieManager.vala index 162a61f..85d8a14 100644 --- a/src/pies/pieManager.vala +++ b/src/pies/pieManager.vala @@ -52,6 +52,14 @@ public class PieManager : GLib.Object { private static bool a_pie_is_active = false; ///////////////////////////////////////////////////////////////////// + /// Storing the position of the last Pie. Used for subpies, which are + /// opened at their parents location. + ///////////////////////////////////////////////////////////////////// + + private static int last_x = 0; + private static int last_y = 0; + + ///////////////////////////////////////////////////////////////////// /// Initializes all Pies. They are loaded from the pies.conf file. ///////////////////////////////////////////////////////////////////// @@ -73,28 +81,35 @@ public class PieManager : GLib.Object { /// Opens the Pie with the given ID, if it exists. ///////////////////////////////////////////////////////////////////// - public static void open_pie(string id) { + public static void open_pie(string id, bool at_last_position = false) { if (!a_pie_is_active) { Pie? pie = all_pies[id]; if (pie != null) { + Logger.stats("OPEN " + id); + a_pie_is_active = true; var window = new PieWindow(); window.load_pie(pie); - window.open(); + + if (at_last_position) { + window.open_at(last_x, last_y); + } else { + window.open(); + } opened_windows.add(window); window.on_closed.connect(() => { opened_windows.remove(window); if (opened_windows.size == 0) { - ThemedIcon.clear_cache(); Icon.clear_cache(); } }); window.on_closing.connect(() => { + window.get_center_pos(out last_x, out last_y); a_pie_is_active = false; }); diff --git a/src/pies/save.vala b/src/pies/save.vala index c940e5a..aadc7c8 100644 --- a/src/pies/save.vala +++ b/src/pies/save.vala @@ -30,6 +30,11 @@ namespace Pies { ///////////////////////////////////////////////////////////////////// public void save() { + message("Saving Pies to \"" + Paths.pie_config + "\"."); + + // log pie statistics + string pie_line = "PIES"; + // initializes the XML-Writer var writer = new Xml.TextWriter.filename(Paths.pie_config); writer.set_indent(true); @@ -42,6 +47,8 @@ namespace Pies { // if it's no dynamically created Pie if (pie.id.length == 3) { + int slice_count = 0; + // write all attributes of the Pie writer.start_element("pie"); writer.write_attribute("name", pie.name); @@ -63,18 +70,26 @@ namespace Pies { writer.write_attribute("command", action.real_command); writer.write_attribute("quickAction", action.is_quickaction ? "true" : "false"); writer.end_element(); + + ++ slice_count; } } else { writer.start_element("group"); writer.write_attribute("type", GroupRegistry.descriptions[group.get_type().name()].id); writer.end_element(); + + slice_count += group.actions.size; } } writer.end_element(); + + pie_line += " " + pie.id + "(%d)".printf(slice_count); } } writer.end_element(); writer.end_document(); + + Logger.stats(pie_line); } } |