diff options
author | Guido Günther <agx@sigxcpu.org> | 2011-08-14 14:12:42 +0200 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2011-08-14 14:12:42 +0200 |
commit | d28d89518e22d1f2b29e01b94703d5c84a124849 (patch) | |
tree | 91452d7ae09638a8770bc83f651e0167bd99e034 | |
parent | c364ef7722829418c2054420fb6cb4930ce8837d (diff) | |
parent | 04ae3ade85928efd5513e138a7cedcaaeb675e4c (diff) |
Merge commit 'v0.0.2' into debian/sid
-rw-r--r-- | ChangeLog | 190 | ||||
-rw-r--r-- | NEWS | 7 | ||||
-rw-r--r-- | TODO | 1 | ||||
-rw-r--r-- | configure.ac | 12 | ||||
-rw-r--r-- | data/Makefile.am | 2 | ||||
-rw-r--r-- | data/icons/128x128/Makefile.am | 9 | ||||
-rw-r--r-- | data/icons/128x128/ppm.png | bin | 0 -> 4655 bytes | |||
-rw-r--r-- | data/icons/32x32/Makefile.am | 9 | ||||
-rw-r--r-- | data/icons/32x32/ppm.png | bin | 0 -> 1043 bytes | |||
-rw-r--r-- | data/icons/48x48/Makefile.am | 9 | ||||
-rw-r--r-- | data/icons/48x48/ppm.png | bin | 0 -> 1648 bytes | |||
-rw-r--r-- | data/icons/64x64/Makefile.am | 9 | ||||
-rw-r--r-- | data/icons/64x64/ppm.png | bin | 0 -> 2269 bytes | |||
-rw-r--r-- | data/icons/Makefile.am | 14 | ||||
-rw-r--r-- | data/icons/scalable/Makefile.am | 9 | ||||
-rw-r--r-- | data/icons/scalable/ppm.svg | 447 | ||||
-rw-r--r-- | src/ppm.ui | 148 | ||||
-rw-r--r-- | src/ppm/Makefile.am | 1 | ||||
-rw-r--r-- | src/ppm/__init__.py.in | 2 | ||||
-rw-r--r-- | src/ppm/modemproxy.py | 86 | ||||
-rw-r--r-- | src/prepaid-manager-applet.desktop.in | 4 | ||||
-rwxr-xr-x | src/prepaid-manager-applet.py | 65 |
22 files changed, 920 insertions, 104 deletions
@@ -0,0 +1,190 @@ +commit 65744bc63c0230a8bfcf39b4723ac1ff68d89f10 +Author: Guido Günther <agx@sigxcpu.org> +Date: Sun Aug 14 14:06:59 2011 +0200 + + Bump version to 0.0.2 + +commit 2fb84acfa4cd7544be829a35b9d4539c870d6c82 +Author: Guido Günther <agx@sigxcpu.org> +Date: Sun Aug 14 14:00:01 2011 +0200 + + Catch exception if getting the provider information fails + + This can happen if the provider disappears from the + mobile-broadband-provider-info db. + +commit 79efa1221be5b77e6e85b19645b602a63ee12860 +Author: Guido Günther <agx@sigxcpu.org> +Date: Thu Jul 28 12:17:49 2011 +0200 + + Use message_type instead of type + + as Gtk.MessageDialog parameter + +commit 337321839f63d7c4d96407b21b9a5430f6a0bbd8 +Author: Guido Günther <agx@sigxcpu.org> +Date: Thu Jul 7 00:14:22 2011 +0200 + + Use GDBus + +commit 407c322971dc68ff4f75038c7fe4b8c47451aaa3 +Author: Guido Günther <agx@sigxcpu.org> +Date: Tue Jul 5 08:59:57 2011 +0200 + + Set correct prgname + + so gnome-shell finds the desktop file: + + http://live.gnome.org/GnomeShell/ApplicationBased + +commit 2df5d870e2b560f63da123f586fc5e5456d42906 +Author: Guido Günther <agx@sigxcpu.org> +Date: Sat Jul 2 16:11:08 2011 +0200 + + Add application icon + +commit c44bb1e2193bcbe09bbdb446994301ee01624b18 +Author: Guido Günther <agx@sigxcpu.org> +Date: Thu Jun 9 18:44:37 2011 +0200 + + Wire up delete-event + +commit e94c7ed0d9fa70e6ec13638e3e362d8fda167c5b +Author: Guido Günther <agx@sigxcpu.org> +Date: Thu Jun 9 18:32:52 2011 +0200 + + Set application name + +commit 1d6e7fb4c6167904e260798ab39bee255f677dec +Author: Guido Günther <agx@sigxcpu.org> +Date: Wed Jun 8 21:47:00 2011 +0200 + + Add an about dialog + +commit 5f47e032fe2b2e8f69fe623e0e25b8e45bb3950a +Author: Guido Günther <agx@sigxcpu.org> +Date: Wed Jun 8 19:21:54 2011 +0200 + + Use main window with menu instead of dialog + +commit 73d2254c229eb9792bcc68a52f4d2750bc074b94 +Author: Guido Günther <agx@sigxcpu.org> +Date: Wed Jun 8 17:55:47 2011 +0200 + + Add Category and enhance Comment + +commit d74980da91745c15e643bd576783a0263275f240 +Author: Guido Günther <agx@sigxcpu.org> +Date: Thu Jun 2 15:18:05 2011 +0200 + + Release 0.0.1.2 + +commit 274ed2ecbf4e1b9d1eca0c6b049e33e78b112905 +Author: Guido Günther <agx@sigxcpu.org> +Date: Thu Jun 2 15:08:46 2011 +0200 + + src/ppm/Makefile.am: genereate __init__.py when Makefile changes + + so we catch updates of ./configure arguments. Otherwise __init__.py + might have old content. + +commit 5f4b48dbfb2d7863f34d83372a636806f6d13c21 +Author: Guido Günther <agx@sigxcpu.org> +Date: Thu Jun 2 13:51:59 2011 +0200 + + autogen.sh was missing from EXTRA_DIST + +commit 703a329daae04fc5ab3a01b407a745003f0817b6 +Author: Guido Günther <agx@sigxcpu.org> +Date: Thu Jun 2 13:50:43 2011 +0200 + + accounts.db was missing from python_DATA + +commit 24714b354d46226c7c195eca8cc97a297b0e363d +Author: Guido Günther <agx@sigxcpu.org> +Date: Wed May 25 21:35:14 2011 +0200 + + Release 0.0.1.1 + +commit 10e21899cc0eb81731f15b8ae9fd97d9a2613741 +Author: Guido Günther <agx@sigxcpu.org> +Date: Wed May 25 21:32:40 2011 +0200 + + Ship prepaid-manager-applet.in + + Reported by: Ankur Sinha + +commit 87690f367da41e30942152f53c131ba9a6763a34 +Author: Guido Günther <agx@sigxcpu.org> +Date: Sun May 1 22:35:38 2011 +0200 + + Releae 0.0.1 + +commit add935ff05e960de47ee8ecccbdc1e48cdd0219d +Author: Guido Günther <agx@sigxcpu.org> +Date: Sun May 1 22:35:15 2011 +0200 + + Add option parser + + se we can enable debugging by default + +commit a2a2aac10c248cc3a7467ca4bbe51bcc5478fdd0 +Author: Guido Günther <agx@sigxcpu.org> +Date: Sun May 1 14:22:57 2011 +0200 + + Set GSETTINGS_SCHEMA_DIR if running from source tree + +commit deda673382bddb0e56429c9e4c9cc645ae37b93b +Author: Guido Günther <agx@sigxcpu.org> +Date: Sun May 1 14:20:10 2011 +0200 + + Add basic build and run instructions + +commit 4b4c334827a8639c246bcbc717288a133d55b754 +Author: Guido Günther <agx@sigxcpu.org> +Date: Sun May 1 13:46:09 2011 +0200 + + Check for dependencies + +commit 8981216d64d501530549836c49fc2844466f9de6 +Author: Guido Günther <agx@sigxcpu.org> +Date: Mon Apr 25 17:41:28 2011 +0200 + + Store known providers and balance in gsettings + + based on the IMSI of the SIM card + +commit 26c0560f6c4a5869859f7daf7e41f73d739e49cd +Author: Guido Günther <agx@sigxcpu.org> +Date: Sun Apr 17 18:19:50 2011 +0200 + + Website is GNOME Wiki + +commit 02f90e8f7dc5707e91a74dabefd661e529a89499 +Author: Guido Günther <agx@sigxcpu.org> +Date: Sun Apr 17 18:17:02 2011 +0200 + + Handle providerdb parsing errors + +commit a6a74fd8d9e55d6827cfd8534cc1c6ad7fc2ee83 +Author: Guido Günther <agx@sigxcpu.org> +Date: Sat Apr 16 18:00:07 2011 +0200 + + Use PyGI instead of pygtk + + and switch to GTK+3 + +commit 0e24147fb4a1f78e40048437301b0795b08eef49 +Author: Guido Günther <agx@sigxcpu.org> +Date: Fri Dec 24 19:43:31 2010 +0100 + + Line wrap USSD replies + + Some provides such as Tchibo Mobil return messages way over 100 + characters. Make sure we linewrap those. + +commit f3bcc5ed66c808ccc15417daf5f3ad25c76ad648 +Author: Guido Günther <agx@sigxcpu.org> +Date: Mon Oct 25 20:10:42 2010 +0200 + + Initial commit @@ -0,0 +1,7 @@ +============= +Version 0.0.2 +============= +* Use GDBus instead of dbus-glib +* Add icon +* Use main window with menu bar instead of dialog +* Don't fail when provider disappears from m-b-p-i @@ -2,4 +2,3 @@ * Collect balance statistics in sqlitedb * Handle multiple modems * Add support for SMS top-up messages as used by some providers -* Drop dbus.glib and use Gio.DBusProxy instead diff --git a/configure.ac b/configure.ac index 6725777..0ff79c4 100644 --- a/configure.ac +++ b/configure.ac @@ -1,7 +1,7 @@ # -*- Autoconf -*- AC_PREREQ([2.67]) -AC_INIT([prepaid-manager-applet], [0.0.1.2], +AC_INIT([prepaid-manager-applet], [0.0.2], [http://honk.sigxcpu.org/projects/prepaid-manager.py]) AM_INIT_AUTOMAKE([-Wno-portability]) @@ -10,12 +10,10 @@ IT_PROG_INTLTOOL([0.35.0]) GLIB_REQUIRED=2.25.6 GTK_REQUIRED=3.0.0 PYGOBJECT_REQUIRED=2.28.3 -DBUS_PYTHON_REQUIRED=0.83 PKG_CHECK_MODULES(PPM, [glib-2.0 >= $GLIB_REQUIRED gtk+-3.0 >= $GTK_REQUIRED - pygobject-2.0 >= $PYGOBJECT_REQUIRED - dbus-python >= $DBUS_PYTHON_REQUIRED]) + pygobject-2.0 >= $PYGOBJECT_REQUIRED]) GETTEXT_PACKAGE=prepaid-manager-applet AC_SUBST(GETTEXT_PACKAGE) @@ -29,6 +27,12 @@ GNOME_DOC_INIT AC_CONFIG_FILES([ Makefile data/Makefile +data/icons/Makefile +data/icons/scalable/Makefile +data/icons/128x128/Makefile +data/icons/64x64/Makefile +data/icons/48x48/Makefile +data/icons/32x32/Makefile po/Makefile.in src/Makefile src/ppm/Makefile diff --git a/data/Makefile.am b/data/Makefile.am index d97af90..2b5580a 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -1,5 +1,7 @@ NULL = +SUBDIRS = icons + gsettings_SCHEMAS = org.gnome.PrepaidManager.gschema.xml @INTLTOOL_XML_NOMERGE_RULE@ diff --git a/data/icons/128x128/Makefile.am b/data/icons/128x128/Makefile.am new file mode 100644 index 0000000..4ee3611 --- /dev/null +++ b/data/icons/128x128/Makefile.am @@ -0,0 +1,9 @@ +NULL = + +icondir = ${datadir}/icons/hicolor/128x128/apps +icon_DATA = \ + ppm.png\ + $(NULL) + +EXTRA_DIST = $(icon_DATA) + diff --git a/data/icons/128x128/ppm.png b/data/icons/128x128/ppm.png Binary files differnew file mode 100644 index 0000000..f5ba651 --- /dev/null +++ b/data/icons/128x128/ppm.png diff --git a/data/icons/32x32/Makefile.am b/data/icons/32x32/Makefile.am new file mode 100644 index 0000000..dd71b0e --- /dev/null +++ b/data/icons/32x32/Makefile.am @@ -0,0 +1,9 @@ +NULL = + +icondir = ${datadir}/icons/hicolor/32x32/apps +icon_DATA = \ + ppm.png\ + $(NULL) + +EXTRA_DIST = $(icon_DATA) + diff --git a/data/icons/32x32/ppm.png b/data/icons/32x32/ppm.png Binary files differnew file mode 100644 index 0000000..eeba927 --- /dev/null +++ b/data/icons/32x32/ppm.png diff --git a/data/icons/48x48/Makefile.am b/data/icons/48x48/Makefile.am new file mode 100644 index 0000000..0806a12 --- /dev/null +++ b/data/icons/48x48/Makefile.am @@ -0,0 +1,9 @@ +NULL = + +icondir = ${datadir}/icons/hicolor/48x48/apps +icon_DATA = \ + ppm.png\ + $(NULL) + +EXTRA_DIST = $(icon_DATA) + diff --git a/data/icons/48x48/ppm.png b/data/icons/48x48/ppm.png Binary files differnew file mode 100644 index 0000000..621e8a3 --- /dev/null +++ b/data/icons/48x48/ppm.png diff --git a/data/icons/64x64/Makefile.am b/data/icons/64x64/Makefile.am new file mode 100644 index 0000000..0953a06 --- /dev/null +++ b/data/icons/64x64/Makefile.am @@ -0,0 +1,9 @@ +NULL = + +icondir = ${datadir}/icons/hicolor/64x64/apps +icon_DATA = \ + ppm.png\ + $(NULL) + +EXTRA_DIST = $(icon_DATA) + diff --git a/data/icons/64x64/ppm.png b/data/icons/64x64/ppm.png Binary files differnew file mode 100644 index 0000000..f4d61a6 --- /dev/null +++ b/data/icons/64x64/ppm.png diff --git a/data/icons/Makefile.am b/data/icons/Makefile.am new file mode 100644 index 0000000..2f415b8 --- /dev/null +++ b/data/icons/Makefile.am @@ -0,0 +1,14 @@ +SUBDIRS = scalable 128x128 64x64 48x48 32x32 + +gtk_update_icon_cache = gtk-update-icon-cache -f -t $(datadir)/icons/hicolor + +install-data-hook: update-icon-cache +uninstall-hook: update-icon-cache +update-icon-cache: + @-if test -z "$(DESTDIR)"; then \ + echo "Updating Gtk icon cache."; \ + $(gtk_update_icon_cache); \ + else \ + echo "*** Icon cache not updated. After (un)install, run this:"; \ + echo "*** $(gtk_update_icon_cache)"; \ + fi diff --git a/data/icons/scalable/Makefile.am b/data/icons/scalable/Makefile.am new file mode 100644 index 0000000..7773565 --- /dev/null +++ b/data/icons/scalable/Makefile.am @@ -0,0 +1,9 @@ +NULL = + +icondir = ${datadir}/icons/hicolor/scalable/apps +icon_DATA = \ + ppm.svg \ + $(NULL) + +EXTRA_DIST = $(icon_DATA) + diff --git a/data/icons/scalable/ppm.svg b/data/icons/scalable/ppm.svg new file mode 100644 index 0000000..455788a --- /dev/null +++ b/data/icons/scalable/ppm.svg @@ -0,0 +1,447 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:xlink="http://www.w3.org/1999/xlink" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + version="1.1" + width="128" + height="128" + id="svg2"> + <title + id="title3884">ppm</title> + <defs + id="defs4"> + <linearGradient + id="linearGradient3833"> + <stop + id="stop3835" + style="stop-color:#d4aa00;stop-opacity:1" + offset="0" /> + <stop + id="stop3837" + style="stop-color:#ffffff;stop-opacity:1" + offset="1" /> + </linearGradient> + <linearGradient + id="linearGradient3825"> + <stop + id="stop3827" + style="stop-color:#ff6600;stop-opacity:1" + offset="0" /> + <stop + id="stop3829" + style="stop-color:#ffffff;stop-opacity:1" + offset="1" /> + </linearGradient> + <inkscape:path-effect + effect="skeletal" + id="path-effect4430" /> + <inkscape:path-effect + effect="spiro" + id="path-effect4428" /> + <inkscape:path-effect + effect="skeletal" + id="path-effect4424" /> + <inkscape:path-effect + effect="spiro" + id="path-effect4422" /> + <linearGradient + id="linearGradient4353"> + <stop + id="stop4355" + style="stop-color:#ff6600;stop-opacity:1" + offset="0" /> + <stop + id="stop4357" + style="stop-color:#ff6600;stop-opacity:0.49019608" + offset="1" /> + </linearGradient> + <linearGradient + id="linearGradient3789"> + <stop + id="stop3799" + style="stop-color:#ffffff;stop-opacity:0" + offset="0" /> + <stop + id="stop4351" + style="stop-color:#c37842;stop-opacity:1" + offset="1" /> + </linearGradient> + <linearGradient + x1="298.49658" + y1="540.21155" + x2="625.77783" + y2="540.21155" + id="linearGradient3282" + xlink:href="#linearGradient3276" + gradientUnits="userSpaceOnUse" + gradientTransform="matrix(-1,0,0,1,1248.7273,50.71935)" /> + <linearGradient + id="linearGradient3276"> + <stop + id="stop3278" + style="stop-color:#87aade;stop-opacity:1" + offset="0" /> + <stop + id="stop3280" + style="stop-color:#87cfde;stop-opacity:1" + offset="1" /> + </linearGradient> + <linearGradient + x1="16.359373" + y1="948.3772" + x2="117.21205" + y2="991.4129" + id="linearGradient3795" + xlink:href="#linearGradient3789" + gradientUnits="userSpaceOnUse" + gradientTransform="translate(0.25000125,0)" /> + <radialGradient + cx="20" + cy="46" + r="8" + fx="20" + fy="46" + id="radialGradient7610" + xlink:href="#linearGradient7604" + gradientUnits="userSpaceOnUse" + gradientTransform="matrix(1,0,0,0.25,0,34.5)" /> + <linearGradient + id="linearGradient7604"> + <stop + id="stop7606" + style="stop-color:#000000;stop-opacity:1" + offset="0" /> + <stop + id="stop7608" + style="stop-color:#000000;stop-opacity:0" + offset="1" /> + </linearGradient> + <radialGradient + cx="20" + cy="46" + r="8" + fx="20" + fy="46" + id="radialGradient3848" + xlink:href="#linearGradient7604" + gradientUnits="userSpaceOnUse" + gradientTransform="matrix(1,0,0,0.25,0,34.5)" /> + <linearGradient + x1="16.359373" + y1="948.3772" + x2="117.21205" + y2="991.4129" + id="linearGradient3001" + xlink:href="#linearGradient3789" + gradientUnits="userSpaceOnUse" + gradientTransform="translate(0.25000125,0)" /> + <radialGradient + cx="20" + cy="46" + r="8" + fx="20" + fy="46" + id="radialGradient3003" + xlink:href="#linearGradient7604" + gradientUnits="userSpaceOnUse" + gradientTransform="matrix(1,0,0,0.25,0,34.5)" /> + <linearGradient + x1="16.359373" + y1="948.3772" + x2="117.21205" + y2="991.4129" + id="linearGradient3816" + xlink:href="#linearGradient3789" + gradientUnits="userSpaceOnUse" + gradientTransform="translate(0.25000125,0)" /> + <linearGradient + x1="16.359373" + y1="948.3772" + x2="117.21205" + y2="991.4129" + id="linearGradient3820" + xlink:href="#linearGradient3789" + gradientUnits="userSpaceOnUse" + gradientTransform="translate(0.25000125,0)" /> + <clipPath + id="clipPath4941"> + <path + d="m 25.375,962.875 c -2.681485,0 -4.8125,2.13102 -4.8125,4.8125 l 0,19.28125 c 0,2.68148 2.134949,4.84375 4.8125,4.84375 l 34.25,0 c 2.677551,0 4.8125,-2.16227 4.8125,-4.84375 l 0,-19.28125 c 0,-2.68148 -2.131015,-4.8125 -4.8125,-4.8125 l -34.25,0 z" + id="path4943" + style="fill:#ff0000;fill-opacity:0.52411577;fill-rule:nonzero;stroke:#ff0000;stroke-width:0;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:0.23794215;stroke-dasharray:none;stroke-dashoffset:0;display:inline" /> + </clipPath> + <clipPath + id="clipPath4941-5"> + <path + d="m 25.375,962.875 c -2.681485,0 -4.8125,2.13102 -4.8125,4.8125 l 0,19.28125 c 0,2.68148 2.134949,4.84375 4.8125,4.84375 l 34.25,0 c 2.677551,0 4.8125,-2.16227 4.8125,-4.84375 l 0,-19.28125 c 0,-2.68148 -2.131015,-4.8125 -4.8125,-4.8125 l -34.25,0 z" + id="path4943-9" + style="fill:#ff0000;fill-opacity:0.52411577;fill-rule:nonzero;stroke:#ff0000;stroke-width:0;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:0.23794215;stroke-dasharray:none;stroke-dashoffset:0;display:inline" /> + </clipPath> + <radialGradient + cx="20" + cy="46" + r="8" + fx="20" + fy="46" + id="radialGradient3822-0" + xlink:href="#linearGradient7604-5" + gradientUnits="userSpaceOnUse" + gradientTransform="matrix(1,0,0,0.25,0,34.5)" /> + <linearGradient + id="linearGradient7604-5"> + <stop + id="stop7606-9" + style="stop-color:#000000;stop-opacity:1" + offset="0" /> + <stop + id="stop7608-4" + style="stop-color:#000000;stop-opacity:0" + offset="1" /> + </linearGradient> + <radialGradient + cx="20" + cy="46" + r="8" + fx="20" + fy="46" + id="radialGradient2977" + xlink:href="#linearGradient7604-5" + gradientUnits="userSpaceOnUse" + gradientTransform="matrix(1,0,0,0.25,0,34.5)" /> + <linearGradient + x1="63.395088" + y1="987.73932" + x2="-6.3950882" + y2="930.23932" + id="linearGradient3831" + xlink:href="#linearGradient3825" + gradientUnits="userSpaceOnUse" /> + <linearGradient + x1="49.946167" + y1="985.34381" + x2="-6.6961594" + y2="934.09375" + id="linearGradient3839" + xlink:href="#linearGradient3833" + gradientUnits="userSpaceOnUse" /> + <radialGradient + cx="156.5" + cy="148.5" + r="19.5" + fx="156.5" + fy="148.5" + id="radialGradient3563" + xlink:href="#linearGradient12684" + gradientUnits="userSpaceOnUse" + gradientTransform="matrix(0.26231224,4.4646861e-5,-4.4646861e-5,0.26231224,-14.432641,-13.683129)" /> + <linearGradient + id="linearGradient12684"> + <stop + id="stop12686" + style="stop-color:#ffffff;stop-opacity:1" + offset="0" /> + <stop + id="stop12692" + style="stop-color:#ffffff;stop-opacity:0.84536082" + offset="0.34999999" /> + <stop + id="stop12688" + style="stop-color:#ffffff;stop-opacity:0" + offset="1" /> + </linearGradient> + <radialGradient + cx="156.5" + cy="148.5" + r="19.5" + fx="156.5" + fy="148.5" + id="radialGradient4396" + xlink:href="#linearGradient12684" + gradientUnits="userSpaceOnUse" + gradientTransform="matrix(0.26173118,0.06970462,-0.24497623,0.3089391,8.1237941,-30.015835)" /> + </defs> + <metadata + id="metadata7"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title>ppm</dc:title> + <dc:creator> + <cc:Agent> + <dc:title>Dana Gruschwitz und Guido Günther</dc:title> + </cc:Agent> + </dc:creator> + <dc:description /> + <dc:subject> + <rdf:Bag> + <rdf:li>sim card</rdf:li> + </rdf:Bag> + </dc:subject> + <dc:date>2011-07-02</dc:date> + <cc:license + rdf:resource="http://creativecommons.org/licenses/by-sa/3.0/" /> + </cc:Work> + <cc:License + rdf:about="http://creativecommons.org/licenses/by-sa/3.0/"> + <cc:permits + rdf:resource="http://creativecommons.org/ns#Reproduction" /> + <cc:permits + rdf:resource="http://creativecommons.org/ns#Distribution" /> + <cc:requires + rdf:resource="http://creativecommons.org/ns#Notice" /> + <cc:requires + rdf:resource="http://creativecommons.org/ns#Attribution" /> + <cc:permits + rdf:resource="http://creativecommons.org/ns#DerivativeWorks" /> + <cc:requires + rdf:resource="http://creativecommons.org/ns#ShareAlike" /> + </cc:License> + </rdf:RDF> + </metadata> + <g + transform="translate(0,-924.36218)" + id="layer1" + style="display:inline"> + <path + d="m 110.39663,947.74444 c 4.82021,0 8.70828,3.86323 8.70828,8.66567 l 0,39.4477 -19.960424,19.87639 -81.551676,0 c -4.820203,0 -8.6977173,-3.8633 -8.6977204,-8.6657 l 0,-50.65839 c 0,-4.80244 3.8775144,-8.66567 8.6977204,-8.66567 l 92.80382,0 z" + id="rect2493" + style="fill:url(#linearGradient3831);fill-opacity:1;stroke:#888a85;stroke-width:3;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> + <path + d="m 17.59375,950.625 c -3.281427,0 -5.8125,2.52869 -5.8125,5.78125 l 0,50.65625 c 2e-6,3.2525 2.531113,5.7813 5.8125,5.7813 l 80.375,0 18.25,-18.18755 0,-38.25 c 0,-3.25257 -2.53107,-5.78125 -5.8125,-5.78125 l -92.8125,0 z" + id="path3818" + style="fill:none;stroke:#ffffff;stroke-width:3;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> + </g> + <g + id="layer4" + style="display:none"> + <path + d="m 17.59375,952.125 c -2.503878,0 -4.3125,1.81388 -4.3125,4.28125 l 0,50.65625 c 2e-6,2.4673 1.808706,4.2813 4.3125,4.2813 l 79.75,0 17.375,-17.31255 0,-37.625 c 0,-2.46738 -1.80862,-4.28125 -4.3125,-4.28125 l -92.8125,0 z" + transform="translate(0,-924.36218)" + id="path3778" + style="fill:#2b1100;stroke:none;display:inline" /> + </g> + <g + id="layer3" + style="display:inline"> + <path + d="m 28,46 a 8,2 0 1 1 -16,0 8,2 0 1 1 16,0 z" + transform="matrix(5.7150041,0,0,4.7885057,-50.300082,-123.73053)" + id="path7602-6" + style="opacity:0.16289595;fill:url(#radialGradient2977);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" /> + </g> + <g + id="layer2" + style="display:inline"> + <g + transform="translate(0,-924.36218)" + clip-path="url(#clipPath4941)" + id="g4739" + style="display:inline"> + <path + d="m 35.104605,957.90399 0,34.53731" + id="path4373-9" + style="fill:#ffffff;stroke:#aa8800;stroke-width:0.75599998;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> + <path + d="m 50.104605,992.49836 0,-15.00001 c 0,-4 1,-5 5,-5 l 10,0" + id="path4373-4-9" + style="fill:none;stroke:#aa8800;stroke-width:0.75592911px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> + <path + d="m 20.104605,972.49835 15,0" + id="path4414-4" + style="fill:none;stroke:#aa8800;stroke-width:0.75599998;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> + <path + d="m 20.104605,982.49835 15,0" + id="path4416-8" + style="fill:none;stroke:#aa8800;stroke-width:0.75599998;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> + <path + d="m 35.104605,966.49835 13.04538,0 c 1.95462,0 1.95462,0 1.95462,-2.00954 l 0,-1.99046" + id="path4457-7" + style="fill:none;stroke:#aa8800;stroke-width:0.75599998;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> + </g> + <path + d="M 35,37.99145 35,68" + id="path4373" + style="fill:#ffffff;stroke:#ffffff;stroke-width:0.75599998;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> + <path + d="M 50,68.00001 50,53 c 0,-4 1,-5 5,-5 l 10,0" + id="path4373-4" + style="fill:none;stroke:#ffffff;stroke-width:0.75592911px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> + <path + d="m 20,48 15,0" + id="path4414" + style="fill:none;stroke:#ffffff;stroke-width:0.75599998;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> + <path + d="m 20,58 15,0" + id="path4416" + style="fill:none;stroke:#ffffff;stroke-width:0.75599998;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> + <path + d="m 35,42 13.04538,0 C 50,42 50,42 50,39.990459 L 50,38" + id="path4457" + style="fill:none;stroke:#ffffff;stroke-width:0.75599998;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> + <path + d="m 25.375,962.3125 c -2.982712,0 -5.375,2.39229 -5.375,5.375 l 0,19.28125 c 0,2.98271 2.392288,5.40625 5.375,5.40625 l 34.25,0 c 2.982712,0 5.375,-2.42354 5.375,-5.40625 l 0,-19.28125 c 0,-2.98271 -2.392288,-5.375 -5.375,-5.375 l -34.25,0 z" + transform="translate(2.0669556e-7,-924.36218)" + id="path4868-4" + style="fill:url(#linearGradient3839);fill-opacity:1;fill-rule:nonzero;stroke:#ffffff;stroke-width:1.10767841;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;display:inline" /> + <g + transform="translate(2.0669556e-7,-924.36218)" + clip-path="url(#clipPath4941-5)" + id="g4739-9" + style="display:inline"> + <path + d="m 35.104605,957.90399 0,34.53731" + id="path4373-9-0" + style="fill:#ffffff;stroke:#aa8800;stroke-width:0.75599998;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> + <path + d="m 50.104605,992.49836 0,-15.00001 c 0,-4 1,-5 5,-5 l 10,0" + id="path4373-4-9-9" + style="fill:none;stroke:#aa8800;stroke-width:0.75592911px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> + <path + d="m 20.104605,972.49835 15,0" + id="path4414-4-1" + style="fill:none;stroke:#aa8800;stroke-width:0.75599998;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> + <path + d="m 20.104605,982.49835 15,0" + id="path4416-8-7" + style="fill:none;stroke:#aa8800;stroke-width:0.75599998;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> + <path + d="m 35.104605,966.49835 13.04538,0 c 1.95462,0 1.95462,0 1.95462,-2.00954 l 0,-1.99046" + id="path4457-7-7" + style="fill:none;stroke:#aa8800;stroke-width:0.75599998;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> + </g> + <path + d="m 35,37.991449 0,30.00855" + id="path4373-1" + style="fill:#ffffff;stroke:#ffffff;stroke-width:0.75599998;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline" /> + <path + d="m 50,68.000009 0,-15.00001 c 0,-4 1,-5 5,-5 l 10,0" + id="path4373-4-1" + style="fill:none;stroke:#ffffff;stroke-width:0.75592911px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;display:inline" /> + <path + d="m 20,47.999999 15,0" + id="path4414-5" + style="fill:none;stroke:#ffffff;stroke-width:0.75599998;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline" /> + <path + d="m 20,57.999999 15,0" + id="path4416-9" + style="fill:none;stroke:#ffffff;stroke-width:0.75599998;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline" /> + <path + d="m 35,41.999999 13.04538,0 c 1.95462,0 1.95462,0 1.95462,-2.009541 l 0,-1.990459" + id="path4457-77" + style="fill:none;stroke:#ffffff;stroke-width:0.75599998;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline" /> + <path + d="M 17.809512,28.129633 A 4.5840947,8.1236928 51.899479 1 1 7.6019575,25.411202 4.5840947,8.1236928 51.899479 0 1 17.809512,28.129633 z" + id="path12726" + style="fill:url(#radialGradient4396);fill-opacity:1;stroke:none" /> + </g> +</svg> @@ -1,16 +1,76 @@ -<?xml version="1.0"?> +<?xml version="1.0" encoding="UTF-8"?> <interface> <requires lib="gtk+" version="2.16"/> - <!-- interface-naming-policy project-wide --> - <object class="GtkDialog" id="ppm_dialog"> - <property name="border_width">5</property> - <property name="title" translatable="yes">Prepaid Manager</property> - <property name="type_hint">dialog</property> - <child internal-child="vbox"> - <object class="GtkVBox" id="dialog-vbox1"> + <object class="GtkWindow" id="ppm_dialog"> + <property name="can_focus">False</property> + <signal name="delete-event" handler="on_delete" swapped="no"/> + <child> + <object class="GtkVBox" id="vbox1"> <property name="visible">True</property> - <property name="orientation">vertical</property> - <property name="spacing">2</property> + <property name="can_focus">False</property> + <child> + <object class="GtkMenuBar" id="menubar1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <child> + <object class="GtkMenuItem" id="menu_filee"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="use_action_appearance">False</property> + <property name="label" translatable="yes">_File</property> + <property name="use_underline">True</property> + <child type="submenu"> + <object class="GtkMenu" id="menu_file"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <child> + <object class="GtkImageMenuItem" id="menuitem_quit"> + <property name="label">gtk-quit</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="use_action_appearance">False</property> + <property name="use_underline">True</property> + <property name="use_stock">True</property> + <signal name="activate" handler="on_close_clicked" swapped="no"/> + </object> + </child> + </object> + </child> + </object> + </child> + <child> + <object class="GtkMenuItem" id="menuitem_help"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="use_action_appearance">False</property> + <property name="label" translatable="yes">_Help</property> + <property name="use_underline">True</property> + <child type="submenu"> + <object class="GtkMenu" id="menu_help"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <child> + <object class="GtkImageMenuItem" id="imagemenuitem_about"> + <property name="label">gtk-about</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="use_action_appearance">False</property> + <property name="use_underline">True</property> + <property name="use_stock">True</property> + <signal name="activate" handler="on_about_activated" swapped="no"/> + </object> + </child> + </object> + </child> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> <child> <object class="GtkNotebook" id="notebook1"> <property name="visible">True</property> @@ -18,6 +78,7 @@ <child> <object class="GtkTable" id="table_balance"> <property name="visible">True</property> + <property name="can_focus">False</property> <property name="n_rows">3</property> <property name="n_columns">3</property> <property name="column_spacing">4</property> @@ -25,6 +86,7 @@ <child> <object class="GtkLabel" id="label_provider"> <property name="visible">True</property> + <property name="can_focus">False</property> <property name="label" translatable="yes">Provider:</property> </object> <packing> @@ -37,6 +99,7 @@ <child> <object class="GtkLabel" id="label_balance_provider_name"> <property name="visible">True</property> + <property name="can_focus">False</property> <property name="label" translatable="yes">unknown provider</property> <attributes> <attribute name="weight" value="bold"/> @@ -55,8 +118,11 @@ <property name="label" translatable="yes">change</property> <property name="can_focus">True</property> <property name="receives_default">True</property> + <property name="has_tooltip">True</property> + <property name="tooltip_markup" translatable="yes">Change provider</property> <property name="tooltip_text" translatable="yes">Change provider</property> - <signal name="clicked" handler="on_provider_change_clicked"/> + <property name="use_action_appearance">False</property> + <signal name="clicked" handler="on_provider_change_clicked" swapped="no"/> </object> <packing> <property name="left_attach">2</property> @@ -69,6 +135,7 @@ </child> <child> <object class="GtkLabel" id="label_balance_from"> + <property name="can_focus">False</property> <property name="label" translatable="yes">Balance information from</property> </object> <packing> @@ -82,6 +149,7 @@ </child> <child> <object class="GtkLabel" id="label_balance_timestamp"> + <property name="can_focus">False</property> <property name="label" translatable="yes">unknown</property> </object> <packing> @@ -97,6 +165,7 @@ <child> <object class="GtkLabel" id="label_balance_info"> <property name="visible">True</property> + <property name="can_focus">False</property> <property name="label" translatable="yes">Balance unknown</property> <property name="wrap">True</property> <attributes> @@ -119,8 +188,11 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> + <property name="has_tooltip">True</property> + <property name="tooltip_markup" translatable="yes">Check your prepaid cards balance.</property> <property name="tooltip_text" translatable="yes">Check your prepaid cards balance.</property> - <signal name="clicked" handler="on_balance_info_renew_clicked"/> + <property name="use_action_appearance">False</property> + <signal name="clicked" handler="on_balance_info_renew_clicked" swapped="no"/> </object> <packing> <property name="left_attach">2</property> @@ -141,6 +213,7 @@ <child type="tab"> <object class="GtkLabel" id="tab_balance"> <property name="visible">True</property> + <property name="can_focus">False</property> <property name="label" translatable="yes">Balance</property> </object> <packing> @@ -150,6 +223,7 @@ <child> <object class="GtkTable" id="table_top_up"> <property name="visible">True</property> + <property name="can_focus">False</property> <property name="n_rows">3</property> <property name="n_columns">3</property> <property name="column_spacing">4</property> @@ -157,6 +231,7 @@ <child> <object class="GtkLabel" id="label_provider1"> <property name="visible">True</property> + <property name="can_focus">False</property> <property name="label" translatable="yes">Provider:</property> </object> <packing> @@ -169,6 +244,7 @@ <child> <object class="GtkLabel" id="label_topup_provider_name"> <property name="visible">True</property> + <property name="can_focus">False</property> <property name="label" translatable="yes">unknown provider</property> <attributes> <attribute name="weight" value="bold"/> @@ -187,6 +263,7 @@ <property name="label" translatable="yes">change</property> <property name="can_focus">True</property> <property name="receives_default">True</property> + <property name="use_action_appearance">False</property> </object> <packing> <property name="left_attach">2</property> @@ -204,8 +281,11 @@ <property name="sensitive">False</property> <property name="can_focus">True</property> <property name="receives_default">True</property> + <property name="has_tooltip">True</property> + <property name="tooltip_markup" translatable="yes">Top up your prepaid accounts balance</property> <property name="tooltip_text" translatable="yes">Top up your prepaid accounts balance</property> - <signal name="clicked" handler="on_balance_top_up_clicked"/> + <property name="use_action_appearance">False</property> + <signal name="clicked" handler="on_balance_top_up_clicked" swapped="no"/> </object> <packing> <property name="left_attach">2</property> @@ -222,9 +302,12 @@ <object class="GtkEntry" id="entry_code"> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="has_tooltip">True</property> + <property name="tooltip_markup" translatable="yes">Enter code to top up credit to your prepaid card.</property> <property name="tooltip_text" translatable="yes">Enter code to top up credit to your prepaid card.</property> - <property name="invisible_char">●</property> - <signal name="changed" handler="on_entry_code_insert"/> + <property name="invisible_char">●</property> + <property name="invisible_char_set">True</property> + <signal name="changed" handler="on_entry_code_insert" swapped="no"/> </object> <packing> <property name="left_attach">1</property> @@ -239,6 +322,7 @@ <child> <object class="GtkLabel" id="label_code"> <property name="visible">True</property> + <property name="can_focus">False</property> <property name="label" translatable="yes">Code:</property> </object> <packing> @@ -253,7 +337,7 @@ <child> <object class="GtkLabel" id="label_top_up_reply"> <property name="visible">True</property> - <property name="label" translatable="no"></property> + <property name="can_focus">False</property> </object> <packing> <property name="right_attach">3</property> @@ -273,6 +357,7 @@ <child type="tab"> <object class="GtkLabel" id="tab_top_up"> <property name="visible">True</property> + <property name="can_focus">False</property> <property name="label" translatable="yes">Top up</property> </object> <packing> @@ -282,39 +367,12 @@ </child> </object> <packing> - <property name="position">1</property> - </packing> - </child> - <child internal-child="action_area"> - <object class="GtkHButtonBox" id="dialog-action_area1"> - <property name="visible">True</property> - <property name="layout_style">end</property> - <child> - <object class="GtkButton" id="button_close"> - <property name="label">gtk-close</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="use_stock">True</property> - <signal name="clicked" handler="on_close_clicked"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">1</property> - </packing> - </child> - </object> - <packing> <property name="expand">False</property> - <property name="pack_type">end</property> - <property name="position">0</property> + <property name="fill">True</property> + <property name="position">1</property> </packing> </child> </object> </child> - <action-widgets> - <action-widget response="0">button_close</action-widget> - </action-widgets> </object> </interface> diff --git a/src/ppm/Makefile.am b/src/ppm/Makefile.am index 8346110..65952cd 100644 --- a/src/ppm/Makefile.am +++ b/src/ppm/Makefile.am @@ -15,6 +15,7 @@ EXTRA_DIST = $(python_DATA) $(python_DATA_IN) %.py: $(srcdir)/%.py.in $(srcdir)/Makefile sed -e "s,::PACKAGE::,$(PACKAGE)," \ + -e "s,::VERSION::,$(PACKAGE_VERSION)," \ -e "s,::PYLIBDIR::,$(pkgdatadir)," \ -e "s,::GETTEXTDIR::,$(datadir)/locale," \ -e "s,::DATADIR::,$(datadir)," \ diff --git a/src/ppm/__init__.py.in b/src/ppm/__init__.py.in index ab3c59d..36220b2 100644 --- a/src/ppm/__init__.py.in +++ b/src/ppm/__init__.py.in @@ -3,3 +3,5 @@ gettext_app = '::PACKAGE::' gettext_dir = '::GETTEXTDIR::' ui_dir = '::PKGDATADIR::' +version = '::VERSION::' +prgname = '::PACKAGE::' diff --git a/src/ppm/modemproxy.py b/src/ppm/modemproxy.py index 6d2e32f..fa06dd5 100644 --- a/src/ppm/modemproxy.py +++ b/src/ppm/modemproxy.py @@ -16,10 +16,10 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -import dbus -import dbus.glib -import dbus.service +import glib from gi.repository import GObject +from gi.repository import GLib +from gi.repository import Gio class ModemError(Exception): @@ -58,7 +58,7 @@ class ModemManagerProxy(GObject.GObject): def __init__(self): self.__gobject_init__() - self.bus = dbus.SystemBus() + self.bus = Gio.bus_get_sync(Gio.BusType.SYSTEM, None) self.request = None self.reply_func = None self.error_func = None @@ -67,7 +67,6 @@ class ModemManagerProxy(GObject.GObject): def set_modem(self, modem): self.modem = modem - self.obj = self.bus.get_object(self.MM_DBUS_SERVICE, self.modem) def mm_request(func): def wrapped_f( self, *args, **kw) : @@ -77,8 +76,7 @@ class ModemManagerProxy(GObject.GObject): if kw.has_key('error_func'): self.error_func = kw['error_func'] self.emit('request-started', self) - ret = func(self, *args, **kw) - return ret + func(self, *args, **kw) wrapped_f.__name__= func.__name__ wrapped_f.__doc__= func.__doc__ return wrapped_f @@ -102,33 +100,41 @@ class ModemManagerProxy(GObject.GObject): return False @mm_request_done - def handle_dbus_reply(self, *args): - if self.reply_func: - self.reply_func(*args) - - @mm_request_done - def handle_dbus_error(self, e): - if self.error_func: - me = ModemError("%s failed: %s" % (self.request, e)) - self.error_func(me) + def handle_dbus_reply(self, obj, result, user_data): + try: + res = obj.call_finish(result) + if self.reply_func: + self.reply_func(res, user_data) + except glib.GError as err: + if self.error_func: + me = ModemError("%s failed: %s" % (self.request, err)) + self.error_func(me) def get_modems(self): - modems = [] - proxy = self.bus.get_object(self.MM_DBUS_SERVICE, - self.MM_DBUS_OBJECT_MODEM_MANAGER) - mm = dbus.Interface(proxy, - dbus_interface=self.MM_DBUS_INTERFACE_MODEM_MANAGER) + modems = [] + mm = Gio.DBusProxy.new_sync(self.bus, + Gio.DBusProxyFlags.NONE, + None, + self.MM_DBUS_SERVICE, + self.MM_DBUS_OBJECT_MODEM_MANAGER, + self.MM_DBUS_INTERFACE_MODEM_MANAGER, + None) ret = mm.EnumerateDevices() for modem in ret: modems.append(modem) return modems def get_imsi(self): - card = dbus.Interface(self.obj, - dbus_interface=self.MM_DBUS_INTERFACE_MODEM_GSM_CARD) + card = Gio.DBusProxy.new_sync(self.bus, + Gio.DBusProxyFlags.NONE, + None, + self.MM_DBUS_SERVICE, + self.modem, + self.MM_DBUS_INTERFACE_MODEM_GSM_CARD, + None) try: return card.GetImsi() - except dbus.exceptions.DBusException as msg: + except glib.GError as msg: raise ModemError("Getting IMSI failed: %s" % msg) def get_network_id(self): @@ -139,20 +145,30 @@ class ModemManagerProxy(GObject.GObject): @mm_request def ussd_initiate(self, command, reply_func=None, error_func=None): - ussd = dbus.Interface(self.obj, - dbus_interface=self.MM_DBUS_INTERFACE_MODEM_GSM_USSD) - return ussd.Initiate(command, - reply_handler=self.handle_dbus_reply, - error_handler=self.handle_dbus_error) + ussd = Gio.DBusProxy.new_sync(self.bus, + Gio.DBusProxyFlags.NONE, + None, + self.MM_DBUS_SERVICE, + self.modem, + self.MM_DBUS_INTERFACE_MODEM_GSM_USSD, + None) + ussd.call("Initiate", GLib.Variant('(s)', (command,)), + Gio.DBusCallFlags.NO_AUTO_START, 5000, None, + self.handle_dbus_reply, None) @mm_request def _modem__enable(self, enable, reply_func=None, error_func=None): - ussd = dbus.Interface(self.obj, - dbus_interface=self.MM_DBUS_INTERFACE_MODEM) - ussd.Enable(enable, - reply_handler=self.handle_dbus_reply, - error_handler=self.handle_dbus_error) - + ussd = Gio.DBusProxy.new_sync(self.bus, + Gio.DBusProxyFlags.NONE, + None, + self.MM_DBUS_SERVICE, + self.modem, + self.MM_DBUS_INTERFACE_MODEM, + None) + ussd.call("Enable", GLib.Variant('(b)', (enable,)), + Gio.DBusCallFlags.NO_AUTO_START, 1000, None, + self.handle_dbus_reply, None) + def modem_enable(self, reply_func=None, error_func=None): self._modem__enable(True) diff --git a/src/prepaid-manager-applet.desktop.in b/src/prepaid-manager-applet.desktop.in index 4b568c1..a345d49 100644 --- a/src/prepaid-manager-applet.desktop.in +++ b/src/prepaid-manager-applet.desktop.in @@ -1,6 +1,8 @@ [Desktop Entry] _Name=Prepaid Manager -_Comment=Prepaid Manager Applet for GSM +_Comment=Manage balance of prepaid GSM SIM cards Exec=prepaid-manager-applet Terminal=false Type=Application +Categories=GNOME;GTK;Utility;Network; +Icon=ppm diff --git a/src/prepaid-manager-applet.py b/src/prepaid-manager-applet.py index 77de3ed..622b16f 100755 --- a/src/prepaid-manager-applet.py +++ b/src/prepaid-manager-applet.py @@ -18,12 +18,11 @@ # -import dbus -import dbus.mainloop.glib import gettext from gi.repository import GObject import glib from gi.repository import Gtk +from gi.repository import Gdk import locale import logging import os @@ -164,10 +163,15 @@ class PPMController(GObject.GObject): self.mm.modem_enable(reply_func=self.init_account_and_provider) return True - - if self._get_account_from_accountdb(self.imsi): - # Since we have the account in the db we can safely - # fetch the provider information from the providerdb + try: + account = self._get_account_from_accountdb(self.imsi) + except: + # Fetching account from the DB failed, so start over + account = None + + if account: + # Since we have the account in the db we can safely fetch the + # provider information from the providerdb self.providerdb.get_provider(self.account.name, self.account.code) else: @@ -215,12 +219,14 @@ class PPMController(GObject.GObject): logging.debug("Finished modem request") self.view.close_modem_response() - def on_balance_info_fetched(self, balance, *args): + def on_balance_info_fetched(self, var, user_data): """Callback for succesful MM fetch balance info call""" + balance = var.unpack()[0] self.emit('balance-info-changed', balance) - def on_balance_topped_up(self, reply): + def on_balance_topped_up(self, var, user_data): """Callback for succesful MM topup balance call""" + reply = var.unpack()[0] self.view.update_top_up_information(reply) def on_modem_error(self, e): @@ -284,10 +290,22 @@ class PPMObject(object): # View class PPMDialog(GObject.GObject, PPMObject): + def _init_about_dialog(self): + self.about_dialog = Gtk.AboutDialog( + authors = ["Guido Günther <agx@sigxcpu.org>"], + website = "https://honk.sigxcpu.org/piki/projects/ppm/", + website_label = _("Website"), + comments = _("Manage balance of prepaid GSM SIM cards"), + wrap_license = True, + version = ppm.version, + logo_icon_name = 'ppm', + license_type = Gtk.License.GPL_3_0) + def _init_subdialogs(self): self.provider_info_missing_dialog = PPMProviderInfoMissingDialog(self) self.provider_assistant = PPMProviderAssistant(self) self.modem_response = PPMModemResponse(self) + self._init_about_dialog() def _setup_ui(self): self.dialog = self.builder.get_object("ppm_dialog") @@ -321,10 +339,18 @@ class PPMDialog(GObject.GObject, PPMObject): def on_close_clicked(self, dummy): self.controller.quit() + def on_delete(self, event, dummy): + self.controller.quit() + return False + def on_balance_top_up_clicked(self, dummy): self.clear_top_up_information() self.controller.top_up_balance() + def on_about_activated(self, dummy): + self.about_dialog.run() + self.about_dialog.hide() + def on_balance_info_renew_clicked(self, dummy): self.controller.fetch_balance() @@ -368,7 +394,7 @@ class PPMDialog(GObject.GObject, PPMObject): dialog = Gtk.MessageDialog(parent=self.dialog, flags=Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT, - type=Gtk.MessageType.ERROR, + message_type=Gtk.MessageType.ERROR, buttons=Gtk.ButtonsType.OK) dialog.set_markup("Modem error: %s" % msg) dialog.run() @@ -379,7 +405,7 @@ class PPMDialog(GObject.GObject, PPMObject): dialog = Gtk.MessageDialog(parent=self.dialog, flags=Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT, - type=Gtk.MessageType.QUESTION, + message_type=Gtk.MessageType.QUESTION, buttons=Gtk.ButtonsType.YES_NO) dialog.set_markup(_("Enable Modem?")) ret = dialog.run() @@ -395,7 +421,7 @@ class PPMDialog(GObject.GObject, PPMObject): error = Gtk.MessageDialog(parent=self.dialog, flags=Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT, - type=Gtk.MessageType.ERROR, + message_type=Gtk.MessageType.ERROR, buttons=Gtk.ButtonsType.OK) error.set_markup(msg) error.run() @@ -550,7 +576,7 @@ class PPMProviderInfoMissingDialog(object): self.dialog = Gtk.MessageDialog(parent=main_dialog.dialog, flags=Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT, - type=Gtk.MessageType.INFO, + message_type=Gtk.MessageType.INFO, buttons=Gtk.ButtonsType.OK) self.messages = { 'balance_info_missing': @@ -619,10 +645,6 @@ def setup_i18n(): logging.debug('Using locale: %s', locale.getlocale()) -def setup_dbus(): - dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) - - def setup_schemas(): """If we're running from the source tree add our gsettings schema to the list of schema dirs""" @@ -636,6 +658,13 @@ def setup_schemas(): os.environ["GSETTINGS_SCHEMA_DIR"] = "data" +def setup_prgname(): + """Set the prgname since gnome-shell is application based""" + glib.set_prgname(ppm.prgname) + Gdk.set_program_class(ppm.prgname) + glib.set_application_name(_("Prepaid Manager")) + + def main(args): parser = glib.option.OptionParser() parser.add_option("--debug", "-d", action="store_true", dest="debug", @@ -650,9 +679,9 @@ def main(args): logging.basicConfig(level=log_level, format='ppm: %(levelname)s: %(message)s') - setup_schemas() - setup_dbus() setup_i18n() + setup_prgname() + setup_schemas() controller = PPMController() main_dialog = PPMDialog(controller) |