From: Pali Rohár Date: Fri, 22 Jun 2012 12:11:03 +0000 (+0200) Subject: Imported Upstream version 0.0.2 X-Git-Url: http://git.maemo.org/git/?p=callnotify;a=commitdiff_plain;h=098da75d104adf550876a398c13cbd95f2faec09;ds=sidebyside Imported Upstream version 0.0.2 --- diff --git a/debian/changelog b/debian/changelog index 12ca277..071a601 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,5 +1,6 @@ -callnotify (0.0.1-1) stable; urgency=low +callnotify (0.0.2-1) stable; urgency=low - * no changelog + * Fixed - IM messages would trigger the notification as well. + * Notification will stop when screen is off to save battery. - -- Omer Agmon Sat, 27 Mar 2010 14:45:34 +0000 + -- Omer Agmon Sun, 28 Mar 2010 13:39:41 +0000 diff --git a/debian/control b/debian/control index 7797e42..46e098c 100644 --- a/debian/control +++ b/debian/control @@ -10,8 +10,8 @@ Architecture: all Depends: python2.5, python-osso, python-dbus, python2.5-gtk2, python-hildondesktop Description: Call and SMS notifier. Will display a small status bar icon for missed Calls and SMS. - The icon will disappear after closwing the yellow notification or viewing the SMS. -XSBC-Bugtracker: http://bugs.maemo.org + The icon will disappear after closing the yellow notification or viewing the SMS. +XSBC-Bugtracker: http://talk.maemo.org/showthread.php?t=48501 XB-Maemo-Icon-26: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACx jwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAZdEVYdFNvZnR3YXJlAFBhaW50Lk5FVCB2My41 diff --git a/debian/copyright b/debian/copyright index ee23c48..810fef9 100644 --- a/debian/copyright +++ b/debian/copyright @@ -1,5 +1,5 @@ This package was py2debianized(0.5.3) by Omer Agmon on -Sat, 27 Mar 2010 14:45:34 +0000. +Sun, 28 Mar 2010 13:39:41 +0000. It was downloaded from diff --git a/debian/dirs b/debian/dirs index a492fa3..04d55c1 100644 --- a/debian/dirs +++ b/debian/dirs @@ -1,3 +1,4 @@ usr/lib/hildon-desktop/ usr/share/CallNotify/ -usr/share/application/hildon-status-menu/ \ No newline at end of file +usr/share/application/hildon-status-menu/ +usr/share/applications/hildon-status-menu/ \ No newline at end of file diff --git a/debian/postinst b/debian/postinst new file mode 100644 index 0000000..27fa7f2 --- /dev/null +++ b/debian/postinst @@ -0,0 +1,2 @@ +#!/bin/sh + killall hildon-status-menu \ No newline at end of file diff --git a/debian/postrm b/debian/postrm new file mode 100644 index 0000000..27fa7f2 --- /dev/null +++ b/debian/postrm @@ -0,0 +1,2 @@ +#!/bin/sh + killall hildon-status-menu \ No newline at end of file diff --git a/debian/rules b/debian/rules index c8eae67..6c38520 100755 --- a/debian/rules +++ b/debian/rules @@ -48,6 +48,10 @@ install: build # mkdir -p "$(CURDIR)/debian/callnotify/usr/lib/hildon-desktop/" cp -a "src/usr/lib/hildon-desktop/CallNotify.py" "$(CURDIR)/debian/callnotify/usr/lib/hildon-desktop/CallNotify.py" + mkdir -p "$(CURDIR)/debian/callnotify/usr/lib/hildon-desktop/" + cp -a "src/usr/lib/hildon-desktop/CallNotify.pyo" "$(CURDIR)/debian/callnotify/usr/lib/hildon-desktop/CallNotify.pyo" + mkdir -p "$(CURDIR)/debian/callnotify/usr/share/applications/hildon-status-menu/" + cp -a "src/usr/share/applications/hildon-status-menu/CallNotify.desktop" "$(CURDIR)/debian/callnotify/usr/share/applications/hildon-status-menu/CallNotify.desktop" mkdir -p "$(CURDIR)/debian/callnotify/usr/share/CallNotify/" cp -a "src/usr/share/CallNotify/1.png" "$(CURDIR)/debian/callnotify/usr/share/CallNotify/1.png" mkdir -p "$(CURDIR)/debian/callnotify/usr/share/CallNotify/" diff --git a/src/usr/lib/hildon-desktop/CallNotify.py b/src/usr/lib/hildon-desktop/CallNotify.py index d05e5d6..1722673 100644 --- a/src/usr/lib/hildon-desktop/CallNotify.py +++ b/src/usr/lib/hildon-desktop/CallNotify.py @@ -4,6 +4,7 @@ import hildondesktop import sqlite3 import time import dbus +import osso from dbus.mainloop.glib import DBusGMainLoop @@ -24,7 +25,13 @@ class CallNotify(hildondesktop.StatusMenuItem): self.missedSMS = self.getMissedCallsCount(True) self.missedLastCall = self.missed self.missedLastSMS = self.missedSMS - gobject.timeout_add(5000, self.handleMissedCall) + + # Register to handle screen off/on events + osso_c = osso.Context("osso_test_device_on", "0.0.1", False) + device = osso.DeviceState(osso_c) + device.set_display_event_cb(self.state_cb) + + self.tmr_main = gobject.timeout_add(5000, self.handleMissedCall) # add d-bus listener for removing notification after viewing missed call # Doing timeout_add with return False instead of explicitly raising a thread @@ -47,6 +54,16 @@ class CallNotify(hildondesktop.StatusMenuItem): self.imgList.append(gtk.gdk.pixbuf_new_from_file_at_size("/usr/share/CallNotify/5.png",18,18)) self.imgList.append(gtk.gdk.pixbuf_new_from_file_at_size("/usr/share/CallNotify/more.png",18,18)) + # Screen off event-handler + def state_cb(self, state): + if state == osso.device_state.OSSO_DISPLAY_OFF: + gobject.source_remove(self.tmr_main) + gobject.source_remove(self.tmr_ptr) + elif state == osso.device_state.OSSO_DISPLAY_ON: + self.tmr_main = gobject.timeout_add(5000, self.handleMissedCall) + self.show() + return False + # Method to define the way to add dbus signal receiver def startDbusListeners(self): DBusGMainLoop(set_as_default=True) @@ -54,19 +71,20 @@ class CallNotify(hildondesktop.StatusMenuItem): #bus.add_signal_receiver(self.stop_notification, "NotificationClosed", "org.freedesktop.Notifications", "org.freedesktop.Notifications", "/org/freedesktop/Notifications") #bus.add_signal_receiver(self.handleMissedCall, "Notify", None, None, None) #bus.add_signal_receiver(self.handleMissedCall, "MembersChanged", None, None, None) - bus.add_signal_receiver(self.smsReceived, "Received", "org.freedesktop.Telepathy.Channel.Type.Text", None, None) + bus.add_signal_receiver(self.smsReceived, "MessageReceived", None, None, None) bus.add_signal_receiver(self.smsRead, "NotificationClosed", "org.freedesktop.Notifications", None, "/org/freedesktop/Notifications") gobject.MainLoop().run() return False - def smsReceived(self, a, b, c, d, e, f): - if self.missedLastSMS == self.getMissedCallsCount(True): - if self.msgType == "Call": - self.msgType = "Both" - else: - self.msgType = "SMS" - self.show() - self.missedLastSMS = self.getMissedCallsCount(True) + def smsReceived(self, a): + if a[0].has_key('message-type'): + if self.missedLastSMS == self.getMissedCallsCount(True): + if self.msgType == "Call": + self.msgType = "Both" + else: + self.msgType = "SMS" + self.show() + self.missedLastSMS = self.getMissedCallsCount(True) def smsRead(self, a): self.stop_notification(a) @@ -133,7 +151,7 @@ class CallNotify(hildondesktop.StatusMenuItem): index = self.getMissedCallsCount(isSMS) - counter - 1 if index >= 5: index = 5 - if index < 0 + if index < 0: index = 0 if self.msgType != "Both": img = self.imgList[index] diff --git a/src/usr/lib/hildon-desktop/CallNotify.pyo b/src/usr/lib/hildon-desktop/CallNotify.pyo new file mode 100644 index 0000000..72633cf Binary files /dev/null and b/src/usr/lib/hildon-desktop/CallNotify.pyo differ diff --git a/src/usr/share/CallNotify/sms.png b/src/usr/share/CallNotify/sms.png index d8b144f..a75b457 100644 Binary files a/src/usr/share/CallNotify/sms.png and b/src/usr/share/CallNotify/sms.png differ diff --git a/src/usr/share/applications/hildon-status-menu/CallNotify.desktop b/src/usr/share/applications/hildon-status-menu/CallNotify.desktop new file mode 100644 index 0000000..8e0f54a --- /dev/null +++ b/src/usr/share/applications/hildon-status-menu/CallNotify.desktop @@ -0,0 +1,5 @@ +[Desktop Entry] +Name=CallNotify +Type=python +X-Path=CallNotify +