From 7b771b3f042669e5d763864dd69560c4e2a5bb8d Mon Sep 17 00:00:00 2001 From: Sebastien Estienne Date: Sat, 17 Sep 2005 13:40:38 +0000 Subject: * updated docs * added a schema git-svn-id: file:///home/lennart/svn/public/service-discovery-applet/trunk@13 3be567f1-68ff-0310-b24a-ad7cc433fd2f --- INSTALL | 2 +- Makefile.am | 1 + README | 2 -- bootstrap.sh | 3 -- configure.ac | 44 +++++++++++++++++++++++----- schemas/Makefile.am | 16 ++++++++++ schemas/service-discovery-applet.schemas | 50 ++++++++++++++++++++++++++++++++ src/service-discovery-applet.in | 34 +++++++++++++--------- 8 files changed, 126 insertions(+), 26 deletions(-) create mode 100644 schemas/Makefile.am create mode 100644 schemas/service-discovery-applet.schemas diff --git a/INSTALL b/INSTALL index d476121..315415f 100644 --- a/INSTALL +++ b/INSTALL @@ -1 +1 @@ -./configure --prefix=/usr && make && make install +./configure --prefix=/usr --sysconfdir=/etc && make && make install diff --git a/Makefile.am b/Makefile.am index b3ef3b1..fe4946f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -2,6 +2,7 @@ SUBDIRS = \ common \ src \ icons \ + schemas \ scripts \ servers diff --git a/README b/README index 696ce3d..304ec7d 100644 --- a/README +++ b/README @@ -4,8 +4,6 @@ You should test that the applet is functionning with the following command: $ /usr/bin/service-discovery-applet -window before trying to put it in your panel -To add support for more service type, edit $(prefix)/bin/service-discovery-applet, and look the following variable: "type_browsed" - To add actions when you click on a specified service, add a file in $(prefix)/share/service-discovery-applet/scripts, you must name it type.sh (eg: _ssh._tcp.sh), look at the included scripts to know how to access ADDRESS, PORT and TXT records. To add icons for services in the applet, just drop a png named TYPE.png (eg: _ssh._tcp.png) in $(prefix)/share/service-discovery-applet/icons diff --git a/bootstrap.sh b/bootstrap.sh index 04b8a22..d920bac 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -37,11 +37,8 @@ else rm -f config.cache run_versioned aclocal "$VERSION" -I common - autoheader run_versioned automake "$VERSION" -a -c --foreign autoconf -Wall ./configure "$@" - - make clean fi diff --git a/configure.ac b/configure.ac index 5f293d7..7adf226 100644 --- a/configure.ac +++ b/configure.ac @@ -1,36 +1,66 @@ -AC_PREREQ(2.57) -AC_INIT([service-discovery-applet], [0.1], [sebastien (dot) estienne (at) gmail (dot) com]) +AC_PREREQ(2.59) +AC_INIT([service-discovery-applet],[0.1],[sebastien (dot) estienne (at) gmail (dot) com]) AC_CONFIG_SRCDIR([src/service-discovery-applet.in]) -AC_CONFIG_HEADERS([config.h]) AM_INIT_AUTOMAKE([foreign 1.9 -Wall]) AC_SUBST(VERSION) AM_MAINTAINER_MODE +dnl ======================================================== +dnl Check for python and some modules +dnl ======================================================== AM_PATH_PYTHON([2.4]) AM_CHECK_PYMOD(gtk,,,[AC_MSG_ERROR(Could not find Python module pygtk)]) AM_CHECK_PYMOD(dbus,,,[AC_MSG_ERROR(Could not find Python module dbus)]) AM_CHECK_PYMOD(avahi,,,[AC_MSG_ERROR(Could not find Python module avahi)]) -AM_CHECK_PYMOD(gnomeapplet,,,[AC_MSG_ERROR(Could not find Python module gnomeapplet)]) +# disable because it needs a DISPLAY +# AM_CHECK_PYMOD(gnomeapplet,,,[AC_MSG_ERROR(Could not find Python module gnomeapplet)]) +dnl ======================================================== +dnl Directory where services' scripts will be installed +dnl ======================================================== SCRIPTSDIR="${datadir}/${PACKAGE}/scripts/" AC_SUBST(SCRIPTSDIR) +dnl ======================================================== +dnl Directory where services' icons will be installed +dnl ======================================================== ICONSDIR="${datadir}/${PACKAGE}/icons/" AC_SUBST(ICONSDIR) +dnl ======================================================== +dnl Directory where glade interfaces will be installed +dnl ======================================================== INTERFACESDIR="${datadir}/${PACKAGE}/interfaces/" AC_SUBST(INTERFACESDIR) +dnl ======================================================== +dnl This is to check correct gconf installation +dnl ======================================================== +AM_GCONF_SOURCE_2 + +dnl ======================================================== AC_CONFIG_FILES([ Makefile common/Makefile - src/Makefile - scripts/Makefile - servers/Makefile icons/Makefile icons/24x24/Makefile icons/48x48/Makefile + schemas/Makefile + scripts/Makefile + servers/Makefile + src/Makefile ]) AC_OUTPUT + +dnl ======================================================== +dnl Summary +dnl ======================================================== +echo " + ---{ $PACKAGE_NAME $VERSION }--- + + prefix: ${prefix} + sysconfdir: ${sysconfdir} + gconf config source: ${GCONF_SCHEMA_CONFIG_SOURCE} +" diff --git a/schemas/Makefile.am b/schemas/Makefile.am new file mode 100644 index 0000000..207c0a3 --- /dev/null +++ b/schemas/Makefile.am @@ -0,0 +1,16 @@ +SCHEMAS_FILE = service-discovery-applet.schemas + +EXTRA_DIST = $(SCHEMAS_FILE) + +schemasdir = $(GCONF_SCHEMA_FILE_DIR) +schemas_DATA = $(SCHEMAS_FILE) + +install-schemas: + GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) gconftool-2 --makefile-install-rule $(SCHEMAS_FILE) 2>&1 > /dev/null + gconftool-2 --shutdown + +if GCONF_SCHEMAS_INSTALL +install-data-local: install-schemas +else +install-data-local: +endif diff --git a/schemas/service-discovery-applet.schemas b/schemas/service-discovery-applet.schemas new file mode 100644 index 0000000..563f51f --- /dev/null +++ b/schemas/service-discovery-applet.schemas @@ -0,0 +1,50 @@ + + + + /schemas/apps/service-discovery-applet/options/show_notifications + /apps/service-discovery-applet/options/show_notifications + service-discovery-applet + bool + TRUE + + Display notifications. + + Use the notification deamon to notify the user when a service is discovered. + + + + + /schemas/apps/service-discovery-applet/services/_ssh._tcp + /apps/service-discovery-applet/services/_ssh._tcp + service-discovery-applet + bool + TRUE + + + + + + + /schemas/apps/service-discovery-applet/services/_https._tcp + /apps/service-discovery-applet/services/_https._tcp + service-discovery-applet + bool + TRUE + + + + + + + /schemas/apps/service-discovery-applet/services/_http._tcp + /apps/service-discovery-applet/services/_http._tcp + service-discovery-applet + bool + TRUE + + + + + + + diff --git a/src/service-discovery-applet.in b/src/service-discovery-applet.in index 54cb45e..14d3668 100755 --- a/src/service-discovery-applet.in +++ b/src/service-discovery-applet.in @@ -27,22 +27,30 @@ import sys import pygtk 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() + try: - import avahi, gobject, dbus + import avahi + import dbus + import gtk + import gnomeapplet + import gnome.ui + from gconf import client, client_get_default except ImportError: - print "Sorry, to use this tool you need to install Avahi, pygtk and python-dbus." - sys.exit(1) + error_msg("Sorry, to use this tool you need to install Avahi, pygtk and python-dbus.") + try: import dbus.glib except ImportError, e: pass -import gtk -import gnomeapplet -import gnome -import gnome.ui -import gconf # Gconf Paths gc_options = "/apps/service-discovery-applet/options" @@ -68,7 +76,6 @@ zc_pretty_name = {'_ssh._tcp' : 'SSH Servers', menuZC = gtk.ImageMenuItem() menubar = gtk.MenuBar() - def siocgifname(interface): global server @@ -225,7 +232,7 @@ def on_change_background(panelapplet, backgroundtype, color, pixmap): # s3.bg_pixmap[gtk.STATE_NORMAL] = pixmap if backgroundtype == gnomeapplet.COLOR_BACKGROUND: - print "COLOR_BACKGROUP" + print "COLOR_BACKGROUND" if backgroundtype == gnomeapplet.NO_BACKGROUND: print "NO_BACKGROUND" @@ -342,10 +349,10 @@ def ServiceDiscoveryApplet_factory(applet, iid): gc_client.notify_add (gc_services, gc_services_cb,None) # Applet MenuItem - menuZC = gtk.ImageMenuItem() - menuZC.add(gtk.Label('ZeroConf')) image = gtk.Image() image.set_from_file("@iconsdir@/24x24/service-discovery-applet.png") + menuZC = gtk.ImageMenuItem() + menuZC.add(gtk.Label('ZeroConf')) menuZC.set_image(image) menuZC.set_right_justified(True) menuZC.set_submenu(service_menu); @@ -367,8 +374,9 @@ def ServiceDiscoveryApplet_factory(applet, iid): menubar.add(menuZC) #expand the applet with the panel -# applet.connect("change_background", on_change_background) + applet.connect("change_background", on_change_background) applet.set_applet_flags(gnomeapplet.EXPAND_MINOR) + #applet.add(menuZC) applet.add(menubar) applet.show_all() -- cgit