summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlessandro Ghedini <al3xbio@gmail.com>2012-11-03 16:15:11 +0100
committerAlessandro Ghedini <al3xbio@gmail.com>2012-11-03 16:15:11 +0100
commit1f6f24308e96040962794c5a9ffd81597b5e072a (patch)
tree7d719e21bf759d20ace53bcac13325048aa21a8c /src
parent87a5b11d7598fc1e5239e11972c5e03a38bbb672 (diff)
Imported Upstream version 0.5.4upstream/0.5.4
Diffstat (limited to 'src')
-rw-r--r--src/deamon.vala15
-rw-r--r--src/gui/aboutWindow.vala4
-rw-r--r--src/gui/newsWindow.vala24
-rw-r--r--src/gui/pieList.vala24
-rw-r--r--src/gui/piePreview.vala36
-rw-r--r--src/gui/settingsWindow.vala6
-rw-r--r--src/gui/triggerSelectButton.vala1
-rw-r--r--src/pies/pieManager.vala1
-rw-r--r--src/pies/save.vala7
-rw-r--r--src/renderers/pieRenderer.vala9
-rw-r--r--src/utilities/bindingManager.vala9
-rw-r--r--src/utilities/focusGrabber.vala14
-rw-r--r--src/utilities/logger.vala41
13 files changed, 81 insertions, 110 deletions
diff --git a/src/deamon.vala b/src/deamon.vala
index 117e872..a987de3 100644
--- a/src/deamon.vala
+++ b/src/deamon.vala
@@ -36,7 +36,7 @@ public class Deamon : GLib.Object {
/////////////////////////////////////////////////////////////////////
public static int main(string[] args) {
- version = "0.5.3";
+ version = "0.5.4";
Logger.init();
Gdk.threads_init();
@@ -100,8 +100,6 @@ public class Deamon : GLib.Object {
message("Removed file \"%s\"", Paths.pie_config);
if (GLib.FileUtils.remove(Paths.settings) == 0)
message("Removed file \"%s\"", Paths.settings);
-
- Logger.stats("LAUNCH RESET");
return;
}
@@ -121,16 +119,12 @@ public class Deamon : GLib.Object {
data.set_text(open_pie, open_pie.length);
app.send_message(Unique.Command.ACTIVATE, data);
- Logger.stats("LAUNCH PIE " + open_pie);
-
return;
}
message("Gnome-Pie is already running. Sending request to open config menu.");
app.send_message(Unique.Command.ACTIVATE, null);
- Logger.stats("LAUNCH CONFIG");
-
return;
}
@@ -170,17 +164,10 @@ public class Deamon : GLib.Object {
// finished loading... so run the prog!
message("Started happily...");
- Logger.stats("LAUNCH " + version);
// open pie if neccessary
if (open_pie != null)
PieManager.open_pie(open_pie);
- else if (Config.global.showed_news < NewsWindow.news_count
- && Logger.get_statistics_size() > 10000) {
-
- var b = new NewsWindow();
- b.show();
- }
Gtk.main();
diff --git a/src/gui/aboutWindow.vala b/src/gui/aboutWindow.vala
index 6c5820b..c6b7453 100644
--- a/src/gui/aboutWindow.vala
+++ b/src/gui/aboutWindow.vala
@@ -44,7 +44,9 @@ public class AboutWindow: Gtk.AboutDialog {
"Eduardo Anabalon <lalo1412@gmail.com> (ES)",
"Grégoire Bellon-Gervais <greggbg@gmail.com> (FR)",
"Alex Maxime <cad.maxime@gmail.com> (FR)",
- "Eugene Roskin <pams@imail.ru> (RU)"
+ "Eugene Roskin <pams@imail.ru> (RU)",
+ "Ting Zhou <tzhou@haverford.edu> (ZH-CN)",
+ "Martin Dinov <martindinov@yahoo.com> (BG)"
};
// sort translators
diff --git a/src/gui/newsWindow.vala b/src/gui/newsWindow.vala
index 9212fa6..75de60e 100644
--- a/src/gui/newsWindow.vala
+++ b/src/gui/newsWindow.vala
@@ -23,7 +23,7 @@ namespace GnomePie {
public class NewsWindow: Gtk.Dialog {
- public static const int news_count = 1;
+ public static const int news_count = 2;
/////////////////////////////////////////////////////////////////////
///
@@ -42,27 +42,7 @@ public class NewsWindow: Gtk.Dialog {
var news = new Gtk.Label("");
news.wrap = true;
news.set_width_chars(75);
- news.set_markup("<b>Gnome-Pie needs your help!</b>\n\n" +
-
- "Hey, this is Simon, developer of Gnome-Pie. I’m going to " +
- "write my Bachelor thesis on pie menus! In order to improve " +
- "Gnome-Pie to the limits, I need some information on how " +
- "you use Gnome-Pie.\n\n" +
-
- "<b>So please help improving this software by sending the " +
- "file 'gnome-pie.stats' located in <a href='file:" +
- Paths.config_directory + "'>" + Paths.config_directory +
- "</a> by email to <a href='mailto:pie-stats@simonschneegans.de?subject=statistics'>" +
- "pie-stats@simonschneegans.de</a>!</b>\n\n" +
-
- "There is no personal information in this file. Only " +
- "information on your usage frequency, how fast you use " +
- "Gnome-Pie and how many Pies with how many Slices you " +
- "have configured. If you have any questions regarding " +
- "this topic please send an email to " +
- "<a href='mailto:code@simonschneegans.de'>code@simonschneegans.de</a>!\n\n" +
-
- "Thank you so much! It’s going to be exciting!");
+ news.set_markup("<b>Thank you!</b>\n\n");
box.pack_start(news, false, false);
diff --git a/src/gui/pieList.vala b/src/gui/pieList.vala
index 474e5f5..f9fb54b 100644
--- a/src/gui/pieList.vala
+++ b/src/gui/pieList.vala
@@ -94,6 +94,7 @@ class PieList : Gtk.TreeView {
this.enable_model_drag_source(Gdk.ModifierType.BUTTON1_MASK, entries, Gdk.DragAction.LINK);
this.enable_model_drag_dest(entries, Gdk.DragAction.COPY | Gdk.DragAction.MOVE | Gdk.DragAction.LINK);
this.drag_data_get.connect(this.on_dnd_source);
+ this.drag_data_received.connect(this.on_dnd_received);
this.drag_begin.connect_after(this.on_start_drag);
this.drag_motion.connect(this.on_drag_move);
this.drag_leave.connect(() => {
@@ -238,6 +239,29 @@ class PieList : Gtk.TreeView {
return true;
}
+
+ /////////////////////////////////////////////////////////////////////
+ /// Called when the user finishes a drag operation on this widget.
+ /// Only used for external drags.
+ /////////////////////////////////////////////////////////////////////
+
+ private void on_dnd_received(Gdk.DragContext context, int x, int y,
+ Gtk.SelectionData selection_data, uint info, uint time_) {
+
+ Gtk.TreeIter active;
+ if (this.get_selection().get_selected(null, out active)) {
+ string id = "";
+ this.data.get(active, DataPos.ID, out id);
+
+ var pie = PieManager.all_pies[id];
+
+ foreach (var uri in selection_data.get_uris()) {
+ pie.add_action(ActionRegistry.new_for_uri(uri), 0);
+ }
+
+ this.on_select(id);
+ }
+ }
}
}
diff --git a/src/gui/piePreview.vala b/src/gui/piePreview.vala
index 5745fcb..3ddf6c8 100644
--- a/src/gui/piePreview.vala
+++ b/src/gui/piePreview.vala
@@ -68,6 +68,7 @@ class PiePreview : Gtk.DrawingArea {
/////////////////////////////////////////////////////////////////////
private int drag_start_index = -1;
+ private string drag_start_id = "";
/////////////////////////////////////////////////////////////////////
/// C'tor, creates the widget.
@@ -174,8 +175,12 @@ class PiePreview : Gtk.DrawingArea {
public void set_pie(string id) {
this.current_id = id;
- this.modify_bg(Gtk.StateType.NORMAL, Gtk.rc_get_style(this).light[0]);
+ this.modify_bg(Gtk.StateType.NORMAL, Gtk.rc_get_style(this).light[Gtk.StateType.NORMAL]);
this.renderer.load_pie(PieManager.all_pies[id]);
+
+ if (id == this.drag_start_id) {
+ this.renderer.hide_group(this.drag_start_index);
+ }
}
/////////////////////////////////////////////////////////////////////
@@ -209,6 +214,7 @@ class PiePreview : Gtk.DrawingArea {
Gtk.Allocation allocation;
this.get_allocation(out allocation);
+
ctx.translate((int)(allocation.width*0.5), (int)(allocation.height*0.5));
this.renderer.draw(frame_time, ctx);
@@ -278,6 +284,7 @@ class PiePreview : Gtk.DrawingArea {
Gtk.Allocation allocation;
this.get_allocation(out allocation);
this.renderer.on_mouse_move(x-allocation.width*0.5, y-allocation.height*0.5);
+
return true;
}
@@ -287,6 +294,7 @@ class PiePreview : Gtk.DrawingArea {
private void on_start_drag(Gdk.DragContext ctx) {
this.drag_start_index = this.renderer.get_active_slice();
+ this.drag_start_id = this.current_id;
var icon = this.renderer.get_active_icon();
var pixbuf = icon.to_pixbuf();
@@ -311,11 +319,29 @@ class PiePreview : Gtk.DrawingArea {
context.list_targets().foreach((target) => {
Gdk.Atom target_type = (Gdk.Atom)target;
if (target_type.name() == "text/plain") {
- var pie = PieManager.all_pies[this.current_id];
- pie.move_group(this.drag_start_index, target_index);
- this.renderer.show_hidden_group_at(target_index);
+ if (this.current_id == this.drag_start_id) {
+ var pie = PieManager.all_pies[this.current_id];
+ pie.move_group(this.drag_start_index, target_index);
+ this.renderer.show_hidden_group_at(target_index);
+ } else {
+ var src_pie = PieManager.all_pies[this.drag_start_id];
+ var dst_pie = PieManager.all_pies[this.current_id];
+ dst_pie.add_group(src_pie.action_groups[this.drag_start_index], target_index);
+ this.renderer.add_group(dst_pie.action_groups[target_index], target_index);
+
+ if (this.renderer.slices.size == 1)
+ this.on_first_slice_added();
+
+ if ((context.get_actions() & Gdk.DragAction.COPY) == 0)
+ src_pie.remove_group(this.drag_start_index);
+ }
+
+
}
});
+
+ this.drag_start_index = -1;
+ this.drag_start_id = "";
}
}
@@ -349,7 +375,7 @@ class PiePreview : Gtk.DrawingArea {
this.drag_enabled = true;
Gtk.TargetEntry slice_source = {"text/plain", Gtk.TargetFlags.SAME_WIDGET | Gtk.TargetFlags.SAME_APP, 0};
Gtk.TargetEntry[] sources = { slice_source };
- Gtk.drag_source_set(this, Gdk.ModifierType.BUTTON1_MASK, sources, Gdk.DragAction.MOVE);
+ Gtk.drag_source_set(this, Gdk.ModifierType.BUTTON1_MASK, sources, Gdk.DragAction.MOVE | Gdk.DragAction.COPY);
}
}
diff --git a/src/gui/settingsWindow.vala b/src/gui/settingsWindow.vala
index 60bfcf3..81f8f7e 100644
--- a/src/gui/settingsWindow.vala
+++ b/src/gui/settingsWindow.vala
@@ -138,12 +138,6 @@ public class SettingsWindow : GLib.Object {
private void on_close_button_clicked() {
this.window.hide();
-
- Logger.stats("SETTINGS " + Config.global.theme.name +
- (this.indicator.active ? " INDICATOR" : "") +
- (this.autostart.active ? " AUTOSTART" : "") +
- (this.captions.active ? " CAPTIONS" : "") +
- " %f".printf(Config.global.global_scale));
}
/////////////////////////////////////////////////////////////////////
diff --git a/src/gui/triggerSelectButton.vala b/src/gui/triggerSelectButton.vala
index fd8505a..7132220 100644
--- a/src/gui/triggerSelectButton.vala
+++ b/src/gui/triggerSelectButton.vala
@@ -48,6 +48,7 @@ public class TriggerSelectButton : Gtk.ToggleButton {
/////////////////////////////////////////////////////////////////////
private Gdk.ModifierType lock_modifiers = Gdk.ModifierType.MOD2_MASK
+ |Gdk.ModifierType.SUPER_MASK
|Gdk.ModifierType.LOCK_MASK
|Gdk.ModifierType.MOD5_MASK;
diff --git a/src/pies/pieManager.vala b/src/pies/pieManager.vala
index 85d8a14..f574085 100644
--- a/src/pies/pieManager.vala
+++ b/src/pies/pieManager.vala
@@ -86,7 +86,6 @@ public class PieManager : GLib.Object {
Pie? pie = all_pies[id];
if (pie != null) {
- Logger.stats("OPEN " + id);
a_pie_is_active = true;
diff --git a/src/pies/save.vala b/src/pies/save.vala
index aadc7c8..60fc0b2 100644
--- a/src/pies/save.vala
+++ b/src/pies/save.vala
@@ -32,9 +32,6 @@ 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);
@@ -82,14 +79,10 @@ namespace Pies {
}
}
writer.end_element();
-
- pie_line += " " + pie.id + "(%d)".printf(slice_count);
}
}
writer.end_element();
writer.end_document();
-
- Logger.stats(pie_line);
}
}
diff --git a/src/renderers/pieRenderer.vala b/src/renderers/pieRenderer.vala
index 09c5f7a..7135381 100644
--- a/src/renderers/pieRenderer.vala
+++ b/src/renderers/pieRenderer.vala
@@ -132,13 +132,6 @@ public class PieRenderer : GLib.Object {
public void activate() {
if (this.active_slice >= 0 && this.active_slice < this.slices.size) {
slices[active_slice].activate();
-
- if (this.active_slice == this.quickaction)
- Logger.stats("ACTIVATE QUICKACTION %d".printf(this.active_slice));
- else
- Logger.stats("ACTIVATE %d".printf(this.active_slice));
- } else {
- Logger.stats("CANCEL");
}
foreach (var slice in this.slices)
@@ -156,8 +149,6 @@ public class PieRenderer : GLib.Object {
slice.fade_out();
center.fade_out();
-
- Logger.stats("CANCEL");
}
/////////////////////////////////////////////////////////////////////
diff --git a/src/utilities/bindingManager.vala b/src/utilities/bindingManager.vala
index 669c863..255dbfb 100644
--- a/src/utilities/bindingManager.vala
+++ b/src/utilities/bindingManager.vala
@@ -227,8 +227,13 @@ public class BindingManager : GLib.Object {
/////////////////////////////////////////////////////////////////////
private Gdk.FilterReturn event_filter(Gdk.XEvent gdk_xevent, Gdk.Event gdk_event) {
- void* pointer = &gdk_xevent;
- X.Event* xevent = (X.Event*) pointer;
+
+ #if VALA_0_16 || VALA_0_17
+ X.Event* xevent = (X.Event*) gdk_xevent;
+ #else
+ void* pointer = &gdk_xevent;
+ X.Event* xevent = (X.Event*) pointer;
+ #endif
if(xevent->type == X.EventType.KeyPress) {
foreach(var binding in bindings) {
diff --git a/src/utilities/focusGrabber.vala b/src/utilities/focusGrabber.vala
index 293e103..e5900d6 100644
--- a/src/utilities/focusGrabber.vala
+++ b/src/utilities/focusGrabber.vala
@@ -53,7 +53,12 @@ public class FocusGrabber : GLib.Object {
var display = Gdk.Display.get_default();
var manager = display.get_device_manager();
- unowned GLib.List<weak Gdk.Device?> list = manager.list_devices(Gdk.DeviceType.MASTER);
+ #if VALA_0_16 || VALA_0_17
+ GLib.List<weak Gdk.Device?> list = manager.list_devices(Gdk.DeviceType.MASTER);
+ #else
+ unowned GLib.List<weak Gdk.Device?> list = manager.list_devices(Gdk.DeviceType.MASTER);
+ #endif
+
foreach(var device in list) {
if ((device.input_source == Gdk.InputSource.KEYBOARD && keyboard)
|| (device.input_source != Gdk.InputSource.KEYBOARD && pointer))
@@ -81,7 +86,12 @@ public class FocusGrabber : GLib.Object {
bool grabbed_all = true;
- unowned GLib.List<weak Gdk.Device?> list = manager.list_devices(Gdk.DeviceType.MASTER);
+ #if VALA_0_16
+ GLib.List<weak Gdk.Device?> list = manager.list_devices(Gdk.DeviceType.MASTER);
+ #else
+ unowned GLib.List<weak Gdk.Device?> list = manager.list_devices(Gdk.DeviceType.MASTER);
+ #endif
+
foreach(var device in list) {
if ((device.input_source == Gdk.InputSource.KEYBOARD && keyboard)
|| (device.input_source != Gdk.InputSource.KEYBOARD && pointer)) {
diff --git a/src/utilities/logger.vala b/src/utilities/logger.vala
index 116cbcd..69310fc 100644
--- a/src/utilities/logger.vala
+++ b/src/utilities/logger.vala
@@ -68,10 +68,8 @@ public class Logger {
/////////////////////////////////////////////////////////////////////
private static const int max_log_length = 1000000;
- private static const int max_stats_length = 1000000;
private static int log_length;
- private static int stats_length;
/////////////////////////////////////////////////////////////////////
/// Possible terminal colors.
@@ -94,7 +92,6 @@ public class Logger {
public static void init() {
log_length = -1;
- stats_length = -1;
try {
regex = new Regex("""(.*)\.vala(:\d+): (.*)""");
@@ -104,44 +101,6 @@ public class Logger {
}
/////////////////////////////////////////////////////////////////////
- /// Appends a line to the statistics file
- /////////////////////////////////////////////////////////////////////
-
- public static int get_statistics_size() {
- if (stats_length == -1) {
- var stats = GLib.FileStream.open(Paths.stats, "a");
- stats_length = (int)stats.tell();
- }
-
- return stats_length;
- }
-
- public static void stats(string line) {
- var stats = GLib.FileStream.open(Paths.stats, "a");
-
- if (stats != null) {
- if (stats_length == -1)
- stats_length = (int)stats.tell();
-
- string final_line = "[" + get_time() + "] " + line + "\n";
- stats.puts(final_line);
- stats_length += final_line.length;
- }
-
- if (stats_length > max_stats_length) {
- string content = "";
-
- try {
- GLib.FileUtils.get_contents(Paths.stats, out content);
- int split_index = content.index_of_char('\n', stats_length - (int)(max_stats_length*0.9));
- GLib.FileUtils.set_contents(Paths.stats, content.substring(split_index+1));
-
- stats_length -= (split_index+1);
- } catch (GLib.FileError e) {}
- }
- }
-
- /////////////////////////////////////////////////////////////////////
/// Appends a line to the log file
/////////////////////////////////////////////////////////////////////