summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastien Estienne <sebastien.estienne@gmail.com>2005-10-02 18:12:47 +0000
committerSebastien Estienne <sebastien.estienne@gmail.com>2005-10-02 18:12:47 +0000
commit392c5a73f748f76ae223bc47d8a90743d16a5fc1 (patch)
tree4708bf7905bb5bb4a5b7a65f5e7cd9fdb69ab661
parent2bbf4f654ab32b899f591475601d5d1a2571cc4f (diff)
* fix bugs
* adding a 1s timeout before displaying notifications git-svn-id: file:///home/lennart/svn/public/service-discovery-applet/trunk@29 3be567f1-68ff-0310-b24a-ad7cc433fd2f
-rwxr-xr-xsrc/service-discovery-applet.in35
1 files changed, 19 insertions, 16 deletions
diff --git a/src/service-discovery-applet.in b/src/service-discovery-applet.in
index 7160e73..65b95b3 100755
--- a/src/service-discovery-applet.in
+++ b/src/service-discovery-applet.in
@@ -80,11 +80,11 @@ class ServiceDiscoveryApplet(gnomeapplet.Applet):
self.gc_client.add_dir (self.gc_options, gconf.CLIENT_PRELOAD_NONE)
self.show_local_services = self.gc_client.get_bool ("%s/%s" % (self.gc_options,"show_local_services"))
- self.show_notifications = self.gc_client.get_bool ("%s/%s" % (self.gc_options,"show_notifications"))
-
+ self.show_notifications = False
+
self.gc_client.add_dir (self.gc_services, gconf.CLIENT_PRELOAD_NONE)
- self.gc_client.notify_add (self.gc_services, self.gc_services_cb,None)
- self.gc_client.notify_add (self.gc_options, self.gc_options_cb, None)
+ self.gc_client.notify_add (self.gc_services, self.gc_services_cb)
+ self.gc_client.notify_add (self.gc_options, self.gc_options_cb)
self.eb = gtk.EventBox()
self.eb.set_events(gtk.gdk.POINTER_MOTION_MASK)
@@ -132,9 +132,15 @@ class ServiceDiscoveryApplet(gnomeapplet.Applet):
self.session_bus = dbus.SessionBus()
obj = self.session_bus.get_object("org.freedesktop.Notifications", "/org/freedesktop/Notifications")
self.notif = dbus.Interface(obj, "org.freedesktop.Notifications")
-
+
self.applet.show_all()
+ gobject.timeout_add(1000, self.start_notifying_cb)
+
+ def start_notifying_cb(self):
+ print "start notifying"
+ self.show_notifications = self.gc_client.get_bool ("%s/%s" % (self.gc_options,"show_notifications"))
+
def siocgifname(self, interface):
if interface <= 0:
return "any"
@@ -274,7 +280,6 @@ class ServiceDiscoveryApplet(gnomeapplet.Applet):
applet_width = self.applet.allocation.width
applet_height = self.applet.allocation.height
widget_width ,widget_height = widget.size_request()
- print x, y,applet_width, applet_height,widget_height, widget_width
orientation = self.applet.get_orient()
if orientation == gnomeapplet.ORIENT_UP:
y -= widget_height
@@ -287,16 +292,14 @@ class ServiceDiscoveryApplet(gnomeapplet.Applet):
return (x, y, True)
def on_button_press(self, widget, event):
- if event.type == gtk.gdk.BUTTON_PRESS and event.button == 3:
- return False
- elif event.type == gtk.gdk.BUTTON_PRESS and event.button == 1:
+ if event.type == gtk.gdk.BUTTON_PRESS and event.button == 1:
self.service_menu.show_all()
self.service_menu.popup(None, None, self.position_popup_cb, event.button, event.time)
- return True
-
+ return False
+
def on_eventbox_size_allocate(self, eventbox, rect):
if (rect.x <= 0) or (rect.y <= 0):
- return False
+ return False
rect.x -= 1
rect.y -= 1
rect.width += 2
@@ -352,7 +355,7 @@ class ServiceDiscoveryApplet(gnomeapplet.Applet):
return
for service in self.service_browsers.copy():
- del_service_type(service[0],service[1],service[2],service[3])
+ self.del_service_type(service[0],service[1],service[2],service[3])
domain = ""
# Callback called when a service is added/removed/enabled/disabled in gconf
@@ -362,13 +365,13 @@ class ServiceDiscoveryApplet(gnomeapplet.Applet):
if client.get_bool(gc_entry.key) == True:
# Browse for a new service
print "browse %s" % (service_type)
- add_service_type(self.interface, self.protocol, service_type, self.domain)
+ self.add_service_type(self.interface, self.protocol, service_type, self.domain)
else:
# Stop browsing for a service
print "remove %s" % (service_type)
- del_service_type(self.interface, self.protocol, service_type, self.domain)
+ self.del_service_type(self.interface, self.protocol, service_type, self.domain)
- def gc_options_cb (self, client, cnxn_id, gc_entry):
+ def gc_options_cb (self, client, cnxn_id, gc_entry, data):
key = os.path.basename(gc_entry.key)
if key == "show_notifications":
self.show_notifications = client.get_bool(gc_entry.key)