From 27c6fade238336c61a5a01d22fe767bf664ca010 Mon Sep 17 00:00:00 2001 From: Sebastien Estienne Date: Sun, 6 Aug 2006 23:52:31 +0000 Subject: display error messages when something goes wrong in plugins git-svn-id: file:///home/lennart/svn/public/service-discovery-applet/trunk@115 3be567f1-68ff-0310-b24a-ad7cc433fd2f --- Makefile.am | 2 + configure.ac | 9 +- plugins/Makefile.am | 29 ++++++- plugins/ekiga.py | 37 --------- plugins/ekiga.py.in | 37 +++++++++ plugins/gconfterminal.py | 132 ------------------------------ plugins/gconfterminal.py.in | 132 ++++++++++++++++++++++++++++++ plugins/nautilus.py | 50 ------------ plugins/nautilus.py.in | 50 ++++++++++++ plugins/xvncviewer.py | 31 ------- plugins/xvncviewer.py.in | 31 +++++++ po/POTFILES.in | 10 +-- po/service-discovery-applet.pot | 176 ---------------------------------------- tools/Makefile.am | 14 ++++ tools/exec_wrapper.in | 58 +++++++++++++ 15 files changed, 365 insertions(+), 433 deletions(-) delete mode 100644 plugins/ekiga.py create mode 100644 plugins/ekiga.py.in delete mode 100644 plugins/gconfterminal.py create mode 100644 plugins/gconfterminal.py.in delete mode 100644 plugins/nautilus.py create mode 100644 plugins/nautilus.py.in delete mode 100644 plugins/xvncviewer.py create mode 100644 plugins/xvncviewer.py.in delete mode 100644 po/service-discovery-applet.pot create mode 100644 tools/Makefile.am create mode 100644 tools/exec_wrapper.in diff --git a/Makefile.am b/Makefile.am index 38eb740..653a6c0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -5,8 +5,10 @@ SUBDIRS = \ schemas \ servers \ plugins \ + tools \ po EXTRA_DIST = README INSTALL AUTHORS COPYING TODO \ intltool-extract.in intltool-merge.in intltool-update.in + DISTCLEANFILES = intltool-extract intltool-merge intltool-update diff --git a/configure.ac b/configure.ac index 7675f91..3de47f0 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ AC_PREREQ(2.59) -AC_INIT([service-discovery-applet],[0.4.1],[sebastien (dot) estienne (at) gmail (dot) com]) +AC_INIT([service-discovery-applet],[0.4.2],[sebastien (dot) estienne (at) gmail (dot) com]) AC_CONFIG_SRCDIR([src/service-discovery-applet.in]) AM_INIT_AUTOMAKE([foreign 1.9 -Wall]) AC_CONFIG_MACRO_DIR([common]) @@ -26,6 +26,12 @@ dnl ======================================================== PLUGINSDIR="\$(pkgdatadir)/plugins/" AC_SUBST(PLUGINSDIR) +dnl ======================================================== +dnl Directory where services' tools will be installed +dnl ======================================================== +TOOLSDIR="\$(pkgdatadir)/tools/" +AC_SUBST(TOOLSDIR) + dnl ======================================================== dnl Directory where services' icons will be installed dnl ======================================================== @@ -68,6 +74,7 @@ AC_CONFIG_FILES([ src/Makefile src/modules/Makefile plugins/Makefile + tools/Makefile po/Makefile.in ]) AC_OUTPUT diff --git a/plugins/Makefile.am b/plugins/Makefile.am index d0b4e7b..893cc07 100644 --- a/plugins/Makefile.am +++ b/plugins/Makefile.am @@ -1,10 +1,37 @@ pluginsdir = $(PLUGINSDIR) +plugins = \ + gconfterminal.py.in \ + nautilus.py.in \ + xvncviewer.py.in \ + ekiga.py.in + plugins_DATA = \ gconfterminal.py \ nautilus.py \ xvncviewer.py \ ekiga.py +gconfterminal.py: gconfterminal.py.in + sed \ + -e 's,@toolsdir\@,$(TOOLSDIR),g' \ + $< > $@ + +nautilus.py: nautilus.py.in + sed \ + -e 's,@toolsdir\@,$(TOOLSDIR),g' \ + $< > $@ + +xvncviewer.py: xvncviewer.py.in + sed \ + -e 's,@toolsdir\@,$(TOOLSDIR),g' \ + $< > $@ + +ekiga.py: ekiga.py.in + sed \ + -e 's,@toolsdir\@,$(TOOLSDIR),g' \ + $< > $@ + +EXTRA_DIST = $(plugins) -EXTRA_DIST = $(plugins_DATA) +CLEANFILES = $(plugins_DATA) diff --git a/plugins/ekiga.py b/plugins/ekiga.py deleted file mode 100644 index 7b920e4..0000000 --- a/plugins/ekiga.py +++ /dev/null @@ -1,37 +0,0 @@ -# -*- coding: UTF-8 -*- -# -*- python -*- -# Copyright (C) 2006 by Sebastian Dröge -# -# This file may be distributed and/or modified under the terms of -# the GNU General Public License version 2 as published by -# the Free Software Foundation. -# This file is distributed without any warranty; without even the implied -# warranty of merchantability or fitness for a particular purpose. -# See "COPYING" in the source distribution for more information. -# -# $Id$ -# - -from sdapplet.pluginutils import * -import subprocess - -class plugin_ekiga: - def __init__(self): - self.service_type = ["_h323._tcp", "_sip._udp"] - self.author = "Sebastian Dröge" - self.description = "Start SIP/h323 connections with Ekiga" - - def connect(self, use_host_names, name, stype, hostname, address, port, txts): - if use_host_names == True: - address = hostname - print "connecting using ekiga" - cmdline = ["ekiga"] - if stype == "_sip._udp": - cmdline += ["-c", "sip:%s:%s" % (address, port)] - else: - cmdline += ["-c", "h323:%s:%s" % (address, port)] - print cmdline - pid = subprocess.Popen(cmdline).pid - -def load(): - return plugin_ekiga() diff --git a/plugins/ekiga.py.in b/plugins/ekiga.py.in new file mode 100644 index 0000000..26b37fa --- /dev/null +++ b/plugins/ekiga.py.in @@ -0,0 +1,37 @@ +# -*- coding: UTF-8 -*- +# -*- python -*- +# Copyright (C) 2006 by Sebastian Dröge +# +# This file may be distributed and/or modified under the terms of +# the GNU General Public License version 2 as published by +# the Free Software Foundation. +# This file is distributed without any warranty; without even the implied +# warranty of merchantability or fitness for a particular purpose. +# See "COPYING" in the source distribution for more information. +# +# $Id$ +# + +from sdapplet.pluginutils import * +import subprocess + +class plugin_ekiga: + def __init__(self): + self.service_type = ["_h323._tcp", "_sip._udp"] + self.author = "Sebastian Dröge" + self.description = "Start SIP/h323 connections with Ekiga" + + def connect(self, use_host_names, name, stype, hostname, address, port, txts): + if use_host_names == True: + address = hostname + print "connecting using ekiga" + cmdline = ["@toolsdir@/exec_wrapper", "ekiga"] + if stype == "_sip._udp": + cmdline += ["-c", "sip:%s:%s" % (address, port)] + else: + cmdline += ["-c", "h323:%s:%s" % (address, port)] + print cmdline + pid = subprocess.Popen(cmdline).pid + +def load(): + return plugin_ekiga() diff --git a/plugins/gconfterminal.py b/plugins/gconfterminal.py deleted file mode 100644 index 92b9abb..0000000 --- a/plugins/gconfterminal.py +++ /dev/null @@ -1,132 +0,0 @@ -# -*- coding: UTF-8 -*- -# -*- python -*- -# Copyright (C) 2005 by Sebastien Estienne -# -# This file may be distributed and/or modified under the terms of -# the GNU General Public License version 2 as published by -# the Free Software Foundation. -# This file is distributed without any warranty; without even the implied -# warranty of merchantability or fitness for a particular purpose. -# See "COPYING" in the source distribution for more information. -# -# $Id$ -# - -from sdapplet.pluginutils import * - -import os -import pwd -import subprocess - -try: - import gettext - gettext.bindtextdomain("service-discovery-applet", "/usr/share/locale") - gettext.textdomain("service-discovery-applet") - _ = gettext.gettext - import pygtk - pygtk.require('2.0') - import gtk - import gconf - import gnome -except ImportError, e: - error_msg(_("A required python module is missing!\n%s") % (e)) - os._exit() - -class plugin_gnometerminal: - def __init__(self): - self.service_type = ["_ssh._tcp", "_sftp-ssh._tcp" ] - self.author = "Sébastien Estienne" - - def enter_callback(self, widget, win): - win.response(gtk.RESPONSE_OK) - - def SshLogin(self, hostname, username = None): - self.win = gtk.Dialog(_("SSH Connection"), None, - gtk.DIALOG_MODAL, - (gtk.STOCK_OK, gtk.RESPONSE_OK, - gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL)) - - vbox = gtk.VBox(False, 5) - self.win.vbox.pack_start(vbox, True, True, 0) - vbox.set_border_width(5) - - label = gtk.Label() - label.set_markup(_("Connecting to %s.\nPlease enter your login:") % (hostname)) - - vbox.pack_start(label, False, False, 0) - - # Create our entry - entry = gtk.Entry() - if username!= None: - entry.set_text(username) - entry.connect("activate", self.enter_callback, self.win) - vbox.pack_start(entry, False, False, 0) - - # Create the completion object - completion = gtk.EntryCompletion() - - # Assign the completion to the entry - entry.set_completion(completion) - - # Create a tree model and use it as the completion model - completion_model = self.__create_completion_model() - completion.set_model(completion_model) - - # Use model column 0 as the text column - completion.set_text_column(0) - - self.win.show_all() - if self.win.run() == gtk.RESPONSE_OK: - self.win.destroy() - return entry.get_text() - else: - self.win.destroy() - return None - - def __create_completion_model(self): - ''' Creates a tree model containing the completions. - ''' - store = gtk.ListStore(str) - - iter = store.append() - store.set(iter, 0, "root") - - current_user = pwd.getpwuid(os.getuid())[0] - iter = store.append() - store.set(iter, 0, current_user) - - return store - - def connect(self, use_host_names, name, stype, hostname, address, port, txts): - try: - terminal = gconf.client_get_default().get_string ("/desktop/gnome/applications/terminal/exec") - terminal = terminal + " " + gconf.client_get_default().get_string ("/desktop/gnome/applications/terminal/exec_arg") - except: - terminal = "gnome-terminal -x" - if use_host_names == True: - address = hostname - print "connecting using %s" % (terminal) - if txts.has_key("u"): - username = self.SshLogin(name, txts["u"]) - else: - username = self.SshLogin(name) - - - if stype == "_ssh._tcp": - scheme = "ssh -X" - else: - scheme = "sftp" - if username == None: - return - elif username != "": - sshline = "%s -p %i %s@%s" % (scheme, port, username, address) - else: - sshline = "%s -p %i %s " % (scheme, port, address) - - cmdline = terminal.split(" ") - cmdline.extend(sshline.split(" ")) - print cmdline - subprocess.Popen(cmdline) - -def load(): - return plugin_gnometerminal() diff --git a/plugins/gconfterminal.py.in b/plugins/gconfterminal.py.in new file mode 100644 index 0000000..8dbaef8 --- /dev/null +++ b/plugins/gconfterminal.py.in @@ -0,0 +1,132 @@ +# -*- coding: UTF-8 -*- +# -*- python -*- +# Copyright (C) 2005 by Sebastien Estienne +# +# This file may be distributed and/or modified under the terms of +# the GNU General Public License version 2 as published by +# the Free Software Foundation. +# This file is distributed without any warranty; without even the implied +# warranty of merchantability or fitness for a particular purpose. +# See "COPYING" in the source distribution for more information. +# +# $Id$ +# + +from sdapplet.pluginutils import * + +import os +import pwd +import subprocess + +try: + import gettext + gettext.bindtextdomain("service-discovery-applet", "/usr/share/locale") + gettext.textdomain("service-discovery-applet") + _ = gettext.gettext + import pygtk + pygtk.require('2.0') + import gtk + import gconf + import gnome +except ImportError, e: + error_msg(_("A required python module is missing!\n%s") % (e)) + os._exit() + +class plugin_gnometerminal: + def __init__(self): + self.service_type = ["_ssh._tcp", "_sftp-ssh._tcp" ] + self.author = "Sébastien Estienne" + + def enter_callback(self, widget, win): + win.response(gtk.RESPONSE_OK) + + def SshLogin(self, hostname, username = None): + self.win = gtk.Dialog(_("SSH Connection"), None, + gtk.DIALOG_MODAL, + (gtk.STOCK_OK, gtk.RESPONSE_OK, + gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL)) + + vbox = gtk.VBox(False, 5) + self.win.vbox.pack_start(vbox, True, True, 0) + vbox.set_border_width(5) + + label = gtk.Label() + label.set_markup(_("Connecting to %s.\nPlease enter your login:") % (hostname)) + + vbox.pack_start(label, False, False, 0) + + # Create our entry + entry = gtk.Entry() + if username!= None: + entry.set_text(username) + entry.connect("activate", self.enter_callback, self.win) + vbox.pack_start(entry, False, False, 0) + + # Create the completion object + completion = gtk.EntryCompletion() + + # Assign the completion to the entry + entry.set_completion(completion) + + # Create a tree model and use it as the completion model + completion_model = self.__create_completion_model() + completion.set_model(completion_model) + + # Use model column 0 as the text column + completion.set_text_column(0) + + self.win.show_all() + if self.win.run() == gtk.RESPONSE_OK: + self.win.destroy() + return entry.get_text() + else: + self.win.destroy() + return None + + def __create_completion_model(self): + ''' Creates a tree model containing the completions. + ''' + store = gtk.ListStore(str) + + iter = store.append() + store.set(iter, 0, "root") + + current_user = pwd.getpwuid(os.getuid())[0] + iter = store.append() + store.set(iter, 0, current_user) + + return store + + def connect(self, use_host_names, name, stype, hostname, address, port, txts): + try: + terminal = gconf.client_get_default().get_string ("/desktop/gnome/applications/terminal/exec") + terminal = terminal + " " + gconf.client_get_default().get_string ("/desktop/gnome/applications/terminal/exec_arg") + except: + terminal = "gnome-terminal -x" + if use_host_names == True: + address = hostname + print "connecting using %s" % (terminal) + if txts.has_key("u"): + username = self.SshLogin(name, txts["u"]) + else: + username = self.SshLogin(name) + + + if stype == "_ssh._tcp": + scheme = "@toolsdir@/exec_wrapper ssh -X" + else: + scheme = "@toolsdir@/exec_wrapper sftp" + if username == None: + return + elif username != "": + sshline = "%s -p %i %s@%s" % (scheme, port, username, address) + else: + sshline = "%s -p %i %s " % (scheme, port, address) + + cmdline = terminal.split(" ") + cmdline.extend(sshline.split(" ")) + print cmdline + subprocess.Popen(cmdline) + +def load(): + return plugin_gnometerminal() diff --git a/plugins/nautilus.py b/plugins/nautilus.py deleted file mode 100644 index 6783bbe..0000000 --- a/plugins/nautilus.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: UTF-8 -*- -# -*- python -*- -# Copyright (C) 2005 by Sebastien Estienne -# -# This file may be distributed and/or modified under the terms of -# the GNU General Public License version 2 as published by -# the Free Software Foundation. -# This file is distributed without any warranty; without even the implied -# warranty of merchantability or fitness for a particular purpose. -# See "COPYING" in the source distribution for more information. -# -# $Id$ -# - -from sdapplet.pluginutils import * - -import gnome - -class plugin_nautilus: - def __init__(self): - self.service_type = ["_http._tcp", "_ftp._tcp" , "_https._tcp", "_ftps._tcp" , "_webdav._tcp", "_webdavs._tcp", "_sftp-ssh._tcp"] - self.author = "Sébastien Estienne" - self.description = "Accessing zeroconf services using Nautilus" - - def connect(self, use_host_names, name, stype, hostname, address, port, txts): - if use_host_names == True: - address = hostname - print "connecting using nautilus" - path = get_txt_value(txts,"path") - username = get_txt_value(txts,"u") - password = get_txt_value(txts,"p") - if stype == "_http._tcp": - url = build_url("http",address,port, path, username,password) - if stype == "_https._tcp": - url = build_url("https",address,port, path, username,password) - if stype == "_ftp._tcp": - url = build_url("ftp",address,port, path, username,password) - if stype == "_ftps._tcp": - url = build_url("ftps",address,port, path, username,password) - if stype == "_sftp-ssh._tcp": - url = build_url("sftp",address,port, path, username,password) - if stype == "_webdav._tcp": - url = build_url("dav",address,port, path, username,password) - if stype == "_webdavs._tcp": - url = build_url("davs",address,port, path, username,password) - gnome.url_show(url) - - -def load(): - return plugin_nautilus() diff --git a/plugins/nautilus.py.in b/plugins/nautilus.py.in new file mode 100644 index 0000000..6783bbe --- /dev/null +++ b/plugins/nautilus.py.in @@ -0,0 +1,50 @@ +# -*- coding: UTF-8 -*- +# -*- python -*- +# Copyright (C) 2005 by Sebastien Estienne +# +# This file may be distributed and/or modified under the terms of +# the GNU General Public License version 2 as published by +# the Free Software Foundation. +# This file is distributed without any warranty; without even the implied +# warranty of merchantability or fitness for a particular purpose. +# See "COPYING" in the source distribution for more information. +# +# $Id$ +# + +from sdapplet.pluginutils import * + +import gnome + +class plugin_nautilus: + def __init__(self): + self.service_type = ["_http._tcp", "_ftp._tcp" , "_https._tcp", "_ftps._tcp" , "_webdav._tcp", "_webdavs._tcp", "_sftp-ssh._tcp"] + self.author = "Sébastien Estienne" + self.description = "Accessing zeroconf services using Nautilus" + + def connect(self, use_host_names, name, stype, hostname, address, port, txts): + if use_host_names == True: + address = hostname + print "connecting using nautilus" + path = get_txt_value(txts,"path") + username = get_txt_value(txts,"u") + password = get_txt_value(txts,"p") + if stype == "_http._tcp": + url = build_url("http",address,port, path, username,password) + if stype == "_https._tcp": + url = build_url("https",address,port, path, username,password) + if stype == "_ftp._tcp": + url = build_url("ftp",address,port, path, username,password) + if stype == "_ftps._tcp": + url = build_url("ftps",address,port, path, username,password) + if stype == "_sftp-ssh._tcp": + url = build_url("sftp",address,port, path, username,password) + if stype == "_webdav._tcp": + url = build_url("dav",address,port, path, username,password) + if stype == "_webdavs._tcp": + url = build_url("davs",address,port, path, username,password) + gnome.url_show(url) + + +def load(): + return plugin_nautilus() diff --git a/plugins/xvncviewer.py b/plugins/xvncviewer.py deleted file mode 100644 index ee51d54..0000000 --- a/plugins/xvncviewer.py +++ /dev/null @@ -1,31 +0,0 @@ -# -*- coding: UTF-8 -*- -# -*- python -*- -# Copyright (C) 2006 by Sebastien Estienne -# -# This file may be distributed and/or modified under the terms of -# the GNU General Public License version 2 as published by -# the Free Software Foundation. -# This file is distributed without any warranty; without even the implied -# warranty of merchantability or fitness for a particular purpose. -# See "COPYING" in the source distribution for more information. -# -# $Id$ -# - -from sdapplet.pluginutils import * -import subprocess - -class plugin_xvncviewer: - def __init__(self): - self.service_type = ["_rfb._tcp"] - self.author = "Sebastien Estienne" - self.description = "Start a VNC connections with xvncviewer" - - def connect(self, use_host_names, name, stype, hostname, address, port, txts): - print "connecting using xvncviewer" - cmdline = ["xvncviewer", "-xrm", "*passwordDialog:true", hostname ] - print cmdline - pid = subprocess.Popen(cmdline, close_fds=True).pid - -def load(): - return plugin_xvncviewer() diff --git a/plugins/xvncviewer.py.in b/plugins/xvncviewer.py.in new file mode 100644 index 0000000..a6e614d --- /dev/null +++ b/plugins/xvncviewer.py.in @@ -0,0 +1,31 @@ +# -*- coding: UTF-8 -*- +# -*- python -*- +# Copyright (C) 2006 by Sebastien Estienne +# +# This file may be distributed and/or modified under the terms of +# the GNU General Public License version 2 as published by +# the Free Software Foundation. +# This file is distributed without any warranty; without even the implied +# warranty of merchantability or fitness for a particular purpose. +# See "COPYING" in the source distribution for more information. +# +# $Id$ +# + +from sdapplet.pluginutils import * +import subprocess + +class plugin_xvncviewer: + def __init__(self): + self.service_type = ["_rfb._tcp"] + self.author = "Sebastien Estienne" + self.description = "Start a VNC connections with xvncviewer" + + def connect(self, use_host_names, name, stype, hostname, address, port, txts): + print "connecting using xvncviewer" + cmdline = ["@toolsdir@/exec_wrapper", "xvncviewer", "-xrm", "*passwordDialog:true", hostname ] + print cmdline + pid = subprocess.Popen(cmdline, close_fds=True).pid + +def load(): + return plugin_xvncviewer() diff --git a/po/POTFILES.in b/po/POTFILES.in index b58afe6..9f82a30 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -2,12 +2,12 @@ # List of source files containing translatable strings. # Please keep this file sorted alphabetically. -plugins/ekiga.py -plugins/gconfterminal.py -plugins/nautilus.py -plugins/xvncviewer.py +plugins/ekiga.py.in +plugins/gconfterminal.py.in +plugins/nautilus.py.in +plugins/xvncviewer.py.in schemas/service-discovery-applet.schemas.in -servers/GNOME_ServiceDiscoveryApplet.server.in +servers/GNOME_ServiceDiscoveryApplet.server.in.in src/service-discovery-applet.in src/service-discovery-config.glade src/service-discovery-config.in diff --git a/po/service-discovery-applet.pot b/po/service-discovery-applet.pot deleted file mode 100644 index 8a5cc33..0000000 --- a/po/service-discovery-applet.pot +++ /dev/null @@ -1,176 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2006-06-29 23:12+0200\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=CHARSET\n" -"Content-Transfer-Encoding: 8bit\n" - -#: ../plugins/gconfterminal.py:31 ../src/service-discovery-applet.in:50 -#: ../src/service-discovery-config.in:41 -#, c-format, python-format -msgid "" -"A required python module is missing!\n" -"%s" -msgstr "" - -#: ../plugins/gconfterminal.py:43 -msgid "SSH Connection" -msgstr "" - -#: ../plugins/gconfterminal.py:53 -#, python-format -msgid "" -"Connecting to %s.\n" -"Please enter your login:" -msgstr "" - -#: ../schemas/service-discovery-applet.schemas.in.h:1 -msgid "Browse for your own services" -msgstr "" - -#: ../schemas/service-discovery-applet.schemas.in.h:2 -msgid "Display notifications" -msgstr "" - -#: ../schemas/service-discovery-applet.schemas.in.h:3 -msgid "First time you start the app?" -msgstr "" - -#: ../schemas/service-discovery-applet.schemas.in.h:4 -msgid "" -"Use the notification deamon to notify the user when a service is discovered" -msgstr "" - -#: ../servers/GNOME_ServiceDiscoveryApplet.server.in.h:1 -msgid "" -"Show Zeroconf Services on your local network and allow accessing them easily" -msgstr "" - -#: ../servers/GNOME_ServiceDiscoveryApplet.server.in.h:2 -#: ../src/service-discovery-applet.in:174 -#: ../src/service-discovery-applet.in:215 -#: ../src/service-discovery-applet.in:398 -#: ../src/service-discovery-applet.in:520 -msgid "Zeroconf Service Discovery" -msgstr "" - -#: ../src/service-discovery-applet.in:105 -#: ../src/service-discovery-applet.in:422 -msgid "You need at least avahi 0.6.9" -msgstr "" - -#: ../src/service-discovery-applet.in:162 -#, c-format -msgid "" -"Name : %s\n" -"Type : %s (%s)" -msgstr "" - -#: ../src/service-discovery-applet.in:165 -msgid "New service found" -msgstr "" - -#: ../src/service-discovery-applet.in:167 -msgid "Service disappeared" -msgstr "" - -#: ../src/service-discovery-applet.in:228 -msgid "_About" -msgstr "" - -#: ../src/service-discovery-applet.in:228 -msgid "_Preferences" -msgstr "" - -#: ../src/service-discovery-applet.in:385 -msgid "No services found" -msgstr "" - -#: ../src/service-discovery-applet.in:399 -msgid "Copyright (C) 2005 Sebastien Estienne" -msgstr "" - -#: ../src/service-discovery-applet.in:400 -msgid "" -"Shows Zeroconf Services on your local network and allows accessing them " -"easily" -msgstr "" - -#: ../src/service-discovery-applet.in:402 -msgid "translator-credits" -msgstr "" - -#: ../src/service-discovery-applet.in:416 -msgid "Already Discovering" -msgstr "" - -#: ../src/service-discovery-applet.in:426 -msgid "Error Detected!" -msgstr "" - -#: ../src/service-discovery-applet.in:426 -msgid "Check that the Avahi daemon is running!" -msgstr "" - -#: ../src/service-discovery-applet.in:429 -msgid "Starting discovery" -msgstr "" - -#: ../src/service-discovery-applet.in:444 -msgid "Discovery already stopped" -msgstr "" - -#: ../src/service-discovery-applet.in:450 -msgid "Discovery stopped" -msgstr "" - -#: ../src/service-discovery-config.glade.h:1 -msgid "Advanced options:" -msgstr "" - -#: ../src/service-discovery-config.glade.h:2 -msgid "Service types that will be browsed:" -msgstr "" - -#: ../src/service-discovery-config.glade.h:3 -msgid "Advanced" -msgstr "" - -#: ../src/service-discovery-config.glade.h:4 -msgid "Services" -msgstr "" - -#: ../src/service-discovery-config.glade.h:5 -msgid "Zeroconf Service Discovery Preferences" -msgstr "" - -#: ../src/service-discovery-config.glade.h:6 -msgid "_Browse services published on this machine" -msgstr "" - -#: ../src/service-discovery-config.glade.h:7 -msgid "_Display notifications" -msgstr "" - -#: ../src/service-discovery-config.glade.h:8 -msgid "services informations" -msgstr "" - -#: ../src/service-discovery-config.in:95 -msgid "Enabled" -msgstr "" - -#: ../src/service-discovery-config.in:107 -msgid "Service type" -msgstr "" diff --git a/tools/Makefile.am b/tools/Makefile.am new file mode 100644 index 0000000..3cd6b4e --- /dev/null +++ b/tools/Makefile.am @@ -0,0 +1,14 @@ +toolsdir = $(TOOLSDIR) + +tools_SCRIPTS = \ + exec_wrapper + +exec_wrapper: exec_wrapper.in + sed \ + -e 's,@PYTHON\@,$(PYTHON),g' \ + $< > $@ + chmod +x $@ + +EXTRA_DIST = exec_wrapper.in + +CLEANFILES = exec_wrapper diff --git a/tools/exec_wrapper.in b/tools/exec_wrapper.in new file mode 100644 index 0000000..c9d85ac --- /dev/null +++ b/tools/exec_wrapper.in @@ -0,0 +1,58 @@ +#!@PYTHON@ +# -*- coding: UTF-8 -*- +# -*- python -*- +# Copyright (C) 2006 by Sebastien Estienne +# +# This file may be distributed and/or modified under the terms of +# the GNU General Public License version 2 as published by +# the Free Software Foundation. +# This file is distributed without any warranty; without even the implied +# warranty of merchantability or fitness for a particular purpose. +# See "COPYING" in the source distribution for more information. +# +# $Id$ +# + +import sys +import os +import pygtk +import gtk + + +from subprocess import * +from string import join, replace + +pygtk.require('2.0') + +def error_msg(msg): + d = gtk.MessageDialog(parent=None, flags=gtk.DIALOG_MODAL, + type=gtk.MESSAGE_ERROR, buttons=gtk.BUTTONS_OK) + d.set_markup(msg) + d.show_all() + d.run() + d.destroy() + +def remove_markup(msg): + msg = replace(msg, "&" , "&") + msg = replace(msg, "<" , "<") + msg = replace(msg, ">" , ">") + return msg + +def main(argv): + if len(argv) < 2: + print "Not enought arguments." + sys.exit(1) + + argv.pop(0) + + try: + p = Popen(argv, close_fds=True, stderr = PIPE) + except OSError, e: + error_msg("An error has occured!\n\nCommand: %s\nError: %s" % (join(argv, " "), e)) + else: + status = os.waitpid(p.pid, 0) + if status[1] != 0: + error_msg(remove_markup(p.stderr.read())) + +if __name__ == "__main__": + main(sys.argv) -- cgit