aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore19
-rw-r--r--AUTHORS4
-rw-r--r--COPYING674
-rw-r--r--ChangeLog226
-rw-r--r--Makefile.am13
-rw-r--r--NEWS27
-rw-r--r--README19
-rw-r--r--TODO2
-rwxr-xr-xautogen.sh21
-rw-r--r--configure.ac40
-rw-r--r--data/Makefile.am35
-rw-r--r--data/hicolor/128x128/apps/ppm.png (renamed from data/icons/128x128/ppm.png)bin4655 -> 4655 bytes
-rw-r--r--data/hicolor/32x32/apps/ppm.png (renamed from data/icons/32x32/ppm.png)bin1043 -> 1043 bytes
-rw-r--r--data/hicolor/48x48/apps/ppm.png (renamed from data/icons/48x48/ppm.png)bin1648 -> 1648 bytes
-rw-r--r--data/hicolor/64x64/apps/ppm.png (renamed from data/icons/64x64/ppm.png)bin2269 -> 2269 bytes
-rw-r--r--data/hicolor/scalable/apps/ppm.svg (renamed from data/icons/scalable/ppm.svg)0
-rw-r--r--data/icons/128x128/Makefile.am9
-rw-r--r--data/icons/32x32/Makefile.am9
-rw-r--r--data/icons/48x48/Makefile.am9
-rw-r--r--data/icons/64x64/Makefile.am9
-rw-r--r--data/icons/Makefile.am14
-rw-r--r--data/icons/scalable/Makefile.am9
-rw-r--r--data/meson.build46
-rw-r--r--data/org.gnome.PrepaidManager.appdata.xml.in27
-rw-r--r--data/org.gnome.PrepaidManager.desktop.in10
-rw-r--r--data/org.gnome.PrepaidManager.gschema.xml (renamed from data/org.gnome.PrepaidManager.gschema.xml.in.in)34
-rw-r--r--data/ppm.gresources.xml8
-rw-r--r--data/prepaid-manager-applet.appdata.xml.in22
-rw-r--r--data/ui/ppm-error-dialog.ui96
-rw-r--r--data/ui/ppm-provider-assistant.ui (renamed from src/ppm-provider-assistant.ui)6
-rw-r--r--data/ui/ppm.ui (renamed from src/ppm.ui)156
-rw-r--r--meson.build22
-rw-r--r--po/POTFILES.in1
-rw-r--r--po/meson.build2
-rw-r--r--setup.cfg5
-rw-r--r--src/Makefile.am23
-rw-r--r--src/meson.build15
-rw-r--r--src/ppm/Makefile.am25
-rw-r--r--src/ppm/__init__.py.in11
-rw-r--r--src/ppm/accountdb.py18
-rw-r--r--src/ppm/meson.build25
-rw-r--r--src/ppm/modemproxy.py247
-rw-r--r--src/ppm/provider.py18
-rw-r--r--src/ppm/providerdb.py12
-rw-r--r--src/prepaid-manager-applet.desktop.in8
-rwxr-xr-xsrc/prepaid-manager-applet.in2
-rwxr-xr-xsrc/prepaid-manager-applet.py370
47 files changed, 1415 insertions, 933 deletions
diff --git a/.gitignore b/.gitignore
index e576237..e35d885 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,18 +1 @@
-config.log
-config.status
-aclocal.m4
-autom4te.cache/
-configure
-COPYING
-gnome-doc-utils.make
-INSTALL
-install-sh
-Makefile
-Makefile.in
-missing
-mkinstalldirs
-prepaid-manager-applet-*.tar.gz
-
-data/gschemas.compiled
-data/org.gnome.PrepaidManager.gschema.valid
-data/org.gnome.PrepaidManager.gschema.xml
+_build
diff --git a/AUTHORS b/AUTHORS
deleted file mode 100644
index 8383b14..0000000
--- a/AUTHORS
+++ /dev/null
@@ -1,4 +0,0 @@
-Prepaid Manager Applet code is developed by:
-
- Guido Günther <agx@sigxcpu.org>
-
diff --git a/COPYING b/COPYING
new file mode 100644
index 0000000..94a9ed0
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ <program> Copyright (C) <year> <name of author>
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<http://www.gnu.org/licenses/>.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
diff --git a/ChangeLog b/ChangeLog
deleted file mode 100644
index 5031736..0000000
--- a/ChangeLog
+++ /dev/null
@@ -1,226 +0,0 @@
-commit b20c91e1d1f75150c2e6e028dfd0eda75791a4a1
-Author: Guido Günther <agx@sigxcpu.org>
-Date: Mon Nov 14 18:36:31 2011 +0100
-
- Bump version to 0.0.2.1
-
-commit 855afa8a30645ce4cfff762fc502f951e786d219
-Author: Guido Günther <agx@sigxcpu.org>
-Date: Mon Nov 14 18:34:30 2011 +0100
-
- Fix URL
-
-commit 97803a61a75ef00147e26befffd22889ac19f16d
-Author: Guido Günther <agx@sigxcpu.org>
-Date: Mon Sep 26 10:04:36 2011 +0200
-
- Require PyGObject 3.0
-
-commit 8413459fc915b83e9974d0ff7cb12c12c10df091
-Author: Guido Günther <agx@sigxcpu.org>
-Date: Mon Sep 26 10:04:36 2011 +0200
-
- Adjust to GObject 3.0
-
-commit e9f6c6d60fd007643fab72cde5aacf851e34404f
-Author: Guido Günther <agx@sigxcpu.org>
-Date: Mon Sep 26 19:18:07 2011 +0200
-
- Fix typo
-
-commit 8b35c7402bbe003e9da37773d3ef5ceb06e8ae04
-Author: Guido Günther <agx@sigxcpu.org>
-Date: Fri Aug 19 08:56:54 2011 +0200
-
- Use a consistent timeout for MM DBus calls
-
-commit 04ae3ade85928efd5513e138a7cedcaaeb675e4c
-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
diff --git a/Makefile.am b/Makefile.am
deleted file mode 100644
index d435340..0000000
--- a/Makefile.am
+++ /dev/null
@@ -1,13 +0,0 @@
-NULL =
-
-SUBDIRS = data src po
-
-EXTRA_DIST = \
- autogen.sh
-
-DISTCLEANFILES = \
- intltool-extract \
- intltool-merge \
- intltool-update \
- gnome-doc-utils.make \
- $(NULL)
diff --git a/NEWS b/NEWS
deleted file mode 100644
index 1490352..0000000
--- a/NEWS
+++ /dev/null
@@ -1,27 +0,0 @@
-===============
-Version 0.0.3.1
-===============
-* Provider selections fixes
-* Add 'change' button to allow to reconfigure current provider
-* Reschedule modem setup on modem errors
-* Switch to xz tarballs
-
-==============
-Version 0.0.3
-==============
-* Better handle missing and disabled modems
-* Better feedback when entering top up codes if
- m-b-p-i has length information for the ussd code.
-
-===============
-Version 0.0.2.1
-===============
-* Update to PyGObject 3.0
-
-=============
-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
diff --git a/README b/README
index 64438b8..0437510 100644
--- a/README
+++ b/README
@@ -10,25 +10,26 @@ by the built in 3G chipset in your laptop/netbook.
Requirements
------------
-* ModemManager with ussd support (>= 0.5)
+* Python3
+* ModemManager with ussd support (>= 1.4)
* mobile-broadband-provider-info with top-up support (>= 20110319)
-* GTK+ >= 3.0.0, Debian package: libgtk+-3-0
-* PyGObject >= 2.28.3, Debian package: python-gobject
-* DBus Python Bindings >= 0.83, Debian package: python-dbus
+* GTK+ >= 3.22, Debian package: libgtk+-3-0
+* PyGObject >= 3.22, Debian package: python-gobject
Build
-----
To build ppm use:
- ./configure
- make
+ meson . _build
+ ninja -C _build
Running
-------
-If you don't want to install ppm on you system you can run it from the source
-tree:
+Running is currently a bit cumbersome due to the preprocessed python
+files so:
- src/prepaid-manager-applet.py
+ ninja -C _build install
+ GSETTINGS_SCHEMA_DIR=_build/data _build/src/prepaid-manager-applet
Project Page
------------
diff --git a/TODO b/TODO
index f40bc1a..766f990 100644
--- a/TODO
+++ b/TODO
@@ -2,3 +2,5 @@
* Collect balance statistics in sqlitedb
* Handle multiple modems
* Add support for SMS top-up messages as used by some providers
+* USSD menus
+* Make remaining calls aync
diff --git a/autogen.sh b/autogen.sh
deleted file mode 100755
index ed5671b..0000000
--- a/autogen.sh
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/bin/sh
-# Run this to generate all the initial makefiles, etc.
-
-srcdir=`dirname $0`
-test -z "$srcdir" && srcdir=.
-REQUIRED_AUTOMAKE_VERSION=1.9
-REQUIRED_INTLTOOL_VERSION=0.35.0
-PKG_NAME=prepaid-manager-applet
-
-(test -f $srcdir/configure.ac \
- && test -f $srcdir/src/prepaid-manager-applet.py) || {
- echo -n "**Error**: Directory "\`$srcdir\'" does not look like the"
- echo " top-level $PKG_NAME directory"
- exit 1
-}
-
-which gnome-autogen.sh || {
- echo "You need to install gnome-common from the GNOME git"
- exit 1
-}
-USE_GNOME2_MACROS=1 . gnome-autogen.sh
diff --git a/configure.ac b/configure.ac
deleted file mode 100644
index 429b404..0000000
--- a/configure.ac
+++ /dev/null
@@ -1,40 +0,0 @@
-# -*- Autoconf -*-
-
-AC_PREREQ([2.67])
-AC_INIT([prepaid-manager-applet], [0.0.3.1],
- [https://honk.sigxcpu.org/piki/projects/ppm/])
-AM_INIT_AUTOMAKE([dist-xz -Wno-portability])
-
-IT_PROG_INTLTOOL([0.35.0])
-
-GLIB_REQUIRED=2.25.6
-GTK_REQUIRED=3.0.0
-PYGOBJECT_REQUIRED=3.0
-
-PKG_CHECK_MODULES(PPM, [glib-2.0 >= $GLIB_REQUIRED
- gtk+-3.0 >= $GTK_REQUIRED
- pygobject-3.0 >= $PYGOBJECT_REQUIRED])
-
-GETTEXT_PACKAGE=prepaid-manager-applet
-AC_SUBST(GETTEXT_PACKAGE)
-AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package])
-AM_GLIB_GNU_GETTEXT
-
-GLIB_GSETTINGS
-
-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
-])
-AC_OUTPUT
diff --git a/data/Makefile.am b/data/Makefile.am
deleted file mode 100644
index ad4e00f..0000000
--- a/data/Makefile.am
+++ /dev/null
@@ -1,35 +0,0 @@
-NULL =
-
-SUBDIRS = icons
-
-gsettings_SCHEMAS = org.gnome.PrepaidManager.gschema.xml
-
-@INTLTOOL_XML_NOMERGE_RULE@
-@GSETTINGS_RULES@
-
-%.gschema.xml.in: %.gschema.xml.in.in Makefile
- $(AM_V_GEN) sed -e 's^\@GETTEXT_PACKAGE\@^$(GETTEXT_PACKAGE)^g' < $< > $@
-
-# We need to compile schemas at make time
-# to run from source tree
-gschemas.compiled: $(gsettings_SCHEMAS:.xml=.valid)
- $(AM_V_GEN) $(GLIB_COMPILE_SCHEMAS) --targetdir=. .
-
-@INTLTOOL_XML_RULE@
-appdatadir = $(datadir)/appdata
-appdata_in_files = prepaid-manager-applet.appdata.xml.in
-appdata_DATA = $(appdata_in_files:.xml.in=.xml)
-
-all-local: gschemas.compiled
-
-EXTRA_DIST = \
- org.gnome.PrepaidManager.gschema.xml.in.in \
- $(appdata_in_files) \
- $(NULL)
-
-CLEANFILES = \
- $(gsettings_SCHEMAS) \
- gschemas.compiled \
- $(appdata_DATA) \
- $(NULL)
-
diff --git a/data/icons/128x128/ppm.png b/data/hicolor/128x128/apps/ppm.png
index f5ba651..f5ba651 100644
--- a/data/icons/128x128/ppm.png
+++ b/data/hicolor/128x128/apps/ppm.png
Binary files differ
diff --git a/data/icons/32x32/ppm.png b/data/hicolor/32x32/apps/ppm.png
index eeba927..eeba927 100644
--- a/data/icons/32x32/ppm.png
+++ b/data/hicolor/32x32/apps/ppm.png
Binary files differ
diff --git a/data/icons/48x48/ppm.png b/data/hicolor/48x48/apps/ppm.png
index 621e8a3..621e8a3 100644
--- a/data/icons/48x48/ppm.png
+++ b/data/hicolor/48x48/apps/ppm.png
Binary files differ
diff --git a/data/icons/64x64/ppm.png b/data/hicolor/64x64/apps/ppm.png
index f4d61a6..f4d61a6 100644
--- a/data/icons/64x64/ppm.png
+++ b/data/hicolor/64x64/apps/ppm.png
Binary files differ
diff --git a/data/icons/scalable/ppm.svg b/data/hicolor/scalable/apps/ppm.svg
index 455788a..455788a 100644
--- a/data/icons/scalable/ppm.svg
+++ b/data/hicolor/scalable/apps/ppm.svg
diff --git a/data/icons/128x128/Makefile.am b/data/icons/128x128/Makefile.am
deleted file mode 100644
index 4ee3611..0000000
--- a/data/icons/128x128/Makefile.am
+++ /dev/null
@@ -1,9 +0,0 @@
-NULL =
-
-icondir = ${datadir}/icons/hicolor/128x128/apps
-icon_DATA = \
- ppm.png\
- $(NULL)
-
-EXTRA_DIST = $(icon_DATA)
-
diff --git a/data/icons/32x32/Makefile.am b/data/icons/32x32/Makefile.am
deleted file mode 100644
index dd71b0e..0000000
--- a/data/icons/32x32/Makefile.am
+++ /dev/null
@@ -1,9 +0,0 @@
-NULL =
-
-icondir = ${datadir}/icons/hicolor/32x32/apps
-icon_DATA = \
- ppm.png\
- $(NULL)
-
-EXTRA_DIST = $(icon_DATA)
-
diff --git a/data/icons/48x48/Makefile.am b/data/icons/48x48/Makefile.am
deleted file mode 100644
index 0806a12..0000000
--- a/data/icons/48x48/Makefile.am
+++ /dev/null
@@ -1,9 +0,0 @@
-NULL =
-
-icondir = ${datadir}/icons/hicolor/48x48/apps
-icon_DATA = \
- ppm.png\
- $(NULL)
-
-EXTRA_DIST = $(icon_DATA)
-
diff --git a/data/icons/64x64/Makefile.am b/data/icons/64x64/Makefile.am
deleted file mode 100644
index 0953a06..0000000
--- a/data/icons/64x64/Makefile.am
+++ /dev/null
@@ -1,9 +0,0 @@
-NULL =
-
-icondir = ${datadir}/icons/hicolor/64x64/apps
-icon_DATA = \
- ppm.png\
- $(NULL)
-
-EXTRA_DIST = $(icon_DATA)
-
diff --git a/data/icons/Makefile.am b/data/icons/Makefile.am
deleted file mode 100644
index 2f415b8..0000000
--- a/data/icons/Makefile.am
+++ /dev/null
@@ -1,14 +0,0 @@
-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
deleted file mode 100644
index 7773565..0000000
--- a/data/icons/scalable/Makefile.am
+++ /dev/null
@@ -1,9 +0,0 @@
-NULL =
-
-icondir = ${datadir}/icons/hicolor/scalable/apps
-icon_DATA = \
- ppm.svg \
- $(NULL)
-
-EXTRA_DIST = $(icon_DATA)
-
diff --git a/data/meson.build b/data/meson.build
new file mode 100644
index 0000000..8b0d71d
--- /dev/null
+++ b/data/meson.build
@@ -0,0 +1,46 @@
+desktop_file = i18n.merge_file(
+ input: app_id + '.desktop.in',
+ output: app_id + '.desktop',
+ type: 'desktop',
+ po_dir: '../po',
+ install: true,
+ install_dir: join_paths(get_option('datadir'), 'applications')
+)
+
+schemas = [app_id + '.gschema.xml']
+compiled = gnome.compile_schemas(
+ build_by_default: true
+)
+
+install_data(
+ schemas,
+ install_dir: 'share/glib-2.0/schemas'
+)
+
+appstream_file = i18n.merge_file(
+ input: app_id + '.appdata.xml.in',
+ output: app_id + '.appdata.xml',
+ po_dir: '../po',
+ install: true,
+ install_dir: join_paths(get_option('datadir'), 'appdata')
+)
+
+# Verify the AppStream file with the appropriate tool, if found.
+appstream_util = find_program('appstream-util', required: false)
+if appstream_util.found()
+ test('Validate appstream file', appstream_util,
+ args: ['validate-relax', appstream_file]
+ )
+endif
+
+ppm_resources = gnome.compile_resources(
+ 'ppm',
+ 'ppm.gresources.xml',
+ gresource_bundle: true,
+ c_name: 'ppm',
+ install: true,
+ install_dir: pkgdatadir,
+)
+
+iconsdir = join_paths(get_option('datadir'), 'icons')
+install_subdir('hicolor/', install_dir: iconsdir)
diff --git a/data/org.gnome.PrepaidManager.appdata.xml.in b/data/org.gnome.PrepaidManager.appdata.xml.in
new file mode 100644
index 0000000..4435c28
--- /dev/null
+++ b/data/org.gnome.PrepaidManager.appdata.xml.in
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<component type="desktop">
+ <id>org.gnome.PrepaidManager</id>
+ <metadata_license>CC-BY-SA-3.0</metadata_license>
+ <project_license>GPL-3.0-or-later</project_license>
+ <name>Prepaid manager</name>
+ <description>
+ <p>
+ GNOME Prepaid-manager-applet is an applet for the GNOME Desktop that
+ allows you to check and top up the balance of GSM mobile prepaid SIM cards.
+ </p>
+ <p>
+ It uses ModemManager to talk to the modem and mobile-broadband-provider-info
+ to determine the necessary USSD codes for your provider.
+ </p>
+ </description>
+ <url type="homepage">https://honk.sigxcpu.org/piki/projects/ppm/</url>
+ <updatecontact>agx@sigxcpu.org</updatecontact>
+ <screenshots>
+ <screenshot type="default" width="411" height="183">https://honk.sigxcpu.org/piki/projects/ppm/check.png</screenshot>
+ <screenshot width="411" height="183">https://honk.sigxcpu.org/piki/projects/ppm/topup.png</screenshot>
+ </screenshots>
+ <custom>
+ <value key="Purism::form_factor">workstation</value>
+ <value key="Purism::form_factor">mobile</value>
+ </custom>
+</component>
diff --git a/data/org.gnome.PrepaidManager.desktop.in b/data/org.gnome.PrepaidManager.desktop.in
new file mode 100644
index 0000000..744cc45
--- /dev/null
+++ b/data/org.gnome.PrepaidManager.desktop.in
@@ -0,0 +1,10 @@
+[Desktop Entry]
+Name=Prepaid Manager
+Comment=Manage balance of prepaid GSM SIM cards
+Exec=prepaid-manager-applet
+Terminal=false
+Type=Application
+Categories=GNOME;GTK;Utility;Network;
+Icon=ppm
+StartupNotify=true
+X-Purism-FormFactor=Workstation;Mobile;
diff --git a/data/org.gnome.PrepaidManager.gschema.xml.in.in b/data/org.gnome.PrepaidManager.gschema.xml
index 2b75c8e..db17026 100644
--- a/data/org.gnome.PrepaidManager.gschema.xml.in.in
+++ b/data/org.gnome.PrepaidManager.gschema.xml
@@ -1,43 +1,43 @@
<schemalist>
- <schema id="org.gnome.PrepaidManager" path="/apps/prepaid-manager/" gettext-domain="@GETTEXT_PACKAGE@">
+ <schema id="org.gnome.PrepaidManager" path="/org/gnome/prepaid-manager/">
<key name="accounts" type="as">
<default>[]</default>
- <_summary>Accounts</_summary>
- <_description>
+ <summary>Accounts</summary>
+ <description>
List of configured accounts. The account at your GSM/UMTS provider is
identified by the imsi on your SIM card.
- </_description>
+ </description>
</key>
</schema>
- <schema id="org.gnome.PrepaidManager.account" gettext-domain="@GETTEXT_PACKAGE@">
+ <schema id="org.gnome.PrepaidManager.account">
<key name="provider" type="s">
<default>""</default>
- <_summary>The providers name</_summary>
- <_description>
+ <summary>The providers name</summary>
+ <description>
The name of the mobile broadband provider.
- </_description>
+ </description>
</key>
<key name="country" type="s">
<default>""</default>
- <_summary>The country the provider operates in</_summary>
- <_description>
+ <summary>The country the provider operates in</summary>
+ <description>
This is the country where you bought the SIM card.
- </_description>
+ </description>
</key>
<key name="balance" type="s">
<default>"The current balance is unknown."</default>
- <_summary>Balance</_summary>
- <_description>
+ <summary>Balance</summary>
+ <description>
The current balance of this account.
- </_description>
+ </description>
</key>
<key name="timestamp" type="s">
<default>""</default>
- <_summary>Update timestamp</_summary>
- <_description>
+ <summary>Update timestamp</summary>
+ <description>
The last time the balance got updated.
- </_description>
+ </description>
</key>
</schema>
</schemalist>
diff --git a/data/ppm.gresources.xml b/data/ppm.gresources.xml
new file mode 100644
index 0000000..2948c0d
--- /dev/null
+++ b/data/ppm.gresources.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+ <gresource prefix="/org/gnome/PrepaidManager">
+ <file>ui/ppm.ui</file>
+ <file>ui/ppm-error-dialog.ui</file>
+ <file>ui/ppm-provider-assistant.ui</file>
+ </gresource>
+</gresources>
diff --git a/data/prepaid-manager-applet.appdata.xml.in b/data/prepaid-manager-applet.appdata.xml.in
deleted file mode 100644
index 3f1f9cb..0000000
--- a/data/prepaid-manager-applet.appdata.xml.in
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Copyright 2014 Guido Günther <agx@sigxcpu.org> -->
-<application>
- <id type="desktop">prepaid-manager-applet.desktop</id>
- <metadata_licence>CC-BY-SA-3.0</metadata_licence>
- <description>
- <_p>
- GNOME Prepaid-manager-applet is an applet for the GNOME Desktop that
- allows you to check and top up the balance of GSM mobile prepaid SIM cards.
- </_p>
- <_p>
- It uses ModemManager to talk to the modem and mobile-broadband-provider-info
- to determine the necessary USSD codes for your provider.
- </_p>
- </description>
- <screenshots>
- <screenshot type="default" width="337" height="150">https://honk.sigxcpu.org/piki/projects/ppm/check.png</screenshot>
- <screenshot type="default" width="337" height="150">https://honk.sigxcpu.org/piki/projects/ppm/topup.png</screenshot>
- </screenshots>
- <url type="homepage">https://honk.sigxcpu.org/piki/projects/ppm/</url>
- <updatecontact>agx_at_sigxcpu.org</updatecontact>
-</application>
diff --git a/data/ui/ppm-error-dialog.ui b/data/ui/ppm-error-dialog.ui
new file mode 100644
index 0000000..a0e1842
--- /dev/null
+++ b/data/ui/ppm-error-dialog.ui
@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.22.2 -->
+<interface>
+ <requires lib="gtk+" version="3.20"/>
+ <template class="PPMErrorDialog" parent="GtkDialog">
+ <property name="can_focus">False</property>
+ <property name="type_hint">dialog</property>
+ <child type="titlebar">
+ <placeholder/>
+ </child>
+ <child internal-child="vbox">
+ <object class="GtkBox">
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">2</property>
+ <child internal-child="action_area">
+ <object class="GtkButtonBox">
+ <property name="can_focus">False</property>
+ <property name="layout_style">end</property>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <object class="GtkButton" id="button1">
+ <property name="label">gtk-ok</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkLabel" id="error_origin">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="margin_left">10</property>
+ <property name="margin_right">10</property>
+ <property name="margin_top">10</property>
+ <property name="margin_bottom">10</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="error_detail">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="margin_left">10</property>
+ <property name="margin_right">10</property>
+ <property name="margin_top">10</property>
+ <property name="margin_bottom">10</property>
+ <property name="wrap">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <action-widgets>
+ <action-widget response="-5">button1</action-widget>
+ </action-widgets>
+ </template>
+</interface>
diff --git a/src/ppm-provider-assistant.ui b/data/ui/ppm-provider-assistant.ui
index 590e18d..684764f 100644
--- a/src/ppm-provider-assistant.ui
+++ b/data/ui/ppm-provider-assistant.ui
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<interface>
- <requires lib="gtk+" version="2.16"/>
+ <requires lib="gtk+" version="3.16"/>
<!-- interface-naming-policy project-wide -->
<object class="GtkListStore" id="liststore_providers">
<columns>
@@ -16,7 +16,7 @@
<column type="gchararray"/>
</columns>
</object>
- <object class="GtkAssistant" id="ppm_provider_assistant">
+ <template class="PPMProviderAssistant" parent="GtkAssistant">
<property name="border_width">12</property>
<property name="title">Provider Configuration</property>
<property name="modal">True</property>
@@ -205,5 +205,5 @@
<property name="title" translatable="yes">Check your selection</property>
</packing>
</child>
- </object>
+ </template>
</interface>
diff --git a/src/ppm.ui b/data/ui/ppm.ui
index 6eee0c0..62fdfd7 100644
--- a/src/ppm.ui
+++ b/data/ui/ppm.ui
@@ -1,79 +1,56 @@
<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.22.2 -->
<interface>
- <requires lib="gtk+" version="2.16"/>
- <object class="GtkWindow" id="ppm_dialog">
- <property name="can_focus">False</property>
- <signal name="delete-event" handler="on_delete" swapped="no"/>
+ <requires lib="gtk+" version="3.16"/>
+ <object class="GtkPopoverMenu" id="menu_main">
<child>
- <object class="GtkVBox" id="vbox_main">
+ <object class="GtkBox">
+ <property name="visible">True</property>
+ <property name="margin">10</property>
+ <child>
+ <object class="GtkModelButton">
+ <property name="visible">True</property>
+ <property name="action-name">win.about</property>
+ <property name="text" translatable="yes">About PPM</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ <template class="PPMDialog" parent="GtkApplicationWindow">
+ <property name="can_focus">False</property>
+ <property name="show_menubar">False</property>
+ <child type="titlebar">
+ <object class="GtkHeaderBar">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="title" translatable="yes">Prepaid Manager</property>
+ <property name="show_close_button">True</property>
<child>
- <object class="GtkMenuBar" id="menubar1">
+ <object class="GtkMenuButton">
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <object class="GtkMenuItem" id="menu_item_file">
- <property name="use_action_appearance">False</property>
- <property name="visible">True</property>
- <property name="can_focus">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="use_action_appearance">False</property>
- <property name="visible">True</property>
- <property name="can_focus">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>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="popover">menu_main</property>
<child>
- <object class="GtkMenuItem" id="menu_item_help">
- <property name="use_action_appearance">False</property>
+ <object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">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="use_action_appearance">False</property>
- <property name="visible">True</property>
- <property name="can_focus">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>
+ <property name="icon_name">open-menu-symbolic</property>
</object>
</child>
</object>
<packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
+ <property name="pack_type">end</property>
</packing>
</child>
- <child>
- <placeholder/>
- </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkBox" id="vbox_main">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
<child>
<object class="GtkNotebook" id="notebook1">
<property name="visible">True</property>
@@ -87,14 +64,17 @@
<property name="column_spacing">4</property>
<property name="row_spacing">4</property>
<child>
+ <placeholder/>
+ </child>
+ <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>
- <property name="x_options"></property>
- <property name="y_options"></property>
+ <property name="x_options"/>
+ <property name="y_options"/>
<property name="x_padding">5</property>
<property name="y_padding">5</property>
</packing>
@@ -111,7 +91,7 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
<property name="x_padding">5</property>
<property name="y_padding">5</property>
</packing>
@@ -119,21 +99,19 @@
<child>
<object class="GtkButton" id="button_provider_change">
<property name="label" translatable="yes">change</property>
- <property name="use_action_appearance">False</property>
<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">Change provider</property>
<property name="tooltip_text" translatable="yes">Change provider</property>
- <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>
<property name="right_attach">3</property>
<property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
<property name="x_padding">5</property>
<property name="y_padding">5</property>
</packing>
@@ -141,13 +119,14 @@
<child>
<object class="GtkLabel" id="label_balance_from">
<property name="can_focus">False</property>
- <property name="label" translatable="yes">Balance information from</property>
+ <property name="label" translatable="yes">Balance from:</property>
+ <property name="wrap">True</property>
</object>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
- <property name="x_options"></property>
- <property name="y_options"></property>
+ <property name="x_options"/>
+ <property name="y_options"/>
<property name="x_padding">5</property>
<property name="y_padding">5</property>
</packing>
@@ -162,7 +141,7 @@
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
<property name="x_padding">5</property>
<property name="y_padding">5</property>
</packing>
@@ -182,7 +161,7 @@
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
<property name="x_padding">5</property>
<property name="y_padding">5</property>
</packing>
@@ -190,14 +169,12 @@
<child>
<object class="GtkButton" id="button_check_balance">
<property name="label" translatable="yes">check</property>
- <property name="use_action_appearance">False</property>
<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>
- <property name="use_action_appearance">False</property>
<signal name="clicked" handler="on_balance_info_renew_clicked" swapped="no"/>
</object>
<packing>
@@ -206,14 +183,11 @@
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
<property name="x_padding">5</property>
<property name="y_padding">5</property>
</packing>
</child>
- <child>
- <placeholder/>
- </child>
</object>
</child>
<child type="tab">
@@ -241,8 +215,8 @@
<property name="label" translatable="yes">Provider:</property>
</object>
<packing>
- <property name="x_options"></property>
- <property name="y_options"></property>
+ <property name="x_options"/>
+ <property name="y_options"/>
<property name="x_padding">5</property>
<property name="y_padding">5</property>
</packing>
@@ -259,7 +233,7 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
<property name="x_padding">5</property>
<property name="y_padding">5</property>
</packing>
@@ -267,18 +241,16 @@
<child>
<object class="GtkButton" id="button_provider_change1">
<property name="label" translatable="yes">change</property>
- <property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <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>
<property name="right_attach">3</property>
<property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
<property name="x_padding">5</property>
<property name="y_padding">5</property>
</packing>
@@ -286,7 +258,6 @@
<child>
<object class="GtkButton" id="button_top_up">
<property name="label" translatable="yes">top up</property>
- <property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">True</property>
@@ -294,7 +265,6 @@
<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>
- <property name="use_action_appearance">False</property>
<signal name="clicked" handler="on_balance_top_up_clicked" swapped="no"/>
</object>
<packing>
@@ -303,7 +273,7 @@
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
<property name="x_padding">5</property>
<property name="y_padding">5</property>
</packing>
@@ -316,7 +286,6 @@
<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>
- <property name="invisible_char_set">True</property>
<property name="placeholder_text">01234567890123</property>
<signal name="changed" handler="on_entry_code_insert" swapped="no"/>
</object>
@@ -325,7 +294,7 @@
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
<property name="x_padding">5</property>
<property name="y_padding">5</property>
</packing>
@@ -339,8 +308,8 @@
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
- <property name="x_options"></property>
- <property name="y_options"></property>
+ <property name="x_options"/>
+ <property name="y_options"/>
<property name="x_padding">5</property>
<property name="y_padding">5</property>
</packing>
@@ -349,12 +318,13 @@
<object class="GtkLabel" id="label_top_up_reply">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="wrap">True</property>
</object>
<packing>
<property name="right_attach">3</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
<property name="x_padding">5</property>
<property name="y_padding">5</property>
</packing>
@@ -378,7 +348,7 @@
</child>
</object>
<packing>
- <property name="expand">False</property>
+ <property name="expand">True</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">2</property>
@@ -386,5 +356,5 @@
</child>
</object>
</child>
- </object>
+ </template>
</interface>
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..25a0350
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,22 @@
+project('ppm',
+ version: '0.0.4',
+ meson_version: '>= 0.49.0',
+)
+
+app_id = 'org.gnome.PrepaidManager'
+package = 'prepaid-manager-applet'
+prefix = get_option('prefix')
+datadir = join_paths(prefix, get_option('datadir'))
+pkgdatadir = join_paths(get_option('prefix'), get_option('datadir'), package)
+
+gnome = import('gnome')
+i18n = import('i18n')
+
+gio_dep = dependency('gio-2.0', version: '>=2.25.6')
+gtk_dep = dependency('gtk+-3.0', version: '>=3.22.0')
+pygobject_dep = dependency('pygobject-3.0', version: '>=3.22')
+
+subdir('data')
+subdir('src')
+subdir('po')
+
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 13933ad..04417b7 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -1,4 +1,3 @@
-data/org.gnome.PrepaidManager.gschema.xml.in.in
data/prepaid-manager-applet.appdata.xml.in
[type: gettext/glade]src/ppm.ui
[type: gettext/glade]src/ppm-provider-assistant.ui
diff --git a/po/meson.build b/po/meson.build
new file mode 100644
index 0000000..90b98bc
--- /dev/null
+++ b/po/meson.build
@@ -0,0 +1,2 @@
+i18n = import('i18n')
+i18n.gettext(package, preset : 'glib')
diff --git a/setup.cfg b/setup.cfg
new file mode 100644
index 0000000..0c70a55
--- /dev/null
+++ b/setup.cfg
@@ -0,0 +1,5 @@
+[flake8]
+# E501: ignore line length
+# E265: block comment should start with '# '
+# E401: multiple imports on one line
+ignore=E501,E265,E401,W504
diff --git a/src/Makefile.am b/src/Makefile.am
deleted file mode 100644
index ada0251..0000000
--- a/src/Makefile.am
+++ /dev/null
@@ -1,23 +0,0 @@
-SUBDIRS = ppm
-
-bin_SCRIPTS_IN = prepaid-manager-applet.in
-bin_SCRIPTS = prepaid-manager-applet
-
-desktopdir = $(datadir)/applications
-desktop_in_files = prepaid-manager-applet.desktop.in
-desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
-
-pythondir = $(pkgdatadir)
-python_DATA = $(PACKAGE).py
-
-EXTRA_DIST = $(python_DATA) $(desktop_in_files) $(ui_DATA) $(bin_SCRIPTS_IN)
-
-@INTLTOOL_DESKTOP_RULE@
-
-uidir = $(pkgdatadir)
-ui_DATA = $(wildcard $(srcdir)/*.ui)
-
-$(PACKAGE): $(srcdir)/$(PACKAGE).in
- sed -e "s,::PACKAGE::,$(PACKAGE)," -e "s,::PYTHONDIR::,$(pkgdatadir)," < $< > $@
-
-CLEANFILES = *.pyc $(desktop_DATA) $(bin_SCRIPTS)
diff --git a/src/meson.build b/src/meson.build
new file mode 100644
index 0000000..170ebe5
--- /dev/null
+++ b/src/meson.build
@@ -0,0 +1,15 @@
+conf = configuration_data()
+conf.set('PYTHONDIR', pkgdatadir)
+conf.set('PACKAGE', package)
+
+configure_file(
+ input: 'prepaid-manager-applet.in',
+ output: 'prepaid-manager-applet',
+ configuration: conf,
+ install_dir: get_option('bindir')
+)
+
+sources = [package + '.py']
+install_data(sources, install_dir: pkgdatadir)
+
+subdir('ppm')
diff --git a/src/ppm/Makefile.am b/src/ppm/Makefile.am
deleted file mode 100644
index 65952cd..0000000
--- a/src/ppm/Makefile.am
+++ /dev/null
@@ -1,25 +0,0 @@
-NULL =
-
-pythondir = $(pkgdatadir)/ppm/
-python_DATA_IN = __init__.py.in
-python_DATA = \
- __init__.py \
- accountdb.py \
- modemproxy.py \
- provider.py \
- providerdb.py \
- $(NULL)
-
-
-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)," \
- -e "s,::PKGDATADIR::,$(pkgdatadir)," \
- < $< > $@
-
-CLEANFILES = *.pyc
diff --git a/src/ppm/__init__.py.in b/src/ppm/__init__.py.in
index 36220b2..aa674ea 100644
--- a/src/ppm/__init__.py.in
+++ b/src/ppm/__init__.py.in
@@ -1,7 +1,8 @@
# Paths for prepaid-manager-applet
-gettext_app = '::PACKAGE::'
-gettext_dir = '::GETTEXTDIR::'
-ui_dir = '::PKGDATADIR::'
-version = '::VERSION::'
-prgname = '::PACKAGE::'
+app_id = '@APP_ID@'
+gettext_app = '@PACKAGE@'
+gettext_dir = '@GETTEXTDIR@'
+data_dir = '@PKGDATADIR@'
+version = '@VERSION@'
+prgname = '@PACKAGE@'
diff --git a/src/ppm/accountdb.py b/src/ppm/accountdb.py
index e0a22a3..9c3d471 100644
--- a/src/ppm/accountdb.py
+++ b/src/ppm/accountdb.py
@@ -14,10 +14,12 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
+from builtins import object
from gi.repository import Gio
from gi.repository import GObject
import logging
+
class Account(GObject.GObject):
identifier = GObject.property(type=str,
nick='account identifier',
@@ -48,8 +50,6 @@ class Account(GObject.GObject):
self.props.balance = balance
self.props.timestamp = timestamp
-GObject.type_register(Account)
-
class AccountDB(object):
"""
@@ -76,7 +76,7 @@ class AccountDB(object):
phone other keys must be possible later
"""
return '%s%s/' % (self.accounts_path_prefix,
- self.imsi_to_identifier(imsi))
+ self.imsi_to_identifier(imsi))
@classmethod
def imsi_to_identifier(klass, imsi):
@@ -89,16 +89,16 @@ class AccountDB(object):
path = self._account_path(imsi)
account = Account()
- account.props.identifier = self.imsi_to_identifier(imsi)
+ account.props.identifier = self.imsi_to_identifier(imsi)
gsettings_account = Gio.Settings(self.PPM_GSETTINGS_ACCOUNT_ID, path)
gsettings_account.bind('provider', account, 'name',
- Gio.SettingsBindFlags.DEFAULT)
+ Gio.SettingsBindFlags.DEFAULT)
gsettings_account.bind('country', account, 'code',
- Gio.SettingsBindFlags.DEFAULT)
+ Gio.SettingsBindFlags.DEFAULT)
gsettings_account.bind('balance', account, 'balance',
- Gio.SettingsBindFlags.DEFAULT)
+ Gio.SettingsBindFlags.DEFAULT)
gsettings_account.bind('timestamp', account, 'timestamp',
- Gio.SettingsBindFlags.DEFAULT)
+ Gio.SettingsBindFlags.DEFAULT)
return account
def fetch(self, imsi):
@@ -132,5 +132,3 @@ class AccountDB(object):
account = self._bind_account(imsi)
account.props.name = provider.name
account.props.code = provider.country
-
-
diff --git a/src/ppm/meson.build b/src/ppm/meson.build
new file mode 100644
index 0000000..bbf049f
--- /dev/null
+++ b/src/ppm/meson.build
@@ -0,0 +1,25 @@
+pythondir = pkgdatadir / 'ppm'
+
+sources = [
+ 'accountdb.py',
+ 'modemproxy.py',
+ 'provider.py',
+ 'providerdb.py',
+]
+install_data(sources, install_dir: pythondir)
+
+conf = configuration_data()
+conf.set('APP_ID', app_id)
+conf.set('VERSION', meson.project_version())
+conf.set('PACKAGE', package)
+conf.set('PYLIBDIR', pkgdatadir)
+conf.set('GETTEXTDIR', datadir / 'locale')
+conf.set('DATADIR', datadir)
+conf.set('PKGDATADIR', pkgdatadir)
+
+configure_file(
+ input: '__init__.py.in',
+ output: '__init__.py',
+ configuration: conf,
+ install_dir: pythondir,
+)
diff --git a/src/ppm/modemproxy.py b/src/ppm/modemproxy.py
index ae3f650..99e303f 100644
--- a/src/ppm/modemproxy.py
+++ b/src/ppm/modemproxy.py
@@ -18,7 +18,12 @@ from gi.repository import GObject
from gi.repository import GLib
from gi.repository import Gio
-import re
+import logging
+
+MM_DBUS_SERVICE = 'org.freedesktop.ModemManager1'
+MM_DBUS_TIMEOUT = 5000
+MM_DBUS_FLAGS = (Gio.DBusProxyFlags.DO_NOT_LOAD_PROPERTIES |
+ Gio.DBusProxyFlags.DO_NOT_CONNECT_SIGNALS)
class ModemError(Exception):
def __init__(self, msg):
@@ -28,7 +33,65 @@ class ModemError(Exception):
return [False, True][self.msg.find("Operation not allowed") != -1]
def is_disabled(self):
- return [False, True][self.msg.find("not enabled") != -1]
+ return [False, True][self.msg.find("not enabled") != -1]
+
+
+class Modem(GObject.GObject):
+ MM_DBUS_INTERFACE_MODEM = 'org.freedesktop.ModemManager1.Modem'
+ MM_DBUS_INTERFACE_MODEM_GSM_USSD = "{}.Modem3gpp.Ussd".format(MM_DBUS_INTERFACE_MODEM)
+
+ MM_STATE_ENABLED = 6
+
+ def on_new_proxy_done(self, proxy, res, iface_name):
+ try:
+ _proxy = proxy.new_for_bus_finish(res)
+ except GLib.Error:
+ logging.exception("Failed to get iface '%s' for modem %s",
+ iface_name, self.path)
+ setattr(self, "_%s_proxy" % iface_name, _proxy)
+
+ def __init__(self, path):
+ GObject.GObject.__init__(self)
+ self._path = path
+
+ self._modem_proxy = None
+ Gio.DBusProxy.new_for_bus(Gio.BusType.SYSTEM,
+ Gio.DBusProxyFlags.DO_NOT_CONNECT_SIGNALS,
+ None,
+ MM_DBUS_SERVICE,
+ self.path,
+ self.MM_DBUS_INTERFACE_MODEM,
+ None,
+ self.on_new_proxy_done,
+ 'modem')
+
+ self._ussd_proxy = None
+ Gio.DBusProxy.new_for_bus(Gio.BusType.SYSTEM,
+ MM_DBUS_FLAGS,
+ None,
+ MM_DBUS_SERVICE,
+ self.path,
+ self.MM_DBUS_INTERFACE_MODEM_GSM_USSD,
+ None,
+ self.on_new_proxy_done,
+ 'ussd')
+
+ @property
+ def path(self):
+ return self._path
+
+ @property
+ def modem_proxy(self):
+ return self._modem_proxy
+
+ @property
+ def ussd_proxy(self):
+ return self._ussd_proxy
+
+ @property
+ def enabled(self):
+ variant = self.modem_proxy.get_cached_property("State")
+ return variant.get_int32() >= self.MM_STATE_ENABLED
class ModemManagerProxy(GObject.GObject):
@@ -39,62 +102,91 @@ class ModemManagerProxy(GObject.GObject):
@type modem: string
"""
- MM_DBUS_SERVICE='org.freedesktop.ModemManager'
- MM_DBUS_INTERFACE_MODEM_MANAGER='org.freedesktop.ModemManager'
- MM_DBUS_OBJECT_MODEM_MANAGER='/org/freedesktop/ModemManager'
- MM_DBUS_INTERFACE_MODEM='org.freedesktop.ModemManager.Modem'
- MM_DBUS_INTERFACE_MODEM_GSM_CARD='org.freedesktop.ModemManager.Modem.Gsm.Card'
- MM_DBUS_INTERFACE_MODEM_GSM_USSD='org.freedesktop.ModemManager.Modem.Gsm.Ussd'
- MM_DBUS_TIMEOUT = 5000
- MM_DBUS_FLAGS = (Gio.DBusProxyFlags.DO_NOT_LOAD_PROPERTIES |
- Gio.DBusProxyFlags.DO_NOT_CONNECT_SIGNALS)
+ DBUS_INTERFACE_PROPERTIES = 'org.freedesktop.DBus.Properties'
+ DBUS_INTERFACE_OBJECT_MANAGER = 'org.freedesktop.DBus.ObjectManager'
+ MM_DBUS_INTERFACE_MODEM_MANAGER = 'org.freedesktop.ModemManager1'
+ MM_DBUS_OBJECT_MODEM_MANAGER = '/org/freedesktop/ModemManager1'
+ MM_DBUS_INTERFACE_SIM = 'org.freedesktop.ModemManager1.Sim'
# IMSIs are 14 or 15 digits
IMSI_RE = r'\d{14,15}'
__gsignals__ = {
# Emitted when a request to MM starts
- 'request-started': (GObject.SignalFlags.RUN_FIRST, None,
- [object]),
+ 'request-started': (GObject.SignalFlags.RUN_FIRST, None,
+ [object]),
# Emitted when a request has finished
'request-finished': (GObject.SignalFlags.RUN_FIRST, None,
[object]),
- }
+ # Emitted when modem search completed
+ 'got-modems': (GObject.SignalFlags.RUN_FIRST, None,
+ [object]),
+ }
+
+ def on_new_object_manager_done(self, obj, res):
+ try:
+ proxy = Gio.DBusProxy.new_for_bus_finish(res)
+ except GLib.Error:
+ logging.exception("Connecting to MM failed")
+ else:
+ self.object_manager = proxy
def __init__(self):
GObject.GObject.__init__(self)
- self.bus = Gio.bus_get_sync(Gio.BusType.SYSTEM, None)
self.request = None
self.reply_func = None
self.error_func = None
self.modem = None
self.obj = None
+ self.objs = None
+
+ self.object_manager = None
+ Gio.DBusProxy.new_for_bus(Gio.BusType.SYSTEM,
+ MM_DBUS_FLAGS,
+ None,
+ MM_DBUS_SERVICE,
+ self.MM_DBUS_OBJECT_MODEM_MANAGER,
+ self.DBUS_INTERFACE_OBJECT_MANAGER,
+ None,
+ self.on_new_object_manager_done)
+ self._modems = []
+
+ def ready(self):
+ return True if self.object_manager else False
+
+ def get_objects(self):
+ self.objs = self.object_manager.GetManagedObjects()
+
+ def objects(self):
+ if self.objs is None:
+ self.get_objects()
+ return self.objs
def set_modem(self, modem):
self.modem = modem
def mm_request(func):
- def wrapped_f( self, *args, **kw):
- self.request = "%s" % func.func_name
- if kw.has_key('reply_func'):
+ def wrapped_f(self, *args, **kw):
+ self.request = "%s" % func.__name__
+ if 'reply_func' in kw:
self.reply_func = kw['reply_func']
- if kw.has_key('error_func'):
+ if 'error_func' in kw:
self.error_func = kw['error_func']
self.emit('request-started', self)
func(self, *args, **kw)
- wrapped_f.__name__= func.__name__
- wrapped_f.__doc__= func.__doc__
+ wrapped_f.__name__ = func.__name__
+ wrapped_f.__doc__ = func.__doc__
return wrapped_f
def mm_request_done(func):
- def wrapped_f( self, *args, **kw):
+ def wrapped_f(self, *args, **kw):
self.emit('request-finished', self)
ret = func(self, *args, **kw)
self.reply_func = None
self.error_func = None
self.request = None
return ret
- wrapped_f.__name__= func.__name__
- wrapped_f.__doc__= func.__doc__
+ wrapped_f.__name__ = func.__name__
+ wrapped_f.__doc__ = func.__doc__
return wrapped_f
def request_pending(self):
@@ -103,6 +195,10 @@ class ModemManagerProxy(GObject.GObject):
else:
return False
+ @property
+ def modems(self):
+ return self._modems
+
@mm_request_done
def handle_dbus_reply(self, obj, result, user_data):
try:
@@ -111,41 +207,62 @@ class ModemManagerProxy(GObject.GObject):
self.reply_func(res, user_data)
except Exception as err:
if self.error_func:
- me = ModemError("%s failed: %s" % (self.request, err))
+ # We don't get a proper error domain so we assume
+ # 'GDBus.Error:org.freedesktop.*: <error message>
+ msg = err.message.split(':', 2)
+ if len(msg) == 3:
+ msg = msg[-1]
+ else:
+ msg = err.message
+ print(msg)
+ me = ModemError("%s failed: %s" % (self.request.replace('_', ' '),
+ msg))
self.error_func(me)
- def get_modems(self):
- modems = []
- mm = Gio.DBusProxy.new_sync(self.bus,
- self.MM_DBUS_FLAGS,
- None,
- self.MM_DBUS_SERVICE,
- self.MM_DBUS_OBJECT_MODEM_MANAGER,
- self.MM_DBUS_INTERFACE_MODEM_MANAGER,
- None)
+ def on_get_managed_objects_finished(self, proxy, res, user_data):
+ self._modems = []
+
try:
- ret = mm.EnumerateDevices()
- except Exception as e:
- raise ModemError("Failed to list modems: %s" % e)
- for modem in ret:
- modems.append(modem)
- return modems
+ objs = proxy.call_finish(res)
+ except Exception as err:
+ logging.error("Failed to get managed modems: %s", err)
+ objs = []
+ return
+
+ for obj in objs:
+ for path, ifaces in obj.items():
+ if Modem.MM_DBUS_INTERFACE_MODEM in ifaces:
+ self._modems.append(Modem(path))
+ logging.debug("Found modems: %s", self.modems)
+ self.emit('got-modems', self)
+
+ def dbus_find_modems(self):
+ """
+ Async method to find modems
+
+ Result will be in modems property
+ """
+ self.object_manager.call("GetManagedObjects",
+ None,
+ Gio.DBusCallFlags.NO_AUTO_START,
+ MM_DBUS_TIMEOUT,
+ None,
+ self.on_get_managed_objects_finished,
+ None)
def get_imsi(self):
- card = Gio.DBusProxy.new_sync(self.bus,
- self.MM_DBUS_FLAGS,
- None,
- self.MM_DBUS_SERVICE,
- self.modem,
- self.MM_DBUS_INTERFACE_MODEM_GSM_CARD,
- None)
+ card = Gio.DBusProxy.new_for_bus_sync(
+ Gio.BusType.SYSTEM,
+ MM_DBUS_FLAGS,
+ None,
+ MM_DBUS_SERVICE,
+ self.objects()[self.modem.path][Modem.MM_DBUS_INTERFACE_MODEM]['Sim'],
+ self.DBUS_INTERFACE_PROPERTIES,
+ None)
try:
- imsi = card.GetImsi()
+ return card.Get('(ss)', self.MM_DBUS_INTERFACE_SIM, 'Imsi')
except Exception as msg:
raise ModemError("Getting IMSI failed: %s" % msg)
- if not re.match(self.IMSI_RE, imsi):
- raise ModemError("%s is not a valid imsi" % imsi)
- return imsi
def get_network_id(self):
imsi = self.get_imsi()
@@ -155,29 +272,15 @@ class ModemManagerProxy(GObject.GObject):
@mm_request
def ussd_initiate(self, command, reply_func=None, error_func=None):
- ussd = Gio.DBusProxy.new_sync(self.bus,
- self.MM_DBUS_FLAGS,
- 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, self.MM_DBUS_TIMEOUT, None,
- self.handle_dbus_reply, None)
+ self.modem.ussd_proxy.call("Initiate", GLib.Variant('(s)', (command,)),
+ Gio.DBusCallFlags.NO_AUTO_START, MM_DBUS_TIMEOUT, None,
+ self.handle_dbus_reply, None)
@mm_request
def _modem__enable(self, enable, reply_func=None, error_func=None):
- ussd = Gio.DBusProxy.new_sync(self.bus,
- self.MM_DBUS_FLAGS,
- 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, self.MM_DBUS_TIMEOUT, None,
- self.handle_dbus_reply, None)
+ self.modem.modem_proxy.call("Enable", GLib.Variant('(b)', (enable,)),
+ Gio.DBusCallFlags.NO_AUTO_START, MM_DBUS_TIMEOUT, None,
+ self.handle_dbus_reply, None)
def modem_enable(self, reply_func=None, error_func=None):
self._modem__enable(True,
@@ -188,5 +291,3 @@ class ModemManagerProxy(GObject.GObject):
self._modem_enable(False,
reply_func=reply_func,
error_func=error_func)
-
-GObject.type_register(ModemManagerProxy)
diff --git a/src/ppm/provider.py b/src/ppm/provider.py
index ccdf810..c782c76 100644
--- a/src/ppm/provider.py
+++ b/src/ppm/provider.py
@@ -14,8 +14,10 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
+from builtins import object
import logging
+
class ProviderError(Exception):
def __init__(self, msg):
self.msg = msg
@@ -48,14 +50,14 @@ class Provider(object):
def has_fetch_balance_cmd(self):
# Only USSD for now
- if self.fetch_balance_cmds.has_key('ussd'):
+ if 'ussd' in self.fetch_balance_cmds:
return True
else:
return False
def has_top_up_cmd(self):
# Only USSD for now
- if self.top_up_cmds.has_key('ussd'):
+ if 'ussd' in self.top_up_cmds:
return True
else:
return False
@@ -73,9 +75,9 @@ class Provider(object):
def fetch_balance(self, mm, reply_func=None, error_func=None):
if self.has_fetch_balance_cmd():
- mm.ussd_initiate (self.fetch_balance_cmds['ussd'],
- reply_func=reply_func,
- error_func=error_func)
+ mm.ussd_initiate(self.fetch_balance_cmds['ussd'],
+ reply_func=reply_func,
+ error_func=error_func)
return True
else:
return False
@@ -83,10 +85,10 @@ class Provider(object):
def top_up(self, mm, code, reply_func=None, error_func=None):
if self.has_top_up_cmd():
cmd = self.top_up_cmds['ussd'][0].replace(
- self.top_up_cmds['ussd'][1],
- code)
+ self.top_up_cmds['ussd'][1],
+ code)
logging.debug("Top up cmd: %s", cmd)
- mm.ussd_initiate (cmd, reply_func=reply_func, error_func=error_func)
+ mm.ussd_initiate(cmd, reply_func=reply_func, error_func=error_func)
return True
else:
return False
diff --git a/src/ppm/providerdb.py b/src/ppm/providerdb.py
index 0e35b59..7bf59a5 100644
--- a/src/ppm/providerdb.py
+++ b/src/ppm/providerdb.py
@@ -14,11 +14,13 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
+from builtins import object
import os
import logging
from lxml import etree
-from provider import Provider
+from . provider import Provider
+
class ProviderDB(object):
"""Proxy to mobile broadband provider database"""
@@ -50,9 +52,9 @@ class ProviderDB(object):
def _load_countries(self):
try:
- for line in file(self.country_codes, 'r'):
+ for line in open(self.country_codes, 'r'):
if line[0] != '#':
- (code, country) = line.split('\t',2)
+ (code, country) = line.split('\t', 2)
self.__countries[code.lower()] = country.strip()
except IOError as msg:
logging.warning("Loading country code database failed: %s" % msg)
@@ -62,8 +64,8 @@ class ProviderDB(object):
name = provider_elem.xpath("./name")[0].text
country = provider_elem.getparent().attrib['code']
gsm_elem = provider_elem.xpath("./gsm")
- provider = Provider(country = country,
- name = name)
+ provider = Provider(country=country,
+ name=name)
if gsm_elem:
self._fill_balance_check_cmd(gsm_elem[0], provider)
self._fill_top_up_cmd(gsm_elem[0], provider)
diff --git a/src/prepaid-manager-applet.desktop.in b/src/prepaid-manager-applet.desktop.in
deleted file mode 100644
index a345d49..0000000
--- a/src/prepaid-manager-applet.desktop.in
+++ /dev/null
@@ -1,8 +0,0 @@
-[Desktop Entry]
-_Name=Prepaid Manager
-_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.in b/src/prepaid-manager-applet.in
index 192cc22..0ab4839 100755
--- a/src/prepaid-manager-applet.in
+++ b/src/prepaid-manager-applet.in
@@ -1,3 +1,3 @@
#!/bin/sh
-exec python "::PYTHONDIR::/::PACKAGE::.py" "$@"
+exec python3 "@PYTHONDIR@/@PACKAGE@.py" "$@"
diff --git a/src/prepaid-manager-applet.py b/src/prepaid-manager-applet.py
index 22464e0..8b227a0 100755
--- a/src/prepaid-manager-applet.py
+++ b/src/prepaid-manager-applet.py
@@ -1,7 +1,7 @@
-#!/usr/bin/python
+#!/usr/bin/python3
# vim: set fileencoding=utf-8 :
#
-# (C) 2010,2011 Guido Guenther <agx@sigxcpu.org>
+# (C) 2010,2011,2020 Guido Guenther <agx@sigxcpu.org>
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
@@ -15,11 +15,9 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
-import gettext
-from gi.repository import GObject
-from gi.repository import GLib
-from gi.repository import Gtk
-from gi.repository import Gdk
+from builtins import str
+from builtins import range
+from builtins import object
import locale
import logging
import os
@@ -31,12 +29,27 @@ from ppm.modemproxy import (ModemManagerProxy, ModemError)
from ppm.providerdb import ProviderDB
from ppm.accountdb import AccountDB
+import gettext
+import gi
+from gi.repository import Gio
+from gi.repository import GObject
+from gi.repository import GLib
+gi.require_version('Gtk', '3.0')
+from gi.repository import Gtk # noqa: E402
+from gi.repository import Gdk # noqa: E402
+
+
_ = None
+
+# Needs to happen early so we can use it to create classes based on templates
+resource = Gio.Resource.load(os.path.join(ppm.data_dir, "ppm.gresource"))
+resource._register()
+
# The controller receives input and initiates a response by making calls on model
# objects. A controller accepts input from the user and instructs the model and
# view to perform actions based on that input.
-class PPMController(GObject.GObject):
+class PPMController(Gtk.Application):
"""
@ivar providers: the possible providers
@ivar imsi: the imsi if we could fetch it from the modem
@@ -51,15 +64,17 @@ class PPMController(GObject.GObject):
# Emitted when the provider changed
'provider-changed': (GObject.SignalFlags.RUN_FIRST, None,
[object]),
- }
+ }
def _connect_mm_signals(self):
self.mm.connect('request-started', self.on_mm_request_started)
self.mm.connect('request-finished', self.on_mm_request_finished)
+ self.mm.connect('got-modems', self.on_mm_got_modems)
def __init__(self):
- GObject.GObject.__init__(self)
+ Gtk.Application.__init__(self, application_id=ppm.app_id)
self.mm = None
+ self.mm_tries = 0
self.imsi = None
self.provider = None
self.account = None
@@ -72,9 +87,12 @@ class PPMController(GObject.GObject):
def fetch_balance(self):
"""Fetch the current account balance from the network"""
+ if not self.mm.modem.enabled:
+ self.view.show_modem_enable()
+
if not self.provider.fetch_balance(self.mm,
- reply_func=self.on_balance_info_fetched,
- error_func=self.on_modem_error):
+ reply_func=self.on_balance_info_fetched,
+ error_func=self.on_modem_error):
self.view.show_provider_balance_info_missing(self.provider)
logging.error("No idea how to fetch account information for "
"%s in %s.", self.provider.name, self.provider.country)
@@ -154,6 +172,11 @@ class PPMController(GObject.GObject):
"""Fetch the imsi and deduce account and provider information"""
logging.debug("Fetching account information")
+
+ if not self.mm.modem.enabled:
+ self.view.show_modem_enable()
+ return False
+
try:
self.imsi = self.mm.get_imsi()
except ModemError as me:
@@ -161,17 +184,13 @@ class PPMController(GObject.GObject):
if me.is_forbidden():
self.view.show_provider_assistant()
return False
- if not me.is_disabled():
- self.view.show_modem_error(me.msg)
- return False
- logging.info("modem not enabled.")
- self.view.show_modem_enable()
+ self.view.show_modem_error(me.msg)
return False
try:
account = self._get_account_from_accountdb(self.imsi)
- except:
+ except Exception:
# Fetching account from the DB failed, so start over
account = None
@@ -188,29 +207,35 @@ class PPMController(GObject.GObject):
# Everything worked out, disable the timer.
return False
- def setup(self):
- logging.debug("Setting up")
-
- self.mm = ModemManagerProxy()
- self._connect_mm_signals()
-
- try:
- modems = self.mm.get_modems()
- except ModemError as e:
- logging.error("%s" % e.msg)
- modems = None
- if modems:
- modem = modems[0] # FIXME: handle multiple modems
+ def on_mm_got_modems(self, obj, mm_proxy):
+ if mm_proxy.modems:
+ modem = mm_proxy.modems[0] # FIXME: handle multiple modems
logging.debug("Using modem %s" % modem)
self.mm.set_modem(modem)
- GObject.timeout_add(500, self.init_account_and_provider)
+ GLib.timeout_add(500, self.init_account_and_provider)
else:
self.view.show_no_modem_found()
+
+ def setup(self):
+ logging.debug("Setting up")
+ # Wait for MM Proxy to become ready:
+ if not self.mm.ready():
+ self.mm_tries += 1
+ logging.debug("Not yet ready, rescheduling")
+ return True
+ if self.mm_tries > 5:
+ self.view.show_no_modem_found()
+ return False
+
+ self.mm.dbus_find_modems()
return False
def schedule_setup(self):
"""Schedule another run of setup"""
- GObject.timeout_add(1, self.setup)
+
+ self.mm = ModemManagerProxy()
+ self._connect_mm_signals()
+ GLib.timeout_add(500, self.setup)
def enable_modem(self):
"""Enable the modem"""
@@ -252,16 +277,16 @@ class PPMController(GObject.GObject):
def on_modem_enable(self, var, user_data):
"""Callback for succesful MM enable modem call"""
- GObject.timeout_add(500, self.init_account_and_provider)
+ GLib.timeout_add(500, self.init_account_and_provider)
def on_modem_enable_error(self, e):
"""Callback for failed MM enable modem call"""
self.on_modem_error(e)
- GObject.timeout_add(500, self.init_account_and_provider)
+ GLib.timeout_add(500, self.init_account_and_provider)
def on_modem_error(self, e):
- self.view.show_modem_error(e.msg)
logging.error(e.msg)
+ self.view.show_modem_error(e.msg)
# The modem might have disconnected. So reschedule the setup
self.schedule_setup()
@@ -280,8 +305,8 @@ class PPMController(GObject.GObject):
self.account.update_provider(provider)
if self.account.props.timestamp:
self.view.update_account_balance_information(
- self.account.balance,
- self.account.timestamp)
+ self.account.balance,
+ self.account.timestamp)
def on_balance_info_changed(self, obj, balance):
"""Act on balance-info-changed signal"""
@@ -293,46 +318,46 @@ class PPMController(GObject.GObject):
self.view.update_account_balance_information(balance, timestamp)
-
-GObject.type_register(PPMController)
-
-
-class PPMObject(object):
- """Dialog or window constructed via a GtkBuilder"""
- def __init__(self, view, ui):
- if view:
- self.controller = view.controller
- else:
- self.controller = None
- self._load_ui(ui)
-
- def _load_ui(self, ui):
- """Load the user interfade description"""
- self.builder = Gtk.Builder()
- self.builder.set_translation_domain(ppm.gettext_app)
- self.builder.add_from_file(os.path.join(ppm.ui_dir, '%s.ui' % ui))
- self.builder.connect_signals(self)
-
- def _add_elem(self, name):
- self.__dict__[name] = self.builder.get_object(name)
-
- def _add_elements(self, *args):
- for name in args:
- self._add_elem(name)
-
-# View
-class PPMDialog(GObject.GObject, PPMObject):
+# Views
+@Gtk.Template.from_resource('/org/gnome/PrepaidManager/ui/ppm-error-dialog.ui')
+class PPMErrorDialog(Gtk.Dialog):
+ __gtype_name__ = "PPMErrorDialog"
+ error_origin = Gtk.Template.Child()
+ error_detail = Gtk.Template.Child()
+
+ def __init__(self, origin, detail):
+ Gtk.Dialog.__init__(self)
+
+ self.error_origin.set_text(origin)
+ self.error_detail.set_text(detail)
+ self.set_title(GLib.get_application_name())
+
+
+@Gtk.Template.from_resource('/org/gnome/PrepaidManager/ui/ppm.ui')
+class PPMDialog(Gtk.ApplicationWindow):
+ __gtype_name__ = "PPMDialog"
+
+ label_balance_provider_name = Gtk.Template.Child()
+ label_topup_provider_name = Gtk.Template.Child()
+ label_balance_info = Gtk.Template.Child()
+ label_balance_timestamp = Gtk.Template.Child()
+ label_balance_from = Gtk.Template.Child()
+ entry_code = Gtk.Template.Child()
+ button_top_up = Gtk.Template.Child()
+ label_top_up_reply = Gtk.Template.Child()
+ vbox_main = Gtk.Template.Child()
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)
+ parent=self,
+ 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):
"""Init dialogs shown from the main window"""
@@ -346,33 +371,26 @@ class PPMDialog(GObject.GObject, PPMObject):
self.no_modem_found_info_bar = PPMNoModemFoundInfoBar(self)
def _setup_ui(self):
- self.dialog = self.builder.get_object("ppm_dialog")
- self._add_elements("label_balance_provider_name",
- "label_topup_provider_name",
- "label_balance_info",
- "label_balance_timestamp",
- "label_balance_from",
- "entry_code",
- "button_top_up",
- "label_top_up_reply",
- "vbox_main")
self._init_infobars()
self._init_subdialogs()
+ def _add_actions(self):
+ action = Gio.SimpleAction(name='about')
+ action.set_enabled(True)
+ action.connect('activate', self.on_about_activated, None)
+
+ self.add_action(action)
+
def __init__(self, controller):
- GObject.GObject.__init__(self)
- PPMObject.__init__(self, None, "ppm")
+ Gtk.ApplicationWindow.__init__(self)
self.code_len = 0
self.controller = controller
# Register ourself to the controller
self.controller.view = self
+ self._add_actions()
self._setup_ui()
- self.dialog.show()
-
- def close(self):
- self.dialog.hide()
- self.dialog.destroy()
+ self.show()
@property
def info_bar_container(self):
@@ -382,34 +400,29 @@ class PPMDialog(GObject.GObject, PPMObject):
def get_top_up_code(self):
return self.entry_code.get_text().strip()
- def on_close_clicked(self, dummy):
- self.controller.quit()
-
- def on_delete(self, event, dummy):
- self.controller.quit()
- return False
-
+ @Gtk.Template.Callback("on_balance_top_up_clicked")
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_about_activated(self, *argv):
+ self.about_dialog.show()
+ @Gtk.Template.Callback("on_balance_info_renew_clicked")
def on_balance_info_renew_clicked(self, dummy):
self.controller.fetch_balance()
+ @Gtk.Template.Callback("on_provider_change_clicked")
def on_provider_change_clicked(self, dummy):
self.controller.get_provider_interactive(imsi=None)
+ @Gtk.Template.Callback("on_entry_code_insert")
def on_entry_code_insert(self, entry):
- cur_len = entry.get_text_length()
+ cur_len = entry.get_text_length()
sensitive = True
if self.code_len > 0:
- self.entry_code.set_progress_fraction(float(cur_len) /
- self.code_len)
+ self.entry_code.set_progress_fraction(cur_len / self.code_len)
if cur_len != self.code_len:
sensitive = False
self.button_top_up.set_sensitive(sensitive)
@@ -423,7 +436,7 @@ class PPMDialog(GObject.GObject, PPMObject):
placeholder = ''
self.code_len = len
if len:
- placeholder = "".join([ str(x)[-1] for x in range(1, len+1) ])
+ placeholder = "".join([str(x)[-1] for x in range(1, len + 1)])
self.entry_code.set_placeholder_text(placeholder)
def update_account_balance_information(self, balance_text, timestamp):
@@ -448,14 +461,10 @@ class PPMDialog(GObject.GObject, PPMObject):
self.provider_info_missing_dialog.provider_unknown(mcc, mnc)
def show_modem_error(self, msg):
- dialog = Gtk.MessageDialog(parent=self.dialog,
- flags=Gtk.DialogFlags.MODAL |
- Gtk.DialogFlags.DESTROY_WITH_PARENT,
- message_type=Gtk.MessageType.ERROR,
- buttons=Gtk.ButtonsType.OK)
- dialog.set_markup("Modem error: %s" % msg)
+ logging.debug(msg)
+ dialog = PPMErrorDialog(_("Modem error"), msg)
dialog.run()
- dialog.hide()
+ dialog.destroy()
def show_modem_enable(self):
self.enable_modem_info_bar.show()
@@ -470,14 +479,9 @@ class PPMDialog(GObject.GObject, PPMObject):
def show_error(self, msg):
"""show generic error"""
logging.debug(msg)
- error = Gtk.MessageDialog(parent=self.dialog,
- flags=Gtk.DialogFlags.MODAL |
- Gtk.DialogFlags.DESTROY_WITH_PARENT,
- message_type=Gtk.MessageType.ERROR,
- buttons=Gtk.ButtonsType.OK)
- error.set_markup(msg)
- error.run()
- error.hide()
+ dialog = PPMErrorDialog(_("Error"), msg)
+ dialog.run()
+ dialog.destroy()
def show_modem_response(self):
self.modem_response_info_bar.show()
@@ -486,9 +490,6 @@ class PPMDialog(GObject.GObject, PPMObject):
self.modem_response_info_bar.hide()
-GObject.type_register(PPMDialog)
-
-
class PPMInfoBar(object):
def __init__(self, view):
self.view = view
@@ -502,7 +503,7 @@ class PPMInfoBar(object):
def hide(self):
self.info_bar.hide()
self.view.info_bar_container.remove(self.info_bar)
- self.view.dialog.resize(1, 1)
+ self.view.resize(1, 1)
class PPMEnableModemInfoBar(PPMInfoBar):
@@ -512,13 +513,13 @@ class PPMEnableModemInfoBar(PPMInfoBar):
PPMInfoBar.__init__(self, view)
self.info_bar.add_button(_("Enable"), Gtk.ResponseType.OK)
self.info_bar.set_message_type(Gtk.MessageType.WARNING)
- self.msg_label = Gtk.Label(_("Modem not enabled"))
+ self.msg_label = Gtk.Label(label=_("Modem not enabled"))
content_area = self.info_bar.get_content_area()
content_area.add(self.msg_label)
self.msg_label.show()
self.info_bar.connect("response", self.on_enable_clicked)
- def on_enable_clicked(self, info_bar, response_id):
+ def on_enable_clicked(self, info_bar, response_id):
self.hide()
self.controller.enable_modem()
@@ -535,13 +536,13 @@ class PPMModemResponseInfoBar(PPMInfoBar):
def show(self):
logging.debug("Awaiting modem resonse")
- self.timer = GObject.timeout_add(50, self.do_progress,
- priority=GLib.PRIORITY_HIGH)
+ self.timer = GLib.timeout_add(50, self.do_progress,
+ priority=GLib.PRIORITY_HIGH)
PPMInfoBar.show(self)
def hide(self):
if self.timer:
- GObject.source_remove(self.timer)
+ GLib.source_remove(self.timer)
self.timer = None
PPMInfoBar.hide(self)
@@ -554,37 +555,41 @@ class PPMNoModemFoundInfoBar(PPMInfoBar):
def __init__(self, container):
PPMInfoBar.__init__(self, container)
self.info_bar.set_message_type(Gtk.MessageType.WARNING)
- self.msg_label = Gtk.Label(_("No modem found."))
+ self.msg_label = Gtk.Label(label=_("No modem found."))
content_area = self.info_bar.get_content_area()
content_area.add(self.msg_label)
self.info_bar.add_button(_("Try again"), Gtk.ResponseType.OK)
self.info_bar.connect("response", self.on_try_again_clicked)
- def on_try_again_clicked(self, info_bar, response_id):
+ def on_try_again_clicked(self, info_bar, response_id):
logging.debug("Rescheduling modem setup")
self.hide()
self.controller.schedule_setup()
-class PPMProviderAssistant(PPMObject):
- PAGE_INTRO, PAGE_COUNTRIES, PAGE_PROVIDERS, PAGE_CONFIRM = range(0, 4)
+@Gtk.Template.from_resource('/org/gnome/PrepaidManager/ui/ppm-provider-assistant.ui')
+class PPMProviderAssistant(Gtk.Assistant):
+ PAGE_INTRO, PAGE_COUNTRIES, PAGE_PROVIDERS, PAGE_CONFIRM = list(range(0, 4))
+
+ __gtype_name__ = "PPMProviderAssistant"
+
+ vbox_countries = Gtk.Template.Child()
+ treeview_countries = Gtk.Template.Child()
+ vbox_providers = Gtk.Template.Child()
+ treeview_providers = Gtk.Template.Child()
+ liststore_providers = Gtk.Template.Child()
+ label_country = Gtk.Template.Child()
+ label_provider = Gtk.Template.Child()
def __init__(self, main_dialog):
- PPMObject.__init__(self, main_dialog, "ppm-provider-assistant")
- self.assistant = self.builder.get_object("ppm_provider_assistant")
- self._add_elements("vbox_countries",
- "treeview_countries",
- "vbox_providers",
- "treeview_providers",
- "liststore_providers",
- "label_country",
- "label_provider")
- self.assistant.set_transient_for(main_dialog.dialog)
+ Gtk.Assistant.__init__(self)
+ self.set_transient_for(main_dialog)
self.liststore_countries = None
self.country_code = None
self.provider = None
self.possible_providers = None
self.providers_initialized = False
+ self.controller = Gio.Application.get_default()
def _get_current_country_from_locale(self):
(l, enc) = locale.getlocale()
@@ -597,14 +602,13 @@ class PPMProviderAssistant(PPMObject):
treeselection = self.treeview_countries.get_selection()
treeselection.select_path(path)
self.treeview_countries.scroll_to_cell(path)
- self.assistant.set_page_complete(self.vbox_countries, True)
+ self.set_page_complete(self.vbox_countries, True)
def _fill_liststore_countries(self):
"""Fille the countries liststore with all known countries"""
lcode = self._get_current_country_from_locale()
if not self.liststore_countries:
- self.liststore_countries = self.builder.get_object(
- "liststore_countries")
+ self.liststore_countries = self.treeview_countries.get_model()
for (country, code) in self.controller.get_provider_countries():
if country is None:
country = code
@@ -619,10 +623,10 @@ class PPMProviderAssistant(PPMObject):
if current_page < self.PAGE_PROVIDERS:
return self.PAGE_PROVIDERS
else:
- return current_page+1
+ return current_page + 1
def _all_pages_func(self, current_page, user_data):
- return current_page+1
+ return current_page + 1
def show(self, providers=None):
self.possible_providers = providers
@@ -632,17 +636,18 @@ class PPMProviderAssistant(PPMObject):
if not self.possible_providers:
# No list of possible providers so allow to select the country first
self._fill_liststore_countries()
- self.assistant.set_forward_page_func(self._all_pages_func, None)
+ self.set_forward_page_func(self._all_pages_func, None)
else:
# List of possible providers given, all from the same country
self.country_code = self.possible_providers[0].country
- self.assistant.set_forward_page_func(self._providers_only_page_func,
+ self.set_forward_page_func(self._providers_only_page_func,
None)
- self.assistant.show()
+ Gtk.Widget.show(self)
def close(self):
- self.assistant.hide()
+ self.hide()
+ @Gtk.Template.Callback("on_ppm_provider_assistant_cancel")
def on_ppm_provider_assistant_cancel(self, obj):
logging.debug("Assistant canceled.")
self.close()
@@ -661,8 +666,9 @@ class PPMProviderAssistant(PPMObject):
0,
provider.name)
+ @Gtk.Template.Callback("on_ppm_provider_assistant_prepare")
def on_ppm_provider_assistant_prepare(self, obj, page):
- if self.assistant.get_current_page() == self.PAGE_PROVIDERS:
+ if self.get_current_page() == self.PAGE_PROVIDERS:
if self.possible_providers:
if self.providers_initialized:
return
@@ -676,28 +682,31 @@ class PPMProviderAssistant(PPMObject):
else:
self.providers_initialized = self.country_code
self._fill_provider_liststore_by_country_code(self.country_code)
- elif self.assistant.get_current_page() == self.PAGE_CONFIRM:
+ elif self.get_current_page() == self.PAGE_CONFIRM:
country = self.controller.get_country_by_code(self.country_code)
label = country if country else self.country_code
self.label_country.set_text(label)
self.label_provider.set_text(self.provider)
+ @Gtk.Template.Callback("on_treeview_countries_changed")
def on_treeview_countries_changed(self, obj):
selection = self.treeview_countries.get_selection()
(model, iter) = selection.get_selected()
if not iter:
return
self.country_code = model.get_value(iter, 1)
- self.assistant.set_page_complete(self.vbox_countries, True)
+ self.set_page_complete(self.vbox_countries, True)
+ @Gtk.Template.Callback("on_treeview_providers_changed")
def on_treeview_providers_changed(self, obj):
selection = self.treeview_providers.get_selection()
(model, iter) = selection.get_selected()
if not iter:
return
self.provider = model.get_value(iter, 0)
- self.assistant.set_page_complete(self.vbox_providers, True)
+ self.set_page_complete(self.vbox_providers, True)
+ @Gtk.Template.Callback("on_ppm_provider_assistant_close")
def on_ppm_provider_assistant_close(self, obj):
logging.debug("Selected: %s %s", self.provider, self.country_code)
self.close()
@@ -715,23 +724,23 @@ class PPMProviderInfoMissingDialog(object):
'MobileBroadband/ServiceProviders\">GNOME Wiki</a>')
def __init__(self, main_dialog):
- self.dialog = Gtk.MessageDialog(parent=main_dialog.dialog,
- flags=Gtk.DialogFlags.MODAL |
- Gtk.DialogFlags.DESTROY_WITH_PARENT,
+ self.dialog = Gtk.MessageDialog(parent=main_dialog,
+ modal=True,
+ destroy_with_parent=True,
message_type=Gtk.MessageType.INFO,
buttons=Gtk.ButtonsType.OK)
self.messages = {
'balance_info_missing':
- _("We can't find the information on how to query the "
- "account balance from your provider '%s' in our database."),
+ _("We can't find the information on how to query the "
+ "account balance from your provider '%s' in our database."),
'top_up_info_missing':
- _("We can't find the information on how to top up the "
- "balance for your provider '%s' in our database."),
+ _("We can't find the information on how to top up the "
+ "balance for your provider '%s' in our database."),
'provider_unknown':
- _("We can't find any information about your provider with "
- "mcc '%s' and mnc '%s'.")
- }
- self.common_msg = _("\n\nYou can go to the %s to learn how to provide that "
+ _("We can't find any information about your provider with "
+ "mcc '%s' and mnc '%s'.")
+ }
+ self.common_msg = _("\n\nYou can go to %s to learn how to provide that "
"information.")
def _run(self, msg):
@@ -744,7 +753,7 @@ class PPMProviderInfoMissingDialog(object):
msg = self.messages['balance_info_missing'] % provider.name
self._run(msg)
- def top_upinfo_missing(self, provider):
+ def top_up_info_missing(self, provider):
msg = self.messages['top_up_info_missing'] % provider.name
self._run(msg)
@@ -763,23 +772,10 @@ def setup_i18n():
logging.debug('Using locale: %s', locale.getlocale())
-def setup_schemas():
- """If we're running from the source tree add our gsettings schema to the
- list of schema dirs"""
-
- schema_dir = 'data'
- schema = os.path.join(schema_dir,
- "%s.gschema.xml" % AccountDB.PPM_GSETTINGS_ID)
- if os.path.exists(schema):
- logging.debug("Running from source tree, adding local schema dir '%s'"
- % schema_dir)
- 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_prgname(ppm.app_id)
+ Gdk.set_program_class(ppm.app_id)
GLib.set_application_name(_("Prepaid Manager"))
@@ -796,18 +792,18 @@ def main(args):
logging.basicConfig(level=log_level,
format='ppm: %(levelname)s: %(message)s')
- logging.debug("%s %s", ppm.prgname, ppm.version)
+ logging.debug("%s %s", ppm.app_id, ppm.version)
setup_i18n()
setup_prgname()
- setup_schemas()
controller = PPMController()
- main_dialog = PPMDialog(controller)
+ PPMDialog(controller)
controller.schedule_setup()
Gtk.main()
+
if __name__ == "__main__":
try:
main(sys.argv)