/*
* app - zavai main window
*
- * Copyright (C) 2009 Enrico Zini <enrico@enricozini.org>
+ * Copyright (C) 2009-2010 Enrico Zini <enrico@enricozini.org>
*
* 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
current = null;
destroy += Gtk.main_quit;
set_events(get_events() | Gdk.EventMask.VISIBILITY_NOTIFY_MASK);
+ set_position(Gtk.WindowPosition.MOUSE);
visibility_notify_event += on_visibility;
set_skip_pager_hint(true);
set_skip_taskbar_hint(true);
{
set_size_request(300, 500);
//fullscreen();
- show_all();
+ if (zavai.config.profile == "laptop")
+ {
+ visibility = false;
+ zavai.app.ensure_hidden();
+ zavai.ui.wm.raise_icon.update_icon();
+ } else {
+ show_all();
+ }
}
public void run_script(string command)
zavai.log.error("Running " + command + ": " + e.message);
}
}
+
+ public int run_script_sync(string command, out string std_out, out string std_err)
+ {
+ int status = -1;
+ zavai.log.info("Run program: " + command);
+ string[] args = command.split(" ");
+ try {
+ bool res = Process.spawn_sync(Environment.get_home_dir(), args, null, SpawnFlags.SEARCH_PATH, null, out std_out, out std_err, out status);
+ } catch (SpawnError e) {
+ zavai.log.error("Running " + command + ": " + e.message);
+ }
+ return status;
+ }
}
public abstract class Applet : Gtk.VBox, Resource
set_label(get_active() ? label_stop : label_start);
}
+ private void on_service_toggled(bool val)
+ {
+ set_active(val);
+ //set_label(val ? label_stop : label_start);
+ }
+
public ServiceRequestLink(Service service, string label_start, string label_stop)
{
this.service = service;
this.label_start = label_start;
this.label_stop = label_stop;
set_size_request(0, zavai.config.min_button_height);
+ set_active(service.started);
toggled += on_toggled;
+ service.toggled += on_service_toggled;
set_label(get_active() ? label_stop : label_start);
}