summaryrefslogtreecommitdiff
path: root/src/deamon.vala
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2015-01-15 18:59:03 +0100
committerJörg Frings-Fürst <debian@jff-webhosting.net>2015-01-15 18:59:03 +0100
commit484946ba512d2f441471e3d7e1b839b4f71c54a7 (patch)
treecfe32a46fee52ab246d2258d7fcec862eb1af9ad /src/deamon.vala
parent45fa2e053bf7f7d51f3e0583abe3d53de4ebdcfd (diff)
Merge Upstream Release
Diffstat (limited to 'src/deamon.vala')
-rw-r--r--src/deamon.vala74
1 files changed, 37 insertions, 37 deletions
diff --git a/src/deamon.vala b/src/deamon.vala
index 8cf95f8..fb9618b 100644
--- a/src/deamon.vala
+++ b/src/deamon.vala
@@ -1,4 +1,4 @@
-/*
+/*
Copyright (c) 2011 by Simon Schneegans
This program is free software: you can redistribute it and/or modify it
@@ -12,17 +12,17 @@ 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/>.
+this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace GnomePie {
-/////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////
/// This class runs in the background. It has an Indicator sitting in the
/// user's panel. It initializes everything and guarantees that there is
/// only one instance of Gnome-Pie running.
/////////////////////////////////////////////////////////////////////////
-
+
public class Deamon : GLib.Object {
/////////////////////////////////////////////////////////////////////
@@ -30,19 +30,19 @@ public class Deamon : GLib.Object {
/////////////////////////////////////////////////////////////////////
public static string version;
-
+
/////////////////////////////////////////////////////////////////////
/// The beginning of everything.
/////////////////////////////////////////////////////////////////////
public static int main(string[] args) {
- version = "0.5.5";
-
+ version = "0.5.6";
+
Logger.init();
Gdk.threads_init();
Gtk.init(ref args);
Paths.init();
-
+
message("Welcome to Gnome-Pie " + version + "!");
// create the Deamon and run it
@@ -51,28 +51,28 @@ public class Deamon : GLib.Object {
return 0;
}
-
+
/////////////////////////////////////////////////////////////////////
/// The AppIndicator of Gnome-Pie.
/////////////////////////////////////////////////////////////////////
private Indicator indicator = null;
-
+
/////////////////////////////////////////////////////////////////////
/// Varaibles set by the commend line parser.
/////////////////////////////////////////////////////////////////////
-
+
private static string open_pie = null;
private static bool reset = false;
-
+
/////////////////////////////////////////////////////////////////////
/// Available command line options.
/////////////////////////////////////////////////////////////////////
-
+
private const GLib.OptionEntry[] options = {
- { "open", 'o', 0, GLib.OptionArg.STRING, out open_pie,
+ { "open", 'o', 0, GLib.OptionArg.STRING, out open_pie,
"Open the Pie with the given ID", "ID" },
- { "reset", 'r', 0, GLib.OptionArg.NONE, out reset,
+ { "reset", 'r', 0, GLib.OptionArg.NONE, out reset,
"Reset all options to default values" },
{ null }
};
@@ -81,7 +81,7 @@ public class Deamon : GLib.Object {
/// C'tor of the Deamon. It checks whether it's the firts running
/// instance of Gnome-Pie.
/////////////////////////////////////////////////////////////////////
-
+
public void run(string[] args) {
// create command line options
var context = new GLib.OptionContext("");
@@ -94,16 +94,16 @@ public class Deamon : GLib.Object {
} catch(GLib.OptionError error) {
warning(error.message);
}
-
+
if (Deamon.reset) {
if (GLib.FileUtils.remove(Paths.pie_config) == 0)
message("Removed file \"%s\"", Paths.pie_config);
if (GLib.FileUtils.remove(Paths.settings) == 0)
message("Removed file \"%s\"", Paths.settings);
-
+
return;
}
-
+
// create unique application
var app = new Unique.App("org.gnome.gnomepie", null);
@@ -118,21 +118,21 @@ public class Deamon : GLib.Object {
var data = new Unique.MessageData();
data.set_text(open_pie, open_pie.length);
app.send_message(Unique.Command.ACTIVATE, data);
-
+
return;
- }
-
+ }
+
message("Gnome-Pie is already running. Sending request to open config menu.");
app.send_message(Unique.Command.ACTIVATE, null);
-
+
return;
}
-
+
// wait for incoming messages
app.message_received.connect((cmd, data, event_time) => {
if (cmd == Unique.Command.ACTIVATE) {
var pie = data.get_text();
-
+
if (pie != null && pie != "") PieManager.open_pie(pie);
else this.indicator.show_preferences();
@@ -141,43 +141,43 @@ public class Deamon : GLib.Object {
return Unique.Response.PASSTHROUGH;
});
-
+
Gdk.threads_enter();
-
+
// init locale support
Intl.bindtextdomain ("gnomepie", Paths.locales);
Intl.textdomain ("gnomepie");
-
+
// init toolkits and static stuff
ActionRegistry.init();
GroupRegistry.init();
-
+
PieManager.init();
Icon.init();
-
+
// launch the indicator
this.indicator = new Indicator();
// connect SigHandlers
Posix.signal(Posix.SIGINT, sig_handler);
Posix.signal(Posix.SIGTERM, sig_handler);
-
+
// finished loading... so run the prog!
message("Started happily...");
-
+
// open pie if neccessary
- if (open_pie != null)
+ if (open_pie != null)
PieManager.open_pie(open_pie);
-
+
Gtk.main();
-
+
Gdk.threads_leave();
}
-
+
/////////////////////////////////////////////////////////////////////
/// Print a nifty message when the prog is killed.
/////////////////////////////////////////////////////////////////////
-
+
private static void sig_handler(int sig) {
stdout.printf("\n");
message("Caught signal (%d), bye!".printf(sig));