summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlessandro Ghedini <al3xbio@gmail.com>2012-05-20 20:01:22 +0200
committerAlessandro Ghedini <al3xbio@gmail.com>2012-05-20 20:01:22 +0200
commita095c29cd9cc8e4a43d79548bc57b870c6e90bfa (patch)
treedaf6e98fbb58b7f78213e98d9291255c151d8671 /src
parentb3977b8585efcd19a73e3bf7f25f41b01d9d4cae (diff)
parent87a5b11d7598fc1e5239e11972c5e03a38bbb672 (diff)
Merge tag 'upstream/0.5.3'
Upstream version 0.5.3
Diffstat (limited to 'src')
-rw-r--r--src/deamon.vala11
-rw-r--r--src/gui/newsWindow.vala93
-rw-r--r--src/gui/settingsWindow.vala6
-rw-r--r--src/utilities/bindingManager.vala2
-rw-r--r--src/utilities/config.vala5
-rw-r--r--src/utilities/logger.vala9
-rw-r--r--src/utilities/paths.vala9
7 files changed, 132 insertions, 3 deletions
diff --git a/src/deamon.vala b/src/deamon.vala
index 2424f8f..117e872 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.2";
+ version = "0.5.3";
Logger.init();
Gdk.threads_init();
@@ -173,7 +173,14 @@ public class Deamon : GLib.Object {
Logger.stats("LAUNCH " + version);
// open pie if neccessary
- if (open_pie != null) PieManager.open_pie(open_pie);
+ 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/newsWindow.vala b/src/gui/newsWindow.vala
new file mode 100644
index 0000000..9212fa6
--- /dev/null
+++ b/src/gui/newsWindow.vala
@@ -0,0 +1,93 @@
+/*
+Copyright (c) 2011 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 <http://www.gnu.org/licenses/>.
+*/
+
+namespace GnomePie {
+
+/////////////////////////////////////////////////////////////////////////
+///
+/////////////////////////////////////////////////////////////////////////
+
+public class NewsWindow: Gtk.Dialog {
+
+ public static const int news_count = 1;
+
+ /////////////////////////////////////////////////////////////////////
+ ///
+ /////////////////////////////////////////////////////////////////////
+
+ public NewsWindow () {
+ this.title = "Gnome-Pie";
+
+ this.set_border_width(5);
+
+ var box = new Gtk.VBox(false, 12);
+
+ var image = new Gtk.Image.from_icon_name("gnome-pie", Gtk.IconSize.DIALOG);
+ box.pack_start(image);
+
+ 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!");
+
+ box.pack_start(news, false, false);
+
+ var check = new Gtk.CheckButton.with_label("Don't show this window again.");
+ check.toggled.connect((check_box) => {
+ var checky = check_box as Gtk.CheckButton;
+
+ if (checky.active) Config.global.showed_news = news_count;
+ else Config.global.showed_news = news_count-1;
+
+ Config.global.save();
+ });
+
+ box.pack_end(check);
+
+ (this.get_content_area() as Gtk.VBox).pack_start(box);
+ this.get_content_area().show_all();
+
+ this.add_button(Gtk.Stock.CLOSE, 0);
+
+ this.response.connect((id) => {
+ if (id == 0)
+ this.hide();
+ });
+ }
+}
+
+}
diff --git a/src/gui/settingsWindow.vala b/src/gui/settingsWindow.vala
index 0e7af20..60bfcf3 100644
--- a/src/gui/settingsWindow.vala
+++ b/src/gui/settingsWindow.vala
@@ -152,17 +152,21 @@ public class SettingsWindow : GLib.Object {
/////////////////////////////////////////////////////////////////////
private void on_autostart_toggled(Gtk.ToggleButton check_box) {
+
bool active = check_box.active;
if (!active && FileUtils.test(Paths.autostart, FileTest.EXISTS)) {
+ Config.global.auto_start = false;
// delete the autostart file
FileUtils.remove (Paths.autostart);
}
else if (active && !FileUtils.test(Paths.autostart, FileTest.EXISTS)) {
+ Config.global.auto_start = true;
+
string autostart_entry =
"#!/usr/bin/env xdg-open\n" +
"[Desktop Entry]\n" +
"Name=Gnome-Pie\n" +
- "Exec=gnome-pie\n" +
+ "Exec=" + Paths.executable + "\n" +
"Encoding=UTF-8\n" +
"Type=Application\n" +
"X-GNOME-Autostart-enabled=true\n" +
diff --git a/src/utilities/bindingManager.vala b/src/utilities/bindingManager.vala
index 5a4548e..669c863 100644
--- a/src/utilities/bindingManager.vala
+++ b/src/utilities/bindingManager.vala
@@ -48,9 +48,11 @@ public class BindingManager : GLib.Object {
Gdk.ModifierType.MOD2_MASK,
Gdk.ModifierType.LOCK_MASK,
Gdk.ModifierType.MOD5_MASK,
+
Gdk.ModifierType.MOD2_MASK|Gdk.ModifierType.LOCK_MASK,
Gdk.ModifierType.MOD2_MASK|Gdk.ModifierType.MOD5_MASK,
Gdk.ModifierType.LOCK_MASK|Gdk.ModifierType.MOD5_MASK,
+
Gdk.ModifierType.MOD2_MASK|Gdk.ModifierType.LOCK_MASK|Gdk.ModifierType.MOD5_MASK
};
diff --git a/src/utilities/config.vala b/src/utilities/config.vala
index cc776d5..1d8b714 100644
--- a/src/utilities/config.vala
+++ b/src/utilities/config.vala
@@ -57,6 +57,7 @@ public class Config : GLib.Object {
public bool show_indicator { get; set; default = true; }
public bool show_captions { get; set; default = true; }
public bool auto_start { get; set; default = false; }
+ public int showed_news { get; set; default = 0; }
public Gee.ArrayList<Theme?> themes { get; private set; }
/////////////////////////////////////////////////////////////////////
@@ -72,6 +73,7 @@ public class Config : GLib.Object {
writer.write_attribute("global_scale", global_scale.to_string());
writer.write_attribute("show_indicator", show_indicator ? "true" : "false");
writer.write_attribute("show_captions", show_captions ? "true" : "false");
+ writer.write_attribute("showed_news", showed_news.to_string());
writer.end_element();
writer.end_document();
}
@@ -117,6 +119,9 @@ public class Config : GLib.Object {
case "show_captions":
show_captions = bool.parse(attr_content);
break;
+ case "showed_news":
+ showed_news = int.parse(attr_content);
+ break;
default:
warning("Invalid setting \"" + attr_name + "\" in gnome-pie.conf!");
break;
diff --git a/src/utilities/logger.vala b/src/utilities/logger.vala
index 5334920..116cbcd 100644
--- a/src/utilities/logger.vala
+++ b/src/utilities/logger.vala
@@ -107,6 +107,15 @@ 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");
diff --git a/src/utilities/paths.vala b/src/utilities/paths.vala
index bc3e9b1..fe8897b 100644
--- a/src/utilities/paths.vala
+++ b/src/utilities/paths.vala
@@ -25,6 +25,13 @@ namespace GnomePie {
public class Paths : GLib.Object {
/////////////////////////////////////////////////////////////////////
+ /// The config directory,
+ /// usually ~/.config/gnome-pie/.
+ /////////////////////////////////////////////////////////////////////
+
+ public static string config_directory { get; private set; default=""; }
+
+ /////////////////////////////////////////////////////////////////////
/// The log file,
/// usually ~/.config/gnome-pie/gnome-pie.log.
/////////////////////////////////////////////////////////////////////
@@ -171,6 +178,8 @@ public class Paths : GLib.Object {
}
}
+ config_directory = config_dir.get_path();
+
// create local themes directory if neccasary
var themes_dir = config_dir.get_child("themes");
if(!themes_dir.query_exists()) {