From 87a5b11d7598fc1e5239e11972c5e03a38bbb672 Mon Sep 17 00:00:00 2001 From: Alessandro Ghedini Date: Sun, 20 May 2012 20:01:21 +0200 Subject: Imported Upstream version 0.5.3 --- src/gui/newsWindow.vala | 93 +++++++++++++++++++++++++++++++++++++++++++++ src/gui/settingsWindow.vala | 6 ++- 2 files changed, 98 insertions(+), 1 deletion(-) create mode 100644 src/gui/newsWindow.vala (limited to 'src/gui') 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 . +*/ + +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("Gnome-Pie needs your help!\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" + + + "So please help improving this software by sending the " + + "file 'gnome-pie.stats' located in " + Paths.config_directory + + " by email to " + + "pie-stats@simonschneegans.de!\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 " + + "code@simonschneegans.de!\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" + -- cgit v1.2.3