gnome: Simplify launch script now that we're using GtkApplication
This commit is contained in:
parent
edee2eec69
commit
ec03fed186
|
@ -25,36 +25,36 @@ namespace SparkleShare {
|
|||
|
||||
public class SparkleUI {
|
||||
|
||||
public static string AssetsPath = Defines.INSTALL_DIR;
|
||||
|
||||
public SparkleStatusIcon StatusIcon;
|
||||
public SparkleEventLog EventLog;
|
||||
public SparkleBubbles Bubbles;
|
||||
public SparkleSetup Setup;
|
||||
public SparkleAbout About;
|
||||
|
||||
public static string AssetsPath = Defines.INSTALL_DIR;
|
||||
|
||||
private Gtk.Application application;
|
||||
|
||||
// TODO: port sparkleshare.in
|
||||
|
||||
public SparkleUI ()
|
||||
{
|
||||
application = new Gtk.Application ("org.sparkleshare.sparkleshare", 0);
|
||||
this.application = new Gtk.Application ("org.sparkleshare.sparkleshare", 0);
|
||||
|
||||
application.Register (null);
|
||||
application.Activated += ApplicationActivatedDelegate;
|
||||
this.application.Register (null);
|
||||
this.application.Activated += ApplicationActivatedDelegate;
|
||||
}
|
||||
|
||||
|
||||
public void Run ()
|
||||
{
|
||||
(application as GLib.Application).Run (0, null);
|
||||
(this.application as GLib.Application).Run (0, null);
|
||||
}
|
||||
|
||||
|
||||
private void ApplicationActivatedDelegate (object sender, EventArgs args)
|
||||
{
|
||||
if (application.Windows.Length > 0) {
|
||||
foreach (Window window in application.Windows) {
|
||||
if (this.application.Windows.Length > 0) {
|
||||
foreach (Window window in this.application.Windows) {
|
||||
if (window.Visible)
|
||||
window.Present ();
|
||||
}
|
||||
|
@ -66,9 +66,9 @@ namespace SparkleShare {
|
|||
Bubbles = new SparkleBubbles ();
|
||||
StatusIcon = new SparkleStatusIcon ();
|
||||
|
||||
Setup.Application = application;
|
||||
EventLog.Application = application;
|
||||
About.Application = application;
|
||||
Setup.Application = this.application;
|
||||
EventLog.Application = this.application;
|
||||
About.Application = this.application;
|
||||
|
||||
Program.Controller.UIHasLoaded ();
|
||||
}
|
||||
|
|
|
@ -5,62 +5,18 @@ if [[ $UID -eq 0 ]]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$XDG_RUNTIME_DIR" ]; then
|
||||
pidfile=${XDG_RUNTIME_DIR}/sparkleshare.pid
|
||||
else
|
||||
pidfile=~/.sparkleshare-$(hostname)-${USER}.pid
|
||||
fi
|
||||
|
||||
start() {
|
||||
if [ -e "${pidfile}" ]; then
|
||||
sparklepid=`cat ${pidfile}`
|
||||
if [ -n "`ps -p ${sparklepid} | grep ${sparklepid}`" ]; then
|
||||
echo "SparkleShare is already running."
|
||||
exit 0
|
||||
else
|
||||
echo "Stale SparkleShare PID file found, starting a new instance..."
|
||||
rm -f $pidfile
|
||||
fi
|
||||
fi
|
||||
|
||||
echo -n "Starting SparkleShare... "
|
||||
if [ -n "${SSH_AGENT_PID}" -o -n "${SSH_AUTH_SOCK}" ] ; then
|
||||
mono "@expanded_libdir@/@PACKAGE@/SparkleShare.exe" $2 &
|
||||
else
|
||||
ssh-agent mono "@expanded_libdir@/@PACKAGE@/SparkleShare.exe" $2 &
|
||||
fi
|
||||
( umask 066; echo $! > ${pidfile} )
|
||||
echo "Done."
|
||||
}
|
||||
|
||||
stop() {
|
||||
if [ -e "${pidfile}" ]; then
|
||||
sparklepid=`cat ${pidfile}`
|
||||
if [ -n "`ps -p ${sparklepid} | grep ${sparklepid}`" ]; then
|
||||
echo -n "Stopping SparkleShare... "
|
||||
kill ${sparklepid}
|
||||
rm -f ${pidfile}
|
||||
echo "Done."
|
||||
else
|
||||
echo "SparkleShare is not running, removing stale PID file..."
|
||||
rm -f ${pidfile}
|
||||
fi
|
||||
else
|
||||
echo "SparkleShare is not running."
|
||||
fi
|
||||
}
|
||||
|
||||
case $1 in
|
||||
start|--start)
|
||||
start
|
||||
;;
|
||||
stop|--stop)
|
||||
stop
|
||||
;;
|
||||
restart|--restart)
|
||||
stop
|
||||
start
|
||||
;;
|
||||
open|--open)
|
||||
invite=`date -u +%N`
|
||||
open=`echo $2 | sed 's/sparkleshare:\/\/addProject\///'`
|
||||
|
|
|
@ -36,7 +36,7 @@ namespace SparkleShare {
|
|||
#endif
|
||||
public static void Main (string [] args)
|
||||
{
|
||||
if (args.Length != 0 && !args [0].Equals ("start") &&
|
||||
if (args.Length != 0 && !args [0].Equals ("help") &&
|
||||
SparkleBackend.Platform != PlatformID.MacOSX &&
|
||||
SparkleBackend.Platform != PlatformID.Win32NT) {
|
||||
|
||||
|
@ -47,13 +47,13 @@ namespace SparkleShare {
|
|||
"designed to keep things simple and to stay out of your way." + n +
|
||||
n +
|
||||
"Version: " + SparkleLib.SparkleBackend.Version + n +
|
||||
"Copyright (C) 2010 Hylke Bons" + n +
|
||||
"Copyright (C) 2010 Hylke Bons and others" + n +
|
||||
"This program comes with ABSOLUTELY NO WARRANTY." + n +
|
||||
n +
|
||||
"This is free software, and you are welcome to redistribute it" + n +
|
||||
"under certain conditions. Please read the GNU GPLv3 for details." + n +
|
||||
n +
|
||||
"Usage: sparkleshare [start|stop|restart]");
|
||||
"Usage: sparkleshare [start|open]");
|
||||
|
||||
Environment.Exit (-1);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue