From 098da75d104adf550876a398c13cbd95f2faec09 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Pali=20Roh=C3=A1r?= Date: Fri, 22 Jun 2012 14:11:03 +0200 Subject: [PATCH 1/1] Imported Upstream version 0.0.2 --- debian/changelog | 7 ++-- debian/control | 4 +- debian/copyright | 2 +- debian/dirs | 3 +- debian/postinst | 2 + debian/postrm | 2 + debian/rules | 4 ++ src/usr/lib/hildon-desktop/CallNotify.py | 40 ++++++++++++++------ src/usr/lib/hildon-desktop/CallNotify.pyo | Bin 0 -> 4885 bytes src/usr/share/CallNotify/sms.png | Bin 818 -> 374 bytes .../hildon-status-menu/CallNotify.desktop | 5 +++ 11 files changed, 51 insertions(+), 18 deletions(-) create mode 100644 debian/postinst create mode 100644 debian/postrm create mode 100644 src/usr/lib/hildon-desktop/CallNotify.pyo create mode 100644 src/usr/share/applications/hildon-status-menu/CallNotify.desktop 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 0000000000000000000000000000000000000000..72633cfce7e4179fd1863a76c3f0300da593abc7 GIT binary patch literal 4885 zcmb7ITaO$$6?XM?sxzHT639gfFbi7L0nx*5mIu(XpiJ0kb~Bw-bry+!DQc=b-Ib|J zr|ixJHV-HW@k4m#g;#z9zk_GQJAB`9Rrh3-ol(-UV;{Th#3wGlDDlX^J6$5z-@wj+%$ z>$FEJc+iYvePy?#;mg>7Q}HQ>E;N#@MzSpuk%vQRizK|L>?M`%@Q~c#vU=T8UM-TH z(<>rMRBiBy`2p13Ta>xpTNz#LjVl|M`A_sSUD&Lg&mq#;I61>qWUk6J3_-< z(IU-~v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{vdO9`LZaZ_YDlT&1qa&aO>CSg{Woms=tO`{ zyarcMNtSh#rNzks)DAwT{2h3Ouv?-ST2QqH-VLWYO+z3GR)!!{r+Il_G)D&-QUuUA zsGN>-9O!U>XJ7|sa`X?rm=^zZLYV@!896A21uBTWehtn>*wi>dT$b zS`#6Ac#0el6&jBF<^3K=+9QmAn*(&n;CrmdA&$a?%!J1zYVTs;6g#1Pejlx#Gcg~w5WFW`!JWG!P vNL4^C47itM(~BfrW~+IMmkj9VTqVsGKK$63;u9`nNaK7{H@}_s&AWe9 literal 0 HcmV?d00001 diff --git a/src/usr/share/CallNotify/sms.png b/src/usr/share/CallNotify/sms.png index d8b144f2771470982e6895eaee5a6e933874c08b..a75b457bbb33ca6cd59a04c1a925b6c326f3a0ea 100644 GIT binary patch literal 374 zcmeAS@N?(olHy`uVBq!ia0vp^LLkh+0wn(&ce?|mn3BBRT^Rni_n+Ah2>8 zUk71ECym(^Ai=T%$8;bK*2|!5k>>^E)Oor%hG?8m{&C(x!YCkAP|;!4qV@lq19Ui< zx)x~8;yhCSfBJ!`Qy3}*0##f&62%l;G8}`Ce6WA{-(MkHUEm-4rb+*d6SOA%sF(Gq zXZh^#q;vttETxV~umAV{k7sjA*6?Qvy;!;<&Q2kvA=`stuaAPKS|I6tkVJh3R1p}f3YFEcN@I61K(RWH9NefB#WDWD<- MPgg&ebxsLQ05pGeL;wH) delta 806 zcmV+>1KIrc08Gi-<0036bj#mHx00DDSM?wIu&K&6g000DMK}|sb0I`n?{9y$E z000SaNLh0L01m?d01m?e$8V@)0000PbVXQnQ*UN;cVTj608n9RZgehAMN}YmGcGkQ zG(L^Yb^rhZqDe$SR5(wylgUpLVHk&J3W6YtON@H(Z}1;6UVprss0R}hgDVG!5@W4pq zQMIBV7M8m48GoDj9DD}q3j)*kkS3e)&pcA=Wc-iCIz{U zg13R(d^5r6M?@U2wqQG#bxhPCGwmo74P;&Ql;JZ(r>?NBv|{LcfNi3i zy*t4^bhls|d`#N$1mDPc@LnTfJWF`&G%Vf4udl;4(tpVObO&DBq&9>kMFnbfT|%}H zuy$eYYb4`(NYYY|Z}c1y<7EPdt4L!FObs=YPdV`WBo-IdV$c>@jR#N{ok*q*^u6~n z_us)b+=Ra87DF$uV>h(nwDzK^LDaQ1Om?|6$R7@o&1FbLWwNPxtdp;K-`hgaJ%-0V z%D|g;qJJ?z!9*N`!;L+ZDgi3561~wBvE>|2_X4R*7MIh*jMar_UZDWwzCa+piWExX ziliBLDWyO)VtC~%OL>?Jt>TSp{<1dx*e1~xt?$tSN_+#OGmIQtXVl`MwQH~hsOG57 zr%}w(B4&4rw|W^R4O8wFtPAUyJuBG#S%yt+41e|j1LGFrtKUlZD3;#D=1npi&NE>2 zp?7B({1{@?7Ncuy7K^MhBPWo&acU2p)TC0mEtli_@% 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 + -- 1.7.9.5