pax_global_header00006660000000000000000000000064121727141170014515gustar00rootroot0000000000000052 comment=fa7eb985b6ea4c9ec66120df5f89a2953cb030fb modem-manager-gui-0.0.16/000077500000000000000000000000001217271411700150745ustar00rootroot00000000000000modem-manager-gui-0.0.16/.tx/000077500000000000000000000000001217271411700156055ustar00rootroot00000000000000modem-manager-gui-0.0.16/.tx/config000066400000000000000000000003011217271411700167670ustar00rootroot00000000000000[main] host = https://www.transifex.com [modem-manager-gui.modem-manager-gui-internationalization-template] file_filter = po/.po source_file = po/modem-manager-gui.pot source_lang = en modem-manager-gui-0.0.16/AUTHORS000066400000000000000000000016741217271411700161540ustar00rootroot00000000000000MAIN DEVELOPERS: Alex CONTRIBUTORS: Graham Inggs ARTISTS: Yogesh Kanitkar Michal Konstantynowicz / shokunin LlubNek Umidjon Almasov TRANSLATORS: Russian - Alex Uzbek - Umidjon Almasov Ukrainian - Игорь Гриценко Роман Лепіш Portuguese (Brazil) - Rafael Ferreira Turkish - Ahmet Sezgin Duran Indonesian - Ade Malsasa Akbar Bengali (Bangladesh) - Reazul Iqbal modem-manager-gui-0.0.16/Changelog000066400000000000000000000021661217271411700167130ustar00rootroot00000000000000* Sat Jul 20 2013 * Version 0.0.16 release * Sat Jan 12 2013 * Icons for SMS folders added * Wed Jan 2 2013 * Ukrainian localization added * Mon Dec 31 2012 Alex * USSD session support and additional request validation * USSD commands list added * SMS folders added * SMS concatenation can be disabled * Uzbek localization added * Thu Sep 06 2012 Alex * Traffic limits control * USSD session support and additional request validation * Wed Aug 22 2012 Alex * SMS message validation changes * Thu Aug 16 2012 Alex * Traffic statistics and SMS updates can be disabled * Wed Aug 08 2012 Alex * Libindicate can be disabled * Tue Jul 17 2012 Alex * Ubuntu ARB suggested fixes * Sat Jul 7 2012 Alex * Libindicate support (unread SMS indication) * Libnotify support (new SMS indication) * Russian localization added * Simple man page added * Fri Jul 6 2012 Alex * Initial release modem-manager-gui-0.0.16/LICENSE000066400000000000000000001045131217271411700161050ustar00rootroot00000000000000 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. 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. Copyright (C) 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 . 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: Copyright (C) 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 . 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 . modem-manager-gui-0.0.16/Makefile000066400000000000000000000012101217271411700165260ustar00rootroot00000000000000include Makefile_h DESTDIR=$(PREFIX)/bin all: modem-manager-gui modem-manager-gui: (cd src && ${MAKE} all) (cd src/modules && ${MAKE} all) (cd po && ${MAKE} all) install: (cd src && ${MAKE} install) (cd src/modules && ${MAKE} install) (cd resources && ${MAKE} install) (cd po && ${MAKE} install) (cd man && ${MAKE} install) uninstall: (cd src && ${MAKE} uninstall) (cd src/modules && ${MAKE} uninstall) (cd resources && ${MAKE} uninstall) (cd po && ${MAKE} uninstall) (cd man && ${MAKE} uninstall) clean: (cd src && ${MAKE} clean) (cd src/modules && ${MAKE} clean) (cd resources && ${MAKE} clean) (cd po && ${MAKE} clean) modem-manager-gui-0.0.16/configure000077500000000000000000000146371217271411700170160ustar00rootroot00000000000000#!/bin/sh # configure # # Copyright 2012-2013 Alex # 2013 Graham Inggs # # 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 . prefix=/usr libpath=/usr/lib prefixchanged=false libpathchanged=false cflags=$CFLAGS if [ "x$cflags" = x ] ; then cflags='-mtune=native -O3' fi for arg_iter in "$@"; do arg=${arg_iter%%=*} arg_value=${arg_iter#*=} case $arg in --help) echo "This script generates Modem Manager GUI configuration and build files. It also checks if all dependencies are fulfilled. Used without arguments, default settings are applied. Arguments are : --help : Display this message and exit. --prefix=PATH : Set PATH as file-system root for installation. --libdir=PATH : Set PATH as a directory for libraries. --cflags=PARAMETERS : Pass PARAMETERS to the compiler." exit 0;; --prefix) prefixchanged=true prefix=$(eval echo $arg_value);; --libdir) libpathchanged=true libpath=$(eval echo $arg_value);; --cflags) echo "Using : \"$arg_value\" as compilation options." cflags="$arg_value ";; esac done if $prefixchanged ; then if ! $libpathchanged ; then libpath="$prefix/lib" fi fi echo -n "Checking depencies... " if ! pkg-config --print-errors --exists 'gtk+-3.0 >= 3.4.0'; then echo 'ERROR: Please install GTK+ version 3.4.0 or later' exit 1 fi if ! test -e "/usr/include/gdbm/gdbm.h"; then if ! test -e "/usr/include/gdbm.h"; then echo 'ERROR: Please install GDBM library with development headers' exit 1 fi fi echo done echo -n "Generating Makefile_h... " echo "#WARNING: Auto-generated file, edit with care. CFLAGS := $cflags LIBPATH := $libpath PREFIX := $prefix" > Makefile_h echo done echo -n "Generating resources.h... " echo "/* * resources.h * * Copyright 2012 Alex * * 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 . */ /* WARNING: Auto-generated file, edit with care. */ #ifndef __RESOURCES_H__ #define __RESOURCES_H__ #define RESOURCE_MAINWINDOW_ICON \"$prefix/share/pixmaps/modem-manager-gui.png\" #define RESOURCE_MAINWINDOW_UI \"$prefix/share/modem-manager-gui/ui/modem-manager-gui.ui\" #define RESOURCE_TOOLBAR_DEV \"$prefix/share/modem-manager-gui/pixmaps/dev-tb.png\" #define RESOURCE_TOOLBAR_SMS \"$prefix/share/modem-manager-gui/pixmaps/sms-tb.png\" #define RESOURCE_TOOLBAR_USSD \"$prefix/share/modem-manager-gui/pixmaps/ussd-tb.png\" #define RESOURCE_TOOLBAR_INFO \"$prefix/share/modem-manager-gui/pixmaps/info-tb.png\" #define RESOURCE_TOOLBAR_SCAN \"$prefix/share/modem-manager-gui/pixmaps/scan-tb.png\" #define RESOURCE_TOOLBAR_CONT \"$prefix/share/modem-manager-gui/pixmaps/cont-tb.png\" #define RESOURCE_TOOLBAR_TRAFFIC \"$prefix/share/modem-manager-gui/pixmaps/traffic-tb.png\" #define RESOURCE_SMS_READ \"$prefix/share/modem-manager-gui/pixmaps/sms-read.png\" #define RESOURCE_SMS_UNREAD \"$prefix/share/modem-manager-gui/pixmaps/sms-unread.png\" #define RESOURCE_MESSAGE_RECIEVED \"$prefix/share/modem-manager-gui/pixmaps/message-received.png\" #define RESOURCE_MESSAGE_SENT \"$prefix/share/modem-manager-gui/pixmaps/message-sent.png\" #define RESOURCE_MESSAGE_DRAFTS \"$prefix/share/modem-manager-gui/pixmaps/message-drafts.png\" #define RESOURCE_INFO_EQUIPMENT \"$prefix/share/modem-manager-gui/pixmaps/info-equipment.png\" #define RESOURCE_INFO_NETWORK \"$prefix/share/modem-manager-gui/pixmaps/info-network.png\" #define RESOURCE_INFO_LOCATION \"$prefix/share/modem-manager-gui/pixmaps/info-location.png\" #define RESOURCE_SOUND_MESSAGE \"$prefix/share/modem-manager-gui/sounds/message.ogg\" #define RESOURCE_DESKTOP_FILE \"/usr/share/applications/modem-manager-gui.desktop\" #define RESOURCE_MODULES_DIR \"$libpath/modem-manager-gui/modules/\" #define RESOURCE_LOCALE_DIR \"$prefix/share/locale/\" #define RESOURCE_LOCALE_DOMAIN \"modem-manager-gui\" #endif // __RESOURCES_H__" > src/resources.h echo done echo -n "Generating launcher... " echo " [Desktop Entry] Name=Modem Manager GUI GenericName=Modem Manager GUI Comment=Graphical interface for Modem manager daemon control Comment[ru]=Программа для управления специфическими функциями EDGE/3G/4G модемов Comment[uz]=EDGE/3G/4G modemning o'ziga xos vazifalarini boshqarish vositasi Comment[uk]=Інструмент для керування специфічними функціями EDGE/3G/4G модемів Comment[pt_BR]=Ferramenta para controle de funções específicas de modem EDGE/3G/4G Comment[tr]=EDGE/3G/4G modemler için özel işlev kontrol aracı Comment[id]=Perangkat lunak untuk mengendalikan fungsi spesifik modem EDGE/3G/4G Exec=$prefix/bin/modem-manager-gui Icon=$prefix/share/pixmaps/modem-manager-gui.png Terminal=false Type=Application Categories=System;" > resources/modem-manager-gui.desktop echo done modem-manager-gui-0.0.16/man/000077500000000000000000000000001217271411700156475ustar00rootroot00000000000000modem-manager-gui-0.0.16/man/Makefile000066400000000000000000000006661217271411700173170ustar00rootroot00000000000000include ../Makefile_h GZIP = gzip -f --best FILES_MAN:=$(wildcard *.1) FILES_GZ:=$(wildcard *.gz) MANDIR = $(PREFIX)/share/man/man1 all: install: install -d $(INSTALLPREFIX)$(DESTDIR)$(MANDIR); for f in $(FILES_MAN); do install -m 644 $$f $(INSTALLPREFIX)$(DESTDIR)$(MANDIR); $(GZIP) $(INSTALLPREFIX)$(DESTDIR)$(MANDIR)/$$f; done uninstall: for f in $(FILES_MAN); do rm -f $(INSTALLPREFIX)$(DESTDIR)$(MANDIR)/$$f.gz; done clean: modem-manager-gui-0.0.16/man/modem-manager-gui.1000066400000000000000000000014521217271411700212260ustar00rootroot00000000000000.TH modem-manager-gui "1" "Jun 2013" "Modem Manager GUI v0.0.16" "User Commands" .SH NAME modem-manager-gui \- simple graphical interface for Modem Manager daemon. .SH SYNOPSIS .B modem-manager-gui [\fIi\fR]... .SH DESCRIPTION .PP This program is simple graphical interface for Modem Manager 0.6/0.7 and Wader daemons using dbus interface. .TP \fB\-i, --invisible\fR Do not show window on start .SH AUTHOR Written by Alex. See the about dialog for all contributors. .SH "REPORTING BUGS" Report bugs to , or to the bug tracker section on site . .SH COPYRIGHT Copyright \(co 2012-2013 Alex .br This is free software. You may redistribute copies of it under the terms of the GNU General Public License . .SH "SEE ALSO" \fBmmcli\fR(1) modem-manager-gui-0.0.16/packages/000077500000000000000000000000001217271411700166525ustar00rootroot00000000000000modem-manager-gui-0.0.16/packages/fedora/000077500000000000000000000000001217271411700201125ustar00rootroot00000000000000modem-manager-gui-0.0.16/packages/fedora/modem-manager-gui.spec000066400000000000000000000047731217271411700242740ustar00rootroot00000000000000Summary: Modem Manager GUI Name: modem-manager-gui Version: 0.0.16 Release: 1%{dist} License: GPLv3 Group: Applications/Communications URL: http://linuxonly.ru Source: %{name}-%{version}.tar.gz Vendor: Alex #BuildArch: x86_64 Requires: gtk3 >= 3.4.0, glib2 >= 2.32.1, gdbm >= 1.10, libnotify >= 0.7.5 BuildRequires: pkgconfig, gtk3-devel >= 3.4.0, glib2-devel >= 2.32.1, gdbm-devel >= 1.10, desktop-file-utils %description This program is simple graphical interface for Modem Manager daemon dbus interface. Current features: - View device information: Operator name, Mode, IMEI, IMSI, Signal level. - Send and receive SMS messages with long massages concatenation and store messages in database. - Send USSD requests and read answers in GSM7 and UCS2 formats converted to system UTF8 charset. - Scan available mobile networks. %prep %setup -q %build %configure make %{?_smp_mflags} %install rm -rf %{buildroot} make install INSTALLPREFIX=%{buildroot} desktop-file-install --dir %{buildroot}%{_datadir}/applications --delete-original %{buildroot}%{_datadir}/applications/%{name}.desktop %find_lang %{name} %clean rm -rf %{buildroot} %files -f %{name}.lang %defattr(-,root,root,-) %doc LICENSE %doc AUTHORS %doc Changelog %{_bindir}/%{name} %{_libdir}/%{name}/modules/modmm_mm06.so %{_libdir}/%{name}/modules/modmm_mm07.so %{_libdir}/%{name}/modules/modcm_nm09.so %{_libdir}/%{name}/modules/modcm_pppd245.so %{_datadir}/pixmaps/%{name}.png %{_datadir}/%{name}/pixmaps/%{name}.png %{_datadir}/%{name}/pixmaps/cont-tb.png %{_datadir}/%{name}/pixmaps/dev-tb.png %{_datadir}/%{name}/pixmaps/info-tb.png %{_datadir}/%{name}/pixmaps/scan-tb.png %{_datadir}/%{name}/pixmaps/sms-tb.png %{_datadir}/%{name}/pixmaps/ussd-tb.png %{_datadir}/%{name}/pixmaps/traffic-tb.png %{_datadir}/%{name}/pixmaps/sms-read.png %{_datadir}/%{name}/pixmaps/sms-unread.png %{_datadir}/%{name}/pixmaps/message-received.png %{_datadir}/%{name}/pixmaps/message-sent.png %{_datadir}/%{name}/pixmaps/message-drafts.png %{_datadir}/%{name}/pixmaps/info-equipment.png %{_datadir}/%{name}/pixmaps/info-network.png %{_datadir}/%{name}/pixmaps/info-location.png %{_datadir}/%{name}/sounds/message.ogg %{_datadir}/%{name}/ui/%{name}.ui %{_datadir}/applications/%{name}.desktop %{_mandir}/man1/modem-manager-gui.1.gz %changelog * Sat Jul 6 2013 Alex - 0.0.16-1.fc19 - Version 0.0.16 fixes * Tue Dec 16 2012 Alex - added additional pictures for 0.0.15 release * Wed Aug 08 2012 Alex - released spec modem-manager-gui-0.0.16/packages/gentoo/000077500000000000000000000000001217271411700201455ustar00rootroot00000000000000modem-manager-gui-0.0.16/packages/gentoo/modem-manager-gui-0.0.15.ebuild000066400000000000000000000007571217271411700253560ustar00rootroot00000000000000# Copyright 1999-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ EAPI=4 DESCRIPTION="GUI for Modem Manager daemon, capable to read and send SMS, send USSD requests, display modem informaion." HOMEPAGE="http://linuxonly.ru/" SRC_URI="http://download.tuxfamily.org/gsf/source/modem-manager-gui-0.0.15.1.tar.gz" LICENSE="GPL" SLOT="0" KEYWORDS="~amd64 ~x86" IUSE="" DEPEND=">=x11-libs/gtk+-3.4.0 x11-libs/libnotify" RDEPEND="${DEPEND}" modem-manager-gui-0.0.16/packages/mageia/000077500000000000000000000000001217271411700200755ustar00rootroot00000000000000modem-manager-gui-0.0.16/packages/mageia/modem-manager-gui.spec000066400000000000000000000062131217271411700242460ustar00rootroot00000000000000Summary: Modem Manager GUI Name: modem-manager-gui Version: 0.0.16 Release: %mkrel 1 License: GPLv3 Group: Communications/Mobile URL: http://linuxonly.ru Source: %{name}-%{version}.tar.gz Vendor: Alex #BuildArch: x86_64 BuildRequires: pkgconfig BuildRequires: libgtk+3.0-devel >= 3.4.0 BuildRequires: glib2-devel >= 2.32.1 BuildRequires: libgdbm-devel >= 1.10 #BuildRequires: libnotify-devel >= 0.7.5 #BuildRequires: desktop-file-utils Requires: gtk+3.0 >= 3.4.0 Requires: glib2 >= 2.32.1 #Requires: libgdbm4 >= 1.10 Requires: modemmanager >= 0.5.0.0 #Requires: libnotify >= 0.7.5 #Suggests: networkmanager Suggests: libnotify >= 0.7.5 Suggests: libcanberra0 >= 0.28 Suggests: evolution-data-server >= 3.4.1 %description This program is simple graphical interface for Modem Manager daemon dbus interface. Current features: - View device information: Operator name, Mode, IMEI, IMSI, Signal level. - Send and receive SMS messages with long massages concatenation and store messages in database. - Send USSD requests and read answers in GSM7 and UCS2 formats converted to system UTF8 charset. - Scan available mobile networks. %prep %setup -q #cp -f %{SOURCE1} ./src/ %build %configure make %{?_smp_mflags} %install rm -rf %{buildroot} make install INSTALLPREFIX=%{buildroot} #desktop-file-install --vendor mageia --dir %{buildroot}%{_datadir}/applications --add-category X-Mageia --delete-original %{buildroot}%{_datadir}/applications/extras-%{name}.desktop %find_lang %{name} %clean rm -rf %{buildroot} %files -f %{name}.lang %defattr(-,root,root,-) %doc LICENSE %doc AUTHORS %doc Changelog %{_bindir}/%{name} %{_libdir}/%{name}/modules/modmm_mm06.so %{_libdir}/%{name}/modules/modmm_mm07.so %{_libdir}/%{name}/modules/modcm_nm09.so %{_libdir}/%{name}/modules/modcm_pppd245.so #%{_bindir}/modem-manager-gui.ui %{_datadir}/pixmaps/%{name}.png %{_datadir}/%{name}/pixmaps/%{name}.png %{_datadir}/%{name}/pixmaps/cont-tb.png %{_datadir}/%{name}/pixmaps/dev-tb.png %{_datadir}/%{name}/pixmaps/info-tb.png %{_datadir}/%{name}/pixmaps/scan-tb.png %{_datadir}/%{name}/pixmaps/sms-tb.png %{_datadir}/%{name}/pixmaps/ussd-tb.png %{_datadir}/%{name}/pixmaps/traffic-tb.png %{_datadir}/%{name}/pixmaps/sms-read.png %{_datadir}/%{name}/pixmaps/sms-unread.png %{_datadir}/%{name}/pixmaps/message-received.png %{_datadir}/%{name}/pixmaps/message-sent.png %{_datadir}/%{name}/pixmaps/message-drafts.png %{_datadir}/%{name}/pixmaps/info-equipment.png %{_datadir}/%{name}/pixmaps/info-network.png %{_datadir}/%{name}/pixmaps/info-location.png %{_datadir}/%{name}/sounds/message.ogg %{_datadir}/%{name}/ui/%{name}.ui %{_datadir}/applications/%{name}.desktop %{_mandir}/man1/modem-manager-gui.1.xz %changelog * Tue Jun 18 2013 Alex - Version 0.0.16 changes * Fri Apr 12 2013 AlexL - fixed Group for Mageia - added modemmanager to Requires - added networkmanager to Suggests - added patch modem-manager-gui.ui * Mon Apr 07 2013 Zomby - repack for Mageia Russian Community * Tue Dec 16 2012 Alex - added additional pictures for 0.0.15 release * Wed Aug 08 2012 Alex - released spec modem-manager-gui-0.0.16/po/000077500000000000000000000000001217271411700155125ustar00rootroot00000000000000modem-manager-gui-0.0.16/po/Makefile000066400000000000000000000014531217271411700171550ustar00rootroot00000000000000include ../Makefile_h PACKAGE = modem-manager-gui MSGFMT = msgfmt FILES_PO:=$(wildcard *.po) FILES_MO:=$(wildcard *.mo) LOCALEDIR = $(PREFIX)/share/locale MSGFMT_OPT = -f -v -o all: for f in $(FILES_PO); do $(MSGFMT) $$f $(MSGFMT_OPT) `basename $$f .po`.mo; done install: for f in $(FILES_MO); do install -d $(INSTALLPREFIX)$(DESTDIR)$(LOCALEDIR)/`basename $$f .mo`/LC_MESSAGES; \ cp $$f $(INSTALLPREFIX)$(DESTDIR)$(LOCALEDIR)/`basename $$f .mo`/LC_MESSAGES/$(PACKAGE).mo; done uninstall: for f in $(FILES_MO); do \ rm -f $(INSTALLPREFIX)$(DESTDIR)$(LOCALEDIR)/`basename $$f .mo`/LC_MESSAGES/$(PACKAGE).mo; done messages: xgettext -k_ -kN_ ../src/*.c -o modem-manager-gui.pot xgettext -j -L Glade ../resources/*.ui -o modem-manager-gui.pot clean: for f in $(FILES_MO); do \ rm -f $$f; done modem-manager-gui-0.0.16/po/bn_BD.po000066400000000000000000000724331217271411700170270ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # # Translators: # CodeBull , 2013 # CodeBull , 2013 msgid "" msgstr "" "Project-Id-Version: Modem Manager GUI\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2013-07-11 23:22+0400\n" "PO-Revision-Date: 2013-07-11 19:33+0000\n" "Last-Translator: ethereal \n" "Language-Team: Bengali (Bangladesh) (http://www.transifex.com/projects/p/modem-manager-gui/language/bn_BD/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: bn_BD\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #: ../src/ayatana.c:129 msgid "Unread SMS" msgstr "" #: ../src/ayatana.c:300 msgid "Unread messages" msgstr "" #: ../src/main.c:667 ../src/main.c:3372 ../src/main.c:4297 msgid "Error sending message" msgstr "মেসেজ পাঠাতে এরর (ত্রুটি) হয়েছে" #: ../src/main.c:738 msgid "Operation timed out" msgstr "" #: ../src/main.c:738 msgid "Operation took too long to execute. Please restart it." msgstr "" #: ../src/main.c:1083 msgid "Modem must be enabled to read SMS. Enable modem?" msgstr "এস এম এস পড়ার জন্যে মডেম চালু করতে হবে। মডেম চালু করবেন?" #: ../src/main.c:1084 msgid "Modem must be enabled to read and write SMS. Please enable modem." msgstr "" #: ../src/main.c:1085 msgid "" "Modem must be registered in mobile network to receive and send SMS. Please " "wait..." msgstr "" #: ../src/main.c:1086 msgid "Modem must be unlocked to receive and send SMS. Please enter PIN code." msgstr "" #: ../src/main.c:1087 msgid "Modem manager does not support SMS manipulation functions." msgstr "" #: ../src/main.c:1088 msgid "Modem manager does not support sending of SMS messages." msgstr "" #: ../src/main.c:1106 msgid "Modem must be enabled to send USSD. Enable modem?" msgstr "USSD পাঠাতে অবশ্যই মডেম চালু করতে হবে। মডেম চালু " #: ../src/main.c:1107 msgid "Modem must be enabled to send USSD. Please enable modem." msgstr "" #: ../src/main.c:1108 msgid "" "Modem must be registered in mobile network to send USSD. Please wait..." msgstr "" #: ../src/main.c:1109 msgid "Modem must be unlocked to send USSD. Please enter PIN code." msgstr "" #: ../src/main.c:1110 msgid "Modem manager does not support sending of USSD requests." msgstr "" #: ../src/main.c:1138 msgid "Modem must be enabled to scan for available networks. Enable modem?" msgstr "ব্যবহারযোগ্য নেটওয়ার্ক স্ক্যানের জন্যে মডেম সক্রিয় করতে হবে। মডেম সক্রিয় করবেন?" #: ../src/main.c:1139 msgid "" "Modem must be enabled to scan for available networks. Please enable modem." msgstr "" #: ../src/main.c:1141 msgid "" "Modem must be unlocked to scan for available networks. Please enter PIN " "code." msgstr "" #: ../src/main.c:1142 msgid "Modem manager does not support scanning for available mobile networks." msgstr "" #: ../src/main.c:1143 msgid "Modem is connected now. Please disconnect to scan." msgstr "মডেমটি এখন সংযুক্ত আছে। স্ক্যান করতে দয়াকরে সংযোগ ছিন্ন করুন।" #: ../src/main.c:1175 msgid "Modem must be enabled to export contacts from it. Enable modem?" msgstr "" #: ../src/main.c:1176 msgid "Modem must be enabled to export contacts from it. Please enable modem." msgstr "" #: ../src/main.c:1178 msgid "" "Modem must be unlocked to export contacts from it. Please enter PIN code." msgstr "" #: ../src/main.c:1179 msgid "Modem manager does not support modem contacts manipulation functions." msgstr "" #: ../src/main.c:1180 msgid "Modem manager does not support modem contacts edition functions." msgstr "" #: ../src/main.c:1218 msgid "Enable modem" msgstr "মডেম চালু " #: ../src/main.c:1222 ../src/main.c:4731 msgid "Error enabling device" msgstr "ডিভাইস চালু করতে এরর (ত্রুটি) হয়েছে" #: ../src/main.c:1438 ../src/main.c:1465 msgid "Modem Manager GUI window hidden" msgstr "" #: ../src/main.c:1438 ../src/main.c:1465 msgid "Use tray icon or messaging menu to show window again" msgstr "" #: ../src/main.c:1757 #, c-format msgid "Unread messages: %u" msgstr "" #: ../src/main.c:1760 ../src/main.c:1763 ../src/main.c:5669 msgid "No unread messages" msgstr "কোন অপঠিত মেসেজ " #: ../src/main.c:2085 msgid "Error adding contact" msgstr "" #: ../src/main.c:2121 msgid "Remove contact" msgstr "" #: ../src/main.c:2121 msgid "Really want to remove contact?" msgstr "" #: ../src/main.c:2125 ../src/main.c:2130 msgid "Error removing contact" msgstr "" #: ../src/main.c:2125 msgid "Contact not removed from device" msgstr "" #: ../src/main.c:2130 msgid "Contact not selected" msgstr "" #: ../src/main.c:2260 ../resources/modem-manager-gui.ui:517 msgid "First name" msgstr "" #: ../src/main.c:2264 ../resources/modem-manager-gui.ui:530 msgid "First number" msgstr "" #: ../src/main.c:2268 ../resources/modem-manager-gui.ui:543 msgid "EMail" msgstr "" #: ../src/main.c:2272 ../resources/modem-manager-gui.ui:556 msgid "Group" msgstr "" #: ../src/main.c:2276 ../resources/modem-manager-gui.ui:570 msgid "Second name" msgstr "" #: ../src/main.c:2280 ../resources/modem-manager-gui.ui:583 msgid "Second number" msgstr "" #: ../src/main.c:2289 msgid "Modem contacts" msgstr "" #: ../src/main.c:2357 ../src/main.c:2410 ../src/main.c:4553 #: ../src/strformat.c:165 ../src/strformat.c:195 ../src/strformat.c:203 #: ../src/strformat.c:211 #, c-format msgid "Unknown" msgstr "অজানা" #: ../src/main.c:2521 msgid "Day" msgstr "" #: ../src/main.c:2525 msgid "Received data" msgstr "" #: ../src/main.c:2529 msgid "Transmitted data" msgstr "" #: ../src/main.c:2533 msgid "Session time" msgstr "" #: ../src/main.c:2696 msgid "Application" msgstr "প্রয়োগ" #: ../src/main.c:2700 msgid "PID" msgstr "পি আই " #: ../src/main.c:2704 msgid "Protocol" msgstr "প্রোটকল" #: ../src/main.c:2708 msgid "State" msgstr "অবস্থা" #: ../src/main.c:2712 msgid "Buffer" msgstr "ব্যাফার" #: ../src/main.c:2716 msgid "Port" msgstr "পোর্ট" #: ../src/main.c:2720 msgid "Destination" msgstr "গন্তব্য" #: ../src/main.c:2746 msgid "Traffic limit exceeded" msgstr "" #: ../src/main.c:2750 msgid "Time limit exceeded" msgstr "" #: ../src/main.c:2927 #, c-format msgid "" "Traffic: %s, limit set to: %s\n" "Time: %s, limit set to: %s\n" "Please check entered values and try once more" msgstr "ট্রাফিক: %s, সীমা: %s\nসময়: %s, সীমা: %s\nদয়াকরে প্রবেশকৃত মানগুলো পরীক্ষা করুন এবং আবার চেষ্টা করুন" #: ../src/main.c:2932 msgid "Wrong traffic and time limit values" msgstr "ভুল ট্রাফিক এবং সময় সীমা মান" #: ../src/main.c:2935 #, c-format msgid "" "Traffic: %s, limit set to: %s\n" "Please check entered values and try once more" msgstr "ট্রাফিক: %s, সীমা: %s\nদয়াকরে প্রবেশকৃত মানগুলো পরীক্ষা করুন এবং আবার চেষ্টা করুন" #: ../src/main.c:2938 msgid "Wrong traffic limit value" msgstr "ভুল ট্রাফিক সীমা মান" #: ../src/main.c:2941 #, c-format msgid "" "Time: %s, limit set to: %s\n" "Please check entered values and try once more" msgstr "সময়: %s, সীমা: %s\nদয়াকরে প্রবেশকৃত মানগুলো পরীক্ষা করুন এবং আবার চেষ্টা করুন" #: ../src/main.c:2944 msgid "Wrong time limit value" msgstr "ভুল সময় সীমা মান" #: ../src/main.c:2981 #, c-format msgid "%s disconnected" msgstr "" #: ../src/main.c:3055 ../src/main.c:3079 ../src/main.c:3103 msgid "Disconnected" msgstr "" #: ../src/main.c:3067 ../src/main.c:3073 ../src/main.c:3091 ../src/main.c:3097 msgid "Limit" msgstr "" #: ../src/main.c:3070 ../src/main.c:3076 ../src/main.c:3094 ../src/main.c:3100 msgid "Disabled" msgstr "" #: ../src/main.c:3232 msgid "kbps" msgstr "কেবিপিএস" #: ../src/main.c:3242 msgid "sec" msgstr "সেক" #: ../src/main.c:3296 msgid "RX speed" msgstr "আর এক্স গতি" #: ../src/main.c:3315 msgid "TX speed" msgstr "টি এক্স গতি" #: ../src/main.c:3330 msgid "Parameter" msgstr "প্যারামিটার" #: ../src/main.c:3335 msgid "Value" msgstr "মান" #: ../src/main.c:3341 msgid "Received data" msgstr "গৃহীত ডাটা" #: ../src/main.c:3344 msgid "Transmitted data" msgstr "প্রেরিত ডাটা" #: ../src/main.c:3347 msgid "Receive speed" msgstr "গ্রহণ গতি" #: ../src/main.c:3350 msgid "Transmit speed" msgstr "প্রেরণ গতি" #: ../src/main.c:3353 msgid "Session time" msgstr "সেশন সময়" #: ../src/main.c:3356 msgid "Traffic left" msgstr "ট্রাফিক বাকি" #: ../src/main.c:3359 msgid "Time left" msgstr "সময় বাকি" #: ../src/main.c:3372 msgid "Device error" msgstr "ডিভাইস এঁরর (ত্রুটি)" #: ../src/main.c:3399 #, c-format msgid "" "%s\n" "%s ID: %u Availability: %s Access tech: %s" msgstr "%s\n%s আই ডি: %u প্রাপ্যতা: %s টেকনোলজি: %s " #: ../src/main.c:3435 msgid "Error scanning networks" msgstr "নেটওয়ার্ক স্ক্যানে এরর (ত্রুটি) হয়েছে" #: ../src/main.c:3449 ../resources/modem-manager-gui.ui:2704 msgid "Operator" msgstr "অপারেটর" #: ../src/main.c:3495 ../src/main.c:3502 ../src/main.c:3554 ../src/main.c:3562 msgid "Not supported" msgstr "" #: ../src/main.c:3584 msgid "Sample command" msgstr "স্যাম্পল কমান্ড" #: ../src/main.c:3790 ../src/main.c:3803 msgid "" "USSD request is not valid\n" "Request must be 160 symbols long\n" "started with '*' and ended with '#'" msgstr "USSD রেকোয়েস্ট বৈধ নয়\nরেকোয়েস্ট ১৬০ চিহ্নের এবং '*' দিয়ে শুরু এবং '#' দিয়ে শেষ হতে হবে" #: ../src/main.c:3880 ../src/main.c:3883 ../src/main.c:3886 ../src/main.c:3920 msgid "Error sending USSD" msgstr "USSD পাঠাতে এরর (ত্রুটি) হয়েছে" #: ../src/main.c:3880 msgid "Wrong USSD request or device not ready" msgstr "ভুল USSD রেকোয়েস্ট অথবা ডিভাইস প্রস্তুত নয়" #: ../src/main.c:3883 msgid "USSD session terminated. You can send new request" msgstr "USSD সেশন বাতিল করা হয়েছে। আপনি নূতন রিকোয়েস্ট পাঠাতে " #: ../src/main.c:3886 msgid "Wrong USSD request" msgstr "ভুল USSD " #: ../src/main.c:3909 msgid "" "\n" "USSD session is active. Waiting for your input...\n" msgstr "" #: ../src/main.c:3970 msgid "Command" msgstr "কমান্ড" #: ../src/main.c:3976 msgid "Description" msgstr "বর্ণনা" #: ../src/main.c:4045 #, c-format msgid "Received %u new SMS messages" msgstr "%u নূতন মেসেজ গৃহীত হয়েছে" #: ../src/main.c:4047 ../src/main.c:4116 msgid "Received new SMS message" msgstr "নূতন মেসেজ গৃহীত হয়েছে" #: ../src/main.c:4051 msgid "Message senders: " msgstr "মেসেজ প্রেরক:" #: ../src/main.c:4177 msgid "" "SMS number is not valid\n" "Only numbers from 2 to 20 digits without\n" "letters and symbols can be used" msgstr "এস এম এস নাম্বারটি বৈধ নয়\nশুধুমাত্র ২ থেকে ২০ সংখ্যার বর্ণমালা ও চিহ্ন ব্যতীত সংখ্যা ব্যবহার করা যাবে" #: ../src/main.c:4179 msgid "" "SMS text is not valid\n" "Please write some text to send" msgstr "এস এম এস মেসেজটি বৈধ নয়\nদয়াকরে মেসেজ লিখুন" #: ../src/main.c:4297 msgid "Wrong number or device not ready" msgstr "নাম্বার ভুল অথবা ডিভাইস প্রস্তুত নয়" #: ../src/main.c:4345 msgid "Remove message" msgstr "মেসেজ অপসরণ করুন" #: ../src/main.c:4345 msgid "Really want to remove message?" msgstr "মেসেজ অপসারণ করতে চান?" #: ../src/main.c:4351 ../src/main.c:4356 msgid "Error removing SMS" msgstr "এস এম এস অপসারণ করতে এরর (ত্রুটি) হয়েছে" #: ../src/main.c:4351 msgid "Message not found" msgstr "মেসেজ খুঁজে পাওয়া যায়নি" #: ../src/main.c:4356 msgid "Message not selected" msgstr "মেসেজ নির্বাচন করা " #: ../src/main.c:4508 msgid "This message can't be read" msgstr "এই মেসেজটি পড়া যাবে নাহ" #: ../src/main.c:4514 msgid "" "This is folder for your incoming SMS messages.\n" "You can answer selected message using 'Answer' button." msgstr "এই ফোল্ডারটি আগত মেসেজগুলোর জন্য।\nআপনি 'উত্তর' বাটন ব্যাবহার করে উত্তর দিতে পারবেন।" #: ../src/main.c:4517 msgid "This is folder for your sent SMS messages." msgstr "এই ফোল্ডারটি প্রেরিত মেসেজগুলোর জন্য।" #: ../src/main.c:4520 msgid "" "This is folder for your SMS message drafts.\n" "Select message and click 'Answer' button to start editing." msgstr "এই ফোল্ডারটি খসড়া মেসেজগুলোর জন্য।\nআপনি 'উত্তর' বাটন ব্যবহার করে সম্পাদনা করতে পারবেন।" #: ../src/main.c:4556 #, c-format msgid "" "%s\n" "%s" msgstr "%s\n%s" #: ../src/main.c:4611 msgid "" "Incoming\n" "Incoming messages" msgstr "আগত\nআগত মেসেজগুলো" #: ../src/main.c:4612 msgid "" "Sent\n" "Sent messages" msgstr "প্রেরিত\nপ্রেরিত মেসেজগুলো" #: ../src/main.c:4613 msgid "" "Drafts\n" "Message drafts" msgstr "খসড়া\nখসড়া মেসেজগুলো" #: ../src/main.c:4690 ../resources/modem-manager-gui.ui:1908 #: ../resources/modem-manager-gui.ui:2321 msgid "SMS" msgstr "এস এম এস" #: ../src/main.c:4959 msgid "Error opening device" msgstr "ডিভাইস খুলতে এরর (ত্রুটি) হয়েছে" #: ../src/main.c:5105 #, c-format msgid "" "%s %s\n" "Version:%s Port:%s Type:%s" msgstr "%s %s\nভার্সন: %s পোর্ট: %s টাইপ: %s" #: ../src/main.c:5154 msgid "Selected" msgstr "নির্বাচিত" #: ../src/main.c:5159 ../resources/modem-manager-gui.ui:2572 msgid "Device" msgstr "ডিভাইস" #: ../src/main.c:5215 msgid "GNOME contacts" msgstr "" #: ../src/main.c:5222 msgid "KDE contacts" msgstr "" #: ../src/main.c:5277 msgid "Traffic limit exceeded... It's time to take rest \\(^_^)/" msgstr "" #: ../src/main.c:5300 msgid "Time limit exceeded... Go sleep and have nice dreams -_-" msgstr "" #: ../src/main.c:5673 msgid "Show window" msgstr "" #: ../src/main.c:5680 msgid "New SMS" msgstr "" #: ../src/main.c:5741 ../resources/modem-manager-gui.ui:761 msgid "Preferences" msgstr "" #: ../src/main.c:5743 ../resources/modem-manager-gui.ui:7 msgid "About" msgstr "" #: ../src/main.c:5745 msgid "Quit" msgstr "" #: ../src/main.c:5776 ../src/main.c:5813 msgid "Error while initialization" msgstr "" #: ../src/main.c:5776 msgid "No one modem manager is available" msgstr "" #: ../src/main.c:5813 msgid "Interface building error" msgstr "" #: ../src/main.c:5860 #, c-format msgid "Segmentation fault at address: %p\n" msgstr "" #: ../src/main.c:5863 msgid "Stack trace:\n" msgstr "" #: ../src/main.c:5890 msgid "Do not show window on start" msgstr "" #: ../src/main.c:5920 msgid "- tool for EDGE/3G/4G modem specific functions control" msgstr "" #: ../src/main.c:5927 #, c-format msgid "Command line option parsing failed: %s\n" msgstr "" #: ../src/strformat.c:39 #, c-format msgid "%.3f kbps" msgstr "%.3f কে বি পি এস" #: ../src/strformat.c:41 #, c-format msgid "%.3f kbps" msgstr "%.3f কে বি পি এস" #: ../src/strformat.c:46 #, c-format msgid "%.3g Mbps" msgstr "%.3g এম বি পি এস" #: ../src/strformat.c:48 #, c-format msgid "%.3g Mbps" msgstr "" #: ../src/strformat.c:53 #, c-format msgid "%.3g Gbps" msgstr "%.3g জি বি পি এস" #: ../src/strformat.c:55 #, c-format msgid "%.3g Gbps" msgstr "%.3g জি বি পি এস" #: ../src/strformat.c:87 #, c-format msgid "%u sec" msgstr "%u সেক" #: ../src/strformat.c:89 #, c-format msgid "%u sec" msgstr "%u সেক" #: ../src/strformat.c:93 #, c-format msgid "%s:%s" msgstr "%s:%s" #: ../src/strformat.c:95 #, c-format msgid "%s:%s" msgstr "%s:%s" #: ../src/strformat.c:99 #, c-format msgid "%s:%s:%s" msgstr "%s:%s:%s" #: ../src/strformat.c:101 #, c-format msgid "%s:%s:%s" msgstr "%s:%s:%s" #: ../src/strformat.c:105 #, c-format msgid "%lu day(s) %s:%s:%s" msgstr "" #: ../src/strformat.c:107 #, c-format msgid "%lu day(s) %s:%s:%s" msgstr "" #: ../src/strformat.c:124 #, c-format msgid "%u" msgstr "%u" #: ../src/strformat.c:126 #, c-format msgid "%u" msgstr "" #: ../src/strformat.c:131 #, c-format msgid "%.3g Kb" msgstr "%.3g কে বি" #: ../src/strformat.c:133 #, c-format msgid "%.3g Kb" msgstr "%.3g কে বি" #: ../src/strformat.c:138 #, c-format msgid "%.3g Mb" msgstr "" #: ../src/strformat.c:140 #, c-format msgid "%.3g Mb" msgstr "" #: ../src/strformat.c:145 #, c-format msgid "%.3g Gb" msgstr "" #: ../src/strformat.c:147 #, c-format msgid "%.3g Gb" msgstr "" #: ../src/strformat.c:152 #, c-format msgid "%.3g Tb" msgstr "" #: ../src/strformat.c:154 #, c-format msgid "%.3g Tb" msgstr "" #: ../src/strformat.c:205 msgid "Available" msgstr "" #: ../src/strformat.c:207 msgid "Current" msgstr "" #: ../src/strformat.c:209 msgid "Forbidden" msgstr "" #: ../src/strformat.c:241 msgid "Not registered" msgstr "" #: ../src/strformat.c:243 msgid "Home network" msgstr "" #: ../src/strformat.c:245 msgid "Searching" msgstr "" #: ../src/strformat.c:247 msgid "Registration denied" msgstr "" #: ../src/strformat.c:249 ../src/strformat.c:253 msgid "Unknown status" msgstr "" #: ../src/strformat.c:251 msgid "Roaming network" msgstr "" #: ../resources/modem-manager-gui.ui:17 msgid "Copyright 2012-2013 Alex" msgstr "" #: ../resources/modem-manager-gui.ui:18 msgid "Tool for EDGE/3G/4G modem specific functions control" msgstr "" #: ../resources/modem-manager-gui.ui:20 msgid "Homepage" msgstr "" #: ../resources/modem-manager-gui.ui:21 msgid "GPL3" msgstr "" #: ../resources/modem-manager-gui.ui:23 msgid "English: Alex " msgstr "" #: ../resources/modem-manager-gui.ui:55 msgid "Active connections" msgstr "" #: ../resources/modem-manager-gui.ui:111 msgid "Terminate selected application using SIGTERM signal CTRL+T" msgstr "" #: ../resources/modem-manager-gui.ui:113 msgid "Terminate application" msgstr "" #: ../resources/modem-manager-gui.ui:167 msgid "Error" msgstr "" #: ../resources/modem-manager-gui.ui:282 msgid "Ask me again" msgstr "" #: ../resources/modem-manager-gui.ui:302 msgid "Quit or minimize?" msgstr "" #: ../resources/modem-manager-gui.ui:316 msgid "What do you want application to do on window close?" msgstr "" #: ../resources/modem-manager-gui.ui:327 msgid "Just quit" msgstr "" #: ../resources/modem-manager-gui.ui:344 msgid "Minimize to tray or messaging menu" msgstr "" #: ../resources/modem-manager-gui.ui:378 #: ../resources/modem-manager-gui.ui:3366 msgid "New contact" msgstr "" #: ../resources/modem-manager-gui.ui:611 msgid "New SMS message" msgstr "" #: ../resources/modem-manager-gui.ui:657 #: ../resources/modem-manager-gui.ui:2374 msgid "Send" msgstr "" #: ../resources/modem-manager-gui.ui:693 msgid "Number" msgstr "" #: ../resources/modem-manager-gui.ui:838 msgid "Concatenate messages" msgstr "" #: ../resources/modem-manager-gui.ui:853 msgid "Expand folders" msgstr "" #: ../resources/modem-manager-gui.ui:868 msgid "Place old messages on top" msgstr "" #: ../resources/modem-manager-gui.ui:889 msgid "SMS" msgstr "" #: ../resources/modem-manager-gui.ui:947 msgid "RX Speed graph color" msgstr "" #: ../resources/modem-manager-gui.ui:962 msgid "TX Speed graph color" msgstr "" #: ../resources/modem-manager-gui.ui:979 msgid "Traffic" msgstr "" #: ../resources/modem-manager-gui.ui:1008 msgid "Use sounds for events" msgstr "" #: ../resources/modem-manager-gui.ui:1023 msgid "Hide window to tray on close" msgstr "" #: ../resources/modem-manager-gui.ui:1038 msgid "Save window geometry and placement" msgstr "" #: ../resources/modem-manager-gui.ui:1059 msgid "Behaviour" msgstr "" #: ../resources/modem-manager-gui.ui:1087 msgid "Progress" msgstr "" #: ../resources/modem-manager-gui.ui:1142 msgid "Executing command" msgstr "" #: ../resources/modem-manager-gui.ui:1181 msgid "Question" msgstr "" #: ../resources/modem-manager-gui.ui:1234 msgid "Traffic limits" msgstr "" #: ../resources/modem-manager-gui.ui:1296 msgid "Eanble traffic limit" msgstr "" #: ../resources/modem-manager-gui.ui:1312 msgid "Enable time limit" msgstr "" #: ../resources/modem-manager-gui.ui:1330 #: ../resources/modem-manager-gui.ui:1972 #: ../resources/modem-manager-gui.ui:3271 msgid "Traffic" msgstr "" #: ../resources/modem-manager-gui.ui:1376 #: ../resources/modem-manager-gui.ui:1478 msgid "Message" msgstr "" #: ../resources/modem-manager-gui.ui:1402 #: ../resources/modem-manager-gui.ui:1504 msgid "Action" msgstr "" #: ../resources/modem-manager-gui.ui:1433 msgid "Time" msgstr "" #: ../resources/modem-manager-gui.ui:1548 msgid "Traffic statistics" msgstr "" #: ../resources/modem-manager-gui.ui:1608 msgid "Selected statistics period" msgstr "" #: ../resources/modem-manager-gui.ui:1773 msgid "Add new USSD command CTRL+N" msgstr "" #: ../resources/modem-manager-gui.ui:1775 msgid "Add" msgstr "" #: ../resources/modem-manager-gui.ui:1789 msgid "Remove selected USSD command CTRL+D" msgstr "" #: ../resources/modem-manager-gui.ui:1791 msgid "Delete" msgstr "" #: ../resources/modem-manager-gui.ui:1815 msgid "" "Force USSD answer encoding change from GSM7 to UCS2 (useful for Huawei " "modems) CTRL+E" msgstr "" #: ../resources/modem-manager-gui.ui:1817 msgid "Change message encoding" msgstr "" #: ../resources/modem-manager-gui.ui:1871 msgid "Modem Manager GUI" msgstr "" #: ../resources/modem-manager-gui.ui:1890 msgid "View and select available devices CTRL+F1" msgstr "" #: ../resources/modem-manager-gui.ui:1892 #: ../resources/modem-manager-gui.ui:2117 msgid "Devices" msgstr "" #: ../resources/modem-manager-gui.ui:1906 msgid "Send and receive SMS messages CTRL+F2" msgstr "" #: ../resources/modem-manager-gui.ui:1922 msgid "Send USSD requests CTRL+F3" msgstr "" #: ../resources/modem-manager-gui.ui:1924 #: ../resources/modem-manager-gui.ui:2523 msgid "USSD" msgstr "" #: ../resources/modem-manager-gui.ui:1938 msgid "View active device information CTRL+F4" msgstr "" #: ../resources/modem-manager-gui.ui:1940 #: ../resources/modem-manager-gui.ui:2975 msgid "Info" msgstr "" #: ../resources/modem-manager-gui.ui:1954 msgid "Scan existing mobile networks CTRL+F5" msgstr "" #: ../resources/modem-manager-gui.ui:1956 #: ../resources/modem-manager-gui.ui:3125 msgid "Scan" msgstr "" #: ../resources/modem-manager-gui.ui:1970 msgid "Monitor network traffic CTRL+F6" msgstr "" #: ../resources/modem-manager-gui.ui:1986 msgid "View system and modem addressbooks CTRL+F7" msgstr "" #: ../resources/modem-manager-gui.ui:1988 #: ../resources/modem-manager-gui.ui:3455 msgid "Contacts" msgstr "" #: ../resources/modem-manager-gui.ui:2041 msgid "No devices found in system" msgstr "" #: ../resources/modem-manager-gui.ui:2210 msgid "Send new SMS message CTRL+N" msgstr "" #: ../resources/modem-manager-gui.ui:2212 msgid "New" msgstr "" #: ../resources/modem-manager-gui.ui:2226 msgid "Remove selected message CTRL+D" msgstr "" #: ../resources/modem-manager-gui.ui:2228 msgid "Remove" msgstr "" #: ../resources/modem-manager-gui.ui:2242 msgid "Answer selected message CTRL+A" msgstr "" #: ../resources/modem-manager-gui.ui:2244 msgid "Answer" msgstr "" #: ../resources/modem-manager-gui.ui:2340 msgid "Request" msgstr "" #: ../resources/modem-manager-gui.ui:2378 msgid "Send ussd request CTRL+S" msgstr "" #: ../resources/modem-manager-gui.ui:2398 msgid "Edit USSD commands list CTRL+E" msgstr "" #: ../resources/modem-manager-gui.ui:2600 msgid "IMEI" msgstr "" #: ../resources/modem-manager-gui.ui:2627 msgid "IMSI/ESN" msgstr "" #: ../resources/modem-manager-gui.ui:2658 msgid "Equipment" msgstr "" #: ../resources/modem-manager-gui.ui:2732 msgid "Mode" msgstr "" #: ../resources/modem-manager-gui.ui:2760 msgid "Signal level" msgstr "" #: ../resources/modem-manager-gui.ui:2774 msgid "Operator code" msgstr "" #: ../resources/modem-manager-gui.ui:2801 msgid "Registration" msgstr "" #: ../resources/modem-manager-gui.ui:2846 msgid "Network" msgstr "" #: ../resources/modem-manager-gui.ui:2892 msgid "" "3GPP Location\n" "MCC/MNC/LAC/CID" msgstr "" #: ../resources/modem-manager-gui.ui:2908 msgid "" "GPS location\n" "Longitude/Latiude" msgstr "" #: ../resources/modem-manager-gui.ui:2955 msgid "Location" msgstr "" #: ../resources/modem-manager-gui.ui:3021 msgid "Scan available mobile networks CTRL+S" msgstr "" #: ../resources/modem-manager-gui.ui:3023 msgid "Start scan" msgstr "" #: ../resources/modem-manager-gui.ui:3145 msgid "Set traffic amount or time limit for disconnect CTRL+L" msgstr "" #: ../resources/modem-manager-gui.ui:3147 msgid "Set limit" msgstr "" #: ../resources/modem-manager-gui.ui:3161 msgid "View list of active network connections CTRL+C" msgstr "" #: ../resources/modem-manager-gui.ui:3163 msgid "Connections" msgstr "" #: ../resources/modem-manager-gui.ui:3177 msgid "View daily traffic statistics CTRL+S" msgstr "" #: ../resources/modem-manager-gui.ui:3179 msgid "Statistics" msgstr "" #: ../resources/modem-manager-gui.ui:3230 msgid "Transmission speed" msgstr "" #: ../resources/modem-manager-gui.ui:3364 msgid "Add new contact to modem addressbook CTRL+N" msgstr "" #: ../resources/modem-manager-gui.ui:3380 msgid "Remove contact from modem addressbook CTRL+D" msgstr "" #: ../resources/modem-manager-gui.ui:3382 msgid "Remove contact" msgstr "" #: ../resources/modem-manager-gui.ui:3406 msgid "Send SMS message to selected contact CTRL+S" msgstr "" #: ../resources/modem-manager-gui.ui:3408 msgid "Send SMS" msgstr "" #: manual addition msgid "Show message" msgstr "" #: manual addition msgid "Disconnect" msgstr "" #: manual addition msgid "Hours" msgstr "" #: manual addition msgid "Minutes" msgstr "" #: manual addition msgid "Mb" msgstr "" #: manual addition msgid "Gb" msgstr "" #: manual addition msgid "Tb" msgstr "" #: manual addition msgid "January" msgstr "" #: manual addition msgid "February" msgstr "" #: manual addition msgid "March" msgstr "" #: manual addition msgid "April" msgstr "" #: manual addition msgid "May" msgstr "" #: manual addition msgid "June" msgstr "" #: manual addition msgid "July" msgstr "" #: manual addition msgid "August" msgstr "" #: manual addition msgid "September" msgstr "" #: manual addition msgid "October" msgstr "" #: manual addition msgid "November" msgstr "" #: manual addition msgid "December" msgstr "" modem-manager-gui-0.0.16/po/en_US.po000066400000000000000000000753221217271411700170740ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # # Translators: msgid "" msgstr "" "Project-Id-Version: Modem Manager GUI\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2013-07-11 23:22+0400\n" "PO-Revision-Date: 2013-07-11 19:33+0000\n" "Last-Translator: ethereal \n" "Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: en_US\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #: ../src/ayatana.c:129 msgid "Unread SMS" msgstr "Unread SMS" #: ../src/ayatana.c:300 msgid "Unread messages" msgstr "Unread messages" #: ../src/main.c:667 ../src/main.c:3372 ../src/main.c:4297 msgid "Error sending message" msgstr "Error sending message" #: ../src/main.c:738 msgid "Operation timed out" msgstr "Operation timed out" #: ../src/main.c:738 msgid "Operation took too long to execute. Please restart it." msgstr "Operation took too long to execute. Please restart it." #: ../src/main.c:1083 msgid "Modem must be enabled to read SMS. Enable modem?" msgstr "Modem must be enabled to read SMS. Enable modem?" #: ../src/main.c:1084 msgid "Modem must be enabled to read and write SMS. Please enable modem." msgstr "Modem must be enabled to read and write SMS. Please enable modem." #: ../src/main.c:1085 msgid "" "Modem must be registered in mobile network to receive and send SMS. Please " "wait..." msgstr "Modem must be registered in mobile network to receive and send SMS. Please wait..." #: ../src/main.c:1086 msgid "Modem must be unlocked to receive and send SMS. Please enter PIN code." msgstr "Modem must be unlocked to receive and send SMS. Please enter PIN code." #: ../src/main.c:1087 msgid "Modem manager does not support SMS manipulation functions." msgstr "Modem manager does not support SMS manipulation functions." #: ../src/main.c:1088 msgid "Modem manager does not support sending of SMS messages." msgstr "Modem manager does not support sending of SMS messages." #: ../src/main.c:1106 msgid "Modem must be enabled to send USSD. Enable modem?" msgstr "Modem must be enabled to send USSD. Enable modem?" #: ../src/main.c:1107 msgid "Modem must be enabled to send USSD. Please enable modem." msgstr "Modem must be enabled to send USSD. Please enable modem." #: ../src/main.c:1108 msgid "" "Modem must be registered in mobile network to send USSD. Please wait..." msgstr "Modem must be registered in mobile network to send USSD. Please wait..." #: ../src/main.c:1109 msgid "Modem must be unlocked to send USSD. Please enter PIN code." msgstr "Modem must be unlocked to send USSD. Please enter PIN code." #: ../src/main.c:1110 msgid "Modem manager does not support sending of USSD requests." msgstr "Modem manager does not support sending of USSD requests." #: ../src/main.c:1138 msgid "Modem must be enabled to scan for available networks. Enable modem?" msgstr "Modem must be enabled to scan for available networks. Enable modem?" #: ../src/main.c:1139 msgid "" "Modem must be enabled to scan for available networks. Please enable modem." msgstr "Modem must be enabled to scan for available networks. Please enable modem." #: ../src/main.c:1141 msgid "" "Modem must be unlocked to scan for available networks. Please enter PIN " "code." msgstr "Modem must be unlocked to scan for available networks. Please enter PIN code." #: ../src/main.c:1142 msgid "Modem manager does not support scanning for available mobile networks." msgstr "Modem manager does not support scanning for available mobile networks." #: ../src/main.c:1143 msgid "Modem is connected now. Please disconnect to scan." msgstr "Modem is connected now. Please disconnect to scan." #: ../src/main.c:1175 msgid "Modem must be enabled to export contacts from it. Enable modem?" msgstr "Modem must be enabled to export contacts from it. Enable modem?" #: ../src/main.c:1176 msgid "Modem must be enabled to export contacts from it. Please enable modem." msgstr "Modem must be enabled to export contacts from it. Please enable modem." #: ../src/main.c:1178 msgid "" "Modem must be unlocked to export contacts from it. Please enter PIN code." msgstr "Modem must be unlocked to export contacts from it. Please enter PIN code." #: ../src/main.c:1179 msgid "Modem manager does not support modem contacts manipulation functions." msgstr "Modem manager does not support modem contacts manipulation functions." #: ../src/main.c:1180 msgid "Modem manager does not support modem contacts edition functions." msgstr "Modem manager does not support modem contacts edition functions." #: ../src/main.c:1218 msgid "Enable modem" msgstr "Enable modem" #: ../src/main.c:1222 ../src/main.c:4731 msgid "Error enabling device" msgstr "Error enabling device" #: ../src/main.c:1438 ../src/main.c:1465 msgid "Modem Manager GUI window hidden" msgstr "Modem Manager GUI window hidden" #: ../src/main.c:1438 ../src/main.c:1465 msgid "Use tray icon or messaging menu to show window again" msgstr "Use tray icon or messaging menu to show window again" #: ../src/main.c:1757 #, c-format msgid "Unread messages: %u" msgstr "Unread messages: %u" #: ../src/main.c:1760 ../src/main.c:1763 ../src/main.c:5669 msgid "No unread messages" msgstr "No unread messages" #: ../src/main.c:2085 msgid "Error adding contact" msgstr "Error adding contact" #: ../src/main.c:2121 msgid "Remove contact" msgstr "Remove contact" #: ../src/main.c:2121 msgid "Really want to remove contact?" msgstr "Really want to remove contact?" #: ../src/main.c:2125 ../src/main.c:2130 msgid "Error removing contact" msgstr "Error removing contact" #: ../src/main.c:2125 msgid "Contact not removed from device" msgstr "Contact not removed from device" #: ../src/main.c:2130 msgid "Contact not selected" msgstr "Contact not selected" #: ../src/main.c:2260 ../resources/modem-manager-gui.ui:517 msgid "First name" msgstr "First name" #: ../src/main.c:2264 ../resources/modem-manager-gui.ui:530 msgid "First number" msgstr "First number" #: ../src/main.c:2268 ../resources/modem-manager-gui.ui:543 msgid "EMail" msgstr "EMail" #: ../src/main.c:2272 ../resources/modem-manager-gui.ui:556 msgid "Group" msgstr "Group" #: ../src/main.c:2276 ../resources/modem-manager-gui.ui:570 msgid "Second name" msgstr "Second name" #: ../src/main.c:2280 ../resources/modem-manager-gui.ui:583 msgid "Second number" msgstr "Second number" #: ../src/main.c:2289 msgid "Modem contacts" msgstr "Modem contacts" #: ../src/main.c:2357 ../src/main.c:2410 ../src/main.c:4553 #: ../src/strformat.c:165 ../src/strformat.c:195 ../src/strformat.c:203 #: ../src/strformat.c:211 #, c-format msgid "Unknown" msgstr "Unknown" #: ../src/main.c:2521 msgid "Day" msgstr "Day" #: ../src/main.c:2525 msgid "Received data" msgstr "Received data" #: ../src/main.c:2529 msgid "Transmitted data" msgstr "Transmitted data" #: ../src/main.c:2533 msgid "Session time" msgstr "Session time" #: ../src/main.c:2696 msgid "Application" msgstr "Application" #: ../src/main.c:2700 msgid "PID" msgstr "PID" #: ../src/main.c:2704 msgid "Protocol" msgstr "Protocol" #: ../src/main.c:2708 msgid "State" msgstr "State" #: ../src/main.c:2712 msgid "Buffer" msgstr "Buffer" #: ../src/main.c:2716 msgid "Port" msgstr "Port" #: ../src/main.c:2720 msgid "Destination" msgstr "Destination" #: ../src/main.c:2746 msgid "Traffic limit exceeded" msgstr "Traffic limit exceeded" #: ../src/main.c:2750 msgid "Time limit exceeded" msgstr "Time limit exceeded" #: ../src/main.c:2927 #, c-format msgid "" "Traffic: %s, limit set to: %s\n" "Time: %s, limit set to: %s\n" "Please check entered values and try once more" msgstr "Traffic: %s, limit set to: %s\nTime: %s, limit set to: %s\nPlease check entered values and try once more" #: ../src/main.c:2932 msgid "Wrong traffic and time limit values" msgstr "Wrong traffic and time limit values" #: ../src/main.c:2935 #, c-format msgid "" "Traffic: %s, limit set to: %s\n" "Please check entered values and try once more" msgstr "Traffic: %s, limit set to: %s\nPlease check entered values and try once more" #: ../src/main.c:2938 msgid "Wrong traffic limit value" msgstr "Wrong traffic limit value" #: ../src/main.c:2941 #, c-format msgid "" "Time: %s, limit set to: %s\n" "Please check entered values and try once more" msgstr "Time: %s, limit set to: %s\nPlease check entered values and try once more" #: ../src/main.c:2944 msgid "Wrong time limit value" msgstr "Wrong time limit value" #: ../src/main.c:2981 #, c-format msgid "%s disconnected" msgstr "%s disconnected" #: ../src/main.c:3055 ../src/main.c:3079 ../src/main.c:3103 msgid "Disconnected" msgstr "Disconnected" #: ../src/main.c:3067 ../src/main.c:3073 ../src/main.c:3091 ../src/main.c:3097 msgid "Limit" msgstr "Limit" #: ../src/main.c:3070 ../src/main.c:3076 ../src/main.c:3094 ../src/main.c:3100 msgid "Disabled" msgstr "Disabled" #: ../src/main.c:3232 msgid "kbps" msgstr "kbps" #: ../src/main.c:3242 msgid "sec" msgstr "sec" #: ../src/main.c:3296 msgid "RX speed" msgstr "RX speed" #: ../src/main.c:3315 msgid "TX speed" msgstr "TX speed" #: ../src/main.c:3330 msgid "Parameter" msgstr "Parameter" #: ../src/main.c:3335 msgid "Value" msgstr "Value" #: ../src/main.c:3341 msgid "Received data" msgstr "Received data" #: ../src/main.c:3344 msgid "Transmitted data" msgstr "Transmitted data" #: ../src/main.c:3347 msgid "Receive speed" msgstr "Receive speed" #: ../src/main.c:3350 msgid "Transmit speed" msgstr "Transmit speed" #: ../src/main.c:3353 msgid "Session time" msgstr "Session time" #: ../src/main.c:3356 msgid "Traffic left" msgstr "Traffic left" #: ../src/main.c:3359 msgid "Time left" msgstr "Time left" #: ../src/main.c:3372 msgid "Device error" msgstr "Device error" #: ../src/main.c:3399 #, c-format msgid "" "%s\n" "%s ID: %u Availability: %s Access tech: %s" msgstr "%s\n%s ID: %u Availability: %s Access tech: %s" #: ../src/main.c:3435 msgid "Error scanning networks" msgstr "Error scanning networks" #: ../src/main.c:3449 ../resources/modem-manager-gui.ui:2704 msgid "Operator" msgstr "Operator" #: ../src/main.c:3495 ../src/main.c:3502 ../src/main.c:3554 ../src/main.c:3562 msgid "Not supported" msgstr "Not supported" #: ../src/main.c:3584 msgid "Sample command" msgstr "Sample command" #: ../src/main.c:3790 ../src/main.c:3803 msgid "" "USSD request is not valid\n" "Request must be 160 symbols long\n" "started with '*' and ended with '#'" msgstr "USSD request is not valid\nRequest must be 160 symbols long\nstarted with '*' and ended with '#'" #: ../src/main.c:3880 ../src/main.c:3883 ../src/main.c:3886 ../src/main.c:3920 msgid "Error sending USSD" msgstr "Error sending USSD" #: ../src/main.c:3880 msgid "Wrong USSD request or device not ready" msgstr "Wrong USSD request or device not ready" #: ../src/main.c:3883 msgid "USSD session terminated. You can send new request" msgstr "USSD session terminated. You can send new request" #: ../src/main.c:3886 msgid "Wrong USSD request" msgstr "Wrong USSD request" #: ../src/main.c:3909 msgid "" "\n" "USSD session is active. Waiting for your input...\n" msgstr "\nUSSD session is active. Waiting for your input...\n" #: ../src/main.c:3970 msgid "Command" msgstr "Command" #: ../src/main.c:3976 msgid "Description" msgstr "Description" #: ../src/main.c:4045 #, c-format msgid "Received %u new SMS messages" msgstr "Received %u new SMS messages" #: ../src/main.c:4047 ../src/main.c:4116 msgid "Received new SMS message" msgstr "Received new SMS message" #: ../src/main.c:4051 msgid "Message senders: " msgstr "Message senders: " #: ../src/main.c:4177 msgid "" "SMS number is not valid\n" "Only numbers from 2 to 20 digits without\n" "letters and symbols can be used" msgstr "SMS number is not valid\nOnly numbers from 2 to 20 digits without\nletters and symbols can be used" #: ../src/main.c:4179 msgid "" "SMS text is not valid\n" "Please write some text to send" msgstr "SMS text is not valid\nPlease write some text to send" #: ../src/main.c:4297 msgid "Wrong number or device not ready" msgstr "Wrong number or device not ready" #: ../src/main.c:4345 msgid "Remove message" msgstr "Remove message" #: ../src/main.c:4345 msgid "Really want to remove message?" msgstr "Really want to remove message?" #: ../src/main.c:4351 ../src/main.c:4356 msgid "Error removing SMS" msgstr "Error removing SMS" #: ../src/main.c:4351 msgid "Message not found" msgstr "Message not found" #: ../src/main.c:4356 msgid "Message not selected" msgstr "Message not selected" #: ../src/main.c:4508 msgid "This message can't be read" msgstr "This message can't be read" #: ../src/main.c:4514 msgid "" "This is folder for your incoming SMS messages.\n" "You can answer selected message using 'Answer' button." msgstr "This is folder for your incoming SMS messages.\nYou can answer selected message using 'Answer' button." #: ../src/main.c:4517 msgid "This is folder for your sent SMS messages." msgstr "This is folder for your sent SMS messages." #: ../src/main.c:4520 msgid "" "This is folder for your SMS message drafts.\n" "Select message and click 'Answer' button to start editing." msgstr "This is folder for your SMS message drafts.\nSelect message and click 'Answer' button to start editing." #: ../src/main.c:4556 #, c-format msgid "" "%s\n" "%s" msgstr "%s\n%s" #: ../src/main.c:4611 msgid "" "Incoming\n" "Incoming messages" msgstr "Incoming\nIncoming messages" #: ../src/main.c:4612 msgid "" "Sent\n" "Sent messages" msgstr "Sent\nSent messages" #: ../src/main.c:4613 msgid "" "Drafts\n" "Message drafts" msgstr "Drafts\nMessage drafts" #: ../src/main.c:4690 ../resources/modem-manager-gui.ui:1908 #: ../resources/modem-manager-gui.ui:2321 msgid "SMS" msgstr "SMS" #: ../src/main.c:4959 msgid "Error opening device" msgstr "Error opening device" #: ../src/main.c:5105 #, c-format msgid "" "%s %s\n" "Version:%s Port:%s Type:%s" msgstr "%s %s\nVersion:%s Port:%s Type:%s" #: ../src/main.c:5154 msgid "Selected" msgstr "Selected" #: ../src/main.c:5159 ../resources/modem-manager-gui.ui:2572 msgid "Device" msgstr "Device" #: ../src/main.c:5215 msgid "GNOME contacts" msgstr "GNOME contacts" #: ../src/main.c:5222 msgid "KDE contacts" msgstr "KDE contacts" #: ../src/main.c:5277 msgid "Traffic limit exceeded... It's time to take rest \\(^_^)/" msgstr "Traffic limit exceeded... It's time to take rest \\(^_^)/" #: ../src/main.c:5300 msgid "Time limit exceeded... Go sleep and have nice dreams -_-" msgstr "Time limit exceeded... Go sleep and have nice dreams -_-" #: ../src/main.c:5673 msgid "Show window" msgstr "Show window" #: ../src/main.c:5680 msgid "New SMS" msgstr "New SMS" #: ../src/main.c:5741 ../resources/modem-manager-gui.ui:761 msgid "Preferences" msgstr "Preferences" #: ../src/main.c:5743 ../resources/modem-manager-gui.ui:7 msgid "About" msgstr "About" #: ../src/main.c:5745 msgid "Quit" msgstr "Quit" #: ../src/main.c:5776 ../src/main.c:5813 msgid "Error while initialization" msgstr "Error while initialization" #: ../src/main.c:5776 msgid "No one modem manager is available" msgstr "No one modem manager is available" #: ../src/main.c:5813 msgid "Interface building error" msgstr "Interface building error" #: ../src/main.c:5860 #, c-format msgid "Segmentation fault at address: %p\n" msgstr "Segmentation fault at address: %p\n" #: ../src/main.c:5863 msgid "Stack trace:\n" msgstr "Stack trace:\n" #: ../src/main.c:5890 msgid "Do not show window on start" msgstr "Do not show window on start" #: ../src/main.c:5920 msgid "- tool for EDGE/3G/4G modem specific functions control" msgstr "- tool for EDGE/3G/4G modem specific functions control" #: ../src/main.c:5927 #, c-format msgid "Command line option parsing failed: %s\n" msgstr "Command line option parsing failed: %s\n" #: ../src/strformat.c:39 #, c-format msgid "%.3f kbps" msgstr "%.3f kbps" #: ../src/strformat.c:41 #, c-format msgid "%.3f kbps" msgstr "%.3f kbps" #: ../src/strformat.c:46 #, c-format msgid "%.3g Mbps" msgstr "%.3g Mbps" #: ../src/strformat.c:48 #, c-format msgid "%.3g Mbps" msgstr "%.3g Mbps" #: ../src/strformat.c:53 #, c-format msgid "%.3g Gbps" msgstr "%.3g Gbps" #: ../src/strformat.c:55 #, c-format msgid "%.3g Gbps" msgstr "%.3g Gbps" #: ../src/strformat.c:87 #, c-format msgid "%u sec" msgstr "%u sec" #: ../src/strformat.c:89 #, c-format msgid "%u sec" msgstr "%u sec" #: ../src/strformat.c:93 #, c-format msgid "%s:%s" msgstr "%s:%s" #: ../src/strformat.c:95 #, c-format msgid "%s:%s" msgstr "%s:%s" #: ../src/strformat.c:99 #, c-format msgid "%s:%s:%s" msgstr "%s:%s:%s" #: ../src/strformat.c:101 #, c-format msgid "%s:%s:%s" msgstr "%s:%s:%s" #: ../src/strformat.c:105 #, c-format msgid "%lu day(s) %s:%s:%s" msgstr "%lu day(s) %s:%s:%s" #: ../src/strformat.c:107 #, c-format msgid "%lu day(s) %s:%s:%s" msgstr "%lu day(s) %s:%s:%s" #: ../src/strformat.c:124 #, c-format msgid "%u" msgstr "%u" #: ../src/strformat.c:126 #, c-format msgid "%u" msgstr "%u" #: ../src/strformat.c:131 #, c-format msgid "%.3g Kb" msgstr "%.3g Kb" #: ../src/strformat.c:133 #, c-format msgid "%.3g Kb" msgstr "%.3g Kb" #: ../src/strformat.c:138 #, c-format msgid "%.3g Mb" msgstr "%.3g Mb" #: ../src/strformat.c:140 #, c-format msgid "%.3g Mb" msgstr "%.3g Mb" #: ../src/strformat.c:145 #, c-format msgid "%.3g Gb" msgstr "%.3g Gb" #: ../src/strformat.c:147 #, c-format msgid "%.3g Gb" msgstr "%.3g Gb" #: ../src/strformat.c:152 #, c-format msgid "%.3g Tb" msgstr "%.3g Tb" #: ../src/strformat.c:154 #, c-format msgid "%.3g Tb" msgstr "%.3g Tb" #: ../src/strformat.c:205 msgid "Available" msgstr "Available" #: ../src/strformat.c:207 msgid "Current" msgstr "Current" #: ../src/strformat.c:209 msgid "Forbidden" msgstr "Forbidden" #: ../src/strformat.c:241 msgid "Not registered" msgstr "Not registered" #: ../src/strformat.c:243 msgid "Home network" msgstr "Home network" #: ../src/strformat.c:245 msgid "Searching" msgstr "Searching" #: ../src/strformat.c:247 msgid "Registration denied" msgstr "Registration denied" #: ../src/strformat.c:249 ../src/strformat.c:253 msgid "Unknown status" msgstr "Unknown status" #: ../src/strformat.c:251 msgid "Roaming network" msgstr "Roaming network" #: ../resources/modem-manager-gui.ui:17 msgid "Copyright 2012-2013 Alex" msgstr "Copyright 2012-2013 Alex" #: ../resources/modem-manager-gui.ui:18 msgid "Tool for EDGE/3G/4G modem specific functions control" msgstr "Tool for EDGE/3G/4G modem specific functions control" #: ../resources/modem-manager-gui.ui:20 msgid "Homepage" msgstr "Homepage" #: ../resources/modem-manager-gui.ui:21 msgid "GPL3" msgstr "GPL3" #: ../resources/modem-manager-gui.ui:23 msgid "English: Alex " msgstr "English: Alex " #: ../resources/modem-manager-gui.ui:55 msgid "Active connections" msgstr "Active connections" #: ../resources/modem-manager-gui.ui:111 msgid "Terminate selected application using SIGTERM signal CTRL+T" msgstr "Terminate selected application using SIGTERM signal CTRL+T" #: ../resources/modem-manager-gui.ui:113 msgid "Terminate application" msgstr "Terminate application" #: ../resources/modem-manager-gui.ui:167 msgid "Error" msgstr "Error" #: ../resources/modem-manager-gui.ui:282 msgid "Ask me again" msgstr "Ask me again" #: ../resources/modem-manager-gui.ui:302 msgid "Quit or minimize?" msgstr "Quit or minimize?" #: ../resources/modem-manager-gui.ui:316 msgid "What do you want application to do on window close?" msgstr "What do you want application to do on window close?" #: ../resources/modem-manager-gui.ui:327 msgid "Just quit" msgstr "Just quit" #: ../resources/modem-manager-gui.ui:344 msgid "Minimize to tray or messaging menu" msgstr "Minimize to tray or messaging menu" #: ../resources/modem-manager-gui.ui:378 #: ../resources/modem-manager-gui.ui:3366 msgid "New contact" msgstr "New contact" #: ../resources/modem-manager-gui.ui:611 msgid "New SMS message" msgstr "New SMS message" #: ../resources/modem-manager-gui.ui:657 #: ../resources/modem-manager-gui.ui:2374 msgid "Send" msgstr "Send" #: ../resources/modem-manager-gui.ui:693 msgid "Number" msgstr "Number" #: ../resources/modem-manager-gui.ui:838 msgid "Concatenate messages" msgstr "Concatenate messages" #: ../resources/modem-manager-gui.ui:853 msgid "Expand folders" msgstr "Expand folders" #: ../resources/modem-manager-gui.ui:868 msgid "Place old messages on top" msgstr "Place old messages on top" #: ../resources/modem-manager-gui.ui:889 msgid "SMS" msgstr "SMS" #: ../resources/modem-manager-gui.ui:947 msgid "RX Speed graph color" msgstr "RX Speed graph color" #: ../resources/modem-manager-gui.ui:962 msgid "TX Speed graph color" msgstr "TX Speed graph color" #: ../resources/modem-manager-gui.ui:979 msgid "Traffic" msgstr "Traffic" #: ../resources/modem-manager-gui.ui:1008 msgid "Use sounds for events" msgstr "Use sounds for events" #: ../resources/modem-manager-gui.ui:1023 msgid "Hide window to tray on close" msgstr "Hide window to tray on close" #: ../resources/modem-manager-gui.ui:1038 msgid "Save window geometry and placement" msgstr "Save window geometry and placement" #: ../resources/modem-manager-gui.ui:1059 msgid "Behaviour" msgstr "Behaviour" #: ../resources/modem-manager-gui.ui:1087 msgid "Progress" msgstr "Progress" #: ../resources/modem-manager-gui.ui:1142 msgid "Executing command" msgstr "Executing command" #: ../resources/modem-manager-gui.ui:1181 msgid "Question" msgstr "Question" #: ../resources/modem-manager-gui.ui:1234 msgid "Traffic limits" msgstr "Traffic limits" #: ../resources/modem-manager-gui.ui:1296 msgid "Eanble traffic limit" msgstr "Eanble traffic limit" #: ../resources/modem-manager-gui.ui:1312 msgid "Enable time limit" msgstr "Enable time limit" #: ../resources/modem-manager-gui.ui:1330 #: ../resources/modem-manager-gui.ui:1972 #: ../resources/modem-manager-gui.ui:3271 msgid "Traffic" msgstr "Traffic" #: ../resources/modem-manager-gui.ui:1376 #: ../resources/modem-manager-gui.ui:1478 msgid "Message" msgstr "Message" #: ../resources/modem-manager-gui.ui:1402 #: ../resources/modem-manager-gui.ui:1504 msgid "Action" msgstr "Action" #: ../resources/modem-manager-gui.ui:1433 msgid "Time" msgstr "Time" #: ../resources/modem-manager-gui.ui:1548 msgid "Traffic statistics" msgstr "Traffic statistics" #: ../resources/modem-manager-gui.ui:1608 msgid "Selected statistics period" msgstr "Selected statistics period" #: ../resources/modem-manager-gui.ui:1773 msgid "Add new USSD command CTRL+N" msgstr "Add new USSD command CTRL+N" #: ../resources/modem-manager-gui.ui:1775 msgid "Add" msgstr "Add" #: ../resources/modem-manager-gui.ui:1789 msgid "Remove selected USSD command CTRL+D" msgstr "Remove selected USSD command CTRL+D" #: ../resources/modem-manager-gui.ui:1791 msgid "Delete" msgstr "Delete" #: ../resources/modem-manager-gui.ui:1815 msgid "" "Force USSD answer encoding change from GSM7 to UCS2 (useful for Huawei " "modems) CTRL+E" msgstr "Force USSD answer encoding change from GSM7 to UCS2 (useful for Huawei modems) CTRL+E" #: ../resources/modem-manager-gui.ui:1817 msgid "Change message encoding" msgstr "Change message encoding" #: ../resources/modem-manager-gui.ui:1871 msgid "Modem Manager GUI" msgstr "Modem Manager GUI" #: ../resources/modem-manager-gui.ui:1890 msgid "View and select available devices CTRL+F1" msgstr "View and select available devices CTRL+F1" #: ../resources/modem-manager-gui.ui:1892 #: ../resources/modem-manager-gui.ui:2117 msgid "Devices" msgstr "Devices" #: ../resources/modem-manager-gui.ui:1906 msgid "Send and receive SMS messages CTRL+F2" msgstr "Send and receive SMS messages CTRL+F2" #: ../resources/modem-manager-gui.ui:1922 msgid "Send USSD requests CTRL+F3" msgstr "Send USSD requests CTRL+F3" #: ../resources/modem-manager-gui.ui:1924 #: ../resources/modem-manager-gui.ui:2523 msgid "USSD" msgstr "USSD" #: ../resources/modem-manager-gui.ui:1938 msgid "View active device information CTRL+F4" msgstr "View active device information CTRL+F4" #: ../resources/modem-manager-gui.ui:1940 #: ../resources/modem-manager-gui.ui:2975 msgid "Info" msgstr "Info" #: ../resources/modem-manager-gui.ui:1954 msgid "Scan existing mobile networks CTRL+F5" msgstr "Scan existing mobile networks CTRL+F5" #: ../resources/modem-manager-gui.ui:1956 #: ../resources/modem-manager-gui.ui:3125 msgid "Scan" msgstr "Scan" #: ../resources/modem-manager-gui.ui:1970 msgid "Monitor network traffic CTRL+F6" msgstr "Monitor network traffic CTRL+F6" #: ../resources/modem-manager-gui.ui:1986 msgid "View system and modem addressbooks CTRL+F7" msgstr "View system and modem addressbooks CTRL+F7" #: ../resources/modem-manager-gui.ui:1988 #: ../resources/modem-manager-gui.ui:3455 msgid "Contacts" msgstr "Contacts" #: ../resources/modem-manager-gui.ui:2041 msgid "No devices found in system" msgstr "No devices found in system" #: ../resources/modem-manager-gui.ui:2210 msgid "Send new SMS message CTRL+N" msgstr "Send new SMS message CTRL+N" #: ../resources/modem-manager-gui.ui:2212 msgid "New" msgstr "New" #: ../resources/modem-manager-gui.ui:2226 msgid "Remove selected message CTRL+D" msgstr "Remove selected message CTRL+D" #: ../resources/modem-manager-gui.ui:2228 msgid "Remove" msgstr "Remove" #: ../resources/modem-manager-gui.ui:2242 msgid "Answer selected message CTRL+A" msgstr "Answer selected message CTRL+A" #: ../resources/modem-manager-gui.ui:2244 msgid "Answer" msgstr "Answer" #: ../resources/modem-manager-gui.ui:2340 msgid "Request" msgstr "Request" #: ../resources/modem-manager-gui.ui:2378 msgid "Send ussd request CTRL+S" msgstr "Send ussd request CTRL+S" #: ../resources/modem-manager-gui.ui:2398 msgid "Edit USSD commands list CTRL+E" msgstr "Edit USSD commands list CTRL+E" #: ../resources/modem-manager-gui.ui:2600 msgid "IMEI" msgstr "IMEI" #: ../resources/modem-manager-gui.ui:2627 msgid "IMSI/ESN" msgstr "IMSI/ESN" #: ../resources/modem-manager-gui.ui:2658 msgid "Equipment" msgstr "Equipment" #: ../resources/modem-manager-gui.ui:2732 msgid "Mode" msgstr "Mode" #: ../resources/modem-manager-gui.ui:2760 msgid "Signal level" msgstr "Signal level" #: ../resources/modem-manager-gui.ui:2774 msgid "Operator code" msgstr "Operator code" #: ../resources/modem-manager-gui.ui:2801 msgid "Registration" msgstr "Registration" #: ../resources/modem-manager-gui.ui:2846 msgid "Network" msgstr "Network" #: ../resources/modem-manager-gui.ui:2892 msgid "" "3GPP Location\n" "MCC/MNC/LAC/CID" msgstr "3GPP Location\nMCC/MNC/LAC/CID" #: ../resources/modem-manager-gui.ui:2908 msgid "" "GPS location\n" "Longitude/Latiude" msgstr "GPS location\nLongitude/Latiude" #: ../resources/modem-manager-gui.ui:2955 msgid "Location" msgstr "Location" #: ../resources/modem-manager-gui.ui:3021 msgid "Scan available mobile networks CTRL+S" msgstr "Scan available mobile networks CTRL+S" #: ../resources/modem-manager-gui.ui:3023 msgid "Start scan" msgstr "Start scan" #: ../resources/modem-manager-gui.ui:3145 msgid "Set traffic amount or time limit for disconnect CTRL+L" msgstr "Set traffic amount or time limit for disconnect CTRL+L" #: ../resources/modem-manager-gui.ui:3147 msgid "Set limit" msgstr "Set limit" #: ../resources/modem-manager-gui.ui:3161 msgid "View list of active network connections CTRL+C" msgstr "View list of active network connections CTRL+C" #: ../resources/modem-manager-gui.ui:3163 msgid "Connections" msgstr "Connections" #: ../resources/modem-manager-gui.ui:3177 msgid "View daily traffic statistics CTRL+S" msgstr "View daily traffic statistics CTRL+S" #: ../resources/modem-manager-gui.ui:3179 msgid "Statistics" msgstr "Statistics" #: ../resources/modem-manager-gui.ui:3230 msgid "Transmission speed" msgstr "Transmission speed" #: ../resources/modem-manager-gui.ui:3364 msgid "Add new contact to modem addressbook CTRL+N" msgstr "Add new contact to modem addressbook CTRL+N" #: ../resources/modem-manager-gui.ui:3380 msgid "Remove contact from modem addressbook CTRL+D" msgstr "Remove contact from modem addressbook CTRL+D" #: ../resources/modem-manager-gui.ui:3382 msgid "Remove contact" msgstr "Remove contact" #: ../resources/modem-manager-gui.ui:3406 msgid "Send SMS message to selected contact CTRL+S" msgstr "Send SMS message to selected contact CTRL+S" #: ../resources/modem-manager-gui.ui:3408 msgid "Send SMS" msgstr "Send SMS" #: manual addition msgid "Show message" msgstr "Show message" #: manual addition msgid "Disconnect" msgstr "Disconnect" #: manual addition msgid "Hours" msgstr "Hours" #: manual addition msgid "Minutes" msgstr "Minutes" #: manual addition msgid "Mb" msgstr "Mb" #: manual addition msgid "Gb" msgstr "Gb" #: manual addition msgid "Tb" msgstr "Tb" #: manual addition msgid "January" msgstr "January" #: manual addition msgid "February" msgstr "February" #: manual addition msgid "March" msgstr "March" #: manual addition msgid "April" msgstr "April" #: manual addition msgid "May" msgstr "May" #: manual addition msgid "June" msgstr "June" #: manual addition msgid "July" msgstr "July" #: manual addition msgid "August" msgstr "August" #: manual addition msgid "September" msgstr "September" #: manual addition msgid "October" msgstr "October" #: manual addition msgid "November" msgstr "November" #: manual addition msgid "December" msgstr "December" modem-manager-gui-0.0.16/po/id.po000066400000000000000000000670721217271411700164620ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # # Translators: # Malsasa , 2013 # etc.session , 2013 # Malsasa , 2013 # master , 2013 msgid "" msgstr "" "Project-Id-Version: Modem Manager GUI\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2013-07-11 23:22+0400\n" "PO-Revision-Date: 2013-07-11 19:33+0000\n" "Last-Translator: ethereal \n" "Language-Team: Indonesian (http://www.transifex.com/projects/p/modem-manager-gui/language/id/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: id\n" "Plural-Forms: nplurals=1; plural=0;\n" #: ../src/ayatana.c:129 msgid "Unread SMS" msgstr "" #: ../src/ayatana.c:300 msgid "Unread messages" msgstr "" #: ../src/main.c:667 ../src/main.c:3372 ../src/main.c:4297 msgid "Error sending message" msgstr "Galat mengirim pesan" #: ../src/main.c:738 msgid "Operation timed out" msgstr "" #: ../src/main.c:738 msgid "Operation took too long to execute. Please restart it." msgstr "" #: ../src/main.c:1083 msgid "Modem must be enabled to read SMS. Enable modem?" msgstr "Modem harus diaktifkan untuk membaca SMS. Aktifkan modem?" #: ../src/main.c:1084 msgid "Modem must be enabled to read and write SMS. Please enable modem." msgstr "" #: ../src/main.c:1085 msgid "" "Modem must be registered in mobile network to receive and send SMS. Please " "wait..." msgstr "" #: ../src/main.c:1086 msgid "Modem must be unlocked to receive and send SMS. Please enter PIN code." msgstr "" #: ../src/main.c:1087 msgid "Modem manager does not support SMS manipulation functions." msgstr "" #: ../src/main.c:1088 msgid "Modem manager does not support sending of SMS messages." msgstr "" #: ../src/main.c:1106 msgid "Modem must be enabled to send USSD. Enable modem?" msgstr "Modem harus diaktifkan untuk mengirim USSD. Aktifkan modem?" #: ../src/main.c:1107 msgid "Modem must be enabled to send USSD. Please enable modem." msgstr "" #: ../src/main.c:1108 msgid "" "Modem must be registered in mobile network to send USSD. Please wait..." msgstr "" #: ../src/main.c:1109 msgid "Modem must be unlocked to send USSD. Please enter PIN code." msgstr "" #: ../src/main.c:1110 msgid "Modem manager does not support sending of USSD requests." msgstr "" #: ../src/main.c:1138 msgid "Modem must be enabled to scan for available networks. Enable modem?" msgstr "Modem harus diaktifkan untuk memindai pada jaringan yang tersedia. Aktifkan modem?" #: ../src/main.c:1139 msgid "" "Modem must be enabled to scan for available networks. Please enable modem." msgstr "" #: ../src/main.c:1141 msgid "" "Modem must be unlocked to scan for available networks. Please enter PIN " "code." msgstr "" #: ../src/main.c:1142 msgid "Modem manager does not support scanning for available mobile networks." msgstr "" #: ../src/main.c:1143 msgid "Modem is connected now. Please disconnect to scan." msgstr "Modem sedang terhubung sekarang. Silakan putuskan untuk memindai." #: ../src/main.c:1175 msgid "Modem must be enabled to export contacts from it. Enable modem?" msgstr "" #: ../src/main.c:1176 msgid "Modem must be enabled to export contacts from it. Please enable modem." msgstr "" #: ../src/main.c:1178 msgid "" "Modem must be unlocked to export contacts from it. Please enter PIN code." msgstr "" #: ../src/main.c:1179 msgid "Modem manager does not support modem contacts manipulation functions." msgstr "" #: ../src/main.c:1180 msgid "Modem manager does not support modem contacts edition functions." msgstr "" #: ../src/main.c:1218 msgid "Enable modem" msgstr "Aktifkan modem" #: ../src/main.c:1222 ../src/main.c:4731 msgid "Error enabling device" msgstr "Galat mengaktifkan perangkat" #: ../src/main.c:1438 ../src/main.c:1465 msgid "Modem Manager GUI window hidden" msgstr "" #: ../src/main.c:1438 ../src/main.c:1465 msgid "Use tray icon or messaging menu to show window again" msgstr "" #: ../src/main.c:1757 #, c-format msgid "Unread messages: %u" msgstr "" #: ../src/main.c:1760 ../src/main.c:1763 ../src/main.c:5669 msgid "No unread messages" msgstr "Tak ada pesan yang dapat dibaca" #: ../src/main.c:2085 msgid "Error adding contact" msgstr "" #: ../src/main.c:2121 msgid "Remove contact" msgstr "" #: ../src/main.c:2121 msgid "Really want to remove contact?" msgstr "" #: ../src/main.c:2125 ../src/main.c:2130 msgid "Error removing contact" msgstr "" #: ../src/main.c:2125 msgid "Contact not removed from device" msgstr "" #: ../src/main.c:2130 msgid "Contact not selected" msgstr "" #: ../src/main.c:2260 ../resources/modem-manager-gui.ui:517 msgid "First name" msgstr "" #: ../src/main.c:2264 ../resources/modem-manager-gui.ui:530 msgid "First number" msgstr "" #: ../src/main.c:2268 ../resources/modem-manager-gui.ui:543 msgid "EMail" msgstr "" #: ../src/main.c:2272 ../resources/modem-manager-gui.ui:556 msgid "Group" msgstr "" #: ../src/main.c:2276 ../resources/modem-manager-gui.ui:570 msgid "Second name" msgstr "" #: ../src/main.c:2280 ../resources/modem-manager-gui.ui:583 msgid "Second number" msgstr "" #: ../src/main.c:2289 msgid "Modem contacts" msgstr "" #: ../src/main.c:2357 ../src/main.c:2410 ../src/main.c:4553 #: ../src/strformat.c:165 ../src/strformat.c:195 ../src/strformat.c:203 #: ../src/strformat.c:211 #, c-format msgid "Unknown" msgstr "Tidak diketahui" #: ../src/main.c:2521 msgid "Day" msgstr "" #: ../src/main.c:2525 msgid "Received data" msgstr "" #: ../src/main.c:2529 msgid "Transmitted data" msgstr "" #: ../src/main.c:2533 msgid "Session time" msgstr "" #: ../src/main.c:2696 msgid "Application" msgstr "Aplikasi" #: ../src/main.c:2700 msgid "PID" msgstr "PID" #: ../src/main.c:2704 msgid "Protocol" msgstr "Protokol" #: ../src/main.c:2708 msgid "State" msgstr "Status" #: ../src/main.c:2712 msgid "Buffer" msgstr "Buffer" #: ../src/main.c:2716 msgid "Port" msgstr "Port" #: ../src/main.c:2720 msgid "Destination" msgstr "Tujuan" #: ../src/main.c:2746 msgid "Traffic limit exceeded" msgstr "Melebihi batas lalu lintas jaringan" #: ../src/main.c:2750 msgid "Time limit exceeded" msgstr "Melebihi batas waktu" #: ../src/main.c:2927 #, c-format msgid "" "Traffic: %s, limit set to: %s\n" "Time: %s, limit set to: %s\n" "Please check entered values and try once more" msgstr "Jaringan: %s, batas diatur ke: %s\nWaktu: %s, batas diatur ke: %s\nSilakan periksa nilai yang dimasukkan dan cobalah sekali lagi" #: ../src/main.c:2932 msgid "Wrong traffic and time limit values" msgstr "Nilai lalu lintas jaringan dan batasan waktu salah" #: ../src/main.c:2935 #, c-format msgid "" "Traffic: %s, limit set to: %s\n" "Please check entered values and try once more" msgstr "Traffic: %s, Ubah batasan pada: %s\nSilakan periksa nilai yang dimasukkan dan cobalah sekali lagi" #: ../src/main.c:2938 msgid "Wrong traffic limit value" msgstr "Salah penetapan batas traffic jaringan" #: ../src/main.c:2941 #, c-format msgid "" "Time: %s, limit set to: %s\n" "Please check entered values and try once more" msgstr "Waktu: %s, batas diatur ke: %s\nSilakan periksa nilai yang dimasukkan dan cobalah sekali lagi" #: ../src/main.c:2944 msgid "Wrong time limit value" msgstr "Batas nilai waktu salah" #: ../src/main.c:2981 #, c-format msgid "%s disconnected" msgstr "%s terputus" #: ../src/main.c:3055 ../src/main.c:3079 ../src/main.c:3103 msgid "Disconnected" msgstr "Terputus" #: ../src/main.c:3067 ../src/main.c:3073 ../src/main.c:3091 ../src/main.c:3097 msgid "Limit" msgstr "Batasan" #: ../src/main.c:3070 ../src/main.c:3076 ../src/main.c:3094 ../src/main.c:3100 msgid "Disabled" msgstr "Nonaktif" #: ../src/main.c:3232 msgid "kbps" msgstr "kbps" #: ../src/main.c:3242 msgid "sec" msgstr "detik" #: ../src/main.c:3296 msgid "RX speed" msgstr "Kecepatan RX" #: ../src/main.c:3315 msgid "TX speed" msgstr "Kecepatan TX" #: ../src/main.c:3330 msgid "Parameter" msgstr "Parameter" #: ../src/main.c:3335 msgid "Value" msgstr "Nilai" #: ../src/main.c:3341 msgid "Received data" msgstr "Data diterima" #: ../src/main.c:3344 msgid "Transmitted data" msgstr "Data ditransfer" #: ../src/main.c:3347 msgid "Receive speed" msgstr "Kecepatan menerima" #: ../src/main.c:3350 msgid "Transmit speed" msgstr "Kecepatan mengirim" #: ../src/main.c:3353 msgid "Session time" msgstr "Waktu sesi" #: ../src/main.c:3356 msgid "Traffic left" msgstr "Sisa traffic" #: ../src/main.c:3359 msgid "Time left" msgstr "Sisa waktu" #: ../src/main.c:3372 msgid "Device error" msgstr "Perangkat galat" #: ../src/main.c:3399 #, c-format msgid "" "%s\n" "%s ID: %u Availability: %s Access tech: %s" msgstr "%s\n%s ID: %u Tersedia: %s Akses teknologi: %s" #: ../src/main.c:3435 msgid "Error scanning networks" msgstr "Galat memindai jaringan" #: ../src/main.c:3449 ../resources/modem-manager-gui.ui:2704 msgid "Operator" msgstr "Operator" #: ../src/main.c:3495 ../src/main.c:3502 ../src/main.c:3554 ../src/main.c:3562 msgid "Not supported" msgstr "" #: ../src/main.c:3584 msgid "Sample command" msgstr "Contoh perintah" #: ../src/main.c:3790 ../src/main.c:3803 msgid "" "USSD request is not valid\n" "Request must be 160 symbols long\n" "started with '*' and ended with '#'" msgstr "Permintaan USSD tidak sah\nPermintaan harus terdiri dari 160 simbol\ndimulai dengan '*' dan diakhiri dengan '#'" #: ../src/main.c:3880 ../src/main.c:3883 ../src/main.c:3886 ../src/main.c:3920 msgid "Error sending USSD" msgstr "Galat mengirim USSD" #: ../src/main.c:3880 msgid "Wrong USSD request or device not ready" msgstr "Permintaan USSD salah atau perangkat belum siap" #: ../src/main.c:3883 msgid "USSD session terminated. You can send new request" msgstr "Sesi USSD dihentikan. Anda dapat mengirim permintaan baru" #: ../src/main.c:3886 msgid "Wrong USSD request" msgstr "Permintaan USSD salah" #: ../src/main.c:3909 msgid "" "\n" "USSD session is active. Waiting for your input...\n" msgstr "\nSessi USSD telah aktif. Tunggulah untuk data masukan anda...\n" #: ../src/main.c:3970 msgid "Command" msgstr "Perintah" #: ../src/main.c:3976 msgid "Description" msgstr "Penjelasan" #: ../src/main.c:4045 #, c-format msgid "Received %u new SMS messages" msgstr "Diterima %u pesan SMS baru" #: ../src/main.c:4047 ../src/main.c:4116 msgid "Received new SMS message" msgstr "Pesan SMS baru telah diterima" #: ../src/main.c:4051 msgid "Message senders: " msgstr "Pengirim:" #: ../src/main.c:4177 msgid "" "SMS number is not valid\n" "Only numbers from 2 to 20 digits without\n" "letters and symbols can be used" msgstr "Nomor SMS tidak sah\nHanya nomor dari 2 hingga 20 digit tanpa\nhuruf dan simbol yang bisa dipakai" #: ../src/main.c:4179 msgid "" "SMS text is not valid\n" "Please write some text to send" msgstr "Teks SMS tidak sah\nTulis teks untuk dapat mengirim" #: ../src/main.c:4297 msgid "Wrong number or device not ready" msgstr "Salah nomor atau perangkat tidak siap" #: ../src/main.c:4345 msgid "Remove message" msgstr "Hapus pesan" #: ../src/main.c:4345 msgid "Really want to remove message?" msgstr "Yakin ingin menghapus pesan?" #: ../src/main.c:4351 ../src/main.c:4356 msgid "Error removing SMS" msgstr "Galat menghapus SMS" #: ../src/main.c:4351 msgid "Message not found" msgstr "Pesan tidak ditemukan" #: ../src/main.c:4356 msgid "Message not selected" msgstr "Pesan tidak dipilih" #: ../src/main.c:4508 msgid "This message can't be read" msgstr "Pesan ini tidak dapat dibaca" #: ../src/main.c:4514 msgid "" "This is folder for your incoming SMS messages.\n" "You can answer selected message using 'Answer' button." msgstr "Folder ini untuk pesan yang Anda terima.\nAnda dapat menjawab pesan terpilih menggunakan tombol 'Jawab'." #: ../src/main.c:4517 msgid "This is folder for your sent SMS messages." msgstr "Folder ini untuk pesan terkirim Anda." #: ../src/main.c:4520 msgid "" "This is folder for your SMS message drafts.\n" "Select message and click 'Answer' button to start editing." msgstr "Folder ini untuk draf pesan singkat Anda.\nPilih pesan dan klik tombol 'Jawab' untuk mulai mengubahnya." #: ../src/main.c:4556 #, c-format msgid "" "%s\n" "%s" msgstr "%s\n%s" #: ../src/main.c:4611 msgid "" "Incoming\n" "Incoming messages" msgstr "Masuk\nPesan masuk" #: ../src/main.c:4612 msgid "" "Sent\n" "Sent messages" msgstr "Kirim\nMengirim pesan" #: ../src/main.c:4613 msgid "" "Drafts\n" "Message drafts" msgstr "Draf\nDraf pesan" #: ../src/main.c:4690 ../resources/modem-manager-gui.ui:1908 #: ../resources/modem-manager-gui.ui:2321 msgid "SMS" msgstr "SMS" #: ../src/main.c:4959 msgid "Error opening device" msgstr "Gagal membuka perangkat" #: ../src/main.c:5105 #, c-format msgid "" "%s %s\n" "Version:%s Port:%s Type:%s" msgstr "%s %s\nVersi:%s Port:%s Tipe:%s" #: ../src/main.c:5154 msgid "Selected" msgstr "Dipilih" #: ../src/main.c:5159 ../resources/modem-manager-gui.ui:2572 msgid "Device" msgstr "Perangkat" #: ../src/main.c:5215 msgid "GNOME contacts" msgstr "" #: ../src/main.c:5222 msgid "KDE contacts" msgstr "" #: ../src/main.c:5277 msgid "Traffic limit exceeded... It's time to take rest \\(^_^)/" msgstr "Batas lalu lintas jaringan terlampaui... Saatnya beristirahat" #: ../src/main.c:5300 msgid "Time limit exceeded... Go sleep and have nice dreams -_-" msgstr "Batas waktu telah terlampaui... Tidurlah dan mimpi indah" #: ../src/main.c:5673 msgid "Show window" msgstr "Tampilkan jendela" #: ../src/main.c:5680 msgid "New SMS" msgstr "SMS baru" #: ../src/main.c:5741 ../resources/modem-manager-gui.ui:761 msgid "Preferences" msgstr "Preferensi" #: ../src/main.c:5743 ../resources/modem-manager-gui.ui:7 msgid "About" msgstr "Tentang" #: ../src/main.c:5745 msgid "Quit" msgstr "" #: ../src/main.c:5776 ../src/main.c:5813 msgid "Error while initialization" msgstr "" #: ../src/main.c:5776 msgid "No one modem manager is available" msgstr "" #: ../src/main.c:5813 msgid "Interface building error" msgstr "" #: ../src/main.c:5860 #, c-format msgid "Segmentation fault at address: %p\n" msgstr "" #: ../src/main.c:5863 msgid "Stack trace:\n" msgstr "" #: ../src/main.c:5890 msgid "Do not show window on start" msgstr "" #: ../src/main.c:5920 msgid "- tool for EDGE/3G/4G modem specific functions control" msgstr "" #: ../src/main.c:5927 #, c-format msgid "Command line option parsing failed: %s\n" msgstr "" #: ../src/strformat.c:39 #, c-format msgid "%.3f kbps" msgstr "%.3f kbps" #: ../src/strformat.c:41 #, c-format msgid "%.3f kbps" msgstr "%.3f kbps" #: ../src/strformat.c:46 #, c-format msgid "%.3g Mbps" msgstr "%.3g Mbps" #: ../src/strformat.c:48 #, c-format msgid "%.3g Mbps" msgstr "%.3g Mbps" #: ../src/strformat.c:53 #, c-format msgid "%.3g Gbps" msgstr "%.3g Gbps" #: ../src/strformat.c:55 #, c-format msgid "%.3g Gbps" msgstr "%.3g Gbps" #: ../src/strformat.c:87 #, c-format msgid "%u sec" msgstr "%u detik" #: ../src/strformat.c:89 #, c-format msgid "%u sec" msgstr "%u detik" #: ../src/strformat.c:93 #, c-format msgid "%s:%s" msgstr "%s:%s" #: ../src/strformat.c:95 #, c-format msgid "%s:%s" msgstr "%s:%s" #: ../src/strformat.c:99 #, c-format msgid "%s:%s:%s" msgstr "%s:%s:%s" #: ../src/strformat.c:101 #, c-format msgid "%s:%s:%s" msgstr "%s:%s:%s" #: ../src/strformat.c:105 #, c-format msgid "%lu day(s) %s:%s:%s" msgstr "" #: ../src/strformat.c:107 #, c-format msgid "%lu day(s) %s:%s:%s" msgstr "" #: ../src/strformat.c:124 #, c-format msgid "%u" msgstr "%u" #: ../src/strformat.c:126 #, c-format msgid "%u" msgstr "%u" #: ../src/strformat.c:131 #, c-format msgid "%.3g Kb" msgstr "%.3g Kb" #: ../src/strformat.c:133 #, c-format msgid "%.3g Kb" msgstr "%.3g Kb" #: ../src/strformat.c:138 #, c-format msgid "%.3g Mb" msgstr "%.3g Mb" #: ../src/strformat.c:140 #, c-format msgid "%.3g Mb" msgstr "%.3g Mb" #: ../src/strformat.c:145 #, c-format msgid "%.3g Gb" msgstr "%.3g Gb" #: ../src/strformat.c:147 #, c-format msgid "%.3g Gb" msgstr "%.3g Gb" #: ../src/strformat.c:152 #, c-format msgid "%.3g Tb" msgstr "%.3g Tb" #: ../src/strformat.c:154 #, c-format msgid "%.3g Tb" msgstr "%.3g Tb" #: ../src/strformat.c:205 msgid "Available" msgstr "" #: ../src/strformat.c:207 msgid "Current" msgstr "" #: ../src/strformat.c:209 msgid "Forbidden" msgstr "" #: ../src/strformat.c:241 msgid "Not registered" msgstr "" #: ../src/strformat.c:243 msgid "Home network" msgstr "" #: ../src/strformat.c:245 msgid "Searching" msgstr "" #: ../src/strformat.c:247 msgid "Registration denied" msgstr "" #: ../src/strformat.c:249 ../src/strformat.c:253 msgid "Unknown status" msgstr "" #: ../src/strformat.c:251 msgid "Roaming network" msgstr "" #: ../resources/modem-manager-gui.ui:17 msgid "Copyright 2012-2013 Alex" msgstr "" #: ../resources/modem-manager-gui.ui:18 msgid "Tool for EDGE/3G/4G modem specific functions control" msgstr "Perangkat lunak untuk mengendalikan fungsi spesifik modem EDGE/3G/4G" #: ../resources/modem-manager-gui.ui:20 msgid "Homepage" msgstr "Situs Resmi" #: ../resources/modem-manager-gui.ui:21 msgid "GPL3" msgstr "GPL3" #: ../resources/modem-manager-gui.ui:23 msgid "English: Alex " msgstr "English: Alex " #: ../resources/modem-manager-gui.ui:55 msgid "Active connections" msgstr "Koneksi aktif" #: ../resources/modem-manager-gui.ui:111 msgid "Terminate selected application using SIGTERM signal CTRL+T" msgstr "" #: ../resources/modem-manager-gui.ui:113 msgid "Terminate application" msgstr "Matikan aplikasi" #: ../resources/modem-manager-gui.ui:167 msgid "Error" msgstr "Galat" #: ../resources/modem-manager-gui.ui:282 msgid "Ask me again" msgstr "" #: ../resources/modem-manager-gui.ui:302 msgid "Quit or minimize?" msgstr "" #: ../resources/modem-manager-gui.ui:316 msgid "What do you want application to do on window close?" msgstr "" #: ../resources/modem-manager-gui.ui:327 msgid "Just quit" msgstr "" #: ../resources/modem-manager-gui.ui:344 msgid "Minimize to tray or messaging menu" msgstr "" #: ../resources/modem-manager-gui.ui:378 #: ../resources/modem-manager-gui.ui:3366 msgid "New contact" msgstr "" #: ../resources/modem-manager-gui.ui:611 msgid "New SMS message" msgstr "Pesan SMS baru" #: ../resources/modem-manager-gui.ui:657 #: ../resources/modem-manager-gui.ui:2374 msgid "Send" msgstr "Kirim" #: ../resources/modem-manager-gui.ui:693 msgid "Number" msgstr "Nomor" #: ../resources/modem-manager-gui.ui:838 msgid "Concatenate messages" msgstr "Menyatukan pesan" #: ../resources/modem-manager-gui.ui:853 msgid "Expand folders" msgstr "Memperluas folder" #: ../resources/modem-manager-gui.ui:868 msgid "Place old messages on top" msgstr "" #: ../resources/modem-manager-gui.ui:889 msgid "SMS" msgstr "SMS" #: ../resources/modem-manager-gui.ui:947 msgid "RX Speed graph color" msgstr "Warna grafik kecepatan RX" #: ../resources/modem-manager-gui.ui:962 msgid "TX Speed graph color" msgstr "Warna grafik kecepatan TX" #: ../resources/modem-manager-gui.ui:979 msgid "Traffic" msgstr "lalu lintas jaringan" #: ../resources/modem-manager-gui.ui:1008 msgid "Use sounds for events" msgstr "" #: ../resources/modem-manager-gui.ui:1023 msgid "Hide window to tray on close" msgstr "" #: ../resources/modem-manager-gui.ui:1038 msgid "Save window geometry and placement" msgstr "" #: ../resources/modem-manager-gui.ui:1059 msgid "Behaviour" msgstr "" #: ../resources/modem-manager-gui.ui:1087 msgid "Progress" msgstr "Sedang proses" #: ../resources/modem-manager-gui.ui:1142 msgid "Executing command" msgstr "Sedang mengeksekusi perintah" #: ../resources/modem-manager-gui.ui:1181 msgid "Question" msgstr "Pertanyaan" #: ../resources/modem-manager-gui.ui:1234 msgid "Traffic limits" msgstr "Batas lalu lintas jaringan" #: ../resources/modem-manager-gui.ui:1296 msgid "Eanble traffic limit" msgstr "Aktifkan batasan lalu lintas jaringan" #: ../resources/modem-manager-gui.ui:1312 msgid "Enable time limit" msgstr "Aktifkan batasan waktu" #: ../resources/modem-manager-gui.ui:1330 #: ../resources/modem-manager-gui.ui:1972 #: ../resources/modem-manager-gui.ui:3271 msgid "Traffic" msgstr "Lalu lintas jaringan" #: ../resources/modem-manager-gui.ui:1376 #: ../resources/modem-manager-gui.ui:1478 msgid "Message" msgstr "Pesan" #: ../resources/modem-manager-gui.ui:1402 #: ../resources/modem-manager-gui.ui:1504 msgid "Action" msgstr "Tindakan" #: ../resources/modem-manager-gui.ui:1433 msgid "Time" msgstr "Waktu" #: ../resources/modem-manager-gui.ui:1548 msgid "Traffic statistics" msgstr "" #: ../resources/modem-manager-gui.ui:1608 msgid "Selected statistics period" msgstr "" #: ../resources/modem-manager-gui.ui:1773 msgid "Add new USSD command CTRL+N" msgstr "" #: ../resources/modem-manager-gui.ui:1775 msgid "Add" msgstr "Tambahkan" #: ../resources/modem-manager-gui.ui:1789 msgid "Remove selected USSD command CTRL+D" msgstr "" #: ../resources/modem-manager-gui.ui:1791 msgid "Delete" msgstr "Hapus" #: ../resources/modem-manager-gui.ui:1815 msgid "" "Force USSD answer encoding change from GSM7 to UCS2 (useful for Huawei " "modems) CTRL+E" msgstr "" #: ../resources/modem-manager-gui.ui:1817 msgid "Change message encoding" msgstr "" #: ../resources/modem-manager-gui.ui:1871 msgid "Modem Manager GUI" msgstr "Modem Manager GUI" #: ../resources/modem-manager-gui.ui:1890 msgid "View and select available devices CTRL+F1" msgstr "" #: ../resources/modem-manager-gui.ui:1892 #: ../resources/modem-manager-gui.ui:2117 msgid "Devices" msgstr "Perangkat" #: ../resources/modem-manager-gui.ui:1906 msgid "Send and receive SMS messages CTRL+F2" msgstr "" #: ../resources/modem-manager-gui.ui:1922 msgid "Send USSD requests CTRL+F3" msgstr "" #: ../resources/modem-manager-gui.ui:1924 #: ../resources/modem-manager-gui.ui:2523 msgid "USSD" msgstr "USSD" #: ../resources/modem-manager-gui.ui:1938 msgid "View active device information CTRL+F4" msgstr "" #: ../resources/modem-manager-gui.ui:1940 #: ../resources/modem-manager-gui.ui:2975 msgid "Info" msgstr "Informasi" #: ../resources/modem-manager-gui.ui:1954 msgid "Scan existing mobile networks CTRL+F5" msgstr "" #: ../resources/modem-manager-gui.ui:1956 #: ../resources/modem-manager-gui.ui:3125 msgid "Scan" msgstr "Pindai" #: ../resources/modem-manager-gui.ui:1970 msgid "Monitor network traffic CTRL+F6" msgstr "" #: ../resources/modem-manager-gui.ui:1986 msgid "View system and modem addressbooks CTRL+F7" msgstr "" #: ../resources/modem-manager-gui.ui:1988 #: ../resources/modem-manager-gui.ui:3455 msgid "Contacts" msgstr "" #: ../resources/modem-manager-gui.ui:2041 msgid "No devices found in system" msgstr "Tak ada perangkat yang ditemukan dalam sistem" #: ../resources/modem-manager-gui.ui:2210 msgid "Send new SMS message CTRL+N" msgstr "" #: ../resources/modem-manager-gui.ui:2212 msgid "New" msgstr "Baru" #: ../resources/modem-manager-gui.ui:2226 msgid "Remove selected message CTRL+D" msgstr "" #: ../resources/modem-manager-gui.ui:2228 msgid "Remove" msgstr "Hapus" #: ../resources/modem-manager-gui.ui:2242 msgid "Answer selected message CTRL+A" msgstr "" #: ../resources/modem-manager-gui.ui:2244 msgid "Answer" msgstr "Jawab" #: ../resources/modem-manager-gui.ui:2340 msgid "Request" msgstr "Meminta" #: ../resources/modem-manager-gui.ui:2378 msgid "Send ussd request CTRL+S" msgstr "" #: ../resources/modem-manager-gui.ui:2398 msgid "Edit USSD commands list CTRL+E" msgstr "" #: ../resources/modem-manager-gui.ui:2600 msgid "IMEI" msgstr "IMEI" #: ../resources/modem-manager-gui.ui:2627 msgid "IMSI/ESN" msgstr "IMSI/ESN" #: ../resources/modem-manager-gui.ui:2658 msgid "Equipment" msgstr "" #: ../resources/modem-manager-gui.ui:2732 msgid "Mode" msgstr "Mode" #: ../resources/modem-manager-gui.ui:2760 msgid "Signal level" msgstr "Tingkat sinyal" #: ../resources/modem-manager-gui.ui:2774 msgid "Operator code" msgstr "" #: ../resources/modem-manager-gui.ui:2801 msgid "Registration" msgstr "" #: ../resources/modem-manager-gui.ui:2846 msgid "Network" msgstr "" #: ../resources/modem-manager-gui.ui:2892 msgid "" "3GPP Location\n" "MCC/MNC/LAC/CID" msgstr "" #: ../resources/modem-manager-gui.ui:2908 msgid "" "GPS location\n" "Longitude/Latiude" msgstr "" #: ../resources/modem-manager-gui.ui:2955 msgid "Location" msgstr "" #: ../resources/modem-manager-gui.ui:3021 msgid "Scan available mobile networks CTRL+S" msgstr "" #: ../resources/modem-manager-gui.ui:3023 msgid "Start scan" msgstr "Mulai memindai" #: ../resources/modem-manager-gui.ui:3145 msgid "Set traffic amount or time limit for disconnect CTRL+L" msgstr "" #: ../resources/modem-manager-gui.ui:3147 msgid "Set limit" msgstr "Ubah batas" #: ../resources/modem-manager-gui.ui:3161 msgid "View list of active network connections CTRL+C" msgstr "" #: ../resources/modem-manager-gui.ui:3163 msgid "Connections" msgstr "Koneksi" #: ../resources/modem-manager-gui.ui:3177 msgid "View daily traffic statistics CTRL+S" msgstr "" #: ../resources/modem-manager-gui.ui:3179 msgid "Statistics" msgstr "" #: ../resources/modem-manager-gui.ui:3230 msgid "Transmission speed" msgstr "Kecepatan transmisi" #: ../resources/modem-manager-gui.ui:3364 msgid "Add new contact to modem addressbook CTRL+N" msgstr "" #: ../resources/modem-manager-gui.ui:3380 msgid "Remove contact from modem addressbook CTRL+D" msgstr "" #: ../resources/modem-manager-gui.ui:3382 msgid "Remove contact" msgstr "" #: ../resources/modem-manager-gui.ui:3406 msgid "Send SMS message to selected contact CTRL+S" msgstr "" #: ../resources/modem-manager-gui.ui:3408 msgid "Send SMS" msgstr "" #: manual addition msgid "Show message" msgstr "Tampilkan Pesan" #: manual addition msgid "Disconnect" msgstr "Putuskan" #: manual addition msgid "Hours" msgstr "Jam" #: manual addition msgid "Minutes" msgstr "Menit" #: manual addition msgid "Mb" msgstr "Mb" #: manual addition msgid "Gb" msgstr "Gb" #: manual addition msgid "Tb" msgstr "Tb" #: manual addition msgid "January" msgstr "" #: manual addition msgid "February" msgstr "" #: manual addition msgid "March" msgstr "" #: manual addition msgid "April" msgstr "" #: manual addition msgid "May" msgstr "" #: manual addition msgid "June" msgstr "" #: manual addition msgid "July" msgstr "" #: manual addition msgid "August" msgstr "" #: manual addition msgid "September" msgstr "" #: manual addition msgid "October" msgstr "" #: manual addition msgid "November" msgstr "" #: manual addition msgid "December" msgstr "" modem-manager-gui-0.0.16/po/modem-manager-gui.pot000066400000000000000000000566761217271411700215550ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2013-07-11 23:22+0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" #: ../src/ayatana.c:129 msgid "Unread SMS" msgstr "" #: ../src/ayatana.c:300 msgid "Unread messages" msgstr "" #: ../src/main.c:667 ../src/main.c:3372 ../src/main.c:4297 msgid "Error sending message" msgstr "" #: ../src/main.c:738 msgid "Operation timed out" msgstr "" #: ../src/main.c:738 msgid "Operation took too long to execute. Please restart it." msgstr "" #: ../src/main.c:1083 msgid "Modem must be enabled to read SMS. Enable modem?" msgstr "" #: ../src/main.c:1084 msgid "Modem must be enabled to read and write SMS. Please enable modem." msgstr "" #: ../src/main.c:1085 msgid "" "Modem must be registered in mobile network to receive and send SMS. Please " "wait..." msgstr "" #: ../src/main.c:1086 msgid "Modem must be unlocked to receive and send SMS. Please enter PIN code." msgstr "" #: ../src/main.c:1087 msgid "Modem manager does not support SMS manipulation functions." msgstr "" #: ../src/main.c:1088 msgid "Modem manager does not support sending of SMS messages." msgstr "" #: ../src/main.c:1106 msgid "Modem must be enabled to send USSD. Enable modem?" msgstr "" #: ../src/main.c:1107 msgid "Modem must be enabled to send USSD. Please enable modem." msgstr "" #: ../src/main.c:1108 msgid "Modem must be registered in mobile network to send USSD. Please wait..." msgstr "" #: ../src/main.c:1109 msgid "Modem must be unlocked to send USSD. Please enter PIN code." msgstr "" #: ../src/main.c:1110 msgid "Modem manager does not support sending of USSD requests." msgstr "" #: ../src/main.c:1138 msgid "Modem must be enabled to scan for available networks. Enable modem?" msgstr "" #: ../src/main.c:1139 msgid "" "Modem must be enabled to scan for available networks. Please enable modem." msgstr "" #: ../src/main.c:1141 msgid "" "Modem must be unlocked to scan for available networks. Please enter PIN code." msgstr "" #: ../src/main.c:1142 msgid "Modem manager does not support scanning for available mobile networks." msgstr "" #: ../src/main.c:1143 msgid "Modem is connected now. Please disconnect to scan." msgstr "" #: ../src/main.c:1175 msgid "Modem must be enabled to export contacts from it. Enable modem?" msgstr "" #: ../src/main.c:1176 msgid "Modem must be enabled to export contacts from it. Please enable modem." msgstr "" #: ../src/main.c:1178 msgid "" "Modem must be unlocked to export contacts from it. Please enter PIN code." msgstr "" #: ../src/main.c:1179 msgid "Modem manager does not support modem contacts manipulation functions." msgstr "" #: ../src/main.c:1180 msgid "Modem manager does not support modem contacts edition functions." msgstr "" #: ../src/main.c:1218 msgid "Enable modem" msgstr "" #: ../src/main.c:1222 ../src/main.c:4731 msgid "Error enabling device" msgstr "" #: ../src/main.c:1438 ../src/main.c:1465 msgid "Modem Manager GUI window hidden" msgstr "" #: ../src/main.c:1438 ../src/main.c:1465 msgid "Use tray icon or messaging menu to show window again" msgstr "" #: ../src/main.c:1757 #, c-format msgid "Unread messages: %u" msgstr "" #: ../src/main.c:1760 ../src/main.c:1763 ../src/main.c:5669 msgid "No unread messages" msgstr "" #: ../src/main.c:2085 msgid "Error adding contact" msgstr "" #: ../src/main.c:2121 msgid "Remove contact" msgstr "" #: ../src/main.c:2121 msgid "Really want to remove contact?" msgstr "" #: ../src/main.c:2125 ../src/main.c:2130 msgid "Error removing contact" msgstr "" #: ../src/main.c:2125 msgid "Contact not removed from device" msgstr "" #: ../src/main.c:2130 msgid "Contact not selected" msgstr "" #: ../src/main.c:2260 ../resources/modem-manager-gui.ui:517 msgid "First name" msgstr "" #: ../src/main.c:2264 ../resources/modem-manager-gui.ui:530 msgid "First number" msgstr "" #: ../src/main.c:2268 ../resources/modem-manager-gui.ui:543 msgid "EMail" msgstr "" #: ../src/main.c:2272 ../resources/modem-manager-gui.ui:556 msgid "Group" msgstr "" #: ../src/main.c:2276 ../resources/modem-manager-gui.ui:570 msgid "Second name" msgstr "" #: ../src/main.c:2280 ../resources/modem-manager-gui.ui:583 msgid "Second number" msgstr "" #: ../src/main.c:2289 msgid "Modem contacts" msgstr "" #: ../src/main.c:2357 ../src/main.c:2410 ../src/main.c:4553 #: ../src/strformat.c:165 ../src/strformat.c:195 ../src/strformat.c:203 #: ../src/strformat.c:211 #, c-format msgid "Unknown" msgstr "" #: ../src/main.c:2521 msgid "Day" msgstr "" #: ../src/main.c:2525 msgid "Received data" msgstr "" #: ../src/main.c:2529 msgid "Transmitted data" msgstr "" #: ../src/main.c:2533 msgid "Session time" msgstr "" #: ../src/main.c:2696 msgid "Application" msgstr "" #: ../src/main.c:2700 msgid "PID" msgstr "" #: ../src/main.c:2704 msgid "Protocol" msgstr "" #: ../src/main.c:2708 msgid "State" msgstr "" #: ../src/main.c:2712 msgid "Buffer" msgstr "" #: ../src/main.c:2716 msgid "Port" msgstr "" #: ../src/main.c:2720 msgid "Destination" msgstr "" #: ../src/main.c:2746 msgid "Traffic limit exceeded" msgstr "" #: ../src/main.c:2750 msgid "Time limit exceeded" msgstr "" #: ../src/main.c:2927 #, c-format msgid "" "Traffic: %s, limit set to: %s\n" "Time: %s, limit set to: %s\n" "Please check entered values and try once more" msgstr "" #: ../src/main.c:2932 msgid "Wrong traffic and time limit values" msgstr "" #: ../src/main.c:2935 #, c-format msgid "" "Traffic: %s, limit set to: %s\n" "Please check entered values and try once more" msgstr "" #: ../src/main.c:2938 msgid "Wrong traffic limit value" msgstr "" #: ../src/main.c:2941 #, c-format msgid "" "Time: %s, limit set to: %s\n" "Please check entered values and try once more" msgstr "" #: ../src/main.c:2944 msgid "Wrong time limit value" msgstr "" #: ../src/main.c:2981 #, c-format msgid "%s disconnected" msgstr "" #: ../src/main.c:3055 ../src/main.c:3079 ../src/main.c:3103 msgid "Disconnected" msgstr "" #: ../src/main.c:3067 ../src/main.c:3073 ../src/main.c:3091 ../src/main.c:3097 msgid "Limit" msgstr "" #: ../src/main.c:3070 ../src/main.c:3076 ../src/main.c:3094 ../src/main.c:3100 msgid "Disabled" msgstr "" #: ../src/main.c:3232 msgid "kbps" msgstr "" #: ../src/main.c:3242 msgid "sec" msgstr "" #: ../src/main.c:3296 msgid "RX speed" msgstr "" #: ../src/main.c:3315 msgid "TX speed" msgstr "" #: ../src/main.c:3330 msgid "Parameter" msgstr "" #: ../src/main.c:3335 msgid "Value" msgstr "" #: ../src/main.c:3341 msgid "Received data" msgstr "" #: ../src/main.c:3344 msgid "Transmitted data" msgstr "" #: ../src/main.c:3347 msgid "Receive speed" msgstr "" #: ../src/main.c:3350 msgid "Transmit speed" msgstr "" #: ../src/main.c:3353 msgid "Session time" msgstr "" #: ../src/main.c:3356 msgid "Traffic left" msgstr "" #: ../src/main.c:3359 msgid "Time left" msgstr "" #: ../src/main.c:3372 msgid "Device error" msgstr "" #: ../src/main.c:3399 #, c-format msgid "" "%s\n" "%s ID: %u Availability: %s Access tech: %s" msgstr "" #: ../src/main.c:3435 msgid "Error scanning networks" msgstr "" #: ../src/main.c:3449 ../resources/modem-manager-gui.ui:2704 msgid "Operator" msgstr "" #: ../src/main.c:3495 ../src/main.c:3502 ../src/main.c:3554 ../src/main.c:3562 msgid "Not supported" msgstr "" #: ../src/main.c:3584 msgid "Sample command" msgstr "" #: ../src/main.c:3790 ../src/main.c:3803 msgid "" "USSD request is not valid\n" "Request must be 160 symbols long\n" "started with '*' and ended with '#'" msgstr "" #: ../src/main.c:3880 ../src/main.c:3883 ../src/main.c:3886 ../src/main.c:3920 msgid "Error sending USSD" msgstr "" #: ../src/main.c:3880 msgid "Wrong USSD request or device not ready" msgstr "" #: ../src/main.c:3883 msgid "USSD session terminated. You can send new request" msgstr "" #: ../src/main.c:3886 msgid "Wrong USSD request" msgstr "" #: ../src/main.c:3909 msgid "" "\n" "USSD session is active. Waiting for your input...\n" msgstr "" #: ../src/main.c:3970 msgid "Command" msgstr "" #: ../src/main.c:3976 msgid "Description" msgstr "" #: ../src/main.c:4045 #, c-format msgid "Received %u new SMS messages" msgstr "" #: ../src/main.c:4047 ../src/main.c:4116 msgid "Received new SMS message" msgstr "" #: ../src/main.c:4051 msgid "Message senders: " msgstr "" #: ../src/main.c:4177 msgid "" "SMS number is not valid\n" "Only numbers from 2 to 20 digits without\n" "letters and symbols can be used" msgstr "" #: ../src/main.c:4179 msgid "" "SMS text is not valid\n" "Please write some text to send" msgstr "" #: ../src/main.c:4297 msgid "Wrong number or device not ready" msgstr "" #: ../src/main.c:4345 msgid "Remove message" msgstr "" #: ../src/main.c:4345 msgid "Really want to remove message?" msgstr "" #: ../src/main.c:4351 ../src/main.c:4356 msgid "Error removing SMS" msgstr "" #: ../src/main.c:4351 msgid "Message not found" msgstr "" #: ../src/main.c:4356 msgid "Message not selected" msgstr "" #: ../src/main.c:4508 msgid "This message can't be read" msgstr "" #: ../src/main.c:4514 msgid "" "This is folder for your incoming SMS messages.\n" "You can answer selected message using 'Answer' button." msgstr "" #: ../src/main.c:4517 msgid "This is folder for your sent SMS messages." msgstr "" #: ../src/main.c:4520 msgid "" "This is folder for your SMS message drafts.\n" "Select message and click 'Answer' button to start editing." msgstr "" #: ../src/main.c:4556 #, c-format msgid "" "%s\n" "%s" msgstr "" #: ../src/main.c:4611 msgid "" "Incoming\n" "Incoming messages" msgstr "" #: ../src/main.c:4612 msgid "" "Sent\n" "Sent messages" msgstr "" #: ../src/main.c:4613 msgid "" "Drafts\n" "Message drafts" msgstr "" #: ../src/main.c:4690 ../resources/modem-manager-gui.ui:1908 #: ../resources/modem-manager-gui.ui:2321 msgid "SMS" msgstr "" #: ../src/main.c:4959 msgid "Error opening device" msgstr "" #: ../src/main.c:5105 #, c-format msgid "" "%s %s\n" "Version:%s Port:%s Type:%s" msgstr "" #: ../src/main.c:5154 msgid "Selected" msgstr "" #: ../src/main.c:5159 ../resources/modem-manager-gui.ui:2572 msgid "Device" msgstr "" #: ../src/main.c:5215 msgid "GNOME contacts" msgstr "" #: ../src/main.c:5222 msgid "KDE contacts" msgstr "" #: ../src/main.c:5277 msgid "Traffic limit exceeded... It's time to take rest \\(^_^)/" msgstr "" #: ../src/main.c:5300 msgid "Time limit exceeded... Go sleep and have nice dreams -_-" msgstr "" #: ../src/main.c:5673 msgid "Show window" msgstr "" #: ../src/main.c:5680 msgid "New SMS" msgstr "" #: ../src/main.c:5741 ../resources/modem-manager-gui.ui:761 msgid "Preferences" msgstr "" #: ../src/main.c:5743 ../resources/modem-manager-gui.ui:7 msgid "About" msgstr "" #: ../src/main.c:5745 msgid "Quit" msgstr "" #: ../src/main.c:5776 ../src/main.c:5813 msgid "Error while initialization" msgstr "" #: ../src/main.c:5776 msgid "No one modem manager is available" msgstr "" #: ../src/main.c:5813 msgid "Interface building error" msgstr "" #: ../src/main.c:5860 #, c-format msgid "Segmentation fault at address: %p\n" msgstr "" #: ../src/main.c:5863 msgid "Stack trace:\n" msgstr "" #: ../src/main.c:5890 msgid "Do not show window on start" msgstr "" #: ../src/main.c:5920 msgid "- tool for EDGE/3G/4G modem specific functions control" msgstr "" #: ../src/main.c:5927 #, c-format msgid "Command line option parsing failed: %s\n" msgstr "" #: ../src/strformat.c:39 #, c-format msgid "%.3f kbps" msgstr "" #: ../src/strformat.c:41 #, c-format msgid "%.3f kbps" msgstr "" #: ../src/strformat.c:46 #, c-format msgid "%.3g Mbps" msgstr "" #: ../src/strformat.c:48 #, c-format msgid "%.3g Mbps" msgstr "" #: ../src/strformat.c:53 #, c-format msgid "%.3g Gbps" msgstr "" #: ../src/strformat.c:55 #, c-format msgid "%.3g Gbps" msgstr "" #: ../src/strformat.c:87 #, c-format msgid "%u sec" msgstr "" #: ../src/strformat.c:89 #, c-format msgid "%u sec" msgstr "" #: ../src/strformat.c:93 #, c-format msgid "%s:%s" msgstr "" #: ../src/strformat.c:95 #, c-format msgid "%s:%s" msgstr "" #: ../src/strformat.c:99 #, c-format msgid "%s:%s:%s" msgstr "" #: ../src/strformat.c:101 #, c-format msgid "%s:%s:%s" msgstr "" #: ../src/strformat.c:105 #, c-format msgid "%lu day(s) %s:%s:%s" msgstr "" #: ../src/strformat.c:107 #, c-format msgid "%lu day(s) %s:%s:%s" msgstr "" #: ../src/strformat.c:124 #, c-format msgid "%u" msgstr "" #: ../src/strformat.c:126 #, c-format msgid "%u" msgstr "" #: ../src/strformat.c:131 #, c-format msgid "%.3g Kb" msgstr "" #: ../src/strformat.c:133 #, c-format msgid "%.3g Kb" msgstr "" #: ../src/strformat.c:138 #, c-format msgid "%.3g Mb" msgstr "" #: ../src/strformat.c:140 #, c-format msgid "%.3g Mb" msgstr "" #: ../src/strformat.c:145 #, c-format msgid "%.3g Gb" msgstr "" #: ../src/strformat.c:147 #, c-format msgid "%.3g Gb" msgstr "" #: ../src/strformat.c:152 #, c-format msgid "%.3g Tb" msgstr "" #: ../src/strformat.c:154 #, c-format msgid "%.3g Tb" msgstr "" #: ../src/strformat.c:205 msgid "Available" msgstr "" #: ../src/strformat.c:207 msgid "Current" msgstr "" #: ../src/strformat.c:209 msgid "Forbidden" msgstr "" #: ../src/strformat.c:241 msgid "Not registered" msgstr "" #: ../src/strformat.c:243 msgid "Home network" msgstr "" #: ../src/strformat.c:245 msgid "Searching" msgstr "" #: ../src/strformat.c:247 msgid "Registration denied" msgstr "" #: ../src/strformat.c:249 ../src/strformat.c:253 msgid "Unknown status" msgstr "" #: ../src/strformat.c:251 msgid "Roaming network" msgstr "" #: ../resources/modem-manager-gui.ui:17 msgid "Copyright 2012-2013 Alex" msgstr "" #: ../resources/modem-manager-gui.ui:18 msgid "Tool for EDGE/3G/4G modem specific functions control" msgstr "" #: ../resources/modem-manager-gui.ui:20 msgid "Homepage" msgstr "" #: ../resources/modem-manager-gui.ui:21 msgid "GPL3" msgstr "" #: ../resources/modem-manager-gui.ui:23 msgid "English: Alex " msgstr "" #: ../resources/modem-manager-gui.ui:55 msgid "Active connections" msgstr "" #: ../resources/modem-manager-gui.ui:111 msgid "Terminate selected application using SIGTERM signal CTRL+T" msgstr "" #: ../resources/modem-manager-gui.ui:113 msgid "Terminate application" msgstr "" #: ../resources/modem-manager-gui.ui:167 msgid "Error" msgstr "" #: ../resources/modem-manager-gui.ui:282 msgid "Ask me again" msgstr "" #: ../resources/modem-manager-gui.ui:302 msgid "Quit or minimize?" msgstr "" #: ../resources/modem-manager-gui.ui:316 msgid "What do you want application to do on window close?" msgstr "" #: ../resources/modem-manager-gui.ui:327 msgid "Just quit" msgstr "" #: ../resources/modem-manager-gui.ui:344 msgid "Minimize to tray or messaging menu" msgstr "" #: ../resources/modem-manager-gui.ui:378 #: ../resources/modem-manager-gui.ui:3366 msgid "New contact" msgstr "" #: ../resources/modem-manager-gui.ui:611 msgid "New SMS message" msgstr "" #: ../resources/modem-manager-gui.ui:657 #: ../resources/modem-manager-gui.ui:2374 msgid "Send" msgstr "" #: ../resources/modem-manager-gui.ui:693 msgid "Number" msgstr "" #: ../resources/modem-manager-gui.ui:838 msgid "Concatenate messages" msgstr "" #: ../resources/modem-manager-gui.ui:853 msgid "Expand folders" msgstr "" #: ../resources/modem-manager-gui.ui:868 msgid "Place old messages on top" msgstr "" #: ../resources/modem-manager-gui.ui:889 msgid "SMS" msgstr "" #: ../resources/modem-manager-gui.ui:947 msgid "RX Speed graph color" msgstr "" #: ../resources/modem-manager-gui.ui:962 msgid "TX Speed graph color" msgstr "" #: ../resources/modem-manager-gui.ui:979 msgid "Traffic" msgstr "" #: ../resources/modem-manager-gui.ui:1008 msgid "Use sounds for events" msgstr "" #: ../resources/modem-manager-gui.ui:1023 msgid "Hide window to tray on close" msgstr "" #: ../resources/modem-manager-gui.ui:1038 msgid "Save window geometry and placement" msgstr "" #: ../resources/modem-manager-gui.ui:1059 msgid "Behaviour" msgstr "" #: ../resources/modem-manager-gui.ui:1087 msgid "Progress" msgstr "" #: ../resources/modem-manager-gui.ui:1142 msgid "Executing command" msgstr "" #: ../resources/modem-manager-gui.ui:1181 msgid "Question" msgstr "" #: ../resources/modem-manager-gui.ui:1234 msgid "Traffic limits" msgstr "" #: ../resources/modem-manager-gui.ui:1296 msgid "Eanble traffic limit" msgstr "" #: ../resources/modem-manager-gui.ui:1312 msgid "Enable time limit" msgstr "" #: ../resources/modem-manager-gui.ui:1330 #: ../resources/modem-manager-gui.ui:1972 #: ../resources/modem-manager-gui.ui:3271 msgid "Traffic" msgstr "" #: ../resources/modem-manager-gui.ui:1376 #: ../resources/modem-manager-gui.ui:1478 msgid "Message" msgstr "" #: ../resources/modem-manager-gui.ui:1402 #: ../resources/modem-manager-gui.ui:1504 msgid "Action" msgstr "" #: ../resources/modem-manager-gui.ui:1433 msgid "Time" msgstr "" #: ../resources/modem-manager-gui.ui:1548 msgid "Traffic statistics" msgstr "" #: ../resources/modem-manager-gui.ui:1608 msgid "Selected statistics period" msgstr "" #: ../resources/modem-manager-gui.ui:1773 msgid "Add new USSD command CTRL+N" msgstr "" #: ../resources/modem-manager-gui.ui:1775 msgid "Add" msgstr "" #: ../resources/modem-manager-gui.ui:1789 msgid "Remove selected USSD command CTRL+D" msgstr "" #: ../resources/modem-manager-gui.ui:1791 msgid "Delete" msgstr "" #: ../resources/modem-manager-gui.ui:1815 msgid "" "Force USSD answer encoding change from GSM7 to UCS2 (useful for Huawei " "modems) CTRL+E" msgstr "" #: ../resources/modem-manager-gui.ui:1817 msgid "Change message encoding" msgstr "" #: ../resources/modem-manager-gui.ui:1871 msgid "Modem Manager GUI" msgstr "" #: ../resources/modem-manager-gui.ui:1890 msgid "View and select available devices CTRL+F1" msgstr "" #: ../resources/modem-manager-gui.ui:1892 #: ../resources/modem-manager-gui.ui:2117 msgid "Devices" msgstr "" #: ../resources/modem-manager-gui.ui:1906 msgid "Send and receive SMS messages CTRL+F2" msgstr "" #: ../resources/modem-manager-gui.ui:1922 msgid "Send USSD requests CTRL+F3" msgstr "" #: ../resources/modem-manager-gui.ui:1924 #: ../resources/modem-manager-gui.ui:2523 msgid "USSD" msgstr "" #: ../resources/modem-manager-gui.ui:1938 msgid "View active device information CTRL+F4" msgstr "" #: ../resources/modem-manager-gui.ui:1940 #: ../resources/modem-manager-gui.ui:2975 msgid "Info" msgstr "" #: ../resources/modem-manager-gui.ui:1954 msgid "Scan existing mobile networks CTRL+F5" msgstr "" #: ../resources/modem-manager-gui.ui:1956 #: ../resources/modem-manager-gui.ui:3125 msgid "Scan" msgstr "" #: ../resources/modem-manager-gui.ui:1970 msgid "Monitor network traffic CTRL+F6" msgstr "" #: ../resources/modem-manager-gui.ui:1986 msgid "View system and modem addressbooks CTRL+F7" msgstr "" #: ../resources/modem-manager-gui.ui:1988 #: ../resources/modem-manager-gui.ui:3455 msgid "Contacts" msgstr "" #: ../resources/modem-manager-gui.ui:2041 msgid "No devices found in system" msgstr "" #: ../resources/modem-manager-gui.ui:2210 msgid "Send new SMS message CTRL+N" msgstr "" #: ../resources/modem-manager-gui.ui:2212 msgid "New" msgstr "" #: ../resources/modem-manager-gui.ui:2226 msgid "Remove selected message CTRL+D" msgstr "" #: ../resources/modem-manager-gui.ui:2228 msgid "Remove" msgstr "" #: ../resources/modem-manager-gui.ui:2242 msgid "Answer selected message CTRL+A" msgstr "" #: ../resources/modem-manager-gui.ui:2244 msgid "Answer" msgstr "" #: ../resources/modem-manager-gui.ui:2340 msgid "Request" msgstr "" #: ../resources/modem-manager-gui.ui:2378 msgid "Send ussd request CTRL+S" msgstr "" #: ../resources/modem-manager-gui.ui:2398 msgid "Edit USSD commands list CTRL+E" msgstr "" #: ../resources/modem-manager-gui.ui:2600 msgid "IMEI" msgstr "" #: ../resources/modem-manager-gui.ui:2627 msgid "IMSI/ESN" msgstr "" #: ../resources/modem-manager-gui.ui:2658 msgid "Equipment" msgstr "" #: ../resources/modem-manager-gui.ui:2732 msgid "Mode" msgstr "" #: ../resources/modem-manager-gui.ui:2760 msgid "Signal level" msgstr "" #: ../resources/modem-manager-gui.ui:2774 msgid "Operator code" msgstr "" #: ../resources/modem-manager-gui.ui:2801 msgid "Registration" msgstr "" #: ../resources/modem-manager-gui.ui:2846 msgid "Network" msgstr "" #: ../resources/modem-manager-gui.ui:2892 msgid "" "3GPP Location\n" "MCC/MNC/LAC/CID" msgstr "" #: ../resources/modem-manager-gui.ui:2908 msgid "" "GPS location\n" "Longitude/Latiude" msgstr "" #: ../resources/modem-manager-gui.ui:2955 msgid "Location" msgstr "" #: ../resources/modem-manager-gui.ui:3021 msgid "Scan available mobile networks CTRL+S" msgstr "" #: ../resources/modem-manager-gui.ui:3023 msgid "Start scan" msgstr "" #: ../resources/modem-manager-gui.ui:3145 msgid "Set traffic amount or time limit for disconnect CTRL+L" msgstr "" #: ../resources/modem-manager-gui.ui:3147 msgid "Set limit" msgstr "" #: ../resources/modem-manager-gui.ui:3161 msgid "View list of active network connections CTRL+C" msgstr "" #: ../resources/modem-manager-gui.ui:3163 msgid "Connections" msgstr "" #: ../resources/modem-manager-gui.ui:3177 msgid "View daily traffic statistics CTRL+S" msgstr "" #: ../resources/modem-manager-gui.ui:3179 msgid "Statistics" msgstr "" #: ../resources/modem-manager-gui.ui:3230 msgid "Transmission speed" msgstr "" #: ../resources/modem-manager-gui.ui:3364 msgid "Add new contact to modem addressbook CTRL+N" msgstr "" #: ../resources/modem-manager-gui.ui:3380 msgid "Remove contact from modem addressbook CTRL+D" msgstr "" #: ../resources/modem-manager-gui.ui:3382 msgid "Remove contact" msgstr "" #: ../resources/modem-manager-gui.ui:3406 msgid "Send SMS message to selected contact CTRL+S" msgstr "" #: ../resources/modem-manager-gui.ui:3408 msgid "Send SMS" msgstr "" #: manual addition msgid "Show message" msgstr "" #: manual addition msgid "Disconnect" msgstr "" #: manual addition msgid "Hours" msgstr "" #: manual addition msgid "Minutes" msgstr "" #: manual addition msgid "Mb" msgstr "" #: manual addition msgid "Gb" msgstr "" #: manual addition msgid "Tb" msgstr "" #: manual addition msgid "January" msgstr "" #: manual addition msgid "February" msgstr "" #: manual addition msgid "March" msgstr "" #: manual addition msgid "April" msgstr "" #: manual addition msgid "May" msgstr "" #: manual addition msgid "June" msgstr "" #: manual addition msgid "July" msgstr "" #: manual addition msgid "August" msgstr "" #: manual addition msgid "September" msgstr "" #: manual addition msgid "October" msgstr "" #: manual addition msgid "November" msgstr "" #: manual addition msgid "December" msgstr "" modem-manager-gui-0.0.16/po/pt_BR.po000066400000000000000000000674441217271411700170770ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # # Translators: # Rafael Ferreira , 2013 msgid "" msgstr "" "Project-Id-Version: Modem Manager GUI\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2013-07-11 23:22+0400\n" "PO-Revision-Date: 2013-07-11 19:33+0000\n" "Last-Translator: ethereal \n" "Language-Team: Portuguese (Brazil) (http://www.transifex.com/projects/p/modem-manager-gui/language/pt_BR/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: pt_BR\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" #: ../src/ayatana.c:129 msgid "Unread SMS" msgstr "" #: ../src/ayatana.c:300 msgid "Unread messages" msgstr "" #: ../src/main.c:667 ../src/main.c:3372 ../src/main.c:4297 msgid "Error sending message" msgstr "Erro ao enviar mensagem" #: ../src/main.c:738 msgid "Operation timed out" msgstr "" #: ../src/main.c:738 msgid "Operation took too long to execute. Please restart it." msgstr "" #: ../src/main.c:1083 msgid "Modem must be enabled to read SMS. Enable modem?" msgstr "Modem deve estar habilitado para ler SMS. Habilitar modem?" #: ../src/main.c:1084 msgid "Modem must be enabled to read and write SMS. Please enable modem." msgstr "" #: ../src/main.c:1085 msgid "" "Modem must be registered in mobile network to receive and send SMS. Please " "wait..." msgstr "" #: ../src/main.c:1086 msgid "Modem must be unlocked to receive and send SMS. Please enter PIN code." msgstr "" #: ../src/main.c:1087 msgid "Modem manager does not support SMS manipulation functions." msgstr "" #: ../src/main.c:1088 msgid "Modem manager does not support sending of SMS messages." msgstr "" #: ../src/main.c:1106 msgid "Modem must be enabled to send USSD. Enable modem?" msgstr "Modem deve estar habilitado para enviar USSD. Habilitar modem?" #: ../src/main.c:1107 msgid "Modem must be enabled to send USSD. Please enable modem." msgstr "" #: ../src/main.c:1108 msgid "" "Modem must be registered in mobile network to send USSD. Please wait..." msgstr "" #: ../src/main.c:1109 msgid "Modem must be unlocked to send USSD. Please enter PIN code." msgstr "" #: ../src/main.c:1110 msgid "Modem manager does not support sending of USSD requests." msgstr "" #: ../src/main.c:1138 msgid "Modem must be enabled to scan for available networks. Enable modem?" msgstr "Modem deve estar habilitado para buscar redes disponíveis. Habilitar modem?" #: ../src/main.c:1139 msgid "" "Modem must be enabled to scan for available networks. Please enable modem." msgstr "" #: ../src/main.c:1141 msgid "" "Modem must be unlocked to scan for available networks. Please enter PIN " "code." msgstr "" #: ../src/main.c:1142 msgid "Modem manager does not support scanning for available mobile networks." msgstr "" #: ../src/main.c:1143 msgid "Modem is connected now. Please disconnect to scan." msgstr "Modem está conectado agora. Por favor, desconecte para buscar." #: ../src/main.c:1175 msgid "Modem must be enabled to export contacts from it. Enable modem?" msgstr "" #: ../src/main.c:1176 msgid "Modem must be enabled to export contacts from it. Please enable modem." msgstr "" #: ../src/main.c:1178 msgid "" "Modem must be unlocked to export contacts from it. Please enter PIN code." msgstr "" #: ../src/main.c:1179 msgid "Modem manager does not support modem contacts manipulation functions." msgstr "" #: ../src/main.c:1180 msgid "Modem manager does not support modem contacts edition functions." msgstr "" #: ../src/main.c:1218 msgid "Enable modem" msgstr "Habilitar modem" #: ../src/main.c:1222 ../src/main.c:4731 msgid "Error enabling device" msgstr "Erro ao habilitar o dispositivo" #: ../src/main.c:1438 ../src/main.c:1465 msgid "Modem Manager GUI window hidden" msgstr "" #: ../src/main.c:1438 ../src/main.c:1465 msgid "Use tray icon or messaging menu to show window again" msgstr "" #: ../src/main.c:1757 #, c-format msgid "Unread messages: %u" msgstr "" #: ../src/main.c:1760 ../src/main.c:1763 ../src/main.c:5669 msgid "No unread messages" msgstr "Nenhuma mensagem não lida" #: ../src/main.c:2085 msgid "Error adding contact" msgstr "" #: ../src/main.c:2121 msgid "Remove contact" msgstr "" #: ../src/main.c:2121 msgid "Really want to remove contact?" msgstr "" #: ../src/main.c:2125 ../src/main.c:2130 msgid "Error removing contact" msgstr "" #: ../src/main.c:2125 msgid "Contact not removed from device" msgstr "" #: ../src/main.c:2130 msgid "Contact not selected" msgstr "" #: ../src/main.c:2260 ../resources/modem-manager-gui.ui:517 msgid "First name" msgstr "" #: ../src/main.c:2264 ../resources/modem-manager-gui.ui:530 msgid "First number" msgstr "" #: ../src/main.c:2268 ../resources/modem-manager-gui.ui:543 msgid "EMail" msgstr "" #: ../src/main.c:2272 ../resources/modem-manager-gui.ui:556 msgid "Group" msgstr "" #: ../src/main.c:2276 ../resources/modem-manager-gui.ui:570 msgid "Second name" msgstr "" #: ../src/main.c:2280 ../resources/modem-manager-gui.ui:583 msgid "Second number" msgstr "" #: ../src/main.c:2289 msgid "Modem contacts" msgstr "" #: ../src/main.c:2357 ../src/main.c:2410 ../src/main.c:4553 #: ../src/strformat.c:165 ../src/strformat.c:195 ../src/strformat.c:203 #: ../src/strformat.c:211 #, c-format msgid "Unknown" msgstr "Desconhecido" #: ../src/main.c:2521 msgid "Day" msgstr "" #: ../src/main.c:2525 msgid "Received data" msgstr "" #: ../src/main.c:2529 msgid "Transmitted data" msgstr "" #: ../src/main.c:2533 msgid "Session time" msgstr "" #: ../src/main.c:2696 msgid "Application" msgstr "Aplicativo" #: ../src/main.c:2700 msgid "PID" msgstr "PID" #: ../src/main.c:2704 msgid "Protocol" msgstr "Protocolo" #: ../src/main.c:2708 msgid "State" msgstr "Estado" #: ../src/main.c:2712 msgid "Buffer" msgstr "Buffer" #: ../src/main.c:2716 msgid "Port" msgstr "Porta" #: ../src/main.c:2720 msgid "Destination" msgstr "Destino" #: ../src/main.c:2746 msgid "Traffic limit exceeded" msgstr "Limite de tráfego excedido" #: ../src/main.c:2750 msgid "Time limit exceeded" msgstr "Limite de tempo excedido" #: ../src/main.c:2927 #, c-format msgid "" "Traffic: %s, limit set to: %s\n" "Time: %s, limit set to: %s\n" "Please check entered values and try once more" msgstr "Tráfego: %s, limite definido para: %s\nTempo: %s, limite definido para: %s\nPor favor, verifique os valores inseridos e tente novamente" #: ../src/main.c:2932 msgid "Wrong traffic and time limit values" msgstr "Valores incorretos de limites de tráfego e tempo " #: ../src/main.c:2935 #, c-format msgid "" "Traffic: %s, limit set to: %s\n" "Please check entered values and try once more" msgstr "Tráfego: %s, limite definido para: %s\nPor favor, verifique os valores inseridos e tente novamente" #: ../src/main.c:2938 msgid "Wrong traffic limit value" msgstr "Valor incorreto de limite de tráfego" #: ../src/main.c:2941 #, c-format msgid "" "Time: %s, limit set to: %s\n" "Please check entered values and try once more" msgstr "Tempo: %s, limite definido para: %s\nPor favor, verifique os valores inseridos e tente novamente" #: ../src/main.c:2944 msgid "Wrong time limit value" msgstr "Valor incorreto de limite de tempo" #: ../src/main.c:2981 #, c-format msgid "%s disconnected" msgstr "%s desconectado" #: ../src/main.c:3055 ../src/main.c:3079 ../src/main.c:3103 msgid "Disconnected" msgstr "Desconectado" #: ../src/main.c:3067 ../src/main.c:3073 ../src/main.c:3091 ../src/main.c:3097 msgid "Limit" msgstr "Limite" #: ../src/main.c:3070 ../src/main.c:3076 ../src/main.c:3094 ../src/main.c:3100 msgid "Disabled" msgstr "Desabilitado" #: ../src/main.c:3232 msgid "kbps" msgstr "kbps" #: ../src/main.c:3242 msgid "sec" msgstr "s" #: ../src/main.c:3296 msgid "RX speed" msgstr "Velocidade de RX" #: ../src/main.c:3315 msgid "TX speed" msgstr "Velocidade de TX" #: ../src/main.c:3330 msgid "Parameter" msgstr "Parâmetro" #: ../src/main.c:3335 msgid "Value" msgstr "Valor" #: ../src/main.c:3341 msgid "Received data" msgstr "Dados recebidos" #: ../src/main.c:3344 msgid "Transmitted data" msgstr "Dados transmitidos" #: ../src/main.c:3347 msgid "Receive speed" msgstr "Velocidade de recebimento" #: ../src/main.c:3350 msgid "Transmit speed" msgstr "Velocidade de transmissão" #: ../src/main.c:3353 msgid "Session time" msgstr "Tempo da sessão" #: ../src/main.c:3356 msgid "Traffic left" msgstr "Tráfego restante" #: ../src/main.c:3359 msgid "Time left" msgstr "Tempo restante" #: ../src/main.c:3372 msgid "Device error" msgstr "Erro no dispositivo" #: ../src/main.c:3399 #, c-format msgid "" "%s\n" "%s ID: %u Availability: %s Access tech: %s" msgstr "%s\n%s ID: %u Disponibilidade: %s Tecn. accesso: %s" #: ../src/main.c:3435 msgid "Error scanning networks" msgstr "Erro ao buscar redes" #: ../src/main.c:3449 ../resources/modem-manager-gui.ui:2704 msgid "Operator" msgstr "Operador" #: ../src/main.c:3495 ../src/main.c:3502 ../src/main.c:3554 ../src/main.c:3562 msgid "Not supported" msgstr "" #: ../src/main.c:3584 msgid "Sample command" msgstr "Comando exemplo" #: ../src/main.c:3790 ../src/main.c:3803 msgid "" "USSD request is not valid\n" "Request must be 160 symbols long\n" "started with '*' and ended with '#'" msgstr "Requisição USSD inválida\nA requisição deve possuir 160 símbolos\niniciada com \"*\" e terminada com \"#\"" #: ../src/main.c:3880 ../src/main.c:3883 ../src/main.c:3886 ../src/main.c:3920 msgid "Error sending USSD" msgstr "Erro ao enviar USSD" #: ../src/main.c:3880 msgid "Wrong USSD request or device not ready" msgstr "Requisição incorreta de USSD ou dispositivo não pronto" #: ../src/main.c:3883 msgid "USSD session terminated. You can send new request" msgstr "Sessão USSD terminada. Você pode enviar nova requisição" #: ../src/main.c:3886 msgid "Wrong USSD request" msgstr "Requisição incorreta de USSD" #: ../src/main.c:3909 msgid "" "\n" "USSD session is active. Waiting for your input...\n" msgstr "\nsessão USSD está ativa. Esperando por sua entrada...\n" #: ../src/main.c:3970 msgid "Command" msgstr "Comando" #: ../src/main.c:3976 msgid "Description" msgstr "Descrição" #: ../src/main.c:4045 #, c-format msgid "Received %u new SMS messages" msgstr "Recebidas %u novas mensagens SMS" #: ../src/main.c:4047 ../src/main.c:4116 msgid "Received new SMS message" msgstr "Recebidas novas mensagens SMS" #: ../src/main.c:4051 msgid "Message senders: " msgstr "Remetente da mensagem:" #: ../src/main.c:4177 msgid "" "SMS number is not valid\n" "Only numbers from 2 to 20 digits without\n" "letters and symbols can be used" msgstr "Número de SMS inválido\nsomente números de 2 a 20 dígitos sem letras e símbolos podem ser usados" #: ../src/main.c:4179 msgid "" "SMS text is not valid\n" "Please write some text to send" msgstr "Texto de SMS inválido\nPor favor, escreva algum texto para enviar" #: ../src/main.c:4297 msgid "Wrong number or device not ready" msgstr "Número incorreto ou dispositivo não pronto" #: ../src/main.c:4345 msgid "Remove message" msgstr "Remover mensagem" #: ../src/main.c:4345 msgid "Really want to remove message?" msgstr "Realmente deseja remover a mensagem?" #: ../src/main.c:4351 ../src/main.c:4356 msgid "Error removing SMS" msgstr "Erro ao remover SMS" #: ../src/main.c:4351 msgid "Message not found" msgstr "Mensagem não encontrada" #: ../src/main.c:4356 msgid "Message not selected" msgstr "Mensagem não selecionada" #: ../src/main.c:4508 msgid "This message can't be read" msgstr "Essa mensagem não pode ser lida" #: ../src/main.c:4514 msgid "" "This is folder for your incoming SMS messages.\n" "You can answer selected message using 'Answer' button." msgstr "Essa é a pasta para suas mensagens SMS recebidas.\nVocê pode responder uma mensagem selecionada usando o botão \"Responder\"." #: ../src/main.c:4517 msgid "This is folder for your sent SMS messages." msgstr "Essa é a pasta para suas mensagens SMS enviadas." #: ../src/main.c:4520 msgid "" "This is folder for your SMS message drafts.\n" "Select message and click 'Answer' button to start editing." msgstr "Essa é a pasta para seus rascunhos de mensagens SMS.\nSelecione uma mensagem e clique no botão \"Responder\" para começar a editar." #: ../src/main.c:4556 #, c-format msgid "" "%s\n" "%s" msgstr "%s\n%s" #: ../src/main.c:4611 msgid "" "Incoming\n" "Incoming messages" msgstr "Recebidas\nMensagens recebidas" #: ../src/main.c:4612 msgid "" "Sent\n" "Sent messages" msgstr "Enviadas\nMensagens enviadas" #: ../src/main.c:4613 msgid "" "Drafts\n" "Message drafts" msgstr "Rascunhos\nRascunhos de mensagens" #: ../src/main.c:4690 ../resources/modem-manager-gui.ui:1908 #: ../resources/modem-manager-gui.ui:2321 msgid "SMS" msgstr "SMS" #: ../src/main.c:4959 msgid "Error opening device" msgstr "Erro ao abrir dispositivo" #: ../src/main.c:5105 #, c-format msgid "" "%s %s\n" "Version:%s Port:%s Type:%s" msgstr "%s %s\nVersão:%s Porta:%s Tipo:%s" #: ../src/main.c:5154 msgid "Selected" msgstr "Selecionada" #: ../src/main.c:5159 ../resources/modem-manager-gui.ui:2572 msgid "Device" msgstr "Dispositivo" #: ../src/main.c:5215 msgid "GNOME contacts" msgstr "" #: ../src/main.c:5222 msgid "KDE contacts" msgstr "" #: ../src/main.c:5277 msgid "Traffic limit exceeded... It's time to take rest \\(^_^)/" msgstr "Limite de tráfego excedido... É hora de descansar \\(^_^)/" #: ../src/main.c:5300 msgid "Time limit exceeded... Go sleep and have nice dreams -_-" msgstr "Limite de tempo excedido... Vá dormir e tenha bons sonhos -_-" #: ../src/main.c:5673 msgid "Show window" msgstr "Mostrar janela" #: ../src/main.c:5680 msgid "New SMS" msgstr "Novo SMS" #: ../src/main.c:5741 ../resources/modem-manager-gui.ui:761 msgid "Preferences" msgstr "Preferências" #: ../src/main.c:5743 ../resources/modem-manager-gui.ui:7 msgid "About" msgstr "Sobre" #: ../src/main.c:5745 msgid "Quit" msgstr "" #: ../src/main.c:5776 ../src/main.c:5813 msgid "Error while initialization" msgstr "" #: ../src/main.c:5776 msgid "No one modem manager is available" msgstr "" #: ../src/main.c:5813 msgid "Interface building error" msgstr "" #: ../src/main.c:5860 #, c-format msgid "Segmentation fault at address: %p\n" msgstr "" #: ../src/main.c:5863 msgid "Stack trace:\n" msgstr "" #: ../src/main.c:5890 msgid "Do not show window on start" msgstr "" #: ../src/main.c:5920 msgid "- tool for EDGE/3G/4G modem specific functions control" msgstr "" #: ../src/main.c:5927 #, c-format msgid "Command line option parsing failed: %s\n" msgstr "" #: ../src/strformat.c:39 #, c-format msgid "%.3f kbps" msgstr "%.3f kbps" #: ../src/strformat.c:41 #, c-format msgid "%.3f kbps" msgstr "%.3f kbps" #: ../src/strformat.c:46 #, c-format msgid "%.3g Mbps" msgstr "%.3g Mbps" #: ../src/strformat.c:48 #, c-format msgid "%.3g Mbps" msgstr "%.3g Mbps" #: ../src/strformat.c:53 #, c-format msgid "%.3g Gbps" msgstr "%.3g Gbps" #: ../src/strformat.c:55 #, c-format msgid "%.3g Gbps" msgstr "%.3g Gbps" #: ../src/strformat.c:87 #, c-format msgid "%u sec" msgstr "%u s" #: ../src/strformat.c:89 #, c-format msgid "%u sec" msgstr "%u s" #: ../src/strformat.c:93 #, c-format msgid "%s:%s" msgstr "%s:%s" #: ../src/strformat.c:95 #, c-format msgid "%s:%s" msgstr "%s:%s" #: ../src/strformat.c:99 #, c-format msgid "%s:%s:%s" msgstr "%s:%s:%s" #: ../src/strformat.c:101 #, c-format msgid "%s:%s:%s" msgstr "%s:%s:%s" #: ../src/strformat.c:105 #, c-format msgid "%lu day(s) %s:%s:%s" msgstr "" #: ../src/strformat.c:107 #, c-format msgid "%lu day(s) %s:%s:%s" msgstr "" #: ../src/strformat.c:124 #, c-format msgid "%u" msgstr "%u" #: ../src/strformat.c:126 #, c-format msgid "%u" msgstr "%u" #: ../src/strformat.c:131 #, c-format msgid "%.3g Kb" msgstr "%.3g kB" #: ../src/strformat.c:133 #, c-format msgid "%.3g Kb" msgstr "%.3g kB" #: ../src/strformat.c:138 #, c-format msgid "%.3g Mb" msgstr "%.3g MB" #: ../src/strformat.c:140 #, c-format msgid "%.3g Mb" msgstr "%.3g MB" #: ../src/strformat.c:145 #, c-format msgid "%.3g Gb" msgstr "%.3g GB" #: ../src/strformat.c:147 #, c-format msgid "%.3g Gb" msgstr "%.3g GB" #: ../src/strformat.c:152 #, c-format msgid "%.3g Tb" msgstr "%.3g TB" #: ../src/strformat.c:154 #, c-format msgid "%.3g Tb" msgstr "%.3g TB" #: ../src/strformat.c:205 msgid "Available" msgstr "" #: ../src/strformat.c:207 msgid "Current" msgstr "" #: ../src/strformat.c:209 msgid "Forbidden" msgstr "" #: ../src/strformat.c:241 msgid "Not registered" msgstr "" #: ../src/strformat.c:243 msgid "Home network" msgstr "" #: ../src/strformat.c:245 msgid "Searching" msgstr "" #: ../src/strformat.c:247 msgid "Registration denied" msgstr "" #: ../src/strformat.c:249 ../src/strformat.c:253 msgid "Unknown status" msgstr "" #: ../src/strformat.c:251 msgid "Roaming network" msgstr "" #: ../resources/modem-manager-gui.ui:17 msgid "Copyright 2012-2013 Alex" msgstr "" #: ../resources/modem-manager-gui.ui:18 msgid "Tool for EDGE/3G/4G modem specific functions control" msgstr "Ferramenta para controle de funções específicas de modem EDGE/3G/4G" #: ../resources/modem-manager-gui.ui:20 msgid "Homepage" msgstr "Página web" #: ../resources/modem-manager-gui.ui:21 msgid "GPL3" msgstr "GPL3" #: ../resources/modem-manager-gui.ui:23 msgid "English: Alex " msgstr "Português (Brasil): Rafael Ferreira " #: ../resources/modem-manager-gui.ui:55 msgid "Active connections" msgstr "Conexões ativas" #: ../resources/modem-manager-gui.ui:111 msgid "Terminate selected application using SIGTERM signal CTRL+T" msgstr "" #: ../resources/modem-manager-gui.ui:113 msgid "Terminate application" msgstr "Terminar aplicativo" #: ../resources/modem-manager-gui.ui:167 msgid "Error" msgstr "Erro" #: ../resources/modem-manager-gui.ui:282 msgid "Ask me again" msgstr "" #: ../resources/modem-manager-gui.ui:302 msgid "Quit or minimize?" msgstr "" #: ../resources/modem-manager-gui.ui:316 msgid "What do you want application to do on window close?" msgstr "" #: ../resources/modem-manager-gui.ui:327 msgid "Just quit" msgstr "" #: ../resources/modem-manager-gui.ui:344 msgid "Minimize to tray or messaging menu" msgstr "" #: ../resources/modem-manager-gui.ui:378 #: ../resources/modem-manager-gui.ui:3366 msgid "New contact" msgstr "" #: ../resources/modem-manager-gui.ui:611 msgid "New SMS message" msgstr "Nova mensagem SMS" #: ../resources/modem-manager-gui.ui:657 #: ../resources/modem-manager-gui.ui:2374 msgid "Send" msgstr "Enviar" #: ../resources/modem-manager-gui.ui:693 msgid "Number" msgstr "Número" #: ../resources/modem-manager-gui.ui:838 msgid "Concatenate messages" msgstr "Concatenar mensagens" #: ../resources/modem-manager-gui.ui:853 msgid "Expand folders" msgstr "Expandir pastas" #: ../resources/modem-manager-gui.ui:868 msgid "Place old messages on top" msgstr "" #: ../resources/modem-manager-gui.ui:889 msgid "SMS" msgstr "SMS" #: ../resources/modem-manager-gui.ui:947 msgid "RX Speed graph color" msgstr "Cor do gráfico da velocidade de RX" #: ../resources/modem-manager-gui.ui:962 msgid "TX Speed graph color" msgstr "Cor do gráfico da velocidade de TX" #: ../resources/modem-manager-gui.ui:979 msgid "Traffic" msgstr "Tráfego" #: ../resources/modem-manager-gui.ui:1008 msgid "Use sounds for events" msgstr "" #: ../resources/modem-manager-gui.ui:1023 msgid "Hide window to tray on close" msgstr "" #: ../resources/modem-manager-gui.ui:1038 msgid "Save window geometry and placement" msgstr "" #: ../resources/modem-manager-gui.ui:1059 msgid "Behaviour" msgstr "" #: ../resources/modem-manager-gui.ui:1087 msgid "Progress" msgstr "Progresso" #: ../resources/modem-manager-gui.ui:1142 msgid "Executing command" msgstr "Execução de comando" #: ../resources/modem-manager-gui.ui:1181 msgid "Question" msgstr "Questão" #: ../resources/modem-manager-gui.ui:1234 msgid "Traffic limits" msgstr "Limites de tráfego" #: ../resources/modem-manager-gui.ui:1296 msgid "Eanble traffic limit" msgstr "Habilitar limite de tráfego" #: ../resources/modem-manager-gui.ui:1312 msgid "Enable time limit" msgstr "Habilitar limite de tempo" #: ../resources/modem-manager-gui.ui:1330 #: ../resources/modem-manager-gui.ui:1972 #: ../resources/modem-manager-gui.ui:3271 msgid "Traffic" msgstr "Tráfego" #: ../resources/modem-manager-gui.ui:1376 #: ../resources/modem-manager-gui.ui:1478 msgid "Message" msgstr "Mensagem" #: ../resources/modem-manager-gui.ui:1402 #: ../resources/modem-manager-gui.ui:1504 msgid "Action" msgstr "Ação" #: ../resources/modem-manager-gui.ui:1433 msgid "Time" msgstr "Tempo" #: ../resources/modem-manager-gui.ui:1548 msgid "Traffic statistics" msgstr "" #: ../resources/modem-manager-gui.ui:1608 msgid "Selected statistics period" msgstr "" #: ../resources/modem-manager-gui.ui:1773 msgid "Add new USSD command CTRL+N" msgstr "" #: ../resources/modem-manager-gui.ui:1775 msgid "Add" msgstr "Adicionar" #: ../resources/modem-manager-gui.ui:1789 msgid "Remove selected USSD command CTRL+D" msgstr "" #: ../resources/modem-manager-gui.ui:1791 msgid "Delete" msgstr "Excluir" #: ../resources/modem-manager-gui.ui:1815 msgid "" "Force USSD answer encoding change from GSM7 to UCS2 (useful for Huawei " "modems) CTRL+E" msgstr "" #: ../resources/modem-manager-gui.ui:1817 msgid "Change message encoding" msgstr "" #: ../resources/modem-manager-gui.ui:1871 msgid "Modem Manager GUI" msgstr "Modem Manager GUI" #: ../resources/modem-manager-gui.ui:1890 msgid "View and select available devices CTRL+F1" msgstr "" #: ../resources/modem-manager-gui.ui:1892 #: ../resources/modem-manager-gui.ui:2117 msgid "Devices" msgstr "Dispositivos" #: ../resources/modem-manager-gui.ui:1906 msgid "Send and receive SMS messages CTRL+F2" msgstr "" #: ../resources/modem-manager-gui.ui:1922 msgid "Send USSD requests CTRL+F3" msgstr "" #: ../resources/modem-manager-gui.ui:1924 #: ../resources/modem-manager-gui.ui:2523 msgid "USSD" msgstr "USSD" #: ../resources/modem-manager-gui.ui:1938 msgid "View active device information CTRL+F4" msgstr "" #: ../resources/modem-manager-gui.ui:1940 #: ../resources/modem-manager-gui.ui:2975 msgid "Info" msgstr "Info" #: ../resources/modem-manager-gui.ui:1954 msgid "Scan existing mobile networks CTRL+F5" msgstr "" #: ../resources/modem-manager-gui.ui:1956 #: ../resources/modem-manager-gui.ui:3125 msgid "Scan" msgstr "Buscar" #: ../resources/modem-manager-gui.ui:1970 msgid "Monitor network traffic CTRL+F6" msgstr "" #: ../resources/modem-manager-gui.ui:1986 msgid "View system and modem addressbooks CTRL+F7" msgstr "" #: ../resources/modem-manager-gui.ui:1988 #: ../resources/modem-manager-gui.ui:3455 msgid "Contacts" msgstr "" #: ../resources/modem-manager-gui.ui:2041 msgid "No devices found in system" msgstr "Nenhum dispositivo encontrado no sistema" #: ../resources/modem-manager-gui.ui:2210 msgid "Send new SMS message CTRL+N" msgstr "" #: ../resources/modem-manager-gui.ui:2212 msgid "New" msgstr "Nova" #: ../resources/modem-manager-gui.ui:2226 msgid "Remove selected message CTRL+D" msgstr "" #: ../resources/modem-manager-gui.ui:2228 msgid "Remove" msgstr "Remover" #: ../resources/modem-manager-gui.ui:2242 msgid "Answer selected message CTRL+A" msgstr "" #: ../resources/modem-manager-gui.ui:2244 msgid "Answer" msgstr "Responder" #: ../resources/modem-manager-gui.ui:2340 msgid "Request" msgstr "Requisitar" #: ../resources/modem-manager-gui.ui:2378 msgid "Send ussd request CTRL+S" msgstr "" #: ../resources/modem-manager-gui.ui:2398 msgid "Edit USSD commands list CTRL+E" msgstr "" #: ../resources/modem-manager-gui.ui:2600 msgid "IMEI" msgstr "IMEI" #: ../resources/modem-manager-gui.ui:2627 msgid "IMSI/ESN" msgstr "IMSI/ESN" #: ../resources/modem-manager-gui.ui:2658 msgid "Equipment" msgstr "" #: ../resources/modem-manager-gui.ui:2732 msgid "Mode" msgstr "Modo" #: ../resources/modem-manager-gui.ui:2760 msgid "Signal level" msgstr "Nível de sinal" #: ../resources/modem-manager-gui.ui:2774 msgid "Operator code" msgstr "" #: ../resources/modem-manager-gui.ui:2801 msgid "Registration" msgstr "" #: ../resources/modem-manager-gui.ui:2846 msgid "Network" msgstr "" #: ../resources/modem-manager-gui.ui:2892 msgid "" "3GPP Location\n" "MCC/MNC/LAC/CID" msgstr "" #: ../resources/modem-manager-gui.ui:2908 msgid "" "GPS location\n" "Longitude/Latiude" msgstr "" #: ../resources/modem-manager-gui.ui:2955 msgid "Location" msgstr "" #: ../resources/modem-manager-gui.ui:3021 msgid "Scan available mobile networks CTRL+S" msgstr "" #: ../resources/modem-manager-gui.ui:3023 msgid "Start scan" msgstr "Começar busca" #: ../resources/modem-manager-gui.ui:3145 msgid "Set traffic amount or time limit for disconnect CTRL+L" msgstr "" #: ../resources/modem-manager-gui.ui:3147 msgid "Set limit" msgstr "Definir limite" #: ../resources/modem-manager-gui.ui:3161 msgid "View list of active network connections CTRL+C" msgstr "" #: ../resources/modem-manager-gui.ui:3163 msgid "Connections" msgstr "Conexões" #: ../resources/modem-manager-gui.ui:3177 msgid "View daily traffic statistics CTRL+S" msgstr "" #: ../resources/modem-manager-gui.ui:3179 msgid "Statistics" msgstr "" #: ../resources/modem-manager-gui.ui:3230 msgid "Transmission speed" msgstr "Velocidade de transmissão" #: ../resources/modem-manager-gui.ui:3364 msgid "Add new contact to modem addressbook CTRL+N" msgstr "" #: ../resources/modem-manager-gui.ui:3380 msgid "Remove contact from modem addressbook CTRL+D" msgstr "" #: ../resources/modem-manager-gui.ui:3382 msgid "Remove contact" msgstr "" #: ../resources/modem-manager-gui.ui:3406 msgid "Send SMS message to selected contact CTRL+S" msgstr "" #: ../resources/modem-manager-gui.ui:3408 msgid "Send SMS" msgstr "" #: manual addition msgid "Show message" msgstr "Exibir mensagem" #: manual addition msgid "Disconnect" msgstr "Desconectar" #: manual addition msgid "Hours" msgstr "Horas" #: manual addition msgid "Minutes" msgstr "Minutos" #: manual addition msgid "Mb" msgstr "MB" #: manual addition msgid "Gb" msgstr "GB" #: manual addition msgid "Tb" msgstr "TB" #: manual addition msgid "January" msgstr "" #: manual addition msgid "February" msgstr "" #: manual addition msgid "March" msgstr "" #: manual addition msgid "April" msgstr "" #: manual addition msgid "May" msgstr "" #: manual addition msgid "June" msgstr "" #: manual addition msgid "July" msgstr "" #: manual addition msgid "August" msgstr "" #: manual addition msgid "September" msgstr "" #: manual addition msgid "October" msgstr "" #: manual addition msgid "November" msgstr "" #: manual addition msgid "December" msgstr "" modem-manager-gui-0.0.16/po/ru.po000066400000000000000000001151341217271411700165050ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # # Translators: # ethereal , 2012-2013 msgid "" msgstr "" "Project-Id-Version: Modem Manager GUI\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2013-07-11 23:22+0400\n" "PO-Revision-Date: 2013-07-11 20:19+0000\n" "Last-Translator: ethereal \n" "Language-Team: Russian (http://www.transifex.com/projects/p/modem-manager-gui/language/ru/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: ru\n" "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" #: ../src/ayatana.c:129 msgid "Unread SMS" msgstr "Непрочитанные SMS" #: ../src/ayatana.c:300 msgid "Unread messages" msgstr "Непрочитанные сообщения" #: ../src/main.c:667 ../src/main.c:3372 ../src/main.c:4297 msgid "Error sending message" msgstr "Ошибка отправки сообщения" #: ../src/main.c:738 msgid "Operation timed out" msgstr "Отведенноее для выполнения операции время истекло" #: ../src/main.c:738 msgid "Operation took too long to execute. Please restart it." msgstr "Процесс выполнения операции слишком затянулся. Пожалуйста, начните выполнение операции снова." #: ../src/main.c:1083 msgid "Modem must be enabled to read SMS. Enable modem?" msgstr "Модем должен быть активирован для чтения новых SMS. Активировать модем?" #: ../src/main.c:1084 msgid "Modem must be enabled to read and write SMS. Please enable modem." msgstr "Модем должен быть активирован для чтения и отправки новых SMS. Пожалуйста, активируйте модем." #: ../src/main.c:1085 msgid "" "Modem must be registered in mobile network to receive and send SMS. Please " "wait..." msgstr "Модем должен быть зарегистрирован в домашней сети для приема и отправки SMS. Пожалуйста, подождите..." #: ../src/main.c:1086 msgid "Modem must be unlocked to receive and send SMS. Please enter PIN code." msgstr "Модем должен быть разблокирован для приема и отправки SMS. Пожалуйста, введите PIN-код." #: ../src/main.c:1087 msgid "Modem manager does not support SMS manipulation functions." msgstr "Система управления модемом не поддерживает функции для работы с сообщениями SMS." #: ../src/main.c:1088 msgid "Modem manager does not support sending of SMS messages." msgstr "Система управления модемом не поддерживает функции для отправки сообщений SMS." #: ../src/main.c:1106 msgid "Modem must be enabled to send USSD. Enable modem?" msgstr "Модем должен быть активирован для отправки запросов USSD. Активировать модем?" #: ../src/main.c:1107 msgid "Modem must be enabled to send USSD. Please enable modem." msgstr "Модем должен быть активирован для отправки запросов USSD. Пожалуйста, активируйте модем." #: ../src/main.c:1108 msgid "" "Modem must be registered in mobile network to send USSD. Please wait..." msgstr "Модем должен быть зарегистрирован в домашней сети для отправки запросов USSD. Пожалуйста, подождите..." #: ../src/main.c:1109 msgid "Modem must be unlocked to send USSD. Please enter PIN code." msgstr "Модем должен быть разблокирован для отправки запросов USSD. Пожалуйста, введите PIN-код." #: ../src/main.c:1110 msgid "Modem manager does not support sending of USSD requests." msgstr "Система управления модемом не поддерживает функции для отправки запрсов USSD." #: ../src/main.c:1138 msgid "Modem must be enabled to scan for available networks. Enable modem?" msgstr "Модем должен быть активирован для сканирования доступных сетей. Активировать модем?" #: ../src/main.c:1139 msgid "" "Modem must be enabled to scan for available networks. Please enable modem." msgstr "Модем должен быть активирован для сканирования доступных сетей. Пожалуйста, активируйте модем." #: ../src/main.c:1141 msgid "" "Modem must be unlocked to scan for available networks. Please enter PIN " "code." msgstr "Модем должен быть разблокирован для сканирования доступных сетей. Пожалуйста, введите PIN-код." #: ../src/main.c:1142 msgid "Modem manager does not support scanning for available mobile networks." msgstr "Система управления модемом не поддерживает функции для сканирования доступных мобильных сетей." #: ../src/main.c:1143 msgid "Modem is connected now. Please disconnect to scan." msgstr "Модем в данный момент подключен. Разорвите сетевое соединение для начала сканирования." #: ../src/main.c:1175 msgid "Modem must be enabled to export contacts from it. Enable modem?" msgstr "Модем должен быть активирован для работы с его списком контактов. Активировать модем?" #: ../src/main.c:1176 msgid "Modem must be enabled to export contacts from it. Please enable modem." msgstr "Модем должен быть активирован для работы с его списком контактов. Пожалуйста, активируйте модем." #: ../src/main.c:1178 msgid "" "Modem must be unlocked to export contacts from it. Please enter PIN code." msgstr "Модем должен быть разблокирован для работы с его списком контактов. Пожалуйста, введите PIN-код." #: ../src/main.c:1179 msgid "Modem manager does not support modem contacts manipulation functions." msgstr "Система управления модемом не поддерживает функции для работы со списком контактов модема." #: ../src/main.c:1180 msgid "Modem manager does not support modem contacts edition functions." msgstr "Система управления модемом не поддерживает функции для редактирования списка контактов модема." #: ../src/main.c:1218 msgid "Enable modem" msgstr "Активировать модем" #: ../src/main.c:1222 ../src/main.c:4731 msgid "Error enabling device" msgstr "Ошибка активации модема" #: ../src/main.c:1438 ../src/main.c:1465 msgid "Modem Manager GUI window hidden" msgstr "Окно Modem Manager GUI скрыто" #: ../src/main.c:1438 ../src/main.c:1465 msgid "Use tray icon or messaging menu to show window again" msgstr "Используйте иконку в трее или пункт меню сообщений для восстановления состояния окна" #: ../src/main.c:1757 #, c-format msgid "Unread messages: %u" msgstr "Непрочитанные сообщения: %u" #: ../src/main.c:1760 ../src/main.c:1763 ../src/main.c:5669 msgid "No unread messages" msgstr "Нет новых сообщений" #: ../src/main.c:2085 msgid "Error adding contact" msgstr "Ошибка добавления контакта" #: ../src/main.c:2121 msgid "Remove contact" msgstr "Удаление контакта" #: ../src/main.c:2121 msgid "Really want to remove contact?" msgstr "Действительно хотите удалить контакт?" #: ../src/main.c:2125 ../src/main.c:2130 msgid "Error removing contact" msgstr "Ошибка удаления контакта" #: ../src/main.c:2125 msgid "Contact not removed from device" msgstr "Контакт не удален из адресной книги устройства" #: ../src/main.c:2130 msgid "Contact not selected" msgstr "Контакт не выбран" #: ../src/main.c:2260 ../resources/modem-manager-gui.ui:517 msgid "First name" msgstr "Основное имя" #: ../src/main.c:2264 ../resources/modem-manager-gui.ui:530 msgid "First number" msgstr "Основной номер" #: ../src/main.c:2268 ../resources/modem-manager-gui.ui:543 msgid "EMail" msgstr "EMail" #: ../src/main.c:2272 ../resources/modem-manager-gui.ui:556 msgid "Group" msgstr "Группа" #: ../src/main.c:2276 ../resources/modem-manager-gui.ui:570 msgid "Second name" msgstr "Дополнительное имя" #: ../src/main.c:2280 ../resources/modem-manager-gui.ui:583 msgid "Second number" msgstr "Дополнительный номер" #: ../src/main.c:2289 msgid "Modem contacts" msgstr "Контакты из адресной книги модема" #: ../src/main.c:2357 ../src/main.c:2410 ../src/main.c:4553 #: ../src/strformat.c:165 ../src/strformat.c:195 ../src/strformat.c:203 #: ../src/strformat.c:211 #, c-format msgid "Unknown" msgstr "Неизвестно" #: ../src/main.c:2521 msgid "Day" msgstr "День" #: ../src/main.c:2525 msgid "Received data" msgstr "Принятые данные" #: ../src/main.c:2529 msgid "Transmitted data" msgstr "Отправленные данные" #: ../src/main.c:2533 msgid "Session time" msgstr "Время сессии" #: ../src/main.c:2696 msgid "Application" msgstr "Приложение" #: ../src/main.c:2700 msgid "PID" msgstr "PID" #: ../src/main.c:2704 msgid "Protocol" msgstr "Протокол" #: ../src/main.c:2708 msgid "State" msgstr "Состояние" #: ../src/main.c:2712 msgid "Buffer" msgstr "Буфер" #: ../src/main.c:2716 msgid "Port" msgstr "Порт" #: ../src/main.c:2720 msgid "Destination" msgstr "Целевой адрес" #: ../src/main.c:2746 msgid "Traffic limit exceeded" msgstr "Доступный трафик исчерпан" #: ../src/main.c:2750 msgid "Time limit exceeded" msgstr "Доступное время исчерпано" #: ../src/main.c:2927 #, c-format msgid "" "Traffic: %s, limit set to: %s\n" "Time: %s, limit set to: %s\n" "Please check entered values and try once more" msgstr "Трафик: %s, установленное ограничение: %s\nВремя сессии: %s, установленное ограничение: %s\nПроверьте введенные данные и попробуйте еще раз" #: ../src/main.c:2932 msgid "Wrong traffic and time limit values" msgstr "Некорректные ограничения трафика и времени" #: ../src/main.c:2935 #, c-format msgid "" "Traffic: %s, limit set to: %s\n" "Please check entered values and try once more" msgstr "Трафик: %s, установленное ограничение: %s\nПроверьте введенные данные и попробуйте еще раз" #: ../src/main.c:2938 msgid "Wrong traffic limit value" msgstr "Некорректное ограничение трафика" #: ../src/main.c:2941 #, c-format msgid "" "Time: %s, limit set to: %s\n" "Please check entered values and try once more" msgstr "Время сессии: %s, установленное ограничение: %s\nПроверьте введенные данные и попробуйте еще раз" #: ../src/main.c:2944 msgid "Wrong time limit value" msgstr "Некорректное ограничение времени сессии" #: ../src/main.c:2981 #, c-format msgid "%s disconnected" msgstr "%s не подключен" #: ../src/main.c:3055 ../src/main.c:3079 ../src/main.c:3103 msgid "Disconnected" msgstr "Не подключен" #: ../src/main.c:3067 ../src/main.c:3073 ../src/main.c:3091 ../src/main.c:3097 msgid "Limit" msgstr "Предел" #: ../src/main.c:3070 ../src/main.c:3076 ../src/main.c:3094 ../src/main.c:3100 msgid "Disabled" msgstr "Отключено" #: ../src/main.c:3232 msgid "kbps" msgstr "КБит/с" #: ../src/main.c:3242 msgid "sec" msgstr "сек" #: ../src/main.c:3296 msgid "RX speed" msgstr "Прием" #: ../src/main.c:3315 msgid "TX speed" msgstr "Передача" #: ../src/main.c:3330 msgid "Parameter" msgstr "Параметр" #: ../src/main.c:3335 msgid "Value" msgstr "Значение" #: ../src/main.c:3341 msgid "Received data" msgstr "Принятые данные" #: ../src/main.c:3344 msgid "Transmitted data" msgstr "Переданные данные" #: ../src/main.c:3347 msgid "Receive speed" msgstr "Скорость приема" #: ../src/main.c:3350 msgid "Transmit speed" msgstr "Скорость передачи" #: ../src/main.c:3353 msgid "Session time" msgstr "Время сессии" #: ../src/main.c:3356 msgid "Traffic left" msgstr "Остаток трафика" #: ../src/main.c:3359 msgid "Time left" msgstr "Остаток времени" #: ../src/main.c:3372 msgid "Device error" msgstr "Ошибка устройства" #: ../src/main.c:3399 #, c-format msgid "" "%s\n" "%s ID: %u Availability: %s Access tech: %s" msgstr "%s\n%s ID: %u Доступность: %s Стандарт: %s" #: ../src/main.c:3435 msgid "Error scanning networks" msgstr "Ошибка сканирования сетей" #: ../src/main.c:3449 ../resources/modem-manager-gui.ui:2704 msgid "Operator" msgstr "Оператор" #: ../src/main.c:3495 ../src/main.c:3502 ../src/main.c:3554 ../src/main.c:3562 msgid "Not supported" msgstr "Не поддерживается" #: ../src/main.c:3584 msgid "Sample command" msgstr "Стандартная команда" #: ../src/main.c:3790 ../src/main.c:3803 msgid "" "USSD request is not valid\n" "Request must be 160 symbols long\n" "started with '*' and ended with '#'" msgstr "Запрос USSD некорректен\nЗапрос не должен превышать 160 символов,\nдолжен начинаться с '*' и заканчиваться '#'" #: ../src/main.c:3880 ../src/main.c:3883 ../src/main.c:3886 ../src/main.c:3920 msgid "Error sending USSD" msgstr "Ошибка отправки запроса USSD" #: ../src/main.c:3880 msgid "Wrong USSD request or device not ready" msgstr "Неправильный запрос USSD или устройство не готово" #: ../src/main.c:3883 msgid "USSD session terminated. You can send new request" msgstr "Сессия USSD завершена. Вы можете отправить новый запрос" #: ../src/main.c:3886 msgid "Wrong USSD request" msgstr "Некорректный запрос USSD" #: ../src/main.c:3909 msgid "" "\n" "USSD session is active. Waiting for your input...\n" msgstr "\nСессия USSD активна. Ожидается ответ...\n" #: ../src/main.c:3970 msgid "Command" msgstr "Команда" #: ../src/main.c:3976 msgid "Description" msgstr "Описание" #: ../src/main.c:4045 #, c-format msgid "Received %u new SMS messages" msgstr "Принято %u новых сообщений SMS" #: ../src/main.c:4047 ../src/main.c:4116 msgid "Received new SMS message" msgstr "Принято новое сообщение SMS" #: ../src/main.c:4051 msgid "Message senders: " msgstr "Сообщения от: " #: ../src/main.c:4177 msgid "" "SMS number is not valid\n" "Only numbers from 2 to 20 digits without\n" "letters and symbols can be used" msgstr "Номер для отправки SMS некорректен\nДопустимы номера длиной от 2 до 20 знаков\nбез цифр и специальных символов" #: ../src/main.c:4179 msgid "" "SMS text is not valid\n" "Please write some text to send" msgstr "Текст SMS некорректен\nНеобходимо набрать текст собщения" #: ../src/main.c:4297 msgid "Wrong number or device not ready" msgstr "Неверный номер или устройство не готово" #: ../src/main.c:4345 msgid "Remove message" msgstr "Удаление сообщения" #: ../src/main.c:4345 msgid "Really want to remove message?" msgstr "Действительно хотите удалить сообщение?" #: ../src/main.c:4351 ../src/main.c:4356 msgid "Error removing SMS" msgstr "Ошибка удаления SMS" #: ../src/main.c:4351 msgid "Message not found" msgstr "Сообщение не найдено" #: ../src/main.c:4356 msgid "Message not selected" msgstr "Сообщение не выбрано" #: ../src/main.c:4508 msgid "This message can't be read" msgstr "Это сообщение невозможно прочитать" #: ../src/main.c:4514 msgid "" "This is folder for your incoming SMS messages.\n" "You can answer selected message using 'Answer' button." msgstr "Этот каталог содержит ваши входящие сообщения SMS.\nВы можете ответить на сообщение при помощи кнопки 'Ответ'." #: ../src/main.c:4517 msgid "This is folder for your sent SMS messages." msgstr "Этот каталог содержит ваши исходящие сообщения SMS." #: ../src/main.c:4520 msgid "" "This is folder for your SMS message drafts.\n" "Select message and click 'Answer' button to start editing." msgstr "Этот каталог содержит черновики ваших сообщений SMS.\nВыберите сообщение и нажмите кнопку 'Ответ' для начала редактирования." #: ../src/main.c:4556 #, c-format msgid "" "%s\n" "%s" msgstr "%s\n%s" #: ../src/main.c:4611 msgid "" "Incoming\n" "Incoming messages" msgstr "Входящие\nПринятые сообщения" #: ../src/main.c:4612 msgid "" "Sent\n" "Sent messages" msgstr "Исходящие\nОтправленные сообщения" #: ../src/main.c:4613 msgid "" "Drafts\n" "Message drafts" msgstr "Черновики\nЧерновики сообщений" #: ../src/main.c:4690 ../resources/modem-manager-gui.ui:1908 #: ../resources/modem-manager-gui.ui:2321 msgid "SMS" msgstr "SMS" #: ../src/main.c:4959 msgid "Error opening device" msgstr "Ошибка открытия устройства" #: ../src/main.c:5105 #, c-format msgid "" "%s %s\n" "Version:%s Port:%s Type:%s" msgstr "%s %s\nПрошивка:%s Порт:%s Тип:%s" #: ../src/main.c:5154 msgid "Selected" msgstr "Выбранное" #: ../src/main.c:5159 ../resources/modem-manager-gui.ui:2572 msgid "Device" msgstr "Устройство" #: ../src/main.c:5215 msgid "GNOME contacts" msgstr "Контакты GNOME" #: ../src/main.c:5222 msgid "KDE contacts" msgstr "Контакты KDE" #: ../src/main.c:5277 msgid "Traffic limit exceeded... It's time to take rest \\(^_^)/" msgstr "Трафик закончился... Самое время отдохнуть \\(^_^)/" #: ../src/main.c:5300 msgid "Time limit exceeded... Go sleep and have nice dreams -_-" msgstr "Время закончилось... Прекрасных снов -_-" #: ../src/main.c:5673 msgid "Show window" msgstr "Показать окно" #: ../src/main.c:5680 msgid "New SMS" msgstr "Написать SMS" #: ../src/main.c:5741 ../resources/modem-manager-gui.ui:761 msgid "Preferences" msgstr "Параметры" #: ../src/main.c:5743 ../resources/modem-manager-gui.ui:7 msgid "About" msgstr "О программе" #: ../src/main.c:5745 msgid "Quit" msgstr "Выход" #: ../src/main.c:5776 ../src/main.c:5813 msgid "Error while initialization" msgstr "Ошибка в ходе инициализации" #: ../src/main.c:5776 msgid "No one modem manager is available" msgstr "Ни одна из систем управления модемами не доступна" #: ../src/main.c:5813 msgid "Interface building error" msgstr "Ошибка создания графического интерфейса" #: ../src/main.c:5860 #, c-format msgid "Segmentation fault at address: %p\n" msgstr "Ошибка сегментирования по адресу: %p\n" #: ../src/main.c:5863 msgid "Stack trace:\n" msgstr "Трассировка стека:\n" #: ../src/main.c:5890 msgid "Do not show window on start" msgstr "Не показывать окно при запуске" #: ../src/main.c:5920 msgid "- tool for EDGE/3G/4G modem specific functions control" msgstr "- инструмент для управления специфическими функциями модемов стандартов EDGE/3G/4G" #: ../src/main.c:5927 #, c-format msgid "Command line option parsing failed: %s\n" msgstr "Ошибка разбора параметра команданой строки: %s\n" #: ../src/strformat.c:39 #, c-format msgid "%.3f kbps" msgstr "%.3f КБит/с" #: ../src/strformat.c:41 #, c-format msgid "%.3f kbps" msgstr "%.3f КБит/с" #: ../src/strformat.c:46 #, c-format msgid "%.3g Mbps" msgstr "%.3g МБит/с" #: ../src/strformat.c:48 #, c-format msgid "%.3g Mbps" msgstr "%.3g МБит/с" #: ../src/strformat.c:53 #, c-format msgid "%.3g Gbps" msgstr "%.3g ГБит/с" #: ../src/strformat.c:55 #, c-format msgid "%.3g Gbps" msgstr "%.3g ГБит/с" #: ../src/strformat.c:87 #, c-format msgid "%u sec" msgstr "%u сек" #: ../src/strformat.c:89 #, c-format msgid "%u sec" msgstr "%u сек" #: ../src/strformat.c:93 #, c-format msgid "%s:%s" msgstr "%s:%s" #: ../src/strformat.c:95 #, c-format msgid "%s:%s" msgstr "%s:%s" #: ../src/strformat.c:99 #, c-format msgid "%s:%s:%s" msgstr "%s:%s:%s" #: ../src/strformat.c:101 #, c-format msgid "%s:%s:%s" msgstr "%s:%s:%s" #: ../src/strformat.c:105 #, c-format msgid "%lu day(s) %s:%s:%s" msgstr "%lu (дн.) %s:%s:%s" #: ../src/strformat.c:107 #, c-format msgid "%lu day(s) %s:%s:%s" msgstr "%lu (дн.) %s:%s:%s" #: ../src/strformat.c:124 #, c-format msgid "%u" msgstr "%u" #: ../src/strformat.c:126 #, c-format msgid "%u" msgstr "%u" #: ../src/strformat.c:131 #, c-format msgid "%.3g Kb" msgstr "%.3g КБ" #: ../src/strformat.c:133 #, c-format msgid "%.3g Kb" msgstr "%.3g КБ" #: ../src/strformat.c:138 #, c-format msgid "%.3g Mb" msgstr "%.3g МБ" #: ../src/strformat.c:140 #, c-format msgid "%.3g Mb" msgstr "%.3g МБ" #: ../src/strformat.c:145 #, c-format msgid "%.3g Gb" msgstr "%.3g ГБ" #: ../src/strformat.c:147 #, c-format msgid "%.3g Gb" msgstr "%.3g ГБ" #: ../src/strformat.c:152 #, c-format msgid "%.3g Tb" msgstr "%.3g ТБ" #: ../src/strformat.c:154 #, c-format msgid "%.3g Tb" msgstr "%.3g ТБ" #: ../src/strformat.c:205 msgid "Available" msgstr "Доступна" #: ../src/strformat.c:207 msgid "Current" msgstr "Активная сеть" #: ../src/strformat.c:209 msgid "Forbidden" msgstr "Недоступна" #: ../src/strformat.c:241 msgid "Not registered" msgstr "Не зарегистрирован" #: ../src/strformat.c:243 msgid "Home network" msgstr "Домашняя сеть" #: ../src/strformat.c:245 msgid "Searching" msgstr "Поиск сети" #: ../src/strformat.c:247 msgid "Registration denied" msgstr "В регистрации отказано" #: ../src/strformat.c:249 ../src/strformat.c:253 msgid "Unknown status" msgstr "Неизвестное состояние" #: ../src/strformat.c:251 msgid "Roaming network" msgstr "Роуминг" #: ../resources/modem-manager-gui.ui:17 msgid "Copyright 2012-2013 Alex" msgstr "Copyright 2012-2013 Alex" #: ../resources/modem-manager-gui.ui:18 msgid "Tool for EDGE/3G/4G modem specific functions control" msgstr "Программа для управления специфическими функциями EDGE/3G/4G модемов" #: ../resources/modem-manager-gui.ui:20 msgid "Homepage" msgstr "Домашняя страница" #: ../resources/modem-manager-gui.ui:21 msgid "GPL3" msgstr "GPL3" #: ../resources/modem-manager-gui.ui:23 msgid "English: Alex " msgstr "Русский: Alex " #: ../resources/modem-manager-gui.ui:55 msgid "Active connections" msgstr "Активные соединения" #: ../resources/modem-manager-gui.ui:111 msgid "Terminate selected application using SIGTERM signal CTRL+T" msgstr "Завершить работу выбранного приложения при помощи сигнала SIGTERM CTRL+T" #: ../resources/modem-manager-gui.ui:113 msgid "Terminate application" msgstr "Завершить приложение" #: ../resources/modem-manager-gui.ui:167 msgid "Error" msgstr "Ошибка" #: ../resources/modem-manager-gui.ui:282 msgid "Ask me again" msgstr "Спросить снова" #: ../resources/modem-manager-gui.ui:302 msgid "Quit or minimize?" msgstr "Выход или минимизация?" #: ../resources/modem-manager-gui.ui:316 msgid "What do you want application to do on window close?" msgstr "Что следует сделать при закрытии окна программы?" #: ../resources/modem-manager-gui.ui:327 msgid "Just quit" msgstr "Просто выйти" #: ../resources/modem-manager-gui.ui:344 msgid "Minimize to tray or messaging menu" msgstr "Минимизировать в трей или меню сообщений" #: ../resources/modem-manager-gui.ui:378 #: ../resources/modem-manager-gui.ui:3366 msgid "New contact" msgstr "Новый контакт" #: ../resources/modem-manager-gui.ui:611 msgid "New SMS message" msgstr "Новое SMS сообщение" #: ../resources/modem-manager-gui.ui:657 #: ../resources/modem-manager-gui.ui:2374 msgid "Send" msgstr "Отправить" #: ../resources/modem-manager-gui.ui:693 msgid "Number" msgstr "Номер" #: ../resources/modem-manager-gui.ui:838 msgid "Concatenate messages" msgstr "Объединять сообщения" #: ../resources/modem-manager-gui.ui:853 msgid "Expand folders" msgstr "Раскрывать каталоги" #: ../resources/modem-manager-gui.ui:868 msgid "Place old messages on top" msgstr "Помещать старые сообщения в верх списка" #: ../resources/modem-manager-gui.ui:889 msgid "SMS" msgstr "SMS" #: ../resources/modem-manager-gui.ui:947 msgid "RX Speed graph color" msgstr "Скорость приема" #: ../resources/modem-manager-gui.ui:962 msgid "TX Speed graph color" msgstr "Скорость передачи" #: ../resources/modem-manager-gui.ui:979 msgid "Traffic" msgstr "Трафик" #: ../resources/modem-manager-gui.ui:1008 msgid "Use sounds for events" msgstr "Использовать звуки событий" #: ../resources/modem-manager-gui.ui:1023 msgid "Hide window to tray on close" msgstr "Скрывать окно в трей при его закрытии" #: ../resources/modem-manager-gui.ui:1038 msgid "Save window geometry and placement" msgstr "Сохранять размеры и положение окна" #: ../resources/modem-manager-gui.ui:1059 msgid "Behaviour" msgstr "Поведение" #: ../resources/modem-manager-gui.ui:1087 msgid "Progress" msgstr "Степень выполнения" #: ../resources/modem-manager-gui.ui:1142 msgid "Executing command" msgstr "Выполняется команда" #: ../resources/modem-manager-gui.ui:1181 msgid "Question" msgstr "Вопрос" #: ../resources/modem-manager-gui.ui:1234 msgid "Traffic limits" msgstr "Ограничения" #: ../resources/modem-manager-gui.ui:1296 msgid "Eanble traffic limit" msgstr "Использовать ограничение трафика" #: ../resources/modem-manager-gui.ui:1312 msgid "Enable time limit" msgstr "Использовать ограничение времени" #: ../resources/modem-manager-gui.ui:1330 #: ../resources/modem-manager-gui.ui:1972 #: ../resources/modem-manager-gui.ui:3271 msgid "Traffic" msgstr "Трафик" #: ../resources/modem-manager-gui.ui:1376 #: ../resources/modem-manager-gui.ui:1478 msgid "Message" msgstr "Сообщение" #: ../resources/modem-manager-gui.ui:1402 #: ../resources/modem-manager-gui.ui:1504 msgid "Action" msgstr "Действие" #: ../resources/modem-manager-gui.ui:1433 msgid "Time" msgstr "Время" #: ../resources/modem-manager-gui.ui:1548 msgid "Traffic statistics" msgstr "Статистика" #: ../resources/modem-manager-gui.ui:1608 msgid "Selected statistics period" msgstr "Выбранный период сбора данных" #: ../resources/modem-manager-gui.ui:1773 msgid "Add new USSD command CTRL+N" msgstr "Добавить новую команду USSD CTRL+N" #: ../resources/modem-manager-gui.ui:1775 msgid "Add" msgstr "Добавить" #: ../resources/modem-manager-gui.ui:1789 msgid "Remove selected USSD command CTRL+D" msgstr "Удалить выбранную команду USSD CTRL+D" #: ../resources/modem-manager-gui.ui:1791 msgid "Delete" msgstr "Удалить" #: ../resources/modem-manager-gui.ui:1815 msgid "" "Force USSD answer encoding change from GSM7 to UCS2 (useful for Huawei " "modems) CTRL+E" msgstr "Принудительно конвертировать кодировку ответа USSD из GSM7 в UCS2 (используется для модемов Huawei) CTRL+E" #: ../resources/modem-manager-gui.ui:1817 msgid "Change message encoding" msgstr "Конвертировать кодировку" #: ../resources/modem-manager-gui.ui:1871 msgid "Modem Manager GUI" msgstr "Modem Manager GUI" #: ../resources/modem-manager-gui.ui:1890 msgid "View and select available devices CTRL+F1" msgstr "Просмотр доступных устройств и выбор используемого CTRL+F1" #: ../resources/modem-manager-gui.ui:1892 #: ../resources/modem-manager-gui.ui:2117 msgid "Devices" msgstr "Устройства" #: ../resources/modem-manager-gui.ui:1906 msgid "Send and receive SMS messages CTRL+F2" msgstr "Прием и отправка сообщений SMS CTRL+F2" #: ../resources/modem-manager-gui.ui:1922 msgid "Send USSD requests CTRL+F3" msgstr "Отправка запросов USSD CTRL+F3" #: ../resources/modem-manager-gui.ui:1924 #: ../resources/modem-manager-gui.ui:2523 msgid "USSD" msgstr "USSD" #: ../resources/modem-manager-gui.ui:1938 msgid "View active device information CTRL+F4" msgstr "Просмотр информации об активном устройстве CTRL+F4" #: ../resources/modem-manager-gui.ui:1940 #: ../resources/modem-manager-gui.ui:2975 msgid "Info" msgstr "Статус" #: ../resources/modem-manager-gui.ui:1954 msgid "Scan existing mobile networks CTRL+F5" msgstr "Сканирование существующих мобильных сетей CTRL+F5" #: ../resources/modem-manager-gui.ui:1956 #: ../resources/modem-manager-gui.ui:3125 msgid "Scan" msgstr "Сети" #: ../resources/modem-manager-gui.ui:1970 msgid "Monitor network traffic CTRL+F6" msgstr "Мониторинг сетевого трафика CTRL+F6" #: ../resources/modem-manager-gui.ui:1986 msgid "View system and modem addressbooks CTRL+F7" msgstr "Просмотр адресной книги модема и системных адресных книг CTRL+F7" #: ../resources/modem-manager-gui.ui:1988 #: ../resources/modem-manager-gui.ui:3455 msgid "Contacts" msgstr "Контакты" #: ../resources/modem-manager-gui.ui:2041 msgid "No devices found in system" msgstr "В системе не найдено устройств" #: ../resources/modem-manager-gui.ui:2210 msgid "Send new SMS message CTRL+N" msgstr "Отправить новое сообщение SMS CTRL+N" #: ../resources/modem-manager-gui.ui:2212 msgid "New" msgstr "Новое сообщение" #: ../resources/modem-manager-gui.ui:2226 msgid "Remove selected message CTRL+D" msgstr "Удалить выбранное сообщение CTRL+D" #: ../resources/modem-manager-gui.ui:2228 msgid "Remove" msgstr "Удалить сообщение" #: ../resources/modem-manager-gui.ui:2242 msgid "Answer selected message CTRL+A" msgstr "Ответить на выбранное сообщение CTRL+A" #: ../resources/modem-manager-gui.ui:2244 msgid "Answer" msgstr "Ответ" #: ../resources/modem-manager-gui.ui:2340 msgid "Request" msgstr "Запрос" #: ../resources/modem-manager-gui.ui:2378 msgid "Send ussd request CTRL+S" msgstr "Отправить запрос ussd CTRL+S" #: ../resources/modem-manager-gui.ui:2398 msgid "Edit USSD commands list CTRL+E" msgstr "Отредактировать список команд USSD CTRL+E" #: ../resources/modem-manager-gui.ui:2600 msgid "IMEI" msgstr "IMEI" #: ../resources/modem-manager-gui.ui:2627 msgid "IMSI/ESN" msgstr "IMSI/ESN" #: ../resources/modem-manager-gui.ui:2658 msgid "Equipment" msgstr "Оборудование" #: ../resources/modem-manager-gui.ui:2732 msgid "Mode" msgstr "Стандарт" #: ../resources/modem-manager-gui.ui:2760 msgid "Signal level" msgstr "Уровень сигнала" #: ../resources/modem-manager-gui.ui:2774 msgid "Operator code" msgstr "Код оператора" #: ../resources/modem-manager-gui.ui:2801 msgid "Registration" msgstr "Регистрация" #: ../resources/modem-manager-gui.ui:2846 msgid "Network" msgstr "Сеть" #: ../resources/modem-manager-gui.ui:2892 msgid "" "3GPP Location\n" "MCC/MNC/LAC/CID" msgstr "Позиционирование 3GPP\nMCC/MNC/LAC/CID" #: ../resources/modem-manager-gui.ui:2908 msgid "" "GPS location\n" "Longitude/Latiude" msgstr "Позиционирование GPS\nLongitude/Latiude" #: ../resources/modem-manager-gui.ui:2955 msgid "Location" msgstr "Позиционирование" #: ../resources/modem-manager-gui.ui:3021 msgid "Scan available mobile networks CTRL+S" msgstr "Сканировать доступные мобильные сети CTRL+S" #: ../resources/modem-manager-gui.ui:3023 msgid "Start scan" msgstr "Начать сканирование сетей" #: ../resources/modem-manager-gui.ui:3145 msgid "Set traffic amount or time limit for disconnect CTRL+L" msgstr "Установить объем трафика и время до отсоединения CTRL+L" #: ../resources/modem-manager-gui.ui:3147 msgid "Set limit" msgstr "Установить ограничения" #: ../resources/modem-manager-gui.ui:3161 msgid "View list of active network connections CTRL+C" msgstr "Просмотреть список активных сетевых соединений CTRL+C" #: ../resources/modem-manager-gui.ui:3163 msgid "Connections" msgstr "Соединения" #: ../resources/modem-manager-gui.ui:3177 msgid "View daily traffic statistics CTRL+S" msgstr "Просмотреть ежедневную статистику потребления трафика CTRL+S" #: ../resources/modem-manager-gui.ui:3179 msgid "Statistics" msgstr "Статистика" #: ../resources/modem-manager-gui.ui:3230 msgid "Transmission speed" msgstr "Скорость передачи данных" #: ../resources/modem-manager-gui.ui:3364 msgid "Add new contact to modem addressbook CTRL+N" msgstr "Добавить новый контакт в адресную книгу модема CTRL+N" #: ../resources/modem-manager-gui.ui:3380 msgid "Remove contact from modem addressbook CTRL+D" msgstr "Удалить контакт из адресной книги модема CTRL+D" #: ../resources/modem-manager-gui.ui:3382 msgid "Remove contact" msgstr "Удалить контакт" #: ../resources/modem-manager-gui.ui:3406 msgid "Send SMS message to selected contact CTRL+S" msgstr "Отправить сообщение SMS на номер выделенного контакта CTRL+S" #: ../resources/modem-manager-gui.ui:3408 msgid "Send SMS" msgstr "Отправить SMS" #: manual addition msgid "Show message" msgstr "Показать сообщение" #: manual addition msgid "Disconnect" msgstr "Разорвать соединение" #: manual addition msgid "Hours" msgstr "Часы" #: manual addition msgid "Minutes" msgstr "Минуты" #: manual addition msgid "Mb" msgstr "МБ" #: manual addition msgid "Gb" msgstr "ГБ" #: manual addition msgid "Tb" msgstr "ТБ" #: manual addition msgid "January" msgstr "Январь" #: manual addition msgid "February" msgstr "Февраль" #: manual addition msgid "March" msgstr "Март" #: manual addition msgid "April" msgstr "Апрель" #: manual addition msgid "May" msgstr "Май" #: manual addition msgid "June" msgstr "Июнь" #: manual addition msgid "July" msgstr "Июль" #: manual addition msgid "August" msgstr "Август" #: manual addition msgid "September" msgstr "Сентябрь" #: manual addition msgid "October" msgstr "Октябрь" #: manual addition msgid "November" msgstr "Ноябрь" #: manual addition msgid "December" msgstr "Декабрь" modem-manager-gui-0.0.16/po/tr.po000066400000000000000000000671071217271411700165120ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # # Translators: # Ahmet Sezgin Duran , 2013 # ethereal , 2013 msgid "" msgstr "" "Project-Id-Version: Modem Manager GUI\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2013-07-11 23:22+0400\n" "PO-Revision-Date: 2013-07-11 19:33+0000\n" "Last-Translator: ethereal \n" "Language-Team: Turkish (http://www.transifex.com/projects/p/modem-manager-gui/language/tr/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: tr\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" #: ../src/ayatana.c:129 msgid "Unread SMS" msgstr "" #: ../src/ayatana.c:300 msgid "Unread messages" msgstr "" #: ../src/main.c:667 ../src/main.c:3372 ../src/main.c:4297 msgid "Error sending message" msgstr "İleti gönderme hatası" #: ../src/main.c:738 msgid "Operation timed out" msgstr "" #: ../src/main.c:738 msgid "Operation took too long to execute. Please restart it." msgstr "" #: ../src/main.c:1083 msgid "Modem must be enabled to read SMS. Enable modem?" msgstr "SMS okumak için modem etkinleştirilmelidir. Modem etkinleştirilsin mi?" #: ../src/main.c:1084 msgid "Modem must be enabled to read and write SMS. Please enable modem." msgstr "" #: ../src/main.c:1085 msgid "" "Modem must be registered in mobile network to receive and send SMS. Please " "wait..." msgstr "" #: ../src/main.c:1086 msgid "Modem must be unlocked to receive and send SMS. Please enter PIN code." msgstr "" #: ../src/main.c:1087 msgid "Modem manager does not support SMS manipulation functions." msgstr "" #: ../src/main.c:1088 msgid "Modem manager does not support sending of SMS messages." msgstr "" #: ../src/main.c:1106 msgid "Modem must be enabled to send USSD. Enable modem?" msgstr "USSD göndermek için modem etkinleştirilmelidir. Modem etkinleştirilsin mi?" #: ../src/main.c:1107 msgid "Modem must be enabled to send USSD. Please enable modem." msgstr "" #: ../src/main.c:1108 msgid "" "Modem must be registered in mobile network to send USSD. Please wait..." msgstr "" #: ../src/main.c:1109 msgid "Modem must be unlocked to send USSD. Please enter PIN code." msgstr "" #: ../src/main.c:1110 msgid "Modem manager does not support sending of USSD requests." msgstr "" #: ../src/main.c:1138 msgid "Modem must be enabled to scan for available networks. Enable modem?" msgstr "Mevcut bağlantıları taramak için modem etkinleştirilmelidir. Modem etkinleştirilsin mi?" #: ../src/main.c:1139 msgid "" "Modem must be enabled to scan for available networks. Please enable modem." msgstr "" #: ../src/main.c:1141 msgid "" "Modem must be unlocked to scan for available networks. Please enter PIN " "code." msgstr "" #: ../src/main.c:1142 msgid "Modem manager does not support scanning for available mobile networks." msgstr "" #: ../src/main.c:1143 msgid "Modem is connected now. Please disconnect to scan." msgstr "Modem şuanda bağlı. Taramak için lütfen bağlantıyı kesin." #: ../src/main.c:1175 msgid "Modem must be enabled to export contacts from it. Enable modem?" msgstr "" #: ../src/main.c:1176 msgid "Modem must be enabled to export contacts from it. Please enable modem." msgstr "" #: ../src/main.c:1178 msgid "" "Modem must be unlocked to export contacts from it. Please enter PIN code." msgstr "" #: ../src/main.c:1179 msgid "Modem manager does not support modem contacts manipulation functions." msgstr "" #: ../src/main.c:1180 msgid "Modem manager does not support modem contacts edition functions." msgstr "" #: ../src/main.c:1218 msgid "Enable modem" msgstr "Modemi etkinleştir" #: ../src/main.c:1222 ../src/main.c:4731 msgid "Error enabling device" msgstr "Aygıtı etkinleştirilemiyor" #: ../src/main.c:1438 ../src/main.c:1465 msgid "Modem Manager GUI window hidden" msgstr "" #: ../src/main.c:1438 ../src/main.c:1465 msgid "Use tray icon or messaging menu to show window again" msgstr "" #: ../src/main.c:1757 #, c-format msgid "Unread messages: %u" msgstr "" #: ../src/main.c:1760 ../src/main.c:1763 ../src/main.c:5669 msgid "No unread messages" msgstr "Okunmamış mesaj yok" #: ../src/main.c:2085 msgid "Error adding contact" msgstr "" #: ../src/main.c:2121 msgid "Remove contact" msgstr "" #: ../src/main.c:2121 msgid "Really want to remove contact?" msgstr "" #: ../src/main.c:2125 ../src/main.c:2130 msgid "Error removing contact" msgstr "" #: ../src/main.c:2125 msgid "Contact not removed from device" msgstr "" #: ../src/main.c:2130 msgid "Contact not selected" msgstr "" #: ../src/main.c:2260 ../resources/modem-manager-gui.ui:517 msgid "First name" msgstr "" #: ../src/main.c:2264 ../resources/modem-manager-gui.ui:530 msgid "First number" msgstr "" #: ../src/main.c:2268 ../resources/modem-manager-gui.ui:543 msgid "EMail" msgstr "" #: ../src/main.c:2272 ../resources/modem-manager-gui.ui:556 msgid "Group" msgstr "" #: ../src/main.c:2276 ../resources/modem-manager-gui.ui:570 msgid "Second name" msgstr "" #: ../src/main.c:2280 ../resources/modem-manager-gui.ui:583 msgid "Second number" msgstr "" #: ../src/main.c:2289 msgid "Modem contacts" msgstr "" #: ../src/main.c:2357 ../src/main.c:2410 ../src/main.c:4553 #: ../src/strformat.c:165 ../src/strformat.c:195 ../src/strformat.c:203 #: ../src/strformat.c:211 #, c-format msgid "Unknown" msgstr "Bilinmeyen" #: ../src/main.c:2521 msgid "Day" msgstr "" #: ../src/main.c:2525 msgid "Received data" msgstr "" #: ../src/main.c:2529 msgid "Transmitted data" msgstr "" #: ../src/main.c:2533 msgid "Session time" msgstr "" #: ../src/main.c:2696 msgid "Application" msgstr "Uygulama" #: ../src/main.c:2700 msgid "PID" msgstr "PID" #: ../src/main.c:2704 msgid "Protocol" msgstr "Protokol" #: ../src/main.c:2708 msgid "State" msgstr "Durum" #: ../src/main.c:2712 msgid "Buffer" msgstr "Tampon" #: ../src/main.c:2716 msgid "Port" msgstr "Port" #: ../src/main.c:2720 msgid "Destination" msgstr "Hedef" #: ../src/main.c:2746 msgid "Traffic limit exceeded" msgstr "Kota aşıldı" #: ../src/main.c:2750 msgid "Time limit exceeded" msgstr "Süre sınırı aşıldı" #: ../src/main.c:2927 #, c-format msgid "" "Traffic: %s, limit set to: %s\n" "Time: %s, limit set to: %s\n" "Please check entered values and try once more" msgstr "Kota: %s, sınır ayarı: %s\nSüre: %s, sınır ayarı: %s\nLütfen girilen değerleri kontrol edin ve bir kez daha deneyin" #: ../src/main.c:2932 msgid "Wrong traffic and time limit values" msgstr "Geçersiz kota ve süre sınırı değerleri" #: ../src/main.c:2935 #, c-format msgid "" "Traffic: %s, limit set to: %s\n" "Please check entered values and try once more" msgstr "Kota: %s, sınır ayarı: %s\nLütfen girilen değerleri kontrol edin ve bir kere daha deneyin" #: ../src/main.c:2938 msgid "Wrong traffic limit value" msgstr "Geçersiz kota sınırı değeri" #: ../src/main.c:2941 #, c-format msgid "" "Time: %s, limit set to: %s\n" "Please check entered values and try once more" msgstr "Süre: %s, sınır ayarı: %s\nLütfen girilen değerleri kontrol edin ve bir kez daha deneyin" #: ../src/main.c:2944 msgid "Wrong time limit value" msgstr "Geçersiz süre sınırı değeri" #: ../src/main.c:2981 #, c-format msgid "%s disconnected" msgstr "%s bağlantıyı kesti" #: ../src/main.c:3055 ../src/main.c:3079 ../src/main.c:3103 msgid "Disconnected" msgstr "Bağlantı kesildi" #: ../src/main.c:3067 ../src/main.c:3073 ../src/main.c:3091 ../src/main.c:3097 msgid "Limit" msgstr "Sınır" #: ../src/main.c:3070 ../src/main.c:3076 ../src/main.c:3094 ../src/main.c:3100 msgid "Disabled" msgstr "Devre Dışı" #: ../src/main.c:3232 msgid "kbps" msgstr "kbps" #: ../src/main.c:3242 msgid "sec" msgstr "sn" #: ../src/main.c:3296 msgid "RX speed" msgstr "İndirme hızı" #: ../src/main.c:3315 msgid "TX speed" msgstr "Gönderme hızı" #: ../src/main.c:3330 msgid "Parameter" msgstr "Parametre" #: ../src/main.c:3335 msgid "Value" msgstr "Değer" #: ../src/main.c:3341 msgid "Received data" msgstr "Alınan veri" #: ../src/main.c:3344 msgid "Transmitted data" msgstr "Gönderilen veri" #: ../src/main.c:3347 msgid "Receive speed" msgstr "İndirme hızı" #: ../src/main.c:3350 msgid "Transmit speed" msgstr "Gönderim hızı" #: ../src/main.c:3353 msgid "Session time" msgstr "Oturum süresi" #: ../src/main.c:3356 msgid "Traffic left" msgstr "Kalan kota" #: ../src/main.c:3359 msgid "Time left" msgstr "Kalan süre" #: ../src/main.c:3372 msgid "Device error" msgstr "Aygıt hatası" #: ../src/main.c:3399 #, c-format msgid "" "%s\n" "%s ID: %u Availability: %s Access tech: %s" msgstr "%s\n%s Kimlik: %u Kullanılabilirlik: %s Erişim Yöntemi: %s" #: ../src/main.c:3435 msgid "Error scanning networks" msgstr "Ağ taraması hatası" #: ../src/main.c:3449 ../resources/modem-manager-gui.ui:2704 msgid "Operator" msgstr "Operatör" #: ../src/main.c:3495 ../src/main.c:3502 ../src/main.c:3554 ../src/main.c:3562 msgid "Not supported" msgstr "" #: ../src/main.c:3584 msgid "Sample command" msgstr "Örnek komut" #: ../src/main.c:3790 ../src/main.c:3803 msgid "" "USSD request is not valid\n" "Request must be 160 symbols long\n" "started with '*' and ended with '#'" msgstr "USSD isteği geçerli değil\nİstek 160 simge büyüklüğünde olmalı ve\n'*' ile başlayıp '#' ile bitmelidir" #: ../src/main.c:3880 ../src/main.c:3883 ../src/main.c:3886 ../src/main.c:3920 msgid "Error sending USSD" msgstr "USSD gönderme hatası" #: ../src/main.c:3880 msgid "Wrong USSD request or device not ready" msgstr "Geçersiz USSD isteği veya aygıt hazır değil" #: ../src/main.c:3883 msgid "USSD session terminated. You can send new request" msgstr "USSD oturumu sonlandırıldı. Yeni istek gönderebilirsiniz." #: ../src/main.c:3886 msgid "Wrong USSD request" msgstr "Geçersiz USSD isteği" #: ../src/main.c:3909 msgid "" "\n" "USSD session is active. Waiting for your input...\n" msgstr "\nUSSD oturumu etkin. Girdi için bekleniyor...\n" #: ../src/main.c:3970 msgid "Command" msgstr "Komut" #: ../src/main.c:3976 msgid "Description" msgstr "Açıklama" #: ../src/main.c:4045 #, c-format msgid "Received %u new SMS messages" msgstr "%u yeni SMS iletisi alındı" #: ../src/main.c:4047 ../src/main.c:4116 msgid "Received new SMS message" msgstr "Yeni SMS iletisi alındı" #: ../src/main.c:4051 msgid "Message senders: " msgstr "İleti gönderenler:" #: ../src/main.c:4177 msgid "" "SMS number is not valid\n" "Only numbers from 2 to 20 digits without\n" "letters and symbols can be used" msgstr "SMS numarası geçerli değil\nHarf veya simgeler olmadan, sadece 2'den 20 basamağa kadar olan sayılar kullanılabilir" #: ../src/main.c:4179 msgid "" "SMS text is not valid\n" "Please write some text to send" msgstr "SMS metni geçersiz\\n Lütfen göndermek için bir metin girin" #: ../src/main.c:4297 msgid "Wrong number or device not ready" msgstr "Geçersiz numara veya aygıt hazır değil" #: ../src/main.c:4345 msgid "Remove message" msgstr "İletiyi sil" #: ../src/main.c:4345 msgid "Really want to remove message?" msgstr "Gerçekten ileti silinsin mi?" #: ../src/main.c:4351 ../src/main.c:4356 msgid "Error removing SMS" msgstr "SMS silme hatası" #: ../src/main.c:4351 msgid "Message not found" msgstr "İleti bulunamadı" #: ../src/main.c:4356 msgid "Message not selected" msgstr "İleti seçilmedi" #: ../src/main.c:4508 msgid "This message can't be read" msgstr "Bu mesaj okunamaz" #: ../src/main.c:4514 msgid "" "This is folder for your incoming SMS messages.\n" "You can answer selected message using 'Answer' button." msgstr "Bu klasör gelen SMS iletileri içindir.\n'Cevapla' düğmesini kullanarak seçili iletiyi cevaplayabilirsiniz ." #: ../src/main.c:4517 msgid "This is folder for your sent SMS messages." msgstr "Bu klasör gönderilmiş SMS iletileriniz içindir." #: ../src/main.c:4520 msgid "" "This is folder for your SMS message drafts.\n" "Select message and click 'Answer' button to start editing." msgstr "Bu klasör SMS taslaklarınız içndir.\nDüzenlemek için iletiyi seçin ve 'Cevapla' düğmesine tıklayın." #: ../src/main.c:4556 #, c-format msgid "" "%s\n" "%s" msgstr "%s\n%s" #: ../src/main.c:4611 msgid "" "Incoming\n" "Incoming messages" msgstr "Gelen\nGelen iletiler" #: ../src/main.c:4612 msgid "" "Sent\n" "Sent messages" msgstr "Gönderilen\nGönderilen iletiler" #: ../src/main.c:4613 msgid "" "Drafts\n" "Message drafts" msgstr "Taslaklar\nİleti taslakları" #: ../src/main.c:4690 ../resources/modem-manager-gui.ui:1908 #: ../resources/modem-manager-gui.ui:2321 msgid "SMS" msgstr "SMS" #: ../src/main.c:4959 msgid "Error opening device" msgstr "Aygıt açılamıyor" #: ../src/main.c:5105 #, c-format msgid "" "%s %s\n" "Version:%s Port:%s Type:%s" msgstr "%s %s\nSürüm:%s Port:%s Tip:%s" #: ../src/main.c:5154 msgid "Selected" msgstr "Seçili" #: ../src/main.c:5159 ../resources/modem-manager-gui.ui:2572 msgid "Device" msgstr "Aygıt" #: ../src/main.c:5215 msgid "GNOME contacts" msgstr "" #: ../src/main.c:5222 msgid "KDE contacts" msgstr "" #: ../src/main.c:5277 msgid "Traffic limit exceeded... It's time to take rest \\(^_^)/" msgstr "Kota aşıldı... Ara verme zamanı \\(^_^)/" #: ../src/main.c:5300 msgid "Time limit exceeded... Go sleep and have nice dreams -_-" msgstr "Süre sınırı aşıldı... İyi uykular ve tatlı rüyalar -_-" #: ../src/main.c:5673 msgid "Show window" msgstr "Pencereyi göster" #: ../src/main.c:5680 msgid "New SMS" msgstr "Yeni SMS" #: ../src/main.c:5741 ../resources/modem-manager-gui.ui:761 msgid "Preferences" msgstr "Tercihler" #: ../src/main.c:5743 ../resources/modem-manager-gui.ui:7 msgid "About" msgstr "Hakkında" #: ../src/main.c:5745 msgid "Quit" msgstr "" #: ../src/main.c:5776 ../src/main.c:5813 msgid "Error while initialization" msgstr "" #: ../src/main.c:5776 msgid "No one modem manager is available" msgstr "" #: ../src/main.c:5813 msgid "Interface building error" msgstr "" #: ../src/main.c:5860 #, c-format msgid "Segmentation fault at address: %p\n" msgstr "" #: ../src/main.c:5863 msgid "Stack trace:\n" msgstr "" #: ../src/main.c:5890 msgid "Do not show window on start" msgstr "" #: ../src/main.c:5920 msgid "- tool for EDGE/3G/4G modem specific functions control" msgstr "" #: ../src/main.c:5927 #, c-format msgid "Command line option parsing failed: %s\n" msgstr "" #: ../src/strformat.c:39 #, c-format msgid "%.3f kbps" msgstr "%.3f kbps" #: ../src/strformat.c:41 #, c-format msgid "%.3f kbps" msgstr "%.3f kbps" #: ../src/strformat.c:46 #, c-format msgid "%.3g Mbps" msgstr "%.3g Mbps" #: ../src/strformat.c:48 #, c-format msgid "%.3g Mbps" msgstr "%.3g Mbps" #: ../src/strformat.c:53 #, c-format msgid "%.3g Gbps" msgstr "%.3g Gbps" #: ../src/strformat.c:55 #, c-format msgid "%.3g Gbps" msgstr "%.3g Gbps" #: ../src/strformat.c:87 #, c-format msgid "%u sec" msgstr "%u sn" #: ../src/strformat.c:89 #, c-format msgid "%u sec" msgstr "%u sn" #: ../src/strformat.c:93 #, c-format msgid "%s:%s" msgstr "%s:%s" #: ../src/strformat.c:95 #, c-format msgid "%s:%s" msgstr "%s:%s" #: ../src/strformat.c:99 #, c-format msgid "%s:%s:%s" msgstr "%s:%s:%s" #: ../src/strformat.c:101 #, c-format msgid "%s:%s:%s" msgstr "%s:%s:%s" #: ../src/strformat.c:105 #, c-format msgid "%lu day(s) %s:%s:%s" msgstr "" #: ../src/strformat.c:107 #, c-format msgid "%lu day(s) %s:%s:%s" msgstr "" #: ../src/strformat.c:124 #, c-format msgid "%u" msgstr "%u" #: ../src/strformat.c:126 #, c-format msgid "%u" msgstr "%u" #: ../src/strformat.c:131 #, c-format msgid "%.3g Kb" msgstr "%.3g Kb" #: ../src/strformat.c:133 #, c-format msgid "%.3g Kb" msgstr "%.3g Kb" #: ../src/strformat.c:138 #, c-format msgid "%.3g Mb" msgstr "%.3g Mb" #: ../src/strformat.c:140 #, c-format msgid "%.3g Mb" msgstr "%.3g Mb" #: ../src/strformat.c:145 #, c-format msgid "%.3g Gb" msgstr "%.3g Gb" #: ../src/strformat.c:147 #, c-format msgid "%.3g Gb" msgstr "%.3g Gb" #: ../src/strformat.c:152 #, c-format msgid "%.3g Tb" msgstr "%.3g Tb" #: ../src/strformat.c:154 #, c-format msgid "%.3g Tb" msgstr "%.3g Tb" #: ../src/strformat.c:205 msgid "Available" msgstr "" #: ../src/strformat.c:207 msgid "Current" msgstr "" #: ../src/strformat.c:209 msgid "Forbidden" msgstr "" #: ../src/strformat.c:241 msgid "Not registered" msgstr "" #: ../src/strformat.c:243 msgid "Home network" msgstr "" #: ../src/strformat.c:245 msgid "Searching" msgstr "" #: ../src/strformat.c:247 msgid "Registration denied" msgstr "" #: ../src/strformat.c:249 ../src/strformat.c:253 msgid "Unknown status" msgstr "" #: ../src/strformat.c:251 msgid "Roaming network" msgstr "" #: ../resources/modem-manager-gui.ui:17 msgid "Copyright 2012-2013 Alex" msgstr "" #: ../resources/modem-manager-gui.ui:18 msgid "Tool for EDGE/3G/4G modem specific functions control" msgstr "EDGE/3G/4G modemler için özel işlev kontrol aracı" #: ../resources/modem-manager-gui.ui:20 msgid "Homepage" msgstr "Anasayfa" #: ../resources/modem-manager-gui.ui:21 msgid "GPL3" msgstr "GPL3" #: ../resources/modem-manager-gui.ui:23 msgid "English: Alex " msgstr "Türkçe: Ahmet Sezgin Duran " #: ../resources/modem-manager-gui.ui:55 msgid "Active connections" msgstr "Etkin bağlantılar" #: ../resources/modem-manager-gui.ui:111 msgid "Terminate selected application using SIGTERM signal CTRL+T" msgstr "" #: ../resources/modem-manager-gui.ui:113 msgid "Terminate application" msgstr "Uygulamayı sonlandır" #: ../resources/modem-manager-gui.ui:167 msgid "Error" msgstr "Hata" #: ../resources/modem-manager-gui.ui:282 msgid "Ask me again" msgstr "" #: ../resources/modem-manager-gui.ui:302 msgid "Quit or minimize?" msgstr "" #: ../resources/modem-manager-gui.ui:316 msgid "What do you want application to do on window close?" msgstr "" #: ../resources/modem-manager-gui.ui:327 msgid "Just quit" msgstr "" #: ../resources/modem-manager-gui.ui:344 msgid "Minimize to tray or messaging menu" msgstr "" #: ../resources/modem-manager-gui.ui:378 #: ../resources/modem-manager-gui.ui:3366 msgid "New contact" msgstr "" #: ../resources/modem-manager-gui.ui:611 msgid "New SMS message" msgstr "Yeni SMS iletisi" #: ../resources/modem-manager-gui.ui:657 #: ../resources/modem-manager-gui.ui:2374 msgid "Send" msgstr "Gönder" #: ../resources/modem-manager-gui.ui:693 msgid "Number" msgstr "Numara" #: ../resources/modem-manager-gui.ui:838 msgid "Concatenate messages" msgstr "İletileri sırala" #: ../resources/modem-manager-gui.ui:853 msgid "Expand folders" msgstr "Dizinleri genişlet" #: ../resources/modem-manager-gui.ui:868 msgid "Place old messages on top" msgstr "" #: ../resources/modem-manager-gui.ui:889 msgid "SMS" msgstr "SMS" #: ../resources/modem-manager-gui.ui:947 msgid "RX Speed graph color" msgstr "İndirme Hızı grafik rengi" #: ../resources/modem-manager-gui.ui:962 msgid "TX Speed graph color" msgstr "Gönderme Hızı grafik rengi" #: ../resources/modem-manager-gui.ui:979 msgid "Traffic" msgstr "Kota" #: ../resources/modem-manager-gui.ui:1008 msgid "Use sounds for events" msgstr "" #: ../resources/modem-manager-gui.ui:1023 msgid "Hide window to tray on close" msgstr "" #: ../resources/modem-manager-gui.ui:1038 msgid "Save window geometry and placement" msgstr "" #: ../resources/modem-manager-gui.ui:1059 msgid "Behaviour" msgstr "" #: ../resources/modem-manager-gui.ui:1087 msgid "Progress" msgstr "İşlem" #: ../resources/modem-manager-gui.ui:1142 msgid "Executing command" msgstr "Komut çalıştırılıyor" #: ../resources/modem-manager-gui.ui:1181 msgid "Question" msgstr "Soru" #: ../resources/modem-manager-gui.ui:1234 msgid "Traffic limits" msgstr "Kota" #: ../resources/modem-manager-gui.ui:1296 msgid "Eanble traffic limit" msgstr "Kotayı etkinleştir" #: ../resources/modem-manager-gui.ui:1312 msgid "Enable time limit" msgstr "Süre sınırını etkinleştir" #: ../resources/modem-manager-gui.ui:1330 #: ../resources/modem-manager-gui.ui:1972 #: ../resources/modem-manager-gui.ui:3271 msgid "Traffic" msgstr "Kota" #: ../resources/modem-manager-gui.ui:1376 #: ../resources/modem-manager-gui.ui:1478 msgid "Message" msgstr "İleti" #: ../resources/modem-manager-gui.ui:1402 #: ../resources/modem-manager-gui.ui:1504 msgid "Action" msgstr "Eylem" #: ../resources/modem-manager-gui.ui:1433 msgid "Time" msgstr "Süre" #: ../resources/modem-manager-gui.ui:1548 msgid "Traffic statistics" msgstr "" #: ../resources/modem-manager-gui.ui:1608 msgid "Selected statistics period" msgstr "" #: ../resources/modem-manager-gui.ui:1773 msgid "Add new USSD command CTRL+N" msgstr "" #: ../resources/modem-manager-gui.ui:1775 msgid "Add" msgstr "Ekle" #: ../resources/modem-manager-gui.ui:1789 msgid "Remove selected USSD command CTRL+D" msgstr "" #: ../resources/modem-manager-gui.ui:1791 msgid "Delete" msgstr "Sil" #: ../resources/modem-manager-gui.ui:1815 msgid "" "Force USSD answer encoding change from GSM7 to UCS2 (useful for Huawei " "modems) CTRL+E" msgstr "" #: ../resources/modem-manager-gui.ui:1817 msgid "Change message encoding" msgstr "" #: ../resources/modem-manager-gui.ui:1871 msgid "Modem Manager GUI" msgstr "Modem Manager GUI" #: ../resources/modem-manager-gui.ui:1890 msgid "View and select available devices CTRL+F1" msgstr "" #: ../resources/modem-manager-gui.ui:1892 #: ../resources/modem-manager-gui.ui:2117 msgid "Devices" msgstr "Aygıtlar" #: ../resources/modem-manager-gui.ui:1906 msgid "Send and receive SMS messages CTRL+F2" msgstr "" #: ../resources/modem-manager-gui.ui:1922 msgid "Send USSD requests CTRL+F3" msgstr "" #: ../resources/modem-manager-gui.ui:1924 #: ../resources/modem-manager-gui.ui:2523 msgid "USSD" msgstr "USSD" #: ../resources/modem-manager-gui.ui:1938 msgid "View active device information CTRL+F4" msgstr "" #: ../resources/modem-manager-gui.ui:1940 #: ../resources/modem-manager-gui.ui:2975 msgid "Info" msgstr "Bilgi" #: ../resources/modem-manager-gui.ui:1954 msgid "Scan existing mobile networks CTRL+F5" msgstr "" #: ../resources/modem-manager-gui.ui:1956 #: ../resources/modem-manager-gui.ui:3125 msgid "Scan" msgstr "Tara" #: ../resources/modem-manager-gui.ui:1970 msgid "Monitor network traffic CTRL+F6" msgstr "" #: ../resources/modem-manager-gui.ui:1986 msgid "View system and modem addressbooks CTRL+F7" msgstr "" #: ../resources/modem-manager-gui.ui:1988 #: ../resources/modem-manager-gui.ui:3455 msgid "Contacts" msgstr "" #: ../resources/modem-manager-gui.ui:2041 msgid "No devices found in system" msgstr "Sistemde hiçbir aygıt bulunamadı" #: ../resources/modem-manager-gui.ui:2210 msgid "Send new SMS message CTRL+N" msgstr "" #: ../resources/modem-manager-gui.ui:2212 msgid "New" msgstr "Yeni" #: ../resources/modem-manager-gui.ui:2226 msgid "Remove selected message CTRL+D" msgstr "" #: ../resources/modem-manager-gui.ui:2228 msgid "Remove" msgstr "Kaldır" #: ../resources/modem-manager-gui.ui:2242 msgid "Answer selected message CTRL+A" msgstr "" #: ../resources/modem-manager-gui.ui:2244 msgid "Answer" msgstr "Cevapla" #: ../resources/modem-manager-gui.ui:2340 msgid "Request" msgstr "İstek" #: ../resources/modem-manager-gui.ui:2378 msgid "Send ussd request CTRL+S" msgstr "" #: ../resources/modem-manager-gui.ui:2398 msgid "Edit USSD commands list CTRL+E" msgstr "" #: ../resources/modem-manager-gui.ui:2600 msgid "IMEI" msgstr "IMEI" #: ../resources/modem-manager-gui.ui:2627 msgid "IMSI/ESN" msgstr "IMSI/ESN" #: ../resources/modem-manager-gui.ui:2658 msgid "Equipment" msgstr "" #: ../resources/modem-manager-gui.ui:2732 msgid "Mode" msgstr "Mod" #: ../resources/modem-manager-gui.ui:2760 msgid "Signal level" msgstr "Sinyal seviyesi" #: ../resources/modem-manager-gui.ui:2774 msgid "Operator code" msgstr "" #: ../resources/modem-manager-gui.ui:2801 msgid "Registration" msgstr "" #: ../resources/modem-manager-gui.ui:2846 msgid "Network" msgstr "" #: ../resources/modem-manager-gui.ui:2892 msgid "" "3GPP Location\n" "MCC/MNC/LAC/CID" msgstr "" #: ../resources/modem-manager-gui.ui:2908 msgid "" "GPS location\n" "Longitude/Latiude" msgstr "" #: ../resources/modem-manager-gui.ui:2955 msgid "Location" msgstr "" #: ../resources/modem-manager-gui.ui:3021 msgid "Scan available mobile networks CTRL+S" msgstr "" #: ../resources/modem-manager-gui.ui:3023 msgid "Start scan" msgstr "Taramayı başlat" #: ../resources/modem-manager-gui.ui:3145 msgid "Set traffic amount or time limit for disconnect CTRL+L" msgstr "" #: ../resources/modem-manager-gui.ui:3147 msgid "Set limit" msgstr "Sınır koy" #: ../resources/modem-manager-gui.ui:3161 msgid "View list of active network connections CTRL+C" msgstr "" #: ../resources/modem-manager-gui.ui:3163 msgid "Connections" msgstr "Bağlantılar" #: ../resources/modem-manager-gui.ui:3177 msgid "View daily traffic statistics CTRL+S" msgstr "" #: ../resources/modem-manager-gui.ui:3179 msgid "Statistics" msgstr "" #: ../resources/modem-manager-gui.ui:3230 msgid "Transmission speed" msgstr "Aktarım hızı" #: ../resources/modem-manager-gui.ui:3364 msgid "Add new contact to modem addressbook CTRL+N" msgstr "" #: ../resources/modem-manager-gui.ui:3380 msgid "Remove contact from modem addressbook CTRL+D" msgstr "" #: ../resources/modem-manager-gui.ui:3382 msgid "Remove contact" msgstr "" #: ../resources/modem-manager-gui.ui:3406 msgid "Send SMS message to selected contact CTRL+S" msgstr "" #: ../resources/modem-manager-gui.ui:3408 msgid "Send SMS" msgstr "" #: manual addition msgid "Show message" msgstr "İleti göster" #: manual addition msgid "Disconnect" msgstr "Bağlantıyı kes" #: manual addition msgid "Hours" msgstr "Saat" #: manual addition msgid "Minutes" msgstr "Dakika" #: manual addition msgid "Mb" msgstr "Mb" #: manual addition msgid "Gb" msgstr "Gb" #: manual addition msgid "Tb" msgstr "Tb" #: manual addition msgid "January" msgstr "" #: manual addition msgid "February" msgstr "" #: manual addition msgid "March" msgstr "" #: manual addition msgid "April" msgstr "" #: manual addition msgid "May" msgstr "" #: manual addition msgid "June" msgstr "" #: manual addition msgid "July" msgstr "" #: manual addition msgid "August" msgstr "" #: manual addition msgid "September" msgstr "" #: manual addition msgid "October" msgstr "" #: manual addition msgid "November" msgstr "" #: manual addition msgid "December" msgstr "" modem-manager-gui-0.0.16/po/uk.po000066400000000000000000000747101217271411700165020ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # # Translators: # Игорь Гриценко , 2012 # Роман Лепіш , 2012 msgid "" msgstr "" "Project-Id-Version: Modem Manager GUI\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2013-07-11 23:22+0400\n" "PO-Revision-Date: 2013-07-11 19:33+0000\n" "Last-Translator: ethereal \n" "Language-Team: Ukrainian (http://www.transifex.com/projects/p/modem-manager-gui/language/uk/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: uk\n" "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" #: ../src/ayatana.c:129 msgid "Unread SMS" msgstr "" #: ../src/ayatana.c:300 msgid "Unread messages" msgstr "" #: ../src/main.c:667 ../src/main.c:3372 ../src/main.c:4297 msgid "Error sending message" msgstr "Помилка відправлення повідомлення" #: ../src/main.c:738 msgid "Operation timed out" msgstr "" #: ../src/main.c:738 msgid "Operation took too long to execute. Please restart it." msgstr "" #: ../src/main.c:1083 msgid "Modem must be enabled to read SMS. Enable modem?" msgstr "Модем має бути активовним для читання SMS. Ввімкнути модем?" #: ../src/main.c:1084 msgid "Modem must be enabled to read and write SMS. Please enable modem." msgstr "" #: ../src/main.c:1085 msgid "" "Modem must be registered in mobile network to receive and send SMS. Please " "wait..." msgstr "" #: ../src/main.c:1086 msgid "Modem must be unlocked to receive and send SMS. Please enter PIN code." msgstr "" #: ../src/main.c:1087 msgid "Modem manager does not support SMS manipulation functions." msgstr "" #: ../src/main.c:1088 msgid "Modem manager does not support sending of SMS messages." msgstr "" #: ../src/main.c:1106 msgid "Modem must be enabled to send USSD. Enable modem?" msgstr "Модем має бути активовним для надсилання USSD. Ввімкнути модем?" #: ../src/main.c:1107 msgid "Modem must be enabled to send USSD. Please enable modem." msgstr "" #: ../src/main.c:1108 msgid "" "Modem must be registered in mobile network to send USSD. Please wait..." msgstr "" #: ../src/main.c:1109 msgid "Modem must be unlocked to send USSD. Please enter PIN code." msgstr "" #: ../src/main.c:1110 msgid "Modem manager does not support sending of USSD requests." msgstr "" #: ../src/main.c:1138 msgid "Modem must be enabled to scan for available networks. Enable modem?" msgstr "Модем має бути активованим для сканування доступних мереж. Активувати модем?" #: ../src/main.c:1139 msgid "" "Modem must be enabled to scan for available networks. Please enable modem." msgstr "" #: ../src/main.c:1141 msgid "" "Modem must be unlocked to scan for available networks. Please enter PIN " "code." msgstr "" #: ../src/main.c:1142 msgid "Modem manager does not support scanning for available mobile networks." msgstr "" #: ../src/main.c:1143 msgid "Modem is connected now. Please disconnect to scan." msgstr "На даний момент модем підключено. Для сканування, будь ласка, від'єднайтесь. " #: ../src/main.c:1175 msgid "Modem must be enabled to export contacts from it. Enable modem?" msgstr "" #: ../src/main.c:1176 msgid "Modem must be enabled to export contacts from it. Please enable modem." msgstr "" #: ../src/main.c:1178 msgid "" "Modem must be unlocked to export contacts from it. Please enter PIN code." msgstr "" #: ../src/main.c:1179 msgid "Modem manager does not support modem contacts manipulation functions." msgstr "" #: ../src/main.c:1180 msgid "Modem manager does not support modem contacts edition functions." msgstr "" #: ../src/main.c:1218 msgid "Enable modem" msgstr "Активувати модем" #: ../src/main.c:1222 ../src/main.c:4731 msgid "Error enabling device" msgstr "Помилка активації модему" #: ../src/main.c:1438 ../src/main.c:1465 msgid "Modem Manager GUI window hidden" msgstr "" #: ../src/main.c:1438 ../src/main.c:1465 msgid "Use tray icon or messaging menu to show window again" msgstr "" #: ../src/main.c:1757 #, c-format msgid "Unread messages: %u" msgstr "" #: ../src/main.c:1760 ../src/main.c:1763 ../src/main.c:5669 msgid "No unread messages" msgstr "Немає нових повідомлень" #: ../src/main.c:2085 msgid "Error adding contact" msgstr "" #: ../src/main.c:2121 msgid "Remove contact" msgstr "" #: ../src/main.c:2121 msgid "Really want to remove contact?" msgstr "" #: ../src/main.c:2125 ../src/main.c:2130 msgid "Error removing contact" msgstr "" #: ../src/main.c:2125 msgid "Contact not removed from device" msgstr "" #: ../src/main.c:2130 msgid "Contact not selected" msgstr "" #: ../src/main.c:2260 ../resources/modem-manager-gui.ui:517 msgid "First name" msgstr "" #: ../src/main.c:2264 ../resources/modem-manager-gui.ui:530 msgid "First number" msgstr "" #: ../src/main.c:2268 ../resources/modem-manager-gui.ui:543 msgid "EMail" msgstr "" #: ../src/main.c:2272 ../resources/modem-manager-gui.ui:556 msgid "Group" msgstr "" #: ../src/main.c:2276 ../resources/modem-manager-gui.ui:570 msgid "Second name" msgstr "" #: ../src/main.c:2280 ../resources/modem-manager-gui.ui:583 msgid "Second number" msgstr "" #: ../src/main.c:2289 msgid "Modem contacts" msgstr "" #: ../src/main.c:2357 ../src/main.c:2410 ../src/main.c:4553 #: ../src/strformat.c:165 ../src/strformat.c:195 ../src/strformat.c:203 #: ../src/strformat.c:211 #, c-format msgid "Unknown" msgstr "Невідомо" #: ../src/main.c:2521 msgid "Day" msgstr "" #: ../src/main.c:2525 msgid "Received data" msgstr "" #: ../src/main.c:2529 msgid "Transmitted data" msgstr "" #: ../src/main.c:2533 msgid "Session time" msgstr "" #: ../src/main.c:2696 msgid "Application" msgstr "Програма" #: ../src/main.c:2700 msgid "PID" msgstr "PID" #: ../src/main.c:2704 msgid "Protocol" msgstr "Протокол" #: ../src/main.c:2708 msgid "State" msgstr "Стан" #: ../src/main.c:2712 msgid "Buffer" msgstr "Буфер" #: ../src/main.c:2716 msgid "Port" msgstr "Порт" #: ../src/main.c:2720 msgid "Destination" msgstr "Адреса призначення" #: ../src/main.c:2746 msgid "Traffic limit exceeded" msgstr "Перевищено обмеження трафіку" #: ../src/main.c:2750 msgid "Time limit exceeded" msgstr "Перевищений обмеження часу" #: ../src/main.c:2927 #, c-format msgid "" "Traffic: %s, limit set to: %s\n" "Time: %s, limit set to: %s\n" "Please check entered values and try once more" msgstr "Трафік: %s, обмеження: %s\nЧас: %s, обмеження: %s\nБудь ласка, перевірте введені дані та спробуйте ще раз" #: ../src/main.c:2932 msgid "Wrong traffic and time limit values" msgstr "Некоректні обмеження трафіка та часу" #: ../src/main.c:2935 #, c-format msgid "" "Traffic: %s, limit set to: %s\n" "Please check entered values and try once more" msgstr "Трафік: %s, обмеження: %s\nБудь ласка, перевірте введені дані та спробуйте ще раз" #: ../src/main.c:2938 msgid "Wrong traffic limit value" msgstr "Некоректне обмеження трафіку" #: ../src/main.c:2941 #, c-format msgid "" "Time: %s, limit set to: %s\n" "Please check entered values and try once more" msgstr "Час: %s, обмеження: %s\nБудь ласка, перевірте введені дані та спробуйте ще раз" #: ../src/main.c:2944 msgid "Wrong time limit value" msgstr "Некоректне обмеження часу сесії" #: ../src/main.c:2981 #, c-format msgid "%s disconnected" msgstr "%s відключений" #: ../src/main.c:3055 ../src/main.c:3079 ../src/main.c:3103 msgid "Disconnected" msgstr "Відключений" #: ../src/main.c:3067 ../src/main.c:3073 ../src/main.c:3091 ../src/main.c:3097 msgid "Limit" msgstr "Обмеження" #: ../src/main.c:3070 ../src/main.c:3076 ../src/main.c:3094 ../src/main.c:3100 msgid "Disabled" msgstr "Відключено" #: ../src/main.c:3232 msgid "kbps" msgstr "КБіт/с" #: ../src/main.c:3242 msgid "sec" msgstr "сек" #: ../src/main.c:3296 msgid "RX speed" msgstr "Приймання" #: ../src/main.c:3315 msgid "TX speed" msgstr "Передача" #: ../src/main.c:3330 msgid "Parameter" msgstr "Параметр" #: ../src/main.c:3335 msgid "Value" msgstr "Значення" #: ../src/main.c:3341 msgid "Received data" msgstr "Отримані дані" #: ../src/main.c:3344 msgid "Transmitted data" msgstr "Передані дані" #: ../src/main.c:3347 msgid "Receive speed" msgstr "Швидкість отримання" #: ../src/main.c:3350 msgid "Transmit speed" msgstr "Швидкість віддачі" #: ../src/main.c:3353 msgid "Session time" msgstr "Час сесії" #: ../src/main.c:3356 msgid "Traffic left" msgstr "Залишок трафіку" #: ../src/main.c:3359 msgid "Time left" msgstr "Залишок часу" #: ../src/main.c:3372 msgid "Device error" msgstr "Помилка пристрою" #: ../src/main.c:3399 #, c-format msgid "" "%s\n" "%s ID: %u Availability: %s Access tech: %s" msgstr "%s\n%s ID: %u Доступність: %s Стандарт: %s" #: ../src/main.c:3435 msgid "Error scanning networks" msgstr "Помилка сканування мережі" #: ../src/main.c:3449 ../resources/modem-manager-gui.ui:2704 msgid "Operator" msgstr "Оператор" #: ../src/main.c:3495 ../src/main.c:3502 ../src/main.c:3554 ../src/main.c:3562 msgid "Not supported" msgstr "" #: ../src/main.c:3584 msgid "Sample command" msgstr "Стандартна команда" #: ../src/main.c:3790 ../src/main.c:3803 msgid "" "USSD request is not valid\n" "Request must be 160 symbols long\n" "started with '*' and ended with '#'" msgstr "Запит не коректний.\n Запит не повинен містити більше 160 символів\n,повинен починатись з '*' і закінчуватись '#'" #: ../src/main.c:3880 ../src/main.c:3883 ../src/main.c:3886 ../src/main.c:3920 msgid "Error sending USSD" msgstr "Помилка надсилання запиту USSD" #: ../src/main.c:3880 msgid "Wrong USSD request or device not ready" msgstr "Неправильний запит USSD або пристрій не готовий" #: ../src/main.c:3883 msgid "USSD session terminated. You can send new request" msgstr "Сесію USSD завершено. Ви можете відправити новий запит" #: ../src/main.c:3886 msgid "Wrong USSD request" msgstr "Некоректний запит USSD" #: ../src/main.c:3909 msgid "" "\n" "USSD session is active. Waiting for your input...\n" msgstr "\n Сесія USSD активна. Очікується відповідь...\n" #: ../src/main.c:3970 msgid "Command" msgstr "Команда" #: ../src/main.c:3976 msgid "Description" msgstr "Опис" #: ../src/main.c:4045 #, c-format msgid "Received %u new SMS messages" msgstr "Прийнято %u нових повідомлень SMS" #: ../src/main.c:4047 ../src/main.c:4116 msgid "Received new SMS message" msgstr "Прийнято нове повідомлення SMS" #: ../src/main.c:4051 msgid "Message senders: " msgstr "Повідомлення від:" #: ../src/main.c:4177 msgid "" "SMS number is not valid\n" "Only numbers from 2 to 20 digits without\n" "letters and symbols can be used" msgstr "Невірний номер для відправки SMS\nЛише номери від 2 до 20 цифр без літер та символів можуть бути використані" #: ../src/main.c:4179 msgid "" "SMS text is not valid\n" "Please write some text to send" msgstr "Текст SMS некоректний\nНаберіть більше тексту для відправки" #: ../src/main.c:4297 msgid "Wrong number or device not ready" msgstr "Невірний номер чи неготовність пристрою" #: ../src/main.c:4345 msgid "Remove message" msgstr "Видалення повідомлення" #: ../src/main.c:4345 msgid "Really want to remove message?" msgstr "Дійсно хочете видалити повідомлення?" #: ../src/main.c:4351 ../src/main.c:4356 msgid "Error removing SMS" msgstr "Помилка видалення SMS" #: ../src/main.c:4351 msgid "Message not found" msgstr "Повідомлення не знайдено" #: ../src/main.c:4356 msgid "Message not selected" msgstr "Повідомлення не вибрано" #: ../src/main.c:4508 msgid "This message can't be read" msgstr "Це повідомлення неможливо прочитати" #: ../src/main.c:4514 msgid "" "This is folder for your incoming SMS messages.\n" "You can answer selected message using 'Answer' button." msgstr "Цей каталог містить ваші вхідні повідомлення SMS.\n Ви можете відповісти на повідомлення з допомогою кнопки 'Відповідь'." #: ../src/main.c:4517 msgid "This is folder for your sent SMS messages." msgstr "Цей каталог містить ваші вихідні повідомлення SMS." #: ../src/main.c:4520 msgid "" "This is folder for your SMS message drafts.\n" "Select message and click 'Answer' button to start editing." msgstr "Цей каталог містить чернетки ваших повідомлень SMS.\n Виберіть повідомлення і натисніть кнопку 'Відповідь' для початку редагування." #: ../src/main.c:4556 #, c-format msgid "" "%s\n" "%s" msgstr "%s\n %s" #: ../src/main.c:4611 msgid "" "Incoming\n" "Incoming messages" msgstr "Вхідні \n Прийняті повідомлення" #: ../src/main.c:4612 msgid "" "Sent\n" "Sent messages" msgstr "b> Вихідні \n Відправлені повідомлення" #: ../src/main.c:4613 msgid "" "Drafts\n" "Message drafts" msgstr "Чернетки\n Чернетки повідомлень " #: ../src/main.c:4690 ../resources/modem-manager-gui.ui:1908 #: ../resources/modem-manager-gui.ui:2321 msgid "SMS" msgstr "SMS" #: ../src/main.c:4959 msgid "Error opening device" msgstr "Помилка відкриття пристрою" #: ../src/main.c:5105 #, c-format msgid "" "%s %s\n" "Version:%s Port:%s Type:%s" msgstr "%s%s\nПрошивка:%s Порт:%s Тип:%s" #: ../src/main.c:5154 msgid "Selected" msgstr "Вибране" #: ../src/main.c:5159 ../resources/modem-manager-gui.ui:2572 msgid "Device" msgstr "Пристрій" #: ../src/main.c:5215 msgid "GNOME contacts" msgstr "" #: ../src/main.c:5222 msgid "KDE contacts" msgstr "" #: ../src/main.c:5277 msgid "Traffic limit exceeded... It's time to take rest \\(^_^)/" msgstr "Перевищено обмеження трафіку ... Прийшов час відпочити \\(^_^)/" #: ../src/main.c:5300 msgid "Time limit exceeded... Go sleep and have nice dreams -_-" msgstr "Перевищено обмеження часу...... Приємних снів -_-" #: ../src/main.c:5673 msgid "Show window" msgstr "Показати вікно" #: ../src/main.c:5680 msgid "New SMS" msgstr "Написати SMS" #: ../src/main.c:5741 ../resources/modem-manager-gui.ui:761 msgid "Preferences" msgstr "Налаштування" #: ../src/main.c:5743 ../resources/modem-manager-gui.ui:7 msgid "About" msgstr "Про програму" #: ../src/main.c:5745 msgid "Quit" msgstr "" #: ../src/main.c:5776 ../src/main.c:5813 msgid "Error while initialization" msgstr "" #: ../src/main.c:5776 msgid "No one modem manager is available" msgstr "" #: ../src/main.c:5813 msgid "Interface building error" msgstr "" #: ../src/main.c:5860 #, c-format msgid "Segmentation fault at address: %p\n" msgstr "" #: ../src/main.c:5863 msgid "Stack trace:\n" msgstr "" #: ../src/main.c:5890 msgid "Do not show window on start" msgstr "" #: ../src/main.c:5920 msgid "- tool for EDGE/3G/4G modem specific functions control" msgstr "" #: ../src/main.c:5927 #, c-format msgid "Command line option parsing failed: %s\n" msgstr "" #: ../src/strformat.c:39 #, c-format msgid "%.3f kbps" msgstr "%.3f КБіт/с" #: ../src/strformat.c:41 #, c-format msgid "%.3f kbps" msgstr "%.3f КБіт/с" #: ../src/strformat.c:46 #, c-format msgid "%.3g Mbps" msgstr "%.3g МБіт/с" #: ../src/strformat.c:48 #, c-format msgid "%.3g Mbps" msgstr "%.3g МБіт/с" #: ../src/strformat.c:53 #, c-format msgid "%.3g Gbps" msgstr "%.3g ГБіт/с" #: ../src/strformat.c:55 #, c-format msgid "%.3g Gbps" msgstr "%.3g ГБіт/с" #: ../src/strformat.c:87 #, c-format msgid "%u sec" msgstr "%u сек" #: ../src/strformat.c:89 #, c-format msgid "%u sec" msgstr "%u сек" #: ../src/strformat.c:93 #, c-format msgid "%s:%s" msgstr "%s:%s" #: ../src/strformat.c:95 #, c-format msgid "%s:%s" msgstr "%s:%s" #: ../src/strformat.c:99 #, c-format msgid "%s:%s:%s" msgstr "%s:%s:%s" #: ../src/strformat.c:101 #, c-format msgid "%s:%s:%s" msgstr "%s:%s:%s" #: ../src/strformat.c:105 #, c-format msgid "%lu day(s) %s:%s:%s" msgstr "" #: ../src/strformat.c:107 #, c-format msgid "%lu day(s) %s:%s:%s" msgstr "" #: ../src/strformat.c:124 #, c-format msgid "%u" msgstr "%u" #: ../src/strformat.c:126 #, c-format msgid "%u" msgstr "%u" #: ../src/strformat.c:131 #, c-format msgid "%.3g Kb" msgstr "%.3g КБ" #: ../src/strformat.c:133 #, c-format msgid "%.3g Kb" msgstr "%.3g КБ" #: ../src/strformat.c:138 #, c-format msgid "%.3g Mb" msgstr "%.3g МБ" #: ../src/strformat.c:140 #, c-format msgid "%.3g Mb" msgstr "%.3g МБ" #: ../src/strformat.c:145 #, c-format msgid "%.3g Gb" msgstr "%.3g ГБ" #: ../src/strformat.c:147 #, c-format msgid "%.3g Gb" msgstr "%.3g ГБ" #: ../src/strformat.c:152 #, c-format msgid "%.3g Tb" msgstr "%.3g ТБ" #: ../src/strformat.c:154 #, c-format msgid "%.3g Tb" msgstr "%.3g ТБ" #: ../src/strformat.c:205 msgid "Available" msgstr "" #: ../src/strformat.c:207 msgid "Current" msgstr "" #: ../src/strformat.c:209 msgid "Forbidden" msgstr "" #: ../src/strformat.c:241 msgid "Not registered" msgstr "" #: ../src/strformat.c:243 msgid "Home network" msgstr "" #: ../src/strformat.c:245 msgid "Searching" msgstr "" #: ../src/strformat.c:247 msgid "Registration denied" msgstr "" #: ../src/strformat.c:249 ../src/strformat.c:253 msgid "Unknown status" msgstr "" #: ../src/strformat.c:251 msgid "Roaming network" msgstr "" #: ../resources/modem-manager-gui.ui:17 msgid "Copyright 2012-2013 Alex" msgstr "" #: ../resources/modem-manager-gui.ui:18 msgid "Tool for EDGE/3G/4G modem specific functions control" msgstr "Інструмент для керування специфічними функціями EDGE/3G/4G модемів" #: ../resources/modem-manager-gui.ui:20 msgid "Homepage" msgstr "Домашня сторінка" #: ../resources/modem-manager-gui.ui:21 msgid "GPL3" msgstr "GPL3" #: ../resources/modem-manager-gui.ui:23 msgid "English: Alex " msgstr "Українською: \n Игорь Гриценко , 2012.\n Роман Лепіш , 2012" #: ../resources/modem-manager-gui.ui:55 msgid "Active connections" msgstr "Активні з'єднання" #: ../resources/modem-manager-gui.ui:111 msgid "Terminate selected application using SIGTERM signal CTRL+T" msgstr "" #: ../resources/modem-manager-gui.ui:113 msgid "Terminate application" msgstr "Закрити програму" #: ../resources/modem-manager-gui.ui:167 msgid "Error" msgstr "Помилка" #: ../resources/modem-manager-gui.ui:282 msgid "Ask me again" msgstr "" #: ../resources/modem-manager-gui.ui:302 msgid "Quit or minimize?" msgstr "" #: ../resources/modem-manager-gui.ui:316 msgid "What do you want application to do on window close?" msgstr "" #: ../resources/modem-manager-gui.ui:327 msgid "Just quit" msgstr "" #: ../resources/modem-manager-gui.ui:344 msgid "Minimize to tray or messaging menu" msgstr "" #: ../resources/modem-manager-gui.ui:378 #: ../resources/modem-manager-gui.ui:3366 msgid "New contact" msgstr "" #: ../resources/modem-manager-gui.ui:611 msgid "New SMS message" msgstr "Нове SMS повідомлення" #: ../resources/modem-manager-gui.ui:657 #: ../resources/modem-manager-gui.ui:2374 msgid "Send" msgstr "Надіслати" #: ../resources/modem-manager-gui.ui:693 msgid "Number" msgstr "Номер" #: ../resources/modem-manager-gui.ui:838 msgid "Concatenate messages" msgstr "Об'єднати повідомлення" #: ../resources/modem-manager-gui.ui:853 msgid "Expand folders" msgstr "Розгорнути папки" #: ../resources/modem-manager-gui.ui:868 msgid "Place old messages on top" msgstr "" #: ../resources/modem-manager-gui.ui:889 msgid "SMS" msgstr "SMS" #: ../resources/modem-manager-gui.ui:947 msgid "RX Speed graph color" msgstr "Швидкість прийому" #: ../resources/modem-manager-gui.ui:962 msgid "TX Speed graph color" msgstr "Швидкість передачі" #: ../resources/modem-manager-gui.ui:979 msgid "Traffic" msgstr "Трафік" #: ../resources/modem-manager-gui.ui:1008 msgid "Use sounds for events" msgstr "" #: ../resources/modem-manager-gui.ui:1023 msgid "Hide window to tray on close" msgstr "" #: ../resources/modem-manager-gui.ui:1038 msgid "Save window geometry and placement" msgstr "" #: ../resources/modem-manager-gui.ui:1059 msgid "Behaviour" msgstr "" #: ../resources/modem-manager-gui.ui:1087 msgid "Progress" msgstr "Прогрес" #: ../resources/modem-manager-gui.ui:1142 msgid "Executing command" msgstr "Виконується команда" #: ../resources/modem-manager-gui.ui:1181 msgid "Question" msgstr "Питання" #: ../resources/modem-manager-gui.ui:1234 msgid "Traffic limits" msgstr "Обмеження" #: ../resources/modem-manager-gui.ui:1296 msgid "Eanble traffic limit" msgstr "Включити обмеження трафіку" #: ../resources/modem-manager-gui.ui:1312 msgid "Enable time limit" msgstr "Включити обмеження часу" #: ../resources/modem-manager-gui.ui:1330 #: ../resources/modem-manager-gui.ui:1972 #: ../resources/modem-manager-gui.ui:3271 msgid "Traffic" msgstr "Трафік" #: ../resources/modem-manager-gui.ui:1376 #: ../resources/modem-manager-gui.ui:1478 msgid "Message" msgstr "Повідомлення" #: ../resources/modem-manager-gui.ui:1402 #: ../resources/modem-manager-gui.ui:1504 msgid "Action" msgstr "Дія" #: ../resources/modem-manager-gui.ui:1433 msgid "Time" msgstr "Час" #: ../resources/modem-manager-gui.ui:1548 msgid "Traffic statistics" msgstr "" #: ../resources/modem-manager-gui.ui:1608 msgid "Selected statistics period" msgstr "" #: ../resources/modem-manager-gui.ui:1773 msgid "Add new USSD command CTRL+N" msgstr "" #: ../resources/modem-manager-gui.ui:1775 msgid "Add" msgstr "Додати" #: ../resources/modem-manager-gui.ui:1789 msgid "Remove selected USSD command CTRL+D" msgstr "" #: ../resources/modem-manager-gui.ui:1791 msgid "Delete" msgstr "Вилучити" #: ../resources/modem-manager-gui.ui:1815 msgid "" "Force USSD answer encoding change from GSM7 to UCS2 (useful for Huawei " "modems) CTRL+E" msgstr "" #: ../resources/modem-manager-gui.ui:1817 msgid "Change message encoding" msgstr "" #: ../resources/modem-manager-gui.ui:1871 msgid "Modem Manager GUI" msgstr "Modem Manager GUI" #: ../resources/modem-manager-gui.ui:1890 msgid "View and select available devices CTRL+F1" msgstr "" #: ../resources/modem-manager-gui.ui:1892 #: ../resources/modem-manager-gui.ui:2117 msgid "Devices" msgstr "Пристрої" #: ../resources/modem-manager-gui.ui:1906 msgid "Send and receive SMS messages CTRL+F2" msgstr "" #: ../resources/modem-manager-gui.ui:1922 msgid "Send USSD requests CTRL+F3" msgstr "" #: ../resources/modem-manager-gui.ui:1924 #: ../resources/modem-manager-gui.ui:2523 msgid "USSD" msgstr "USSD" #: ../resources/modem-manager-gui.ui:1938 msgid "View active device information CTRL+F4" msgstr "" #: ../resources/modem-manager-gui.ui:1940 #: ../resources/modem-manager-gui.ui:2975 msgid "Info" msgstr "Статус" #: ../resources/modem-manager-gui.ui:1954 msgid "Scan existing mobile networks CTRL+F5" msgstr "" #: ../resources/modem-manager-gui.ui:1956 #: ../resources/modem-manager-gui.ui:3125 msgid "Scan" msgstr "Мережі" #: ../resources/modem-manager-gui.ui:1970 msgid "Monitor network traffic CTRL+F6" msgstr "" #: ../resources/modem-manager-gui.ui:1986 msgid "View system and modem addressbooks CTRL+F7" msgstr "" #: ../resources/modem-manager-gui.ui:1988 #: ../resources/modem-manager-gui.ui:3455 msgid "Contacts" msgstr "" #: ../resources/modem-manager-gui.ui:2041 msgid "No devices found in system" msgstr "В системі не знайдено пристрою" #: ../resources/modem-manager-gui.ui:2210 msgid "Send new SMS message CTRL+N" msgstr "" #: ../resources/modem-manager-gui.ui:2212 msgid "New" msgstr "Нове повідомлення" #: ../resources/modem-manager-gui.ui:2226 msgid "Remove selected message CTRL+D" msgstr "" #: ../resources/modem-manager-gui.ui:2228 msgid "Remove" msgstr "Видалити повідомлення" #: ../resources/modem-manager-gui.ui:2242 msgid "Answer selected message CTRL+A" msgstr "" #: ../resources/modem-manager-gui.ui:2244 msgid "Answer" msgstr "Відповідь" #: ../resources/modem-manager-gui.ui:2340 msgid "Request" msgstr "Запит" #: ../resources/modem-manager-gui.ui:2378 msgid "Send ussd request CTRL+S" msgstr "" #: ../resources/modem-manager-gui.ui:2398 msgid "Edit USSD commands list CTRL+E" msgstr "" #: ../resources/modem-manager-gui.ui:2600 msgid "IMEI" msgstr "IMEI" #: ../resources/modem-manager-gui.ui:2627 msgid "IMSI/ESN" msgstr "IMSI/ESN" #: ../resources/modem-manager-gui.ui:2658 msgid "Equipment" msgstr "" #: ../resources/modem-manager-gui.ui:2732 msgid "Mode" msgstr "Стандарт" #: ../resources/modem-manager-gui.ui:2760 msgid "Signal level" msgstr "Рівень сигналу" #: ../resources/modem-manager-gui.ui:2774 msgid "Operator code" msgstr "" #: ../resources/modem-manager-gui.ui:2801 msgid "Registration" msgstr "" #: ../resources/modem-manager-gui.ui:2846 msgid "Network" msgstr "" #: ../resources/modem-manager-gui.ui:2892 msgid "" "3GPP Location\n" "MCC/MNC/LAC/CID" msgstr "" #: ../resources/modem-manager-gui.ui:2908 msgid "" "GPS location\n" "Longitude/Latiude" msgstr "" #: ../resources/modem-manager-gui.ui:2955 msgid "Location" msgstr "" #: ../resources/modem-manager-gui.ui:3021 msgid "Scan available mobile networks CTRL+S" msgstr "" #: ../resources/modem-manager-gui.ui:3023 msgid "Start scan" msgstr "Розпочати сканування мереж" #: ../resources/modem-manager-gui.ui:3145 msgid "Set traffic amount or time limit for disconnect CTRL+L" msgstr "" #: ../resources/modem-manager-gui.ui:3147 msgid "Set limit" msgstr "Застосувати обмеження" #: ../resources/modem-manager-gui.ui:3161 msgid "View list of active network connections CTRL+C" msgstr "" #: ../resources/modem-manager-gui.ui:3163 msgid "Connections" msgstr "З'єднання" #: ../resources/modem-manager-gui.ui:3177 msgid "View daily traffic statistics CTRL+S" msgstr "" #: ../resources/modem-manager-gui.ui:3179 msgid "Statistics" msgstr "" #: ../resources/modem-manager-gui.ui:3230 msgid "Transmission speed" msgstr "Швидкість передачі даних" #: ../resources/modem-manager-gui.ui:3364 msgid "Add new contact to modem addressbook CTRL+N" msgstr "" #: ../resources/modem-manager-gui.ui:3380 msgid "Remove contact from modem addressbook CTRL+D" msgstr "" #: ../resources/modem-manager-gui.ui:3382 msgid "Remove contact" msgstr "" #: ../resources/modem-manager-gui.ui:3406 msgid "Send SMS message to selected contact CTRL+S" msgstr "" #: ../resources/modem-manager-gui.ui:3408 msgid "Send SMS" msgstr "" #: manual addition msgid "Show message" msgstr "Показати повідомлення" #: manual addition msgid "Disconnect" msgstr "Розірвати з'єднання" #: manual addition msgid "Hours" msgstr "Години" #: manual addition msgid "Minutes" msgstr "Хвилини" #: manual addition msgid "Mb" msgstr "МБ" #: manual addition msgid "Gb" msgstr "ГБ" #: manual addition msgid "Tb" msgstr "ТБ" #: manual addition msgid "January" msgstr "" #: manual addition msgid "February" msgstr "" #: manual addition msgid "March" msgstr "" #: manual addition msgid "April" msgstr "" #: manual addition msgid "May" msgstr "" #: manual addition msgid "June" msgstr "" #: manual addition msgid "July" msgstr "" #: manual addition msgid "August" msgstr "" #: manual addition msgid "September" msgstr "" #: manual addition msgid "October" msgstr "" #: manual addition msgid "November" msgstr "" #: manual addition msgid "December" msgstr "" modem-manager-gui-0.0.16/po/uz.po000066400000000000000000000707271217271411700165250ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # # Translators: # Umidjon Almasov , 2012-2013 msgid "" msgstr "" "Project-Id-Version: Modem Manager GUI\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2013-07-11 23:22+0400\n" "PO-Revision-Date: 2013-07-11 19:33+0000\n" "Last-Translator: ethereal \n" "Language-Team: Uzbek (http://www.transifex.com/projects/p/modem-manager-gui/language/uz/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: uz\n" "Plural-Forms: nplurals=1; plural=0;\n" #: ../src/ayatana.c:129 msgid "Unread SMS" msgstr "" #: ../src/ayatana.c:300 msgid "Unread messages" msgstr "" #: ../src/main.c:667 ../src/main.c:3372 ../src/main.c:4297 msgid "Error sending message" msgstr "Xabar yuborish xatosi" #: ../src/main.c:738 msgid "Operation timed out" msgstr "" #: ../src/main.c:738 msgid "Operation took too long to execute. Please restart it." msgstr "" #: ../src/main.c:1083 msgid "Modem must be enabled to read SMS. Enable modem?" msgstr "SMS o'qish uchun modemni faollashtirish kerak. Modem faollashtirilsinmi?" #: ../src/main.c:1084 msgid "Modem must be enabled to read and write SMS. Please enable modem." msgstr "" #: ../src/main.c:1085 msgid "" "Modem must be registered in mobile network to receive and send SMS. Please " "wait..." msgstr "" #: ../src/main.c:1086 msgid "Modem must be unlocked to receive and send SMS. Please enter PIN code." msgstr "" #: ../src/main.c:1087 msgid "Modem manager does not support SMS manipulation functions." msgstr "" #: ../src/main.c:1088 msgid "Modem manager does not support sending of SMS messages." msgstr "" #: ../src/main.c:1106 msgid "Modem must be enabled to send USSD. Enable modem?" msgstr "USSD yuborish uchun modemni faollashtirish kerak. Modem faollashtirilsinmi?" #: ../src/main.c:1107 msgid "Modem must be enabled to send USSD. Please enable modem." msgstr "" #: ../src/main.c:1108 msgid "" "Modem must be registered in mobile network to send USSD. Please wait..." msgstr "" #: ../src/main.c:1109 msgid "Modem must be unlocked to send USSD. Please enter PIN code." msgstr "" #: ../src/main.c:1110 msgid "Modem manager does not support sending of USSD requests." msgstr "" #: ../src/main.c:1138 msgid "Modem must be enabled to scan for available networks. Enable modem?" msgstr "Mavjud bo'lgan tarmoqlarni izlash uchun modemni faollashtirish kerak. Modem faollashtirilsinmi?" #: ../src/main.c:1139 msgid "" "Modem must be enabled to scan for available networks. Please enable modem." msgstr "" #: ../src/main.c:1141 msgid "" "Modem must be unlocked to scan for available networks. Please enter PIN " "code." msgstr "" #: ../src/main.c:1142 msgid "Modem manager does not support scanning for available mobile networks." msgstr "" #: ../src/main.c:1143 msgid "Modem is connected now. Please disconnect to scan." msgstr "Modem xozir ulangan. Tarmoqlarni izlash uchun uzib qo'ying." #: ../src/main.c:1175 msgid "Modem must be enabled to export contacts from it. Enable modem?" msgstr "" #: ../src/main.c:1176 msgid "Modem must be enabled to export contacts from it. Please enable modem." msgstr "" #: ../src/main.c:1178 msgid "" "Modem must be unlocked to export contacts from it. Please enter PIN code." msgstr "" #: ../src/main.c:1179 msgid "Modem manager does not support modem contacts manipulation functions." msgstr "" #: ../src/main.c:1180 msgid "Modem manager does not support modem contacts edition functions." msgstr "" #: ../src/main.c:1218 msgid "Enable modem" msgstr "Modemni yoqish" #: ../src/main.c:1222 ../src/main.c:4731 msgid "Error enabling device" msgstr "Uskuna faollashtirish xatosi" #: ../src/main.c:1438 ../src/main.c:1465 msgid "Modem Manager GUI window hidden" msgstr "" #: ../src/main.c:1438 ../src/main.c:1465 msgid "Use tray icon or messaging menu to show window again" msgstr "" #: ../src/main.c:1757 #, c-format msgid "Unread messages: %u" msgstr "O'qilmagan xabarlar: %u" #: ../src/main.c:1760 ../src/main.c:1763 ../src/main.c:5669 msgid "No unread messages" msgstr "O'qilmagan xabarlar yo'q" #: ../src/main.c:2085 msgid "Error adding contact" msgstr "Kontakt qo'shish xatosi" #: ../src/main.c:2121 msgid "Remove contact" msgstr "Kontaktni o'chirish" #: ../src/main.c:2121 msgid "Really want to remove contact?" msgstr "" #: ../src/main.c:2125 ../src/main.c:2130 msgid "Error removing contact" msgstr "Kontakt o'chirish xatosi" #: ../src/main.c:2125 msgid "Contact not removed from device" msgstr "" #: ../src/main.c:2130 msgid "Contact not selected" msgstr "" #: ../src/main.c:2260 ../resources/modem-manager-gui.ui:517 msgid "First name" msgstr "Ismi" #: ../src/main.c:2264 ../resources/modem-manager-gui.ui:530 msgid "First number" msgstr "Birinchi raqam" #: ../src/main.c:2268 ../resources/modem-manager-gui.ui:543 msgid "EMail" msgstr "El. pochta" #: ../src/main.c:2272 ../resources/modem-manager-gui.ui:556 msgid "Group" msgstr "Guruh" #: ../src/main.c:2276 ../resources/modem-manager-gui.ui:570 msgid "Second name" msgstr "Familiyasi" #: ../src/main.c:2280 ../resources/modem-manager-gui.ui:583 msgid "Second number" msgstr "Ikkinchi raqam" #: ../src/main.c:2289 msgid "Modem contacts" msgstr "Modem kontaktlari" #: ../src/main.c:2357 ../src/main.c:2410 ../src/main.c:4553 #: ../src/strformat.c:165 ../src/strformat.c:195 ../src/strformat.c:203 #: ../src/strformat.c:211 #, c-format msgid "Unknown" msgstr "Noma'lum" #: ../src/main.c:2521 msgid "Day" msgstr "Kun" #: ../src/main.c:2525 msgid "Received data" msgstr "Qabul qilingan ma'lumot" #: ../src/main.c:2529 msgid "Transmitted data" msgstr "Jonatilgan ma'lumot" #: ../src/main.c:2533 msgid "Session time" msgstr "" #: ../src/main.c:2696 msgid "Application" msgstr "Dastur" #: ../src/main.c:2700 msgid "PID" msgstr "PID" #: ../src/main.c:2704 msgid "Protocol" msgstr "Protokol" #: ../src/main.c:2708 msgid "State" msgstr "Holat" #: ../src/main.c:2712 msgid "Buffer" msgstr "Bufer" #: ../src/main.c:2716 msgid "Port" msgstr "Port" #: ../src/main.c:2720 msgid "Destination" msgstr "Mo'ljal" #: ../src/main.c:2746 msgid "Traffic limit exceeded" msgstr "Trafik limitidan oshirib yuborildi" #: ../src/main.c:2750 msgid "Time limit exceeded" msgstr "Vaqt limitidan oshirib yuborildi" #: ../src/main.c:2927 #, c-format msgid "" "Traffic: %s, limit set to: %s\n" "Time: %s, limit set to: %s\n" "Please check entered values and try once more" msgstr "Trafik: %s, limit qo'yilgan: %s\nVaqt: %s, limit qo'yilgan: %s\nKiritilgan qiymatlarni tekshiring va qayta o'rinib ko'ring" #: ../src/main.c:2932 msgid "Wrong traffic and time limit values" msgstr "Trafik va vaqt limiti qiymatlari no'to'g'ri" #: ../src/main.c:2935 #, c-format msgid "" "Traffic: %s, limit set to: %s\n" "Please check entered values and try once more" msgstr "Trafik: %s, limit qo'yilgan: %s\nKiritilgan qiymatlarni tekshiring va qayta o'rinib ko'ring" #: ../src/main.c:2938 msgid "Wrong traffic limit value" msgstr "Trafik limiti qiymati noto'g'ri" #: ../src/main.c:2941 #, c-format msgid "" "Time: %s, limit set to: %s\n" "Please check entered values and try once more" msgstr "Vaqt: %s, limit qo'yilgan: %s\nKiritilgan qiymatlarni tekshiring va qayta o'rinib ko'ring" #: ../src/main.c:2944 msgid "Wrong time limit value" msgstr "Vaqt limiti qiymati noto'g'ri" #: ../src/main.c:2981 #, c-format msgid "%s disconnected" msgstr "%s uzilgan" #: ../src/main.c:3055 ../src/main.c:3079 ../src/main.c:3103 msgid "Disconnected" msgstr "Uzilgan" #: ../src/main.c:3067 ../src/main.c:3073 ../src/main.c:3091 ../src/main.c:3097 msgid "Limit" msgstr "Limit" #: ../src/main.c:3070 ../src/main.c:3076 ../src/main.c:3094 ../src/main.c:3100 msgid "Disabled" msgstr "O'chirilgan" #: ../src/main.c:3232 msgid "kbps" msgstr "kb/s" #: ../src/main.c:3242 msgid "sec" msgstr "soniya" #: ../src/main.c:3296 msgid "RX speed" msgstr "Qabul qilish tezligi" #: ../src/main.c:3315 msgid "TX speed" msgstr "Jo'natish tezligi" #: ../src/main.c:3330 msgid "Parameter" msgstr "Parametr" #: ../src/main.c:3335 msgid "Value" msgstr "Qiymati" #: ../src/main.c:3341 msgid "Received data" msgstr "Qabul qilingan" #: ../src/main.c:3344 msgid "Transmitted data" msgstr "Jo'natilgan" #: ../src/main.c:3347 msgid "Receive speed" msgstr "Qabul qilish tezligi" #: ../src/main.c:3350 msgid "Transmit speed" msgstr "Jo'natish tezligi" #: ../src/main.c:3353 msgid "Session time" msgstr "Sessiya vaqti" #: ../src/main.c:3356 msgid "Traffic left" msgstr "Qolgan trafik" #: ../src/main.c:3359 msgid "Time left" msgstr "Qolgan vaqt" #: ../src/main.c:3372 msgid "Device error" msgstr "Uskuna xatosi" #: ../src/main.c:3399 #, c-format msgid "" "%s\n" "%s ID: %u Availability: %s Access tech: %s" msgstr "%s\n%s ID: %u Mavjudligi: %s Standart: %s" #: ../src/main.c:3435 msgid "Error scanning networks" msgstr "Tarmoqlarni izlash xatosi" #: ../src/main.c:3449 ../resources/modem-manager-gui.ui:2704 msgid "Operator" msgstr "Operator" #: ../src/main.c:3495 ../src/main.c:3502 ../src/main.c:3554 ../src/main.c:3562 msgid "Not supported" msgstr "" #: ../src/main.c:3584 msgid "Sample command" msgstr "Buyruq namunasi" #: ../src/main.c:3790 ../src/main.c:3803 msgid "" "USSD request is not valid\n" "Request must be 160 symbols long\n" "started with '*' and ended with '#'" msgstr "USSD so'rovi noto'g'ri\nSo'rov 160 belgilardan oshmasligi,\n'*' bilan boshlanishi va '#' bilan tugashi lozim" #: ../src/main.c:3880 ../src/main.c:3883 ../src/main.c:3886 ../src/main.c:3920 msgid "Error sending USSD" msgstr "USSD yuborish xatosi" #: ../src/main.c:3880 msgid "Wrong USSD request or device not ready" msgstr "USSD so'rovi noto'g'ri yoki uskuna tayyor emas" #: ../src/main.c:3883 msgid "USSD session terminated. You can send new request" msgstr "USSD sessiyasi tugatildi. Yangi so'rov yuborishingiz mumkin" #: ../src/main.c:3886 msgid "Wrong USSD request" msgstr "USSD so'rovi noto'g'ri" #: ../src/main.c:3909 msgid "" "\n" "USSD session is active. Waiting for your input...\n" msgstr "\nUSSD sessiyasi faol. Ma'lumot kiriting...\n" #: ../src/main.c:3970 msgid "Command" msgstr "Buyruq" #: ../src/main.c:3976 msgid "Description" msgstr "Ta'rifi" #: ../src/main.c:4045 #, c-format msgid "Received %u new SMS messages" msgstr "%u yangi SMS xabarlar olindi" #: ../src/main.c:4047 ../src/main.c:4116 msgid "Received new SMS message" msgstr "Yangi SMS xabar olindi" #: ../src/main.c:4051 msgid "Message senders: " msgstr "Xabar yuboruvchilari: " #: ../src/main.c:4177 msgid "" "SMS number is not valid\n" "Only numbers from 2 to 20 digits without\n" "letters and symbols can be used" msgstr "SMS raqami noto'g'ri\nFaqat 2 dan 20 gacha raqamlar ishlatish mumkin,\nxarflar va belgilar ishlatish mumkin emas" #: ../src/main.c:4179 msgid "" "SMS text is not valid\n" "Please write some text to send" msgstr "SMS matni noto'g'ri\nYuborish uchun matn kiriting" #: ../src/main.c:4297 msgid "Wrong number or device not ready" msgstr "Raqam noto'g'ri yoki uskuna tayyor emas" #: ../src/main.c:4345 msgid "Remove message" msgstr "Xabarni o'chirish" #: ../src/main.c:4345 msgid "Really want to remove message?" msgstr "Rostdan xabarni o'chirmoqchimisiz?" #: ../src/main.c:4351 ../src/main.c:4356 msgid "Error removing SMS" msgstr "SMS o'chirish xatosi" #: ../src/main.c:4351 msgid "Message not found" msgstr "Xabar topilmadi" #: ../src/main.c:4356 msgid "Message not selected" msgstr "Xabar tanlanmagan" #: ../src/main.c:4508 msgid "This message can't be read" msgstr "Xabarni o'qib bo'lmadi" #: ../src/main.c:4514 msgid "" "This is folder for your incoming SMS messages.\n" "You can answer selected message using 'Answer' button." msgstr "Ushbu jild kiruvchi SMS xabarlari uchun.\n'Javob berish' tugmasini bosib tanlangan xabarga javob berish mumkin." #: ../src/main.c:4517 msgid "This is folder for your sent SMS messages." msgstr "Ushbu jild yuborilgan SMS xabarlari uchun." #: ../src/main.c:4520 msgid "" "This is folder for your SMS message drafts.\n" "Select message and click 'Answer' button to start editing." msgstr "Ushbu jild dastlabki SMS xabarlar uchun.\nO'zgartirish uchun xabarni tanlang va 'Javob berish' tugmasini bosing." #: ../src/main.c:4556 #, c-format msgid "" "%s\n" "%s" msgstr "%s\n%s" #: ../src/main.c:4611 msgid "" "Incoming\n" "Incoming messages" msgstr "Kiruvchi\nKiruvchi xabarlar" #: ../src/main.c:4612 msgid "" "Sent\n" "Sent messages" msgstr "Yuborilgan\nYuborilgan xabarlar" #: ../src/main.c:4613 msgid "" "Drafts\n" "Message drafts" msgstr "Dastlabki\nDastlabki xabarlar" #: ../src/main.c:4690 ../resources/modem-manager-gui.ui:1908 #: ../resources/modem-manager-gui.ui:2321 msgid "SMS" msgstr "SMS" #: ../src/main.c:4959 msgid "Error opening device" msgstr "Uskuna ochish xatosi" #: ../src/main.c:5105 #, c-format msgid "" "%s %s\n" "Version:%s Port:%s Type:%s" msgstr "%s %s\nVersiya:%s Port:%s Turi:%s" #: ../src/main.c:5154 msgid "Selected" msgstr "Tanlangan" #: ../src/main.c:5159 ../resources/modem-manager-gui.ui:2572 msgid "Device" msgstr "Uskuna" #: ../src/main.c:5215 msgid "GNOME contacts" msgstr "GNOME kontaktlari" #: ../src/main.c:5222 msgid "KDE contacts" msgstr "KDE kontaktlari" #: ../src/main.c:5277 msgid "Traffic limit exceeded... It's time to take rest \\(^_^)/" msgstr "Trafik limiti oshirib yuborildi... Dam olish vaqti keldi \\(^_^)/" #: ../src/main.c:5300 msgid "Time limit exceeded... Go sleep and have nice dreams -_-" msgstr "Vaqt limiti oshirib yuborildi... Uxlang va yaxshi tushlar ko'ring -_-" #: ../src/main.c:5673 msgid "Show window" msgstr "Oynani ko'rsatish" #: ../src/main.c:5680 msgid "New SMS" msgstr "Yangi SMS" #: ../src/main.c:5741 ../resources/modem-manager-gui.ui:761 msgid "Preferences" msgstr "Moslamalar" #: ../src/main.c:5743 ../resources/modem-manager-gui.ui:7 msgid "About" msgstr "Dastur haqida" #: ../src/main.c:5745 msgid "Quit" msgstr "" #: ../src/main.c:5776 ../src/main.c:5813 msgid "Error while initialization" msgstr "" #: ../src/main.c:5776 msgid "No one modem manager is available" msgstr "" #: ../src/main.c:5813 msgid "Interface building error" msgstr "" #: ../src/main.c:5860 #, c-format msgid "Segmentation fault at address: %p\n" msgstr "" #: ../src/main.c:5863 msgid "Stack trace:\n" msgstr "" #: ../src/main.c:5890 msgid "Do not show window on start" msgstr "" #: ../src/main.c:5920 msgid "- tool for EDGE/3G/4G modem specific functions control" msgstr "" #: ../src/main.c:5927 #, c-format msgid "Command line option parsing failed: %s\n" msgstr "" #: ../src/strformat.c:39 #, c-format msgid "%.3f kbps" msgstr "%.3f kb/s" #: ../src/strformat.c:41 #, c-format msgid "%.3f kbps" msgstr "%.3f kb/s" #: ../src/strformat.c:46 #, c-format msgid "%.3g Mbps" msgstr "%.3g Mb/s" #: ../src/strformat.c:48 #, c-format msgid "%.3g Mbps" msgstr "%.3g Mb/s" #: ../src/strformat.c:53 #, c-format msgid "%.3g Gbps" msgstr "%.3g Gb/s" #: ../src/strformat.c:55 #, c-format msgid "%.3g Gbps" msgstr "%.3g Gb/s" #: ../src/strformat.c:87 #, c-format msgid "%u sec" msgstr "%u soniya" #: ../src/strformat.c:89 #, c-format msgid "%u sec" msgstr "%u soniya" #: ../src/strformat.c:93 #, c-format msgid "%s:%s" msgstr "%s:%s" #: ../src/strformat.c:95 #, c-format msgid "%s:%s" msgstr "%s:%s" #: ../src/strformat.c:99 #, c-format msgid "%s:%s:%s" msgstr "%s:%s:%s" #: ../src/strformat.c:101 #, c-format msgid "%s:%s:%s" msgstr "%s:%s:%s" #: ../src/strformat.c:105 #, c-format msgid "%lu day(s) %s:%s:%s" msgstr "" #: ../src/strformat.c:107 #, c-format msgid "%lu day(s) %s:%s:%s" msgstr "" #: ../src/strformat.c:124 #, c-format msgid "%u" msgstr "%u" #: ../src/strformat.c:126 #, c-format msgid "%u" msgstr "%u" #: ../src/strformat.c:131 #, c-format msgid "%.3g Kb" msgstr "%.3g Kb" #: ../src/strformat.c:133 #, c-format msgid "%.3g Kb" msgstr "%.3g Kb" #: ../src/strformat.c:138 #, c-format msgid "%.3g Mb" msgstr "%.3g Mb" #: ../src/strformat.c:140 #, c-format msgid "%.3g Mb" msgstr "%.3g Mb" #: ../src/strformat.c:145 #, c-format msgid "%.3g Gb" msgstr "%.3g Gb" #: ../src/strformat.c:147 #, c-format msgid "%.3g Gb" msgstr "%.3g Gb" #: ../src/strformat.c:152 #, c-format msgid "%.3g Tb" msgstr "%.3g Tb" #: ../src/strformat.c:154 #, c-format msgid "%.3g Tb" msgstr "%.3g Tb" #: ../src/strformat.c:205 msgid "Available" msgstr "Mavjud" #: ../src/strformat.c:207 msgid "Current" msgstr "Joriy" #: ../src/strformat.c:209 msgid "Forbidden" msgstr "" #: ../src/strformat.c:241 msgid "Not registered" msgstr "" #: ../src/strformat.c:243 msgid "Home network" msgstr "Uy tarmog'i" #: ../src/strformat.c:245 msgid "Searching" msgstr "Qidirilmoqda" #: ../src/strformat.c:247 msgid "Registration denied" msgstr "" #: ../src/strformat.c:249 ../src/strformat.c:253 msgid "Unknown status" msgstr "Noma'lum holat" #: ../src/strformat.c:251 msgid "Roaming network" msgstr "Rouming tarmog'i" #: ../resources/modem-manager-gui.ui:17 msgid "Copyright 2012-2013 Alex" msgstr "Mualliflik huquqi 2012-2013 Alex" #: ../resources/modem-manager-gui.ui:18 msgid "Tool for EDGE/3G/4G modem specific functions control" msgstr "EDGE/3G/4G modemlarning o'ziga xos vazifalarini boshqarish vositasi" #: ../resources/modem-manager-gui.ui:20 msgid "Homepage" msgstr "Uy sahifasi" #: ../resources/modem-manager-gui.ui:21 msgid "GPL3" msgstr "GPL3" #: ../resources/modem-manager-gui.ui:23 msgid "English: Alex " msgstr "Uzbek: Umidjon Almasov " #: ../resources/modem-manager-gui.ui:55 msgid "Active connections" msgstr "Faol ulanishlar" #: ../resources/modem-manager-gui.ui:111 msgid "Terminate selected application using SIGTERM signal CTRL+T" msgstr "" #: ../resources/modem-manager-gui.ui:113 msgid "Terminate application" msgstr "Dasturni yopish" #: ../resources/modem-manager-gui.ui:167 msgid "Error" msgstr "Xato" #: ../resources/modem-manager-gui.ui:282 msgid "Ask me again" msgstr "" #: ../resources/modem-manager-gui.ui:302 msgid "Quit or minimize?" msgstr "" #: ../resources/modem-manager-gui.ui:316 msgid "What do you want application to do on window close?" msgstr "" #: ../resources/modem-manager-gui.ui:327 msgid "Just quit" msgstr "" #: ../resources/modem-manager-gui.ui:344 msgid "Minimize to tray or messaging menu" msgstr "" #: ../resources/modem-manager-gui.ui:378 #: ../resources/modem-manager-gui.ui:3366 msgid "New contact" msgstr "Yangi kontakt" #: ../resources/modem-manager-gui.ui:611 msgid "New SMS message" msgstr "Yangi SMS xabar" #: ../resources/modem-manager-gui.ui:657 #: ../resources/modem-manager-gui.ui:2374 msgid "Send" msgstr "Yuborish" #: ../resources/modem-manager-gui.ui:693 msgid "Number" msgstr "Raqam" #: ../resources/modem-manager-gui.ui:838 msgid "Concatenate messages" msgstr "Xabarlarni birlashtirish" #: ../resources/modem-manager-gui.ui:853 msgid "Expand folders" msgstr "Jildlarni ochish" #: ../resources/modem-manager-gui.ui:868 msgid "Place old messages on top" msgstr "" #: ../resources/modem-manager-gui.ui:889 msgid "SMS" msgstr "SMS" #: ../resources/modem-manager-gui.ui:947 msgid "RX Speed graph color" msgstr "Qabul qilish tezligi grafigining rangi" #: ../resources/modem-manager-gui.ui:962 msgid "TX Speed graph color" msgstr "Jo'natish tezligi grafigining rangi" #: ../resources/modem-manager-gui.ui:979 msgid "Traffic" msgstr "Trafik" #: ../resources/modem-manager-gui.ui:1008 msgid "Use sounds for events" msgstr "" #: ../resources/modem-manager-gui.ui:1023 msgid "Hide window to tray on close" msgstr "" #: ../resources/modem-manager-gui.ui:1038 msgid "Save window geometry and placement" msgstr "" #: ../resources/modem-manager-gui.ui:1059 msgid "Behaviour" msgstr "" #: ../resources/modem-manager-gui.ui:1087 msgid "Progress" msgstr "Bajarilishi" #: ../resources/modem-manager-gui.ui:1142 msgid "Executing command" msgstr "Buyruq bajarilmoqda" #: ../resources/modem-manager-gui.ui:1181 msgid "Question" msgstr "Savol" #: ../resources/modem-manager-gui.ui:1234 msgid "Traffic limits" msgstr "Trafik limiti" #: ../resources/modem-manager-gui.ui:1296 msgid "Eanble traffic limit" msgstr "Trafik limitini qo'yish" #: ../resources/modem-manager-gui.ui:1312 msgid "Enable time limit" msgstr "Vaqt limitini qo'yish" #: ../resources/modem-manager-gui.ui:1330 #: ../resources/modem-manager-gui.ui:1972 #: ../resources/modem-manager-gui.ui:3271 msgid "Traffic" msgstr "Trafik" #: ../resources/modem-manager-gui.ui:1376 #: ../resources/modem-manager-gui.ui:1478 msgid "Message" msgstr "Xabar" #: ../resources/modem-manager-gui.ui:1402 #: ../resources/modem-manager-gui.ui:1504 msgid "Action" msgstr "Amal" #: ../resources/modem-manager-gui.ui:1433 msgid "Time" msgstr "Vaqt" #: ../resources/modem-manager-gui.ui:1548 msgid "Traffic statistics" msgstr "" #: ../resources/modem-manager-gui.ui:1608 msgid "Selected statistics period" msgstr "" #: ../resources/modem-manager-gui.ui:1773 msgid "Add new USSD command CTRL+N" msgstr "Yangi USSD buyrug'ini qo'shish CTRL+N" #: ../resources/modem-manager-gui.ui:1775 msgid "Add" msgstr "Qo'shish" #: ../resources/modem-manager-gui.ui:1789 msgid "Remove selected USSD command CTRL+D" msgstr "Tanlangan USSD buyrug'ini o'chirish CTRL+D" #: ../resources/modem-manager-gui.ui:1791 msgid "Delete" msgstr "O'chirish" #: ../resources/modem-manager-gui.ui:1815 msgid "" "Force USSD answer encoding change from GSM7 to UCS2 (useful for Huawei " "modems) CTRL+E" msgstr "" #: ../resources/modem-manager-gui.ui:1817 msgid "Change message encoding" msgstr "Xabar kodlash usulini o'zgartirish" #: ../resources/modem-manager-gui.ui:1871 msgid "Modem Manager GUI" msgstr "Modem Manager GUI" #: ../resources/modem-manager-gui.ui:1890 msgid "View and select available devices CTRL+F1" msgstr "Mavjud uskunalarni korish va tanlash CTRL+F1" #: ../resources/modem-manager-gui.ui:1892 #: ../resources/modem-manager-gui.ui:2117 msgid "Devices" msgstr "Uskunalar" #: ../resources/modem-manager-gui.ui:1906 msgid "Send and receive SMS messages CTRL+F2" msgstr "SMS xabarlarni yuborish va qabul qilish CTRL+F2" #: ../resources/modem-manager-gui.ui:1922 msgid "Send USSD requests CTRL+F3" msgstr "" #: ../resources/modem-manager-gui.ui:1924 #: ../resources/modem-manager-gui.ui:2523 msgid "USSD" msgstr "USSD" #: ../resources/modem-manager-gui.ui:1938 msgid "View active device information CTRL+F4" msgstr "" #: ../resources/modem-manager-gui.ui:1940 #: ../resources/modem-manager-gui.ui:2975 msgid "Info" msgstr "Ma'lumot" #: ../resources/modem-manager-gui.ui:1954 msgid "Scan existing mobile networks CTRL+F5" msgstr "" #: ../resources/modem-manager-gui.ui:1956 #: ../resources/modem-manager-gui.ui:3125 msgid "Scan" msgstr "Tarmoqlar" #: ../resources/modem-manager-gui.ui:1970 msgid "Monitor network traffic CTRL+F6" msgstr "" #: ../resources/modem-manager-gui.ui:1986 msgid "View system and modem addressbooks CTRL+F7" msgstr "" #: ../resources/modem-manager-gui.ui:1988 #: ../resources/modem-manager-gui.ui:3455 msgid "Contacts" msgstr "Kontaktlar" #: ../resources/modem-manager-gui.ui:2041 msgid "No devices found in system" msgstr "Tizimda uskunalar topilmadi" #: ../resources/modem-manager-gui.ui:2210 msgid "Send new SMS message CTRL+N" msgstr "Yangi SMS xabar yuborish CTRL+N" #: ../resources/modem-manager-gui.ui:2212 msgid "New" msgstr "Yangi" #: ../resources/modem-manager-gui.ui:2226 msgid "Remove selected message CTRL+D" msgstr "Tanlangan xabarni o'chirish CTRL+D" #: ../resources/modem-manager-gui.ui:2228 msgid "Remove" msgstr "O'chirish" #: ../resources/modem-manager-gui.ui:2242 msgid "Answer selected message CTRL+A" msgstr "Tanlangan xabarga javob berish CTRL+A" #: ../resources/modem-manager-gui.ui:2244 msgid "Answer" msgstr "Javob berish" #: ../resources/modem-manager-gui.ui:2340 msgid "Request" msgstr "So'rov" #: ../resources/modem-manager-gui.ui:2378 msgid "Send ussd request CTRL+S" msgstr "" #: ../resources/modem-manager-gui.ui:2398 msgid "Edit USSD commands list CTRL+E" msgstr "" #: ../resources/modem-manager-gui.ui:2600 msgid "IMEI" msgstr "IMEI" #: ../resources/modem-manager-gui.ui:2627 msgid "IMSI/ESN" msgstr "IMSI/ESN" #: ../resources/modem-manager-gui.ui:2658 msgid "Equipment" msgstr "" #: ../resources/modem-manager-gui.ui:2732 msgid "Mode" msgstr "Usul" #: ../resources/modem-manager-gui.ui:2760 msgid "Signal level" msgstr "Signal darajasi" #: ../resources/modem-manager-gui.ui:2774 msgid "Operator code" msgstr "Operator kodi" #: ../resources/modem-manager-gui.ui:2801 msgid "Registration" msgstr "Ro'yxatdan o'tish" #: ../resources/modem-manager-gui.ui:2846 msgid "Network" msgstr "Tarmoq" #: ../resources/modem-manager-gui.ui:2892 msgid "" "3GPP Location\n" "MCC/MNC/LAC/CID" msgstr "" #: ../resources/modem-manager-gui.ui:2908 msgid "" "GPS location\n" "Longitude/Latiude" msgstr "" #: ../resources/modem-manager-gui.ui:2955 msgid "Location" msgstr "" #: ../resources/modem-manager-gui.ui:3021 msgid "Scan available mobile networks CTRL+S" msgstr "Mavjud mobil tarmoqlarni tekshirish CTRL+S" #: ../resources/modem-manager-gui.ui:3023 msgid "Start scan" msgstr "Tarmoqlarni izlash" #: ../resources/modem-manager-gui.ui:3145 msgid "Set traffic amount or time limit for disconnect CTRL+L" msgstr "" #: ../resources/modem-manager-gui.ui:3147 msgid "Set limit" msgstr "Limit qo'yish" #: ../resources/modem-manager-gui.ui:3161 msgid "View list of active network connections CTRL+C" msgstr "" #: ../resources/modem-manager-gui.ui:3163 msgid "Connections" msgstr "Ulanishlar" #: ../resources/modem-manager-gui.ui:3177 msgid "View daily traffic statistics CTRL+S" msgstr "" #: ../resources/modem-manager-gui.ui:3179 msgid "Statistics" msgstr "Statistika" #: ../resources/modem-manager-gui.ui:3230 msgid "Transmission speed" msgstr "Jo'natish tezligi" #: ../resources/modem-manager-gui.ui:3364 msgid "Add new contact to modem addressbook CTRL+N" msgstr "" #: ../resources/modem-manager-gui.ui:3380 msgid "Remove contact from modem addressbook CTRL+D" msgstr "" #: ../resources/modem-manager-gui.ui:3382 msgid "Remove contact" msgstr "Kontaktni o'chirish" #: ../resources/modem-manager-gui.ui:3406 msgid "Send SMS message to selected contact CTRL+S" msgstr "Tanlangan kontaktga SMS xabar yuborish CTRL+S" #: ../resources/modem-manager-gui.ui:3408 msgid "Send SMS" msgstr "SMS yuborish" #: manual addition msgid "Show message" msgstr "Xabar ko'rsatish" #: manual addition msgid "Disconnect" msgstr "Aloqani o'zish" #: manual addition msgid "Hours" msgstr "Soat" #: manual addition msgid "Minutes" msgstr "Daqiqa" #: manual addition msgid "Mb" msgstr "Mb" #: manual addition msgid "Gb" msgstr "Gb" #: manual addition msgid "Tb" msgstr "Tb" #: manual addition msgid "January" msgstr "" #: manual addition msgid "February" msgstr "" #: manual addition msgid "March" msgstr "" #: manual addition msgid "April" msgstr "" #: manual addition msgid "May" msgstr "May" #: manual addition msgid "June" msgstr "" #: manual addition msgid "July" msgstr "" #: manual addition msgid "August" msgstr "" #: manual addition msgid "September" msgstr "" #: manual addition msgid "October" msgstr "" #: manual addition msgid "November" msgstr "" #: manual addition msgid "December" msgstr "" modem-manager-gui-0.0.16/resources/000077500000000000000000000000001217271411700171065ustar00rootroot00000000000000modem-manager-gui-0.0.16/resources/Makefile000066400000000000000000000057601217271411700205560ustar00rootroot00000000000000include ../Makefile_h RESUIDIR = $(PREFIX)/share/modem-manager-gui/ui RESPIXDIR = $(PREFIX)/share/modem-manager-gui/pixmaps RESSNDDIR = $(PREFIX)/share/modem-manager-gui/sounds PIXDESTDIR = $(PREFIX)/share/pixmaps APPSDIR = /usr/share/applications install: mkdir -p $(INSTALLPREFIX)$(DESTDIR)$(RESUIDIR) cp modem-manager-gui.ui $(INSTALLPREFIX)$(DESTDIR)$(RESUIDIR) mkdir -p $(INSTALLPREFIX)$(DESTDIR)$(RESPIXDIR) cp modem-manager-gui.png $(INSTALLPREFIX)$(DESTDIR)$(RESPIXDIR) cp dev-tb.png $(INSTALLPREFIX)$(DESTDIR)$(RESPIXDIR) cp sms-tb.png $(INSTALLPREFIX)$(DESTDIR)$(RESPIXDIR) cp ussd-tb.png $(INSTALLPREFIX)$(DESTDIR)$(RESPIXDIR) cp info-tb.png $(INSTALLPREFIX)$(DESTDIR)$(RESPIXDIR) cp scan-tb.png $(INSTALLPREFIX)$(DESTDIR)$(RESPIXDIR) cp cont-tb.png $(INSTALLPREFIX)$(DESTDIR)$(RESPIXDIR) cp traffic-tb.png $(INSTALLPREFIX)$(DESTDIR)$(RESPIXDIR) cp sms-unread.png $(INSTALLPREFIX)$(DESTDIR)$(RESPIXDIR) cp sms-read.png $(INSTALLPREFIX)$(DESTDIR)$(RESPIXDIR) cp message-received.png $(INSTALLPREFIX)$(DESTDIR)$(RESPIXDIR) cp message-sent.png $(INSTALLPREFIX)$(DESTDIR)$(RESPIXDIR) cp message-drafts.png $(INSTALLPREFIX)$(DESTDIR)$(RESPIXDIR) cp info-equipment.png $(INSTALLPREFIX)$(DESTDIR)$(RESPIXDIR) cp info-network.png $(INSTALLPREFIX)$(DESTDIR)$(RESPIXDIR) cp info-location.png $(INSTALLPREFIX)$(DESTDIR)$(RESPIXDIR) mkdir -p $(INSTALLPREFIX)$(DESTDIR)$(RESSNDDIR) cp message.ogg $(INSTALLPREFIX)$(DESTDIR)$(RESSNDDIR) mkdir -p $(INSTALLPREFIX)$(DESTDIR)$(PIXDESTDIR) cp modem-manager-gui.png $(INSTALLPREFIX)$(DESTDIR)$(PIXDESTDIR) mkdir -p $(INSTALLPREFIX)$(DESTDIR)$(APPSDIR) cp *modem-manager-gui.desktop $(INSTALLPREFIX)$(DESTDIR)$(APPSDIR) uninstall: rm -f $(INSTALLPREFIX)$(DESTDIR)$(RESUIDIR)/modem-manager-gui.ui rm -f $(INSTALLPREFIX)$(DESTDIR)$(RESPIXDIR)/modem-manager-gui.png rm -f $(INSTALLPREFIX)$(DESTDIR)$(RESPIXDIR)/dev-tb.png rm -f $(INSTALLPREFIX)$(DESTDIR)$(RESPIXDIR)/sms-tb.png rm -f $(INSTALLPREFIX)$(DESTDIR)$(RESPIXDIR)/ussd-tb.png rm -f $(INSTALLPREFIX)$(DESTDIR)$(RESPIXDIR)/info-tb.png rm -f $(INSTALLPREFIX)$(DESTDIR)$(RESPIXDIR)/scan-tb.png rm -f $(INSTALLPREFIX)$(DESTDIR)$(RESPIXDIR)/cont-tb.png rm -f $(INSTALLPREFIX)$(DESTDIR)$(RESPIXDIR)/traffic-tb.png rm -f $(INSTALLPREFIX)$(DESTDIR)$(RESPIXDIR)/sms-unread.png rm -f $(INSTALLPREFIX)$(DESTDIR)$(RESPIXDIR)/sms-read.png rm -f $(INSTALLPREFIX)$(DESTDIR)$(RESPIXDIR)/message-received.png rm -f $(INSTALLPREFIX)$(DESTDIR)$(RESPIXDIR)/message-sent.png rm -f $(INSTALLPREFIX)$(DESTDIR)$(RESPIXDIR)/message-drafts.png rm -f $(INSTALLPREFIX)$(DESTDIR)$(RESPIXDIR)/info-equipment.png rm -f $(INSTALLPREFIX)$(DESTDIR)$(RESPIXDIR)/info-network.png rm -f $(INSTALLPREFIX)$(DESTDIR)$(RESPIXDIR)/info-location.png rm -f $(INSTALLPREFIX)$(DESTDIR)$(RESSNDDIR)/message.ogg rm -f $(INSTALLPREFIX)$(DESTDIR)$(PIXDESTDIR)/modem-manager-gui.png rm -f $(INSTALLPREFIX)$(DESTDIR)$(APPSDIR)/*modem-manager-gui.desktop clean: rm -f *modem-manager-gui.desktop modem-manager-gui-0.0.16/resources/cont-tb.png000066400000000000000000000032231217271411700211620ustar00rootroot00000000000000PNG  IHDR szzsRGBbKGD pHYs  tIME 7${?IDATXíW_TUsܹ;n` ,`̚H)%" Z YlP*!/ ҃ERxHAʸXȂ8s׃{nw[tc9} OX|B@.{U)J/RgSrι|\MD?ٶeYFFFpE%x* md``lYGGXݻwiffE]u#!ĕK`rm122uAk udجH$p=|2l~CqvZWX8#E [bHW\aDF4chhNi{Vϴ455Ťz7Dh͚5oRۋa7obffREsMOO3)回]@,CCC,.۱|:#s={JeIҥKZ?y/urS 64}˖-d2-sq (-L>|!8 |>?_, è Fqro߆aQ>mR />d2R6qۥ`rrJ)twwcǎp]<3g",ciT=<˽J%[nEЊ.\cժU@ww7$paACZ9MT 7P*VwP@V֭[sٳ'rFJ Rd^D6J1GܸR s;wl509OYP՚tK)8exƶmAж0DZE",(&c#Z:2@iTkµrJ߿s^G1۷Jh1"Jvc0 #7 C avϟ)zǏֺ0 aKJjz8p붝1֯dbMs3HL7nEl)qh%~_H9krx$]F33{w|;-wH$! 4͟Xc_9sܲa虮4mH񶹹O>-k}, Bhhh`0h[5H$˗lvv^7B1w B8뷚RcDǃo3!DR)e˖Ǐ1"*X4##BBJ"ZnjjBccGѹKQJ/A>"ʴ" MCKK 8x2LI@Db1&<מ \}>!躎A gs C)/Oe hGGGFLĉ' D,<On޼Y2cvI&Bs@D"ضmF_ 0== "{mOu,--!ͮ񿳵qݻ(v8pe w‚3p^/3l(EǏ3ιG[h~UUm2ÇBgg'oߎx4>|˲V"bːRp?S]] )eBD"C`Yp=twwcϞ=SSS`h^ֲ,p)LnZYY2r9>H)anݺz4448)=v񠿿tڱc4MiQg۹'ODMM t]Ǎ7PQQgOiuoF*B0DWWWB^W~:r\R˲{n簉FXXXs}}}HӸ~:<:::P[[8Aحi6{crqiqTVVsιtk.9rsssF4 yvVJ 8Ͳ7sNabbիpsgY8ޫ^|>0p5TWWٳ, J.ŋi(R6mڄ.(`&4jcZZZrkY^zuX^^Foo锬n @Nit<a @6uxQ6eDZ˲Vy^߽{0Ԅ@ 7fN0skWgU)s7Lě7o@DR"9LRlX szR`FA:M&C,'fMƾM\fy)5_bBDdc(zJ)#5 D"`V)Ŋ.UNr . V kU4CKp^}b5MC"(] eˉ_o=D4#c 7ou4C"pWJaǎ8ŲCB|fPgEKK &''1FO5rCDDd9D"mD4QO,!ɼM![O- @QLNN !BD $B(P1ϥxO&DzA(RT($ܚRsn lMx_4a;y.NE+il<ӳVB' ?~ } IENDB`modem-manager-gui-0.0.16/resources/info-location.png000066400000000000000000000036231217271411700223610ustar00rootroot00000000000000PNG  IHDR0.nޚlsBIT|d pHYsAm3tEXtSoftwarewww.inkscape.org<IDAThZmLT~ECVlkfZ7؈&ZTBb MZkkJش]CcnD[鯑l(4"~]A`޷?iw̠p$'9y{w jmmm1~r|,6lX`?ϙ3gO_. ,kᧀ`CrAg/I_$ H$IU ה 9d#"Hwvv &kH>.9Mrɩ ,"rD7$T655i,SwQ?P 8)&7{hhq}c$B.X Ña.]Z8Hb JyYO"R" OX%@l6^ 9@rĴg sC>{I^v/dMB)vIv,R y i0#3H~~u{@`*I;`~rE~:>Dq%3g\cpZMM;vLh\U'񪪪e666geeM4̵#%pB9ʇܹsRUUjr;{$ղdg$C[hwH]D^C~:2 PUXX^O}~Q__),+f*;qą#G7l x.Uգ$xˍ!ɽ;w2qP^]]ݷΟ?_F dqLMPXdwǎkjj՜PooocGGGVVVqPjt]])JLIcZOcPhyyy;WXm#:C`7o^իn[6ɛF;&$J3+*** 6HC.__nKco'' -(ii^ƏED_%y)^X=).#y߰ہG+|>| `u

};]lThLF.{ζWT1+n?6'"j ƿL>$pIUपޛ,w_*8xǩLMy!ɹ7888H_H72U5۶|Jj<G΀,jF /.abIENDB`modem-manager-gui-0.0.16/resources/info-network.png000066400000000000000000000021561217271411700222420ustar00rootroot00000000000000PNG  IHDR00WbKGD pHYs $ $BtIME&HIDATh}sשnS*Ed#$IQ֕Va͘,CmL㏰<< ,LLC<,ITC-R?λu֮kw>o{F%l:<4L\+o ϝQ"^t'͌KĤ ;U@|ipR~@"k`tt3+#\߰?b'f>Qt?n9h˩w~H&F]-X3C޶TӋ1xg*LGs] *]KBwd㣊9{Gkh+;Wq||kf'bQQ7D-ɾkR&jU0*3sq)F-x:>cCNZ23+[O/$JVng]_<<0>rJ J߁Ãv`Eurzmώ=юv[Zݻw) n%APy=~8*JOB̌ PF(=!@"U(\.ҥKZ}6z!4#=N1ǎ<{l._ S:a,gסj.xpZSEqka(Bmr9޽{X^^Ngk!Dل-~.JW9WbZk0 (=zDBʁb[666̰,+v"!loo*]׽P,#ػw/Q,7b{oT͏$sjQarrZx۶ \v B]m={i'ǡ0 S yضe!휬m!l۶$RJC$)B0sc6? "X U3PJ̚"h;8\ޚ`>&JKއaJ|6 ׫`@ c$nb}`"f϶mH)QvQv1(J4 Z7}'SRxd#2H0N(&ёDzP At eYHEbrjRmgS bSJɛ\DG8Af_; *3̜o6Zs%ώ.H<Z D֚FLq%ע(ʭJt?FF<<<|2snJ;}dd$իW #Fyôn244zvyloow7!+;̏whɂmm(Nsh^cnnEDwگ0S!D۱J)j&(eLR zJ_uOF^T'JsǎCO077gnQJU|`|̯)n:N]E-7Rkd]JIENDB`modem-manager-gui-0.0.16/resources/message-drafts.png000066400000000000000000000021031217271411700225150ustar00rootroot00000000000000PNG  IHDR-bKGD pHYsVnVn Ѱ(tIME ^IDAT8}MlTƯҿIi %i p!A@\Q M@BbL$]Ę!.$$j-ał(R27(S "'9ŗ5kם[*b0F0<w?9r{>r>t`/?_uerrR&&&֭[2>>nE_ as۟cú;^ʏKc Q)uٶ  }Oׇo0 Uh;˦MDaőc,RIUsuXJ%Y+_uϞ7w߰gռUݫs˗w*գU <5bQ9NJz{l:8W_^͢Żu]80 g!oߦ7rTUri,e6Q>wܡNDc B̾}؃444PWWG* ;iIgftuuErAj~U, 8%- ZEqEQ:y0J!##ԟ8y p8i_1 {>^},̙1`Xä<y8e`Fzsѱ8i~q8Қ J;:PNР*ܔ1J)7Eo]#"q\E[[PӬ2DdR*gURP)ͿnR__+)!#G( @-  Cr.4K=b45!@I%M9(iM" {/R*Wi([m{>JԬX䬟IgH&d8׽\Mc3%BߩTs`j`A4hVp_`B0AkIENDB`modem-manager-gui-0.0.16/resources/message-received.png000066400000000000000000000021151217271411700230230ustar00rootroot00000000000000PNG  IHDR-bKGD pHYsVnVn Ѱ(tIME )c AIDAT8˅hU?{ޭ]732 .u$GF * a*iAeGȲ0i斻^w޻{nӉ9p|GzT*5ZaO?'{Fv{vvo"BA.]$\N٬dY[,^k_cۖζ%|^.^(.\.sI{{|aLsaG^ ߌO$% CeCEc^Yt(Ͽ-pϮm3Zx|An[k.quSa9q$Η_c;ncJ===TTT`UAHk뢹eڱ/mH}}NX,Eab}sfBU1JS'?|?='ځgεvZs޾}[Ljξ}# />U7_Λ1(0r96lxi5M'ZfjT% C(|l6kW~s?卛.465S, R,ueww/]֭osEb?xf,XY8-Êʱy8CE J\By?|wYd{z֑p}ߟL&Yf ]tvtdƦKLeI,#\ell41c y''JQ[[KeeP'*bT%hnn (J*qfW^L?}+m@)4̽ A.!A!/fpdQܝsz5*a:+yu\Jo1@>rPSjEϴs !׋9x aI]a#"յqSRfħlAU:;g9Q99Z[iI`DiKAQY"M)+nݹE]]K/w}e۲mQGxuyjD~KP!@u.VD2A+?%{?dMl Ąf\EDs% K*k*QEEK.+sF}@4fZ1IENDB`modem-manager-gui-0.0.16/resources/message.ogg000066400000000000000000001001211217271411700212230ustar00rootroot00000000000000OggSz*KvorbisDqOggSz*#=vorbis-Xiph.Org libVorbis I 20101101 (Schaufenugget)vorbis)BCV1L ŀАU`$)fI)(yHI)0c1c1c 4d( Ij9g'r9iN8 Q9 &cnkn)% Y@H!RH!b!b!r!r * 2 L2餓N:騣:(B -JL1Vc]|s9s9s BCV BdB!R)r 2ȀАU GI˱$O,Q53ESTMUUUUu]Wvevuv}Y[}Y[؅]aaaa}}} 4d #9)"9d ")Ifjihm˲,˲ iiiiiiifYeYeYeYeYeYeYeYeYeYeYeYeY@h*@@qq$ER$r, Y@R,r4Gs4s@BDFHJLNP@OggS@&z*U69 /4ESPVeiRekh/E eY x陞_i+qy=LCKO0K0=o0sg{w?98qxx9<8<<xpa9 PF{%oE 4 eWrG?,4`%1f4g~>.tW]}qoE 4@ a9 PF{% c9ޢ,7`LA,8͙̪F}} k'Qk q#Ŵ44EpKn_9u}][LߧO3sCW1S(AQ {r o[6%j1}JsTEN12 Tbo`\2%,{ĦI* DaZXX -hEQEc+^c ]EN2HƳ WT\W2xP7~ Ws5o5bYF?kvΉXmuի2jY*$ن5)+,Q˒Z^F(<;WZȞKu?.vĹgk+eQGNga珘|lC,buNJӑ0Wm4\"MA~$VKg6-Mj _VF#szoN햭=av.%;2ş_L{Mcj$T_2l/ e)'(/u `F|CUxW>v`_fR/Omp8}&ۉ3 U5\ f8￯M06{Ѵ9/y*lrLkn5 ywzz5=؆͖cPKVWۯ|1O~j&+ k5aɣ;m.+]^9<*~nb.Ec4_i{HB I3:Vc<_^k1_0O'ѿ[eKapc1TU:B]C>>4M<0M7d|QPd)p4_94-~m7om89Ե_X į(|Ʉ[Z|}0g\fwFZB@@ -YۀXiOe%ù b! ~ nTgQ.P! X#儯4 B'8߮CU͕Ɣi. ~߾JܜYܛ89sdt4y_k4KTU.ݮh5OplOu",;כepCB?wAO7$FIR}| lh|g9|Gyf7j$D$]-55$ u?p_m8^'F]{kŤQӔo/nP@BQ .>>f}sYl.>߁4nt,!u/mIFW{1@9S-H%`7<SQ>.JgޅyZd`*i?OQ G88m`p'F ltp$0N_hZ!9c ˿'ȣ y 0|H7WIiA2bş" vz$iӉL ^Ϸ8S7ni`cѪw {~d@9 M \j vḇ[ҙF}tp*;z0DѪY*{H4tBK5,ta.2F5@Pg<|;LQ ްpa;=JF2TƟ>ʆ'*KCJTK_$=@?o^)I}[t'0k4S%xN{jswgg@뺪ZhC @OJX/<nIu@j2ݎ@_0{@{3]m]@ [W`HMA4  6 x{v8 7DFɤp*ξ?Bq3w ::ڪK1wqo4{x~>B! dd t`,'NwͯDkL yӽnz,4M˩sY=h4VTT{=k`g-`m7fu@1yϯ﹙r(@.˖1 HdߕHoEߚxlMN/fLPDӁ]%Z^p L`;u1̯~3Ll$nyW-y}s>f</}c+`@1ӧӜAEWS>$!"u|VO0"^ DnQOBMKSf\͹$B׆.4o3 =ݟ/sό͂ZDzɤ?XW1g坹Oj|{r5|,}[f*?:ٖ&ѓRb~yNuKcrOvyMkqK]hg/b[knx ɟs5Dו\R60fiiؕD=q~d<9꫏G?W5@}ոk^zNպqI\T#mW}獵=^@!ZJ $޵!R{Vҟ.8`B/eȄv9v%o}~youI|' yܖ29t4g3s sјL:Ir~:,|rT&V_,.NzszkHv. !)jNCdnf(Y܇n7;s-zTiSėm9T%qkZv'6Ԕ3[OSo JewuٓiUsWz4y>}P!A${i:z23y\}|FN|ټr>Stf(L8,K/TUH P4/Ƀn-Dr,OggS@Jz*V^JxݟZ̤7"@=FWs|xw_/:t`Ͼ8d1qbW_W<!e6K ɗ 0b%'0{9'X>W?,>hߟrTvhPJY^=;&Bġ/+UYjH}ߘ#Օ7=Oڐ soi"1mxJ u,{r%|Q: vo 6c543x7 402&|k OLzS^b}*08.Y~&~uZ0${VY@@Phvp`k<奦V㬹!b~k3~nv9cOgf5|ƀ.N0=G4*ZWJPJ֫8fyY#_R {٣;@}_3\K>{x 5AoH:^h>#&j 鐶sU-ڏ``A_ ,RsbKOExCh 4Kxў</Wg3 kQ 8g?(B -`>q[J& ~ K0kh[r/<|3 oӵx7gx @~q ?g_Pdhm=MVx͠)6oR-22[7;`vymsQpU.[=8Ȁ/v b>4 @Yt kc2{N7P-&[W\i⭟z? DG!r[4}?}֓Apѭw;ÜxŌ=Ɨ|qhSPwЙʆ"b{4? ..t; m @]e]u"i7"/?*.1!h0Ix. 9 ?82Bɺ*KS)G停pFQ~ ?'q<9g'xc I('҂$pRKw&(S2y^><""k_5G%*+z^,zh 8` 7bn7'if!,ԞT-<Qf ?$qx Kޯp-upyF@חndaTVY { *% sz7m7>0qޡ))9 {k`w -ib~'} >moXM djn`!ٵxl4 f}O~Sm8ۑco@G6?{7k})~;Rq[>G|U5L(´tC\j"QBT`xL-ˆ˲]nK똟3z āv/^ lW_@W'8j/Jh!,B|IKK.@&N+ٿ@5 >ᷩ#fb߉x'YmͩC}+*ʛk̋zp,%`z}Rh|J9c5?o|Nuȯ { 1]934sm8@ە}`p.۴{>6&p_P ?f1)2s{Ǝo8% 9>_&sV=v/0PCYP5;ʹ.DPׇ͂>{1x^o 4PL )I)8  S uN Mq]jr<5ܙCmu8G" WF&'~*R`"?)"AX o~tO}* 3[x6}^ؿ gx m\ vW@ :}b'8{-M8qMU>ϊ`4@,   r)(W[7t B82M?MŸzC\Giiժ(H[V1Tw7:~==fe:$/s (_aߝ쁂,\\ fP=Tۻ[e<^jS^@xo_o^w}T ҁd>`MPOM4`#`3Lב4Q@5_Ѽ^K\[^HpG^:ce@{~*a  ZPႪ [w3\']UM*e%rI>CX>s0s 9|2ͫJ b㣶a @.v݁T>x6Mx*d'z'Ƿ95ai툙c,Wv|).U1Eu,p~ߕk ou=Σi|]D]=]Ffk/f]6֘^';`vMR<||=-nk ;IN}6_<~|PKWl?D-J7Sΰdٔ2nHva XuI<]-" yE\5;@E7Zp78@|m ;TFPmU1Ndi8^V2oǃ/Ky莯?h=(vWNu@ csjҳ h3KsNֿ4ă;q `?v: bެǯ 5PIkvF 4b ?!mq*&'*r37UJ5o7]N:هolq}Su09=yg7P6_ ,X{4:x[OM䞝Vyֻv]\gv1OGg Cz(Gb`d.L`[8Q]H8OggS@rz*||ȍ؋zZі%oQ縯 7H^Ζ'AH؟p8RU_ =>D< ~{w`'9s@F p=uPwe ~k-~ }/;rVw-oι5| `[#otߩ'`$(yhkˀ?鶀ڝ揶?8d4Tw}pf3*HǬlRpdzo3}~\i/"rI6Y:3eeOu"p r~:z`hwWiDd{V[QL͹xgqGXZtܿ `i^{:QZU8cL,p?gC gS44>Aj |)_(RP]YY*.#͡ܚݣʚu? MϜmhq^,⛝(OK9Omqpfz ]6V/l߿]^ S @!{QSB@>Y÷k4/`@8 ̳3~mO7$qpGiyy;>033;>>7k/s ܀I١o6@PJAgty"HDBvz] _/FԀtiE>ܞ]4<8<*N }_" |G(p"xw @0 puSBɶ MMrz^rѰ&0& o?0Ͽ$m~y2o{x@Ѱqw93\=N’@n룣OPhP^MBE|]uo(Ir}e5-&S@|TPN4U/W&է v;]aꦆyG}|c;牲_P̊͜T_IԲ҉VpI 9@Z.̢r3,`CTlGnv]9`ڍ\iY+u@rj  <4 `Nm2g5p[|uM|W@8årkJ*U%X}e7jSeA7x/Ϭ9 G%v2Љf7<3Ϲhv_ż N`ii Z{N>3 ?oǧ545ph*)KҰGCL˵#2=qȔT_MOO{Wq2ԯS{ ?6ϛ"2ᩧʌTJLd|}gU)?1Q$4kD@%ϗM~k&dv`!(?TA@SC-H~AZEG`@/byEYWM~$bi9=h] uU r?_̧3}w(#B9,!xB *vn͉~$S76 P.ޞ TZo{F?U7_x%nǟ|o, 4j ׉j [>nye8q5[д*)5>d8-dsk7 PNF~J~_EDS% b+"z.q3)l! k`Y \, xӋ%q4ovb&4 &ؿ3@7~Ja"({b-g9x(ݪL%R bJg{.Z@0'ޒz $@ C>?~oR7Ƈ dS^mPg g/==1kyO}H#XV@a*2ji;<խr(wtyuW9$@Q,R X>}O DdٺW!>Hu l^D@}(8kM g3 ߅#Gx_ۂh[%LgXh5C.~- %w8%^ݍBh}g鞳Ucg֌V)/:]1(\?:U r_OOZjYx; -/:'Qbm>h] |7q7#bʝ`l2Jkz?f0?%O3=U:+sy*A# SLx\N%oǫݣ Q Ȧ^?Fi k_?LuA,((0;s>MHz C/"kg.8m12'`*IdaUe۞~ ` Iz7t@:/R/r Gxhpg_XMq173p6߮*$7Fd9f?Ql98xtzRhd6@BxJ{v@Y@W'f_  @AX8njP_++  \!ʟAlN8$Ea׭H|Lfr]=v2c SudJq,|tה^ɣ dl6 9>\ν~0;WR9'|7?^_Ǿ9}+}svמIpB`AH ITQ*=; h+_}S OggS@z*3'Mp?bt!Wdۄ /'X}^J(Y"u5HQ{>2.~x8ja,<^zHzL?v vg[`@ozx>*9CAÀǔ98]Cx33}\K$+37IDZ8+/a.w97|y/> @Q\ϕyZc],}cL"Зo”4N=֋ݛ zر]=QMs*gWs都agr}  Xn0۠5b7iI!gm̈ؼYM@%IWu>?8J`gzn6!9KH2,A(@W&Bm_歜!6N?yXWVgor9}<+?h?mi6pL ٕݙ$}6鵲y̚Ƈ!y  @nx%H~0 @P~G؋|_/". F%]F/LPO3d| [#Pk Z43]YbrE6P]gOǝIՒK En;36SgGW]K5<ĵ6W)?6nzyF\2,cw#+2lXM_9Piǻ3|:[U4_ C7bhJzNjo6v$XR·j|\Z_;ls!~*w;lǿ?*knò"&)tNOrW/o(ưSWmV]]!OyO(ā6:'\47 @z$x>kWuޯOR'NGI<_N\?clz(Z BIJ*\/>!Db C|s} rϯe,\u_ߴ_^U&@O`]M4?ju.wSu_LKCN8/^ZxI`YL<\3t6 o[}T0}8DMΥS.<P bAO!gnvOM$Lul֐/:<%͗/@Q} fpW# ^A6 <`2pg-H޷?GͣF$^SsH43?G[AtxkFHL)d@KنWE?`RԼh ݸ6=,sGs⪡YiWUY?/raLduy'{O%G/̞?meׯٽC2>OM6o? sI8qqJ6גs #\*(`Twc$q]lq7΂H&L P!E&erTA_(witKU8b'D?K8w4/pxLcoGJlHS3tTk-v~v{ݾ\|ӽi,1Y`ד%'_cW<2ͩ27mad@R~~ oP :x>>CokQ&ahxchZOYd7 id7ۙ]4? do4aQ/Y^ǫ?LAk/.*۱,xSs4͂Jd0נ3tK_yoqxk0/neܴ6,b@-l`p?Q`Hp0Jg|u?eN+:Z_CbQGxfDٔIIeT%{?/ 927J7ܶoi ܁IW);$h0r_y?ZG;vkj$PqbD. ,qǕ1d|]5o?MNfS1)QfM|%G%{қMѹD3[0DTZ/h}x0me6NJ; h ?_CyrҮ~tƄc}̽I  % s DӛW&*'D Kܾ_^|&؁QTCYϟ@?|`[3-֎ $ZW, `B9s{ 6o=gpa#'D^jwe|b Pp`07Zy5T'E0&r pSyo6f蟯O! j.oށ{#~8I޼3 [C}h~r2{849Ot2oLX`Xrf&,rUtoWo${{OY2Eszj~8(0h}؄F},H˸2<^8ѷm){QFӉv|`jOeʤ)Wy.vC.,'umh❎*kY$)[,]G9O~gPQ8 .k>m3V ;4 @T@c/G40fN2gjE=g; !*ǖReW.:s':beͨ* ƀ9NXk> ^<֌HчS }c:\}ϯOڒX\$ ϵcPl,БdJCh/{__ ؟S]-7OGemvsM[b>lOL,yzɽ wL/᳠ R ׫j[4.iêi/Վs}N} ]rRՓ3?7jekp6N^/Bd}9iZrI3d8<LUNo1l~[jw< Ugg>n2tT{ D& z0=d_6J <ђ` &jЀ4\{}+wmU陓xu?_ѺM_8uՏ𨔒R\q~͏pn@Qf(P ڗ T|?_X:;khZjw ~dmVr`MWH(A.9 ϟ`8&<YVhRdH>up7`<@0yQ\vnVlo +yX{i򓷬 4'u?'0@@17h@Γ Ȭ4h%: IJkM7׻Yvj*'9ȭ_a_oWCm(\e]8.rbW;3s@S r`{|}WU/}}e>c>z]:s)IƙЬ̜` + }!LM4Iz_ѲXCvsQG/&P| LLg%m-, O /@'[R2#@2왧Q@죽7C,'`[|}(\M `:r;Λ:X[lOpIynfᏙx^ܧ>ٚY]ZUXfD{&gb"n='v{Ͼy S0p'&NFY˫ zrsӓ/EL9rɝ}~$A캱{Ri-B .‚ Hʶ%p,=>_*x盧p緗TYMr6_*![A,@A(4`@W rC޸[</h.`Z2}с =p *3 4/Uz;)֐N桋~dGӹ'aqpHy αY8~w@2 qWLSvb {籷8=v̄CY| ^ J:g`@AFAs^ $l  Yh`L,J<~}R:q <x}N?^ꎲnhX˨~uP!Pè)a~^~kuO|Q#Nˀ锃n=tlW=L`k%vnN}8@Hv`ˣpLgçc{[(Z2[fLhjf_ WgvI64c.!H "߈yht2gl/wb>ŵ!L] 0%zb4@ )) ]p*F!:a&p8'?ٽ]ػ{^VVXԿ~2'>wݷjgo736Ţf˻hiou}rS\9}fRe)tߕ}%|~,4, &+"_^\>/O}6p~'Q߮ 3xhL0o("UV&2E$@ApHutd_׿/ōptNE@KQv[o @/u4 t]˄-'S@ x? \2q5xj݁<2_|6@cN>gp p/`'(aO}Ҡ:~`jTwfOM^.Y`ܴ@W~yݼGjCOO~~O Dx~~eIlX{8@RIDK7H%d5ޓy(=AN<óĴez--;*W9*4@DĀ FF4 u؟ 屴l5 :iOMA>gGi7@_v JUZ p9N"|ݠ[fy5 oGdp}x1&׻^{Uez &|+fy<mv . =l`s=)ggww}rܔyVL2 >]\ '5fW~X>#2/Jz+~^lJ6KfM2-[dߝ?f6=:0_8s6㟽 =3r.- PBSJo0 Sq^f8 >.SnZCMsI@ <~ԩDM??]5;^X3BuHʕk >Y Fm(¦}G2RvKm|5_bOTJ@S0C^9/NtwS=4>{r n`Hrz6v$'v79~eיJ5NrΓ SOLRؠ&dCMn=d͛yOU&j@ZK0p0#]Mʺ/3jHo?ǭ9|3x8 J/P `/^ eLHKxO7w(KU)ӑȖXt.EKrU:d8~Ƈ {6mvӪ+1T9-p+=O@ iv ~.޹zPy=ҡf [hz@$}0b4vs$o|9kT|NNCK~pJ !3Lɡ>S[ʿbz>_uoΖn 醓,cM{5?q<txʹr⦩oF\zYg)ęO6`/ Q0Zp uxMwQZZM*giE}&Pޱv&Y!D` P@P o @elHHGOut("99'@?%+|F}Gf0S_#:)v$@*b'rJh8i̘`.0xl]<2GL+dep20_in`-Gw{sܹD_3;|r6? u28 dy]н59?FGLj{>(sr {nǎG?ϗbx~4Ip^`k=5"!thg ] du~˶mq(o,U55{% ,: `E eL̈ ^r܆l.Kɲ}F`>[_E,FcLSbiLƭwziQ ecNIt>B  xxX/1s~gۿkQw543;?pלvӜ=o<íOJg.1[ODsLTctT:e⩗-mR탄nwXr,0Np1˻WAp@ )~'/ ~7>I|dhh"5d(qy7<aTOggS@z*wyzruqy}je؈`E^mU0l8I~Q]H@}`BgXkmJHN F X.F :?ƽ <1X 1Қ6`z4W2Wn>g =$N‰ylkQҐj'FT<>swsg5=; v6m&>oqL4W߽Guw.wq^ $:QYn//$p<ųt-l)ĵU Ai*liPV 8UR 4ie,: }z^RA0 u Nӿ'MQԣ |m dk]ɂ V2Дf0{+pȎbi{k#`]sew YEghz^{oP`tiihI~?h+mzy ]]IvX (Eaq-=7VMTMK;]\kIR*ѳ!ϥӏT_?KQx C]'wz3=M宜nꜞ% 6ܕ̰'~zr@pxEr fFch  te,ډ sBRKZ rq"~,nr[ԣ 4?x7:FTAH4+_zIICN'fXεY7cXҝkZ 6@<%8`w@C0?/Cyu {f&|2L75dS~oOfϙ?kޟK@K4xF }y:{Ytk7^9}I2K~Gsz/l $dÁ"DDe>}?@J2Ԉ9Ӌ cNeG[Bc] @?y0;?E~ޱӜu^=bUwNMM4yf;dxQS:up<2@+/\{\(\*" P纓}d{a7if@dlE>O6@ʮ@do<@y:Ey:+l™2:x}ze(KQBH.mRlDXv^  !#$@$`> e\:yز8Au,!#, YGkfDY%*HHW[uBn,< {{g%h%ii \eqd<2Kw't44o7@L~$J]c4Ծ4y}1<Π{ӝPE.{Zw1|2TM+{of[=5ʩj?QL&"?oyadt_=Dvv`M-ɩO^D!Y1Wp;Ys&nTԻ6g&sRu 3@*8VD  etyo"z gE➞}K,@6ֺDP) (fҟGsK#Ͼ֝ L s6'/7ʍeN_%q%p<Ó I{U]L?dsw䡟W7枾|:Mî&;ߩ#*U[n o5$N@&?MmzJtLGtU݀DBL xiF}VVra,K2xܙ>/1bbMOqr?Ti }9 e\`tֿOIu,U8(B}|*;Bci~FFM $j$E) طo/ _?3L,:Xsڋk8Ӥ Wٞ*UnZk`+ KPkf}&gv'Ou0{cWe&i&y+#s9g J2iw}wyfǪ&u '[{I(s}rΞ&=X}CQqX~s@wu:d*o/_)!-ff;{b Pyײ)^`+Hre<'yC'NX.gEE'6Bci `cYQI*$@y^?N= fQ{7wM4deߔ{~;@ |J]Z ~b΄SSo&/<6]}3UN̪:ëL{I;kd]{>h@l \0+u50d1嗃Hs؜w9E?DOm,;8E!6u;1o<#^>\bG$sJUSCS窗dəLR3 -)ۦW6hwYQ'YT3p 0e#骯8qHwB\J\vtԲPQT2+30/xOmzLCa]|*[s_p[T ۗ~YxdD Kz3jgbi򞹜93gsyHhIg\0}j>L%B79M'PDvj>4YPf@w' 2UE 3T%xu dj\y}}?CsGïg-if:Xxnp ܿdbNak[Ӥ3gpyn8oBv9UynY|v <ϰ$&h~RKOggSz*-Ғvorst|e\rL}Ze8'"}=ޅ_7º e>r|goW6FւvɧUi4`uwğ_`]---`/@,}Io.elfY:5vz\$wg~z;mMxe?չXxjHhXidl7㛣rM~^H6=`3Wۗ>χFe Ipc*Ӫ0:rO*Eh@ p@\$Ce@Lêz:w5|t:>̮uW$qQَy 6#$7uzI9o@?Н0V?IlVuSy|dF{w#`FAs6;f0 >]z3Zr!lw5S<|l&3ߛk@0Я k545@QX:!:$`윩̥6=Uc":ze]ps`\`]/?z64t#@0I&yww808۶ Cnic/] ¹ A8HrwMTP4IzF^ ؅W5%Z# 9Pe\d}_!e:/BվGnpMl6lUX]$/?;,m3 LtE(Kj4Bu$UnfXQ]$\v$3?en1\.2 }~_t- 9o 잃?}ǝINYagWL&4ܐuK;⧦E'5ïkϗcIOΪ}.~F$к1ac L\G|k\9 b_aR\>?NHln9dHQ ]biDf,SeB2N0Tz_o*URY2zMjN1@L$ɫfX Ton/w2`ֳ݈٩0mm2 Iȼۢ8 ␕s8@='O9==MbNw+U2m}/ 2WUhĬ~zqM>u~NzU*\![ mȲfVw@ [c<ΥY1,etvybu1o}/4s0!v7 TbFoل|jM,ТjL&TRexfWM3y\Yorv?CVYW Dʶ6pST|SM)ſ{(ʚ@']Smodem-manager-gui-0.0.16/resources/modem-manager-gui.png000066400000000000000000000316311217271411700231130ustar00rootroot00000000000000PNG  IHDR>asRGBbKGD pHYs B(xtIME Z IDATxweu[ksn{7`7"ɬ%ZJHɦd%?EI%RϦŏh* XeQ, !6fz){>)*>ܹ^~gѥ;HnQ$ؔ;%.`ϤήѷWGNl}j:?߫fkZY|,BbSgDur=R2"\>ǰbh?&]qٛrvnmciq^@HVAB2yl29/`Oy=h{\~ @Dݒ&&'2eܵogSݺ:nd;j=ά/Kci{lF`YER{G/^813'_'{n5–sy_^tz{?](*{ťQ7q}y+b !(%"@`~d~Ńsx%_v_ŭZg'l M<{i;yIGTzUGOLPX A{fYH]7]]ǥ%awl~nzW,Nw{'XovOtxkg>_D\1z;o:='v4:(&0EM0_unt1-><޷}CƍF0D).rA vqmJ#ur,Gl~ 0 7` ˟ȇ֧qwɂ@ҸEv (0 Mi|ۗƧ=zP2wff@Qh"w?{<]s4Eɏ߽ȵ7o\h@CHIB:_X&y%[,`Ϭ-*b23%!d5}xv|lU!h4}PNQ5<[d7/Ю-yW|l^PSY[B\ sJ%xھKHZZ}Wgeʈ3;pBs7o]ݵ<)©{-F>K^&܅y .>HPJ`T/٬yuny@N.>Ƴٖ@ m*> 4Q; FZtd{1f+7ZK 䢔"@Ad!2э}<`i@ B%wv,88Lg[(>c08\|E'58h!h+QF3(Dj_+ݶXZ|{ʇp97|LRĥWĶ,\ C`\T(8>nխɏ` j1 OGu`L$W {ؗMj,=p(>Uy(q5%q/ CWvg~j^rM%%+8ϩF\7,=K/zz+u1g #^U"֢qa尵c[糗,0 O Joqܽqb_r)k!Z]V \}xe.BO6'FI2<2ܮCa*SmZlgzGj|FRC9ǴʧP}5$^]R $[2{P.9ጡD 4LPbK琄h9x&~*@O:<*pp"ײ&,1y ^ْc^(bh^ Ez{iU7,8Skh+Z=hZv RM$*F"3 Iy Ύg&!ȣ$+s-s)1y"BDݹĤA0b@\|&$ rEg-,!C\?N7{ `O AjOeୈieWa2QIBppD@B0 ,HM$s݇d 5Yŵ K5D(Z'bd\9YtaN&( a+(_]ǁ==}e5mncn) ܿ,Q8;Mq T,|,yaE٦#K$ BS9G`4C)(0o}zeDvbQPBY$|agNݷ6n-PÑ%U"ǁ'W_mi=>>vv$ŶK!8tE+ zo$  / /~W[SA*7V!{H8Y ^`]4)/}٥,S*!s G/X|0=ӋfoD%qּ@~xkC΢F 53Y ۈ/=F_6f^JJ 0ȥA(J|;B"W" Q1OIտɶպnAΘL#r` ! Y=q+tT{z2?% :|rQ:Dk0!komg]%heCw Hy8o7m, .RmI2ȿ@ x x1:ԙ!OȾrsT߲+={jJ `H#|'r7E Nm] `FzcHKSl8baуH=W^r@$f_ t>CM-․}m}t!jL:evx^!лUF$GF÷5<^@ːMi.GȨ"D>R[>mxB Ģa5Qdr|sSKhL hMkD@ض ׍mѰO~B9G`PRq˘@[GDAk(x}CI D1 I M5IiP^{!ՅrV U=  J$`y|>Bn0}T*zT!9X̼ãݑ4;Rߩd vAN=ap؊ȓB=ƩeAURÌm1 A |뮏aD8$(bF/ccBq+ YXa0( * Y_~YҥK@G,`Kpn̩F@; ܳ.۩축!ÛiL柫A H9 \<)?KY/`%YS_iIB/ Ay`HTt5ݴ3>x,$S6Pl8%FzH]$dP4k\d/l%tA!G\JKT%WD S0hhz㱣@ RZ z E⺍ź&Pl$<˧RH[}.q=Wމ5qOeI\ 7@I>baC!YycSCJp `Eh5|ɥJTP_PaG53䣈y|@$/ Tq*qE}&L ۧ]Φ聩)jHyE^Jp)ŁNFm8,@XD7fpl~>>@y&b rB5B =s>Bځͫ ,  ¿NN5F$:c5JMkwhgÇJЩ R?⚅kq/i+SYѭ eoIWՐ9wyI;㇨j]ee$p4SaX_9"ɂ}=2&E hmB+UӠ"j'9 X%m!`<)ĕ`=;/s]|D{&P L˫0 @a8@`h.(Q d4yW14 U.`X0-`W4o+yGwz G8,'p vb (OԔ)2$-`W֩Owd= df)¨K(ziIV>D쉁6ӯy"}9JNߥ+]@`P{Of4fDnJ3 x.*l)'C_(4WjF"Pb/@ADZjNjUA J@ylU\_[38}uw<\َT3P#TBs5{8t.iMf5:Y xV(`*NR(KMzAW@XO[;墚^Wa.l=#D  _ZyW+`ݺ>?"[xB)R/i&fC-nE칎Ic5fTv]?( T^Y)GhHʣ]v[}.GKg[ %GlQT͑7"&z䉞B ).(.BD5-5y^ܙ !ǛS~TM\J*LT\Y@TJb?9=&5QWRuv_pɇ7.<MOeMz!BMF4-ZQV>{vRdj'Nhz8r4v ~L%?K%R{hWN/]l,)C( !%T7坋ZR];iq|u,2(P 9H]zp߇fT2+i;7Hȉ|#HA)>Y_9Y+ÇrL3۲qv^/FsMݼP| !Ɇa*(D:=>tw`h,)TPU~; } ~iTڭeXN[(5ϫE'r|L RTӆ9[h!Nh0\0皓[` XE =J լ/;Ch.d_qZhOGds(ل7`ٳc cfMD"d#cA+O j6!3_.McOpA@5j.-u_XN0`MM7,Jezz[~^-)+m`.Ai,@G=Il#Y5phi3TMf]5L0z5UXA0E@AݫBl҆)`9S1g6GAb\<$=֞==3pE\ JnhU=ڟ,O)j#07/.x<=bn$L\ /QҀJ/DbٜPSC"*&!lm,}eShG($Ui8USC13ASYG66A4*2%rb;T&]r֍;BDzo7Qz3s=VGv\l`J2pzBK8*0'k!`\8ȥEa1 2a?L3.~|ဆN3cj:EAŅV eH jv9~@$LJ: tLRِx=$툜;Ȯ95&e>Z@} zqgW&t1HR7gۋ@M:WI[/6TިႹC-uآիG8ʷsX(I:Cª E* B f/D""D^mZ6)esnlkJz4aT^`G}VU ]s7һ{g.yUy@ax:́H.d/2`Η'bt6AhUѵI~ΜOvTR0xTDq<^- ==;A\i KE $ADԣ6)?[;_<'գ_PC!>Ц ;݄) [iUaT$@~jWX.&TxM:gRE 6셚6}o} 輨.@ _ڞN[<rmyG R5ADދ.,G A" );:Xv]~G$h2(J'jD,T:J. zXziD^}PӭT3@vhFvCϿ쯐t8Ξz&|õO(+*+1$_f%uxʼ;UƗz+*؅-6sWGFVlJ5 Pĥz!kH4ޗxԎp),ayB`m陁+QV`0j';ajb@F(D8yuli16ADdA[8S_Tڔ)m~pHtQ{vKtyEDGCܼPxoGw⌕ =oFEA.%Ի-?ݴ~Cv|aR,\+ج!=޹ޮ{K *Rnvye(zVHodz"nmBZ'5}vQŎܵYHdTKZ+ѓUHk4[N@ߏ3d[ =~'óHY)''ĀC [Wޞ<:x`Vaʇ0hM?|c̲n +"UC]Yҟ j9>uP4Pb2{,Bd+ʚoPEVtI{Suyhke!HU0,TJًᫀ-^j>ht_K8Z+JBd92+ʌ=0S\GlF$ JI;%"dvYO&>h.TBQTSB7("@_>m7{YGˆ]fQ]nξN"w`;!? ;#@IF $7OGAPp*#*nO BƥSJ9 IDAT>'S^:@ОXm[-e\ 7G۵S"hg|DA*t~p#ߵwB ;].7QtBV}3_϶!UOQ߰fjqb┮jw+9*0F.{ϓEUJ VMIDYpp g$}d7dz·mꁱ墭E%UQԭS8%ayt`أP\wp){ݒw$k:_|vѪz3J4~GMDX78(O`+=yb7$(J8JC &B?]@[A:Vy0ss ;VbiKe:.)-cWlD5E\wz~CRy&x({5}W9K_~~vb*ȨreY!Ұg\>xV ]tw,jkSbaj(Oʧ#c OTB;ae7h羙_o;z5sO(SOf/yL*؅T;䉁7Gw}x MܡEV^k*JwFq߸1l8Z|ˁ?M/n}G"\=9>!IPPz55"3sJ[XV9pzK㿮wnm1Deؽ?Qdߖ>4 שa>z2ˀ#TэлgEL T~b߼<|'? 5'7w\g6OF3>ڍKUN3W'tϏ^ʾgUoڱ!.~ec0V-( d5sebTҁʈWQ$Fn'~Q$S+C$<`"{];%Tkt;R1*]ؾwԯ^}5TX\r9ΞmIZ_07 M:V YCQ=}|x1}p귭8>bni#'\-Fœ8d sxm|N_ϭe[Ҫ g #z|U!wF$+en%o}sSv)>wFHK1FZ)t6N}{ޱ뾕 )!Wvf3#ǣ[y E^`Wk1Ł_;?_ӾILwBYpJџiעYT — Rߎѵ ?57J($̥/ }egԯQߍtW}buie.dP\̭U],ȌK4K}ǹno<(Q=Zl̳(5Dze SJwрOU&Ḅ&ca'ΕfS/7O6_"!d2'!yp_ߺܼ@P'KT$gnW+9WSɓC'>YSwVZd)䛣/w<&{>ryr6޽-֗.n~ʟ噅6:ja:{tx?nڍ3ɼMU>I%-f셁d嵛[vw-,PO'zWf/ÅVO#7s``B-j'cJWlSx#;U WìF{7~6:ڮ" Z1\;rzɅ}~lu^Moһmst:-7dr'2V~vP7K|!;/T"&dž3j,'FI#G?w߭u~YAS+{;8K?P)"ynGGEM7\}o4Լs.nPYoN./~{??c]u+@Ñ?_* 匆2:lOٺ/ GwU1Yӵ  5[*7 G2N@z~LMqtEI'{v9>߻wT3V3Y.ܟg|v;~XH|{h_@P'b']AR=2NrJzt}z^cu9zyf}s{t 65nH mUPң!OO6.7l^ÃTTNRH!?Ժj}Xv 8'v[e__־S%!N@vC!}fgXrD~[I`ףo.԰mx{4|UݲىZ\m-<]#f- dDm0yB~80lv5jkt_g7˿_۽nG_zݴyP%kiWg؝*RNz ˺N.njw*Ҁd_ᱬ8),E޽cǶ>y/)vlx礣[;W d"!mʞxܼWow#Y.Ő1e5Wk \g_7KXƢ`!=*TU="ȮF'eKGjw6}ug{ƑM-<߭XdzO,7pvIe@(1rڔktT^d/B+tv5NinC[EvQ n@\(<,,%KQNm獲ϟה\eWZjy2QIaUaK(OX8fbRPB)EmOg/ |zD_rB2>W|HM%[nOҢXtH(P#1LRЃ\ڂW822f1Z#3Ko}i N,8s_nywz&9C8eC*N:pA E#pbhlՖZl7OO._IjIcr{K[_y DW2,vMT$(lTEcA3=|Y_ֽ>j,;#aJIFd;@ ) MVJXs~cә[#V?-T25 hR'0G.d%6X]9ø/T0ڻ Sg!tIaۺ1`͝I UVѤ d qN|>Dțɾ\` nhZgk}ևg@r  ^N+;/o@:m~\|,nE9gH&/)|GT>| 97wh'=w|@-]@_  tF~Y|r~w@ QeЗs/tIENDB`modem-manager-gui-0.0.16/resources/modem-manager-gui.ui000066400000000000000000005306231217271411700227510ustar00rootroot00000000000000 False 5 About True center-on-parent True dialog True True window Modem Manager GUI 0.0.16 Copyright 2012-2013 Alex Tool for EDGE/3G/4G modem specific functions control http://linuxonly.ru Homepage GPL3 Alex <alex@linuxonly.ru> English: Alex <alex@linuxonly.ru> Yogesh Kanitkar <openclipart.org> Michal Konstantynowicz / shokunin <openclipart.org/user-detail/shokunin> LlubNek <openclipart.org/user-detail/LlubNek> Umidjon Almasov <u.almasov@gmail.com> gpl-3-0 False vertical 2 False end False True end 0 False 5 Active connections True center-on-parent 500 300 dialog True True window False vertical 2 False end gtk-close True True True True False True 1 False True end 0 True False vertical True False True False Terminate selected application using SIGTERM signal <b>CTRL+T</b> True Terminate application True gtk-stop False True False True 0 True True in True True True True 1 True True 1 connclosebutton False 5 Error True center-on-parent dialog True True False window error close False vertical 2 False end False True end 0 False 5 True center-on-parent dialog True True window False vertical 2 False end gtk-cancel True False True True False True 0 gtk-ok True False True True False True 1 False True end 0 True False 3 True True False 0 10 10 gtk-dialog-question 6 0 0 1 4 Ask me again True False False 0 True True 0 4 2 1 True False 1 <b>Quit or minimize?</b> True 1 0 1 1 True False What do you want application to do on window close? 1 1 1 1 Just quit True False False 0 True True 1 2 1 1 Minimize to tray or messaging menu True False False 0 True True exitcloseradio 1 3 1 1 True True 5 1 exitnobutton exityesbutton False 5 New contact True center-on-parent True True dialog window False vertical 2 False end gtk-close True False True True False True 0 gtk-add True False True True False True 1 False True end 0 True False True True True 1 0 1 1 True True 1 1 1 1 True True 1 2 1 1 True True 1 3 1 1 True True 1 4 1 1 True True 1 5 1 1 True False First name 0 0 1 1 True False First number 0 1 1 1 True False EMail 0 2 1 1 True False Group 0 3 1 1 True False 0.49000000953674316 Second name 0 4 1 1 True False Second number 0 5 1 1 True True 1 newcontactclosebutton newcontactaddbutton 350 250 False 5 New SMS message True center-on-parent dialog True True window False vertical 2 False end gtk-close True True True True False True 0 gtk-save True True True True False True 1 Send True True True False True 2 False True end 0 True False vertical True False True False 5 5 5 5 Number False True 0 True True 5 5 5 5 True True 1 False True 0 True True in True True word True True 1 True True 1 closesmsbutton savesmsbutton sendsmsbutton False 5 Preferences True center-on-parent 350 200 dialog True True window False vertical 2 False end gtk-close True True True True False True 0 gtk-apply True True True True False True 1 False True end 0 True False vertical True False 0 none True False 12 True False vertical Concatenate messages True True False 0 True False True 0 Expand folders True True False 0 True False True 1 Place old messages on top True False False 0 True False True 2 True False <b>SMS</b> True False True 0 True False 0 none True False 12 True False 5 5 True True True 1 0 1 1 True True True 1 1 1 1 True False RX Speed graph color 0 0 1 1 True False 0.49000000953674316 0.49000000953674316 TX Speed graph color 0 1 1 1 True False <b>Traffic</b> True True True 1 True False 0 none True False 12 True False vertical Use sounds for events True False False 0 True False True 0 Hide window to tray on close True False False 0 True False True 1 Save window geometry and placement True False False 0 True False True 2 True False <b>Behaviour</b> True False True 2 True True 1 prefclosebutton prefapplybutton False 5 Progress False True center-on-parent splashscreen True True False window False False vertical 2 False center gtk-stop True False True True False True 0 False True end 0 True False vertical True False 5 5 5 5 Executing command False True 0 True False 5 5 5 5 False True 1 False True 1 interruptoperationbutton False 5 Question True center-on-parent dialog True True False window question yes-no False vertical 2 False end False True end 0 1 10000 1 1 10 1 10000 1 1 10 False 5 Traffic limits True center-on-parent 380 260 dialog True True window False vertical 2 False end gtk-close True True True True False True 0 gtk-apply True True True True False True 1 True True end 0 True False True True Eanble traffic limit True True False 0 True 0 0 3 1 Enable time limit True True False 0 True 0 4 3 1 True False Traffic 0 1 1 1 True True trafficadjustment True 1 1 1 1 True False 0 Mb Gb Tb 2 1 1 1 True False Message 0 2 1 1 True True 1 2 2 1 True False Action 0 3 1 1 True False 0 0 Show message Disconnect 1 3 2 1 True False Time 0 5 1 1 True True timeadjustment 1 5 1 1 True False 0 0 Minutes Hours 2 5 1 1 True False Message 0 6 1 1 True True 1 6 2 1 True False Action 0 7 1 1 True False 0 0 Show message Disconnect 1 7 2 1 True True 1 trafficlimitsclosebutton trafficlimitsapplybutton False 5 Traffic statistics True center-on-parent 500 300 dialog True True window False vertical 2 False end gtk-close True False True True False False 2 False True end 0 True False vertical True False 2 True False Selected statistics period False True 0 gtk-apply True False True True False True end 0 True False 0 1 False True end 1 True False 0 1 January February March April May June July August September October November December False True end 2 False True 0 True False in True False True True 1 True True 1 trafficstatsclosebutton False 5 True center-on-parent 500 300 dialog True True window False vertical 2 False end gtk-close True True True True False True 1 False True end 0 True False vertical True False True False Add new USSD command <b>CTRL+N</b> True Add True gtk-new False True True False Remove selected USSD command <b>CTRL+D</b> True Delete True gtk-remove False True True False False True True False Force USSD answer encoding change from GSM7 to UCS2 (useful for Huawei modems) <b>CTRL+E</b> True Change message encoding True gtk-convert False True False True 0 True True in True True True True 1 True True 1 ussdeditclosebutton 350 250 False Modem Manager GUI center 655 500 True False vertical True False both-horiz True False View and select available devices <b>CTRL+F1</b> True Devices True True False True True False Send and receive SMS messages <b>CTRL+F2</b> True SMS True devbutton False True True False Send USSD requests <b>CTRL+F3</b> True USSD True devbutton False True True False View active device information <b>CTRL+F4</b> True Info True devbutton False True True False Scan existing mobile networks <b>CTRL+F5</b> True Scan True devbutton False True True False Monitor network traffic <b>CTRL+F6</b> True Traffic True devbutton False True True False View system and modem addressbooks <b>CTRL+F7</b> True Contacts True devbutton False True False True 0 True True False True False vertical True False False 8 16 True False gtk-info 2 False True 0 True False No devices found in system end False True 1 False 5 vertical 6 end False True 0 True True in True True True True 1 True False Devices False True False vertical True False False 8 16 True False gtk-info False True 0 True False end False True 1 False 5 vertical 6 end False True 0 True False both-horiz True False Send new SMS message <b>CTRL+N</b> True New True gtk-new False True True False Remove selected message <b>CTRL+D</b> True Remove True gtk-clear False True True False Answer selected message <b>CTRL+A</b> True Answer True gtk-undo False True False True 1 True True 200 True True in True True False True True True in True True False word True True True True 2 1 True False SMS 1 False True False True False 5 5 5 5 Request 0 1 1 1 True True True True in True True False word-char 0 2 4 1 Send True True True Send ussd request <b>CTRL+S</b> 5 5 5 5 3 1 1 1 gtk-edit True True True Edit USSD commands list <b>CTRL+E</b> 5 5 5 5 True 2 1 1 1 True True 5 5 5 5 True True True False 1 1 1 1 True False False 8 16 True False gtk-info False True 0 True False end False True 1 False 5 vertical 6 end 0 0 4 1 2 True False USSD 2 False True False 5 vertical True True False 0 none True False 12 True False 3 3 True False 6 0 0 1 3 True False 0 Device 1 0 1 1 True False True True 2 0 1 1 True False 0 IMEI 1 1 1 1 True False True 2 1 1 1 True False 0 IMSI/ESN 1 2 1 1 True False True True 2 2 1 1 True False <b>Equipment</b> True False True 0 True False 0 none True False 12 True False 3 3 True False 6 0 0 1 5 True False 0 Operator 1 0 1 1 True False True True 2 0 1 1 True False 0 Mode 1 3 1 1 True False True True 2 3 1 1 True False 0 Signal level 1 4 1 1 True False 0 Operator code 1 1 1 1 True False True 2 1 1 1 True False 0 Registration 1 2 1 1 True False True 2 2 1 1 True False center True middle 2 4 1 1 True False <b>Network</b> True False True 1 True False 0 none True False 12 True False 3 3 True False 6 0 0 1 2 True False 0 3GPP Location <small>MCC/MNC/LAC/CID</small> True 1 0 1 1 True False 0 GPS location <small>Longitude/Latiude</small> True 1 1 1 1 True False True True 2 0 1 1 True False True True 2 1 1 1 True False <b>Location</b> True False True 2 3 True False Info 3 False True False True True True True True True in True True 0 2 1 1 True False True True False Scan available mobile networks <b>CTRL+S</b> True Start scan True gtk-find False True 0 1 1 1 True False False 8 16 True False gtk-info False True 0 True False end False True 1 False 5 vertical 6 end 0 0 1 1 4 False True False Scan 4 False True False vertical True False True False Set traffic amount or time limit for disconnect <b>CTRL+L</b> True Set limit True gtk-edit False True True False View list of active network connections <b>CTRL+C</b> True Connections True gtk-network False True True False View daily traffic statistics <b>CTRL+S</b> True Statistics True gtk-justify-fill False True False True 0 True True 200 True True in True True False True True False vertical True False Transmission speed False True 0 True False True True 1 True True True True 1 5 True False Traffic 5 False True False vertical True False False 8 16 True False gtk-info False True 0 True False end False True 1 False 5 vertical 6 end False True 0 True False True False Add new contact to modem addressbook <b>CTRL+N</b> True New contact True gtk-new False True True False Remove contact from modem addressbook <b>CTRL+D</b> True Remove contact True gtk-clear False True True False False True True False Send SMS message to selected contact <b>CTRL+S</b> True Send SMS True gtk-new False True False True 1 True False in True False True True 2 6 True False Contacts 6 False True True 1 True False vertical 2 False True 2 modem-manager-gui-0.0.16/resources/scan-tb.png000066400000000000000000000045161217271411700211510ustar00rootroot00000000000000PNG  IHDR szzsRGBbKGD pHYs  tIME -686IDATXÕolTU;i a]KRg**&vݺ`JL˲M6Mv1Y1D jEXi0.ܡ-h;Rc3PIn{}}h4D"l8 ø0R[n]SJ~JӴiN2<>.&&&H&g~_M<]OP u`kk+<⺮0R|>T,d2LӼ{(s]ߺuRJ ԏ:^Y4&&&ӧR7iB,R)Y~=pxAtb u]/,s<\)uiilldʕ,YqHR$ n޼I>_QB500 ,}<WIjBMpXwb :;;K'9I K)uݵx D"?c-H>Kee%J)fff8y$ׯ_ Bחի|!Jb&RJ (Jj`WBQ^@48|0n::::z{{ǏSYYI]]匏8㠔L˲nH$ar9s6nH__>V,erTWW+u(@ ,g  4O>Q!ϳqFdhh۶r =iRyf,¶mlۦBJCa„R@ eY(ضm`s'x]ym/_F4CJ?m^,ky<>gϞ7 ͢ l&Ӄ8۷;wx9d22G:˲4 u]mVX/N1 qhhh_`0H]]nҥK gmیy۳Dz,V`R 0ֆR>)%۷o穧駟Ʋ,vލ8 Ή@ T* (q\#eYEJIUUVB4bΝ\p۶Bk.ZZZ,\.' :.]²,jjjRz߾}YlFB\Guhii)%lc;wR266F8DZc/H$_d2I*҂d2r\Iԁau[rrr9*++ĉH)|8泥ݻwS^^?Ϻuشi7oFu,Tfr ^{2z҅']R",fggYlsssTUU|rFFFr ىb\x-[j*H)ٳgǎ}!drr=Px(W' =\߫WC`xx(r0O0h[1>br %$ٸM-%arr횏FveUwDKKYTUUe YX,[ߠ݊N;Igx?鬥n @8Li:YYYevfUU!;;)>ܦ  ͋ppňhhl觩NO˕,$ lIQi,|_ PWj`wV:J "4EF|o8$sYwL0BQ c 'zdY*tPX~,a`0r%UF#~`LT՟J0j1{rQ,4d2i,f3> OҀ,v{| pIENDB`modem-manager-gui-0.0.16/resources/sms-tb.png000066400000000000000000000033031217271411700210200ustar00rootroot00000000000000PNG  IHDR szzsRGBbKGD pHYs  tIME )}CIDATXåMlU3 @c@{Ć DBJB!BYd k ‡|]ŀ,b`ك=r7I~zHX@Pi;0a6,.ZJetll안jkkJ5 PO:1v҉^( q]---lٲk-p$g!Jy\1fp& >rٳGDDȜgzv~}cnMf0^/"6mywgZ˗<$5xFD7oL>֕Rr5=KԔonnV y֚ׯcy?( foQJ?vddc ZkED8!+20=޽{dY/^q&?Xr%f,PIx"qR*uJO*jڵORV3Toh* J0 U}}=uP<P.T*qpkmlu]8@hIR1d 0v\.(/]`GmmLLL064<<ٳgؿ?<{ONoo/\NN:---޽ p :HH{6UAWs۶mѣJ%&&&N8WT*$U!tG,O:v4uD"wŭ[ꢶ rR)03 |C1>>^Z~A˭aHĂZkz{{9~8{իq.( (Jri\B:F)WN >J)\ pZ" ,Yɓ'-6PTPJ1>>N}}=lذUVU雚#aZ[[bŊd}oݺƇKAtR&&&=uuu}e˖׬Y&0 .p]O\Zw4뢵j:@TZth"/_^:.)5"4f\vc\Vrd2 &Zkǡt:͓'O&;Z8i8s ;waH+7n܈뺸y8ܸq/_Vߪb=?N?qx^Ç?$R8CGGGd6 d$b9Ӹt>* w׺X,VM^IEɑa԰9r$nBɽY.Kc0LHrd2;FMMMYЉ8~aU}$JxSϟ?{V'州}W3Z?|κ@Ne ʓy^ՙ1X,VGPRa'Ӻ hDDf,CXl"ncvLkXc mmmc>0P򩢀CƘ /64_OrADVcܿ'³ 8|f9=79c(fxIENDB`modem-manager-gui-0.0.16/resources/sms-unread.png000066400000000000000000000010351217271411700216710ustar00rootroot00000000000000PNG  IHDR KU'sBIT|d pHYs B(xtEXtSoftwarewww.inkscape.org<IDAT(Ja|Lt3`V,1b&&Ru` tmoSn+(B0(c]SRIb2$yÈ7:,esOו#ÃT$I7ȶbn - Mò d)NN~߯MfswmmmQ==^Š=i%~+hiiM{IsKs_5u'i16 |U&&PUB!28==ca~7uׄ9NHnzLHmfoS*jªn,e CD"WzO'zXqm' vPVЕuQ]yIO9Π;An Fb|@tu~N)^KwIENDB`modem-manager-gui-0.0.16/resources/traffic-tb.png000066400000000000000000000044361217271411700216440ustar00rootroot00000000000000PNG  IHDR szzbKGD pHYs B(xtIME.yIDATXíMlT罙`cƞbl1|ٍV5V"(TU*mh7iR"JR CԴPH`bᏎ a3v3;FAUt{9<)͛7kmu]_SVVϷMD"RcL9Ryk0-!K94t}}}[__RpiW7nܐ/$u=G?苝oڴi} 8ֶq۶mqmq2J/iDhhhfffOMM=#Xs#7+dۦM,Ku]\ץ0, 4,8 \z˲u]EQfuuoG-k#?~).7oԴgUTQ__O,#SVVyd247o$.4G}$ J]Լݽyluuuq֯_Oyy9yAD2::nݢq=\2944tG::::|>-[D(%ilݺ6B\v`&vahh/>%r> I&8illիNDؾ};]]]CӴȂ} PSSٳgpdxxeYH x!,"EYEkk+/333{SVVFss3;v젧x<^ܳk./t---$ )"r\iW\\(WUUR p@ |cǎ155Ųe裏h44`NXv-W… ܾ}P(D,CDOSFFFp^z&\LLL8{졳|gtuu؈eY|y~?"UnߏmR8mH$mk׮dذaxMx4Mlɓ~4Mcdd sssxC)mši""+**ض|^,"Nsu<+\.HVu7n9 4 ˲0MuPS@{Q^^NMM r9A)뺴@kk+@aA&"q]xRljAaCi |ٱc1;;,mvZ:::N>,^GaLOOyb $jhh@u<|۷~zRLMM133Css3DQ=J)4My!뢯\r8<rDUVd0 q!  /Efٲe$Iz{{O:U̪ił< ~t J4w&3<)~;w0??iD"֬YCgg'xG6_ghh] W""J F7"[D/"RTXjlܸZ)//;399I*رc<|)~'"(s2<,"Шf VPh4Jee%`p|>tL&SbaƨshO+KA< c;?MRh.'ul;WK}ڱvIR|T ø n= x0k_Xc?P%"d/,LI)GDpZX#a|X kw2`E[n<)> aM,t   XZ 40_{_LIENDB`modem-manager-gui-0.0.16/resources/ussd-tb.png000066400000000000000000000031141217271411700211740ustar00rootroot00000000000000PNG  IHDR szzsRGBbKGD pHYs  tIME 2 3`c5IDATXÝW]hGܽ{kDhTت)UۢUH Bb|*mCѷX*mD>آJ -(-"j̽ݝ9}0w7I=p`fgo,aT*Rl~#abYKe-BOj70.r)^ܼysF4υaa\.sww7J%0S#̃466i~,ĜD l0z{{vZhG33<>|ȗ.]aۤҀd(h|i``yFi\.1r 1RʟAPvf\r%VXѲiߴ|yRJV_'AP"3O^39Q̇D/^$jhLD9gOOwuu|BRBA`T*0sck֬aeh}{{;"B P(8N*˲0ohѢ8,˖-î]pܹ9mmm`W-ˢ Z!֭[m۶Az>,Y5/^ i /ђ3Q.!֭4B ð*r0< 13Q.cY6q J D@.mHSƃfaHxB Ǐ hP"J䜈+hZkAq011  Ǐ8@=z}޽{`E!|G^GVk8M5{zI y8SNš !p-Xw^cjj*FguCWJx݋'O,٠Be 3ٳv:c0_$1'"q޽'OFZ,a& ÈA"IBR3QXXӧ}vLMMe^V7 _J"TkMhA"\9sf;cjzKH)!SA&\Qѣ+]JZJo'!5e]0IcI8[… 0M/_Ɲ;wi_Z(} "OKs+-wJ>"^Ʊ>¶׈ l=YrH)QT^e]KRʍ-'&ّRR_FU^)UVaF0::5RPF 'KJy nܸy;Й1-pcR#ne0-cOIENDB`modem-manager-gui-0.0.16/src/000077500000000000000000000000001217271411700156635ustar00rootroot00000000000000modem-manager-gui-0.0.16/src/Makefile000066400000000000000000000014141217271411700173230ustar00rootroot00000000000000include ../Makefile_h BINDIR = $(PREFIX)/bin GCC = gcc #CFLAGS = -mtune=native -O3 -D_GNU_SOURCE LIB = `pkg-config --cflags --libs gtk+-3.0 gthread-2.0` `pkg-config --cflags --libs gmodule-2.0` -lgdbm OBJ = settings.o strformat.o libpaths.o notifications.o addressbooks.o ayatana.o smsdb.o trafficdb.o ussdlist.o encoding.o netlink.o mmguicore.o main.o all: modem-manager-gui modem-manager-gui: $(OBJ) $(GCC) $(OBJ) $(LIB) -o modem-manager-gui .c.o: $(GCC) $(LIB) -c $(CFLAGS) $< -o $@ install: install -d $(INSTALLPREFIX)$(DESTDIR)$(BINDIR) install modem-manager-gui $(INSTALLPREFIX)$(DESTDIR)$(BINDIR) uninstall: rm -f $(INSTALLPREFIX)$(DESTDIR)$(BINDIR)/modem-manager-gui clean: rm -f *.o rm -f modem-manager-gui modem-manager-gui-0.0.16/src/addressbooks.c000066400000000000000000000351271217271411700205220ustar00rootroot00000000000000/* * addressbooks.c * * Copyright 2013 Alex * * 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 . */ #include #include #include #include #include "addressbooks.h" static void mmgui_addressbooks_get_gnome_contacts_foreach(gpointer data, gpointer user_data) { mmgui_addressbooks_t addressbooks; EContact *econtact; mmgui_contact_t contact; const gchar *fullname, *nickname, *primaryphone, *mobilephone, *email, *group; GList *emails; addressbooks = (mmgui_addressbooks_t)user_data; econtact = (EContact *)data; if ((addressbooks == NULL) || (econtact == NULL)) return; fullname = (addressbooks->e_contact_get_const)(econtact, E_CONTACT_FULL_NAME); nickname = (addressbooks->e_contact_get_const)(econtact, E_CONTACT_NICKNAME); primaryphone = (addressbooks->e_contact_get_const)(econtact, E_CONTACT_PHONE_HOME); mobilephone = (addressbooks->e_contact_get_const)(econtact, E_CONTACT_PHONE_MOBILE); group = (addressbooks->e_contact_get_const)(econtact, E_CONTACT_CATEGORIES); emails = (addressbooks->e_contact_get)(econtact, E_CONTACT_EMAIL); email = g_list_nth_data(emails, 0); contact = g_new0(struct _mmgui_contact, 1); contact->name = g_strdup(fullname); contact->number = g_strdup(primaryphone); contact->email = g_strdup(email); contact->group = g_strdup(group); contact->name2 = g_strdup(nickname); contact->number2 = g_strdup(mobilephone); contact->id = addressbooks->counter; contact->hidden = FALSE; contact->storage = MMGUI_CONTACTS_STORAGE_UNKNOWN; addressbooks->gnomecontacts = g_slist_prepend(addressbooks->gnomecontacts, contact); addressbooks->counter++; g_list_foreach(emails, (GFunc)g_free, NULL); g_list_free(emails); } static gboolean mmgui_addressbooks_get_gnome_contacts(mmgui_addressbooks_t addressbooks) { EBookQuery *queryelements[2]; EBookQuery *query; GError *error; gchar *s; /*New API*/ ESourceRegistry *registry; ESource *source, *addressbook; EBookClient *client; GSList *scontacts; /*Old API*/ EBook *book; GList *dcontacts; if (addressbooks == NULL) return FALSE; if (!addressbooks->gnomesupported) return FALSE; if (addressbooks->ebookmodule == NULL) return FALSE; error = NULL; queryelements[0] = (addressbooks->e_book_query_field_exists)(E_CONTACT_PHONE_HOME); queryelements[1] = (addressbooks->e_book_query_field_exists)(E_CONTACT_PHONE_MOBILE); query = (addressbooks->e_book_query_or)(2, queryelements, TRUE); if (query == NULL) { g_debug("Failed to form GNOME contacts query\n"); return FALSE; } if (addressbooks->e_book_new_system_addressbook != NULL) { g_debug("Using old GNOME contacts API\n"); book = (addressbooks->e_book_new_system_addressbook)(&error); if (book == NULL) { (addressbooks->e_book_query_unref)(query); g_debug("Failed to load GNOME system addressbook: %s\n", error->message); g_error_free(error); return FALSE; } if (!(addressbooks->e_book_open)(book, TRUE, &error)) { (addressbooks->e_book_query_unref)(query); g_debug("Failed to load GNOME system addressbook: %s\n", error->message); g_error_free(error); return FALSE; } if (!(addressbooks->e_book_get_contacts)(book, query, &dcontacts, &error)) { (addressbooks->e_book_query_unref)(query); g_debug("Failed to get query GNOME addressbook results: %s\n", error->message); g_error_free(error); return FALSE; } } else { g_debug("Using new GNOME contacts API\n"); registry = (addressbooks->e_source_registry_new_sync)(NULL, &error); if (registry == NULL) { (addressbooks->e_book_query_unref)(query); g_debug("Failed to get ESourceRegistry: %s\n", error->message); g_error_free(error); return FALSE; } source = (addressbooks->e_source_registry_ref_builtin_address_book)(registry); if (source == NULL) { (addressbooks->e_book_query_unref)(query); g_debug("Failed to get ESource\n"); return FALSE; } if (addressbooks->e_book_client_connect_sync != NULL) { /*Version 3.8*/ client = (EBookClient *)(addressbooks->e_book_client_connect_sync)(source, NULL, &error); if (client == NULL) { (addressbooks->e_book_query_unref)(query); g_debug("Failed to get EBookClient: %s\n", error->message); g_error_free(error); return FALSE; } } else { /*Versions 3.2 ... 3.6*/ client = (addressbooks->e_book_client_new)(source, &error); if (client == NULL) { (addressbooks->e_book_query_unref)(query); g_debug("Failed to get EBookClient: %s\n", error->message); g_error_free(error); return FALSE; } if (!(addressbooks->e_client_open_sync)((EClient *)client, TRUE, NULL, &error)) { (addressbooks->e_book_query_unref)(query); g_debug("Failed to open EBookClient: %s\n", error->message); g_error_free(error); return FALSE; } } s = (addressbooks->e_book_query_to_string)(query); if (s == NULL) { (addressbooks->e_book_query_unref)(query); g_debug("Failed to get GNOME addressbook request in string format\n"); return FALSE; } g_debug("GNOME addressbook request: %s\n", s); if (!(addressbooks->e_book_client_get_contacts_sync)(client, s, &scontacts, NULL, &error)) { (addressbooks->e_book_query_unref)(query); g_debug("Failed to get GNOME addressbook query results: %s\n", error->message); g_error_free(error); return FALSE; } } (addressbooks->e_book_query_unref)(query); if (addressbooks->e_book_new_system_addressbook != NULL) { if (dcontacts != NULL) { addressbooks->counter = 0; g_list_foreach(dcontacts, (GFunc)mmgui_addressbooks_get_gnome_contacts_foreach, addressbooks); } else { g_debug("No suitable contacts found\n"); } } else { if (scontacts != NULL) { addressbooks->counter = 0; g_slist_foreach(scontacts, (GFunc)mmgui_addressbooks_get_gnome_contacts_foreach, addressbooks); } else { g_debug("No suitable contacts found\n"); } } addressbooks->counter = 0; return TRUE; } mmgui_addressbooks_t mmgui_addressbooks_new(mmgui_libpaths_cache_t libcache) { mmgui_addressbooks_t addressbooks; gboolean libopened; addressbooks = g_new0(struct _mmgui_addressbooks, 1); /*libebook*/ addressbooks->ebookmodule = NULL; addressbooks->gnomesupported = FALSE; addressbooks->gnomecontacts = NULL; /*Open module*/ addressbooks->ebookmodule = g_module_open(mmgui_libpaths_cache_get_library_name(libcache, "libebook-1.2"), G_MODULE_BIND_LAZY); if (addressbooks->ebookmodule != NULL) { libopened = TRUE; libopened = libopened && g_module_symbol(addressbooks->ebookmodule, "e_book_query_field_exists", (gpointer *)&(addressbooks->e_book_query_field_exists)); libopened = libopened && g_module_symbol(addressbooks->ebookmodule, "e_book_query_or", (gpointer *)&(addressbooks->e_book_query_or)); libopened = libopened && g_module_symbol(addressbooks->ebookmodule, "e_book_query_unref", (gpointer *)&(addressbooks->e_book_query_unref)); libopened = libopened && g_module_symbol(addressbooks->ebookmodule, "e_contact_get_const", (gpointer *)&(addressbooks->e_contact_get_const)); libopened = libopened && g_module_symbol(addressbooks->ebookmodule, "e_contact_get", (gpointer *)&(addressbooks->e_contact_get)); if (g_module_symbol(addressbooks->ebookmodule, "e_book_new_system_addressbook", (gpointer *)&(addressbooks->e_book_new_system_addressbook))) { libopened = libopened && g_module_symbol(addressbooks->ebookmodule, "e_book_open", (gpointer *)&(addressbooks->e_book_open)); libopened = libopened && g_module_symbol(addressbooks->ebookmodule, "e_book_get_contacts", (gpointer *)&(addressbooks->e_book_get_contacts)); /*Unused functions*/ addressbooks->e_source_registry_new_sync = NULL; addressbooks->e_source_registry_ref_builtin_address_book = NULL; addressbooks->e_book_client_new = NULL; addressbooks->e_client_open_sync = NULL; addressbooks->e_book_client_connect_sync = NULL; addressbooks->e_book_query_to_string = NULL; addressbooks->e_book_client_get_contacts_sync = NULL; } else { if (!g_module_symbol(addressbooks->ebookmodule, "e_book_client_connect_sync", (gpointer *)&(addressbooks->e_book_client_connect_sync))) { /*Since version 3.2 used these functions, but in 3.8 they are deprecated*/ libopened = libopened && g_module_symbol(addressbooks->ebookmodule, "e_book_client_new", (gpointer *)&(addressbooks->e_book_client_new)); libopened = libopened && g_module_symbol(addressbooks->ebookmodule, "e_client_open_sync", (gpointer *)&(addressbooks->e_client_open_sync)); addressbooks->e_book_client_connect_sync = NULL; } libopened = libopened && g_module_symbol(addressbooks->ebookmodule, "e_source_registry_new_sync", (gpointer *)&(addressbooks->e_source_registry_new_sync)); libopened = libopened && g_module_symbol(addressbooks->ebookmodule, "e_source_registry_ref_builtin_address_book", (gpointer *)&(addressbooks->e_source_registry_ref_builtin_address_book)); libopened = libopened && g_module_symbol(addressbooks->ebookmodule, "e_book_query_to_string", (gpointer *)&(addressbooks->e_book_query_to_string)); libopened = libopened && g_module_symbol(addressbooks->ebookmodule, "e_book_client_get_contacts_sync", (gpointer *)&(addressbooks->e_book_client_get_contacts_sync)); /*Unused functions*/ addressbooks->e_book_get_contacts = NULL; addressbooks->e_book_open = NULL; addressbooks->e_book_get_contacts = NULL; } /*If some functions not exported, close library*/ if (!libopened) { addressbooks->e_book_query_field_exists = NULL; addressbooks->e_book_query_or = NULL; addressbooks->e_source_registry_new_sync = NULL; addressbooks->e_source_registry_ref_builtin_address_book = NULL; addressbooks->e_book_client_new = NULL; addressbooks->e_client_open_sync = NULL; addressbooks->e_book_query_to_string = NULL; addressbooks->e_book_client_get_contacts_sync = NULL; addressbooks->e_book_new_system_addressbook = NULL; addressbooks->e_book_open = NULL; addressbooks->e_book_get_contacts = NULL; addressbooks->e_book_query_unref = NULL; addressbooks->e_contact_get_const = NULL; addressbooks->e_contact_get = NULL; /*Close module*/ g_module_close(addressbooks->ebookmodule); addressbooks->ebookmodule = NULL; addressbooks->gnomesupported = FALSE; } else { /*Get contacts*/ addressbooks->gnomesupported = TRUE; mmgui_addressbooks_get_gnome_contacts(addressbooks); } } /*KDE addressbook is not supported now*/ addressbooks->kdecontacts = NULL; addressbooks->kdesupported = FALSE; return addressbooks; } gboolean mmgui_addressbooks_get_gnome_contacts_available(mmgui_addressbooks_t addressbooks) { if (addressbooks == NULL) return FALSE; return addressbooks->gnomesupported; } gboolean mmgui_addressbooks_get_kde_contacts_available(mmgui_addressbooks_t addressbooks) { if (addressbooks == NULL) return FALSE; return addressbooks->kdesupported; } GSList *mmgui_addressbooks_get_gnome_contacts_list(mmgui_addressbooks_t addressbooks) { if (addressbooks == NULL) return NULL; if (!addressbooks->gnomesupported) return NULL; return addressbooks->gnomecontacts; } GSList *mmgui_addressbooks_get_kde_contacts_list(mmgui_addressbooks_t addressbooks) { if (addressbooks == NULL) return NULL; if (!addressbooks->kdesupported) return NULL; return addressbooks->kdecontacts; } static gint mmgui_addressbooks_get_contact_compare(gconstpointer a, gconstpointer b) { mmgui_contact_t contact; guint id; contact = (mmgui_contact_t)a; id = GPOINTER_TO_UINT(b); if (contact->id < id) { return 1; } else if (contact->id > id) { return -1; } else { return 0; } } mmgui_contact_t mmgui_addressbooks_get_gnome_contact(mmgui_addressbooks_t addressbooks, guint index) { GSList *contactptr; mmgui_contact_t contact; if (addressbooks == NULL) return NULL; if (!addressbooks->gnomesupported) return NULL; if (addressbooks->gnomecontacts == NULL) return NULL; contactptr = g_slist_find_custom(addressbooks->gnomecontacts, GUINT_TO_POINTER(index), mmgui_addressbooks_get_contact_compare); if (contactptr != NULL) { contact = (mmgui_contact_t)contactptr->data; return contact; } else { return NULL; } } mmgui_contact_t mmgui_addressbooks_get_kde_contact(mmgui_addressbooks_t addressbooks, guint index) { GSList *contactptr; mmgui_contact_t contact; if (addressbooks == NULL) return NULL; if (!addressbooks->kdesupported) return NULL; if (addressbooks->kdecontacts == NULL) return NULL; contactptr = g_slist_find_custom(addressbooks->kdecontacts, GUINT_TO_POINTER(index), mmgui_addressbooks_get_contact_compare); if (contactptr != NULL) { contact = (mmgui_contact_t)contactptr->data; return contact; } else { return NULL; } } static void mmgui_addressbooks_free_contacts_list_foreach(gpointer data, gpointer user_data) { mmgui_contact_t contact; if (data == NULL) return; contact = (mmgui_contact_t)data; if (contact->name != NULL) { g_free(contact->name); } if (contact->number != NULL) { g_free(contact->number); } if (contact->email != NULL) { g_free(contact->email); } if (contact->group != NULL) { g_free(contact->group); } if (contact->name2 != NULL) { g_free(contact->name2); } if (contact->number2 != NULL) { g_free(contact->number2); } } void mmgui_addressbooks_close(mmgui_addressbooks_t addressbooks) { if (addressbooks == NULL) return; /*GNOME addressbook*/ addressbooks->gnomesupported = FALSE; if (addressbooks->ebookmodule != NULL) { /*First free contacts list*/ if (addressbooks->gnomecontacts != NULL) { g_slist_foreach(addressbooks->gnomecontacts, mmgui_addressbooks_free_contacts_list_foreach, NULL); g_slist_free(addressbooks->gnomecontacts); addressbooks->gnomecontacts = NULL; } /*Then unload module*/ g_module_close(addressbooks->ebookmodule); addressbooks->ebookmodule = NULL; } /*KDE addressbook*/ addressbooks->kdesupported = FALSE; if (addressbooks->kdecontacts != NULL) { /*Only free contacts list*/ g_slist_foreach(addressbooks->kdecontacts, mmgui_addressbooks_free_contacts_list_foreach, NULL); g_slist_free(addressbooks->kdecontacts); addressbooks->kdecontacts = NULL; } g_free(addressbooks); } modem-manager-gui-0.0.16/src/addressbooks.h000066400000000000000000000306621217271411700205260ustar00rootroot00000000000000/* * addressbooks.h * * Copyright 2013 Alex * * 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 . */ #ifndef __ADDRESSBOOKS_H__ #define __ADDRESSBOOKS_H__ #include #include #include #include #include "mmguicore.h" /*For contact structure definition*/ #include "libpaths.h" /*GNOME addressbook contact fields*/ typedef enum { E_CONTACT_UID = 1, /* string field */ E_CONTACT_FILE_AS, /* string field */ E_CONTACT_BOOK_UID, /* string field */ /* Name fields */ E_CONTACT_FULL_NAME, /* string field */ E_CONTACT_GIVEN_NAME, /* synthetic string field */ E_CONTACT_FAMILY_NAME, /* synthetic string field */ E_CONTACT_NICKNAME, /* string field */ /* Email fields */ E_CONTACT_EMAIL_1, /* synthetic string field */ E_CONTACT_EMAIL_2, /* synthetic string field */ E_CONTACT_EMAIL_3, /* synthetic string field */ E_CONTACT_EMAIL_4, /* synthetic string field */ E_CONTACT_MAILER, /* string field */ /* Address Labels */ E_CONTACT_ADDRESS_LABEL_HOME, /* synthetic string field */ E_CONTACT_ADDRESS_LABEL_WORK, /* synthetic string field */ E_CONTACT_ADDRESS_LABEL_OTHER, /* synthetic string field */ /* Phone fields */ E_CONTACT_PHONE_ASSISTANT, E_CONTACT_PHONE_BUSINESS, E_CONTACT_PHONE_BUSINESS_2, E_CONTACT_PHONE_BUSINESS_FAX, E_CONTACT_PHONE_CALLBACK, E_CONTACT_PHONE_CAR, E_CONTACT_PHONE_COMPANY, E_CONTACT_PHONE_HOME, E_CONTACT_PHONE_HOME_2, E_CONTACT_PHONE_HOME_FAX, E_CONTACT_PHONE_ISDN, E_CONTACT_PHONE_MOBILE, E_CONTACT_PHONE_OTHER, E_CONTACT_PHONE_OTHER_FAX, E_CONTACT_PHONE_PAGER, E_CONTACT_PHONE_PRIMARY, E_CONTACT_PHONE_RADIO, E_CONTACT_PHONE_TELEX, E_CONTACT_PHONE_TTYTDD, /* Organizational fields */ E_CONTACT_ORG, /* string field */ E_CONTACT_ORG_UNIT, /* string field */ E_CONTACT_OFFICE, /* string field */ E_CONTACT_TITLE, /* string field */ E_CONTACT_ROLE, /* string field */ E_CONTACT_MANAGER, /* string field */ E_CONTACT_ASSISTANT, /* string field */ /* Web fields */ E_CONTACT_HOMEPAGE_URL, /* string field */ E_CONTACT_BLOG_URL, /* string field */ /* Contact categories */ E_CONTACT_CATEGORIES, /* string field */ /* Collaboration fields */ E_CONTACT_CALENDAR_URI, /* string field */ E_CONTACT_FREEBUSY_URL, /* string field */ E_CONTACT_ICS_CALENDAR, /* string field */ E_CONTACT_VIDEO_URL, /* string field */ /* misc fields */ E_CONTACT_SPOUSE, /* string field */ E_CONTACT_NOTE, /* string field */ E_CONTACT_IM_AIM_HOME_1, /* Synthetic string field */ E_CONTACT_IM_AIM_HOME_2, /* Synthetic string field */ E_CONTACT_IM_AIM_HOME_3, /* Synthetic string field */ E_CONTACT_IM_AIM_WORK_1, /* Synthetic string field */ E_CONTACT_IM_AIM_WORK_2, /* Synthetic string field */ E_CONTACT_IM_AIM_WORK_3, /* Synthetic string field */ E_CONTACT_IM_GROUPWISE_HOME_1, /* Synthetic string field */ E_CONTACT_IM_GROUPWISE_HOME_2, /* Synthetic string field */ E_CONTACT_IM_GROUPWISE_HOME_3, /* Synthetic string field */ E_CONTACT_IM_GROUPWISE_WORK_1, /* Synthetic string field */ E_CONTACT_IM_GROUPWISE_WORK_2, /* Synthetic string field */ E_CONTACT_IM_GROUPWISE_WORK_3, /* Synthetic string field */ E_CONTACT_IM_JABBER_HOME_1, /* Synthetic string field */ E_CONTACT_IM_JABBER_HOME_2, /* Synthetic string field */ E_CONTACT_IM_JABBER_HOME_3, /* Synthetic string field */ E_CONTACT_IM_JABBER_WORK_1, /* Synthetic string field */ E_CONTACT_IM_JABBER_WORK_2, /* Synthetic string field */ E_CONTACT_IM_JABBER_WORK_3, /* Synthetic string field */ E_CONTACT_IM_YAHOO_HOME_1, /* Synthetic string field */ E_CONTACT_IM_YAHOO_HOME_2, /* Synthetic string field */ E_CONTACT_IM_YAHOO_HOME_3, /* Synthetic string field */ E_CONTACT_IM_YAHOO_WORK_1, /* Synthetic string field */ E_CONTACT_IM_YAHOO_WORK_2, /* Synthetic string field */ E_CONTACT_IM_YAHOO_WORK_3, /* Synthetic string field */ E_CONTACT_IM_MSN_HOME_1, /* Synthetic string field */ E_CONTACT_IM_MSN_HOME_2, /* Synthetic string field */ E_CONTACT_IM_MSN_HOME_3, /* Synthetic string field */ E_CONTACT_IM_MSN_WORK_1, /* Synthetic string field */ E_CONTACT_IM_MSN_WORK_2, /* Synthetic string field */ E_CONTACT_IM_MSN_WORK_3, /* Synthetic string field */ E_CONTACT_IM_ICQ_HOME_1, /* Synthetic string field */ E_CONTACT_IM_ICQ_HOME_2, /* Synthetic string field */ E_CONTACT_IM_ICQ_HOME_3, /* Synthetic string field */ E_CONTACT_IM_ICQ_WORK_1, /* Synthetic string field */ E_CONTACT_IM_ICQ_WORK_2, /* Synthetic string field */ E_CONTACT_IM_ICQ_WORK_3, /* Synthetic string field */ /* Convenience field for getting a name from the contact. * Returns the first one of[File-As, Full Name, Org, Email1] * to be set */ E_CONTACT_REV, /* string field to hold time of last update to this vcard */ E_CONTACT_NAME_OR_ORG, /* Address fields */ E_CONTACT_ADDRESS, /* Multi-valued structured (EContactAddress) */ E_CONTACT_ADDRESS_HOME, /* synthetic structured field (EContactAddress) */ E_CONTACT_ADDRESS_WORK, /* synthetic structured field (EContactAddress) */ E_CONTACT_ADDRESS_OTHER, /* synthetic structured field (EContactAddress) */ E_CONTACT_CATEGORY_LIST, /* multi-valued */ /* Photo/Logo */ E_CONTACT_PHOTO, /* structured field (EContactPhoto) */ E_CONTACT_LOGO, /* structured field (EContactPhoto) */ E_CONTACT_NAME, /* structured field (EContactName) */ E_CONTACT_EMAIL, /* Multi-valued */ /* Instant Messaging fields */ E_CONTACT_IM_AIM, /* Multi-valued */ E_CONTACT_IM_GROUPWISE, /* Multi-valued */ E_CONTACT_IM_JABBER, /* Multi-valued */ E_CONTACT_IM_YAHOO, /* Multi-valued */ E_CONTACT_IM_MSN, /* Multi-valued */ E_CONTACT_IM_ICQ, /* Multi-valued */ E_CONTACT_WANTS_HTML, /* boolean field */ /* fields used for describing contact lists. a contact list * is just a contact with _IS_LIST set to true. the members * are listed in the _EMAIL field. */ E_CONTACT_IS_LIST, /* boolean field */ E_CONTACT_LIST_SHOW_ADDRESSES, /* boolean field */ E_CONTACT_BIRTH_DATE, /* structured field (EContactDate) */ E_CONTACT_ANNIVERSARY, /* structured field (EContactDate) */ /* Security Fields */ E_CONTACT_X509_CERT, /* structured field (EContactCert) */ E_CONTACT_IM_GADUGADU_HOME_1, /* Synthetic string field */ E_CONTACT_IM_GADUGADU_HOME_2, /* Synthetic string field */ E_CONTACT_IM_GADUGADU_HOME_3, /* Synthetic string field */ E_CONTACT_IM_GADUGADU_WORK_1, /* Synthetic string field */ E_CONTACT_IM_GADUGADU_WORK_2, /* Synthetic string field */ E_CONTACT_IM_GADUGADU_WORK_3, /* Synthetic string field */ E_CONTACT_IM_GADUGADU, /* Multi-valued */ E_CONTACT_GEO, /* structured field (EContactGeo) */ E_CONTACT_TEL, /* list of strings */ E_CONTACT_IM_SKYPE_HOME_1, /* Synthetic string field */ E_CONTACT_IM_SKYPE_HOME_2, /* Synthetic string field */ E_CONTACT_IM_SKYPE_HOME_3, /* Synthetic string field */ E_CONTACT_IM_SKYPE_WORK_1, /* Synthetic string field */ E_CONTACT_IM_SKYPE_WORK_2, /* Synthetic string field */ E_CONTACT_IM_SKYPE_WORK_3, /* Synthetic string field */ E_CONTACT_IM_SKYPE, /* Multi-valued */ E_CONTACT_SIP, E_CONTACT_IM_GOOGLE_TALK_HOME_1, /* Synthetic string field */ E_CONTACT_IM_GOOGLE_TALK_HOME_2, /* Synthetic string field */ E_CONTACT_IM_GOOGLE_TALK_HOME_3, /* Synthetic string field */ E_CONTACT_IM_GOOGLE_TALK_WORK_1, /* Synthetic string field */ E_CONTACT_IM_GOOGLE_TALK_WORK_2, /* Synthetic string field */ E_CONTACT_IM_GOOGLE_TALK_WORK_3, /* Synthetic string field */ E_CONTACT_IM_GOOGLE_TALK, /* Multi-valued */ E_CONTACT_IM_TWITTER, /* Multi-valued */ E_CONTACT_FIELD_LAST, E_CONTACT_FIELD_FIRST = E_CONTACT_UID, /* useful constants */ E_CONTACT_LAST_SIMPLE_STRING = E_CONTACT_NAME_OR_ORG, E_CONTACT_FIRST_PHONE_ID = E_CONTACT_PHONE_ASSISTANT, E_CONTACT_LAST_PHONE_ID = E_CONTACT_PHONE_TTYTDD, E_CONTACT_FIRST_EMAIL_ID = E_CONTACT_EMAIL_1, E_CONTACT_LAST_EMAIL_ID = E_CONTACT_EMAIL_4, E_CONTACT_FIRST_ADDRESS_ID = E_CONTACT_ADDRESS_HOME, E_CONTACT_LAST_ADDRESS_ID = E_CONTACT_ADDRESS_OTHER, E_CONTACT_FIRST_LABEL_ID = E_CONTACT_ADDRESS_LABEL_HOME, E_CONTACT_LAST_LABEL_ID = E_CONTACT_ADDRESS_LABEL_OTHER } EContactField; /*GNOME addressbook structures*/ typedef struct _ESource ESource; typedef struct _ESourceRegistry ESourceRegistry; typedef struct _EBook EBook; typedef struct _EBookClient EBookClient; typedef struct _EClient EClient; typedef struct _EBookQuery EBookQuery; typedef struct _EContact EContact; /*GNOME addressbook function prototypes*/ typedef EBookQuery *(*e_book_query_field_exists_func)(EContactField field); typedef EBookQuery *(*e_book_query_or_func)(gint nqs, EBookQuery **qs, gboolean unref); typedef ESourceRegistry *(*e_source_registry_new_sync_func)(gpointer cancellable, GError **error); typedef ESource *(*e_source_registry_ref_builtin_address_book_func)(ESourceRegistry *registry); typedef EBookClient *(*e_book_client_new_func)(ESource *source, GError **error); typedef gboolean (*e_client_open_sync_func)(EClient *client, gboolean only_if_exists, gpointer cancellable, GError **error); typedef EClient *(*e_book_client_connect_sync_func)(ESource *source, gpointer cancellable, GError **error); typedef gchar *(*e_book_query_to_string_func)(EBookQuery *q); typedef gboolean (*e_book_client_get_contacts_sync_func)(EBookClient *client, const gchar *sexp, GSList **out_contacts, gpointer cancellable, GError **error); typedef EBook *(*e_book_new_system_addressbook_func)(GError **error); typedef gboolean (*e_book_open_func)(EBook *book, gboolean only_if_exists, GError **error); typedef gboolean (*e_book_get_contacts_func)(EBook *book, EBookQuery *query, GList **contacts, GError **error); typedef void (*e_book_query_unref_func)(EBookQuery *q); typedef gconstpointer (*e_contact_get_const_func)(EContact *contact, EContactField field_id); typedef gpointer (*e_contact_get_func)(EContact *contact, EContactField field_id); struct _mmgui_addressbooks { //Modules GModule *ebookmodule; //GNOME addressbook functions e_book_query_field_exists_func e_book_query_field_exists; e_book_query_or_func e_book_query_or; e_source_registry_new_sync_func e_source_registry_new_sync; e_source_registry_ref_builtin_address_book_func e_source_registry_ref_builtin_address_book; e_book_client_new_func e_book_client_new; e_client_open_sync_func e_client_open_sync; e_book_client_connect_sync_func e_book_client_connect_sync; e_book_query_to_string_func e_book_query_to_string; e_book_client_get_contacts_sync_func e_book_client_get_contacts_sync; e_book_new_system_addressbook_func e_book_new_system_addressbook; e_book_open_func e_book_open; e_book_get_contacts_func e_book_get_contacts; e_book_query_unref_func e_book_query_unref; e_contact_get_const_func e_contact_get_const; e_contact_get_func e_contact_get; //GNOME stuff gboolean gnomesupported; GSList *gnomecontacts; //KDE stuff gboolean kdesupported; GSList *kdecontacts; //Counter for internal contacts identification guint counter; }; typedef struct _mmgui_addressbooks *mmgui_addressbooks_t; mmgui_addressbooks_t mmgui_addressbooks_new(mmgui_libpaths_cache_t libcache); gboolean mmgui_addressbooks_get_gnome_contacts_available(mmgui_addressbooks_t addressbooks); gboolean mmgui_addressbooks_get_kde_contacts_available(mmgui_addressbooks_t addressbooks); GSList *mmgui_addressbooks_get_gnome_contacts_list(mmgui_addressbooks_t addressbooks); GSList *mmgui_addressbooks_get_kde_contacts_list(mmgui_addressbooks_t addressbooks); mmgui_contact_t mmgui_addressbooks_get_gnome_contact(mmgui_addressbooks_t addressbooks, guint index); mmgui_contact_t mmgui_addressbooks_get_kde_contact(mmgui_addressbooks_t addressbooks, guint index); void mmgui_addressbooks_close(mmgui_addressbooks_t addressbooks); #endif /* __ADDRESSBOOKS_H__ */ modem-manager-gui-0.0.16/src/ayatana.c000066400000000000000000000334271217271411700174560ustar00rootroot00000000000000/* * ayatana.c * * Copyright 2013 Alex * * 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 . */ #include #include #include #include #include #include #include #include "resources.h" #include "ayatana.h" static void mmgui_ayatana_indicator_server_clicked_signal(MessagingMenuApp *server, guint timestamp, gpointer user_data) { mmgui_ayatana_t ayatana; ayatana = (mmgui_ayatana_t)user_data; if (ayatana == NULL) return; if (ayatana->eventcb != NULL) { (ayatana->eventcb)(MMGUI_AYATANA_EVENT_SERVER, ayatana, NULL, ayatana->userdata); } } static void mmgui_ayatana_indicator_client_clicked_signal(MessagingMenuApp *indicator, guint timestamp, gpointer user_data) { mmgui_ayatana_t ayatana; ayatana = (mmgui_ayatana_t)user_data; if (ayatana == NULL) return; if (ayatana->eventcb != NULL) { (ayatana->eventcb)(MMGUI_AYATANA_EVENT_CLIENT, ayatana, NULL, ayatana->userdata); } } static void mmgui_ayatana_indicator_server_show_signal(IndicateServer *arg0, guint arg1, gpointer user_data) { mmgui_ayatana_t ayatana; ayatana = (mmgui_ayatana_t)user_data; if (ayatana == NULL) return; if (ayatana->eventcb != NULL) { (ayatana->eventcb)(MMGUI_AYATANA_EVENT_SERVER, ayatana, NULL, ayatana->userdata); } } static void mmgui_ayatana_indicator_client_show_signal(IndicateServer *arg0, guint arg1, gpointer user_data) { mmgui_ayatana_t ayatana; ayatana = (mmgui_ayatana_t)user_data; if (ayatana == NULL) return; if (ayatana->eventcb != NULL) { (ayatana->eventcb)(MMGUI_AYATANA_EVENT_CLIENT, ayatana, NULL, ayatana->userdata); } } static gchar *mmgui_ayatana_get_desktiop_file_id(gchar *filepath) { guint pathlen, sym; if (filepath == NULL) return NULL; pathlen = strlen(filepath); if (pathlen == 0) return NULL; for (sym = pathlen; sym >= 0; sym--) { if (filepath[sym] == '/') { break; } } return filepath+sym+1; } static gboolean mmgui_ayatana_setup_menu(mmgui_ayatana_t ayatana) { if (ayatana == NULL) return FALSE; if (ayatana->library == MMGUI_AYATANA_LIB_MESSAGINGMENU) { /*setup server*/ ayatana->backend.mmenu.server = (ayatana->backend.mmenu.messaging_menu_app_new)(mmgui_ayatana_get_desktiop_file_id(RESOURCE_DESKTOP_FILE)); if (ayatana->backend.mmenu.server == NULL) { return FALSE; } (ayatana->backend.mmenu.messaging_menu_app_register)(ayatana->backend.mmenu.server); g_signal_connect(G_OBJECT(ayatana->backend.mmenu.server), "activate-source", G_CALLBACK(mmgui_ayatana_indicator_server_clicked_signal), ayatana); return TRUE; } else if (ayatana->library == MMGUI_AYATANA_LIB_INDICATE) { /*setup server*/ ayatana->backend.ind.server = (ayatana->backend.ind.indicate_server_ref_default)(); if (ayatana->backend.ind.server == NULL) { return FALSE; } (ayatana->backend.ind.indicate_server_set_type)(ayatana->backend.ind.server, "message.im"); (ayatana->backend.ind.indicate_server_set_desktop_file)(ayatana->backend.ind.server, RESOURCE_DESKTOP_FILE); (ayatana->backend.ind.indicate_server_show)(ayatana->backend.ind.server); g_signal_connect(G_OBJECT(ayatana->backend.ind.server), "server-display", G_CALLBACK(mmgui_ayatana_indicator_server_show_signal), ayatana); /*setup client*/ ayatana->backend.ind.client = (ayatana->backend.ind.indicate_indicator_new_with_server)(ayatana->backend.ind.server); if (ayatana->backend.ind.client != NULL) { (ayatana->backend.ind.indicate_indicator_set_property)(ayatana->backend.ind.client, "subtype", "im"); (ayatana->backend.ind.indicate_indicator_set_property)(ayatana->backend.ind.client, "sender", _("Unread SMS")); (ayatana->backend.ind.indicate_indicator_set_property)(ayatana->backend.ind.client, "draw_attention", "false"); (ayatana->backend.ind.indicate_indicator_set_property)(ayatana->backend.ind.client, "count", ""); (ayatana->backend.ind.indicate_indicator_show)(ayatana->backend.ind.client); g_signal_connect(G_OBJECT(ayatana->backend.ind.client), "user-display", G_CALLBACK(mmgui_ayatana_indicator_client_show_signal), ayatana); } return TRUE; } else { return FALSE; } } static gboolean mmgui_ayatana_clean_menu(mmgui_ayatana_t ayatana) { if (ayatana == NULL) return FALSE; if (ayatana->library == MMGUI_AYATANA_LIB_MESSAGINGMENU) { if (ayatana->backend.mmenu.server != NULL) { (ayatana->backend.mmenu.messaging_menu_app_remove_source)(ayatana->backend.mmenu.server, "sms"); (ayatana->backend.mmenu.messaging_menu_app_unregister)(ayatana->backend.mmenu.server); } return TRUE; } else if (ayatana->library == MMGUI_AYATANA_LIB_INDICATE) { if (ayatana->backend.ind.server != NULL) { if (ayatana->backend.ind.client != NULL) { (ayatana->backend.ind.indicate_indicator_hide)(ayatana->backend.ind.client); g_object_unref(G_OBJECT(ayatana->backend.ind.client)); } (ayatana->backend.ind.indicate_server_hide)(ayatana->backend.ind.server); g_object_unref(G_OBJECT(ayatana->backend.ind.server)); } return TRUE; } else { return FALSE; } } mmgui_ayatana_t mmgui_ayatana_new(mmgui_libpaths_cache_t libcache, mmgui_ayatana_event_callback callback, gpointer userdata) { mmgui_ayatana_t ayatana; gboolean libopened; ayatana = g_new0(struct _mmgui_ayatana, 1); /*Initialization*/ ayatana->module = NULL; ayatana->library = MMGUI_AYATANA_LIB_NULL; ayatana->eventcb = callback; ayatana->userdata = userdata; /*Open module for libmessaging-menu*/ ayatana->module = g_module_open(mmgui_libpaths_cache_get_library_name(libcache, "libmessaging-menu"), G_MODULE_BIND_LAZY); if (ayatana->module != NULL) { libopened = TRUE; libopened = libopened && g_module_symbol(ayatana->module, "messaging_menu_app_new", (gpointer *)&(ayatana->backend.mmenu.messaging_menu_app_new)); libopened = libopened && g_module_symbol(ayatana->module, "messaging_menu_app_register", (gpointer *)&(ayatana->backend.mmenu.messaging_menu_app_register)); libopened = libopened && g_module_symbol(ayatana->module, "messaging_menu_app_unregister", (gpointer *)&(ayatana->backend.mmenu.messaging_menu_app_unregister)); libopened = libopened && g_module_symbol(ayatana->module, "messaging_menu_app_append_source", (gpointer *)&(ayatana->backend.mmenu.messaging_menu_app_append_source)); libopened = libopened && g_module_symbol(ayatana->module, "messaging_menu_app_remove_source", (gpointer *)&(ayatana->backend.mmenu.messaging_menu_app_remove_source)); libopened = libopened && g_module_symbol(ayatana->module, "messaging_menu_app_set_source_count", (gpointer *)&(ayatana->backend.mmenu.messaging_menu_app_set_source_count)); libopened = libopened && g_module_symbol(ayatana->module, "messaging_menu_app_draw_attention", (gpointer *)&(ayatana->backend.mmenu.messaging_menu_app_draw_attention)); libopened = libopened && g_module_symbol(ayatana->module, "messaging_menu_app_remove_attention", (gpointer *)&(ayatana->backend.mmenu.messaging_menu_app_remove_attention)); libopened = libopened && g_module_symbol(ayatana->module, "messaging_menu_app_has_source", (gpointer *)&(ayatana->backend.mmenu.messaging_menu_app_has_source)); /*Try to set up menu*/ if (libopened) { ayatana->library = MMGUI_AYATANA_LIB_MESSAGINGMENU; if (!mmgui_ayatana_setup_menu(ayatana)) { ayatana->library = MMGUI_AYATANA_LIB_NULL; } } /*If some functions not exported or menu not set up, close library*/ if ((!libopened) || (ayatana->library == MMGUI_AYATANA_LIB_NULL)) { ayatana->backend.mmenu.messaging_menu_app_new = NULL; ayatana->backend.mmenu.messaging_menu_app_register = NULL; ayatana->backend.mmenu.messaging_menu_app_unregister = NULL; ayatana->backend.mmenu.messaging_menu_app_append_source = NULL; ayatana->backend.mmenu.messaging_menu_app_remove_source = NULL; ayatana->backend.mmenu.messaging_menu_app_set_source_count = NULL; ayatana->backend.mmenu.messaging_menu_app_draw_attention = NULL; ayatana->backend.mmenu.messaging_menu_app_remove_attention = NULL; /*Close module*/ g_module_close(ayatana->module); ayatana->module = NULL; ayatana->library = MMGUI_AYATANA_LIB_NULL; } } if ((ayatana->library == MMGUI_AYATANA_LIB_NULL) && (ayatana->module == NULL)) { /*Open module for libindicate*/ ayatana->module = g_module_open(mmgui_libpaths_cache_get_library_name(libcache, "libindicate"), G_MODULE_BIND_LAZY); if (ayatana->module != NULL) { libopened = TRUE; libopened = libopened && g_module_symbol(ayatana->module, "indicate_server_ref_default", (gpointer *)&(ayatana->backend.ind.indicate_server_ref_default)); libopened = libopened && g_module_symbol(ayatana->module, "indicate_server_set_type", (gpointer *)&(ayatana->backend.ind.indicate_server_set_type)); libopened = libopened && g_module_symbol(ayatana->module, "indicate_server_set_desktop_file", (gpointer *)&(ayatana->backend.ind.indicate_server_set_desktop_file)); libopened = libopened && g_module_symbol(ayatana->module, "indicate_server_show", (gpointer *)&(ayatana->backend.ind.indicate_server_show)); libopened = libopened && g_module_symbol(ayatana->module, "indicate_server_hide", (gpointer *)&(ayatana->backend.ind.indicate_server_hide)); libopened = libopened && g_module_symbol(ayatana->module, "indicate_indicator_new_with_server", (gpointer *)&(ayatana->backend.ind.indicate_indicator_new_with_server)); libopened = libopened && g_module_symbol(ayatana->module, "indicate_indicator_set_property", (gpointer *)&(ayatana->backend.ind.indicate_indicator_set_property)); libopened = libopened && g_module_symbol(ayatana->module, "indicate_indicator_show", (gpointer *)&(ayatana->backend.ind.indicate_indicator_show)); libopened = libopened && g_module_symbol(ayatana->module, "indicate_indicator_hide", (gpointer *)&(ayatana->backend.ind.indicate_indicator_hide)); /*Try to set up menu*/ if (libopened) { ayatana->library = MMGUI_AYATANA_LIB_INDICATE; if (!mmgui_ayatana_setup_menu(ayatana)) { ayatana->library = MMGUI_AYATANA_LIB_NULL; } } /*If some functions not exported or menu not set up, close library*/ if ((!libopened) || (ayatana->library == MMGUI_AYATANA_LIB_NULL)) { ayatana->backend.ind.indicate_server_ref_default = NULL; ayatana->backend.ind.indicate_server_set_type = NULL; ayatana->backend.ind.indicate_server_set_desktop_file = NULL; ayatana->backend.ind.indicate_server_show = NULL; ayatana->backend.ind.indicate_server_hide = NULL; ayatana->backend.ind.indicate_indicator_new_with_server = NULL; ayatana->backend.ind.indicate_indicator_set_property = NULL; ayatana->backend.ind.indicate_indicator_show = NULL; ayatana->backend.ind.indicate_indicator_hide = NULL; /*Close module*/ g_module_close(ayatana->module); ayatana->module = NULL; ayatana->library = MMGUI_AYATANA_LIB_NULL; } } } if ((!libopened) || (ayatana->library == MMGUI_AYATANA_LIB_NULL)) { g_free(ayatana); return NULL; } return ayatana; } void mmgui_ayatana_close(mmgui_ayatana_t ayatana) { if (ayatana == NULL) return; mmgui_ayatana_clean_menu(ayatana); if (ayatana->module != NULL) { g_module_close(ayatana->module); } g_free(ayatana); } void mmgui_ayatana_set_unread_messages_number(mmgui_ayatana_t ayatana, guint number) { GFile *file; GIcon *icon; gchar numstr[32]; if (ayatana == NULL) return; if (ayatana->library == MMGUI_AYATANA_LIB_MESSAGINGMENU) { if (ayatana->backend.mmenu.server != NULL) { if ((ayatana->backend.mmenu.messaging_menu_app_has_source)(ayatana->backend.mmenu.server, "sms")) { if (number > 0) { (ayatana->backend.mmenu.messaging_menu_app_set_source_count)(ayatana->backend.mmenu.server, "sms", number); (ayatana->backend.mmenu.messaging_menu_app_remove_attention)(ayatana->backend.mmenu.server, "sms"); } else { (ayatana->backend.mmenu.messaging_menu_app_remove_source)(ayatana->backend.mmenu.server, "sms"); } } else { if (number > 0) { file = g_file_new_for_path(RESOURCE_SMS_UNREAD); icon = g_file_icon_new(file); (ayatana->backend.mmenu.messaging_menu_app_append_source)(ayatana->backend.mmenu.server, "sms", icon, _("Unread messages")); (ayatana->backend.mmenu.messaging_menu_app_set_source_count)(ayatana->backend.mmenu.server, "sms", number); (ayatana->backend.mmenu.messaging_menu_app_draw_attention)(ayatana->backend.mmenu.server, "sms"); g_signal_connect(G_OBJECT(ayatana->backend.mmenu.server), "activate-source::sms", G_CALLBACK(mmgui_ayatana_indicator_client_clicked_signal), ayatana); g_object_unref(icon); g_object_unref(file); } } } } else if (ayatana->library == MMGUI_AYATANA_LIB_INDICATE) { if (ayatana->backend.ind.server != NULL) { if (ayatana->backend.ind.client != NULL) { if (number > 0) { memset(numstr, 0, sizeof(numstr)); snprintf(numstr, sizeof(numstr), "%u", number); (ayatana->backend.ind.indicate_indicator_set_property)(ayatana->backend.ind.client, "draw_attention", "true"); (ayatana->backend.ind.indicate_indicator_set_property)(ayatana->backend.ind.client, "count", numstr); } else { (ayatana->backend.ind.indicate_indicator_set_property)(ayatana->backend.ind.client, "draw_attention", "false"); (ayatana->backend.ind.indicate_indicator_set_property)(ayatana->backend.ind.client, "count", ""); } } } } } modem-manager-gui-0.0.16/src/ayatana.h000066400000000000000000000121341217271411700174530ustar00rootroot00000000000000/* * ayatana.h * * Copyright 2013 Alex * * 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 . */ #ifndef __AYATANA_H__ #define __AYATANA_H__ #include #include #include "libpaths.h" enum _mmgui_aytana_library { MMGUI_AYATANA_LIB_NULL = 0, MMGUI_AYATANA_LIB_INDICATE, MMGUI_AYATANA_LIB_MESSAGINGMENU }; enum _mmgui_ayatana_event { MMGUI_AYATANA_EVENT_SERVER = 0, MMGUI_AYATANA_EVENT_CLIENT }; /*libindiacate staructures*/ typedef struct _IndicateServer IndicateServer; typedef struct _IndicateIndicator IndicateIndicator; /*libmessaging-menu structures*/ typedef struct _MessagingMenuApp MessagingMenuApp; /*libindicate functions*/ typedef IndicateServer *(*indicate_server_ref_default_func)(void); typedef void (*indicate_server_set_type_func)(IndicateServer *server, const gchar *type); typedef void (*indicate_server_set_desktop_file_func)(IndicateServer *server, const gchar *path); typedef void (*indicate_server_show_func)(IndicateServer *server); typedef void (*indicate_server_hide_func)(IndicateServer *server); typedef IndicateIndicator *(*indicate_indicator_new_with_server_func)(IndicateServer *server); typedef void (*indicate_indicator_set_property_func)(IndicateIndicator *indicator, const gchar *key, const gchar *data); typedef void (*indicate_indicator_show_func)(IndicateIndicator *indicator); typedef void (*indicate_indicator_hide_func)(IndicateIndicator *indicator); /*libmessaging-menu functions*/ typedef MessagingMenuApp *(*messaging_menu_app_new_func)(const gchar *desktop_id); typedef void (*messaging_menu_app_register_func)(MessagingMenuApp *app); typedef void (*messaging_menu_app_unregister_func)(MessagingMenuApp *app); typedef void (*messaging_menu_app_append_source_func)(MessagingMenuApp *app, const gchar *id, GIcon *icon, const gchar *label); typedef void (*messaging_menu_app_remove_source_func)(MessagingMenuApp *app, const gchar *source_id); typedef void (*messaging_menu_app_set_source_count_func)(MessagingMenuApp *app, const gchar *source_id, guint count); typedef void (*messaging_menu_app_draw_attention_func)(MessagingMenuApp *app, const gchar *source_id); typedef void (*messaging_menu_app_remove_attention_func)(MessagingMenuApp *app, const gchar *source_id); typedef gboolean (*messaging_menu_app_has_source_func)(MessagingMenuApp *app, const gchar *source_id); struct _mmgui_ayatana_libindicate { IndicateServer *server; IndicateIndicator *client; indicate_server_ref_default_func indicate_server_ref_default; indicate_server_set_type_func indicate_server_set_type; indicate_server_set_desktop_file_func indicate_server_set_desktop_file; indicate_server_show_func indicate_server_show; indicate_server_hide_func indicate_server_hide; indicate_indicator_new_with_server_func indicate_indicator_new_with_server; indicate_indicator_set_property_func indicate_indicator_set_property; indicate_indicator_show_func indicate_indicator_show; indicate_indicator_hide_func indicate_indicator_hide; }; struct _mmgui_ayatana_libmessagingmenu { MessagingMenuApp *server; messaging_menu_app_new_func messaging_menu_app_new; messaging_menu_app_register_func messaging_menu_app_register; messaging_menu_app_unregister_func messaging_menu_app_unregister; messaging_menu_app_append_source_func messaging_menu_app_append_source; messaging_menu_app_remove_source_func messaging_menu_app_remove_source; messaging_menu_app_set_source_count_func messaging_menu_app_set_source_count; messaging_menu_app_draw_attention_func messaging_menu_app_draw_attention; messaging_menu_app_remove_attention_func messaging_menu_app_remove_attention; messaging_menu_app_has_source_func messaging_menu_app_has_source; }; /*Ayatana event callback*/ typedef void (*mmgui_ayatana_event_callback)(enum _mmgui_ayatana_event event, gpointer ayatana, gpointer data, gpointer userdata); struct _mmgui_ayatana { /*Module*/ GModule *module; /*Used library*/ enum _mmgui_aytana_library library; /*Event callback*/ mmgui_ayatana_event_callback eventcb; gpointer userdata; /*Functions union*/ union { struct _mmgui_ayatana_libindicate ind; struct _mmgui_ayatana_libmessagingmenu mmenu; } backend; }; typedef struct _mmgui_ayatana *mmgui_ayatana_t; mmgui_ayatana_t mmgui_ayatana_new(mmgui_libpaths_cache_t libcache, mmgui_ayatana_event_callback callback, gpointer userdata); void mmgui_ayatana_close(mmgui_ayatana_t ayatana); void mmgui_ayatana_set_unread_messages_number(mmgui_ayatana_t ayatana, guint number); #endif /* __AYATANA_H__ */ modem-manager-gui-0.0.16/src/encoding.c000066400000000000000000000370211217271411700176200ustar00rootroot00000000000000/* * encoding.c * * Copyright 2012-2013 Alex * * 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 . */ #include #include #include #include static const guint gsm7_utf8_table [128] = { 0x0040, 0xc2a3, 0x0024, 0xc2a5, 0xc3a8, 0xc3a9, 0xc3b9, 0xc3ac, 0xc3b2, 0xc387, 0x000a, 0xc398, 0xc3b8, 0x000d, 0xc385, 0xc3a5, 0xce94, 0x005f, 0xcea6, 0xce93, 0xce9b, 0xcea9, 0xcea0, 0xcea8, 0xcea3, 0xce98, 0xce9e, 0x00a0, 0xc386, 0xc3a6, 0xc39f, 0xc389, 0x0020, 0x0021, 0x0022, 0x0023, 0xc2a4, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x002f, 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x003e, 0x003f, 0xc2a1, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f, 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005a, 0xc384, 0xc396, 0xc391, 0xc39c, 0xc2a7, 0xc2bf, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f, 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007a, 0xc3a4, 0xc3b6, 0xc3b1, 0xc3bc, 0xc3a0 }; static const guint gsm7_utf8_ext_table [2][10] = { {0x00000c, 0x00005e, 0x00007b, 0x00007d, 0x00005c, 0x00005b, 0x00007e, 0x00005d, 0x00007c, 0xe282ac}, { 0x0a, 0x14, 0x28, 0x29, 0x2f, 0x3c, 0x3d, 0x3e, 0x40, 0x65} }; static const gchar hextable[16] = {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'}; static guint hex_to_dec(const guchar *input, gsize number); static guint hex_to_dec(const guchar *input, gsize number) { guint k, b, value; gint hexptr; if ((input == NULL) || ((input != NULL) && (input[0] == '\0')) || (number == 0)) return 0; value = 0; k = 1; for (hexptr = (number-1); hexptr >= 0; hexptr--) { switch (input[hexptr]) { case '0': b = 0; break; case '1': b = 1; break; case '2': b = 2; break; case '3': b = 3; break; case '4': b = 4; break; case '5': b = 5; break; case '6': b = 6; break; case '7': b = 7; break; case '8': b = 8; break; case '9': b = 9; break; case 'a': case 'A': b = 10; break; case 'b': case 'B': b = 11; break; case 'c': case 'C': b = 12; break; case 'd': case 'D': b = 13; break; case 'e': case 'E': b = 14; break; case 'f': case 'F': b = 15; break; default: b = 0; break; } value = value + b*k; k *= 16; } return value; } guchar *utf8_to_ucs2(const guchar *input, gsize ilength, gsize *olength) { guchar *output, *routput; guint iptr, optr; gushort value; if ((input == NULL) || (ilength == 0) || (olength == NULL)) return NULL; if (input[0] == '\0') return NULL; output = g_malloc0(ilength*2+1); if (output == NULL) return NULL; iptr = 0; optr = 0; while (iptr < ilength) { if (input[iptr] < 0x80) { value = input[iptr]; output[optr] = '0'; output[optr+1] = '0'; output[optr+2] = hextable[(guchar)(value & 0xff)/16]; output[optr+3] = hextable[(guchar)(value & 0xff)%16]; iptr += 1; optr += 4; } if ((input[iptr] & 0xE0) == 0xE0) { if (!((input[iptr+1] == 0) || (input[iptr+2] == 0))) { value = ((input[iptr] & 0x0F) << 12) | ((input[iptr+1] & 0x3F) << 6) | (input[iptr+2] & 0x3F); output[optr] = hextable[(guchar)((value >> 8) & 0xff)/16]; output[optr+1] = hextable[(guchar)((value >> 8) & 0xff)%16]; output[optr+2] = hextable[(guchar)(value & 0xff)/16]; output[optr+3] = hextable[(guchar)(value & 0xff)%16]; optr += 4; } iptr += 3; } if ((input[0] & 0xC0) == 0xC0) { if (input[1] != 0) { value = ((input[iptr] & 0x1F) << 6) | (input[iptr+1] & 0x3F); output[optr] = hextable[(guchar)((value >> 8) & 0xff)/16]; output[optr+1] = hextable[(guchar)((value >> 8) & 0xff)%16]; output[optr+2] = hextable[(guchar)(value & 0xff)/16]; output[optr+3] = hextable[(guchar)(value & 0xff)%16]; optr += 4; } iptr += 2; } } output[optr] = '\0'; routput = g_realloc(output, optr+1); if (routput != NULL) output = routput; *olength = optr; return output; } guchar *ucs2_to_utf8(const guchar *input, gsize ilength, gsize *olength) { guchar *output, *routput; guint iptr, optr; guint value; if ((input == NULL) || (ilength == 0) || (olength == NULL)) return NULL; if ((input[0] == '\0') || (ilength%4 != 0)) return NULL; output = g_malloc0(ilength*2+1); iptr = 0; optr = 0; while (iptr < ilength) { value = hex_to_dec(input+iptr, 4); if (value < 0x80) { if ((value <= 0x20) && (value != 0x0A) && (value != 0x0D)) { output[optr] = 0x20; } else { output[optr] = value; } optr += 1; } if ((value >= 0x80) && (value < 0x800)) { output[optr] = (value >> 6) | 0xC0; output[optr+1] = (value & 0x3F) | 0x80; optr += 2; } if ((value >= 0x800) && (value < 0xFFFF)) { output[optr] = ((value >> 12)) | 0xE0; output[optr+1] = ((value >> 6) & 0x3F) | 0x80; output[optr+2] = ((value) & 0x3F) | 0x80; optr += 3; } iptr += 4; } output[optr] = '\0'; routput = g_realloc(output, optr+1); if (routput != NULL) output = routput; *olength = optr; return output; } guchar *utf8_to_gsm7(const guchar *input, gsize ilength, gsize *olength) { guchar *output, *routput; guint iptr, optr; gushort x, value; if ((input == NULL) || (ilength == 0) || (olength == NULL)) return NULL; output = g_malloc0(ilength*2+1); if (output == NULL) return NULL; iptr = 0; optr = 0; while (iptr < ilength) { x = (iptr % 8) + 1; if (x < 8) { if ((iptr + 1) == ilength) { value = (input[iptr] >> (iptr % 8)) & 0xff; output[optr] = hextable[(guchar)(value & 0xff)/16]; output[optr+1] = hextable[(guchar)(value & 0xff)%16]; optr += 2; } else { value = (((input[iptr] >> (x - 1)) | (input[iptr+1] << (8 - x))) & 0xff) & 0xff; output[optr] = hextable[(guchar)(value & 0xff)/16]; output[optr+1] = hextable[(guchar)(value & 0xff)%16]; optr += 2; } } iptr++; } output[optr] = '\0'; routput = g_realloc(output, optr+1); if (routput != NULL) output = routput; *olength = optr; return output; } guchar *gsm7_to_utf8(const guchar *input, gsize ilength, gsize *olength) { guchar *output, *routput; guint iptr, optr; guint value, current, mask, next, left; if ((input == NULL) || (ilength == 0) || (olength == NULL)) return NULL; if ((input[0] == '\0') || (ilength%2 != 0)) return NULL; output = g_malloc0(ilength*4+1); if (output == NULL) return NULL; left = 7; mask = 0x7F; next = 0; iptr = 0; optr = 0; while (iptr < ilength) { if (mask != 0) { value = hex_to_dec(input+iptr, 2); current = (((value & mask) << (7 - left)) | next); next = (value & (~mask)) >> left; output[optr] = current; optr += 1; mask >>= 1; left -= 1; iptr += 2; } else { output[optr] = next; optr += 1; left = 7; mask = 0x7F; next = 0; } } output[optr] = '\0'; routput = g_realloc(output, optr+1); if (routput != NULL) output = routput; *olength = optr; return output; } guchar *utf8_map_gsm7(const guchar *input, gsize ilength, gsize *olength) { guchar *output, *routput; guint iptr, optr; guint value; guint i; gboolean detected, found; if ((input == NULL) || (ilength == 0) || (olength == NULL)) return NULL; if (input[0] == '\0') return NULL; output = g_malloc0(ilength*2+1); if (output == NULL) return NULL; iptr = 0; optr = 0; while (iptr < ilength) { detected = FALSE; if (input[iptr] <= 127) { value = input[iptr]; detected = TRUE; iptr += 1; } else if ((input[iptr] >= 194) && (input[iptr] <= 223)) { value = (((input[iptr] << 8) & 0xff00) | input[iptr+1]) & 0xffff; detected = TRUE; iptr += 2; } else if ((input[iptr] >= 224) && (input[iptr] <= 239)) { value = ((((input[iptr] << 16) & 0xff0000) | (input[iptr+1] << 8) & 0x00ff00) | input[iptr+2]) & 0xffffff; detected = TRUE; iptr += 3; } else if ((input[iptr] >= 240) && (input[iptr] <= 244)) { value = (((((input[iptr] << 24) & 0xff000000) | (input[iptr+1] << 16) & 0x00ff0000) | (input[iptr+2] << 8) & 0x0000ff00) | input[iptr+3]) & 0xffffffff; detected = TRUE; iptr += 4; } if (detected) { found = FALSE; for (i=0; i<10; i++) { if (gsm7_utf8_ext_table[0][i] == value) { output[optr] = 0x1b; output[optr+1] = (unsigned char)gsm7_utf8_ext_table[1][i]; optr += 2; found = TRUE; } } if (!found) { for (i=0; i<128; i++) { if (gsm7_utf8_table[i] == value) { output[optr] = (unsigned char)i; optr += 1; found = TRUE; } } } if (!found) { output[optr] = 0x3f; optr += 1; } } } output[optr] = '\0'; routput = g_realloc(output, optr+1); if (routput != NULL) output = routput; *olength = optr; return output; } guchar *bcd_to_utf8_ascii_part(const guchar *input, gsize ilength, gsize *olength) { guchar *output, *routput; guint iptr, optr; guchar value; guchar buf[4]; if ((input == NULL) || (ilength == 0) || (olength == NULL)) return NULL; if (input[0] == '\0') return NULL; //Test if number decoded correctly for (iptr=0; iptr= 3)) { strncpy(buf, input+iptr, 3); value = (unsigned char)atoi(buf); if (value <= 127) { output[optr] = value; optr++; } iptr += 3; } else if (ilength - iptr >= 2) { strncpy(buf, input+iptr, 2); value = (unsigned char)atoi(buf); if (value >= 32) { output[optr] = value; optr++; } iptr += 2; } else { output[optr] = '?'; optr++; iptr++; } } else { break; } } output[optr] = '\0'; routput = g_realloc(output, optr+1); if (routput != NULL) output = routput; *olength = optr; return output; } gchar *encoding_unescape_xml_markup(const gchar *srcstr, gsize srclen) { guint iptr, optr, newlen, charleft; gchar *unescaped; /*XML escape characters: "<", ">", "&", """, "'", " ", " ", " " '<', '>', '&', '\"', '\'', '\r', '\t', '\n' */ if ((srcstr == NULL) || (srclen == 0)) return NULL; iptr = 0; newlen = 0; while (iptr < srclen) { if (srcstr[iptr] == '&') { charleft = srclen - iptr - 1; if (charleft >= 3) { if ((charleft >= 5) && (srcstr[iptr+1] == 'q') && (srcstr[iptr+2] == 'u') && (srcstr[iptr+3] == 'o') && (srcstr[iptr+4] == 't') && (srcstr[iptr+5] == ';')) { newlen += 1; iptr += 6; } else if ((charleft >= 5) && (srcstr[iptr+1] == 'a') && (srcstr[iptr+2] == 'p') && (srcstr[iptr+3] == 'o') && (srcstr[iptr+4] == 's') && (srcstr[iptr+5] == ';')) { newlen += 1; iptr += 6; } else if ((charleft >= 4) && (srcstr[iptr+1] == 'a') && (srcstr[iptr+2] == 'm') && (srcstr[iptr+3] == 'p') && (srcstr[iptr+4] == ';')) { newlen += 1; iptr += 5; } else if ((charleft >= 4) && (srcstr[iptr+1] == '#') && (srcstr[iptr+2] == 'x') && (srcstr[iptr+3] == 'D') && (srcstr[iptr+4] == ';')) { newlen += 1; iptr += 5; } else if ((charleft >= 4) && (srcstr[iptr+1] == '#') && (srcstr[iptr+2] == 'x') && (srcstr[iptr+3] == '9') && (srcstr[iptr+4] == ';')) { newlen += 1; iptr += 5; } else if ((charleft >= 4) && (srcstr[iptr+1] == '#') && (srcstr[iptr+2] == 'x') && (srcstr[iptr+3] == 'A') && (srcstr[iptr+4] == ';')) { newlen += 1; iptr += 5; } else if ((charleft >= 3) && (srcstr[iptr+1] == 'l') && (srcstr[iptr+2] == 't') && (srcstr[iptr+3] == ';')) { newlen += 1; iptr += 4; } else if ((charleft >= 3) && (srcstr[iptr+1] == 'g') && (srcstr[iptr+2] == 't') && (srcstr[iptr+3] == ';')) { newlen += 1; iptr += 4; } else { newlen += 1; iptr += 1; } } else { newlen += 1; iptr += 1; } } else { newlen += 1; iptr += 1; } } unescaped = g_malloc0(newlen+1); iptr = 0; optr = 0; newlen = 0; while (iptr < srclen) { if (srcstr[iptr] == '&') { charleft = srclen - iptr - 1; if (charleft >= 3) { if ((charleft >= 5) && (srcstr[iptr+1] == 'q') && (srcstr[iptr+2] == 'u') && (srcstr[iptr+3] == 'o') && (srcstr[iptr+4] == 't') && (srcstr[iptr+5] == ';')) { unescaped[optr] = '\"'; optr += 1; iptr += 6; } else if ((charleft >= 5) && (srcstr[iptr+1] == 'a') && (srcstr[iptr+2] == 'p') && (srcstr[iptr+3] == 'o') && (srcstr[iptr+4] == 's') && (srcstr[iptr+5] == ';')) { unescaped[optr] = '\''; optr += 1; iptr += 6; } else if ((charleft >= 4) && (srcstr[iptr+1] == 'a') && (srcstr[iptr+2] == 'm') && (srcstr[iptr+3] == 'p') && (srcstr[iptr+4] == ';')) { unescaped[optr] = '&'; optr += 1; iptr += 5; } else if ((charleft >= 4) && (srcstr[iptr+1] == '#') && (srcstr[iptr+2] == 'x') && (srcstr[iptr+3] == 'D') && (srcstr[iptr+4] == ';')) { unescaped[optr] = '\r'; optr += 1; iptr += 5; } else if ((charleft >= 4) && (srcstr[iptr+1] == '#') && (srcstr[iptr+2] == 'x') && (srcstr[iptr+3] == '9') && (srcstr[iptr+4] == ';')) { unescaped[optr] = '\t'; optr += 1; iptr += 5; } else if ((charleft >= 4) && (srcstr[iptr+1] == '#') && (srcstr[iptr+2] == 'x') && (srcstr[iptr+3] == 'A') && (srcstr[iptr+4] == ';')) { unescaped[optr] = '\n'; optr += 1; iptr += 5; } else if ((charleft >= 3) && (srcstr[iptr+1] == 'l') && (srcstr[iptr+2] == 't') && (srcstr[iptr+3] == ';')) { unescaped[optr] = '<'; optr += 1; iptr += 4; } else if ((charleft >= 3) && (srcstr[iptr+1] == 'g') && (srcstr[iptr+2] == 't') && (srcstr[iptr+3] == ';')) { unescaped[optr] = '>'; optr += 1; iptr += 4; } else { unescaped[optr] = srcstr[iptr]; optr += 1; iptr += 1; } } else { unescaped[optr] = srcstr[iptr]; optr += 1; iptr += 1; } } else { unescaped[optr] = srcstr[iptr]; optr += 1; iptr += 1; } } return unescaped; } gchar *encoding_clear_special_symbols(gchar *srcstr, gsize srclen) { guint iptr; if ((srcstr == NULL) || (srclen == 0)) return NULL; iptr = 0; while (iptr < srclen) { if (srcstr[iptr] > 0) { if ((srcstr[iptr] == '\n') || (srcstr[iptr] == '\r') || (srcstr[iptr] == '\t')) { srcstr[iptr] = ' '; } iptr += 1; } else { switch (srcstr[iptr] & 0xF0) { case 0xE0: iptr += 3; break; case 0xF0: iptr += 4; break; default: iptr += 2; break; } } } return srcstr; } modem-manager-gui-0.0.16/src/encoding.h000066400000000000000000000027211217271411700176240ustar00rootroot00000000000000/* * encoding.h * * Copyright 2012 Alex * * 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 . */ #ifndef __ENCODING_H__ #define __ENCODING_H__ #include guchar *utf8_to_ucs2(const guchar *input, gsize ilength, gsize *olength); guchar *ucs2_to_utf8(const guchar *input, gsize ilength, gsize *olength); guchar *utf8_to_gsm7(const guchar *input, gsize ilength, gsize *olength); guchar *gsm7_to_utf8(const guchar *input, gsize ilength, gsize *olength); guchar *utf8_map_gsm7(const guchar *input, gsize ilength, gsize *olength); guchar *bcd_to_utf8_ascii_part(const guchar *input, gsize ilength, gsize *olength); gchar *encoding_unescape_xml_markup(const gchar *srcstr, gsize srclen); gchar *encoding_clear_special_symbols(gchar *srcstr, gsize srclen); #endif /* __ENCODING_H__ */ modem-manager-gui-0.0.16/src/libpaths.c000066400000000000000000000347741217271411700176540ustar00rootroot00000000000000/* * libpaths.c * * Copyright 2013 Alex * * 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 . */ #include #include #include #include #include #include #include #include #include #include #include "libpaths.h" #define MMGUI_LIBPATHS_CACHE_FILE "/etc/ld.so.cache" #define MMGUI_LIBPATHS_CACHE_SOEXT ".so" #define MMGUI_LIBPATHS_CACHE_LIB_TEMP "/usr/lib/%s.so" #define MMGUI_LIBPATHS_CACHE_PATH_TEMP "/usr/lib/%s.so" /*Cache file*/ #define MMGUI_LIBPATHS_LOCAL_CACHE_XDG ".cache" #define MMGUI_LIBPATHS_LOCAL_CACHE_DIR "modem-manager-gui" #define MMGUI_LIBPATHS_LOCAL_CACHE_FILE "libpaths.conf" #define MMGUI_LIBPATHS_LOCAL_CACHE_PERM 0755 /*Cache file sections*/ #define MMGUI_LIBPATHS_FILE_ROOT_SECTION "cache" #define MMGUI_LIBPATHS_FILE_TIMESTAMP "timestamp" #define MMGUI_LIBPATHS_FILE_NAME "name" #define MMGUI_LIBPATHS_FILE_PATH "path" struct _mmgui_libpaths_entry { gchar *id; gchar *libname; gchar *libpath; }; typedef struct _mmgui_libpaths_entry *mmgui_libpaths_entry_t; static gboolean mmgui_libpaths_cache_open_local_cache_file(mmgui_libpaths_cache_t libcache, guint64 dbtimestamp) { const gchar *homepath; gchar *confpath; guint64 localtimestamp; GError *error; if (libcache == NULL) return FALSE; homepath = g_get_home_dir(); if (homepath == NULL) return FALSE; confpath = g_build_filename(homepath, MMGUI_LIBPATHS_LOCAL_CACHE_XDG, MMGUI_LIBPATHS_LOCAL_CACHE_DIR, NULL); if (g_mkdir_with_parents(confpath, MMGUI_LIBPATHS_LOCAL_CACHE_PERM) != 0) { g_debug("No write access to program settings directory"); g_free(confpath); return FALSE; } g_free(confpath); libcache->localfilename = g_build_filename(homepath, MMGUI_LIBPATHS_LOCAL_CACHE_XDG, MMGUI_LIBPATHS_LOCAL_CACHE_DIR, MMGUI_LIBPATHS_LOCAL_CACHE_FILE, NULL); libcache->localkeyfile = g_key_file_new(); error = NULL; if (!g_key_file_load_from_file(libcache->localkeyfile, libcache->localfilename, G_KEY_FILE_NONE, &error)) { libcache->updatelocal = TRUE; g_debug("Local cache file loading error: %s", error->message); g_error_free(error); } else { error = NULL; if (g_key_file_has_key(libcache->localkeyfile, MMGUI_LIBPATHS_FILE_ROOT_SECTION, MMGUI_LIBPATHS_FILE_TIMESTAMP, &error)) { error = NULL; localtimestamp = g_key_file_get_uint64(libcache->localkeyfile, MMGUI_LIBPATHS_FILE_ROOT_SECTION, MMGUI_LIBPATHS_FILE_TIMESTAMP, &error); if (error == NULL) { if (localtimestamp == dbtimestamp) { libcache->updatelocal = FALSE; } else { libcache->updatelocal = TRUE; } } else { libcache->updatelocal = TRUE; g_debug("Local cache contain unreadable timestamp: %s", error->message); g_error_free(error); } } else { libcache->updatelocal = TRUE; g_debug("Local cache does not contain timestamp: %s", error->message); g_error_free(error); } } return !libcache->updatelocal; } static gboolean mmgui_libpaths_cache_close_local_cache_file(mmgui_libpaths_cache_t libcache, gboolean update) { gchar *filedata; gsize datasize; GError *error; if (libcache == NULL) return FALSE; if ((libcache->localfilename == NULL) || (libcache->localkeyfile == NULL)) return FALSE; if (update) { /*Save timestamp*/ g_key_file_set_int64(libcache->localkeyfile, MMGUI_LIBPATHS_FILE_ROOT_SECTION, MMGUI_LIBPATHS_FILE_TIMESTAMP, (gint64)libcache->modtime); /*Write to file*/ error = NULL; filedata = g_key_file_to_data(libcache->localkeyfile, &datasize, &error); if (filedata != NULL) { if (!g_file_set_contents(libcache->localfilename, filedata, datasize, &error)) { g_debug("No data saved to local cache file file: %s", error->message); g_error_free(error); } } g_free(filedata); } /*Free resources*/ g_free(libcache->localfilename); g_key_file_free(libcache->localkeyfile); return TRUE; } static gboolean mmgui_libpaths_cache_add_to_local_cache_file(mmgui_libpaths_cache_t libcache, mmgui_libpaths_entry_t cachedlib) { if ((libcache == NULL) || (cachedlib == NULL)) return FALSE; if ((libcache->updatelocal) && (libcache->localkeyfile != NULL)) { if (cachedlib->id != NULL) { /*Library name*/ if (cachedlib->libname != NULL) { g_key_file_set_string(libcache->localkeyfile, cachedlib->id, MMGUI_LIBPATHS_FILE_NAME, cachedlib->libname); } /*Library path*/ if (cachedlib->libpath != NULL) { g_key_file_set_string(libcache->localkeyfile, cachedlib->id, MMGUI_LIBPATHS_FILE_PATH, cachedlib->libpath); } } } return TRUE; } static gboolean mmgui_libpaths_cache_get_from_local_cache_file(mmgui_libpaths_cache_t libcache, mmgui_libpaths_entry_t cachedlib) { GError *error; if ((libcache == NULL) || (cachedlib == NULL)) return FALSE; if ((!libcache->updatelocal) && (libcache->localkeyfile != NULL)) { if (cachedlib->id != NULL) { /*Library name*/ error = NULL; if (g_key_file_has_key(libcache->localkeyfile, cachedlib->id, MMGUI_LIBPATHS_FILE_NAME, &error)) { error = NULL; cachedlib->libname = g_key_file_get_string(libcache->localkeyfile, cachedlib->id, MMGUI_LIBPATHS_FILE_NAME, &error); if (error != NULL) { g_debug("Local cache contain unreadable library name: %s", error->message); g_error_free(error); } } else { cachedlib->libname = NULL; g_debug("Local cache does not contain library name: %s", error->message); g_error_free(error); } /*Library path*/ error = NULL; if (g_key_file_has_key(libcache->localkeyfile, cachedlib->id, MMGUI_LIBPATHS_FILE_PATH, &error)) { error = NULL; cachedlib->libpath = g_key_file_get_string(libcache->localkeyfile, cachedlib->id, MMGUI_LIBPATHS_FILE_PATH, &error); if (error != NULL) { g_debug("Local cache contain unreadable library path: %s", error->message); g_error_free(error); } } else { cachedlib->libpath = NULL; g_debug("Local cache does not contain library path: %s", error->message); g_error_free(error); } } } return TRUE; } static void mmgui_libpaths_cache_destroy_entry(gpointer data) { mmgui_libpaths_entry_t cachedlib; cachedlib = (mmgui_libpaths_entry_t)data; if (cachedlib == NULL) return; if (cachedlib->id != NULL) { g_free(cachedlib->id); } if (cachedlib->libname != NULL) { g_free(cachedlib->libname); } if (cachedlib->libpath != NULL) { g_free(cachedlib->libpath); } g_free(cachedlib); } static gboolean mmgui_libpaths_cache_get_entry(mmgui_libpaths_cache_t libcache, gchar *libpath) { mmgui_libpaths_entry_t cachedlib; gchar *libext, *libid; guint pathlen, sym, lnsym, lilen, lnlen; gboolean res; if ((libcache == NULL) || (libpath == NULL)) return FALSE; pathlen = strlen(libpath); if (pathlen == 0) return FALSE; libext = strstr(libpath, MMGUI_LIBPATHS_CACHE_SOEXT); if (libext == NULL) return FALSE; lnsym = 0; lilen = 0; lnlen = 0; for (sym = libext-libpath; sym >= 0; sym--) { if (libpath[sym] == '/') { lnsym = sym + 1; lilen = libext - libpath - sym - 1; lnlen = pathlen - sym - 1; break; } } if ((lilen == 0) || (lnlen == 0)) return FALSE; /*library identifier*/ libid = g_malloc0(lilen+1); strncpy(libid, libpath+lnsym, lilen); /*search in hash table*/ cachedlib = (mmgui_libpaths_entry_t)g_hash_table_lookup(libcache->cache, libid); res = FALSE; if (cachedlib != NULL) { if (cachedlib->libname == NULL) { /*library name*/ cachedlib->libname = g_malloc0(lnlen+1); strncpy(cachedlib->libname, libpath+lnsym, lnlen); /*library name found*/ mmgui_libpaths_cache_add_to_local_cache_file(libcache, cachedlib); g_debug("Library name: %s (%s)\n", cachedlib->libname, libid); } if (cachedlib->libpath == NULL) { /*full library path*/ cachedlib->libpath = g_strdup(libpath); /*library path found*/ mmgui_libpaths_cache_add_to_local_cache_file(libcache, cachedlib); g_debug("Library path: %s (%s)\n", cachedlib->libpath, libid); } res = TRUE; } g_free(libid); return res; } static guint mmgui_libpaths_cache_parse_db(mmgui_libpaths_cache_t libcache) { guint ptr, start, end, entry, entries; gchar *entryhash, *entryname, *entryext; if (libcache == NULL) return; /*Cache file must be terminated with value 0x00*/ if (libcache->mapping[libcache->mapsize-1] != 0x00) { g_debug("Cache file seems to be non-valid\n"); return 0; } start = 0; end = libcache->mapsize-1; entries = 0; entry = 0; for (ptr = libcache->mapsize-1; ptr > 0; ptr--) { if (libcache->mapping[ptr] == 0x00) { /*String separator - value 0x00*/ if ((end - ptr) == 1) { /*Termination sequence - two values 0x00 0x00*/ if (start < end) { if (libcache->mapping[start] == '/') { mmgui_libpaths_cache_get_entry(libcache, libcache->mapping+start); entries++; } entry++; } break; } else { /*Regular cache entry*/ if (start < end) { if (libcache->mapping[start] == '/') { mmgui_libpaths_cache_get_entry(libcache, libcache->mapping+start); entries++; } entry++; } /*Set end pointer to string end*/ end = ptr; } } else if (isprint(libcache->mapping[ptr])) { /*Move start pointer because this value is print symbol*/ start = ptr; } } return entries; } mmgui_libpaths_cache_t mmgui_libpaths_cache_new(gchar *libname, ...) { va_list libnames; gchar *currentlib; struct stat statbuf; gboolean localcopy; mmgui_libpaths_cache_t libcache; mmgui_libpaths_entry_t cachedlib; if (libname == NULL) return NULL; libcache = (mmgui_libpaths_cache_t)g_new0(struct _mmgui_libpaths_cache, 1); if (stat(MMGUI_LIBPATHS_CACHE_FILE, &statbuf) == -1) { g_debug("Failed to get library paths cache file size\n"); g_free(libcache); return NULL; } libcache->modtime = statbuf.st_mtime; localcopy = mmgui_libpaths_cache_open_local_cache_file(libcache, (guint64)libcache->modtime); if (!localcopy) { /*Open system cache*/ libcache->fd = open(MMGUI_LIBPATHS_CACHE_FILE, O_RDONLY); if (libcache->fd == -1) { g_debug("Failed to open library paths cache file\n"); mmgui_libpaths_cache_close_local_cache_file(libcache, FALSE); g_free(libcache); return NULL; } /*Memory mapping size*/ libcache->mapsize = (size_t)statbuf.st_size; if (libcache->mapsize == 0) { g_debug("Failed to map empty library paths cache file\n"); mmgui_libpaths_cache_close_local_cache_file(libcache, FALSE); close(libcache->fd); g_free(libcache); return NULL; } /*Map file into memory*/ libcache->mapping = mmap(NULL, libcache->mapsize, PROT_READ, MAP_PRIVATE, libcache->fd, 0); if (libcache->mapping == MAP_FAILED) { g_debug("Failed to map library paths cache file into memory\n"); mmgui_libpaths_cache_close_local_cache_file(libcache, FALSE); close(libcache->fd); g_free(libcache); return NULL; } } /*When no entry found in cache, form safe name adding .so extension*/ libcache->safename = NULL; /*Cache for requested libraries*/ libcache->cache = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, (GDestroyNotify)mmgui_libpaths_cache_destroy_entry); va_start(libnames, libname); /*Dont forget about first library name*/ currentlib = libname; do { /*Allocate structure*/ cachedlib = (mmgui_libpaths_entry_t)g_new0(struct _mmgui_libpaths_entry, 1); cachedlib->id = g_strdup(currentlib); cachedlib->libname = NULL; cachedlib->libpath = NULL; g_hash_table_insert(libcache->cache, cachedlib->id, cachedlib); /*If available, get from local cache*/ if (localcopy) { mmgui_libpaths_cache_get_from_local_cache_file(libcache, cachedlib); } /*Next library name*/ currentlib = va_arg(libnames, gchar *); } while (currentlib != NULL); va_end(libnames); if (!localcopy) { /*Parse system database*/ mmgui_libpaths_cache_parse_db(libcache); /*Save local cache*/ mmgui_libpaths_cache_close_local_cache_file(libcache, TRUE); } else { /*Close used cache file*/ mmgui_libpaths_cache_close_local_cache_file(libcache, FALSE); } return libcache; } void mmgui_libpaths_cache_close(mmgui_libpaths_cache_t libcache) { if (libcache == NULL) return; if (libcache->safename != NULL) { g_free(libcache->safename); } g_hash_table_destroy(libcache->cache); munmap(libcache->mapping, libcache->mapsize); g_free(libcache); } gchar *mmgui_libpaths_cache_get_library_name(mmgui_libpaths_cache_t libcache, gchar *libname) { mmgui_libpaths_entry_t cachedlib; if ((libcache == NULL) || (libname == NULL)) return NULL; cachedlib = (mmgui_libpaths_entry_t)g_hash_table_lookup(libcache->cache, libname); if (cachedlib != NULL) { if (cachedlib->libname != NULL) { /*Cached library name*/ return cachedlib->libname; } else { /*Safe library name*/ if (libcache->safename != NULL) { g_free(libcache->safename); } libcache->safename = g_strdup_printf(MMGUI_LIBPATHS_CACHE_LIB_TEMP, libname); return libcache->safename; } } else { /*Safe library name*/ if (libcache->safename != NULL) { g_free(libcache->safename); } libcache->safename = g_strdup_printf(MMGUI_LIBPATHS_CACHE_LIB_TEMP, libname); return libcache->safename; } } gchar *mmgui_libpaths_cache_get_library_path(mmgui_libpaths_cache_t libcache, gchar *libname) { mmgui_libpaths_entry_t cachedlib; if ((libcache == NULL) || (libname == NULL)) return NULL; cachedlib = (mmgui_libpaths_entry_t)g_hash_table_lookup(libcache->cache, libname); if (cachedlib != NULL) { if (cachedlib->libpath != NULL) { /*Cached library path*/ return cachedlib->libpath; } else { /*Safe library path*/ if (libcache->safename != NULL) { g_free(libcache->safename); } libcache->safename = g_strdup_printf(MMGUI_LIBPATHS_CACHE_PATH_TEMP, libname); return libcache->safename; } } else { /*Safe library path*/ if (libcache->safename != NULL) { g_free(libcache->safename); } libcache->safename = g_strdup_printf(MMGUI_LIBPATHS_CACHE_PATH_TEMP, libname); return libcache->safename; } } modem-manager-gui-0.0.16/src/libpaths.h000066400000000000000000000027411217271411700176460ustar00rootroot00000000000000/* * libpaths.h * * Copyright 2013 Alex * * 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 . */ #ifndef __LIBPATHS_H__ #define __LIBPATHS_H__ #include struct _mmgui_libpaths_cache { gint fd; gchar *mapping; gsize mapsize; time_t modtime; GHashTable *cache; gchar *safename; /*Local cache*/ gchar *localfilename; gboolean updatelocal; GKeyFile *localkeyfile; }; typedef struct _mmgui_libpaths_cache *mmgui_libpaths_cache_t; mmgui_libpaths_cache_t mmgui_libpaths_cache_new(gchar *libname, ...); void mmgui_libpaths_cache_close(mmgui_libpaths_cache_t libcache); gchar *mmgui_libpaths_cache_get_library_name(mmgui_libpaths_cache_t libcache, gchar *libname); gchar *mmgui_libpaths_cache_get_library_path(mmgui_libpaths_cache_t libcache, gchar *libname); #endif /* __LIBPATHS_H__ */ modem-manager-gui-0.0.16/src/main.c000066400000000000000000007340551217271411700167710ustar00rootroot00000000000000/* * main.c * * Copyright 2012-2013 Alex * * 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 . */ #include #include #ifdef __GLIBC__ #include #define __USE_GNU #include #include #endif #include #include #include #include #include #include "settings.h" #include "encoding.h" #include "libpaths.h" #include "notifications.h" #include "addressbooks.h" #include "ayatana.h" #include "strformat.h" #include "mmguicore.h" #include "smsdb.h" #include "trafficdb.h" #include "netlink.h" #include "resources.h" #define MMGUI_MAIN_OPERATION_TIMEOUT 120 #define MMGUI_MAIN_DEFAULT_USSD_COMMAND "*100#" #define MMGUI_MAIN_DEFAULT_DEVICE_IDENTIFIER "00000000000000000000000" enum _mmgui_main_pages { MMGUI_MAIN_PAGE_DEVICES = 0, MMGUI_MAIN_PAGE_SMS, MMGUI_MAIN_PAGE_USSD, MMGUI_MAIN_PAGE_INFO, MMGUI_MAIN_PAGE_SCAN, MMGUI_MAIN_PAGE_TRAFFIC, MMGUI_MAIN_PAGE_CONTACTS, MMGUI_MAIN_PAGE_NUMBER }; enum _mmgui_main_control_shortcuts { MMGUI_MAIN_CONTROL_SHORTCUT_SMS_NEW = 0, MMGUI_MAIN_CONTROL_SHORTCUT_SMS_REMOVE, MMGUI_MAIN_CONTROL_SHORTCUT_SMS_ANSWER, MMGUI_MAIN_CONTROL_SHORTCUT_USSD_EDITOR, MMGUI_MAIN_CONTROL_SHORTCUT_USSD_SEND, MMGUI_MAIN_CONTROL_SHORTCUT_SCAN_START, MMGUI_MAIN_CONTROL_SHORTCUT_TRAFFIC_LIMIT, MMGUI_MAIN_CONTROL_SHORTCUT_TRAFFIC_CONNECTIONS, MMGUI_MAIN_CONTROL_SHORTCUT_TRAFFIC_STATS, MMGUI_MAIN_CONTROL_SHORTCUT_CONTACTS_NEW, MMGUI_MAIN_CONTROL_SHORTCUT_CONTACTS_REMOVE, MMGUI_MAIN_CONTROL_SHORTCUT_CONTACTS_SMS, MMGUI_MAIN_CONTROL_SHORTCUT_NUMBER }; enum _mmgui_main_devlist_columns { MMGUI_MAIN_DEVLIST_ENABLED = 0, MMGUI_MAIN_DEVLIST_DESCRIPTION, MMGUI_MAIN_DEVLIST_ID, MMGUI_MAIN_DEVLIST_IDENTIFIER, MMGUI_MAIN_DEVLIST_COLUMNS }; enum _mmgui_main_smslist_columns { MMGUI_MAIN_SMSLIST_ICON = 0, MMGUI_MAIN_SMSLIST_SMS, MMGUI_MAIN_SMSLIST_ID, MMGUI_MAIN_SMSLIST_FOLDER, MMGUI_MAIN_SMSLIST_ISFOLDER, MMGUI_MAIN_SMSLIST_COLUMNS }; enum _mmgui_main_scanlist_columns { MMGUI_MAIN_SCANLIST_OPERATOR = 0, MMGUI_MAIN_SCANLIST_COLUMNS }; enum _mmgui_main_trafficlist_columns { MMGUI_MAIN_TRAFFICLIST_PARAMETER = 0, MMGUI_MAIN_TRAFFICLIST_VALUE, MMGUI_MAIN_TRAFFICLIST_ID, MMGUI_MAIN_TRAFFICLIST_COLUMNS }; enum _mmgui_main_trafficlist_id { MMGUI_MAIN_TRAFFICLIST_ID_RXDATA = 0, MMGUI_MAIN_TRAFFICLIST_ID_TXDATA, MMGUI_MAIN_TRAFFICLIST_ID_RXSPEED, MMGUI_MAIN_TRAFFICLIST_ID_TXSPEED, MMGUI_MAIN_TRAFFICLIST_ID_TIME, MMGUI_MAIN_TRAFFICLIST_ID_DATALIMIT, MMGUI_MAIN_TRAFFICLIST_ID_TIMELIMIT }; enum _mmgui_main_connectionlist_columns { MMGUI_MAIN_CONNECTIONLIST_APPLICATION = 0, MMGUI_MAIN_CONNECTIONLIST_PID, MMGUI_MAIN_CONNECTIONLIST_PROTOCOL, MMGUI_MAIN_CONNECTIONLIST_STATE, MMGUI_MAIN_CONNECTIONLIST_BUFFER, MMGUI_MAIN_CONNECTIONLIST_LOCALADDR, MMGUI_MAIN_CONNECTIONLIST_DESTADDR, MMGUI_MAIN_CONNECTIONLIST_INODE, MMGUI_MAIN_CONNECTIONLIST_EXISTS, MMGUI_MAIN_CONNECTIONLIST_COLUMNS }; enum _mmgui_main_trafficstatslist_columns { MMGUI_MAIN_TRAFFICSTATSLIST_DAY = 0, MMGUI_MAIN_TRAFFICSTATSLIST_RXDATA, MMGUI_MAIN_TRAFFICSTATSLIST_TXDATA, MMGUI_MAIN_TRAFFICSTATSLIST_SESSIONTIME, MMGUI_MAIN_TRAFFICSTATSLIST_TIMESATMP, MMGUI_MAIN_TRAFFICSTATSLIST_COLUMNS }; enum _mmgui_main_contactslist_columns { MMGUI_MAIN_CONTACTSLIST_NAME = 0, MMGUI_MAIN_CONTACTSLIST_NUMBER, MMGUI_MAIN_CONTACTSLIST_EMAIL, MMGUI_MAIN_CONTACTSLIST_GROUP, MMGUI_MAIN_CONTACTSLIST_NAME2, MMGUI_MAIN_CONTACTSLIST_NUMBER2, MMGUI_MAIN_CONTACTSLIST_HIDDEN, MMGUI_MAIN_CONTACTSLIST_STORAGE, MMGUI_MAIN_CONTACTSLIST_ID, MMGUI_MAIN_CONTACTSLIST_TYPE, MMGUI_MAIN_CONTACTSLIST_COLUMNS }; enum _mmgui_main_new_sms_validation { MMGUI_MAIN_NEW_SMS_VALIDATION_VALID = 0x00, MMGUI_MAIN_NEW_SMS_VALIDATION_WRONG_NUMBER = 0x01, MMGUI_MAIN_NEW_SMS_VALIDATION_WRONG_TEXT = 0x02 }; enum _mmgui_main_traffic_limits_validation { MMGUI_MAIN_LIMIT_TRAFFIC = 0x00, MMGUI_MAIN_LIMIT_TIME = 0x01, MMGUI_MAIN_LIMIT_BOTH = 0x02 }; enum _mmgui_main_new_sms_dialog_result { MMGUI_MAIN_NEW_SMS_DIALOG_CLOSE = 0, MMGUI_MAIN_NEW_SMS_DIALOG_SAVE, MMGUI_MAIN_NEW_SMS_DIALOG_SEND }; enum _mmgui_main_ussdlist_columns { MMGUI_MAIN_USSDLIST_COMMAND = 0, MMGUI_MAIN_USSDLIST_DESCRIPTION, MMGUI_MAIN_USSDLIST_COLUMNS }; enum _mmgui_main_contact_type { MMGUI_MAIN_CONTACT_UNKNOWN = 0, MMGUI_MAIN_CONTACT_HEADER, MMGUI_MAIN_CONTACT_MODEM, MMGUI_MAIN_CONTACT_GNOME, MMGUI_MAIN_CONTACT_KDE }; enum _mmgui_main_exit_dialog_result { MMGUI_MAIN_EXIT_DIALOG_CANCEL = -1, MMGUI_MAIN_EXIT_DIALOG_EXIT = 0, MMGUI_MAIN_EXIT_DIALOG_HIDE = 1 }; struct _mmgui_main_window { //Window GtkWidget *window; GtkWidget *toolbar; GtkWidget *statusbar; guint sbcontext; //Dialogs GtkWidget *aboutdialog; GtkWidget *prefdialog; GtkWidget *questiondialog; GtkWidget *errordialog; GtkWidget *exitdialog; //Progress dialog GtkWidget *progressdialog; GtkWidget *progressbar; guint progresstimeout; //Info bar for devices page GtkWidget *nodevbar; //New SMS dialog GtkWidget *newsmsdialog; GtkWidget *smsnumberentry; GtkWidget *smstextview; GtkWidget *sendsmsbutton; GtkWidget *savesmsbutton; //Toolbar GtkWidget *devbutton; GtkWidget *smsbutton; GtkWidget *ussdbutton; GtkWidget *infobutton; GtkWidget *scanbutton; GtkWidget *contactsbutton; GtkWidget *trafficbutton; //Pages GtkWidget *notebook; //Devices page GtkWidget *devlist; //SMS page GtkWidget *smsinfobar; GtkWidget *smsinfobarlabel; GtkWidget *smslist; GtkWidget *smstext; GtkWidget *newsmsbutton; GtkWidget *removesmsbutton; GtkWidget *answersmsbutton; GdkPixbuf *smsreadicon; GdkPixbuf *smsunreadicon; GtkTreePath *incomingpath; GtkTreePath *sentpath; GtkTreePath *draftspath; //Info page GtkWidget *devicevlabel; GtkWidget *operatorvlabel; GtkWidget *operatorcodevlabel; GtkWidget *regstatevlabel; GtkWidget *modevlabel; GtkWidget *imeivlabel; GtkWidget *imsivlabel; GtkWidget *signallevelprogressbar; GtkWidget *info3gpplocvlabel; GtkWidget *infogpslocvlabel; GtkWidget *equipmentimage; GtkWidget *networkimage; GtkWidget *locationimage; //USSD page GtkWidget *ussdinfobar; GtkWidget *ussdinfobarlabel; GtkWidget *ussdentry; GtkWidget *ussdcombobox; GtkWidget *ussdeditor; GtkWidget *ussdsend; GtkWidget *ussdtext; GtkTextTag *ussdrequesttag; GtkTextTag *ussdhinttag; GtkTextTag *ussdanswertag; //Scan page GtkWidget *scaninfobar; GtkWidget *scaninfobarlabel; GtkWidget *scanlist; GtkWidget *startscanbutton; //Traffic page GtkWidget *trafficparamslist; GtkWidget *trafficdrawingarea; GtkWidget *trafficlimitbutton; GtkWidget *trafficconnbutton; //Contacts page GtkWidget *contactsinfobar; GtkWidget *contactsinfobarlabel; GtkWidget *newcontactbutton; GtkWidget *removecontactbutton; GtkWidget *smstocontactbutton; GtkWidget *contactstreeview; GtkWidget *contactssmsmenu; GtkTreePath *contmodempath; GtkTreePath *contgnomepath; GtkTreePath *contkdepath; //New contact dialog GtkWidget *newcontactdialog; GtkWidget *contactnameentry; GtkWidget *contactnumberentry; GtkWidget *contactemailentry; GtkWidget *contactgroupentry; GtkWidget *contactname2entry; GtkWidget *contactnumber2entry; GtkWidget *newcontactaddbutton; //Limits dialog GtkWidget *trafficlimitsdialog; GtkWidget *trafficlimitcheckbutton; GtkWidget *trafficamount; GtkWidget *trafficunits; GtkWidget *trafficmessage; GtkWidget *trafficaction; GtkWidget *timelimitcheckbutton; GtkWidget *timeamount; GtkWidget *timeunits; GtkWidget *timemessage; GtkWidget *timeaction; //Connections dialog GtkAccelGroup *connaccelgroup; GtkWidget *conndialog; GtkWidget *connscrolledwindow; GtkWidget *conntreeview; GtkWidget *conntermtoolbutton; //Traffic statistics dialog GtkWidget *trafficstatsdialog; GtkWidget *trafficstatstreeview; GtkWidget *trafficstatsmonthcb; GtkWidget *trafficstatsyearcb; //USSD editor dialog GtkAccelGroup *ussdaccelgroup; GtkWidget *ussdeditdialog; GtkWidget *ussdedittreeview; GtkWidget *newussdtoolbutton; GtkWidget *removeussdtoolbutton; GtkWidget *ussdencodingtoolbutton; //Preferences GtkWidget *prefsmsconcat; GtkWidget *prefsmsexpand; GtkWidget *prefsmsoldontop; GtkWidget *preftrafficrxcolor; GtkWidget *preftraffictxcolor; GtkWidget *prefbehavioursounds; GtkWidget *prefbehaviourhide; GtkWidget *prefbehaviourgeom; //Exit dialog GtkWidget *exitaskagain; GtkWidget *exitcloseradio; GtkWidget *exithideradio; /*Keyboard acceletators*/ GtkAccelGroup *accelgroup; /*Page shortcuts*/ GSList *pageshortcuts; /*Closures for pages*/ GClosure *devclosure; GClosure *smsclosure; GClosure *ussdclosure; GClosure *infoclosure; GClosure *scanclosure; GClosure *contactsclosure; GClosure *trafficclosure; /*Closures for SMS page*/ GClosure *newsmsclosure; GClosure *removesmsclosure; GClosure *answersmsclosure; /*Closures for USSD page*/ GClosure *ussdeditorclosure; GClosure *ussdsendclosure; /*Closures for Scan page*/ GClosure *startscanclosure; /*Closures for Traffic page*/ GClosure *trafficlimitclosure; GClosure *trafficconnclosure; GClosure *trafficstatsclosure; /*Closures for Contacts page*/ GClosure *newcontactclosure; GClosure *removecontactclosure; GClosure *smstocontactclosure; /*Tray icon*/ GtkStatusIcon *statusicon; GtkWidget *traymenu; GtkWidget *showwin_tm, *sep1_tm, *newsms_tm, *sep2_tm, *quit_tm; gulong traysigid; }; typedef struct _mmgui_main_window *mmgui_main_window_t; struct _mmgui_cli_options { gboolean invisible; gboolean minimized; gboolean nostatistics; gboolean nosmsupdate; //SMS gboolean concatsms; gboolean smsexpandfolders; gboolean smsoldontop; //Traffic graph GdkColor rxtrafficcolor; GdkColor txtrafficcolor; //Behaviour gboolean usesounds; gboolean hidetotray; gboolean askforhide; gboolean savegeometry; //Window geometry gint wgwidth; gint wgheight; gint wgposx; gint wgposy; }; typedef struct _mmgui_cli_options *mmgui_cli_options_t; struct _mmgui_application { //GTK+ application object GtkApplication *gtkapplication; //Allocated structures mmgui_main_window_t window; mmgui_cli_options_t options; mmgui_traffic_limits_t limits; //Objects mmguicore_t core; settings_t settings; mmgui_libpaths_cache_t libcache; mmgui_notifications_t notifications; mmgui_addressbooks_t addressbooks; mmgui_ayatana_t ayatana; }; typedef struct _mmgui_application *mmgui_application_t; struct _mmgui_application_data { mmgui_application_t mmguiapp; gpointer data; }; typedef struct _mmgui_application_data *mmgui_application_data_t; //EVENTS static void mmgui_main_event_callback(enum _mmgui_event event, gpointer mmguicore, gpointer data, gpointer userdata); //UI static gboolean mmgui_main_ui_question_dialog_open(mmgui_application_t mmguiapp, gchar *caption, gchar *text); static gboolean mmgui_main_ui_error_dialog_open(mmgui_application_t mmguiapp, gchar *caption, gchar *text); static gboolean mmgui_main_ui_progress_dialog_update_progress(gpointer data); static void mmgui_main_ui_progress_dialog_open(mmgui_application_t mmguiapp); static void mmgui_main_ui_progress_dialog_close(mmgui_application_t mmguiapp); static void mmgui_main_ui_page_control_disable(mmgui_application_t mmguiapp, guint page, gboolean disable, gboolean onlylimited); void mmgui_main_ui_devices_button_toggled_signal(GObject *object, gpointer data); void mmgui_main_ui_sms_button_toggled_signal(GObject *object, gpointer data); void mmgui_main_ui_ussd_button_toggled_signal(GObject *object, gpointer data); void mmgui_main_ui_info_button_toggled_signal(GObject *object, gpointer data); void mmgui_main_ui_scan_button_toggled_signal(GObject *object, gpointer data); void mmgui_main_ui_traffic_button_toggled_signal(GObject *object, gpointer data); void mmgui_main_ui_contacts_button_toggled_signal(GObject *object, gpointer data); void mmgui_main_ui_window_destroy_signal(GObject *object, gpointer data); static void mmgui_main_ui_exit_menu_item_activate_signal(GSimpleAction *action, GVariant *parameter, gpointer data); static void mmgui_main_ui_about_menu_item_activate_signal(GSimpleAction *action, GVariant *parameter, gpointer data); static void mmgui_main_ui_preferences_menu_item_activate_signal(GSimpleAction *action, GVariant *parameter, gpointer data); static void mmgui_main_ui_control_buttons_disable(mmgui_application_t mmguiapp, gboolean disable); void mmgui_main_ui_interrupt_operation_button_clicked_signal(GObject *object, gpointer data); //TRAY static void mmgui_main_tray_icon_activation_signal(GtkStatusIcon *status_icon, gpointer data); static void mmgui_main_tray_icon_window_show_signal(GtkCheckMenuItem *checkmenuitem, gpointer data); static void mmgui_main_tray_icon_new_sms_signal(GtkMenuItem *menuitem, gpointer data); static void mmgui_main_tray_icon_exit_signal(GtkMenuItem *menuitem, gpointer data); static void mmgui_main_tray_popup_menu_show_signal(GtkStatusIcon *status_icon, guint button, guint activate_time, gpointer data); /*Ayatana*/ static void mmgui_main_ayatana_event_callback(enum _mmgui_ayatana_event event, gpointer ayatana, gpointer data, gpointer userdata); //CONTACTS static mmgui_contact_t mmgui_main_contacts_list_get_selected(mmgui_application_t mmguiapp, guint *type); static void mmgui_main_contacts_list_cursor_changed_signal(GtkTreeView *tree_view, gpointer data); static void mmgui_main_contacts_sms(mmgui_application_t mmguiapp); void mmgui_main_contacts_sms_button_clicked_signal(GObject *object, gpointer data); static void mmgui_main_contacts_sms_menu_activate_signal(GtkMenuItem *menuitem, gpointer data); static void mmgui_main_contacts_new(mmgui_application_t mmguiapp); void mmgui_main_contacts_new_button_clicked_signal(GObject *object, gpointer user_data); static void mmgui_main_contacts_remove(mmgui_application_t mmguiapp); void mmgui_main_contacts_remove_button_clicked_signal(GObject *object, gpointer user_data); static void mmgui_main_contacts_list_fill(mmgui_application_t mmguiapp); static void mmgui_main_contacts_addressbook_list_fill(mmgui_application_t mmguiapp, guint contacttype); static void mmgui_main_contacts_list_init(mmgui_application_t mmguiapp); //TRAFFIC static gboolean mmgui_main_traffic_stats_history_update_from_thread(gpointer data); static void mmgui_main_traffic_statistics_dialog(mmgui_application_t mmguiapp); void mmgui_main_traffic_statistics_dialog_button_clicked_signal(GObject *object, gpointer data); static gboolean mmgui_main_traffic_connections_update_from_thread(gpointer data); void mmgui_main_traffic_connections_terminate_button_clicked_signal(GObject *object, gpointer data); static void mmgui_main_traffic_connections_dialog(mmgui_application_t mmguiapp); void mmgui_main_traffic_connections_dialog_button_clicked_signal(GObject *object, gpointer data); static void mmgui_main_traffic_connections_list_init(mmgui_application_t mmguiapp); static gboolean mmgui_main_traffic_limits_show_message_from_thread(gpointer data); static void mmgui_main_traffic_limits_dialog_time_section_disable_signal(GtkToggleButton *togglebutton, gpointer data); static void mmgui_main_traffic_limits_dialog_traffic_section_disable_signal(GtkToggleButton *togglebutton, gpointer data); static gboolean mmgui_main_traffic_limits_dialog_open(mmgui_application_t mmguiapp); static void mmgui_main_traffic_limits_dialog(mmgui_application_t mmguiapp); void mmgui_main_traffic_limits_dialog_button_clicked_signal(GObject *object, gpointer data); static gboolean mmgui_main_traffic_update_statusbar_from_thread(gpointer data); static gboolean mmgui_main_traffic_stats_update_from_thread_foreach(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data); static gboolean mmgui_main_traffic_stats_update_from_thread(gpointer data); static void mmgui_main_traffic_speed_plot_draw(GtkWidget *widget, cairo_t *cr, gpointer data); static void mmgui_main_traffic_list_init(mmgui_application_t mmguiapp); //SCAN static void mmgui_main_scan_start(mmgui_application_t mmguiapp); void mmgui_main_scan_start_button_clicked_signal(GObject *object, gpointer data); static void mmgui_main_scan_list_fill_foreach(gpointer data, gpointer user_data); static void mmgui_main_scan_list_fill(mmgui_application_t mmguiapp, mmguicore_t mmguicore, GSList *netlist); static void mmgui_main_scan_list_init(mmgui_application_t mmguiapp); //INFO static void mmgui_main_info_update_for_device(mmgui_application_t mmguiapp); static void mmgui_main_info_handle_signal_level_change(mmgui_application_t mmguiapp, mmguidevice_t device); static void mmgui_main_info_handle_network_mode_change(mmgui_application_t mmguiapp, mmguidevice_t device); static void mmgui_main_info_handle_network_registration_change(mmgui_application_t mmguiapp, mmguidevice_t device); static void mmgui_main_info_handle_location_change(mmgui_application_t mmguiapp, mmguidevice_t device); //USSD void mmgui_main_ussd_command_add_button_clicked_signal(GObject *object, gpointer data); void mmgui_main_ussd_command_remove_button_clicked_signal(GObject *object, gpointer data); static void mmgui_main_ussd_menu_update_callback(gchar *command, gchar *description, gboolean reencode, gpointer data); static void mmgui_main_ussd_list_read_callback(gchar *command, gchar *description, gboolean reencode, gpointer data); static gboolean mmgui_main_ussd_list_add_command_to_xml_export_foreach(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data); static void mmgui_main_ussd_edit(mmgui_application_t mmguiapp); void mmgui_main_ussd_edit_button_clicked_signal(GtkEditable *editable, gpointer data); void mmgui_main_ussd_command_combobox_changed_signal(GObject *object, gpointer data); void mmgui_main_ussd_command_entry_changed_signal(GtkEditable *editable, gpointer data); void mmgui_main_ussd_command_entry_activated_signal(GtkEntry *entry, gpointer data); void mmgui_main_ussd_send_button_clicked_signal(GtkButton *button, gpointer data); static void mmgui_main_ussd_request_send(mmgui_application_t mmguiapp); static void mmgui_main_ussd_request_send_end(mmgui_application_t mmguiapp, mmguicore_t mmguicore, const gchar *answer); static void mmgui_main_ussd_list_command_cell_edited_signal(GtkCellRendererText *renderer, gchar *path, gchar *new_text, gpointer data); static void mmgui_main_ussd_list_description_cell_edited_signal(GtkCellRendererText *renderer, gchar *path, gchar *new_text, gpointer data); static void mmgui_main_ussd_list_init(mmgui_application_t mmguiapp); //SMS static void mmgui_main_sms_get_message_list_hash_destroy_notify(gpointer data); static gboolean mmgui_main_sms_get_message_list_from_thread(gpointer data); static gboolean mmgui_main_sms_get_message_from_thread(gpointer data); static void mmgui_main_sms_new_dialog_number_changed_signal(GtkEditable *editable, gpointer data); static enum _mmgui_main_new_sms_dialog_result mmgui_main_sms_new_dialog(mmgui_application_t mmguiapp, const gchar *number, const gchar *text); static gboolean mmgui_main_sms_send(mmgui_application_t mmguiapp, const gchar *number, const gchar *text); static void mmgui_main_sms_remove(mmgui_application_t mmguiapp); void mmgui_main_sms_remove_button_clicked_signal(GObject *object, gpointer data); static void mmgui_main_sms_new(mmgui_application_t mmguiapp); void mmgui_main_sms_new_button_clicked_signal(GObject *object, gpointer data); static void mmgui_main_sms_answer(mmgui_application_t mmguiapp); void mmgui_main_sms_answer_button_clicked_signal(GObject *object, gpointer data); static void mmgui_main_sms_list_cursor_changed_signal(GtkTreeView *tree_view, gpointer data); static void mmgui_main_sms_add_to_list(mmgui_application_t mmguiapp, mmgui_sms_message_t sms, GtkTreeModel *model); static gboolean mmgui_main_sms_list_fill(mmgui_application_t mmguiapp); static void mmgui_main_sms_list_init(mmgui_application_t mmguiapp); //Devices static void mmgui_main_device_handle_enabled_local_status(mmgui_application_t mmguiapp, gboolean result); static gboolean mmgui_main_device_handle_enabled_status_from_thread(gpointer data); static gboolean mmgui_main_device_handle_blocked_status_from_thread(gpointer data); static gboolean mmgui_main_device_handle_connection_status_from_thread(gpointer data); static void mmgui_main_device_handle_enable(mmgui_application_t mmguiapp, mmguicore_t mmguicore); static void mmgui_main_device_clear_data(mmgui_application_t mmguiapp); static gboolean mmgui_main_device_open(mmgui_application_t mmguiapp, guint id); static gboolean mmgui_main_device_list_unselect_foreach(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data); static void mmgui_main_device_list_select_signal(GtkCellRendererToggle *cell_renderer, gchar *path, gpointer data); static gboolean mmgui_main_device_select_from_list(mmgui_application_t mmguiapp, gchar *identifier); static void mmgui_main_device_remove_from_list(mmgui_application_t mmguiapp, guint devid); static void mmgui_main_device_add_to_list(mmgui_application_t mmguiapp, mmguidevice_t device, GtkTreeModel *model); static void mmgui_main_device_list_fill(mmgui_application_t mmguiapp); static void mmgui_main_device_list_init(mmgui_application_t mmguiapp); //Initialization static void mmgui_main_application_unresolved_error(mmgui_application_t mmguiapp, gchar *caption, gchar *text); static gboolean mmgui_main_settings_ui_load(mmgui_application_t mmguiapp); static gboolean mmgui_main_settings_load(mmgui_application_t mmguiapp); static gboolean mmgui_main_application_build_user_interface(mmgui_application_t mmguiapp); static void mmgui_main_application_terminate(mmgui_application_t mmguiapp); static void mmgui_main_application_activate_signal(GtkApplication *application, gpointer data); static void mmgui_main_application_shutdown_signal(GtkApplication *application, gpointer data); #ifdef __GLIBC__ static void mmgui_main_application_backtrace_signal_handler(int sig, siginfo_t *info, ucontext_t *ucontext); #endif //EVENTS static void mmgui_main_event_callback(enum _mmgui_event event, gpointer mmguicore, gpointer data, gpointer userdata) { mmguidevice_t device; mmgui_application_t mmguiapp; mmgui_application_data_t appdata; guint id; mmguiapp = (mmgui_application_t)userdata; switch (event) { case MMGUI_EVENT_DEVICE_ADDED: device = (mmguidevice_t)data; //Add device to list mmgui_main_device_add_to_list(mmguiapp, device, NULL); //If no device opened, open that one if (mmguicore_devices_get_current(mmguicore) == NULL) { mmgui_main_device_select_from_list(mmguiapp, device->persistentid); } //Unlock control buttons mmgui_main_ui_control_buttons_disable(mmguiapp, FALSE); break; case MMGUI_EVENT_DEVICE_REMOVED: id = GPOINTER_TO_UINT(data); //Remove device from list mmgui_main_device_remove_from_list(mmguiapp, id); //Look for available devices if (mmguicore_devices_get_list(mmguicore) == NULL) { //No devices available, lock control buttons mmgui_main_ui_control_buttons_disable(mmguiapp, TRUE); } else if (mmguicore_devices_get_current(mmguicore) == NULL) { //If no device opened, open default one mmgui_main_device_select_from_list(mmguiapp, NULL); } break; case MMGUI_EVENT_DEVICE_ENABLED_STATUS: appdata = g_new0(struct _mmgui_application_data, 1); appdata->mmguiapp = mmguiapp; appdata->data = data; g_idle_add(mmgui_main_device_handle_enabled_status_from_thread, appdata); break; case MMGUI_EVENT_DEVICE_BLOCKED_STATUS: appdata = g_new0(struct _mmgui_application_data, 1); appdata->mmguiapp = mmguiapp; appdata->data = data; g_idle_add(mmgui_main_device_handle_blocked_status_from_thread, appdata); break; case MMGUI_EVENT_DEVICE_CONNECTION_STATUS: appdata = g_new0(struct _mmgui_application_data, 1); appdata->mmguiapp = mmguiapp; appdata->data = data; g_idle_add(mmgui_main_device_handle_connection_status_from_thread, appdata); break; case MMGUI_EVENT_SIGNAL_LEVEL_CHANGE: device = (mmguidevice_t)data; mmgui_main_info_handle_signal_level_change(mmguiapp, device); break; case MMGUI_EVENT_NETWORK_MODE_CHANGE: device = (mmguidevice_t)data; mmgui_main_info_handle_network_mode_change(mmguiapp, device); break; case MMGUI_EVENT_NETWORK_REGISTRATION_CHANGE: device = (mmguidevice_t)data; mmgui_main_info_handle_network_registration_change(mmguiapp, device); break; case MMGUI_EVENT_LOCATION_CHANGE: device = (mmguidevice_t)data; mmgui_main_info_handle_location_change(mmguiapp, device); break; case MMGUI_EVENT_MODEM_ENABLE_RESULT: id = GPOINTER_TO_UINT(data); mmgui_main_device_handle_enabled_local_status(mmguiapp, (gboolean)id); break; case MMGUI_EVENT_SCAN_RESULT: //Show found networks mmgui_main_scan_list_fill(mmguiapp, (mmguicore_t)mmguicore, (GSList *)data); //Hide progress dialog mmgui_main_ui_progress_dialog_close(mmguiapp); break; case MMGUI_EVENT_USSD_RESULT: //Show answer mmgui_main_ussd_request_send_end(mmguiapp, (mmguicore_t)mmguicore, (const gchar *)data); //Hide progress dialog mmgui_main_ui_progress_dialog_close(mmguiapp); break; case MMGUI_EVENT_SMS_COMPLETED: appdata = g_new0(struct _mmgui_application_data, 1); appdata->mmguiapp = mmguiapp; appdata->data = data; g_idle_add(mmgui_main_sms_get_message_from_thread, appdata); break; case MMGUI_EVENT_SMS_LIST_READY: appdata = g_new0(struct _mmgui_application_data, 1); appdata->mmguiapp = mmguiapp; appdata->data = data; g_idle_add(mmgui_main_sms_get_message_list_from_thread, appdata); break; case MMGUI_EVENT_SMS_SENT: mmgui_main_ui_progress_dialog_close(mmguiapp); if (!GPOINTER_TO_UINT(data)) { mmgui_main_ui_error_dialog_open(mmguiapp, _("Error sending message"), mmguicore_get_last_error(mmguiapp->core)); } break; case MMGUI_EVENT_NET_STATUS: g_idle_add(mmgui_main_traffic_update_statusbar_from_thread, mmguiapp); g_idle_add(mmgui_main_traffic_stats_update_from_thread, mmguiapp); if (gtk_widget_get_visible(mmguiapp->window->trafficstatsdialog)) { g_idle_add(mmgui_main_traffic_stats_history_update_from_thread, mmguiapp); } break; case MMGUI_EVENT_TRAFFIC_LIMIT: case MMGUI_EVENT_TIME_LIMIT: appdata = g_new0(struct _mmgui_application_data, 1); appdata->mmguiapp = mmguiapp; appdata->data = GINT_TO_POINTER(event); g_idle_add(mmgui_main_traffic_limits_show_message_from_thread, appdata); break; case MMGUI_EVENT_UPDATE_CONNECTIONS_LIST: if (gtk_widget_get_visible(mmguiapp->window->conndialog)) { g_idle_add(mmgui_main_traffic_connections_update_from_thread, mmguiapp); } break; default: g_debug("Unknown event (%u) got from core\n", event); break; } } //UI static gboolean mmgui_main_ui_question_dialog_open(mmgui_application_t mmguiapp, gchar *caption, gchar *text) { gint response; if ((mmguiapp == NULL) || (caption == NULL) || (text == NULL)) return FALSE; gtk_message_dialog_set_markup(GTK_MESSAGE_DIALOG(mmguiapp->window->questiondialog), caption); gtk_message_dialog_format_secondary_markup(GTK_MESSAGE_DIALOG(mmguiapp->window->questiondialog), "%s", text); response = gtk_dialog_run(GTK_DIALOG(mmguiapp->window->questiondialog)); gtk_widget_hide(mmguiapp->window->questiondialog); return (response == GTK_RESPONSE_YES); } static gboolean mmgui_main_ui_error_dialog_open(mmgui_application_t mmguiapp, gchar *caption, gchar *text) { gint response; if ((mmguiapp == NULL) || (caption == NULL) || (text == NULL)) return FALSE; gtk_message_dialog_set_markup(GTK_MESSAGE_DIALOG(mmguiapp->window->errordialog), caption); gtk_message_dialog_format_secondary_markup(GTK_MESSAGE_DIALOG(mmguiapp->window->errordialog), "%s", text); response = gtk_dialog_run(GTK_DIALOG(mmguiapp->window->errordialog)); gtk_widget_hide(mmguiapp->window->errordialog); return (response == GTK_RESPONSE_CLOSE); } static gboolean mmgui_main_ui_progress_dialog_update_progress(gpointer data) { mmgui_application_data_t appdata; time_t currenttime; appdata = (mmgui_application_data_t)data; if (appdata == NULL) return; currenttime = time(NULL); if (abs((gint)difftime(*((time_t *)appdata->data), currenttime)) > MMGUI_MAIN_OPERATION_TIMEOUT) { if (mmguicore_interrupt_operation(appdata->mmguiapp->core)) { mmgui_main_ui_progress_dialog_close(appdata->mmguiapp); mmgui_main_ui_error_dialog_open(appdata->mmguiapp, _("Operation timed out"), _("Operation took too long to execute. Please restart it.")); return FALSE; } } gtk_progress_bar_pulse((GtkProgressBar *)appdata->mmguiapp->window->progressbar); return TRUE; } static void mmgui_main_ui_progress_dialog_open(mmgui_application_t mmguiapp) { static struct _mmgui_application_data appdata; static time_t starttime; if (mmguiapp == NULL) return; starttime = time(NULL); appdata.mmguiapp = mmguiapp; appdata.data = &starttime; mmguiapp->window->progresstimeout = g_timeout_add(100, mmgui_main_ui_progress_dialog_update_progress, &appdata); gtk_dialog_run(GTK_DIALOG(mmguiapp->window->progressdialog)); } static void mmgui_main_ui_progress_dialog_close(mmgui_application_t mmguiapp) { if (mmguiapp == NULL) return; g_source_remove(mmguiapp->window->progresstimeout); mmguiapp->window->progresstimeout = 0; gtk_widget_hide(mmguiapp->window->progressdialog); } static void mmgui_main_ui_page_control_disable(mmgui_application_t mmguiapp, guint page, gboolean disable, gboolean onlylimited) { if ((mmguiapp == NULL) || (page > MMGUI_MAIN_PAGE_CONTACTS)) return; switch (page) { case MMGUI_MAIN_PAGE_DEVICES: break; case MMGUI_MAIN_PAGE_SMS: gtk_widget_set_sensitive(mmguiapp->window->newsmsbutton, !disable); break; case MMGUI_MAIN_PAGE_USSD: gtk_widget_set_sensitive(mmguiapp->window->ussdentry, !disable); gtk_widget_set_sensitive(mmguiapp->window->ussdcombobox, !disable); gtk_widget_set_sensitive(mmguiapp->window->ussdeditor, !disable); gtk_widget_set_sensitive(mmguiapp->window->ussdsend, !disable); if (!disable) { g_signal_emit_by_name(G_OBJECT(mmguiapp->window->ussdentry), "changed", mmguiapp); } break; case MMGUI_MAIN_PAGE_INFO: break; case MMGUI_MAIN_PAGE_SCAN: gtk_widget_set_sensitive(mmguiapp->window->startscanbutton, !disable); break; case MMGUI_MAIN_PAGE_TRAFFIC: break; case MMGUI_MAIN_PAGE_CONTACTS: gtk_widget_set_sensitive(mmguiapp->window->newcontactbutton, !disable); break; default: break; } } static void mmgui_main_ui_page_select_by_accelerator_signal(gpointer data) { mmgui_application_data_t appdata; guint setpage; gboolean devopened; appdata = (mmgui_application_data_t)data; if (appdata == NULL) return; setpage = GPOINTER_TO_UINT(appdata->data); if ((appdata->mmguiapp->core != NULL) && (mmguicore_devices_get_current(appdata->mmguiapp->core) != NULL)) { devopened = TRUE; } else { devopened = FALSE; } switch (setpage) { case MMGUI_MAIN_PAGE_DEVICES: gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(appdata->mmguiapp->window->devbutton), TRUE); break; case MMGUI_MAIN_PAGE_SMS: if (devopened) { gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(appdata->mmguiapp->window->smsbutton), TRUE); } break; case MMGUI_MAIN_PAGE_USSD: if (devopened) { gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(appdata->mmguiapp->window->ussdbutton), TRUE); } break; case MMGUI_MAIN_PAGE_INFO: if (devopened) { gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(appdata->mmguiapp->window->infobutton), TRUE); } break; case MMGUI_MAIN_PAGE_SCAN: if (devopened) { gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(appdata->mmguiapp->window->scanbutton), TRUE); } break; case MMGUI_MAIN_PAGE_TRAFFIC: if (devopened) { gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(appdata->mmguiapp->window->trafficbutton), TRUE); } break; case MMGUI_MAIN_PAGE_CONTACTS: if (devopened) { gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(appdata->mmguiapp->window->contactsbutton), TRUE); } break; default: gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(appdata->mmguiapp->window->devbutton), TRUE); break; } } static void mmgui_main_ui_page_setup_shortcuts(mmgui_application_t mmguiapp, guint setpage) { GSList *iterator; GClosure *closure; if (mmguiapp == NULL) return; if (mmguiapp->window->pageshortcuts != NULL) { for (iterator=mmguiapp->window->pageshortcuts; iterator; iterator=iterator->next) { closure = (GClosure *)iterator->data; if (closure != NULL) { g_closure_ref(closure); gtk_accel_group_disconnect(mmguiapp->window->accelgroup, closure); } } g_slist_free(mmguiapp->window->pageshortcuts); mmguiapp->window->pageshortcuts = NULL; } switch (setpage) { case MMGUI_MAIN_PAGE_DEVICES: break; case MMGUI_MAIN_PAGE_SMS: /*send sms message*/ gtk_accel_group_connect(mmguiapp->window->accelgroup, GDK_KEY_N, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE, mmguiapp->window->newsmsclosure); mmguiapp->window->pageshortcuts = g_slist_prepend(mmguiapp->window->pageshortcuts, mmguiapp->window->newsmsclosure); /*remove sms message*/ gtk_accel_group_connect(mmguiapp->window->accelgroup, GDK_KEY_D, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE, mmguiapp->window->removesmsclosure); mmguiapp->window->pageshortcuts = g_slist_prepend(mmguiapp->window->pageshortcuts, mmguiapp->window->removesmsclosure); /*answer sms message*/ gtk_accel_group_connect(mmguiapp->window->accelgroup, GDK_KEY_A, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE, mmguiapp->window->answersmsclosure); mmguiapp->window->pageshortcuts = g_slist_prepend(mmguiapp->window->pageshortcuts, mmguiapp->window->answersmsclosure); break; case MMGUI_MAIN_PAGE_USSD: /*edit ussd commands*/ gtk_accel_group_connect(mmguiapp->window->accelgroup, GDK_KEY_E, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE, mmguiapp->window->ussdeditorclosure); mmguiapp->window->pageshortcuts = g_slist_prepend(mmguiapp->window->pageshortcuts, mmguiapp->window->ussdeditorclosure); /*send ussd request*/ gtk_accel_group_connect(mmguiapp->window->accelgroup, GDK_KEY_S, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE, mmguiapp->window->ussdsendclosure); mmguiapp->window->pageshortcuts = g_slist_prepend(mmguiapp->window->pageshortcuts, mmguiapp->window->ussdsendclosure); break; case MMGUI_MAIN_PAGE_INFO: break; case MMGUI_MAIN_PAGE_SCAN: /*scan networks*/ gtk_accel_group_connect(mmguiapp->window->accelgroup, GDK_KEY_S, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE, mmguiapp->window->startscanclosure); mmguiapp->window->pageshortcuts = g_slist_prepend(mmguiapp->window->pageshortcuts, mmguiapp->window->startscanclosure); break; case MMGUI_MAIN_PAGE_TRAFFIC: /*limits*/ gtk_accel_group_connect(mmguiapp->window->accelgroup, GDK_KEY_L, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE, mmguiapp->window->trafficlimitclosure); mmguiapp->window->pageshortcuts = g_slist_prepend(mmguiapp->window->pageshortcuts, mmguiapp->window->trafficlimitclosure); /*connections*/ gtk_accel_group_connect(mmguiapp->window->accelgroup, GDK_KEY_C, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE, mmguiapp->window->trafficconnclosure); mmguiapp->window->pageshortcuts = g_slist_prepend(mmguiapp->window->pageshortcuts, mmguiapp->window->trafficconnclosure); /*statistics*/ gtk_accel_group_connect(mmguiapp->window->accelgroup, GDK_KEY_S, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE, mmguiapp->window->trafficstatsclosure); mmguiapp->window->pageshortcuts = g_slist_prepend(mmguiapp->window->pageshortcuts, mmguiapp->window->trafficstatsclosure); break; case MMGUI_MAIN_PAGE_CONTACTS: /*add contact*/ gtk_accel_group_connect(mmguiapp->window->accelgroup, GDK_KEY_N, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE, mmguiapp->window->newcontactclosure); mmguiapp->window->pageshortcuts = g_slist_prepend(mmguiapp->window->pageshortcuts, mmguiapp->window->newcontactclosure); /*remove contact*/ gtk_accel_group_connect(mmguiapp->window->accelgroup, GDK_KEY_D, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE, mmguiapp->window->removecontactclosure); mmguiapp->window->pageshortcuts = g_slist_prepend(mmguiapp->window->pageshortcuts, mmguiapp->window->removecontactclosure); /*send sms*/ gtk_accel_group_connect(mmguiapp->window->accelgroup, GDK_KEY_S, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE, mmguiapp->window->smstocontactclosure); mmguiapp->window->pageshortcuts = g_slist_prepend(mmguiapp->window->pageshortcuts, mmguiapp->window->smstocontactclosure); break; default: break; } } static void mmgui_main_ui_page_use_shortcuts_signal(gpointer data) { mmgui_application_data_t appdata; guint shortcut, operation, setpage, pagecaps, suppcaps; gboolean enabled, blocked, connected; appdata = (mmgui_application_data_t)data; if (appdata == NULL) return; shortcut = GPOINTER_TO_UINT(appdata->data); operation = mmguicore_devices_get_current_operation(appdata->mmguiapp->core); blocked = mmguicore_devices_get_locked(appdata->mmguiapp->core); enabled = mmguicore_devices_get_enabled(appdata->mmguiapp->core); connected = mmguicore_devices_get_connected(appdata->mmguiapp->core); setpage = gtk_notebook_get_current_page(GTK_NOTEBOOK(appdata->mmguiapp->window->notebook)); switch (setpage) { case MMGUI_MAIN_PAGE_DEVICES: break; case MMGUI_MAIN_PAGE_SMS: if ((enabled) && (!blocked)) { pagecaps = mmguicore_sms_get_capabilities(appdata->mmguiapp->core); /*send sms message*/ if ((pagecaps & MMGUI_SMS_CAPS_SEND) && (operation == MMGUI_DEVICE_OPERATION_IDLE)) { if (shortcut == MMGUI_MAIN_CONTROL_SHORTCUT_SMS_NEW) { mmgui_main_sms_new(appdata->mmguiapp); } /*answer sms message*/ if (shortcut == MMGUI_MAIN_CONTROL_SHORTCUT_SMS_ANSWER) { mmgui_main_sms_answer(appdata->mmguiapp); } } /*remove sms message*/ if (shortcut == MMGUI_MAIN_CONTROL_SHORTCUT_SMS_REMOVE) { mmgui_main_sms_remove(appdata->mmguiapp); } } break; case MMGUI_MAIN_PAGE_USSD: if ((enabled) && (!blocked)) { pagecaps = mmguicore_ussd_get_capabilities(appdata->mmguiapp->core); if ((pagecaps & MMGUI_USSD_CAPS_SEND) && (operation == MMGUI_DEVICE_OPERATION_IDLE)) { /*send ussd request*/ if (shortcut == MMGUI_MAIN_CONTROL_SHORTCUT_USSD_SEND) { mmgui_main_ussd_request_send(appdata->mmguiapp); } /*edit ussd commands*/ if (shortcut == MMGUI_MAIN_CONTROL_SHORTCUT_USSD_EDITOR) { mmgui_main_ussd_edit(appdata->mmguiapp); } } } break; case MMGUI_MAIN_PAGE_INFO: break; case MMGUI_MAIN_PAGE_SCAN: if ((enabled) && (!blocked)) { pagecaps = mmguicore_newtworks_scan_get_capabilities(appdata->mmguiapp->core); if ((pagecaps & MMGUI_SCAN_CAPS_OBSERVE) && (operation == MMGUI_DEVICE_OPERATION_IDLE) && (!connected)) { /*scan networks*/ if (shortcut == MMGUI_MAIN_CONTROL_SHORTCUT_SCAN_START) { mmgui_main_scan_start(appdata->mmguiapp); } } } break; case MMGUI_MAIN_PAGE_TRAFFIC: /*limits*/ if (shortcut == MMGUI_MAIN_CONTROL_SHORTCUT_TRAFFIC_LIMIT) { mmgui_main_traffic_limits_dialog(appdata->mmguiapp); } /*connections*/ if (shortcut == MMGUI_MAIN_CONTROL_SHORTCUT_TRAFFIC_CONNECTIONS) { mmgui_main_traffic_connections_dialog(appdata->mmguiapp); } /*statistics*/ if (shortcut == MMGUI_MAIN_CONTROL_SHORTCUT_TRAFFIC_STATS) { mmgui_main_traffic_statistics_dialog(appdata->mmguiapp); } break; case MMGUI_MAIN_PAGE_CONTACTS: if ((enabled) && (!blocked)) { pagecaps = mmguicore_contacts_get_capabilities(appdata->mmguiapp->core); suppcaps = mmguicore_sms_get_capabilities(appdata->mmguiapp->core); if (pagecaps & MMGUI_CONTACTS_CAPS_EDIT) { /*add contact*/ if (shortcut == MMGUI_MAIN_CONTROL_SHORTCUT_CONTACTS_NEW) { mmgui_main_contacts_new(appdata->mmguiapp); } /*remove contact*/ if (shortcut == MMGUI_MAIN_CONTROL_SHORTCUT_CONTACTS_REMOVE) { mmgui_main_contacts_remove(appdata->mmguiapp); } } if (suppcaps & MMGUI_SMS_CAPS_SEND) { /*send sms*/ if (shortcut == MMGUI_MAIN_CONTROL_SHORTCUT_CONTACTS_SMS) { mmgui_main_contacts_sms(appdata->mmguiapp); } } } break; default: break; } } static gboolean mmgui_main_ui_test_device_state(mmgui_application_t mmguiapp, guint setpage) { gboolean trytoenable, nonfunctional, limfunctional, needreg, enabled, blocked, registered; gchar *enablemessage, *nonfuncmessage, *limfuncmessage, *regmessage, *blockedmessage, *notenabledmessage; GtkWidget *infobar, *infobarlabel; guint pagecaps; if (mmguiapp == NULL) return FALSE; blocked = mmguicore_devices_get_locked(mmguiapp->core); enabled = mmguicore_devices_get_enabled(mmguiapp->core); registered = mmguicore_devices_get_registered(mmguiapp->core); switch (setpage) { case MMGUI_MAIN_PAGE_DEVICES: trytoenable = FALSE; needreg = FALSE; enablemessage = NULL; notenabledmessage = NULL; regmessage = NULL; blockedmessage = NULL; nonfuncmessage = NULL; limfuncmessage = NULL; infobar = NULL; infobarlabel = NULL; nonfunctional = FALSE; limfunctional = FALSE; break; case MMGUI_MAIN_PAGE_SMS: trytoenable = TRUE; needreg = TRUE; enablemessage = _("Modem must be enabled to read SMS. Enable modem?"); notenabledmessage = _("Modem must be enabled to read and write SMS. Please enable modem."); regmessage = _("Modem must be registered in mobile network to receive and send SMS. Please wait..."); blockedmessage = _("Modem must be unlocked to receive and send SMS. Please enter PIN code."); nonfuncmessage = _("Modem manager does not support SMS manipulation functions."); limfuncmessage = _("Modem manager does not support sending of SMS messages."); infobar = mmguiapp->window->smsinfobar; infobarlabel = mmguiapp->window->smsinfobarlabel; pagecaps = mmguicore_sms_get_capabilities(mmguiapp->core); if (pagecaps & MMGUI_SMS_CAPS_RECEIVE) { nonfunctional = FALSE; } else { nonfunctional = TRUE; } if (pagecaps & MMGUI_SMS_CAPS_SEND) { limfunctional = FALSE; } else { limfunctional = TRUE; } break; case MMGUI_MAIN_PAGE_USSD: trytoenable = TRUE; needreg = TRUE; enablemessage = _("Modem must be enabled to send USSD. Enable modem?"); notenabledmessage = _("Modem must be enabled to send USSD. Please enable modem."); regmessage = _("Modem must be registered in mobile network to send USSD. Please wait..."); blockedmessage = _("Modem must be unlocked to send USSD. Please enter PIN code."); nonfuncmessage = _("Modem manager does not support sending of USSD requests."); limfuncmessage = NULL; infobar = mmguiapp->window->ussdinfobar; infobarlabel = mmguiapp->window->ussdinfobarlabel; pagecaps = mmguicore_ussd_get_capabilities(mmguiapp->core); if (pagecaps & MMGUI_USSD_CAPS_SEND) { nonfunctional = FALSE; } else { nonfunctional = TRUE; } limfunctional = FALSE; break; case MMGUI_MAIN_PAGE_INFO: trytoenable = FALSE; needreg = FALSE; enablemessage = NULL; regmessage = NULL; blockedmessage = NULL; nonfuncmessage = NULL; limfuncmessage = NULL; infobar = NULL; infobarlabel = NULL; nonfunctional = FALSE; limfunctional = FALSE; break; case MMGUI_MAIN_PAGE_SCAN: trytoenable = TRUE; needreg = FALSE; enablemessage = _("Modem must be enabled to scan for available networks. Enable modem?"); notenabledmessage = _("Modem must be enabled to scan for available networks. Please enable modem."); regmessage = NULL; blockedmessage = _("Modem must be unlocked to scan for available networks. Please enter PIN code."); nonfuncmessage = _("Modem manager does not support scanning for available mobile networks."); limfuncmessage = _("Modem is connected now. Please disconnect to scan."); infobar = mmguiapp->window->scaninfobar; infobarlabel = mmguiapp->window->scaninfobarlabel; pagecaps = mmguicore_newtworks_scan_get_capabilities(mmguiapp->core); if (pagecaps & MMGUI_SCAN_CAPS_OBSERVE) { nonfunctional = FALSE; } else { nonfunctional = TRUE; } if (mmguicore_devices_get_connected(mmguiapp->core)) { limfunctional = TRUE; } else { limfunctional = FALSE; } break; case MMGUI_MAIN_PAGE_TRAFFIC: trytoenable = FALSE; needreg = FALSE; enablemessage = NULL; notenabledmessage = NULL; regmessage = NULL; blockedmessage = NULL; nonfuncmessage = NULL; limfuncmessage = NULL; infobar = NULL; infobarlabel = NULL; nonfunctional = FALSE; limfunctional = FALSE; break; case MMGUI_MAIN_PAGE_CONTACTS: trytoenable = TRUE; needreg = FALSE; enablemessage = _("Modem must be enabled to export contacts from it. Enable modem?"); notenabledmessage = _("Modem must be enabled to export contacts from it. Please enable modem."); regmessage = NULL; blockedmessage = _("Modem must be unlocked to export contacts from it. Please enter PIN code."); nonfuncmessage = _("Modem manager does not support modem contacts manipulation functions."); limfuncmessage = _("Modem manager does not support modem contacts edition functions."); infobar = mmguiapp->window->contactsinfobar; infobarlabel = mmguiapp->window->contactsinfobarlabel; pagecaps = mmguicore_contacts_get_capabilities(mmguiapp->core); if (pagecaps & MMGUI_CONTACTS_CAPS_EXPORT) { nonfunctional = FALSE; } else { nonfunctional = TRUE; } if (pagecaps & MMGUI_CONTACTS_CAPS_EDIT) { limfunctional = FALSE; } else { limfunctional = TRUE; } break; default: trytoenable = FALSE; needreg = FALSE; enablemessage = NULL; notenabledmessage = NULL; regmessage = NULL; nonfuncmessage = NULL; limfuncmessage = NULL; infobar = NULL; infobarlabel = NULL; nonfunctional = FALSE; limfunctional = FALSE; break; } if (blocked) { g_debug("Blocked\n"); if (infobar != NULL) gtk_widget_show(infobar); if (infobarlabel != NULL) gtk_label_set_text(GTK_LABEL(infobarlabel), blockedmessage); mmgui_main_ui_page_control_disable(mmguiapp, setpage, TRUE, FALSE); } else { if ((trytoenable) && (!enabled)) { g_debug("Must be enabled\n"); if (mmgui_main_ui_question_dialog_open(mmguiapp, _("Enable modem"), enablemessage)) { if (mmguicore_devices_enable(mmguiapp->core, TRUE)) { mmgui_main_ui_progress_dialog_open(mmguiapp); } else { mmgui_main_ui_error_dialog_open(mmguiapp, _("Error enabling device"), mmguicore_get_last_error(mmguiapp->core)); } } else { g_debug("Not enabled\n"); if (infobar != NULL) gtk_widget_show(infobar); if (infobarlabel != NULL) gtk_label_set_text(GTK_LABEL(infobarlabel), notenabledmessage); mmgui_main_ui_page_control_disable(mmguiapp, setpage, TRUE, TRUE); } } else { if ((needreg) && (!registered)) { g_debug("Must be registered\n"); if (infobar != NULL) gtk_widget_show(infobar); if (infobarlabel != NULL) gtk_label_set_text(GTK_LABEL(infobarlabel), regmessage); mmgui_main_ui_page_control_disable(mmguiapp, setpage, TRUE, TRUE); } else if (nonfunctional) { g_debug("Nonfunctional\n"); if (infobar != NULL) gtk_widget_show(infobar); if (infobarlabel != NULL) gtk_label_set_text(GTK_LABEL(infobarlabel), nonfuncmessage); mmgui_main_ui_page_control_disable(mmguiapp, setpage, TRUE, FALSE); } else if (limfunctional) { g_debug("Limited functional\n"); if (infobar != NULL) gtk_widget_show(infobar); if (infobarlabel != NULL) gtk_label_set_text(GTK_LABEL(infobarlabel), limfuncmessage); mmgui_main_ui_page_control_disable(mmguiapp, setpage, TRUE, TRUE); } else { g_debug("Fully functional\n"); if (infobar != NULL) gtk_widget_hide(infobar); if (infobarlabel != NULL) mmgui_main_ui_page_control_disable(mmguiapp, setpage, FALSE, FALSE); } } } } static void mmgui_main_ui_open_page(mmgui_application_t mmguiapp, guint page) { if ((mmguiapp == NULL) || (page > MMGUI_MAIN_PAGE_CONTACTS)) return; if ((page != MMGUI_MAIN_PAGE_DEVICES) && (mmguicore_devices_get_current(mmguiapp->core) == NULL)) return; //Test device state mmgui_main_ui_test_device_state(mmguiapp, page); //Bind shortcuts mmgui_main_ui_page_setup_shortcuts(mmguiapp, page); //Open page gtk_notebook_set_current_page(GTK_NOTEBOOK(mmguiapp->window->notebook), page); } void mmgui_main_ui_devices_button_toggled_signal(GObject *object, gpointer data) { mmgui_application_t mmguiapp; mmguiapp = (mmgui_application_t)data; if (mmguiapp == NULL) return; if (gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(object))) { mmgui_main_ui_open_page(mmguiapp, MMGUI_MAIN_PAGE_DEVICES); } } void mmgui_main_ui_sms_button_toggled_signal(GObject *object, gpointer data) { mmgui_application_t mmguiapp; mmguiapp = (mmgui_application_t)data; if (mmguiapp == NULL) return; if (gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(object))) { mmgui_main_ui_open_page(mmguiapp, MMGUI_MAIN_PAGE_SMS); } } void mmgui_main_ui_ussd_button_toggled_signal(GObject *object, gpointer data) { mmgui_application_t mmguiapp; mmguiapp = (mmgui_application_t)data; if (mmguiapp == NULL) return; if (gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(object))) { mmgui_main_ui_open_page(mmguiapp, MMGUI_MAIN_PAGE_USSD); } } void mmgui_main_ui_info_button_toggled_signal(GObject *object, gpointer data) { mmgui_application_t mmguiapp; mmguiapp = (mmgui_application_t)data; if (mmguiapp == NULL) return; if (gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(object))) { mmgui_main_ui_open_page(mmguiapp, MMGUI_MAIN_PAGE_INFO); } } void mmgui_main_ui_scan_button_toggled_signal(GObject *object, gpointer data) { mmgui_application_t mmguiapp; mmguiapp = (mmgui_application_t)data; if (mmguiapp == NULL) return; if (gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(object))) { mmgui_main_ui_open_page(mmguiapp, MMGUI_MAIN_PAGE_SCAN); } } void mmgui_main_ui_traffic_button_toggled_signal(GObject *object, gpointer data) { mmgui_application_t mmguiapp; mmguiapp = (mmgui_application_t)data; if (mmguiapp == NULL) return; if (gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(object))) { mmgui_main_ui_open_page(mmguiapp, MMGUI_MAIN_PAGE_TRAFFIC); } } void mmgui_main_ui_contacts_button_toggled_signal(GObject *object, gpointer data) { mmgui_application_t mmguiapp; mmguiapp = (mmgui_application_t)data; if (mmguiapp == NULL) return; if (gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(object))) { mmgui_main_ui_open_page(mmguiapp, MMGUI_MAIN_PAGE_CONTACTS); } } static enum _mmgui_main_exit_dialog_result mmgui_main_ui_window_hide_dialog(mmgui_application_t mmguiapp) { gint response; gchar *strcolor; if (mmguiapp == NULL) return MMGUI_MAIN_EXIT_DIALOG_CANCEL; if ((mmguiapp->options == NULL) || (mmguiapp->settings == NULL)) return MMGUI_MAIN_EXIT_DIALOG_CANCEL; response = gtk_dialog_run(GTK_DIALOG(mmguiapp->window->exitdialog)); gtk_widget_hide(mmguiapp->window->exitdialog); if (response > 0) { /*Ask again checkbox*/ mmguiapp->options->askforhide = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(mmguiapp->window->exitaskagain)); gmm_settings_set_boolean(mmguiapp->settings, "behaviour_ask_to_hide", mmguiapp->options->askforhide); /*Exit and hide radiobuttons*/ if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(mmguiapp->window->exitcloseradio))) { /*Exit application selected*/ mmguiapp->options->hidetotray = FALSE; gmm_settings_set_boolean(mmguiapp->settings, "behaviour_hide_to_tray", mmguiapp->options->hidetotray); return MMGUI_MAIN_EXIT_DIALOG_EXIT; } else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(mmguiapp->window->exithideradio))) { /*Hide to tray selected*/ mmguiapp->options->hidetotray = TRUE; gmm_settings_set_boolean(mmguiapp->settings, "behaviour_hide_to_tray", mmguiapp->options->hidetotray); return MMGUI_MAIN_EXIT_DIALOG_HIDE; } else { /*Cancel clicked*/ return MMGUI_MAIN_EXIT_DIALOG_CANCEL; } } else { return MMGUI_MAIN_EXIT_DIALOG_CANCEL; } } static void mmgui_main_ui_window_save_geometry(mmgui_application_t mmguiapp) { if (mmguiapp == NULL) return; if (mmguiapp->options->savegeometry) { //Get window geometry and coordinates gtk_window_get_size(GTK_WINDOW(mmguiapp->window->window), &(mmguiapp->options->wgwidth), &(mmguiapp->options->wgheight)); gtk_window_get_position(GTK_WINDOW(mmguiapp->window->window), &(mmguiapp->options->wgposx), &(mmguiapp->options->wgposy)); //Save it if ((mmguiapp->options->wgwidth >= 1) && (mmguiapp->options->wgheight >= 1)) { //Window geometry gmm_settings_set_int(mmguiapp->settings, "window_geometry_width", mmguiapp->options->wgwidth); gmm_settings_set_int(mmguiapp->settings, "window_geometry_height", mmguiapp->options->wgheight); gmm_settings_set_int(mmguiapp->settings, "window_geometry_x", mmguiapp->options->wgposx); gmm_settings_set_int(mmguiapp->settings, "window_geometry_y", mmguiapp->options->wgposy); g_debug("Geometry: width: %i, height: %i, x: %i, y: %i\n", mmguiapp->options->wgwidth, mmguiapp->options->wgheight, mmguiapp->options->wgposx, mmguiapp->options->wgposy); } } } static gboolean mmgui_main_ui_window_delete_event_signal(GtkWidget *widget, GdkEvent *event, gpointer data) { mmgui_application_t mmguiapp; enum _mmgui_notifications_sound soundmode; enum _mmgui_main_exit_dialog_result dialogres; mmguiapp = (mmgui_application_t)data; if (mmguiapp == NULL) return; if (mmguiapp->options->askforhide) { /*Ask at exit*/ dialogres = mmgui_main_ui_window_hide_dialog(mmguiapp); if (dialogres == MMGUI_MAIN_EXIT_DIALOG_HIDE) { /*Hide application*/ gtk_widget_hide_on_delete(mmguiapp->window->window); /*Show notification*/ if (mmguiapp->options->usesounds) { soundmode = MMGUI_NOTIFICATIONS_SOUND_INFO; } else { soundmode = MMGUI_NOTIFICATIONS_SOUND_NONE; } mmgui_notifications_show(mmguiapp->notifications, _("Modem Manager GUI window hidden"), _("Use tray icon or messaging menu to show window again"), soundmode); /*Set tray menu mark*/ g_signal_handler_block(G_OBJECT(mmguiapp->window->showwin_tm), mmguiapp->window->traysigid); gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(mmguiapp->window->showwin_tm), FALSE); g_signal_handler_unblock(G_OBJECT(mmguiapp->window->showwin_tm), mmguiapp->window->traysigid); /*Save window state*/ mmguiapp->options->minimized = TRUE; gmm_settings_set_boolean(mmguiapp->settings, "window_state_minimized", mmguiapp->options->minimized); return TRUE; } else if (dialogres == MMGUI_MAIN_EXIT_DIALOG_EXIT) { /*Exit application*/ mmgui_main_ui_window_save_geometry(mmguiapp); return FALSE; } else { /*Do nothing*/ return TRUE; } } else { /*Do not ask at exit*/ if (mmguiapp->options->hidetotray) { gtk_widget_hide_on_delete(mmguiapp->window->window); /*Show notification*/ if (mmguiapp->options->usesounds) { soundmode = MMGUI_NOTIFICATIONS_SOUND_INFO; } else { soundmode = MMGUI_NOTIFICATIONS_SOUND_NONE; } mmgui_notifications_show(mmguiapp->notifications, _("Modem Manager GUI window hidden"), _("Use tray icon or messaging menu to show window again"), soundmode); /*Set tray menu mark*/ g_signal_handler_block(G_OBJECT(mmguiapp->window->showwin_tm), mmguiapp->window->traysigid); gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(mmguiapp->window->showwin_tm), FALSE); g_signal_handler_unblock(G_OBJECT(mmguiapp->window->showwin_tm), mmguiapp->window->traysigid); /*Save window state*/ mmguiapp->options->minimized = TRUE; gmm_settings_set_boolean(mmguiapp->settings, "window_state_minimized", mmguiapp->options->minimized); return TRUE; } else { mmgui_main_ui_window_save_geometry(mmguiapp); return FALSE; } } } void mmgui_main_ui_window_destroy_signal(GObject *object, gpointer data) { mmgui_application_t mmguiapp; mmguiapp = (mmgui_application_t)data; if (mmguiapp == NULL) return; mmgui_main_application_terminate(mmguiapp); } static void mmgui_main_ui_exit_menu_item_activate_signal(GSimpleAction *action, GVariant *parameter, gpointer data) { mmgui_application_t mmguiapp; mmguiapp = (mmgui_application_t)data; if (mmguiapp == NULL) return; mmgui_main_ui_window_save_geometry(mmguiapp); mmgui_main_application_terminate(mmguiapp); } static void mmgui_main_ui_about_menu_item_activate_signal(GSimpleAction *action, GVariant *parameter, gpointer data) { mmgui_application_t mmguiapp; mmguiapp = (mmgui_application_t)data; if (mmguiapp == NULL) return; gtk_dialog_run(GTK_DIALOG(mmguiapp->window->aboutdialog)); gtk_widget_hide(mmguiapp->window->aboutdialog); } static void mmgui_main_ui_preferences_menu_item_activate_signal(GSimpleAction *action, GVariant *parameter, gpointer data) { mmgui_application_t mmguiapp; gint response; gchar *strcolor; mmguiapp = (mmgui_application_t)data; if (mmguiapp == NULL) return; if ((mmguiapp->options == NULL) || (mmguiapp->settings == NULL)) return; //Show SMS settings gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(mmguiapp->window->prefsmsconcat), mmguiapp->options->concatsms); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(mmguiapp->window->prefsmsexpand), mmguiapp->options->smsexpandfolders); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(mmguiapp->window->prefsmsoldontop), mmguiapp->options->smsoldontop); //Show behaviour settings gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(mmguiapp->window->prefbehaviourhide), mmguiapp->options->hidetotray); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(mmguiapp->window->prefbehavioursounds), mmguiapp->options->usesounds); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(mmguiapp->window->prefbehaviourgeom), mmguiapp->options->savegeometry); //Show graph color settings #if GTK_CHECK_VERSION(3,4,0) GdkRGBA rgba; gtk_color_chooser_set_use_alpha(GTK_COLOR_CHOOSER(mmguiapp->window->preftrafficrxcolor), FALSE); gtk_color_chooser_set_use_alpha(GTK_COLOR_CHOOSER(mmguiapp->window->preftraffictxcolor), FALSE); rgba.red = mmguiapp->options->rxtrafficcolor.red/65535.0; rgba.green = mmguiapp->options->rxtrafficcolor.green/65535.0; rgba.blue = mmguiapp->options->rxtrafficcolor.blue/65535.0; rgba.alpha = 1.0; gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(mmguiapp->window->preftrafficrxcolor), (const GdkRGBA *)&rgba); rgba.red = mmguiapp->options->txtrafficcolor.red/65535.0; rgba.green = mmguiapp->options->txtrafficcolor.green/65535.0; rgba.blue = mmguiapp->options->txtrafficcolor.blue/65535.0; rgba.alpha = 1.0; gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(mmguiapp->window->preftraffictxcolor), (const GdkRGBA *)&rgba); #else gtk_color_button_set_use_alpha(GTK_COLOR_BUTTON(mmguiapp->window->preftrafficrxcolor), FALSE); gtk_color_button_set_use_alpha(GTK_COLOR_BUTTON(mmguiapp->window->preftraffictxcolor), FALSE); gtk_color_button_set_color(GTK_COLOR_BUTTON(mmguiapp->window->preftrafficrxcolor), (const GdkColor *)&(mmguiapp->options->rxtrafficcolor)); gtk_color_button_set_color(GTK_COLOR_BUTTON(mmguiapp->window->preftraffictxcolor), (const GdkColor *)&(mmguiapp->options->txtrafficcolor)); #endif response = gtk_dialog_run(GTK_DIALOG(mmguiapp->window->prefdialog)); if (response > 0) { //Save SMS settings mmguiapp->options->concatsms = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(mmguiapp->window->prefsmsconcat)); gmm_settings_set_boolean(mmguiapp->settings, "sms_concatenation", gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(mmguiapp->window->prefsmsconcat))); mmguiapp->options->smsexpandfolders = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(mmguiapp->window->prefsmsexpand)); gmm_settings_set_boolean(mmguiapp->settings, "sms_expand_folders", gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(mmguiapp->window->prefsmsexpand))); mmguiapp->options->smsoldontop = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(mmguiapp->window->prefsmsoldontop)); gmm_settings_set_boolean(mmguiapp->settings, "sms_old_on_top", gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(mmguiapp->window->prefsmsoldontop))); //Save program behaviour settings mmguiapp->options->hidetotray = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(mmguiapp->window->prefbehaviourhide)); gmm_settings_set_boolean(mmguiapp->settings, "behaviour_hide_to_tray", gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(mmguiapp->window->prefbehaviourhide))); mmguiapp->options->usesounds = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(mmguiapp->window->prefbehavioursounds)); gmm_settings_set_boolean(mmguiapp->settings, "behaviour_use_sounds", gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(mmguiapp->window->prefbehavioursounds))); mmguiapp->options->savegeometry = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(mmguiapp->window->prefbehaviourgeom)); gmm_settings_set_boolean(mmguiapp->settings, "behaviour_save_geometry", gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(mmguiapp->window->prefbehaviourgeom))); //Save graph colors #if GTK_CHECK_VERSION(3,4,0) GdkRGBA rgba; gtk_color_chooser_get_rgba(GTK_COLOR_CHOOSER(mmguiapp->window->preftrafficrxcolor), (GdkRGBA *)&rgba); mmguiapp->options->rxtrafficcolor.red = rgba.red*65535.0; mmguiapp->options->rxtrafficcolor.green = rgba.green*65535.0; mmguiapp->options->rxtrafficcolor.blue = rgba.blue*65535.0; gtk_color_chooser_get_rgba(GTK_COLOR_CHOOSER(mmguiapp->window->preftraffictxcolor), (GdkRGBA *)&rgba); mmguiapp->options->txtrafficcolor.red = rgba.red*65535.0; mmguiapp->options->txtrafficcolor.green = rgba.green*65535.0; mmguiapp->options->txtrafficcolor.blue = rgba.blue*65535.0; #else gtk_color_button_get_color(GTK_COLOR_BUTTON(mmguiapp->window->preftrafficrxcolor), &(mmguiapp->options->rxtrafficcolor)); gtk_color_button_get_color(GTK_COLOR_BUTTON(mmguiapp->window->preftraffictxcolor), &(mmguiapp->options->txtrafficcolor)); #endif strcolor = gdk_color_to_string((const GdkColor *)&mmguiapp->options->rxtrafficcolor); gmm_settings_set_string(mmguiapp->settings, "graph_rx_color", strcolor); g_free(strcolor); strcolor = gdk_color_to_string((const GdkColor *)&mmguiapp->options->txtrafficcolor); gmm_settings_set_string(mmguiapp->settings, "graph_tx_color", strcolor); g_free(strcolor); } gtk_widget_hide(mmguiapp->window->prefdialog); } static void mmgui_main_ui_control_buttons_disable(mmgui_application_t mmguiapp, gboolean disable) { if (mmguiapp == NULL) return; gtk_widget_set_sensitive(mmguiapp->window->smsbutton, !disable); gtk_widget_set_sensitive(mmguiapp->window->ussdbutton, !disable); gtk_widget_set_sensitive(mmguiapp->window->infobutton, !disable); gtk_widget_set_sensitive(mmguiapp->window->scanbutton, !disable); gtk_widget_set_sensitive(mmguiapp->window->trafficbutton, !disable); gtk_widget_set_sensitive(mmguiapp->window->contactsbutton, !disable); if (disable) { gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(mmguiapp->window->devbutton), TRUE); gtk_notebook_set_current_page(GTK_NOTEBOOK(mmguiapp->window->notebook), MMGUI_MAIN_PAGE_DEVICES); gtk_widget_show(mmguiapp->window->nodevbar); } else { gtk_widget_hide(mmguiapp->window->nodevbar); } } void mmgui_main_ui_interrupt_operation_button_clicked_signal(GObject *object, gpointer data) { mmgui_application_t mmguiapp; mmguiapp = (mmgui_application_t)data; if (mmguiapp == NULL) return; if (mmguiapp->core == NULL) return; if (mmguicore_interrupt_operation(mmguiapp->core)) { mmgui_main_ui_progress_dialog_close(mmguiapp); } } //TRAY static void mmgui_main_tray_icon_activation_signal(GtkStatusIcon *status_icon, gpointer data) { mmgui_application_t mmguiapp; mmguiapp = (mmgui_application_t)data; if (mmguiapp == NULL) return; if ((mmguiapp->core == NULL) || (mmguiapp->window == NULL)) return; if (gtk_widget_get_visible(mmguiapp->window->window)) { /*Hide window*/ gtk_widget_hide(mmguiapp->window->window); mmguiapp->options->minimized = TRUE; g_signal_handler_block(G_OBJECT(mmguiapp->window->showwin_tm), mmguiapp->window->traysigid); gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(mmguiapp->window->showwin_tm), FALSE); g_signal_handler_unblock(G_OBJECT(mmguiapp->window->showwin_tm), mmguiapp->window->traysigid); } else { /*Show window*/ gtk_widget_show(mmguiapp->window->window); mmguiapp->options->minimized = FALSE; g_signal_handler_block(G_OBJECT(mmguiapp->window->showwin_tm), mmguiapp->window->traysigid); gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(mmguiapp->window->showwin_tm), TRUE); g_signal_handler_unblock(G_OBJECT(mmguiapp->window->showwin_tm), mmguiapp->window->traysigid); } /*Save window state*/ gmm_settings_set_boolean(mmguiapp->settings, "window_state_minimized", mmguiapp->options->minimized); } static void mmgui_main_tray_icon_window_show_signal(GtkCheckMenuItem *checkmenuitem, gpointer data) { mmgui_application_t mmguiapp; mmguiapp = (mmgui_application_t)data; if (mmguiapp == NULL) return; if ((mmguiapp->core == NULL) || (mmguiapp->window == NULL)) return; mmgui_main_tray_icon_activation_signal(GTK_STATUS_ICON(mmguiapp->window->statusicon), mmguiapp); } static void mmgui_main_tray_icon_new_sms_signal(GtkMenuItem *menuitem, gpointer data) { mmgui_application_t mmguiapp; guint smscaps; mmguiapp = (mmgui_application_t)data; if (mmguiapp == NULL) return; if ((mmguiapp->core == NULL) || (mmguiapp->window == NULL)) return; if (!gtk_widget_get_visible(mmguiapp->window->window)) { gtk_widget_show(mmguiapp->window->window); g_signal_handler_block(G_OBJECT(mmguiapp->window->showwin_tm), mmguiapp->window->traysigid); gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(mmguiapp->window->showwin_tm), TRUE); g_signal_handler_unblock(G_OBJECT(mmguiapp->window->showwin_tm), mmguiapp->window->traysigid); } else { gtk_window_present(GTK_WINDOW(mmguiapp->window->window)); } if (mmguicore_devices_get_enabled(mmguiapp->core)) { smscaps = mmguicore_sms_get_capabilities(mmguiapp->core); if (smscaps & MMGUI_SMS_CAPS_SEND) { gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(mmguiapp->window->smsbutton), TRUE); mmgui_main_sms_new(mmguiapp); } } } static void mmgui_main_tray_icon_exit_signal(GtkMenuItem *menuitem, gpointer data) { mmgui_application_t mmguiapp; mmguiapp = (mmgui_application_t)data; if (mmguiapp == NULL) return; mmgui_main_ui_window_save_geometry(mmguiapp); mmgui_main_application_terminate(mmguiapp); } static void mmgui_main_tray_popup_menu_show_signal(GtkStatusIcon *status_icon, guint button, guint activate_time, gpointer data) { mmgui_application_t mmguiapp; guint smscaps; mmguiapp = (mmgui_application_t)data; if (mmguiapp == NULL) return; if ((mmguiapp->core == NULL) || (mmguiapp->window == NULL)) return; if (mmguicore_devices_get_enabled(mmguiapp->core)) { smscaps = mmguicore_sms_get_capabilities(mmguiapp->core); if (smscaps & MMGUI_SMS_CAPS_SEND) { gtk_widget_set_sensitive(mmguiapp->window->newsms_tm, TRUE); } else { gtk_widget_set_sensitive(mmguiapp->window->newsms_tm, FALSE); } } else { gtk_widget_set_sensitive(mmguiapp->window->newsms_tm, FALSE); } gtk_menu_popup(GTK_MENU(mmguiapp->window->traymenu), NULL, NULL, gtk_status_icon_position_menu, status_icon, button, activate_time); } static gboolean mmgui_main_tray_tooltip_show_signal(GtkStatusIcon *status_icon, gint x, gint y, gboolean keyboard_mode, GtkTooltip *tooltip, gpointer data) { mmgui_application_t mmguiapp; guint unreadmessages; gchar strbuf[64]; mmguiapp = (mmgui_application_t)data; if (mmguiapp == NULL) return; if (mmguicore_devices_get_current(mmguiapp->core) != NULL) { unreadmessages = mmgui_smsdb_get_unread_messages(mmguicore_devices_get_sms_db(mmguiapp->core)); if (unreadmessages > 0) { memset(strbuf, 0, sizeof(strbuf)); g_snprintf(strbuf, sizeof(strbuf), _("Unread messages: %u"), unreadmessages); gtk_tooltip_set_text(tooltip, strbuf); } else { gtk_tooltip_set_text(tooltip, _("No unread messages")); } } else { gtk_tooltip_set_text(tooltip, _("No unread messages")); } } /*Ayatana*/ static void mmgui_main_ayatana_event_callback(enum _mmgui_ayatana_event event, gpointer ayatana, gpointer data, gpointer userdata) { mmgui_application_t mmguiapp; mmguiapp = (mmgui_application_t)userdata; if (userdata == NULL) return; gtk_window_present(GTK_WINDOW(mmguiapp->window->window)); if (event == MMGUI_AYATANA_EVENT_CLIENT) { if (mmguicore_devices_get_enabled(mmguiapp->core)) { gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(mmguiapp->window->smsbutton), TRUE); } } } //CONTACTS static mmgui_contact_t mmgui_main_contacts_list_get_selected(mmgui_application_t mmguiapp, guint *type) { GtkTreeModel *model; GtkTreeSelection *selection; GtkTreeIter iter; guint id, contacttype; mmgui_contact_t contact; if (mmguiapp == NULL) return; model = gtk_tree_view_get_model(GTK_TREE_VIEW(mmguiapp->window->contactstreeview)); selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(mmguiapp->window->contactstreeview)); contact = NULL; if ((model != NULL) && (selection != NULL)) { if (gtk_tree_selection_get_selected(selection, &model, &iter)) { gtk_tree_model_get(model, &iter, MMGUI_MAIN_CONTACTSLIST_ID, &id, MMGUI_MAIN_CONTACTSLIST_TYPE, &contacttype, -1); if (contacttype != MMGUI_MAIN_CONTACT_HEADER) { if (contacttype == MMGUI_MAIN_CONTACT_MODEM) { //Contact from modem contact = mmguicore_contacts_get(mmguiapp->core, id); } else if (contacttype == MMGUI_MAIN_CONTACT_GNOME) { //Contact from GNOME addressbook contact = mmgui_addressbooks_get_gnome_contact(mmguiapp->addressbooks, id); } else if (contacttype == MMGUI_MAIN_CONTACT_KDE) { //Contact from KDE addressbook contact = mmgui_addressbooks_get_gnome_contact(mmguiapp->addressbooks, id); } } //Set contact type if needed if (type != NULL) *(type) = contacttype; } else { if (type != NULL) *(type) = MMGUI_MAIN_CONTACT_UNKNOWN; } } else { if (type != NULL) *(type) = MMGUI_MAIN_CONTACT_UNKNOWN; } return contact; } static void mmgui_main_contacts_list_cursor_changed_signal(GtkTreeView *tree_view, gpointer data) { mmgui_application_t mmguiapp; mmgui_contact_t contact; guint contactscaps; gboolean validated; GtkWidget *menu_sms1, *menu_sms2; guint contacttype; static struct _mmgui_application_data appdata[2]; mmguiapp = (mmgui_application_t)data; if (mmguiapp == NULL) return; validated = FALSE; contacttype = MMGUI_MAIN_CONTACT_UNKNOWN; contact = mmgui_main_contacts_list_get_selected(mmguiapp, &contacttype); if ((contact != NULL) && (contacttype != MMGUI_MAIN_CONTACT_UNKNOWN)) { if (contacttype != MMGUI_MAIN_CONTACT_HEADER) { //Destroy old menu if (mmguiapp->window->contactssmsmenu != NULL) { gtk_widget_destroy(mmguiapp->window->contactssmsmenu); mmguiapp->window->contactssmsmenu = NULL; } //Create new menu mmguiapp->window->contactssmsmenu = gtk_menu_new(); //Contacts numbers validation if ((contact->number != NULL) && (mmguicore_sms_validate_number((const gchar *)contact->number))) { menu_sms1 = gtk_menu_item_new_with_label(contact->number); gtk_menu_shell_append(GTK_MENU_SHELL(mmguiapp->window->contactssmsmenu), menu_sms1); appdata[0].mmguiapp = mmguiapp; appdata[0].data = GINT_TO_POINTER(0); g_signal_connect(G_OBJECT(menu_sms1), "activate", G_CALLBACK(mmgui_main_contacts_sms_menu_activate_signal), &(appdata[0])); validated = TRUE; } if ((contact->number2 != NULL) && (mmguicore_sms_validate_number((const gchar *)contact->number2))) { menu_sms2 = gtk_menu_item_new_with_label(contact->number2); gtk_menu_shell_append(GTK_MENU_SHELL(mmguiapp->window->contactssmsmenu), menu_sms2); appdata[1].mmguiapp = mmguiapp; appdata[1].data = GINT_TO_POINTER(1); g_signal_connect(G_OBJECT(menu_sms2), "activate", G_CALLBACK(mmgui_main_contacts_sms_menu_activate_signal), &(appdata[1])); validated = TRUE; } //Set buttons state if (validated) { contactscaps = mmguicore_contacts_get_capabilities(mmguiapp->core); if ((contactscaps & MMGUI_CONTACTS_CAPS_EDIT) && (contacttype == MMGUI_MAIN_CONTACT_MODEM)) { gtk_widget_set_sensitive(mmguiapp->window->removecontactbutton, TRUE); } else { gtk_widget_set_sensitive(mmguiapp->window->removecontactbutton, FALSE); } gtk_widget_set_sensitive(mmguiapp->window->smstocontactbutton, TRUE); //Show menu if contact data validated gtk_widget_show_all(GTK_WIDGET(mmguiapp->window->contactssmsmenu)); gtk_menu_tool_button_set_menu(GTK_MENU_TOOL_BUTTON(mmguiapp->window->smstocontactbutton), mmguiapp->window->contactssmsmenu); } else { gtk_widget_set_sensitive(mmguiapp->window->removecontactbutton, FALSE); gtk_widget_set_sensitive(mmguiapp->window->smstocontactbutton, FALSE); } } } else if (contacttype == MMGUI_MAIN_CONTACT_HEADER) { //Header selected gtk_widget_set_sensitive(mmguiapp->window->removecontactbutton, FALSE); gtk_widget_set_sensitive(mmguiapp->window->smstocontactbutton, FALSE); } } static void mmgui_main_contacts_sms(mmgui_application_t mmguiapp) { mmgui_contact_t contact; gchar *number; guint smscaps, contacttype; if (mmguiapp == NULL) return; smscaps = mmguicore_sms_get_capabilities(mmguiapp->core); if (!(smscaps & MMGUI_SMS_CAPS_SEND)) return; number = NULL; contacttype = MMGUI_MAIN_CONTACT_UNKNOWN; contact = mmgui_main_contacts_list_get_selected(mmguiapp, &contacttype); if ((contact != NULL) && (contacttype != MMGUI_MAIN_CONTACT_UNKNOWN)) { //Find apporitate number if (contact->number != NULL) { number = contact->number; } else if (contact->number2 != NULL) { number = contact->number2; } //Switch to SMS page and send message if (number != NULL) { gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(mmguiapp->window->smsbutton), TRUE); mmgui_main_sms_send(mmguiapp, number, ""); } } } void mmgui_main_contacts_sms_button_clicked_signal(GObject *object, gpointer data) { mmgui_application_t mmguiapp; mmguiapp = (mmgui_application_t)data; if (mmguiapp == NULL) return; mmgui_main_contacts_sms(mmguiapp); } static void mmgui_main_contacts_sms_menu_activate_signal(GtkMenuItem *menuitem, gpointer data) { mmgui_application_data_t appdata; mmgui_contact_t contact; guint contacttype; appdata = (mmgui_application_data_t)data; if (appdata == NULL) return; contacttype = MMGUI_MAIN_CONTACT_UNKNOWN; contact = mmgui_main_contacts_list_get_selected(appdata->mmguiapp, &contacttype); if ((contact != NULL) && (contacttype != MMGUI_MAIN_CONTACT_UNKNOWN)) { if ((GPOINTER_TO_INT(appdata->data) == 0) && (contact->number != NULL)) { //First number: switch to SMS page and send message if number found gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(appdata->mmguiapp->window->smsbutton), TRUE); mmgui_main_sms_send(appdata->mmguiapp, contact->number, ""); } else if ((GPOINTER_TO_INT(appdata->data) == 1) && (contact->number2 != NULL)) { //Second number: switch to SMS page and send message if number found gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(appdata->mmguiapp->window->smsbutton), TRUE); mmgui_main_sms_send(appdata->mmguiapp, contact->number2, ""); } } } static void mmgui_main_contacts_dialog_entry_changed_signal(GtkEditable *editable, gpointer data) { mmgui_application_t mmguiapp; guint16 namelen, numberlen, number2len; const gchar *number, *number2; gboolean valid; mmguiapp = (mmgui_application_t)data; if (mmguiapp == NULL) return; namelen = gtk_entry_get_text_length(GTK_ENTRY(mmguiapp->window->contactnameentry)); numberlen = gtk_entry_get_text_length(GTK_ENTRY(mmguiapp->window->contactnumberentry)); number2len = gtk_entry_get_text_length(GTK_ENTRY(mmguiapp->window->contactnumber2entry)); if ((namelen == 0) || (numberlen == 0)) { gtk_widget_set_sensitive(mmguiapp->window->newcontactaddbutton, FALSE); } else { valid = TRUE; //Number2 validation if (number2len > 0) { number2 = gtk_entry_get_text(GTK_ENTRY(mmguiapp->window->contactnumber2entry)); if (!mmguicore_sms_validate_number(number2)) { valid = FALSE; } } //Number validation if (valid) { number = gtk_entry_get_text(GTK_ENTRY(mmguiapp->window->contactnumberentry)); if (!mmguicore_sms_validate_number(number)) { valid = FALSE; } } //Set state of add button if (valid) { gtk_widget_set_sensitive(mmguiapp->window->newcontactaddbutton, TRUE); } else { gtk_widget_set_sensitive(mmguiapp->window->newcontactaddbutton, FALSE); } } } static void mmgui_main_contacts_new(mmgui_application_t mmguiapp) { guint contactscaps; gboolean extsensitive; gulong editsignal[3]; gint response; mmgui_contact_t contact; GtkTreeModel *model; GtkTreeIter iter, child; if (mmguiapp == NULL) return; contactscaps = mmguicore_contacts_get_capabilities(mmguiapp->core); if (!(contactscaps & MMGUI_CONTACTS_CAPS_EDIT)) return; /*Capabilities*/ extsensitive = (gboolean)(contactscaps & MMGUI_CONTACTS_CAPS_EXTENDED); gtk_widget_set_sensitive(mmguiapp->window->contactemailentry, extsensitive); gtk_widget_set_sensitive(mmguiapp->window->contactgroupentry, extsensitive); gtk_widget_set_sensitive(mmguiapp->window->contactname2entry, extsensitive); gtk_widget_set_sensitive(mmguiapp->window->contactnumber2entry, extsensitive); /*Clear entries*/ gtk_entry_set_text(GTK_ENTRY(mmguiapp->window->contactnameentry), ""); gtk_entry_set_text(GTK_ENTRY(mmguiapp->window->contactnumberentry), ""); gtk_entry_set_text(GTK_ENTRY(mmguiapp->window->contactemailentry), ""); gtk_entry_set_text(GTK_ENTRY(mmguiapp->window->contactgroupentry), ""); gtk_entry_set_text(GTK_ENTRY(mmguiapp->window->contactname2entry), ""); gtk_entry_set_text(GTK_ENTRY(mmguiapp->window->contactnumber2entry), ""); /*Bind signals*/ editsignal[0] = g_signal_connect(G_OBJECT(mmguiapp->window->contactnameentry), "changed", G_CALLBACK(mmgui_main_contacts_dialog_entry_changed_signal), mmguiapp); editsignal[1] = g_signal_connect(G_OBJECT(mmguiapp->window->contactnumberentry), "changed", G_CALLBACK(mmgui_main_contacts_dialog_entry_changed_signal), mmguiapp); editsignal[2] = g_signal_connect(G_OBJECT(mmguiapp->window->contactnumber2entry), "changed", G_CALLBACK(mmgui_main_contacts_dialog_entry_changed_signal), mmguiapp); g_signal_emit_by_name(G_OBJECT(mmguiapp->window->contactnameentry), "changed"); /*Run dialog*/ response = gtk_dialog_run(GTK_DIALOG(mmguiapp->window->newcontactdialog)); /*Unbind signals*/ g_signal_handler_disconnect(G_OBJECT(mmguiapp->window->contactnameentry), editsignal[0]); g_signal_handler_disconnect(G_OBJECT(mmguiapp->window->contactnumberentry), editsignal[1]); g_signal_handler_disconnect(G_OBJECT(mmguiapp->window->contactnumber2entry), editsignal[2]); gtk_widget_hide(mmguiapp->window->newcontactdialog); /*Add contact*/ if (response) { /*Form contact*/ contact = (mmgui_contact_t)g_new0(struct _mmgui_contact, 1); contact->name = g_strdup(gtk_entry_get_text(GTK_ENTRY(mmguiapp->window->contactnameentry))); contact->number = g_strdup(gtk_entry_get_text(GTK_ENTRY(mmguiapp->window->contactnumberentry))); contact->email = g_strdup(gtk_entry_get_text(GTK_ENTRY(mmguiapp->window->contactemailentry))); contact->group = g_strdup(gtk_entry_get_text(GTK_ENTRY(mmguiapp->window->contactgroupentry))); contact->name2 = g_strdup(gtk_entry_get_text(GTK_ENTRY(mmguiapp->window->contactname2entry))); contact->number2 = g_strdup(gtk_entry_get_text(GTK_ENTRY(mmguiapp->window->contactnumber2entry))); contact->hidden = FALSE; contact->storage = 0; /*Add to device*/ if (mmguicore_contacts_add(mmguiapp->core, contact)) { /*Add to list*/ model = gtk_tree_view_get_model(GTK_TREE_VIEW(mmguiapp->window->contactstreeview)); if (model != NULL) { gtk_tree_model_get_iter(model, &iter, mmguiapp->window->contmodempath); gtk_tree_store_append(GTK_TREE_STORE(model), &child, &iter); gtk_tree_store_set(GTK_TREE_STORE(model), &child, MMGUI_MAIN_CONTACTSLIST_NAME, contact->name, MMGUI_MAIN_CONTACTSLIST_NUMBER, contact->number, MMGUI_MAIN_CONTACTSLIST_EMAIL, contact->email, MMGUI_MAIN_CONTACTSLIST_GROUP, contact->group, MMGUI_MAIN_CONTACTSLIST_NAME2, contact->name2, MMGUI_MAIN_CONTACTSLIST_NUMBER2, contact->number2, MMGUI_MAIN_CONTACTSLIST_HIDDEN, contact->hidden, MMGUI_MAIN_CONTACTSLIST_STORAGE, contact->storage, MMGUI_MAIN_CONTACTSLIST_ID, contact->id, MMGUI_MAIN_CONTACTSLIST_TYPE, MMGUI_MAIN_CONTACT_MODEM, -1); } } else { /*Can not add, free resources*/ mmguicore_contacts_free_single(contact, TRUE); mmgui_main_ui_error_dialog_open(mmguiapp, _("Error adding contact"), mmguicore_get_last_error(mmguiapp->core)); } } } void mmgui_main_contacts_new_button_clicked_signal(GObject *object, gpointer user_data) { mmgui_application_t mmguiapp; mmguiapp = (mmgui_application_t)user_data; if (mmguiapp == NULL) return; mmgui_main_contacts_new(mmguiapp); } static void mmgui_main_contacts_remove(mmgui_application_t mmguiapp) { GtkTreeModel *model; GtkTreeSelection *selection; GtkTreeIter iter; guint id, contacttype, contactcaps; if (mmguiapp == NULL) return; contactcaps = mmguicore_contacts_get_capabilities(mmguiapp->core); if (!(contactcaps & MMGUI_CONTACTS_CAPS_EDIT)) return; model = gtk_tree_view_get_model(GTK_TREE_VIEW(mmguiapp->window->contactstreeview)); selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(mmguiapp->window->contactstreeview)); if ((model != NULL) && (selection != NULL)) { if (gtk_tree_selection_get_selected(selection, &model, &iter)) { gtk_tree_model_get(model, &iter, MMGUI_MAIN_CONTACTSLIST_ID, &id, MMGUI_MAIN_CONTACTSLIST_TYPE, &contacttype, -1); if (contacttype == MMGUI_MAIN_CONTACT_MODEM) { if (mmgui_main_ui_question_dialog_open(mmguiapp, _("Remove contact"), _("Really want to remove contact?"))) { if (mmguicore_contacts_delete(mmguiapp->core, id)) { gtk_tree_store_remove(GTK_TREE_STORE(model), &iter); } else { mmgui_main_ui_error_dialog_open(mmguiapp, _("Error removing contact"), _("Contact not removed from device")); } } } } else { mmgui_main_ui_error_dialog_open(mmguiapp, _("Error removing contact"), _("Contact not selected")); } } } void mmgui_main_contacts_remove_button_clicked_signal(GObject *object, gpointer user_data) { mmgui_application_t mmguiapp; mmguiapp = (mmgui_application_t)user_data; if (mmguiapp == NULL) return; mmgui_main_contacts_remove(mmguiapp); } static void mmgui_main_contacts_list_fill(mmgui_application_t mmguiapp) { guint contactscaps; GSList *contacts; GtkTreeModel *model; GtkTreeIter iter, child; GSList *iterator; mmgui_contact_t contact; if (mmguiapp == NULL) return; contactscaps = mmguicore_contacts_get_capabilities(mmguiapp->core); contacts = mmguicore_contacts_list(mmguiapp->core); if (contactscaps & MMGUI_CONTACTS_CAPS_EXPORT) { model = gtk_tree_view_get_model(GTK_TREE_VIEW(mmguiapp->window->contactstreeview)); if (model != NULL) { gtk_tree_store_insert(GTK_TREE_STORE(model), &iter, NULL, 0); gtk_tree_store_set(GTK_TREE_STORE(model), &iter, MMGUI_MAIN_CONTACTSLIST_NAME, _("Modem contacts"), MMGUI_MAIN_CONTACTSLIST_ID, 0, MMGUI_MAIN_CONTACTSLIST_TYPE, MMGUI_MAIN_CONTACT_HEADER, -1); mmguiapp->window->contmodempath = gtk_tree_model_get_path(GTK_TREE_MODEL(model), &iter); if (contacts != NULL) { //Add contacts gtk_tree_model_get_iter(model, &iter, mmguiapp->window->contmodempath); for (iterator=contacts; iterator; iterator=iterator->next) { contact = iterator->data; gtk_tree_store_append(GTK_TREE_STORE(model), &child, &iter); gtk_tree_store_set(GTK_TREE_STORE(model), &child, MMGUI_MAIN_CONTACTSLIST_NAME, contact->name, MMGUI_MAIN_CONTACTSLIST_NUMBER, contact->number, MMGUI_MAIN_CONTACTSLIST_EMAIL, contact->email, MMGUI_MAIN_CONTACTSLIST_GROUP, contact->group, MMGUI_MAIN_CONTACTSLIST_NAME2, contact->name2, MMGUI_MAIN_CONTACTSLIST_NUMBER2, contact->number2, MMGUI_MAIN_CONTACTSLIST_HIDDEN, contact->hidden, MMGUI_MAIN_CONTACTSLIST_STORAGE, contact->storage, MMGUI_MAIN_CONTACTSLIST_ID, contact->id, MMGUI_MAIN_CONTACTSLIST_TYPE, MMGUI_MAIN_CONTACT_MODEM, -1); } } gtk_tree_view_expand_all(GTK_TREE_VIEW(mmguiapp->window->contactstreeview)); } } } static void mmgui_main_contacts_addressbook_list_fill(mmgui_application_t mmguiapp, guint contacttype) { GSList *contacts; GtkTreeModel *model; GtkTreeIter iter, child; GSList *iterator; mmgui_contact_t contact; if (mmguiapp == NULL) return; contacts = NULL; if ((contacttype == MMGUI_MAIN_CONTACT_GNOME) && (mmguiapp->window->contgnomepath != NULL)) { //Contacts from GNOME addressbook if (mmgui_addressbooks_get_gnome_contacts_available(mmguiapp->addressbooks)) { contacts = mmgui_addressbooks_get_gnome_contacts_list(mmguiapp->addressbooks); } } else if (contacttype == MMGUI_MAIN_CONTACT_KDE) { //Contacts from KDE addressbook if (mmgui_addressbooks_get_kde_contacts_available(mmguiapp->addressbooks)) { contacts = mmgui_addressbooks_get_kde_contacts_list(mmguiapp->addressbooks); } } if (contacts != NULL) { model = gtk_tree_view_get_model(GTK_TREE_VIEW(mmguiapp->window->contactstreeview)); if (model != NULL) { g_object_ref(model); gtk_tree_view_set_model(GTK_TREE_VIEW(mmguiapp->window->contactstreeview), NULL); //Get patrent iterator if (contacttype == MMGUI_MAIN_CONTACT_GNOME) { gtk_tree_model_get_iter(model, &iter, mmguiapp->window->contgnomepath); } else if (contacttype == MMGUI_MAIN_CONTACT_KDE) { gtk_tree_model_get_iter(model, &iter, mmguiapp->window->contkdepath); } //Add contacts for (iterator=contacts; iterator; iterator=iterator->next) { contact = iterator->data; gtk_tree_store_append(GTK_TREE_STORE(model), &child, &iter); gtk_tree_store_set(GTK_TREE_STORE(model), &child, MMGUI_MAIN_CONTACTSLIST_NAME, contact->name, MMGUI_MAIN_CONTACTSLIST_NUMBER, contact->number, MMGUI_MAIN_CONTACTSLIST_EMAIL, contact->email, MMGUI_MAIN_CONTACTSLIST_GROUP, contact->group, MMGUI_MAIN_CONTACTSLIST_NAME2, contact->name2, MMGUI_MAIN_CONTACTSLIST_NUMBER2, contact->number2, MMGUI_MAIN_CONTACTSLIST_HIDDEN, contact->hidden, MMGUI_MAIN_CONTACTSLIST_STORAGE, contact->storage, MMGUI_MAIN_CONTACTSLIST_ID, contact->id, MMGUI_MAIN_CONTACTSLIST_TYPE, contacttype, -1); } //Attach model gtk_tree_view_set_model(GTK_TREE_VIEW(mmguiapp->window->contactstreeview), model); g_object_unref(model); } gtk_tree_view_expand_all(GTK_TREE_VIEW(mmguiapp->window->contactstreeview)); } } static void mmgui_main_contacts_list_init(mmgui_application_t mmguiapp) { GtkCellRenderer *renderer; GtkTreeViewColumn *column; GtkTreeStore *store; if (mmguiapp == NULL) return; renderer = gtk_cell_renderer_text_new(); column = gtk_tree_view_column_new_with_attributes(_("First name"), renderer, "markup", MMGUI_MAIN_CONTACTSLIST_NAME, NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(mmguiapp->window->contactstreeview), column); renderer = gtk_cell_renderer_text_new(); column = gtk_tree_view_column_new_with_attributes(_("First number"), renderer, "markup", MMGUI_MAIN_CONTACTSLIST_NUMBER, NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(mmguiapp->window->contactstreeview), column); renderer = gtk_cell_renderer_text_new(); column = gtk_tree_view_column_new_with_attributes(_("EMail"), renderer, "markup", MMGUI_MAIN_CONTACTSLIST_EMAIL, NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(mmguiapp->window->contactstreeview), column); renderer = gtk_cell_renderer_text_new(); column = gtk_tree_view_column_new_with_attributes(_("Group"), renderer, "markup", MMGUI_MAIN_CONTACTSLIST_GROUP, NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(mmguiapp->window->contactstreeview), column); renderer = gtk_cell_renderer_text_new(); column = gtk_tree_view_column_new_with_attributes(_("Second name"), renderer, "markup", MMGUI_MAIN_CONTACTSLIST_NAME2, NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(mmguiapp->window->contactstreeview), column); renderer = gtk_cell_renderer_text_new(); column = gtk_tree_view_column_new_with_attributes(_("Second number"), renderer, "markup", MMGUI_MAIN_CONTACTSLIST_NUMBER2, NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(mmguiapp->window->contactstreeview), column); store = gtk_tree_store_new(MMGUI_MAIN_CONTACTSLIST_COLUMNS, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT); mmguiapp->window->contmodempath = NULL; gtk_tree_view_set_model(GTK_TREE_VIEW(mmguiapp->window->contactstreeview), GTK_TREE_MODEL(store)); g_object_unref(store); g_signal_connect(G_OBJECT(mmguiapp->window->contactstreeview), "cursor-changed", G_CALLBACK(mmgui_main_contacts_list_cursor_changed_signal), mmguiapp); } //TRAFFIC static gboolean mmgui_main_traffic_stats_history_update_from_thread(gpointer data) { mmgui_application_t mmguiapp; mmgui_trafficdb_t trafficdb; struct _mmgui_day_traffic traffic; guint monthid; GtkTreeModel *model; gboolean valid, found; guint64 curtimestamp; GtkTreeIter iter; struct tm *timespec; gchar strformat[4][64]; mmguiapp = (mmgui_application_t)data; if (mmguiapp == NULL) return FALSE; if (mmguiapp->core == NULL) return FALSE; /*If dialog window is not visible - do not update connections list*/ if (!gtk_widget_get_visible(mmguiapp->window->trafficstatsdialog)) return FALSE; trafficdb = (mmgui_trafficdb_t)mmguicore_devices_get_traffic_db(mmguiapp->core); model = gtk_tree_view_get_model(GTK_TREE_VIEW(mmguiapp->window->trafficstatstreeview)); monthid = gtk_combo_box_get_active(GTK_COMBO_BOX(mmguiapp->window->trafficstatsmonthcb)); if ((trafficdb != NULL) && (model != NULL)) { if (mmgui_trafficdb_session_get_day_traffic(trafficdb, &traffic)) { timespec = localtime((const time_t *)&(traffic.daytime)); if (monthid == timespec->tm_mon) { found = FALSE; valid = gtk_tree_model_get_iter_first(model, &iter); while (valid) { gtk_tree_model_get(model, &iter, MMGUI_MAIN_TRAFFICSTATSLIST_TIMESATMP, &curtimestamp, -1); if (traffic.daytime == curtimestamp) { //RX bytes mmgui_str_format_bytes(traffic.dayrxbytes + traffic.sessrxbytes, strformat[1], sizeof(strformat[1]), FALSE); //TX bytes mmgui_str_format_bytes(traffic.daytxbytes + traffic.sesstxbytes, strformat[2], sizeof(strformat[2]), FALSE); //Session time mmgui_str_format_time(traffic.dayduration + traffic.sessduration, strformat[3], sizeof(strformat[3]), FALSE); gtk_list_store_set(GTK_LIST_STORE(model), &iter, MMGUI_MAIN_TRAFFICSTATSLIST_RXDATA, strformat[1], MMGUI_MAIN_TRAFFICSTATSLIST_TXDATA, strformat[2], MMGUI_MAIN_TRAFFICSTATSLIST_SESSIONTIME, strformat[3], -1); found = TRUE; break; } valid = gtk_tree_model_iter_next(model, &iter); } if (!found) { //Date timespec = localtime((const time_t *)&(traffic.daytime)); if (strftime(strformat[0], sizeof(strformat[0]), "%d %B", timespec) == -1) { snprintf(strformat[0], sizeof(strformat[0]), _("Unknown")); } //RX bytes mmgui_str_format_bytes(traffic.dayrxbytes + traffic.sessrxbytes, strformat[1], sizeof(strformat[1]), FALSE); //TX bytes mmgui_str_format_bytes(traffic.daytxbytes + traffic.sesstxbytes, strformat[2], sizeof(strformat[2]), FALSE); //Session time mmgui_str_format_time(traffic.dayduration + traffic.sessduration, strformat[3], sizeof(strformat[3]), FALSE); gtk_list_store_append(GTK_LIST_STORE(model), &iter); gtk_list_store_set(GTK_LIST_STORE(model), &iter, MMGUI_MAIN_TRAFFICSTATSLIST_DAY, strformat[0], MMGUI_MAIN_TRAFFICSTATSLIST_RXDATA, strformat[1], MMGUI_MAIN_TRAFFICSTATSLIST_TXDATA, strformat[2], MMGUI_MAIN_TRAFFICSTATSLIST_SESSIONTIME, strformat[3], MMGUI_MAIN_TRAFFICSTATSLIST_TIMESATMP, traffic.daytime, -1); } } } } return FALSE; } void mmgui_main_traffic_statistics_dialog_fill_statistics(mmgui_application_t mmguiapp, guint month, guint year) { GtkTreeModel *model; GtkTreeIter iter; GSList *statistics, *iterator; mmgui_trafficdb_t trafficdb; mmgui_day_traffic_t traffic; struct tm *timespec; gchar strformat[4][64]; if (mmguiapp == NULL) return; model = gtk_tree_view_get_model(GTK_TREE_VIEW(mmguiapp->window->trafficstatstreeview)); trafficdb = (mmgui_trafficdb_t)mmguicore_devices_get_traffic_db(mmguiapp->core); if ((model != NULL) && (trafficdb != NULL)) { g_object_ref(model); gtk_tree_view_set_model(GTK_TREE_VIEW(mmguiapp->window->trafficstatstreeview), NULL); gtk_list_store_clear(GTK_LIST_STORE(model)); statistics = mmgui_trafficdb_get_traffic_list_for_month(trafficdb, month, year); if (statistics != NULL) { for (iterator=statistics; iterator; iterator=iterator->next) { traffic = iterator->data; //Date timespec = localtime((const time_t *)&(traffic->daytime)); if (strftime(strformat[0], sizeof(strformat[0]), "%d %B", timespec) == -1) { snprintf(strformat[0], sizeof(strformat[0]), _("Unknown")); } //RX bytes mmgui_str_format_bytes(traffic->dayrxbytes + traffic->sessrxbytes, strformat[1], sizeof(strformat[1]), FALSE); //TX bytes mmgui_str_format_bytes(traffic->daytxbytes + traffic->sesstxbytes, strformat[2], sizeof(strformat[2]), FALSE); //Session time mmgui_str_format_time(traffic->dayduration + traffic->sessduration, strformat[3], sizeof(strformat[3]), FALSE); gtk_list_store_append(GTK_LIST_STORE(model), &iter); gtk_list_store_set(GTK_LIST_STORE(model), &iter, MMGUI_MAIN_TRAFFICSTATSLIST_DAY, strformat[0], MMGUI_MAIN_TRAFFICSTATSLIST_RXDATA, strformat[1], MMGUI_MAIN_TRAFFICSTATSLIST_TXDATA, strformat[2], MMGUI_MAIN_TRAFFICSTATSLIST_SESSIONTIME, strformat[3], MMGUI_MAIN_TRAFFICSTATSLIST_TIMESATMP, traffic->daytime, -1); } } gtk_tree_view_set_model(GTK_TREE_VIEW(mmguiapp->window->trafficstatstreeview), model); g_object_unref(model); mmgui_trafficdb_free_traffic_list_for_month(statistics); } } void mmgui_main_traffic_statistics_control_apply_button_clicked_signal(GObject *object, gpointer data) { mmgui_application_t mmguiapp; time_t presenttime; struct tm *timespec; gint monthid, yearid; guint year; mmguiapp = (mmgui_application_t)data; if (mmguiapp == NULL) return; //Local time presenttime = time(NULL); timespec = localtime(&presenttime); //Selected month and year identifiers monthid = gtk_combo_box_get_active(GTK_COMBO_BOX(mmguiapp->window->trafficstatsmonthcb)); yearid = gtk_combo_box_get_active(GTK_COMBO_BOX(mmguiapp->window->trafficstatsyearcb)); //Translate year if (yearid == 0) { year = timespec->tm_year+1900-2; } else if (yearid == 1) { year = timespec->tm_year+1900-1; } else if (yearid == 2) { year = timespec->tm_year+1900; } //Reload list mmgui_main_traffic_statistics_dialog_fill_statistics(mmguiapp, monthid, year); } static void mmgui_main_traffic_statistics_dialog(mmgui_application_t mmguiapp) { gint response; time_t presenttime; struct tm *timespec; gchar strformat[64]; if (mmguiapp == NULL) return; //Local time presenttime = time(NULL); timespec = localtime(&presenttime); //Clear years gtk_combo_box_text_remove_all(GTK_COMBO_BOX_TEXT(mmguiapp->window->trafficstatsyearcb)); //Years snprintf(strformat, sizeof(strformat), "%u", timespec->tm_year+1900-2); gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(mmguiapp->window->trafficstatsyearcb), strformat); snprintf(strformat, sizeof(strformat), "%u", timespec->tm_year+1900-1); gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(mmguiapp->window->trafficstatsyearcb), strformat); snprintf(strformat, sizeof(strformat), "%u", timespec->tm_year+1900); gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(mmguiapp->window->trafficstatsyearcb), strformat); //Select current year gtk_combo_box_set_active(GTK_COMBO_BOX(mmguiapp->window->trafficstatsyearcb), 2); //Select current month gtk_combo_box_set_active(GTK_COMBO_BOX(mmguiapp->window->trafficstatsmonthcb), timespec->tm_mon); //Fill list mmgui_main_traffic_statistics_dialog_fill_statistics(mmguiapp, timespec->tm_mon, timespec->tm_year+1900); response = gtk_dialog_run(GTK_DIALOG(mmguiapp->window->trafficstatsdialog)); gtk_widget_hide(mmguiapp->window->trafficstatsdialog); } void mmgui_main_traffic_statistics_dialog_button_clicked_signal(GObject *object, gpointer data) { mmgui_application_t mmguiapp; mmguiapp = (mmgui_application_t)data; if (mmguiapp == NULL) return; mmgui_main_traffic_statistics_dialog(mmguiapp); } static void mmgui_main_traffic_traffic_statistics_list_init(mmgui_application_t mmguiapp) { GtkCellRenderer *renderer; GtkTreeViewColumn *column; GtkListStore *store; GtkTreeIter iter; if (mmguiapp == NULL) return; renderer = gtk_cell_renderer_text_new(); column = gtk_tree_view_column_new_with_attributes(_("Day"), renderer, "markup", MMGUI_MAIN_TRAFFICSTATSLIST_DAY, NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(mmguiapp->window->trafficstatstreeview), column); renderer = gtk_cell_renderer_text_new(); column = gtk_tree_view_column_new_with_attributes(_("Received data"), renderer, "markup", MMGUI_MAIN_TRAFFICSTATSLIST_RXDATA, NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(mmguiapp->window->trafficstatstreeview), column); renderer = gtk_cell_renderer_text_new(); column = gtk_tree_view_column_new_with_attributes(_("Transmitted data"), renderer, "markup", MMGUI_MAIN_TRAFFICSTATSLIST_TXDATA, NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(mmguiapp->window->trafficstatstreeview), column); renderer = gtk_cell_renderer_text_new(); column = gtk_tree_view_column_new_with_attributes(_("Session time"), renderer, "markup", MMGUI_MAIN_TRAFFICSTATSLIST_SESSIONTIME, NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(mmguiapp->window->trafficstatstreeview), column); store = gtk_list_store_new(MMGUI_MAIN_TRAFFICSTATSLIST_COLUMNS, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_UINT64); gtk_tree_view_set_model(GTK_TREE_VIEW(mmguiapp->window->trafficstatstreeview), GTK_TREE_MODEL(store)); g_object_unref(store); } static gboolean mmgui_main_traffic_connections_update_from_thread(gpointer data) { mmgui_application_t mmguiapp; GHashTable *connections; GtkTreeModel *model; GtkTreeIter iter; gboolean valid; guint inode; mmgui_ext_connection_t extconnection; GHashTableIter hashiter; gpointer key, value; GtkTreePath *path; GtkTreeRowReference *reference; GList *rmlist; GList *rmnode; gchar strbuf[32]; mmguiapp = (mmgui_application_t)data; if (mmguiapp == NULL) return FALSE; /*If dialog window is not visible - do not update connections list*/ if (!gtk_widget_get_visible(mmguiapp->window->conndialog)) return FALSE; connections = mmguicore_connections_sync(mmguiapp->core); if (connections == NULL) return FALSE; model = gtk_tree_view_get_model(GTK_TREE_VIEW(mmguiapp->window->conntreeview)); rmlist = NULL; if (model != NULL) { /*Freeze treeview*/ gtk_widget_freeze_child_notify(mmguiapp->window->conntreeview); /*update model*/ valid = gtk_tree_model_get_iter_first(model, &iter); while (valid) { gtk_tree_model_get(model, &iter, MMGUI_MAIN_CONNECTIONLIST_INODE, &inode, -1); extconnection = g_hash_table_lookup(connections, (gconstpointer)&inode); if (extconnection != NULL) { /*update connection*/ mmgui_str_format_bytes((guint64)extconnection->dqueue, strbuf, sizeof(strbuf), FALSE); gtk_list_store_set(GTK_LIST_STORE(model), &iter, MMGUI_MAIN_CONNECTIONLIST_STATE, mmgui_netlink_socket_state(extconnection->state), MMGUI_MAIN_CONNECTIONLIST_BUFFER, strbuf, -1); extconnection->existsflag = TRUE; } else { /*save reference to remove*/ path = gtk_tree_model_get_path(model, &iter); reference = gtk_tree_row_reference_new(model, path); rmlist = g_list_append(rmlist, reference); gtk_tree_path_free(path); } valid = gtk_tree_model_iter_next(model, &iter); } /*add new connections*/ g_hash_table_iter_init(&hashiter, connections); while (g_hash_table_iter_next(&hashiter, &key, &value)) { extconnection = (mmgui_ext_connection_t)value; if (!extconnection->existsflag) { mmgui_str_format_bytes((guint64)extconnection->dqueue, strbuf, sizeof(strbuf), FALSE); gtk_list_store_append(GTK_LIST_STORE(model), &iter); gtk_list_store_set(GTK_LIST_STORE(model), &iter, MMGUI_MAIN_CONNECTIONLIST_APPLICATION, extconnection->appname, MMGUI_MAIN_CONNECTIONLIST_PID, extconnection->apppid, MMGUI_MAIN_CONNECTIONLIST_PROTOCOL, "TCP", MMGUI_MAIN_CONNECTIONLIST_STATE, mmgui_netlink_socket_state(extconnection->state), MMGUI_MAIN_CONNECTIONLIST_BUFFER, strbuf, MMGUI_MAIN_CONNECTIONLIST_LOCALADDR, extconnection->srcport, MMGUI_MAIN_CONNECTIONLIST_DESTADDR, extconnection->dsthostname, MMGUI_MAIN_CONNECTIONLIST_INODE, extconnection->inode, -1); } } /*remove closed connections*/ for (rmnode = rmlist; rmnode != NULL; rmnode = rmnode->next) { path = gtk_tree_row_reference_get_path((GtkTreeRowReference *)rmnode->data); if (path != NULL) { if (gtk_tree_model_get_iter(GTK_TREE_MODEL(model), &iter, path)) { gtk_list_store_remove(GTK_LIST_STORE(model), &iter); } } } g_list_foreach(rmlist, (GFunc)gtk_tree_row_reference_free, NULL); g_list_free(rmlist); /*Update treeview*/ gtk_widget_thaw_child_notify(mmguiapp->window->conntreeview); } return FALSE; } void mmgui_main_traffic_connections_terminate_button_clicked_signal(GObject *object, gpointer data) { mmgui_application_t mmguiapp; GtkTreeModel *model; GtkTreeSelection *selection; GtkTreeIter iter; guint pid; mmguiapp = (mmgui_application_t)data; if (mmguiapp == NULL) return; model = gtk_tree_view_get_model(GTK_TREE_VIEW(mmguiapp->window->conntreeview)); selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(mmguiapp->window->conntreeview)); if (model != NULL) { if (gtk_tree_selection_get_selected(selection, &model, &iter)) { gtk_tree_model_get(model, &iter, MMGUI_MAIN_CONNECTIONLIST_PID, &pid, -1); mmgui_netlink_terminate_application((pid_t)pid); } } } static void mmgui_main_traffic_connections_dialog(mmgui_application_t mmguiapp) { gint response; if (mmguiapp == NULL) return; response = gtk_dialog_run(GTK_DIALOG(mmguiapp->window->conndialog)); gtk_widget_hide(mmguiapp->window->conndialog); } void mmgui_main_traffic_connections_dialog_button_clicked_signal(GObject *object, gpointer data) { mmgui_application_t mmguiapp; mmguiapp = (mmgui_application_t)data; if (mmguiapp == NULL) return; mmgui_main_traffic_connections_dialog(mmguiapp); } static void mmgui_main_traffic_connections_list_init(mmgui_application_t mmguiapp) { GtkCellRenderer *renderer; GtkTreeViewColumn *column; GtkListStore *store; GtkTreeIter iter; if (mmguiapp == NULL) return; renderer = gtk_cell_renderer_text_new(); column = gtk_tree_view_column_new_with_attributes(_("Application"), renderer, "markup", MMGUI_MAIN_CONNECTIONLIST_APPLICATION, NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(mmguiapp->window->conntreeview), column); renderer = gtk_cell_renderer_text_new(); column = gtk_tree_view_column_new_with_attributes(_("PID"), renderer, "markup", MMGUI_MAIN_CONNECTIONLIST_PID, NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(mmguiapp->window->conntreeview), column); renderer = gtk_cell_renderer_text_new(); column = gtk_tree_view_column_new_with_attributes(_("Protocol"), renderer, "markup", MMGUI_MAIN_CONNECTIONLIST_PROTOCOL, NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(mmguiapp->window->conntreeview), column); renderer = gtk_cell_renderer_text_new(); column = gtk_tree_view_column_new_with_attributes(_("State"), renderer, "markup", MMGUI_MAIN_CONNECTIONLIST_STATE, NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(mmguiapp->window->conntreeview), column); renderer = gtk_cell_renderer_text_new(); column = gtk_tree_view_column_new_with_attributes(_("Buffer"), renderer, "markup", MMGUI_MAIN_CONNECTIONLIST_BUFFER, NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(mmguiapp->window->conntreeview), column); renderer = gtk_cell_renderer_text_new(); column = gtk_tree_view_column_new_with_attributes(_("Port"), renderer, "markup", MMGUI_MAIN_CONNECTIONLIST_LOCALADDR, NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(mmguiapp->window->conntreeview), column); renderer = gtk_cell_renderer_text_new(); column = gtk_tree_view_column_new_with_attributes(_("Destination"), renderer, "markup", MMGUI_MAIN_CONNECTIONLIST_DESTADDR, NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(mmguiapp->window->conntreeview), column); store = gtk_list_store_new(MMGUI_MAIN_CONNECTIONLIST_COLUMNS, G_TYPE_STRING, G_TYPE_UINT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_UINT, G_TYPE_STRING, G_TYPE_UINT, G_TYPE_BOOLEAN); gtk_tree_view_set_model(GTK_TREE_VIEW(mmguiapp->window->conntreeview), GTK_TREE_MODEL(store)); g_object_unref(store); } static gboolean mmgui_main_traffic_limits_show_message_from_thread(gpointer data) { mmgui_application_data_t mmguiappdata; guint eventid; gchar *notifycaption, *notifytext; enum _mmgui_notifications_sound soundmode; mmguiappdata = (mmgui_application_data_t)data; if (mmguiappdata == NULL) return FALSE; eventid = GPOINTER_TO_INT(mmguiappdata->data); if (mmguiappdata->mmguiapp->limits != NULL) { //Various limits switch (eventid) { case MMGUI_EVENT_TRAFFIC_LIMIT: notifycaption = _("Traffic limit exceeded"); notifytext = mmguiappdata->mmguiapp->limits->trafficmessage; break; case MMGUI_EVENT_TIME_LIMIT: notifycaption = _("Time limit exceeded"); notifytext = mmguiappdata->mmguiapp->limits->timemessage; break; default: g_debug("Unknown limit identifier"); return FALSE; } //Show notification/play sound if (mmguiappdata->mmguiapp->options->usesounds) { soundmode = MMGUI_NOTIFICATIONS_SOUND_MESSAGE; } else { soundmode = MMGUI_NOTIFICATIONS_SOUND_NONE; } mmgui_notifications_show(mmguiappdata->mmguiapp->notifications, notifycaption, notifytext, soundmode); } g_free(mmguiappdata); return FALSE; } static void mmgui_main_traffic_limits_dialog_time_section_disable_signal(GtkToggleButton *togglebutton, gpointer data) { mmgui_application_t mmguiapp; gboolean sensitive; mmguiapp = (mmgui_application_t)data; if (mmguiapp == NULL) return; sensitive = gtk_toggle_button_get_active(togglebutton); gtk_widget_set_sensitive(mmguiapp->window->timeamount, sensitive); gtk_widget_set_sensitive(mmguiapp->window->timeunits, sensitive); gtk_widget_set_sensitive(mmguiapp->window->timemessage, sensitive); gtk_widget_set_sensitive(mmguiapp->window->timeaction, sensitive); } static void mmgui_main_traffic_limits_dialog_traffic_section_disable_signal(GtkToggleButton *togglebutton, gpointer data) { mmgui_application_t mmguiapp; gboolean sensitive; mmguiapp = (mmgui_application_t)data; if (mmguiapp == NULL) return; sensitive = gtk_toggle_button_get_active(togglebutton); gtk_widget_set_sensitive(mmguiapp->window->trafficamount, sensitive); gtk_widget_set_sensitive(mmguiapp->window->trafficunits, sensitive); gtk_widget_set_sensitive(mmguiapp->window->trafficmessage, sensitive); gtk_widget_set_sensitive(mmguiapp->window->trafficaction, sensitive); } static gboolean mmgui_main_traffic_limits_dialog_open(mmgui_application_t mmguiapp) { gint response; gulong trafficboxsignal, timeboxsignal; if (mmguiapp == NULL) return FALSE; trafficboxsignal = g_signal_connect(G_OBJECT(mmguiapp->window->trafficlimitcheckbutton), "toggled", G_CALLBACK(mmgui_main_traffic_limits_dialog_traffic_section_disable_signal), mmguiapp); timeboxsignal = g_signal_connect(G_OBJECT(mmguiapp->window->timelimitcheckbutton), "toggled", G_CALLBACK(mmgui_main_traffic_limits_dialog_time_section_disable_signal), mmguiapp); g_signal_emit_by_name(G_OBJECT(mmguiapp->window->trafficlimitcheckbutton), "toggled", NULL); g_signal_emit_by_name(G_OBJECT(mmguiapp->window->timelimitcheckbutton), "toggled", NULL); response = gtk_dialog_run(GTK_DIALOG(mmguiapp->window->trafficlimitsdialog)); g_signal_handler_disconnect(G_OBJECT(mmguiapp->window->trafficlimitcheckbutton), trafficboxsignal); g_signal_handler_disconnect(G_OBJECT(mmguiapp->window->timelimitcheckbutton), timeboxsignal); gtk_widget_hide(mmguiapp->window->trafficlimitsdialog); return (response > 0); } static void mmgui_main_traffic_limits_dialog(mmgui_application_t mmguiapp) { mmguidevice_t device; gchar realtrafficbuf[64], settrafficbuf[64], realtimebuf[64], settimebuf[64]; gchar *message; if (mmguiapp == NULL) return; if ((mmguiapp->limits == NULL) || (mmguiapp->core == NULL)) return; device = mmguicore_devices_get_current(mmguiapp->core); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(mmguiapp->window->trafficlimitcheckbutton), mmguiapp->limits->trafficenabled); gtk_spin_button_set_value(GTK_SPIN_BUTTON(mmguiapp->window->trafficamount), (gdouble)mmguiapp->limits->trafficamount); gtk_combo_box_set_active(GTK_COMBO_BOX(mmguiapp->window->trafficunits), mmguiapp->limits->trafficunits); gtk_entry_set_text(GTK_ENTRY(mmguiapp->window->trafficmessage), mmguiapp->limits->trafficmessage); gtk_combo_box_set_active(GTK_COMBO_BOX(mmguiapp->window->trafficaction), mmguiapp->limits->trafficaction); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(mmguiapp->window->timelimitcheckbutton), mmguiapp->limits->timeenabled); gtk_spin_button_set_value(GTK_SPIN_BUTTON(mmguiapp->window->timeamount), (gdouble)mmguiapp->limits->timeamount); gtk_combo_box_set_active(GTK_COMBO_BOX(mmguiapp->window->timeunits), mmguiapp->limits->timeunits); gtk_entry_set_text(GTK_ENTRY(mmguiapp->window->timemessage), mmguiapp->limits->timemessage); gtk_combo_box_set_active(GTK_COMBO_BOX(mmguiapp->window->timeaction), mmguiapp->limits->timeaction); if (mmgui_main_traffic_limits_dialog_open(mmguiapp)) { if (mmguiapp->limits != NULL) { mmguiapp->limits->trafficenabled = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(mmguiapp->window->trafficlimitcheckbutton)); mmguiapp->limits->trafficamount = (guint)gtk_spin_button_get_value(GTK_SPIN_BUTTON(mmguiapp->window->trafficamount)); mmguiapp->limits->trafficunits = gtk_combo_box_get_active(GTK_COMBO_BOX(mmguiapp->window->trafficunits)); if (mmguiapp->limits->trafficmessage != NULL) g_free(mmguiapp->limits->trafficmessage); mmguiapp->limits->trafficmessage = g_strdup(gtk_entry_get_text(GTK_ENTRY(mmguiapp->window->trafficmessage))); mmguiapp->limits->trafficaction = gtk_combo_box_get_active(GTK_COMBO_BOX(mmguiapp->window->trafficaction)); switch (mmguiapp->limits->trafficunits) { case 0: mmguiapp->limits->trafficfull = mmguiapp->limits->trafficamount*1024*1024; break; case 1: mmguiapp->limits->trafficfull = mmguiapp->limits->trafficamount*1024*1024*1024; break; case 2: mmguiapp->limits->trafficfull = mmguiapp->limits->trafficamount*1024*1024*1024*1024; break; default: mmguiapp->limits->trafficfull = mmguiapp->limits->trafficamount*1024*1024; break; } mmguiapp->limits->trafficexecuted = FALSE; if (device != NULL) { if ((device->connected) && (mmguiapp->limits->trafficenabled) && (mmguiapp->limits->trafficfull < (device->rxbytes + device->txbytes))) { mmguiapp->limits->trafficexecuted = TRUE; } } mmguiapp->limits->timeenabled = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(mmguiapp->window->timelimitcheckbutton)); mmguiapp->limits->timeamount = (guint)gtk_spin_button_get_value(GTK_SPIN_BUTTON(mmguiapp->window->timeamount)); mmguiapp->limits->timeunits = gtk_combo_box_get_active(GTK_COMBO_BOX(mmguiapp->window->timeunits)); if (mmguiapp->limits->timemessage != NULL) g_free(mmguiapp->limits->timemessage); mmguiapp->limits->timemessage = g_strdup(gtk_entry_get_text(GTK_ENTRY(mmguiapp->window->timemessage))); mmguiapp->limits->timeaction = gtk_combo_box_get_active(GTK_COMBO_BOX(mmguiapp->window->timeaction)); switch (mmguiapp->limits->timeunits) { case 0: mmguiapp->limits->timefull = mmguiapp->limits->timeamount*60; break; case 1: mmguiapp->limits->timefull = mmguiapp->limits->timeamount*60*60; break; default: mmguiapp->limits->timefull = mmguiapp->limits->timeamount*60; break; } mmguiapp->limits->timeexecuted = FALSE; if (device != NULL) { if ((device->connected) && (mmguiapp->limits->timeenabled) && (mmguiapp->limits->timefull < device->sessiontime)) { mmguiapp->limits->timeexecuted = TRUE; } } gmm_settings_set_boolean(mmguiapp->settings, "limits_traffic_enabled", mmguiapp->limits->trafficenabled); gmm_settings_set_int(mmguiapp->settings, "limits_traffic_amount", (gint)mmguiapp->limits->trafficamount); gmm_settings_set_int(mmguiapp->settings, "limits_traffic_units", (guint)mmguiapp->limits->trafficunits); gmm_settings_set_string(mmguiapp->settings, "limits_traffic_message", mmguiapp->limits->trafficmessage); gmm_settings_set_int(mmguiapp->settings, "limits_traffic_action", (guint)mmguiapp->limits->trafficaction); gmm_settings_set_boolean(mmguiapp->settings, "limits_time_enabled", mmguiapp->limits->timeenabled); gmm_settings_set_int(mmguiapp->settings, "limits_time_amount", (guint)mmguiapp->limits->timeamount); gmm_settings_set_int(mmguiapp->settings, "limits_time_units", (guint)mmguiapp->limits->timeunits); gmm_settings_set_string(mmguiapp->settings, "limits_time_message", mmguiapp->limits->timemessage); gmm_settings_set_int(mmguiapp->settings, "limits_time_action", (guint)mmguiapp->limits->timeaction); if (device != NULL) { if ((mmguiapp->limits->trafficexecuted) || (mmguiapp->limits->timeexecuted)) { if ((mmguiapp->limits->trafficexecuted) && (mmguiapp->limits->timeexecuted)) { message = g_strdup_printf(_("Traffic: %s, limit set to: %s\nTime: %s, limit set to: %s\nPlease check entered values and try once more"), mmgui_str_format_bytes(device->rxbytes + device->txbytes, realtrafficbuf, sizeof(realtrafficbuf), TRUE), mmgui_str_format_bytes(mmguiapp->limits->trafficfull, settrafficbuf, sizeof(settrafficbuf), TRUE), mmgui_str_format_time(device->sessiontime, realtimebuf, sizeof(realtimebuf), TRUE), mmgui_str_format_time(mmguiapp->limits->timefull, settimebuf, sizeof(settimebuf), TRUE)); mmgui_main_ui_error_dialog_open(mmguiapp, _("Wrong traffic and time limit values"), message); g_free(message); } else if (mmguiapp->limits->trafficexecuted) { message = g_strdup_printf(_("Traffic: %s, limit set to: %s\nPlease check entered values and try once more"), mmgui_str_format_bytes(device->rxbytes + device->txbytes, realtrafficbuf, sizeof(realtrafficbuf), TRUE), mmgui_str_format_bytes(mmguiapp->limits->trafficfull, settrafficbuf, sizeof(settrafficbuf), TRUE)); mmgui_main_ui_error_dialog_open(mmguiapp, _("Wrong traffic limit value"), message); g_free(message); } else if (mmguiapp->limits->timeexecuted) { message = g_strdup_printf(_("Time: %s, limit set to: %s\nPlease check entered values and try once more"), mmgui_str_format_time(device->sessiontime, realtimebuf, sizeof(realtimebuf), TRUE), mmgui_str_format_time(mmguiapp->limits->timefull, settimebuf, sizeof(settimebuf), TRUE)); mmgui_main_ui_error_dialog_open(mmguiapp, _("Wrong time limit value"), message); g_free(message); } } } } } } void mmgui_main_traffic_limits_dialog_button_clicked_signal(GObject *object, gpointer data) { mmgui_application_t mmguiapp; mmguiapp = (mmgui_application_t)data; if (mmguiapp == NULL) return; if ((mmguiapp->limits == NULL) || (mmguiapp->core == NULL)) return; mmgui_main_traffic_limits_dialog(mmguiapp); } static gboolean mmgui_main_traffic_update_statusbar_from_thread(gpointer data) { mmgui_application_t mmguiapp; mmguidevice_t device; gchar *statusmsg; gchar rxbuffer[32], txbuffer[32]; mmguiapp = (mmgui_application_t)data; if (mmguiapp == NULL) return; if (mmguiapp->core == NULL) return; device = mmguicore_devices_get_current(mmguiapp->core); if (device != NULL) { if (!device->connected) { statusmsg = g_strdup_printf(_("%s disconnected"), device->operatorname); } else { statusmsg = g_strdup_printf("%s ↓ %s ↑ %s", device->operatorname, mmgui_str_format_bytes(device->rxbytes, rxbuffer, sizeof(rxbuffer), FALSE), mmgui_str_format_bytes(device->txbytes, txbuffer, sizeof(txbuffer), FALSE)); } gtk_statusbar_pop(GTK_STATUSBAR(mmguiapp->window->statusbar), mmguiapp->window->sbcontext); mmguiapp->window->sbcontext = gtk_statusbar_get_context_id(GTK_STATUSBAR(mmguiapp->window->statusbar), statusmsg); gtk_statusbar_push(GTK_STATUSBAR(mmguiapp->window->statusbar), mmguiapp->window->sbcontext, statusmsg); g_free(statusmsg); } else { gtk_statusbar_pop(GTK_STATUSBAR(mmguiapp->window->statusbar), mmguiapp->window->sbcontext); } return FALSE; } static gboolean mmgui_main_traffic_stats_update_from_thread_foreach(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data) { mmgui_application_t mmguiapp; mmguidevice_t device; gint id; gchar buffer[64]; gfloat speed; guint64 limitleft; mmguiapp = (mmgui_application_t)data; if (mmguiapp == NULL) return; if (mmguiapp->core == NULL) return; device = mmguicore_devices_get_current(mmguiapp->core); if ((device == NULL) || ((device != NULL) && (!device->connected))) { gtk_list_store_set(GTK_LIST_STORE(model), iter, MMGUI_MAIN_TRAFFICLIST_VALUE, "", -1); } else { gtk_tree_model_get(model, iter, MMGUI_MAIN_TRAFFICLIST_ID, &id, -1); switch (id) { case MMGUI_MAIN_TRAFFICLIST_ID_RXDATA: gtk_list_store_set(GTK_LIST_STORE(model), iter, MMGUI_MAIN_TRAFFICLIST_VALUE, mmgui_str_format_bytes(device->rxbytes, buffer, sizeof(buffer), TRUE), -1); break; case MMGUI_MAIN_TRAFFICLIST_ID_TXDATA: gtk_list_store_set(GTK_LIST_STORE(model), iter, MMGUI_MAIN_TRAFFICLIST_VALUE, mmgui_str_format_bytes(device->txbytes, buffer, sizeof(buffer), TRUE), -1); break; case MMGUI_MAIN_TRAFFICLIST_ID_RXSPEED: if (device->speedindex < MMGUI_SPEED_VALUES_NUMBER) { if (device->speedindex == 0) { speed = device->speedvalues[0][device->speedindex]; } else { speed = device->speedvalues[0][device->speedindex-1]; } } else { speed = device->speedvalues[0][MMGUI_SPEED_VALUES_NUMBER-1]; } gtk_list_store_set(GTK_LIST_STORE(model), iter, MMGUI_MAIN_TRAFFICLIST_VALUE, mmgui_str_format_speed(speed, buffer, sizeof(buffer), TRUE), -1); break; case MMGUI_MAIN_TRAFFICLIST_ID_TXSPEED: if (device->speedindex < MMGUI_SPEED_VALUES_NUMBER) { if (device->speedindex == 0) { speed = device->speedvalues[1][device->speedindex]; } else { speed = device->speedvalues[1][device->speedindex-1]; } } else { speed = device->speedvalues[1][MMGUI_SPEED_VALUES_NUMBER-1]; } gtk_list_store_set(GTK_LIST_STORE(model), iter, MMGUI_MAIN_TRAFFICLIST_VALUE, mmgui_str_format_speed(speed, buffer, sizeof(buffer), TRUE), -1); break; case MMGUI_MAIN_TRAFFICLIST_ID_TIME: if (device->connected) { gtk_list_store_set(GTK_LIST_STORE(model), iter, MMGUI_MAIN_TRAFFICLIST_VALUE, mmgui_str_format_time(device->sessiontime, buffer, sizeof(buffer), TRUE), -1); } else { gtk_list_store_set(GTK_LIST_STORE(model), iter, MMGUI_MAIN_TRAFFICLIST_VALUE, _("Disconnected"), -1); } break; case MMGUI_MAIN_TRAFFICLIST_ID_DATALIMIT: if (device->connected) { if (mmguiapp->limits != NULL) { if (!mmguiapp->limits->trafficexecuted) { if (mmguiapp->limits->trafficenabled) { limitleft = mmguiapp->limits->trafficfull - (device->rxbytes + device->txbytes); if (mmguiapp->limits->trafficfull > (device->rxbytes + device->txbytes)) { gtk_list_store_set(GTK_LIST_STORE(model), iter, MMGUI_MAIN_TRAFFICLIST_VALUE, mmgui_str_format_bytes(limitleft, buffer, sizeof(buffer), TRUE), -1); } else { gtk_list_store_set(GTK_LIST_STORE(model), iter, MMGUI_MAIN_TRAFFICLIST_VALUE, _("Limit"), -1); } } else { gtk_list_store_set(GTK_LIST_STORE(model), iter, MMGUI_MAIN_TRAFFICLIST_VALUE, _("Disabled"), -1); } } else { gtk_list_store_set(GTK_LIST_STORE(model), iter, MMGUI_MAIN_TRAFFICLIST_VALUE, _("Limit"), -1); } } else { gtk_list_store_set(GTK_LIST_STORE(model), iter, MMGUI_MAIN_TRAFFICLIST_VALUE, _("Disabled"), -1); } } else { gtk_list_store_set(GTK_LIST_STORE(model), iter, MMGUI_MAIN_TRAFFICLIST_VALUE, _("Disconnected"), -1); } break; case MMGUI_MAIN_TRAFFICLIST_ID_TIMELIMIT: if (device->connected) { if (mmguiapp->limits != NULL) { if (!mmguiapp->limits->timeexecuted) { if (mmguiapp->limits->timeenabled) { limitleft = mmguiapp->limits->timefull - device->sessiontime; if (mmguiapp->limits->timefull > device->sessiontime) { gtk_list_store_set(GTK_LIST_STORE(model), iter, MMGUI_MAIN_TRAFFICLIST_VALUE, mmgui_str_format_time(limitleft, buffer, sizeof(buffer), TRUE), -1); } else { gtk_list_store_set(GTK_LIST_STORE(model), iter, MMGUI_MAIN_TRAFFICLIST_VALUE, _("Limit"), -1); } } else { gtk_list_store_set(GTK_LIST_STORE(model), iter, MMGUI_MAIN_TRAFFICLIST_VALUE, _("Disabled"), -1); } } else { gtk_list_store_set(GTK_LIST_STORE(model), iter, MMGUI_MAIN_TRAFFICLIST_VALUE, _("Limit"), -1); } } else { gtk_list_store_set(GTK_LIST_STORE(model), iter, MMGUI_MAIN_TRAFFICLIST_VALUE, _("Disabled"), -1); } } else { gtk_list_store_set(GTK_LIST_STORE(model), iter, MMGUI_MAIN_TRAFFICLIST_VALUE, _("Disconnected"), -1); } break; default: break; } } return FALSE; } static gboolean mmgui_main_traffic_stats_update_from_thread(gpointer data) { mmgui_application_t mmguiapp; GtkTreeModel *model; GdkWindow *window; gboolean visible; mmguiapp = (mmgui_application_t)data; if (mmguiapp == NULL) return FALSE; if (mmguiapp->core == NULL) return FALSE; if (mmguiapp->core->device == NULL) return FALSE; //Update traffic statistics model = gtk_tree_view_get_model(GTK_TREE_VIEW(mmguiapp->window->trafficparamslist)); if (model != NULL) { gtk_tree_model_foreach(model, mmgui_main_traffic_stats_update_from_thread_foreach, data); } //Update traffic graph window = gtk_widget_get_window(mmguiapp->window->trafficdrawingarea); visible = gtk_widget_get_visible(mmguiapp->window->trafficdrawingarea); //Update only if needed if ((gtk_notebook_get_current_page(GTK_NOTEBOOK(mmguiapp->window->notebook)) == MMGUI_MAIN_PAGE_TRAFFIC) && (window != NULL) && (visible)) { //TODO: Determine rectangle gdk_window_invalidate_rect(window, NULL, FALSE); } return FALSE; } static void mmgui_main_traffic_speed_plot_draw(GtkWidget *widget, cairo_t *cr, gpointer data) { gint width, height; gint i, c, graphlen; gfloat maxvalue; gchar strbuffer[32]; const gdouble dashed[1] = {1.0}; mmgui_application_t mmguiapp; mmguidevice_t device; gfloat rxr, rxg, rxb, txr, txg, txb; mmguiapp = (mmgui_application_t)data; if (mmguiapp == NULL) return; device = mmguicore_devices_get_current(mmguiapp->core); if (device == NULL) return; rxr = mmguiapp->options->rxtrafficcolor.red/65535.0; rxg = mmguiapp->options->rxtrafficcolor.green/65535.0; rxb = mmguiapp->options->rxtrafficcolor.blue/65535.0; txr = mmguiapp->options->txtrafficcolor.red/65535.0; txg = mmguiapp->options->txtrafficcolor.green/65535.0; txb = mmguiapp->options->txtrafficcolor.blue/65535.0; maxvalue = 100.0; if ((device->connected) && (device->speedindex > 0)) { for (i=device->speedindex-1; i>=0; i--) { if (device->speedvalues[0][i] > maxvalue) { maxvalue = device->speedvalues[0][i]; } if (device->speedvalues[1][i] > maxvalue) { maxvalue = device->speedvalues[1][i]; } } } if (maxvalue < 100.0) maxvalue = 100.0; width = gtk_widget_get_allocated_width(widget); height = gtk_widget_get_allocated_height(widget); cairo_set_source_rgba(cr, 0, 0, 0, 1); cairo_set_line_width(cr, 1.5); graphlen = 19*(gint)((width-60)/19.0); cairo_move_to(cr, 30, 30); cairo_line_to(cr, 30, height-30); cairo_line_to(cr, 30+graphlen, height-30); cairo_line_to(cr, 30+graphlen, 30); cairo_line_to(cr, 30, 30); cairo_stroke(cr); cairo_set_source_rgba(cr, 0.5, 0.5, 0.5, 1); cairo_set_line_width(cr, 1.0); cairo_set_dash(cr, dashed, 1, 0); for (i=1; i<10; i++) { cairo_move_to(cr, 30, height-30-(i*(gint)((height-60)/10.0))); cairo_line_to(cr, 30+graphlen, height-30-(i*(gint)((height-60)/10.0))); } for (i=1; i<19; i++) { cairo_move_to(cr, 30+(i*(gint)((width-60)/19.0)), 30); cairo_line_to(cr, 30+(i*(gint)((width-60)/19.0)), height-30); } cairo_stroke(cr); cairo_set_dash(cr, dashed, 0, 0); cairo_select_font_face(cr, "Sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD); cairo_set_font_size(cr, 8); for (i=0; i<=10; i++) { cairo_move_to(cr, 0, height-30+3-(i*(gint)((height-60)/10.0))); memset(strbuffer, 0, sizeof(strbuffer)); g_snprintf(strbuffer, sizeof(strbuffer), "%4.0f", i*(maxvalue/10.0)); cairo_show_text(cr, strbuffer); } cairo_move_to(cr, 0, 15); cairo_show_text(cr, _("kbps")); for (i=0; i<19; i++) { cairo_move_to(cr, 30-5+(i*(gint)((width-60)/19.0)), height-8); memset(strbuffer, 0, sizeof(strbuffer)); g_snprintf(strbuffer, sizeof(strbuffer), "%i", (i+1)*MMGUI_THREAD_SLEEP_PERIOD); cairo_show_text(cr, strbuffer); } cairo_move_to(cr, width-35, height-8); cairo_show_text(cr, _("sec")); cairo_stroke(cr); if ((device != NULL) && (device->connected) && (device->speedindex > 0)) { cairo_set_source_rgba(cr, txr, txg, txb, 1.0); cairo_set_line_width(cr, 2.5); cairo_set_line_join(cr, CAIRO_LINE_JOIN_ROUND); c = 1; for (i=device->speedindex-1; i>=0; i--) { if (i == device->speedindex-1) { cairo_arc(cr, 30, height-30-(gint)(device->speedvalues[1][i]*((height-60)/maxvalue)), 2.0, 0*(3.14/180.0), 360*(3.14/180.0)); cairo_move_to(cr, 30, height-30-(gint)(device->speedvalues[1][i]*((height-60)/maxvalue))); } else { cairo_line_to(cr, 30+(c*(gint)((width-60)/19.0)), height-30-(gint)(device->speedvalues[1][i]*((height-60)/maxvalue))); cairo_arc(cr, 30+(c*(gint)((width-60)/19.0)), height-30-(gint)(device->speedvalues[1][i]*((height-60)/maxvalue)), 2.0, 0*(3.14/180.0), 360*(3.14/180.0)); cairo_move_to(cr, 30+(c*(gint)((width-60)/19.0)), height-30-(gint)(device->speedvalues[1][i]*((height-60)/maxvalue))); c++; } } cairo_stroke(cr); cairo_set_source_rgba(cr, rxr, rxg, rxb, 1.0); cairo_set_line_width(cr, 2.5); cairo_set_line_join(cr, CAIRO_LINE_JOIN_ROUND); c = 1; for (i=device->speedindex-1; i>=0; i--) { if (i == device->speedindex-1) { cairo_arc(cr, 30, height-30-(gint)(device->speedvalues[0][i]*((height-60)/maxvalue)), 2.0, 0*(3.14/180.0), 360*(3.14/180.0)); cairo_move_to(cr, 30, height-30-(gint)(device->speedvalues[0][i]*((height-60)/maxvalue))); } else { cairo_line_to(cr, 30+(c*(gint)((width-60)/19.0)), height-30-(gint)(device->speedvalues[0][i]*((height-60)/maxvalue))); cairo_arc(cr, 30+(c*(gint)((width-60)/19.0)), height-30-(gint)(device->speedvalues[0][i]*((height-60)/maxvalue)), 2.0, 0*(3.14/180.0), 360*(3.14/180.0)); cairo_move_to(cr, 30+(c*(gint)((width-60)/19.0)), height-30-(gint)(device->speedvalues[0][i]*((height-60)/maxvalue))); c++; } } cairo_stroke(cr); } //078B2DFF cairo_set_source_rgba(cr, rxr, rxg, rxb, 1.0); cairo_set_line_width(cr, 2.5); cairo_arc(cr, width-230, 12, 2.0, 0*(3.14/180.0), 360*(3.14/180.0)); cairo_move_to(cr, width-222, 12); cairo_line_to(cr, width-238, 12); cairo_stroke(cr); cairo_set_source_rgba(cr, 0.5, 0.5, 0.5, 1); cairo_select_font_face(cr, "Sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL); cairo_set_font_size(cr, 10); cairo_move_to(cr, width-220, 15); cairo_show_text(cr, _("RX speed")); cairo_stroke(cr); //99114DFF cairo_set_source_rgba(cr, txr, txg, txb, 1.0); cairo_set_line_width(cr, 2.5); cairo_arc(cr, width-110, 12, 2.0, 0*(3.14/180.0), 360*(3.14/180.0)); cairo_move_to(cr, width-102, 12); cairo_line_to(cr, width-118, 12); cairo_stroke(cr); cairo_set_source_rgba(cr, 0.5, 0.5, 0.5, 1); cairo_select_font_face(cr, "Sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL); cairo_set_font_size(cr, 10); cairo_move_to(cr, width-100, 15); cairo_show_text(cr, _("TX speed")); cairo_stroke(cr); } static void mmgui_main_traffic_list_init(mmgui_application_t mmguiapp) { GtkCellRenderer *renderer; GtkTreeViewColumn *column; GtkListStore *store; GtkTreeIter iter; if (mmguiapp == NULL) return; renderer = gtk_cell_renderer_text_new(); column = gtk_tree_view_column_new_with_attributes(_("Parameter"), renderer, "markup", MMGUI_MAIN_TRAFFICLIST_PARAMETER, NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(mmguiapp->window->trafficparamslist), column); renderer = gtk_cell_renderer_text_new(); g_object_set(renderer, "ellipsize", PANGO_ELLIPSIZE_END, "ellipsize-set", TRUE, NULL); column = gtk_tree_view_column_new_with_attributes(_("Value"), renderer, "markup", MMGUI_MAIN_TRAFFICLIST_VALUE, NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(mmguiapp->window->trafficparamslist), column); store = gtk_list_store_new(MMGUI_MAIN_TRAFFICLIST_COLUMNS, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT); gtk_list_store_append(store, &iter); gtk_list_store_set(store, &iter, MMGUI_MAIN_TRAFFICLIST_PARAMETER, _("Received data"), MMGUI_MAIN_TRAFFICLIST_ID, MMGUI_MAIN_TRAFFICLIST_ID_RXDATA, -1); gtk_list_store_append(store, &iter); gtk_list_store_set(store, &iter, MMGUI_MAIN_TRAFFICLIST_PARAMETER, _("Transmitted data"), MMGUI_MAIN_TRAFFICLIST_ID, MMGUI_MAIN_TRAFFICLIST_ID_TXDATA, -1); gtk_list_store_append(store, &iter); gtk_list_store_set(store, &iter, MMGUI_MAIN_TRAFFICLIST_PARAMETER, _("Receive speed"), MMGUI_MAIN_TRAFFICLIST_ID, MMGUI_MAIN_TRAFFICLIST_ID_RXSPEED, -1); gtk_list_store_append(store, &iter); gtk_list_store_set(store, &iter, MMGUI_MAIN_TRAFFICLIST_PARAMETER, _("Transmit speed"), MMGUI_MAIN_TRAFFICLIST_ID, MMGUI_MAIN_TRAFFICLIST_ID_TXSPEED, -1); gtk_list_store_append(store, &iter); gtk_list_store_set(store, &iter, MMGUI_MAIN_TRAFFICLIST_PARAMETER, _("Session time"), MMGUI_MAIN_TRAFFICLIST_ID, MMGUI_MAIN_TRAFFICLIST_ID_TIME, -1); gtk_list_store_append(store, &iter); gtk_list_store_set(store, &iter, MMGUI_MAIN_TRAFFICLIST_PARAMETER, _("Traffic left"), MMGUI_MAIN_TRAFFICLIST_ID, MMGUI_MAIN_TRAFFICLIST_ID_DATALIMIT, -1); gtk_list_store_append(store, &iter); gtk_list_store_set(store, &iter, MMGUI_MAIN_TRAFFICLIST_PARAMETER, _("Time left"), MMGUI_MAIN_TRAFFICLIST_ID, MMGUI_MAIN_TRAFFICLIST_ID_TIMELIMIT, -1); gtk_tree_view_set_model(GTK_TREE_VIEW(mmguiapp->window->trafficparamslist), GTK_TREE_MODEL(store)); g_object_unref(store); } //SCAN static void mmgui_main_scan_start(mmgui_application_t mmguiapp) { if (mmguiapp == NULL) return; if (mmguicore_networks_scan(mmguiapp->core)) { mmgui_main_ui_progress_dialog_open(mmguiapp); } else { mmgui_main_ui_error_dialog_open(mmguiapp, _("Error sending message"), _("Device error")); } } void mmgui_main_scan_start_button_clicked_signal(GObject *object, gpointer data) { mmgui_application_t mmguiapp; mmguiapp = (mmgui_application_t)data; if (mmguiapp == NULL) return; mmgui_main_scan_start(mmguiapp); } static void mmgui_main_scan_list_fill_foreach(gpointer data, gpointer user_data) { mmgui_scanned_network_t network; GtkTreeModel *model; GtkTreeIter iter; gchar *markup; network = (mmgui_scanned_network_t)data; model = (GtkTreeModel *)user_data; if ((network == NULL) || (model == NULL)) return; markup = g_strdup_printf(_("%s\n%s ID: %u Availability: %s Access tech: %s"), network->operator_long, network->operator_short, network->operator_num, mmgui_str_format_na_status_string(network->status), mmgui_str_format_access_tech_string(network->access_tech)); gtk_list_store_append(GTK_LIST_STORE(model), &iter); gtk_list_store_set(GTK_LIST_STORE(model), &iter, MMGUI_MAIN_SCANLIST_OPERATOR, markup, -1); g_free(markup); } static void mmgui_main_scan_list_fill(mmgui_application_t mmguiapp, mmguicore_t mmguicore, GSList *netlist) { GtkTreeModel *model; if ((mmguiapp == NULL) || (mmguicore == NULL)) return; if (netlist != NULL) { model = gtk_tree_view_get_model(GTK_TREE_VIEW(mmguiapp->window->scanlist)); if (model != NULL) { //Detach model g_object_ref(model); gtk_tree_view_set_model(GTK_TREE_VIEW(mmguiapp->window->scanlist), NULL); //Clear model gtk_list_store_clear(GTK_LIST_STORE(model)); //Fill model g_slist_foreach(netlist, mmgui_main_scan_list_fill_foreach, model); //Attach model gtk_tree_view_set_model(GTK_TREE_VIEW(mmguiapp->window->scanlist), model); g_object_unref(model); } //Free networks list mmguicore_networks_scan_free(netlist); } else { mmgui_main_ui_error_dialog_open(mmguiapp, _("Error scanning networks"), mmguicore_get_last_error(mmguiapp->core)); } } static void mmgui_main_scan_list_init(mmgui_application_t mmguiapp) { GtkCellRenderer *renderer; GtkTreeViewColumn *column; GtkListStore *store; if (mmguiapp == NULL) return; renderer = gtk_cell_renderer_text_new(); g_object_set(renderer, "ellipsize", PANGO_ELLIPSIZE_END, "ellipsize-set", TRUE, NULL); column = gtk_tree_view_column_new_with_attributes(_("Operator"), renderer, "markup", MMGUI_MAIN_SCANLIST_OPERATOR, NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(mmguiapp->window->scanlist), column); store = gtk_list_store_new(MMGUI_MAIN_SCANLIST_COLUMNS, G_TYPE_STRING); gtk_tree_view_set_model(GTK_TREE_VIEW(mmguiapp->window->scanlist), GTK_TREE_MODEL(store)); g_object_unref(store); } //INFO static void mmgui_main_info_update_for_device(mmgui_application_t mmguiapp) { mmguidevice_t device; gchar buffer[256]; guint locationcaps; if (mmguiapp == NULL) return; device = mmguicore_devices_get_current(mmguiapp->core); locationcaps = mmguicore_location_get_capabilities(mmguiapp->core); if (device != NULL) { //Device g_snprintf(buffer, sizeof(buffer), "%s %s (%s)", device->manufacturer, device->model, device->port); gtk_label_set_label(GTK_LABEL(mmguiapp->window->devicevlabel), buffer); //Operator name gtk_label_set_label(GTK_LABEL(mmguiapp->window->operatorvlabel), device->operatorname); //Operator code gtk_label_set_label(GTK_LABEL(mmguiapp->window->operatorcodevlabel), device->operatorcode); //Registration state gtk_label_set_label(GTK_LABEL(mmguiapp->window->regstatevlabel), mmgui_str_format_reg_status(device->regstatus)); //Network mode gtk_label_set_label(GTK_LABEL(mmguiapp->window->modevlabel), mmgui_str_format_mode_string(device->mode)); //IMEI gtk_label_set_label(GTK_LABEL(mmguiapp->window->imeivlabel), device->imei); //IMSI gtk_label_set_label(GTK_LABEL(mmguiapp->window->imsivlabel), device->imsi); //Signal level g_snprintf(buffer, sizeof(buffer), "%u%%", device->siglevel); gtk_progress_bar_set_text(GTK_PROGRESS_BAR(mmguiapp->window->signallevelprogressbar), buffer); gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(mmguiapp->window->signallevelprogressbar), device->siglevel/100.0); //Location if (locationcaps & MMGUI_LOCATION_CAPS_3GPP) { memset(buffer, 0, sizeof(buffer)); g_snprintf(buffer, sizeof(buffer), "%u/%u/%X/%X", device->loc3gppdata[0], device->loc3gppdata[1], device->loc3gppdata[2], device->loc3gppdata[3]); gtk_label_set_label(GTK_LABEL(mmguiapp->window->info3gpplocvlabel), buffer); } else { gtk_label_set_label(GTK_LABEL(mmguiapp->window->info3gpplocvlabel), _("Not supported")); } if (locationcaps & MMGUI_LOCATION_CAPS_GPS) { memset(buffer, 0, sizeof(buffer)); g_snprintf(buffer, sizeof(buffer), "%3.2f/%3.2f/%3.2f", device->locgpsdata[0], device->locgpsdata[1], device->locgpsdata[2]); gtk_label_set_label(GTK_LABEL(mmguiapp->window->infogpslocvlabel), buffer); } else { gtk_label_set_label(GTK_LABEL(mmguiapp->window->infogpslocvlabel), _("Not supported")); } } } static void mmgui_main_info_handle_signal_level_change(mmgui_application_t mmguiapp, mmguidevice_t device) { gchar strbuf[256]; if ((mmguiapp == NULL) || (device == NULL)) return; g_snprintf(strbuf, sizeof(strbuf), "%u%%", device->siglevel); gtk_progress_bar_set_text(GTK_PROGRESS_BAR(mmguiapp->window->signallevelprogressbar), strbuf); gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(mmguiapp->window->signallevelprogressbar), device->siglevel/100.0); } static void mmgui_main_info_handle_network_mode_change(mmgui_application_t mmguiapp, mmguidevice_t device) { if ((mmguiapp == NULL) || (device == NULL)) return; gtk_label_set_label(GTK_LABEL(mmguiapp->window->modevlabel), mmgui_str_format_mode_string(device->mode)); } static void mmgui_main_info_handle_network_registration_change(mmgui_application_t mmguiapp, mmguidevice_t device) { guint setpage; if ((mmguiapp == NULL) || (device == NULL)) return; gtk_label_set_label(GTK_LABEL(mmguiapp->window->operatorvlabel), device->operatorname); gtk_label_set_label(GTK_LABEL(mmguiapp->window->operatorcodevlabel), device->operatorcode); gtk_label_set_label(GTK_LABEL(mmguiapp->window->regstatevlabel), mmgui_str_format_reg_status(device->regstatus)); /*Update current page state*/ setpage = gtk_notebook_get_current_page(GTK_NOTEBOOK(mmguiapp->window->notebook)); mmgui_main_ui_test_device_state(mmguiapp, setpage); } static void mmgui_main_info_handle_location_change(mmgui_application_t mmguiapp, mmguidevice_t device) { gchar buffer[256]; guint locationcaps; if ((mmguiapp == NULL) || (device == NULL)) return; locationcaps = mmguicore_location_get_capabilities(mmguiapp->core); if (locationcaps & MMGUI_LOCATION_CAPS_3GPP) { memset(buffer, 0, sizeof(buffer)); g_snprintf(buffer, sizeof(buffer), "%u/%u/%X/%X", device->loc3gppdata[0], device->loc3gppdata[1], device->loc3gppdata[2], device->loc3gppdata[3]); gtk_label_set_label(GTK_LABEL(mmguiapp->window->info3gpplocvlabel), buffer); } else { gtk_label_set_label(GTK_LABEL(mmguiapp->window->info3gpplocvlabel), _("Not supported")); } if (locationcaps & MMGUI_LOCATION_CAPS_GPS) { memset(buffer, 0, sizeof(buffer)); g_snprintf(buffer, sizeof(buffer), "%2.3f/%2.3f/%2.3f", device->locgpsdata[0], device->locgpsdata[1], device->locgpsdata[2]); gtk_label_set_label(GTK_LABEL(mmguiapp->window->infogpslocvlabel), buffer); } else { gtk_label_set_label(GTK_LABEL(mmguiapp->window->infogpslocvlabel), _("Not supported")); } } //USSD void mmgui_main_ussd_command_add_button_clicked_signal(GObject *object, gpointer data) { mmgui_application_t mmguiapp; GtkTreeModel *model; GtkTreeIter iter; GtkTreeViewColumn *column; GtkTreePath *path; gchar *pathstr; mmguiapp = (mmgui_application_t)data; if (mmguiapp == NULL) return; model = gtk_tree_view_get_model(GTK_TREE_VIEW(mmguiapp->window->ussdedittreeview)); if (model != NULL) { gtk_list_store_append(GTK_LIST_STORE(model), &iter); gtk_list_store_set(GTK_LIST_STORE(model), &iter, MMGUI_MAIN_USSDLIST_COMMAND, "*100#", MMGUI_MAIN_USSDLIST_DESCRIPTION, _("Sample command"), -1); pathstr = gtk_tree_model_get_string_from_iter(GTK_TREE_MODEL(model), &iter); path = gtk_tree_path_new_from_string(pathstr); column = gtk_tree_view_get_column(GTK_TREE_VIEW(mmguiapp->window->ussdedittreeview), 0); gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(mmguiapp->window->ussdedittreeview), path, 0, TRUE, 0.5, 0.0); gtk_tree_view_set_cursor(GTK_TREE_VIEW(mmguiapp->window->ussdedittreeview), path, column, TRUE); gtk_tree_path_free(path); g_free(pathstr); } } void mmgui_main_ussd_command_remove_button_clicked_signal(GObject *object, gpointer data) { mmgui_application_t mmguiapp; GtkTreeModel *model; GtkTreeSelection *selection; GtkTreeIter iter; mmguiapp = (mmgui_application_t)data; if (mmguiapp == NULL) return; model = gtk_tree_view_get_model(GTK_TREE_VIEW(mmguiapp->window->ussdedittreeview)); selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(mmguiapp->window->ussdedittreeview)); if ((model != NULL) && (selection != NULL)) { if (gtk_tree_selection_get_selected(selection, &model, &iter)) { gtk_list_store_remove(GTK_LIST_STORE(model), &iter); } } } static void mmgui_main_ussd_menu_update_callback(gchar *command, gchar *description, gboolean reencode, gpointer data) { mmgui_application_t mmguiapp; gchar commandcaption[1024]; mmguiapp = (mmgui_application_t)data; if (mmguiapp == NULL) return; if ((command != NULL) && (description != NULL)) { //Add USSD command to combo box if (mmguicore_ussd_validate_request(command) == MMGUI_USSD_VALIDATION_REQUEST) { memset(commandcaption, 0, sizeof(commandcaption)); g_snprintf(commandcaption, sizeof(commandcaption), "%s - %s", command, description); gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(mmguiapp->window->ussdcombobox), command, commandcaption); } } else if (mmguiapp->core != NULL) { //Set encoding flag for device if (reencode) { mmguicore_ussd_set_encoding(mmguiapp->core, MMGUI_USSD_ENCODING_UCS2); } else { mmguicore_ussd_set_encoding(mmguiapp->core, MMGUI_USSD_ENCODING_GSM7); } } } static void mmgui_main_ussd_list_read_callback(gchar *command, gchar *description, gboolean reencode, gpointer data) { mmgui_application_data_t mmguiappdata; GtkTreeIter iter; mmguiappdata = (mmgui_application_data_t)data; if (mmguiappdata == NULL) return; if ((mmguiappdata->mmguiapp == NULL) || (mmguiappdata->data == NULL)) return; if ((command != NULL) && (description != NULL)) { if (mmguicore_ussd_validate_request(command) == MMGUI_USSD_VALIDATION_REQUEST) { gtk_list_store_append(GTK_LIST_STORE((GtkTreeModel *)(mmguiappdata->data)), &iter); gtk_list_store_set(GTK_LIST_STORE((GtkTreeModel *)(mmguiappdata->data)), &iter, MMGUI_MAIN_USSDLIST_COMMAND, command, MMGUI_MAIN_USSDLIST_DESCRIPTION, description, -1); } } /*else if (mmguicore_devices_get_current(mmguicore) != NULL) { if (reencode) { mmguicore_ussd_set_encoding(mmguicore, MMGUI_USSD_ENCODING_UCS2); } else { mmguicore_ussd_set_encoding(mmguicore, MMGUI_USSD_ENCODING_GSM7); } }*/ else { if (reencode) { gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(mmguiappdata->mmguiapp->window->ussdencodingtoolbutton), TRUE); } else { gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(mmguiappdata->mmguiapp->window->ussdencodingtoolbutton), FALSE); } } } static gboolean mmgui_main_ussd_list_add_command_to_xml_export_foreach(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data) { gchar *command, *description; gtk_tree_model_get(model, iter, MMGUI_MAIN_USSDLIST_COMMAND, &command, MMGUI_MAIN_USSDLIST_DESCRIPTION, &description, -1); ussdlist_add_command_to_xml_export(command, description); return FALSE; } static void mmgui_main_ussd_edit(mmgui_application_t mmguiapp) { struct _mmgui_application_data mmguiappdata; GtkTreeModel *model; gint response; if (mmguiapp == NULL) return; model = gtk_tree_view_get_model(GTK_TREE_VIEW(mmguiapp->window->ussdedittreeview)); mmguiappdata.mmguiapp = mmguiapp; mmguiappdata.data = model; if (model != NULL) { //Detach model g_object_ref(model); gtk_tree_view_set_model(GTK_TREE_VIEW(mmguiapp->window->ussdedittreeview), NULL); gtk_list_store_clear(GTK_LIST_STORE(model)); //Fill model if (!ussdlist_read_commands(mmgui_main_ussd_list_read_callback, mmguicore_devices_get_identifier(mmguiapp->core), mmguicore_devices_get_internal_identifier(mmguiapp->core), &mmguiappdata)) { /*Get current USSD encoding and set button state*/ if (mmguiapp->core != NULL) { if (mmguicore_ussd_get_encoding(mmguiapp->core) == MMGUI_USSD_ENCODING_GSM7) { gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(mmguiapp->window->ussdencodingtoolbutton), FALSE); } else if (mmguicore_ussd_get_encoding(mmguiapp->core) == MMGUI_USSD_ENCODING_UCS2) { gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(mmguiapp->window->ussdencodingtoolbutton), TRUE); } } } //Attach model gtk_tree_view_set_model(GTK_TREE_VIEW(mmguiapp->window->ussdedittreeview), model); g_object_unref(model); response = gtk_dialog_run(GTK_DIALOG(mmguiapp->window->ussdeditdialog)); if (mmguicore_devices_get_current(mmguiapp->core) != NULL) { //Write commands to XML file ussdlist_start_xml_export(gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(mmguiapp->window->ussdencodingtoolbutton))); gtk_tree_model_foreach(model, mmgui_main_ussd_list_add_command_to_xml_export_foreach, NULL); ussdlist_end_xml_export(mmguicore_devices_get_identifier(mmguiapp->core)); //Update USSD menu gtk_combo_box_text_remove_all(GTK_COMBO_BOX_TEXT(mmguiapp->window->ussdcombobox)); ussdlist_read_commands(mmgui_main_ussd_menu_update_callback, mmguicore_devices_get_identifier(mmguiapp->core), mmguicore_devices_get_internal_identifier(mmguiapp->core), mmguiapp); //Update USSD reencoding flag if (gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(mmguiapp->window->ussdencodingtoolbutton))) { mmguicore_ussd_set_encoding(mmguiapp->core, MMGUI_USSD_ENCODING_UCS2); } else { mmguicore_ussd_set_encoding(mmguiapp->core, MMGUI_USSD_ENCODING_GSM7); } } gtk_widget_hide(mmguiapp->window->ussdeditdialog); } } void mmgui_main_ussd_edit_button_clicked_signal(GtkEditable *editable, gpointer data) { mmgui_application_t mmguiapp; mmguiapp = (mmgui_application_t)data; if (mmguiapp == NULL) return; mmgui_main_ussd_edit(mmguiapp); } void mmgui_main_ussd_command_combobox_changed_signal(GObject *object, gpointer data) { mmgui_application_t mmguiapp; const gchar *command; mmguiapp = (mmgui_application_t)data; if (mmguiapp == NULL) return; command = gtk_combo_box_get_active_id(GTK_COMBO_BOX(mmguiapp->window->ussdcombobox)); if (command != NULL) { gtk_entry_set_text(GTK_ENTRY(mmguiapp->window->ussdentry), command); } } void mmgui_main_ussd_command_entry_changed_signal(GtkEditable *editable, gpointer data) { const gchar *request; enum _mmgui_ussd_validation validationid; enum _mmgui_ussd_state sessionstate; mmgui_application_t mmguiapp; mmguiapp = (mmgui_application_t)data; if (mmguiapp == NULL) return; //Validate request request = gtk_entry_get_text(GTK_ENTRY(mmguiapp->window->ussdentry)); validationid = mmguicore_ussd_validate_request((gchar *)request); if (validationid == MMGUI_USSD_VALIDATION_REQUEST) { //Simple request gtk_entry_set_icon_from_stock(GTK_ENTRY(mmguiapp->window->ussdentry), GTK_ENTRY_ICON_SECONDARY, NULL); gtk_entry_set_icon_tooltip_markup(GTK_ENTRY(mmguiapp->window->ussdentry), GTK_ENTRY_ICON_SECONDARY, NULL); gtk_widget_set_sensitive(mmguiapp->window->ussdsend, TRUE); } else if (validationid == MMGUI_USSD_VALIDATION_INVALID) { //Incorrect request gtk_entry_set_icon_from_stock(GTK_ENTRY(mmguiapp->window->ussdentry), GTK_ENTRY_ICON_SECONDARY, GTK_STOCK_CAPS_LOCK_WARNING); gtk_entry_set_icon_tooltip_markup(GTK_ENTRY(mmguiapp->window->ussdentry), GTK_ENTRY_ICON_SECONDARY, _("USSD request is not valid\nRequest must be 160 symbols long\nstarted with '*' and ended with '#'")); gtk_widget_set_sensitive(mmguiapp->window->ussdsend, FALSE); } else if (validationid == MMGUI_USSD_VALIDATION_RESPONSE) { //Response sessionstate = mmguicore_ussd_get_state(mmguiapp->core); if (sessionstate == MMGUI_USSD_STATE_USER_RESPONSE) { //Response expected gtk_entry_set_icon_from_stock(GTK_ENTRY(mmguiapp->window->ussdentry), GTK_ENTRY_ICON_SECONDARY, NULL); gtk_entry_set_icon_tooltip_markup(GTK_ENTRY(mmguiapp->window->ussdentry), GTK_ENTRY_ICON_SECONDARY, NULL); gtk_widget_set_sensitive(mmguiapp->window->ussdsend, TRUE); } else { //Response not expected gtk_entry_set_icon_from_stock(GTK_ENTRY(mmguiapp->window->ussdentry), GTK_ENTRY_ICON_SECONDARY, GTK_STOCK_CAPS_LOCK_WARNING); gtk_entry_set_icon_tooltip_markup(GTK_ENTRY(mmguiapp->window->ussdentry), GTK_ENTRY_ICON_SECONDARY, _("USSD request is not valid\nRequest must be 160 symbols long\nstarted with '*' and ended with '#'")); gtk_widget_set_sensitive(mmguiapp->window->ussdsend, FALSE); } } } void mmgui_main_ussd_command_entry_activated_signal(GtkEntry *entry, gpointer data) { mmgui_application_t mmguiapp; mmguiapp = (mmgui_application_t)data; if (mmguiapp == NULL) return; mmgui_main_ussd_request_send(mmguiapp); } void mmgui_main_ussd_send_button_clicked_signal(GtkButton *button, gpointer data) { mmgui_application_t mmguiapp; mmguiapp = (mmgui_application_t)data; if (mmguiapp == NULL) return; mmgui_main_ussd_request_send(mmguiapp); } static void mmgui_main_ussd_request_send(mmgui_application_t mmguiapp) { gchar *request; enum _mmgui_ussd_validation validationid; enum _mmgui_ussd_state sessionstate; GtkTextBuffer *buffer; GtkTextIter startiter, enditer; GtkTextMark *position; if (mmguiapp == NULL) return; if (gtk_entry_get_text_length(GTK_ENTRY(mmguiapp->window->ussdentry)) == 0) return; request = (gchar *)gtk_entry_get_text(GTK_ENTRY(mmguiapp->window->ussdentry)); //Session state and request validation validationid = mmguicore_ussd_validate_request(request); sessionstate = mmguicore_ussd_get_state(mmguiapp->core); //Text view buffer buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(mmguiapp->window->ussdtext)); if (validationid != MMGUI_USSD_VALIDATION_INVALID) { if (!((validationid == MMGUI_USSD_VALIDATION_RESPONSE) && (sessionstate != MMGUI_USSD_STATE_USER_RESPONSE))) { if (mmguicore_ussd_send(mmguiapp->core, request)) { if (validationid == MMGUI_USSD_VALIDATION_REQUEST) { //save last request gmm_settings_set_string(mmguiapp->settings, "ussd_request", request); //clear text view gtk_text_buffer_get_bounds(buffer, &startiter, &enditer); gtk_text_buffer_delete(buffer, &startiter, &enditer); //add request text gtk_text_buffer_get_end_iter(buffer, &enditer); gtk_text_buffer_insert_with_tags(buffer, &enditer, request, -1, mmguiapp->window->ussdrequesttag, NULL); gtk_text_buffer_get_end_iter(buffer, &enditer); gtk_text_buffer_insert_with_tags(buffer, &enditer, "\n", -1, mmguiapp->window->ussdrequesttag, NULL); } else if (validationid == MMGUI_USSD_VALIDATION_RESPONSE) { //add response text gtk_text_buffer_get_end_iter(buffer, &enditer); gtk_text_buffer_insert_with_tags(buffer, &enditer, request, -1, mmguiapp->window->ussdrequesttag, NULL); gtk_text_buffer_get_end_iter(buffer, &enditer); gtk_text_buffer_insert_with_tags(buffer, &enditer, "\n", -1, mmguiapp->window->ussdrequesttag, NULL); } //scroll to the end of buffer position = gtk_text_buffer_create_mark(buffer, "position", &enditer, FALSE); gtk_text_view_scroll_mark_onscreen(GTK_TEXT_VIEW(mmguiapp->window->ussdtext), position); gtk_text_buffer_delete_mark(buffer, position); //show progress dialog mmgui_main_ui_progress_dialog_open(mmguiapp); } else { mmgui_main_ui_error_dialog_open(mmguiapp, _("Error sending USSD"), _("Wrong USSD request or device not ready")); } } else { mmgui_main_ui_error_dialog_open(mmguiapp, _("Error sending USSD"), _("USSD session terminated. You can send new request")); } } else { mmgui_main_ui_error_dialog_open(mmguiapp, _("Error sending USSD"), _("Wrong USSD request")); } } static void mmgui_main_ussd_request_send_end(mmgui_application_t mmguiapp, mmguicore_t mmguicore, const gchar *answer) { enum _mmgui_ussd_state sessionstate; GtkTextBuffer *buffer; GtkTextIter enditer; GtkTextMark *position; if ((mmguiapp == NULL) || (mmguicore == NULL)) return; sessionstate = mmguicore_ussd_get_state(mmguicore); buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(mmguiapp->window->ussdtext)); if (answer != NULL) { //Add answer text gtk_text_buffer_get_end_iter(buffer, &enditer); gtk_text_buffer_insert_with_tags(buffer, &enditer, answer, -1, mmguiapp->window->ussdanswertag, NULL); if (sessionstate == MMGUI_USSD_STATE_USER_RESPONSE) { //Add session hint gtk_text_buffer_get_end_iter(buffer, &enditer); gtk_text_buffer_insert_with_tags(buffer, &enditer, _("\nUSSD session is active. Waiting for your input...\n"), -1, mmguiapp->window->ussdhinttag, NULL); } else { //Add new line symbol gtk_text_buffer_get_end_iter(buffer, &enditer); gtk_text_buffer_insert_with_tags(buffer, &enditer, "\n", -1, mmguiapp->window->ussdanswertag, NULL); } //scroll to the end of buffer position = gtk_text_buffer_create_mark(buffer, "position", &enditer, FALSE); gtk_text_view_scroll_mark_onscreen(GTK_TEXT_VIEW(mmguiapp->window->ussdtext), position); gtk_text_buffer_delete_mark(buffer, position); } else { mmgui_main_ui_error_dialog_open(mmguiapp, _("Error sending USSD"), mmguicore_get_last_error(mmguiapp->core)); } } static void mmgui_main_ussd_list_command_cell_edited_signal(GtkCellRendererText *renderer, gchar *path, gchar *new_text, gpointer data) { GtkTreeIter iter; GtkTreeModel *model; mmgui_application_t mmguiapp; mmguiapp = (mmgui_application_t)data; if (mmguiapp == NULL) return; if (mmguicore_ussd_validate_request(new_text) == MMGUI_USSD_VALIDATION_REQUEST) { model = gtk_tree_view_get_model(GTK_TREE_VIEW(mmguiapp->window->ussdedittreeview)); if (gtk_tree_model_get_iter_from_string(model, &iter, path)) { gtk_list_store_set(GTK_LIST_STORE(model), &iter, MMGUI_MAIN_USSDLIST_COMMAND, new_text, -1); } } } static void mmgui_main_ussd_list_description_cell_edited_signal(GtkCellRendererText *renderer, gchar *path, gchar *new_text, gpointer data) { GtkTreeIter iter; GtkTreeModel *model; mmgui_application_t mmguiapp; mmguiapp = (mmgui_application_t)data; if (mmguiapp == NULL) return; if (g_ascii_strcasecmp(new_text, "") != 0) { model = gtk_tree_view_get_model(GTK_TREE_VIEW(mmguiapp->window->ussdedittreeview)); if (gtk_tree_model_get_iter_from_string(model, &iter, path)) { gtk_list_store_set(GTK_LIST_STORE(model), &iter, MMGUI_MAIN_USSDLIST_DESCRIPTION, new_text, -1); } } } static void mmgui_main_ussd_list_init(mmgui_application_t mmguiapp) { GtkCellRenderer *renderer; GtkTreeViewColumn *column; GtkListStore *store; if (mmguiapp == NULL) return; renderer = gtk_cell_renderer_text_new(); g_object_set (renderer, "editable", TRUE, "editable-set", TRUE, NULL); column = gtk_tree_view_column_new_with_attributes(_("Command"), renderer, "text", MMGUI_MAIN_USSDLIST_COMMAND, NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(mmguiapp->window->ussdedittreeview), column); g_signal_connect(G_OBJECT(renderer), "edited", G_CALLBACK(mmgui_main_ussd_list_command_cell_edited_signal), mmguiapp); renderer = gtk_cell_renderer_text_new(); g_object_set(renderer, "editable", TRUE, "editable-set", TRUE, "ellipsize", PANGO_ELLIPSIZE_END, "ellipsize-set", TRUE, NULL); column = gtk_tree_view_column_new_with_attributes(_("Description"), renderer, "text", MMGUI_MAIN_USSDLIST_DESCRIPTION, NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(mmguiapp->window->ussdedittreeview), column); g_signal_connect(G_OBJECT(renderer), "edited", G_CALLBACK(mmgui_main_ussd_list_description_cell_edited_signal), mmguiapp); store = gtk_list_store_new(MMGUI_MAIN_USSDLIST_COLUMNS, G_TYPE_STRING, G_TYPE_STRING); gtk_tree_view_set_model(GTK_TREE_VIEW(mmguiapp->window->ussdedittreeview), GTK_TREE_MODEL(store)); g_object_unref(store); } //SMS static void mmgui_main_sms_get_message_list_hash_destroy_notify(gpointer data) { //Free unique sender name hash table entries if (data != NULL) g_free(data); } static gboolean mmgui_main_sms_get_message_list_from_thread(gpointer data) { mmgui_application_data_t mmguiappdata; GSList *messages, *iterator; mmgui_sms_message_t message; guint nummessages, addedsender; gchar *notifycaption, *currentsender; GHashTable *sendernames; GHashTableIter sendernamesiter; gpointer sendernameskey, sendernamesvalue; GString *senderunames; enum _mmgui_notifications_sound soundmode; mmguiappdata = (mmgui_application_data_t)data; if (mmguiappdata == NULL) return FALSE; messages = mmguicore_sms_enum(mmguiappdata->mmguiapp->core, (gboolean)GPOINTER_TO_UINT(mmguiappdata->data)); if (messages == NULL) return FALSE; //No new messages available yet nummessages = 0; //Hash table for unique sender names sendernames = g_hash_table_new_full(g_str_hash, g_str_equal, mmgui_main_sms_get_message_list_hash_destroy_notify, NULL); for (iterator=messages; iterator; iterator=iterator->next) { message = iterator->data; if (!mmgui_smsdb_message_get_read(message)) { //Add message to database mmgui_smsdb_add_sms(mmguicore_devices_get_sms_db(mmguiappdata->mmguiapp->core), message); //Add message to list mmgui_main_sms_add_to_list(mmguiappdata->mmguiapp, message, NULL); //Add unique sender name into hash table if (g_hash_table_lookup(sendernames, message->number) == NULL) { currentsender = g_strdup(mmgui_smsdb_message_get_number(message)); g_hash_table_insert(sendernames, currentsender, currentsender); } //New message received nummessages++; } //Delete message mmguicore_sms_delete(mmguiappdata->mmguiapp->core, mmgui_smsdb_message_get_identifier(message)); //Free message mmgui_smsdb_message_free(message); } //Free list g_slist_free(messages); //Form notification caption based on messages count if (nummessages > 1) { notifycaption = g_strdup_printf(_("Received %u new SMS messages"), nummessages); } else { notifycaption = g_strdup(_("Received new SMS message")); } //Form list of unique senders for message text senderunames = g_string_new(_("Message senders: ")); //Number of unique messages addedsender = 0; //Iterate through hash table g_hash_table_iter_init(&sendernamesiter, sendernames); while (g_hash_table_iter_next(&sendernamesiter, &sendernameskey, &sendernamesvalue)) { if (addedsender == 0) { g_string_append_printf(senderunames, " %s", (gchar *)sendernameskey); } else { g_string_append_printf(senderunames, ", %s", (gchar *)sendernameskey); } addedsender++; } senderunames = g_string_append_c(senderunames, '.'); //Show notification/play sound if (mmguiappdata->mmguiapp->options->usesounds) { soundmode = MMGUI_NOTIFICATIONS_SOUND_MESSAGE; } else { soundmode = MMGUI_NOTIFICATIONS_SOUND_NONE; } /*Ayatana menu*/ mmgui_ayatana_set_unread_messages_number(mmguiappdata->mmguiapp->ayatana, mmgui_smsdb_get_unread_messages(mmguicore_devices_get_sms_db(mmguiappdata->mmguiapp->core))); /*Notification*/ mmgui_notifications_show(mmguiappdata->mmguiapp->notifications, notifycaption, senderunames->str, soundmode); //Free resources g_free(notifycaption); g_hash_table_destroy(sendernames); g_string_free(senderunames, TRUE); g_free(mmguiappdata); return FALSE; } static gboolean mmgui_main_sms_get_message_from_thread(gpointer data) { mmgui_application_data_t mmguiappdata; guint messageid; mmgui_sms_message_t message; gchar *notifycaption, *notifytext; enum _mmgui_notifications_sound soundmode; mmguiappdata = (mmgui_application_data_t)data; if (mmguiappdata == NULL) return FALSE; messageid = GPOINTER_TO_UINT(mmguiappdata->data); message = mmguicore_sms_get(mmguiappdata->mmguiapp->core, messageid); if (message == NULL) return FALSE; //Add message to database mmgui_smsdb_add_sms(mmguicore_devices_get_sms_db(mmguiappdata->mmguiapp->core), message); //Add message to list mmgui_main_sms_add_to_list(mmguiappdata->mmguiapp, message, NULL); mmguicore_sms_delete(mmguiappdata->mmguiapp->core, mmgui_smsdb_message_get_identifier(message)); //Form notification notifycaption = g_strdup(_("Received new SMS message")); notifytext = g_strdup_printf("%s: %s", mmgui_smsdb_message_get_number(message), mmgui_smsdb_message_get_text(message)); //Free message mmgui_smsdb_message_free(message); //Show notification/play sound if (mmguiappdata->mmguiapp->options->usesounds) { soundmode = MMGUI_NOTIFICATIONS_SOUND_MESSAGE; } else { soundmode = MMGUI_NOTIFICATIONS_SOUND_NONE; } /*Ayatana menu*/ mmgui_ayatana_set_unread_messages_number(mmguiappdata->mmguiapp->ayatana, mmgui_smsdb_get_unread_messages(mmguicore_devices_get_sms_db(mmguiappdata->mmguiapp->core))); /*Notification*/ mmgui_notifications_show(mmguiappdata->mmguiapp->notifications, notifycaption, notifytext, soundmode); //Free resources g_free(notifycaption); g_free(notifytext); g_free(mmguiappdata); return FALSE; } static void mmgui_main_sms_new_dialog_number_changed_signal(GtkEditable *editable, gpointer data) { mmgui_application_data_t appdata; const gchar *number; GtkTextBuffer *buffer; gboolean newnumvalid; gint bufferchars; gint *smsvalidflags; gint newsmsvalidflags; appdata = (mmgui_application_data_t)data; if (appdata == NULL) return; number = gtk_entry_get_text(GTK_ENTRY(appdata->mmguiapp->window->smsnumberentry)); buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(appdata->mmguiapp->window->smstextview)); smsvalidflags = (gint *)appdata->data; //Validate SMS number newnumvalid = mmguicore_sms_validate_number(number); if (buffer != NULL) { bufferchars = gtk_text_buffer_get_char_count(buffer); } else { bufferchars = 0; } newsmsvalidflags = MMGUI_MAIN_NEW_SMS_VALIDATION_VALID; if (!newnumvalid) newsmsvalidflags &= MMGUI_MAIN_NEW_SMS_VALIDATION_WRONG_NUMBER; if (bufferchars == 0) newsmsvalidflags &= MMGUI_MAIN_NEW_SMS_VALIDATION_WRONG_TEXT; if (((!newnumvalid) || (bufferchars == 0)) && ((*smsvalidflags == MMGUI_MAIN_NEW_SMS_VALIDATION_VALID) || (*smsvalidflags != newsmsvalidflags))) { gtk_entry_set_icon_from_stock(GTK_ENTRY(appdata->mmguiapp->window->smsnumberentry), GTK_ENTRY_ICON_SECONDARY, GTK_STOCK_CAPS_LOCK_WARNING); if (!newnumvalid) { gtk_entry_set_icon_tooltip_markup(GTK_ENTRY(appdata->mmguiapp->window->smsnumberentry), GTK_ENTRY_ICON_SECONDARY, _("SMS number is not valid\nOnly numbers from 2 to 20 digits without\nletters and symbols can be used")); } else if (bufferchars == 0) { gtk_entry_set_icon_tooltip_markup(GTK_ENTRY(appdata->mmguiapp->window->smsnumberentry), GTK_ENTRY_ICON_SECONDARY, _("SMS text is not valid\nPlease write some text to send")); } gtk_widget_set_sensitive(appdata->mmguiapp->window->sendsmsbutton, FALSE); gtk_widget_set_sensitive(appdata->mmguiapp->window->savesmsbutton, FALSE); *smsvalidflags = newsmsvalidflags; } else if ((newnumvalid) && (bufferchars > 0)) { gtk_entry_set_icon_from_stock(GTK_ENTRY(appdata->mmguiapp->window->smsnumberentry), GTK_ENTRY_ICON_SECONDARY, NULL); gtk_entry_set_icon_tooltip_markup(GTK_ENTRY(appdata->mmguiapp->window->smsnumberentry), GTK_ENTRY_ICON_SECONDARY, NULL); gtk_widget_set_sensitive(appdata->mmguiapp->window->sendsmsbutton, TRUE); gtk_widget_set_sensitive(appdata->mmguiapp->window->savesmsbutton, TRUE); *smsvalidflags = newsmsvalidflags; } } static enum _mmgui_main_new_sms_dialog_result mmgui_main_sms_new_dialog(mmgui_application_t mmguiapp, const gchar *number, const gchar *text) { struct _mmgui_application_data appdata; GtkTextBuffer *buffer; gint response; gulong editnumsignal, edittextsignal; gint smsvalidflags; enum _mmgui_main_new_sms_dialog_result result; if (mmguiapp == NULL) return; smsvalidflags = MMGUI_MAIN_NEW_SMS_VALIDATION_VALID; appdata.mmguiapp = mmguiapp; appdata.data = &smsvalidflags; editnumsignal = g_signal_connect(G_OBJECT(mmguiapp->window->smsnumberentry), "changed", G_CALLBACK(mmgui_main_sms_new_dialog_number_changed_signal), &appdata); if (number != NULL) { gtk_entry_set_text(GTK_ENTRY(mmguiapp->window->smsnumberentry), number); g_signal_emit_by_name(G_OBJECT(mmguiapp->window->smsnumberentry), "changed"); } buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(mmguiapp->window->smstextview)); if (buffer != NULL) { edittextsignal = g_signal_connect(G_OBJECT(buffer), "changed", G_CALLBACK(mmgui_main_sms_new_dialog_number_changed_signal), &appdata); if (text != NULL) { gtk_text_buffer_set_text(buffer, text, -1); g_signal_emit_by_name(G_OBJECT(buffer), "changed"); } } response = gtk_dialog_run(GTK_DIALOG(mmguiapp->window->newsmsdialog)); g_signal_handler_disconnect(G_OBJECT(mmguiapp->window->smsnumberentry), editnumsignal); if (buffer != NULL) { g_signal_handler_disconnect(G_OBJECT(buffer), edittextsignal); } gtk_widget_hide(mmguiapp->window->newsmsdialog); switch (response) { case 0: result = MMGUI_MAIN_NEW_SMS_DIALOG_CLOSE; break; case 1: result = MMGUI_MAIN_NEW_SMS_DIALOG_SEND; break; case 2: result = MMGUI_MAIN_NEW_SMS_DIALOG_SAVE; break; default: result = MMGUI_MAIN_NEW_SMS_DIALOG_CLOSE; break; } return result; } static gboolean mmgui_main_sms_send(mmgui_application_t mmguiapp, const gchar *number, const gchar *text) { GtkTextBuffer *buffer; GtkTextIter start, end; gchar *resnumber, *restext; enum _mmgui_main_new_sms_dialog_result result; mmgui_sms_message_t message; if ((mmguiapp == NULL) || (number == NULL) || (text == NULL)) return FALSE; buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(mmguiapp->window->smstextview)); if (buffer == NULL) return FALSE; //Open dialog for user interaction result = mmgui_main_sms_new_dialog(mmguiapp, number, text); if ((result == MMGUI_MAIN_NEW_SMS_DIALOG_SEND) || (result == MMGUI_MAIN_NEW_SMS_DIALOG_SAVE)) { //Get final message number and text resnumber = (gchar *)gtk_entry_get_text(GTK_ENTRY(mmguiapp->window->smsnumberentry)); gtk_text_buffer_get_bounds(buffer, &start, &end); restext = gtk_text_buffer_get_text(buffer, &start, &end, FALSE); //Send message if (result == MMGUI_MAIN_NEW_SMS_DIALOG_SEND) { if (mmguicore_sms_send(mmguiapp->core, resnumber, restext)) { //Form message message = mmgui_smsdb_message_create(); mmgui_smsdb_message_set_number(message, resnumber); mmgui_smsdb_message_set_text(message, restext, FALSE); mmgui_smsdb_message_set_read(message, TRUE); mmgui_smsdb_message_set_folder(message, MMGUI_SMSDB_SMS_FOLDER_SENT); //Add message to database mmgui_smsdb_add_sms(mmguicore_devices_get_sms_db(mmguiapp->core), message); //Add message to list mmgui_main_sms_add_to_list(mmguiapp, message, NULL); //Free message mmgui_smsdb_message_free(message); //Save last number gmm_settings_set_string(mmguiapp->settings, "sms_number", resnumber); //Start progress dialog mmgui_main_ui_progress_dialog_open(mmguiapp); return TRUE; } else { mmgui_main_ui_error_dialog_open(mmguiapp, _("Error sending message"), _("Wrong number or device not ready")); return FALSE; } //Save message } else if (result == MMGUI_MAIN_NEW_SMS_DIALOG_SAVE) { //Form message message = mmgui_smsdb_message_create(); mmgui_smsdb_message_set_number(message, resnumber); mmgui_smsdb_message_set_text(message, restext, FALSE); mmgui_smsdb_message_set_read(message, TRUE); mmgui_smsdb_message_set_folder(message, MMGUI_SMSDB_SMS_FOLDER_DRAFTS); //Add message to database mmgui_smsdb_add_sms(mmguicore_devices_get_sms_db(mmguiapp->core), message); //Add message to list mmgui_main_sms_add_to_list(mmguiapp, message, NULL); //Free message mmgui_smsdb_message_free(message); //Save last number gmm_settings_set_string(mmguiapp->settings, "sms_number", resnumber); return TRUE; } } return FALSE; } static void mmgui_main_sms_remove(mmgui_application_t mmguiapp) { GtkTreeModel *model; GtkTreeSelection *selection; GtkTreeIter iter; gulong id; gboolean valid; gboolean isfolder; if (mmguiapp == NULL) return; if (mmguicore_devices_get_current(mmguiapp->core) == NULL) return; model = gtk_tree_view_get_model(GTK_TREE_VIEW(mmguiapp->window->smslist)); selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(mmguiapp->window->smslist)); if ((model != NULL) && (selection != NULL)) { if (gtk_tree_selection_get_selected(selection, &model, &iter)) { gtk_tree_model_get(model, &iter, MMGUI_MAIN_SMSLIST_ID, &id, MMGUI_MAIN_SMSLIST_ISFOLDER, &isfolder, -1); if (!isfolder) { if (mmgui_main_ui_question_dialog_open(mmguiapp, _("Remove message"), _("Really want to remove message?"))) { if (mmgui_smsdb_remove_sms_message(mmguicore_devices_get_sms_db(mmguiapp->core), id)) { gtk_tree_store_remove(GTK_TREE_STORE(model), &iter); /*Ayatana menu*/ mmgui_ayatana_set_unread_messages_number(mmguiapp->ayatana, mmgui_smsdb_get_unread_messages(mmguicore_devices_get_sms_db(mmguiapp->core))); } else { mmgui_main_ui_error_dialog_open(mmguiapp, _("Error removing SMS"), _("Message not found")); } } } } else { mmgui_main_ui_error_dialog_open(mmguiapp, _("Error removing SMS"), _("Message not selected")); } } } void mmgui_main_sms_remove_button_clicked_signal(GObject *object, gpointer data) { mmgui_application_t mmguiapp; mmguiapp = (mmgui_application_t)data; if (mmguiapp == NULL) return; mmgui_main_sms_remove(mmguiapp); } static void mmgui_main_sms_new(mmgui_application_t mmguiapp) { gchar *oldnumber; guint smscaps; if (mmguiapp == NULL) return; if (mmguicore_devices_get_current(mmguiapp->core) == NULL) return; smscaps = mmguicore_sms_get_capabilities(mmguiapp->core); if (smscaps & MMGUI_SMS_CAPS_SEND) { //Saved number oldnumber = gmm_settings_get_string(mmguiapp->settings, "sms_number", "8888"); //Send message mmgui_main_sms_send(mmguiapp, oldnumber, ""); //Free resources g_free(oldnumber); } } void mmgui_main_sms_new_button_clicked_signal(GObject *object, gpointer data) { mmgui_application_t mmguiapp; mmguiapp = (mmgui_application_t)data; if (mmguiapp == NULL) return; mmgui_main_sms_new(mmguiapp); } static void mmgui_main_sms_answer(mmgui_application_t mmguiapp) { GtkTreeModel *model; GtkTreeSelection *selection; GtkTreeIter iter; guint smscaps; gulong id; guint folder; gboolean isfolder; mmgui_sms_message_t message; if (mmguiapp == NULL) return; if (mmguicore_devices_get_current(mmguiapp->core) == NULL) return; model = gtk_tree_view_get_model(GTK_TREE_VIEW(mmguiapp->window->smslist)); selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(mmguiapp->window->smslist)); smscaps = mmguicore_sms_get_capabilities(mmguiapp->core); if ((model != NULL) && (selection != NULL)) { //Get selected message if (gtk_tree_selection_get_selected(selection, &model, &iter)) { gtk_tree_model_get(model, &iter, MMGUI_MAIN_SMSLIST_ID, &id, MMGUI_MAIN_SMSLIST_FOLDER, &folder, MMGUI_MAIN_SMSLIST_ISFOLDER, &isfolder, -1); if (!isfolder) { message = mmgui_smsdb_read_sms_message(mmguicore_devices_get_sms_db(mmguiapp->core), id); if (message != NULL) { //Open dialog if (mmguicore_sms_validate_number(mmgui_smsdb_message_get_number(message)) && (smscaps & MMGUI_SMS_CAPS_SEND)) { if (folder == MMGUI_SMSDB_SMS_FOLDER_DRAFTS) { mmgui_main_sms_send(mmguiapp, mmgui_smsdb_message_get_number(message), mmgui_smsdb_message_get_text(message)); } else { mmgui_main_sms_send(mmguiapp, mmgui_smsdb_message_get_number(message), ""); } } //Free message mmgui_smsdb_message_free(message); } } } } } void mmgui_main_sms_answer_button_clicked_signal(GObject *object, gpointer data) { mmgui_application_t mmguiapp; mmguiapp = (mmgui_application_t)data; if (mmguiapp == NULL) return; mmgui_main_sms_answer(mmguiapp); } static void mmgui_main_sms_list_cursor_changed_signal(GtkTreeView *tree_view, gpointer data) { mmgui_application_t mmguiapp; guint smscaps; GtkTreeModel *model; GtkTreeSelection *selection; GtkTextBuffer *buffer; GtkTreeIter iter; GtkTextIter siter, eiter; gulong id; guint folder; gboolean isfolder; mmgui_sms_message_t sms; mmguiapp = (mmgui_application_t)data; if (mmguiapp == NULL) return; smscaps = mmguicore_sms_get_capabilities(mmguiapp->core); model = gtk_tree_view_get_model(tree_view); selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree_view)); buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(mmguiapp->window->smstext)); if (mmguicore_devices_get_current(mmguiapp->core) != NULL) { if ((model != NULL) && (buffer != NULL)) { if (gtk_tree_selection_get_selected(selection, &model, &iter)) { gtk_tree_model_get(model, &iter, MMGUI_MAIN_SMSLIST_ID, &id, MMGUI_MAIN_SMSLIST_FOLDER, &folder, MMGUI_MAIN_SMSLIST_ISFOLDER, &isfolder, -1); if (!isfolder) { sms = mmgui_smsdb_read_sms_message(mmguicore_devices_get_sms_db(mmguiapp->core), id); if (sms != NULL) { //Show message text gtk_text_buffer_set_text(buffer, mmgui_smsdb_message_get_text(sms), -1); //Enable Answer button if needed if (mmguicore_sms_validate_number(mmgui_smsdb_message_get_number(sms)) && (smscaps & MMGUI_SMS_CAPS_SEND)) { gtk_widget_set_sensitive(mmguiapp->window->answersmsbutton, TRUE); } else { gtk_widget_set_sensitive(mmguiapp->window->answersmsbutton, FALSE); } gtk_widget_set_sensitive(mmguiapp->window->removesmsbutton, TRUE); //Set read flag if not set before if (!mmgui_smsdb_message_get_read(sms)) { if (mmgui_smsdb_set_message_read_status(mmguicore_devices_get_sms_db(mmguiapp->core), id, TRUE)) { gtk_tree_store_set(GTK_TREE_STORE(model), &iter, MMGUI_MAIN_SMSLIST_ICON, mmguiapp->window->smsreadicon, -1); } /*Ayatana menu*/ mmgui_ayatana_set_unread_messages_number(mmguiapp->ayatana, mmgui_smsdb_get_unread_messages(mmguicore_devices_get_sms_db(mmguiapp->core))); } //Free SMS message mmgui_smsdb_message_free(sms); } else { //Cant read message gtk_widget_set_sensitive(mmguiapp->window->answersmsbutton, FALSE); gtk_text_buffer_set_text(buffer, _("This message can't be read"), -1); } } else { //Folder selected switch (folder) { case MMGUI_SMSDB_SMS_FOLDER_INCOMING: gtk_text_buffer_set_text(buffer, _("This is folder for your incoming SMS messages.\nYou can answer selected message using 'Answer' button."), -1); break; case MMGUI_SMSDB_SMS_FOLDER_SENT: gtk_text_buffer_set_text(buffer, _("This is folder for your sent SMS messages."), -1); break; case MMGUI_SMSDB_SMS_FOLDER_DRAFTS: gtk_text_buffer_set_text(buffer, _("This is folder for your SMS message drafts.\nSelect message and click 'Answer' button to start editing."), -1); break; default: break; } gtk_widget_set_sensitive(mmguiapp->window->removesmsbutton, FALSE); gtk_widget_set_sensitive(mmguiapp->window->answersmsbutton, FALSE); } } } } } static void mmgui_main_sms_add_to_list(mmgui_application_t mmguiapp, mmgui_sms_message_t sms, GtkTreeModel *model) { GtkTreeIter iter, child; time_t timestamp; gchar *markup; struct tm *tmptime; gchar timestr[200]; GdkPixbuf *icon; guint folder; if ((mmguiapp == NULL) || (sms == NULL)) return; if (model == NULL) { model = gtk_tree_view_get_model(GTK_TREE_VIEW(mmguiapp->window->smslist)); } timestamp = mmgui_smsdb_message_get_timestamp(sms); tmptime = localtime(×tamp); if (strftime(timestr, sizeof(timestr), "%T %D", tmptime) == 0) { g_snprintf(timestr, sizeof(timestr), _("Unknown")); } markup = g_strdup_printf(_("%s\n%s"), mmgui_smsdb_message_get_number(sms), timestr); if (mmgui_smsdb_message_get_read(sms)) { icon = mmguiapp->window->smsreadicon; } else { icon = mmguiapp->window->smsunreadicon; } switch (mmgui_smsdb_message_get_folder(sms)) { case MMGUI_SMSDB_SMS_FOLDER_INCOMING: folder = MMGUI_SMSDB_SMS_FOLDER_INCOMING; gtk_tree_model_get_iter(model, &iter, mmguiapp->window->incomingpath); break; case MMGUI_SMSDB_SMS_FOLDER_SENT: folder = MMGUI_SMSDB_SMS_FOLDER_SENT; gtk_tree_model_get_iter(model, &iter, mmguiapp->window->sentpath); break; case MMGUI_SMSDB_SMS_FOLDER_DRAFTS: folder = MMGUI_SMSDB_SMS_FOLDER_DRAFTS; gtk_tree_model_get_iter(model, &iter, mmguiapp->window->draftspath); break; default: folder = MMGUI_SMSDB_SMS_FOLDER_INCOMING; gtk_tree_model_get_iter(model, &iter, mmguiapp->window->incomingpath); break; } //Place new message on top or append to list if (mmguiapp->options->smsoldontop) { gtk_tree_store_append(GTK_TREE_STORE(model), &child, &iter); } else { gtk_tree_store_insert(GTK_TREE_STORE(model), &child, &iter, 0); } gtk_tree_store_set(GTK_TREE_STORE(model), &child, MMGUI_MAIN_SMSLIST_ICON, icon, MMGUI_MAIN_SMSLIST_SMS, markup, MMGUI_MAIN_SMSLIST_ID, mmgui_smsdb_message_get_db_identifier(sms), MMGUI_MAIN_SMSLIST_FOLDER, folder, MMGUI_MAIN_SMSLIST_ISFOLDER, FALSE, -1); g_free(markup); } static gboolean mmgui_main_sms_list_fill(mmgui_application_t mmguiapp) { GSList *smslist; GtkTreeModel *model; GtkTreeIter iter; gint i; GdkPixbuf *foldericon; gboolean foldericonused; GSList *iterator; mmgui_application_data_t appdata; gchar *foldercomments[3] = {_("Incoming\nIncoming messages"), _("Sent\nSent messages"), _("Drafts\nMessage drafts")}; const guint folderids[3] = {MMGUI_SMSDB_SMS_FOLDER_INCOMING, MMGUI_SMSDB_SMS_FOLDER_SENT, MMGUI_SMSDB_SMS_FOLDER_DRAFTS}; GtkTreePath **folderpath[3] = {&mmguiapp->window->incomingpath, &mmguiapp->window->sentpath, &mmguiapp->window->draftspath}; const gchar *foldericonfile[3] = {RESOURCE_MESSAGE_RECIEVED, RESOURCE_MESSAGE_SENT, RESOURCE_MESSAGE_DRAFTS}; if (mmguiapp == NULL) return FALSE; if (mmguicore_devices_get_current(mmguiapp->core) != NULL) { smslist = mmgui_smsdb_read_sms_list(mmguicore_devices_get_sms_db(mmguiapp->core)); model = gtk_tree_view_get_model(GTK_TREE_VIEW(mmguiapp->window->smslist)); if (model != NULL) { g_object_ref(model); gtk_tree_view_set_model(GTK_TREE_VIEW(mmguiapp->window->smslist), NULL); gtk_tree_store_clear(GTK_TREE_STORE(model)); for (i=0; i<3; i++) { foldericon = gdk_pixbuf_new_from_file(foldericonfile[i], NULL); if (foldericon != NULL) { foldericonused = TRUE; } else { foldericon = mmguiapp->window->smsunreadicon; foldericonused = FALSE; } gtk_tree_store_append(GTK_TREE_STORE(model), &iter, NULL); gtk_tree_store_set(GTK_TREE_STORE(model), &iter, MMGUI_MAIN_SMSLIST_ICON, foldericon, MMGUI_MAIN_SMSLIST_SMS, foldercomments[i], MMGUI_MAIN_SMSLIST_ID, 0, MMGUI_MAIN_SMSLIST_FOLDER, folderids[i], MMGUI_MAIN_SMSLIST_ISFOLDER, TRUE, -1); *(folderpath[i]) = gtk_tree_model_get_path(model, &iter); if (foldericonused) { g_object_unref(foldericon); } } if (smslist != NULL) { for (iterator=smslist; iterator; iterator=iterator->next) { mmgui_main_sms_add_to_list(mmguiapp, (mmgui_sms_message_t)iterator->data, model); } } gtk_tree_view_set_model(GTK_TREE_VIEW(mmguiapp->window->smslist), model); g_object_unref(model); if (mmguiapp->options->smsexpandfolders) { gtk_tree_view_expand_all(GTK_TREE_VIEW(mmguiapp->window->smslist)); } } //Free resources if (smslist != NULL) { mmgui_smsdb_message_free_list(smslist); } //Get new messages from modem appdata = g_new0(struct _mmgui_application_data, 1); appdata->mmguiapp = mmguiapp; appdata->data = GUINT_TO_POINTER(mmguiapp->options->concatsms); g_idle_add(mmgui_main_sms_get_message_list_from_thread, appdata); } } static void mmgui_main_sms_list_init(mmgui_application_t mmguiapp) { GtkCellRenderer *renderer; GtkTreeViewColumn *column; GtkTreeStore *store; if (mmguiapp == NULL) return; column = gtk_tree_view_column_new(); gtk_tree_view_column_set_title(column, _("SMS")); renderer = gtk_cell_renderer_pixbuf_new(); gtk_tree_view_column_pack_start(column, renderer, FALSE); gtk_tree_view_column_set_attributes(column, renderer, "pixbuf", MMGUI_MAIN_SMSLIST_ICON, NULL); renderer = gtk_cell_renderer_text_new(); g_object_set(renderer, "ellipsize", PANGO_ELLIPSIZE_END, "ellipsize-set", TRUE, NULL); gtk_tree_view_column_pack_start(column, renderer, TRUE); gtk_tree_view_column_set_attributes(column, renderer, "markup", MMGUI_MAIN_SMSLIST_SMS, NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(mmguiapp->window->smslist), column); store = gtk_tree_store_new(MMGUI_MAIN_SMSLIST_COLUMNS, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_ULONG, G_TYPE_UINT, G_TYPE_BOOLEAN); gtk_tree_view_set_model(GTK_TREE_VIEW(mmguiapp->window->smslist), GTK_TREE_MODEL(store)); g_object_unref(store); g_signal_connect(G_OBJECT(mmguiapp->window->smslist), "cursor-changed", G_CALLBACK(mmgui_main_sms_list_cursor_changed_signal), mmguiapp); } //Devices static void mmgui_main_device_handle_enabled_local_status(mmgui_application_t mmguiapp, gboolean result) { guint setpage; gboolean enabled; if (mmguiapp == NULL) return; mmgui_main_ui_progress_dialog_close(mmguiapp); if (result) { enabled = mmguicore_devices_get_enabled(mmguiapp->core); if (enabled) { /*Update device information*/ mmgui_main_info_update_for_device(mmguiapp); } /*Update current page state*/ setpage = gtk_notebook_get_current_page(GTK_NOTEBOOK(mmguiapp->window->notebook)); mmgui_main_ui_test_device_state(mmguiapp, setpage); } else { /*In case of error*/ mmgui_main_ui_error_dialog_open(mmguiapp, _("Error enabling device"), mmguicore_get_last_error(mmguiapp->core)); } } static gboolean mmgui_main_device_handle_enabled_status_from_thread(gpointer data) { mmgui_application_data_t mmguiappdata; gboolean enabledstatus; guint setpage; mmguiappdata = (mmgui_application_data_t)data; if (mmguiappdata == NULL) return FALSE; enabledstatus = (gboolean)GPOINTER_TO_UINT(mmguiappdata->data); if (mmguiappdata->mmguiapp == NULL) return FALSE; if (enabledstatus) { //Update device information mmgui_main_info_update_for_device(mmguiappdata->mmguiapp); } /*Update current page state*/ setpage = gtk_notebook_get_current_page(GTK_NOTEBOOK(mmguiappdata->mmguiapp->window->notebook)); mmgui_main_ui_test_device_state(mmguiappdata->mmguiapp, setpage); g_free(mmguiappdata); return FALSE; } static gboolean mmgui_main_device_handle_blocked_status_from_thread(gpointer data) { mmgui_application_data_t mmguiappdata; gboolean blockedstatus; guint setpage; mmguiappdata = (mmgui_application_data_t)data; if (mmguiappdata == NULL) return FALSE; blockedstatus = (gboolean)GPOINTER_TO_UINT(mmguiappdata->data); if (mmguiappdata->mmguiapp == NULL) return FALSE; /*Update current page state*/ setpage = gtk_notebook_get_current_page(GTK_NOTEBOOK(mmguiappdata->mmguiapp->window->notebook)); mmgui_main_ui_test_device_state(mmguiappdata->mmguiapp, setpage); g_free(mmguiappdata); return FALSE; } static gboolean mmgui_main_device_handle_connection_status_from_thread(gpointer data) { mmgui_application_data_t mmguiappdata; gboolean connstatus; guint setpage; mmguiappdata = (mmgui_application_data_t)data; if (mmguiappdata == NULL) return FALSE; connstatus = (gboolean)GPOINTER_TO_UINT(mmguiappdata->data); if (mmguiappdata->mmguiapp == NULL) return FALSE; /*Update current page state*/ setpage = gtk_notebook_get_current_page(GTK_NOTEBOOK(mmguiappdata->mmguiapp->window->notebook)); mmgui_main_ui_test_device_state(mmguiappdata->mmguiapp, setpage); g_free(mmguiappdata); return FALSE; } static void mmgui_main_device_clear_data(mmgui_application_t mmguiapp) { GtkTreeModel *model; GtkTextBuffer *buffer; GtkTextIter siter, eiter; GtkTreeIter catiter, contiter; GtkTreePath *refpath; GtkTreeRowReference *reference; GSList *reflist, *iterator; gboolean validcat, validcont; guint contacttype, numcontacts; const gchar *pathstr; guint pagecaps; if (mmguiapp == NULL) return; //Clear SMS list model = gtk_tree_view_get_model(GTK_TREE_VIEW(mmguiapp->window->smslist)); if (model != NULL) { gtk_tree_store_clear(GTK_TREE_STORE(model)); } //Clear SMS text field buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(mmguiapp->window->smstext)); if (buffer != NULL) { gtk_text_buffer_get_bounds(buffer, &siter, &eiter); gtk_text_buffer_delete(buffer, &siter, &eiter); } //Set sensitivity of SMS control buttons gtk_widget_set_sensitive(mmguiapp->window->removesmsbutton, FALSE); gtk_widget_set_sensitive(mmguiapp->window->answersmsbutton, FALSE); //Clear USSD text fiels buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(mmguiapp->window->ussdtext)); if (buffer != NULL) { gtk_text_buffer_get_bounds(buffer, &siter, &eiter); gtk_text_buffer_delete(buffer, &siter, &eiter); } //Clear INFO data gtk_label_set_text(GTK_LABEL(mmguiapp->window->devicevlabel), ""); gtk_label_set_text(GTK_LABEL(mmguiapp->window->operatorvlabel), ""); gtk_label_set_text(GTK_LABEL(mmguiapp->window->modevlabel), ""); gtk_label_set_text(GTK_LABEL(mmguiapp->window->imeivlabel), ""); gtk_label_set_text(GTK_LABEL(mmguiapp->window->imsivlabel), ""); gtk_label_set_text(GTK_LABEL(mmguiapp->window->info3gpplocvlabel), ""); gtk_label_set_text(GTK_LABEL(mmguiapp->window->infogpslocvlabel), ""); gtk_progress_bar_set_text(GTK_PROGRESS_BAR(mmguiapp->window->signallevelprogressbar), ""); gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(mmguiapp->window->signallevelprogressbar), 0.0); //Clear scanned networks model = gtk_tree_view_get_model(GTK_TREE_VIEW(mmguiapp->window->scanlist)); if (model != NULL) { gtk_list_store_clear(GTK_LIST_STORE(model)); } //Clear contacts list if (mmguiapp->window->contmodempath != NULL) { pathstr = gtk_tree_path_to_string(mmguiapp->window->contmodempath); if (pathstr != NULL) { model = gtk_tree_view_get_model(GTK_TREE_VIEW(mmguiapp->window->contactstreeview)); if (model != NULL) { reflist = NULL; numcontacts = 0; //Iterate through model and save references validcat = gtk_tree_model_get_iter_from_string(GTK_TREE_MODEL(model), &catiter, pathstr); while (validcat) { if (gtk_tree_model_iter_has_child(GTK_TREE_MODEL(model), &catiter)) { validcont = gtk_tree_model_iter_children(GTK_TREE_MODEL(model), &contiter, &catiter); while (validcont) { gtk_tree_model_get(GTK_TREE_MODEL(model), &contiter, MMGUI_MAIN_CONTACTSLIST_TYPE, &contacttype, -1); //Save references only on contacts stored on device if (contacttype == MMGUI_MAIN_CONTACT_MODEM) { refpath = gtk_tree_model_get_path(GTK_TREE_MODEL(model), &contiter); if (refpath != NULL) { reference = gtk_tree_row_reference_new(GTK_TREE_MODEL(model), refpath); if (reference != NULL) { reflist = g_slist_prepend(reflist, reference); numcontacts++; } } } validcont = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &contiter); } } validcat = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &catiter); } //Remove contacts if any found if (numcontacts > 0) { for (iterator = reflist; iterator != NULL; iterator = iterator->next) { refpath = gtk_tree_row_reference_get_path((GtkTreeRowReference *)iterator->data); if (refpath) { if (gtk_tree_model_get_iter(GTK_TREE_MODEL(model), &contiter, refpath)) { gtk_tree_store_remove(GTK_TREE_STORE(model), &contiter); } } } //Clear resources allocated for references list g_slist_foreach(reflist, (GFunc)gtk_tree_row_reference_free, NULL); g_slist_free(reflist); } //Remove category caption if (gtk_tree_model_get_iter_from_string(GTK_TREE_MODEL(model), &catiter, pathstr)) { gtk_tree_store_remove(GTK_TREE_STORE(model), &catiter); } } g_free((gchar *)pathstr); } } gtk_widget_set_sensitive(mmguiapp->window->removecontactbutton, FALSE); gtk_widget_set_sensitive(mmguiapp->window->smstocontactbutton, FALSE); } static gboolean mmgui_main_device_open(mmgui_application_t mmguiapp, guint id) { if (mmguiapp == NULL) return FALSE; if (mmguicore_devices_open(mmguiapp->core, id, TRUE)) { mmgui_main_device_clear_data(mmguiapp); //SMS messages mmgui_main_sms_list_fill(mmguiapp); //Contacts mmgui_main_contacts_list_fill(mmguiapp); //Update USSD menu gtk_combo_box_text_remove_all(GTK_COMBO_BOX_TEXT(mmguiapp->window->ussdcombobox)); ussdlist_read_commands(mmgui_main_ussd_menu_update_callback, mmguicore_devices_get_identifier(mmguiapp->core), mmguicore_devices_get_internal_identifier(mmguiapp->core), mmguiapp); //Update device information mmgui_main_info_update_for_device(mmguiapp); g_printf("Selected device ID: %i\n", id); return TRUE; } else { mmgui_main_ui_error_dialog_open(mmguiapp, _("Error opening device"), mmguicore_get_last_error(mmguiapp->core)); return FALSE; } } static gboolean mmgui_main_device_list_unselect_foreach(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data) { mmgui_application_t mmguiapp; gboolean enabled; mmguiapp = (mmgui_application_t)data; if (mmguiapp == NULL) return TRUE; gtk_tree_model_get(model, iter, MMGUI_MAIN_DEVLIST_ENABLED, &enabled, -1); if (enabled) { gtk_list_store_set(GTK_LIST_STORE(model), iter, MMGUI_MAIN_DEVLIST_ENABLED, FALSE, -1); return TRUE; } return FALSE; } static void mmgui_main_device_list_select_signal(GtkCellRendererToggle *cell_renderer, gchar *path, gpointer data) { mmgui_application_t mmguiapp; GtkTreeIter iter; GtkTreeModel *model; gboolean enabled; guint id; mmguiapp = (mmgui_application_t)data; if (mmguiapp == NULL) return; model = gtk_tree_view_get_model(GTK_TREE_VIEW(mmguiapp->window->devlist)); if (gtk_tree_model_get_iter_from_string(model, &iter, path)) { gtk_tree_model_get(model, &iter, MMGUI_MAIN_DEVLIST_ENABLED, &enabled, MMGUI_MAIN_DEVLIST_ID, &id, -1); if (!enabled) { gtk_tree_model_foreach(model, mmgui_main_device_list_unselect_foreach, mmguiapp); gtk_list_store_set(GTK_LIST_STORE(model), &iter, MMGUI_MAIN_DEVLIST_ENABLED, TRUE, -1); mmgui_main_device_open(mmguiapp, id); } } } static gboolean mmgui_main_device_select_from_list(mmgui_application_t mmguiapp, gchar *identifier) { GtkTreeModel *model; GtkTreeIter iter; gboolean valid; gboolean selected; guint curid; gchar *curidentifier; if (mmguiapp == NULL) return FALSE; model = gtk_tree_view_get_model(GTK_TREE_VIEW(mmguiapp->window->devlist)); if (model == NULL) return FALSE; selected = FALSE; //Select requested device if (identifier != NULL) { for (valid = gtk_tree_model_get_iter_first(model, &iter); valid; valid = gtk_tree_model_iter_next(model, &iter)) { gtk_tree_model_get(model, &iter, MMGUI_MAIN_DEVLIST_ID, &curid, MMGUI_MAIN_DEVLIST_IDENTIFIER, &curidentifier, -1); if (g_str_equal(identifier, curidentifier)) { gtk_list_store_set(GTK_LIST_STORE(model), &iter, MMGUI_MAIN_DEVLIST_ENABLED, TRUE, -1); selected = TRUE; break; } } } //If needed device not found, select first one if (!selected) { for (valid = gtk_tree_model_get_iter_first(model, &iter); valid; valid = gtk_tree_model_iter_next(model, &iter)) { gtk_tree_model_get(model, &iter, MMGUI_MAIN_DEVLIST_ID, &curid, MMGUI_MAIN_DEVLIST_IDENTIFIER, &curidentifier, -1); gtk_list_store_set(GTK_LIST_STORE(model), &iter, MMGUI_MAIN_DEVLIST_ENABLED, TRUE, -1); selected = TRUE; break; } } if (selected) { if (mmgui_main_device_open(mmguiapp, curid)) { gmm_settings_set_string(mmguiapp->settings, "device_identifier", identifier); return TRUE; } mmgui_main_ui_control_buttons_disable(mmguiapp, FALSE); } else { g_debug("No devices to select\n"); mmgui_main_ui_control_buttons_disable(mmguiapp, TRUE); } return FALSE; } static void mmgui_main_device_remove_from_list(mmgui_application_t mmguiapp, guint devid) { GtkTreeModel *model; GtkTreeIter iter; gboolean valid; guint currentid; if (mmguiapp == NULL) return; model = gtk_tree_view_get_model(GTK_TREE_VIEW(mmguiapp->window->devlist)); if (model != NULL) { for (valid = gtk_tree_model_get_iter_first(model, &iter); valid; valid = gtk_tree_model_iter_next(model, &iter)) { gtk_tree_model_get(model, &iter, MMGUI_MAIN_DEVLIST_ID, ¤tid, -1); if (currentid == devid) { gtk_list_store_remove(GTK_LIST_STORE(model), &iter); break; } } } } static void mmgui_main_device_add_to_list(mmgui_application_t mmguiapp, mmguidevice_t device, GtkTreeModel *model) { GtkTreeIter iter; gchar *markup; gchar *devtype; gchar *devmanufacturer, *devmodel, *devversion; if ((mmguiapp == NULL) || (device == NULL)) return; if (mmguiapp->window == NULL) return; if (model == NULL) { model = gtk_tree_view_get_model(GTK_TREE_VIEW(mmguiapp->window->devlist)); } if (device->type == MMGUI_DEVICE_TYPE_GSM) { devtype = "GSM"; } else if (device->type == MMGUI_DEVICE_TYPE_CDMA) { devtype = "CDMA"; } devmanufacturer = encoding_clear_special_symbols(g_strdup(device->manufacturer), strlen(device->manufacturer)); devmodel = encoding_clear_special_symbols(g_strdup(device->model), strlen(device->model)); devversion = encoding_clear_special_symbols(g_strdup(device->version), strlen(device->version)); markup = g_strdup_printf(_("%s %s\nVersion:%s Port:%s Type:%s"), devmanufacturer, devmodel, devversion, device->port, devtype); gtk_list_store_append(GTK_LIST_STORE(model), &iter); gtk_list_store_set(GTK_LIST_STORE(model), &iter, MMGUI_MAIN_DEVLIST_ENABLED, FALSE, MMGUI_MAIN_DEVLIST_DESCRIPTION, markup, MMGUI_MAIN_DEVLIST_ID, device->id, MMGUI_MAIN_DEVLIST_IDENTIFIER, device->persistentid, -1); g_free(devmanufacturer); g_free(devmodel); g_free(devversion); g_free(markup); } static void mmgui_main_device_list_fill(mmgui_application_t mmguiapp) { GtkTreeModel *model; GSList *devices; GSList *iterator; if (mmguiapp == NULL) return; model = gtk_tree_view_get_model(GTK_TREE_VIEW(mmguiapp->window->devlist)); if (model != NULL) { g_object_ref(model); gtk_tree_view_set_model(GTK_TREE_VIEW(mmguiapp->window->devlist), NULL); gtk_list_store_clear(GTK_LIST_STORE(model)); devices = mmguicore_devices_get_list(mmguiapp->core); if (devices != NULL) { for (iterator=devices; iterator; iterator=iterator->next) { mmgui_main_device_add_to_list(mmguiapp, (mmguidevice_t)iterator->data, model); } } gtk_tree_view_set_model(GTK_TREE_VIEW(mmguiapp->window->devlist), model); g_object_unref(model); } } static void mmgui_main_device_list_init(mmgui_application_t mmguiapp) { GtkCellRenderer *tbrenderer; GtkCellRenderer *renderer; GtkTreeViewColumn *column; GtkListStore *store; if (mmguiapp == NULL) return; tbrenderer = gtk_cell_renderer_toggle_new(); column = gtk_tree_view_column_new_with_attributes(_("Selected"), tbrenderer, "active", MMGUI_MAIN_DEVLIST_ENABLED, NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(mmguiapp->window->devlist), column); gtk_cell_renderer_toggle_set_radio(GTK_CELL_RENDERER_TOGGLE(tbrenderer), TRUE); renderer = gtk_cell_renderer_text_new(); column = gtk_tree_view_column_new_with_attributes(_("Device"), renderer, "markup", MMGUI_MAIN_DEVLIST_DESCRIPTION, NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(mmguiapp->window->devlist), column); store = gtk_list_store_new(MMGUI_MAIN_DEVLIST_COLUMNS, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_INT, G_TYPE_STRING); gtk_tree_view_set_model(GTK_TREE_VIEW(mmguiapp->window->devlist), GTK_TREE_MODEL(store)); g_object_unref(store); //Device selection signal g_signal_connect(G_OBJECT(tbrenderer), "toggled", G_CALLBACK(mmgui_main_device_list_select_signal), mmguiapp); } //Initialization static void mmgui_main_application_unresolved_error(mmgui_application_t mmguiapp, gchar *caption, gchar *text) { GtkWidget *dialog; if ((mmguiapp == NULL) || (caption == NULL) || (text == NULL)) return; //Show error message (Interface may be not built, so using custom message box) dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, "%s\n%s", caption, text); gtk_window_set_title(GTK_WINDOW(dialog), "Modem Manager GUI"); gtk_dialog_run(GTK_DIALOG(dialog)); gtk_widget_destroy (dialog); //Close application mmgui_main_application_terminate(mmguiapp); } static gboolean mmgui_main_settings_ui_load(mmgui_application_t mmguiapp) { gchar *strparam; GtkTreeModel *model; GtkTreeIter iter; if (mmguiapp == NULL) return FALSE; if ((mmguiapp->window == NULL) || (mmguiapp->settings == NULL)) return FALSE; //Last USSD request strparam = gmm_settings_get_string(mmguiapp->settings, "ussd_request", MMGUI_MAIN_DEFAULT_USSD_COMMAND); gtk_entry_set_text(GTK_ENTRY(mmguiapp->window->ussdentry), strparam); g_free(strparam); //Get last opened device and open it strparam = gmm_settings_get_string(mmguiapp->settings, "device_identifier", MMGUI_MAIN_DEFAULT_DEVICE_IDENTIFIER); mmgui_main_device_select_from_list(mmguiapp, strparam); g_free(strparam); /*Import contacts from system address books*/ model = gtk_tree_view_get_model(GTK_TREE_VIEW(mmguiapp->window->contactstreeview)); if (model) { if (mmgui_addressbooks_get_gnome_contacts_available(mmguiapp->addressbooks)) { gtk_tree_store_append(GTK_TREE_STORE(model), &iter, NULL); gtk_tree_store_set(GTK_TREE_STORE(model), &iter, MMGUI_MAIN_CONTACTSLIST_NAME, _("GNOME contacts"), MMGUI_MAIN_CONTACTSLIST_ID, 0, MMGUI_MAIN_CONTACTSLIST_TYPE, MMGUI_MAIN_CONTACT_HEADER, -1); mmguiapp->window->contgnomepath = gtk_tree_model_get_path(GTK_TREE_MODEL(model), &iter); mmgui_main_contacts_addressbook_list_fill(mmguiapp, MMGUI_MAIN_CONTACT_GNOME); } if (mmgui_addressbooks_get_kde_contacts_available(mmguiapp->addressbooks)) { gtk_tree_store_append(GTK_TREE_STORE(model), &iter, NULL); gtk_tree_store_set(GTK_TREE_STORE(model), &iter, MMGUI_MAIN_CONTACTSLIST_NAME, _("KDE contacts"), MMGUI_MAIN_CONTACTSLIST_ID, 0, MMGUI_MAIN_CONTACTSLIST_TYPE, MMGUI_MAIN_CONTACT_HEADER, -1); mmguiapp->window->contkdepath = gtk_tree_model_get_path(GTK_TREE_MODEL(model), &iter); mmgui_main_contacts_addressbook_list_fill(mmguiapp, MMGUI_MAIN_CONTACT_KDE); } } return TRUE; } static gboolean mmgui_main_settings_load(mmgui_application_t mmguiapp) { gchar *strparam; if (mmguiapp == NULL) return FALSE; if ((mmguiapp->options == NULL) || (mmguiapp->settings == NULL)) return FALSE; //RX speed graph color (default 078B2DFF) strparam = gmm_settings_get_string(mmguiapp->settings, "graph_rx_color", "#078b2d"); if (!gdk_color_parse(strparam, &mmguiapp->options->rxtrafficcolor)) { gdk_color_parse("green", &mmguiapp->options->rxtrafficcolor); } g_free(strparam); //TX speed graph color (default 99114DFF) strparam = gmm_settings_get_string(mmguiapp->settings, "graph_tx_color", "#99114d"); if (!gdk_color_parse(strparam, &mmguiapp->options->txtrafficcolor)) { gdk_color_parse("red", &mmguiapp->options->txtrafficcolor); } g_free(strparam); //SMS options mmguiapp->options->concatsms = gmm_settings_get_boolean(mmguiapp->settings, "sms_concatenation", FALSE); mmguiapp->options->smsexpandfolders = gmm_settings_get_boolean(mmguiapp->settings, "sms_expand_folders", FALSE); mmguiapp->options->smsoldontop = gmm_settings_get_boolean(mmguiapp->settings, "sms_old_on_top", TRUE); //Behaviour options mmguiapp->options->hidetotray = gmm_settings_get_boolean(mmguiapp->settings, "behaviour_hide_to_tray", FALSE); mmguiapp->options->usesounds = gmm_settings_get_boolean(mmguiapp->settings, "behaviour_use_sounds", TRUE); mmguiapp->options->askforhide = gmm_settings_get_boolean(mmguiapp->settings, "behaviour_ask_to_hide", TRUE); mmguiapp->options->savegeometry = gmm_settings_get_boolean(mmguiapp->settings, "behaviour_save_geometry", FALSE); //Window geometry mmguiapp->options->wgwidth = gmm_settings_get_int(mmguiapp->settings, "window_geometry_width", -1); mmguiapp->options->wgheight = gmm_settings_get_int(mmguiapp->settings, "window_geometry_height", -1); mmguiapp->options->wgposx = gmm_settings_get_int(mmguiapp->settings, "window_geometry_x", -1); mmguiapp->options->wgposy = gmm_settings_get_int(mmguiapp->settings, "window_geometry_y", -1); //Is window was minimized on exit mmguiapp->options->minimized = gmm_settings_get_boolean(mmguiapp->settings, "window_state_minimized", FALSE); //Traffic limits if (mmguiapp->limits != NULL) { mmguiapp->limits->trafficenabled = gmm_settings_get_boolean(mmguiapp->settings, "limits_traffic_enabled", FALSE); mmguiapp->limits->trafficamount = (guint)gmm_settings_get_int(mmguiapp->settings, "limits_traffic_amount", 150); mmguiapp->limits->trafficunits = (guint)gmm_settings_get_int(mmguiapp->settings, "limits_traffic_units", 0); mmguiapp->limits->trafficmessage = gmm_settings_get_string(mmguiapp->settings, "limits_traffic_message", _("Traffic limit exceeded... It's time to take rest \\(^_^)/")); mmguiapp->limits->trafficaction = (guint)gmm_settings_get_int(mmguiapp->settings, "limits_traffic_action", 0); switch (mmguiapp->limits->trafficunits) { case 0: mmguiapp->limits->trafficfull = mmguiapp->limits->trafficamount*1024*1024; break; case 1: mmguiapp->limits->trafficfull = mmguiapp->limits->trafficamount*1024*1024*1024; break; case 2: mmguiapp->limits->trafficfull = mmguiapp->limits->trafficamount*1024*1024*1024*1024; break; default: mmguiapp->limits->trafficfull = mmguiapp->limits->trafficamount*1024*1024; break; } mmguiapp->limits->trafficexecuted = FALSE; mmguiapp->limits->timeenabled = gmm_settings_get_boolean(mmguiapp->settings, "limits_time_enabled", FALSE); mmguiapp->limits->timeamount = (guint)gmm_settings_get_int(mmguiapp->settings, "limits_time_amount", 60); mmguiapp->limits->timeunits = (guint)gmm_settings_get_int(mmguiapp->settings, "limits_time_units", 0); mmguiapp->limits->timemessage = gmm_settings_get_string(mmguiapp->settings, "limits_time_message", _("Time limit exceeded... Go sleep and have nice dreams -_-")); mmguiapp->limits->timeaction = (guint)gmm_settings_get_int(mmguiapp->settings, "limits_time_action", 0); switch (mmguiapp->limits->timeunits) { case 0: mmguiapp->limits->timefull = mmguiapp->limits->timeamount*60; break; case 1: mmguiapp->limits->timefull = mmguiapp->limits->timeamount*60*60; break; default: mmguiapp->limits->timefull = mmguiapp->limits->timeamount*60; break; } mmguiapp->limits->timeexecuted = FALSE; } return TRUE; } static gboolean mmgui_main_application_build_user_interface(mmgui_application_t mmguiapp) { GtkBuilder *builder; GError *error; GtkStyleContext *context; GdkPixbuf *pixbuf; GtkWidget *tbimage; GtkTextBuffer *buffer; //Structures for closures static struct _mmgui_application_data appdata[MMGUI_MAIN_PAGE_NUMBER]; static struct _mmgui_application_data shortcutsdata[MMGUI_MAIN_CONTROL_SHORTCUT_NUMBER]; if (mmguiapp == NULL) return FALSE; error = NULL; builder = gtk_builder_new(); if (gtk_builder_add_from_file(builder, RESOURCE_MAINWINDOW_UI, &error) == 0) { g_print("User interface file parse error: %s\n", (error->message != NULL) ? error->message : "Unknown"); g_error_free(error); return FALSE; } gtk_builder_set_translation_domain(builder, RESOURCE_LOCALE_DOMAIN); //Window mmguiapp->window->window = GTK_WIDGET(gtk_builder_get_object(builder, "window")); g_object_set(G_OBJECT(mmguiapp->window->window), "application", mmguiapp->gtkapplication, NULL); gtk_application_window_set_show_menubar(GTK_APPLICATION_WINDOW(mmguiapp->window->window), TRUE); //Controls mmguiapp->window->toolbar = GTK_WIDGET(gtk_builder_get_object(builder, "toolbar")); mmguiapp->window->statusbar = GTK_WIDGET(gtk_builder_get_object(builder, "statusbar")); mmguiapp->window->notebook = GTK_WIDGET(gtk_builder_get_object(builder, "notebook")); //Toolbar buttons mmguiapp->window->devbutton = GTK_WIDGET(gtk_builder_get_object(builder, "devbutton")); tbimage = gtk_image_new_from_file(RESOURCE_TOOLBAR_DEV); gtk_tool_button_set_icon_widget(GTK_TOOL_BUTTON(mmguiapp->window->devbutton), GTK_WIDGET(tbimage)); gtk_widget_show(tbimage); mmguiapp->window->smsbutton = GTK_WIDGET(gtk_builder_get_object(builder, "smsbutton")); tbimage = gtk_image_new_from_file(RESOURCE_TOOLBAR_SMS); gtk_tool_button_set_icon_widget(GTK_TOOL_BUTTON(mmguiapp->window->smsbutton), GTK_WIDGET(tbimage)); gtk_widget_show(tbimage); mmguiapp->window->ussdbutton = GTK_WIDGET(gtk_builder_get_object(builder, "ussdbutton")); tbimage = gtk_image_new_from_file(RESOURCE_TOOLBAR_USSD); gtk_tool_button_set_icon_widget(GTK_TOOL_BUTTON(mmguiapp->window->ussdbutton), GTK_WIDGET(tbimage)); gtk_widget_show(tbimage); mmguiapp->window->infobutton = GTK_WIDGET(gtk_builder_get_object(builder, "infobutton")); tbimage = gtk_image_new_from_file(RESOURCE_TOOLBAR_INFO); gtk_tool_button_set_icon_widget(GTK_TOOL_BUTTON(mmguiapp->window->infobutton), GTK_WIDGET(tbimage)); gtk_widget_show(tbimage); mmguiapp->window->scanbutton = GTK_WIDGET(gtk_builder_get_object(builder, "scanbutton")); tbimage = gtk_image_new_from_file(RESOURCE_TOOLBAR_SCAN); gtk_tool_button_set_icon_widget(GTK_TOOL_BUTTON(mmguiapp->window->scanbutton), GTK_WIDGET(tbimage)); gtk_widget_show(tbimage); mmguiapp->window->contactsbutton = GTK_WIDGET(gtk_builder_get_object(builder, "contactsbutton")); tbimage = gtk_image_new_from_file(RESOURCE_TOOLBAR_CONT); gtk_tool_button_set_icon_widget(GTK_TOOL_BUTTON(mmguiapp->window->contactsbutton), GTK_WIDGET(tbimage)); gtk_widget_show(tbimage); mmguiapp->window->trafficbutton = GTK_WIDGET(gtk_builder_get_object(builder, "trafficbutton")); tbimage = gtk_image_new_from_file(RESOURCE_TOOLBAR_TRAFFIC); gtk_tool_button_set_icon_widget(GTK_TOOL_BUTTON(mmguiapp->window->trafficbutton), GTK_WIDGET(tbimage)); gtk_widget_show(tbimage); //Dialogs mmguiapp->window->aboutdialog = GTK_WIDGET(gtk_builder_get_object(builder, "aboutdialog")); mmguiapp->window->prefdialog = GTK_WIDGET(gtk_builder_get_object(builder, "prefdialog")); mmguiapp->window->questiondialog = GTK_WIDGET(gtk_builder_get_object(builder, "questiondialog")); mmguiapp->window->errordialog = GTK_WIDGET(gtk_builder_get_object(builder, "errordialog")); mmguiapp->window->exitdialog = GTK_WIDGET(gtk_builder_get_object(builder, "exitdialog")); mmguiapp->window->progressdialog = GTK_WIDGET(gtk_builder_get_object(builder, "progressdialog")); mmguiapp->window->progressbar = GTK_WIDGET(gtk_builder_get_object(builder, "progressbar")); mmguiapp->window->nodevbar = GTK_WIDGET(gtk_builder_get_object(builder, "nodevbar")); //SMS send dialog mmguiapp->window->newsmsdialog = GTK_WIDGET(gtk_builder_get_object(builder, "newsmsdialog")); mmguiapp->window->smsnumberentry = GTK_WIDGET(gtk_builder_get_object(builder, "smsnumberentry")); mmguiapp->window->smstextview = GTK_WIDGET(gtk_builder_get_object(builder, "smstextview")); mmguiapp->window->sendsmsbutton = GTK_WIDGET(gtk_builder_get_object(builder, "sendsmsbutton")); mmguiapp->window->savesmsbutton = GTK_WIDGET(gtk_builder_get_object(builder, "savesmsbutton")); //Devices page mmguiapp->window->devlist = GTK_WIDGET(gtk_builder_get_object(builder, "devlist")); mmgui_main_device_list_init(mmguiapp); //SMS page mmguiapp->window->smsinfobar = GTK_WIDGET(gtk_builder_get_object(builder, "smsinfobar")); mmguiapp->window->smsinfobarlabel = GTK_WIDGET(gtk_builder_get_object(builder, "smsinfobarlabel")); mmguiapp->window->smslist = GTK_WIDGET(gtk_builder_get_object(builder, "smslist")); mmguiapp->window->smstext = GTK_WIDGET(gtk_builder_get_object(builder, "smstext")); mmguiapp->window->newsmsbutton = GTK_WIDGET(gtk_builder_get_object(builder, "newsmsbutton")); mmguiapp->window->removesmsbutton = GTK_WIDGET(gtk_builder_get_object(builder, "removesmsbutton")); mmguiapp->window->answersmsbutton = GTK_WIDGET(gtk_builder_get_object(builder, "answersmsbutton")); mmgui_main_sms_list_init(mmguiapp); //Info page mmguiapp->window->devicevlabel = GTK_WIDGET(gtk_builder_get_object(builder, "devicevlabel")); mmguiapp->window->operatorvlabel = GTK_WIDGET(gtk_builder_get_object(builder, "operatorvlabel")); mmguiapp->window->operatorcodevlabel = GTK_WIDGET(gtk_builder_get_object(builder, "operatorcodevlabel")); mmguiapp->window->regstatevlabel = GTK_WIDGET(gtk_builder_get_object(builder, "regstatevlabel")); mmguiapp->window->modevlabel = GTK_WIDGET(gtk_builder_get_object(builder, "modevlabel")); mmguiapp->window->imeivlabel = GTK_WIDGET(gtk_builder_get_object(builder, "imeivlabel")); mmguiapp->window->imsivlabel = GTK_WIDGET(gtk_builder_get_object(builder, "imsivlabel")); mmguiapp->window->signallevelprogressbar = GTK_WIDGET(gtk_builder_get_object(builder, "signallevelprogressbar")); mmguiapp->window->info3gpplocvlabel = GTK_WIDGET(gtk_builder_get_object(builder, "3gpplocationvlabel")); mmguiapp->window->infogpslocvlabel = GTK_WIDGET(gtk_builder_get_object(builder, "gpslocationvlabel")); mmguiapp->window->equipmentimage = GTK_WIDGET(gtk_builder_get_object(builder, "equipmentimage")); gtk_image_set_from_file(GTK_IMAGE(mmguiapp->window->equipmentimage), RESOURCE_INFO_EQUIPMENT); mmguiapp->window->networkimage = GTK_WIDGET(gtk_builder_get_object(builder, "networkimage")); gtk_image_set_from_file(GTK_IMAGE(mmguiapp->window->networkimage), RESOURCE_INFO_NETWORK); mmguiapp->window->locationimage = GTK_WIDGET(gtk_builder_get_object(builder, "locationimage")); gtk_image_set_from_file(GTK_IMAGE(mmguiapp->window->locationimage), RESOURCE_INFO_LOCATION); //USSD page mmguiapp->window->ussdinfobar = GTK_WIDGET(gtk_builder_get_object(builder, "ussdinfobar")); mmguiapp->window->ussdinfobarlabel = GTK_WIDGET(gtk_builder_get_object(builder, "ussdinfobarlabel")); mmguiapp->window->ussdentry = GTK_WIDGET(gtk_builder_get_object(builder, "ussdentry")); mmguiapp->window->ussdcombobox = GTK_WIDGET(gtk_builder_get_object(builder, "ussdcombobox")); mmguiapp->window->ussdeditor = GTK_WIDGET(gtk_builder_get_object(builder, "ussdeditor")); mmguiapp->window->ussdsend = GTK_WIDGET(gtk_builder_get_object(builder, "ussdsend")); mmguiapp->window->ussdtext = GTK_WIDGET(gtk_builder_get_object(builder, "ussdtext")); //Scan page mmguiapp->window->scaninfobar = GTK_WIDGET(gtk_builder_get_object(builder, "scaninfobar")); mmguiapp->window->scaninfobarlabel = GTK_WIDGET(gtk_builder_get_object(builder, "scaninfobarlabel")); mmguiapp->window->scanlist = GTK_WIDGET(gtk_builder_get_object(builder, "scanlist")); mmguiapp->window->startscanbutton = GTK_WIDGET(gtk_builder_get_object(builder, "startscanbutton")); mmgui_main_scan_list_init(mmguiapp); //Contacts page mmguiapp->window->contactsinfobar = GTK_WIDGET(gtk_builder_get_object(builder, "contactsinfobar")); mmguiapp->window->contactsinfobarlabel = GTK_WIDGET(gtk_builder_get_object(builder, "contactsinfobarlabel")); mmguiapp->window->newcontactbutton = GTK_WIDGET(gtk_builder_get_object(builder, "newcontactbutton")); mmguiapp->window->removecontactbutton = GTK_WIDGET(gtk_builder_get_object(builder, "removecontactbutton")); mmguiapp->window->smstocontactbutton = GTK_WIDGET(gtk_builder_get_object(builder, "smstocontactbutton")); mmguiapp->window->contactstreeview = GTK_WIDGET(gtk_builder_get_object(builder, "contactstreeview")); mmguiapp->window->contactssmsmenu = NULL; mmgui_main_contacts_list_init(mmguiapp); //New contact dialog mmguiapp->window->newcontactdialog = GTK_WIDGET(gtk_builder_get_object(builder, "newcontactdialog")); mmguiapp->window->contactnameentry = GTK_WIDGET(gtk_builder_get_object(builder, "contactnameentry")); mmguiapp->window->contactnumberentry = GTK_WIDGET(gtk_builder_get_object(builder, "contactnumberentry")); mmguiapp->window->contactemailentry = GTK_WIDGET(gtk_builder_get_object(builder, "contactemailentry")); mmguiapp->window->contactgroupentry = GTK_WIDGET(gtk_builder_get_object(builder, "contactgroupentry")); mmguiapp->window->contactname2entry = GTK_WIDGET(gtk_builder_get_object(builder, "contactname2entry")); mmguiapp->window->contactnumber2entry = GTK_WIDGET(gtk_builder_get_object(builder, "contactnumber2entry")); mmguiapp->window->newcontactaddbutton = GTK_WIDGET(gtk_builder_get_object(builder, "newcontactaddbutton")); //Traffic page mmguiapp->window->trafficparamslist = GTK_WIDGET(gtk_builder_get_object(builder, "trafficparamslist")); mmguiapp->window->trafficdrawingarea = GTK_WIDGET(gtk_builder_get_object(builder, "trafficdrawingarea")); mmgui_main_traffic_list_init(mmguiapp); //Traffic limits dialog mmguiapp->window->trafficlimitsdialog = GTK_WIDGET(gtk_builder_get_object(builder, "trafficlimitsdialog")); mmguiapp->window->trafficlimitcheckbutton = GTK_WIDGET(gtk_builder_get_object(builder, "trafficlimitcheckbutton")); mmguiapp->window->trafficamount = GTK_WIDGET(gtk_builder_get_object(builder, "trafficamount")); mmguiapp->window->trafficunits = GTK_WIDGET(gtk_builder_get_object(builder, "trafficunits")); mmguiapp->window->trafficmessage = GTK_WIDGET(gtk_builder_get_object(builder, "trafficmessage")); mmguiapp->window->trafficaction = GTK_WIDGET(gtk_builder_get_object(builder, "trafficaction")); mmguiapp->window->timelimitcheckbutton = GTK_WIDGET(gtk_builder_get_object(builder, "timelimitcheckbutton")); mmguiapp->window->timeamount = GTK_WIDGET(gtk_builder_get_object(builder, "timeamount")); mmguiapp->window->timeunits = GTK_WIDGET(gtk_builder_get_object(builder, "timeunits")); mmguiapp->window->timemessage = GTK_WIDGET(gtk_builder_get_object(builder, "timemessage")); mmguiapp->window->timeaction = GTK_WIDGET(gtk_builder_get_object(builder, "timeaction")); //Connections dialog mmguiapp->window->conndialog = GTK_WIDGET(gtk_builder_get_object(builder, "conndialog")); mmguiapp->window->connscrolledwindow = GTK_WIDGET(gtk_builder_get_object(builder, "connscrolledwindow")); mmguiapp->window->conntreeview = GTK_WIDGET(gtk_builder_get_object(builder, "conntreeview")); mmguiapp->window->conntermtoolbutton = GTK_WIDGET(gtk_builder_get_object(builder, "conntermtoolbutton")); /*accelerators*/ mmguiapp->window->connaccelgroup = gtk_accel_group_new(); gtk_window_add_accel_group(GTK_WINDOW(mmguiapp->window->conndialog), mmguiapp->window->connaccelgroup); gtk_widget_add_accelerator(mmguiapp->window->conntermtoolbutton, "clicked", mmguiapp->window->connaccelgroup, GDK_KEY_t, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE); mmgui_main_traffic_connections_list_init(mmguiapp); //Traffic statistics dialog mmguiapp->window->trafficstatsdialog = GTK_WIDGET(gtk_builder_get_object(builder, "trafficstatsdialog")); mmguiapp->window->trafficstatstreeview = GTK_WIDGET(gtk_builder_get_object(builder, "trafficstatstreeview")); mmguiapp->window->trafficstatsmonthcb = GTK_WIDGET(gtk_builder_get_object(builder, "trafficstatsmonthcb")); mmguiapp->window->trafficstatsyearcb = GTK_WIDGET(gtk_builder_get_object(builder, "trafficstatsyearcb")); mmgui_main_traffic_traffic_statistics_list_init(mmguiapp); //USSD edition dialog mmguiapp->window->ussdeditdialog = GTK_WIDGET(gtk_builder_get_object(builder, "ussdeditdialog")); mmguiapp->window->ussdedittreeview = GTK_WIDGET(gtk_builder_get_object(builder, "ussdedittreeview")); mmguiapp->window->newussdtoolbutton = GTK_WIDGET(gtk_builder_get_object(builder, "newussdtoolbutton")); mmguiapp->window->removeussdtoolbutton = GTK_WIDGET(gtk_builder_get_object(builder, "removeussdtoolbutton")); mmguiapp->window->ussdencodingtoolbutton = GTK_WIDGET(gtk_builder_get_object(builder, "ussdencodingtoolbutton")); /*accelerators*/ mmguiapp->window->ussdaccelgroup = gtk_accel_group_new(); gtk_window_add_accel_group(GTK_WINDOW(mmguiapp->window->ussdeditdialog), mmguiapp->window->ussdaccelgroup); gtk_widget_add_accelerator(mmguiapp->window->newussdtoolbutton, "clicked", mmguiapp->window->ussdaccelgroup, GDK_KEY_n, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE); gtk_widget_add_accelerator(mmguiapp->window->removeussdtoolbutton, "clicked", mmguiapp->window->ussdaccelgroup, GDK_KEY_d, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE); gtk_widget_add_accelerator(mmguiapp->window->ussdencodingtoolbutton, "clicked", mmguiapp->window->ussdaccelgroup, GDK_KEY_e, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE); mmgui_main_ussd_list_init(mmguiapp); //Preferences dialog mmguiapp->window->prefsmsconcat = GTK_WIDGET(gtk_builder_get_object(builder, "prefsmsconcat")); mmguiapp->window->prefsmsexpand = GTK_WIDGET(gtk_builder_get_object(builder, "prefsmsexpand")); mmguiapp->window->prefsmsoldontop = GTK_WIDGET(gtk_builder_get_object(builder, "prefssmsoldontop")); mmguiapp->window->preftrafficrxcolor = GTK_WIDGET(gtk_builder_get_object(builder, "preftrafficrxcolor")); mmguiapp->window->preftraffictxcolor = GTK_WIDGET(gtk_builder_get_object(builder, "preftraffictxcolor")); mmguiapp->window->prefbehavioursounds = GTK_WIDGET(gtk_builder_get_object(builder, "prefbehavioursounds")); mmguiapp->window->prefbehaviourhide = GTK_WIDGET(gtk_builder_get_object(builder, "prefbehaviourhide")); mmguiapp->window->prefbehaviourgeom = GTK_WIDGET(gtk_builder_get_object(builder, "prefbehaviourgeom")); //Exit dialog mmguiapp->window->exitaskagain = GTK_WIDGET(gtk_builder_get_object(builder, "exitaskagain")); mmguiapp->window->exitcloseradio = GTK_WIDGET(gtk_builder_get_object(builder, "exitcloseradio")); mmguiapp->window->exithideradio = GTK_WIDGET(gtk_builder_get_object(builder, "exithideradio")); //Toolbar style context = gtk_widget_get_style_context(GTK_WIDGET(mmguiapp->window->toolbar)); gtk_style_context_add_class(context, GTK_STYLE_CLASS_PRIMARY_TOOLBAR); //Binding signal handlers defined by Glade gtk_builder_connect_signals(builder, mmguiapp); //Builder object not needed anymore g_object_unref(G_OBJECT(builder)); //Set icon for all windows error = NULL; pixbuf = gdk_pixbuf_new_from_file(RESOURCE_MAINWINDOW_ICON, &error); if (pixbuf != NULL) { gtk_about_dialog_set_logo(GTK_ABOUT_DIALOG(mmguiapp->window->aboutdialog), pixbuf); gtk_window_set_icon(GTK_WINDOW(mmguiapp->window->window), pixbuf); gtk_window_set_icon(GTK_WINDOW(mmguiapp->window->aboutdialog), pixbuf); gtk_window_set_icon(GTK_WINDOW(mmguiapp->window->questiondialog), pixbuf); gtk_window_set_icon(GTK_WINDOW(mmguiapp->window->errordialog), pixbuf); gtk_window_set_icon(GTK_WINDOW(mmguiapp->window->progressdialog), pixbuf); gtk_window_set_icon(GTK_WINDOW(mmguiapp->window->newsmsdialog), pixbuf); g_object_unref(G_OBJECT(pixbuf)); } else { g_print("Pixbuf load error: %s\n", (error->message != NULL) ? error->message : "Unknown"); g_error_free(error); } //Icons for SMS messages mmguiapp->window->smsreadicon = gdk_pixbuf_new_from_file(RESOURCE_SMS_READ, NULL); mmguiapp->window->smsunreadicon = gdk_pixbuf_new_from_file(RESOURCE_SMS_UNREAD, NULL); //USSD text markup tags buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(mmguiapp->window->ussdtext)); mmguiapp->window->ussdrequesttag = gtk_text_buffer_create_tag(buffer, "request", "weight", PANGO_WEIGHT_BOLD, "indent", 5, "left_margin", 5, "right_margin", 5, NULL); mmguiapp->window->ussdhinttag = gtk_text_buffer_create_tag(buffer, "hint", "weight", PANGO_WEIGHT_NORMAL, "style", PANGO_STYLE_ITALIC, "scale", PANGO_SCALE_SMALL, "indent", 5, "left_margin", 5, "right_margin", 5, NULL); mmguiapp->window->ussdanswertag = gtk_text_buffer_create_tag(buffer, "answer", "weight", PANGO_WEIGHT_NORMAL, "indent", 5, "left_margin", 5, "right_margin", 5, NULL); //Windows must be owned by GTK+ application gtk_window_set_application(GTK_WINDOW(mmguiapp->window->window), GTK_APPLICATION(mmguiapp->gtkapplication)); gtk_window_set_application(GTK_WINDOW(mmguiapp->window->aboutdialog), GTK_APPLICATION(mmguiapp->gtkapplication)); gtk_window_set_application(GTK_WINDOW(mmguiapp->window->questiondialog), GTK_APPLICATION(mmguiapp->gtkapplication)); gtk_window_set_application(GTK_WINDOW(mmguiapp->window->errordialog), GTK_APPLICATION(mmguiapp->gtkapplication)); gtk_window_set_application(GTK_WINDOW(mmguiapp->window->progressdialog), GTK_APPLICATION(mmguiapp->gtkapplication)); gtk_window_set_application(GTK_WINDOW(mmguiapp->window->newsmsdialog), GTK_APPLICATION(mmguiapp->gtkapplication)); //Window delete event signal g_signal_connect(G_OBJECT(mmguiapp->window->window), "delete-event", G_CALLBACK(mmgui_main_ui_window_delete_event_signal), mmguiapp); //Keyboard accelerators mmguiapp->window->accelgroup = gtk_accel_group_new(); gtk_window_add_accel_group(GTK_WINDOW(mmguiapp->window->window), mmguiapp->window->accelgroup); //Toolbar (F1-F7) //Devices page appdata[MMGUI_MAIN_PAGE_DEVICES].mmguiapp = mmguiapp; appdata[MMGUI_MAIN_PAGE_DEVICES].data = GUINT_TO_POINTER(MMGUI_MAIN_PAGE_DEVICES); mmguiapp->window->devclosure = g_cclosure_new_swap(G_CALLBACK(mmgui_main_ui_page_select_by_accelerator_signal), &(appdata[MMGUI_MAIN_PAGE_DEVICES]), NULL); gtk_accel_group_connect(mmguiapp->window->accelgroup, GDK_KEY_F1, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE, mmguiapp->window->devclosure); //SMS page appdata[MMGUI_MAIN_PAGE_SMS].mmguiapp = mmguiapp; appdata[MMGUI_MAIN_PAGE_SMS].data = GUINT_TO_POINTER(MMGUI_MAIN_PAGE_SMS); mmguiapp->window->smsclosure = g_cclosure_new_swap(G_CALLBACK(mmgui_main_ui_page_select_by_accelerator_signal), &(appdata[MMGUI_MAIN_PAGE_SMS]), NULL); gtk_accel_group_connect(mmguiapp->window->accelgroup, GDK_KEY_F2, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE, mmguiapp->window->smsclosure); //USSD page appdata[MMGUI_MAIN_PAGE_USSD].mmguiapp = mmguiapp; appdata[MMGUI_MAIN_PAGE_USSD].data = GUINT_TO_POINTER(MMGUI_MAIN_PAGE_USSD); mmguiapp->window->ussdclosure = g_cclosure_new_swap(G_CALLBACK(mmgui_main_ui_page_select_by_accelerator_signal), &(appdata[MMGUI_MAIN_PAGE_USSD]), NULL); gtk_accel_group_connect(mmguiapp->window->accelgroup, GDK_KEY_F3, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE, mmguiapp->window->ussdclosure); //Info page appdata[MMGUI_MAIN_PAGE_INFO].mmguiapp = mmguiapp; appdata[MMGUI_MAIN_PAGE_INFO].data = GUINT_TO_POINTER(MMGUI_MAIN_PAGE_INFO); mmguiapp->window->infoclosure = g_cclosure_new_swap(G_CALLBACK(mmgui_main_ui_page_select_by_accelerator_signal), &(appdata[MMGUI_MAIN_PAGE_INFO]), NULL); gtk_accel_group_connect(mmguiapp->window->accelgroup, GDK_KEY_F4, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE, mmguiapp->window->infoclosure); //Scan page appdata[MMGUI_MAIN_PAGE_SCAN].mmguiapp = mmguiapp; appdata[MMGUI_MAIN_PAGE_SCAN].data = GUINT_TO_POINTER(MMGUI_MAIN_PAGE_SCAN); mmguiapp->window->scanclosure = g_cclosure_new_swap(G_CALLBACK(mmgui_main_ui_page_select_by_accelerator_signal), &(appdata[MMGUI_MAIN_PAGE_SCAN]), NULL); gtk_accel_group_connect(mmguiapp->window->accelgroup, GDK_KEY_F5, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE, mmguiapp->window->scanclosure); //Traffic page appdata[MMGUI_MAIN_PAGE_TRAFFIC].mmguiapp = mmguiapp; appdata[MMGUI_MAIN_PAGE_TRAFFIC].data = GUINT_TO_POINTER(MMGUI_MAIN_PAGE_TRAFFIC); mmguiapp->window->trafficclosure = g_cclosure_new_swap(G_CALLBACK(mmgui_main_ui_page_select_by_accelerator_signal), &(appdata[MMGUI_MAIN_PAGE_TRAFFIC]), NULL); gtk_accel_group_connect(mmguiapp->window->accelgroup, GDK_KEY_F6, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE, mmguiapp->window->trafficclosure); //Contacts page appdata[MMGUI_MAIN_PAGE_CONTACTS].mmguiapp = mmguiapp; appdata[MMGUI_MAIN_PAGE_CONTACTS].data = GUINT_TO_POINTER(MMGUI_MAIN_PAGE_CONTACTS); mmguiapp->window->contactsclosure = g_cclosure_new_swap(G_CALLBACK(mmgui_main_ui_page_select_by_accelerator_signal), &(appdata[MMGUI_MAIN_PAGE_CONTACTS]), NULL); gtk_accel_group_connect(mmguiapp->window->accelgroup, GDK_KEY_F7, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE, mmguiapp->window->contactsclosure); //Buttons on pages /*Active shortcuts list*/ mmguiapp->window->pageshortcuts = NULL; /*Closures for SMS page*/ /*send sms message*/ shortcutsdata[MMGUI_MAIN_CONTROL_SHORTCUT_SMS_NEW].mmguiapp = mmguiapp; shortcutsdata[MMGUI_MAIN_CONTROL_SHORTCUT_SMS_NEW].data = GUINT_TO_POINTER(MMGUI_MAIN_CONTROL_SHORTCUT_SMS_NEW); mmguiapp->window->newsmsclosure = g_cclosure_new_swap(G_CALLBACK(mmgui_main_ui_page_use_shortcuts_signal), &(shortcutsdata[MMGUI_MAIN_CONTROL_SHORTCUT_SMS_NEW]), NULL); /*remove sms message*/ shortcutsdata[MMGUI_MAIN_CONTROL_SHORTCUT_SMS_REMOVE].mmguiapp = mmguiapp; shortcutsdata[MMGUI_MAIN_CONTROL_SHORTCUT_SMS_REMOVE].data = GUINT_TO_POINTER(MMGUI_MAIN_CONTROL_SHORTCUT_SMS_REMOVE); mmguiapp->window->removesmsclosure = g_cclosure_new_swap(G_CALLBACK(mmgui_main_ui_page_use_shortcuts_signal), &(shortcutsdata[MMGUI_MAIN_CONTROL_SHORTCUT_SMS_REMOVE]), NULL); /*answer sms message*/ shortcutsdata[MMGUI_MAIN_CONTROL_SHORTCUT_SMS_ANSWER].mmguiapp = mmguiapp; shortcutsdata[MMGUI_MAIN_CONTROL_SHORTCUT_SMS_ANSWER].data = GUINT_TO_POINTER(MMGUI_MAIN_CONTROL_SHORTCUT_SMS_ANSWER); mmguiapp->window->answersmsclosure = g_cclosure_new_swap(G_CALLBACK(mmgui_main_ui_page_use_shortcuts_signal), &(shortcutsdata[MMGUI_MAIN_CONTROL_SHORTCUT_SMS_ANSWER]), NULL); /*Closures for USSD page*/ /*edit ussd commands*/ shortcutsdata[MMGUI_MAIN_CONTROL_SHORTCUT_USSD_EDITOR].mmguiapp = mmguiapp; shortcutsdata[MMGUI_MAIN_CONTROL_SHORTCUT_USSD_EDITOR].data = GUINT_TO_POINTER(MMGUI_MAIN_CONTROL_SHORTCUT_USSD_EDITOR); mmguiapp->window->ussdeditorclosure = g_cclosure_new_swap(G_CALLBACK(mmgui_main_ui_page_use_shortcuts_signal), &(shortcutsdata[MMGUI_MAIN_CONTROL_SHORTCUT_USSD_EDITOR]), NULL); /*send ussd request*/ shortcutsdata[MMGUI_MAIN_CONTROL_SHORTCUT_USSD_SEND].mmguiapp = mmguiapp; shortcutsdata[MMGUI_MAIN_CONTROL_SHORTCUT_USSD_SEND].data = GUINT_TO_POINTER(MMGUI_MAIN_CONTROL_SHORTCUT_USSD_SEND); mmguiapp->window->ussdsendclosure = g_cclosure_new_swap(G_CALLBACK(mmgui_main_ui_page_use_shortcuts_signal), &(shortcutsdata[MMGUI_MAIN_CONTROL_SHORTCUT_USSD_SEND]), NULL); /*Closures for Scan page*/ /*scan networks*/ shortcutsdata[MMGUI_MAIN_CONTROL_SHORTCUT_SCAN_START].mmguiapp = mmguiapp; shortcutsdata[MMGUI_MAIN_CONTROL_SHORTCUT_SCAN_START].data = GUINT_TO_POINTER(MMGUI_MAIN_CONTROL_SHORTCUT_SCAN_START); mmguiapp->window->startscanclosure = g_cclosure_new_swap(G_CALLBACK(mmgui_main_ui_page_use_shortcuts_signal), &(shortcutsdata[MMGUI_MAIN_CONTROL_SHORTCUT_SCAN_START]), NULL); /*Closures for Traffic page*/ /*limits*/ shortcutsdata[MMGUI_MAIN_CONTROL_SHORTCUT_TRAFFIC_LIMIT].mmguiapp = mmguiapp; shortcutsdata[MMGUI_MAIN_CONTROL_SHORTCUT_TRAFFIC_LIMIT].data = GUINT_TO_POINTER(MMGUI_MAIN_CONTROL_SHORTCUT_TRAFFIC_LIMIT); mmguiapp->window->trafficlimitclosure = g_cclosure_new_swap(G_CALLBACK(mmgui_main_ui_page_use_shortcuts_signal), &(shortcutsdata[MMGUI_MAIN_CONTROL_SHORTCUT_TRAFFIC_LIMIT]), NULL); /*connections*/ shortcutsdata[MMGUI_MAIN_CONTROL_SHORTCUT_TRAFFIC_CONNECTIONS].mmguiapp = mmguiapp; shortcutsdata[MMGUI_MAIN_CONTROL_SHORTCUT_TRAFFIC_CONNECTIONS].data = GUINT_TO_POINTER(MMGUI_MAIN_CONTROL_SHORTCUT_TRAFFIC_CONNECTIONS); mmguiapp->window->trafficconnclosure = g_cclosure_new_swap(G_CALLBACK(mmgui_main_ui_page_use_shortcuts_signal), &(shortcutsdata[MMGUI_MAIN_CONTROL_SHORTCUT_TRAFFIC_CONNECTIONS]), NULL); /*statistics*/ shortcutsdata[MMGUI_MAIN_CONTROL_SHORTCUT_TRAFFIC_STATS].mmguiapp = mmguiapp; shortcutsdata[MMGUI_MAIN_CONTROL_SHORTCUT_TRAFFIC_STATS].data = GUINT_TO_POINTER(MMGUI_MAIN_CONTROL_SHORTCUT_TRAFFIC_STATS); mmguiapp->window->trafficstatsclosure = g_cclosure_new_swap(G_CALLBACK(mmgui_main_ui_page_use_shortcuts_signal), &(shortcutsdata[MMGUI_MAIN_CONTROL_SHORTCUT_TRAFFIC_STATS]), NULL); /*Closures for Contacts page*/ /*add contact*/ shortcutsdata[MMGUI_MAIN_CONTROL_SHORTCUT_CONTACTS_NEW].mmguiapp = mmguiapp; shortcutsdata[MMGUI_MAIN_CONTROL_SHORTCUT_CONTACTS_NEW].data = GUINT_TO_POINTER(MMGUI_MAIN_CONTROL_SHORTCUT_CONTACTS_NEW); mmguiapp->window->newcontactclosure = g_cclosure_new_swap(G_CALLBACK(mmgui_main_ui_page_use_shortcuts_signal), &(shortcutsdata[MMGUI_MAIN_CONTROL_SHORTCUT_CONTACTS_NEW]), NULL); /*remove contact*/ shortcutsdata[MMGUI_MAIN_CONTROL_SHORTCUT_CONTACTS_REMOVE].mmguiapp = mmguiapp; shortcutsdata[MMGUI_MAIN_CONTROL_SHORTCUT_CONTACTS_REMOVE].data = GUINT_TO_POINTER(MMGUI_MAIN_CONTROL_SHORTCUT_CONTACTS_REMOVE); mmguiapp->window->removecontactclosure = g_cclosure_new_swap(G_CALLBACK(mmgui_main_ui_page_use_shortcuts_signal), &(shortcutsdata[MMGUI_MAIN_CONTROL_SHORTCUT_CONTACTS_REMOVE]), NULL); /*send sms*/ shortcutsdata[MMGUI_MAIN_CONTROL_SHORTCUT_CONTACTS_SMS].mmguiapp = mmguiapp; shortcutsdata[MMGUI_MAIN_CONTROL_SHORTCUT_CONTACTS_SMS].data = GUINT_TO_POINTER(MMGUI_MAIN_CONTROL_SHORTCUT_CONTACTS_SMS); mmguiapp->window->smstocontactclosure = g_cclosure_new_swap(G_CALLBACK(mmgui_main_ui_page_use_shortcuts_signal), &(shortcutsdata[MMGUI_MAIN_CONTROL_SHORTCUT_CONTACTS_SMS]), NULL); /*Tray icon*/ mmguiapp->window->statusicon = gtk_status_icon_new_from_file(RESOURCE_MAINWINDOW_ICON); g_signal_connect(G_OBJECT(mmguiapp->window->statusicon), "activate", G_CALLBACK(mmgui_main_tray_icon_activation_signal), mmguiapp); gtk_status_icon_set_tooltip_text(mmguiapp->window->statusicon, _("No unread messages")); /*Tray menu*/ mmguiapp->window->traymenu = gtk_menu_new(); /*Show window entry*/ mmguiapp->window->showwin_tm = gtk_check_menu_item_new_with_label(_("Show window")); gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(mmguiapp->window->showwin_tm), gtk_widget_get_visible(mmguiapp->window->window)); mmguiapp->window->traysigid = g_signal_connect(G_OBJECT(mmguiapp->window->showwin_tm), "toggled", G_CALLBACK(mmgui_main_tray_icon_window_show_signal), mmguiapp); /*Separator*/ mmguiapp->window->sep1_tm = gtk_separator_menu_item_new(); /*New SMS entry*/ mmguiapp->window->newsms_tm = gtk_menu_item_new_with_label(_("New SMS")); gtk_widget_set_sensitive(mmguiapp->window->newsms_tm, FALSE); g_signal_connect(G_OBJECT(mmguiapp->window->newsms_tm), "activate", G_CALLBACK(mmgui_main_tray_icon_new_sms_signal), mmguiapp); /*Separator 2*/ mmguiapp->window->sep2_tm = gtk_separator_menu_item_new(); /*Quit entry*/ mmguiapp->window->quit_tm = gtk_image_menu_item_new_from_stock(GTK_STOCK_QUIT, NULL); g_signal_connect(G_OBJECT(mmguiapp->window->quit_tm), "activate", G_CALLBACK(mmgui_main_tray_icon_exit_signal), mmguiapp); /*Packaging*/ gtk_menu_shell_append(GTK_MENU_SHELL(mmguiapp->window->traymenu), mmguiapp->window->showwin_tm); gtk_menu_shell_append(GTK_MENU_SHELL(mmguiapp->window->traymenu), mmguiapp->window->sep1_tm); gtk_menu_shell_append(GTK_MENU_SHELL(mmguiapp->window->traymenu), mmguiapp->window->newsms_tm); gtk_menu_shell_append(GTK_MENU_SHELL(mmguiapp->window->traymenu), mmguiapp->window->sep2_tm); gtk_menu_shell_append(GTK_MENU_SHELL(mmguiapp->window->traymenu), mmguiapp->window->quit_tm); gtk_widget_show_all(mmguiapp->window->traymenu); /*Tray menu signal*/ g_signal_connect(G_OBJECT(mmguiapp->window->statusicon), "popup-menu", G_CALLBACK(mmgui_main_tray_popup_menu_show_signal), mmguiapp); /*Tray tooltip signal*/ g_signal_connect(G_OBJECT(mmguiapp->window->statusicon), "query-tooltip", G_CALLBACK(mmgui_main_tray_tooltip_show_signal), mmguiapp); gtk_status_icon_set_has_tooltip(mmguiapp->window->statusicon, TRUE); return TRUE; } static void mmgui_main_application_terminate(mmgui_application_t mmguiapp) { GtkWidget *win; GList *wlist, *wnext; if (mmguiapp == NULL) return; #if GLIB_CHECK_VERSION(2,32,0) g_application_quit(G_APPLICATION(mmguiapp->gtkapplication)); #else wlist = gtk_application_get_windows(GTK_APPLICATION(mmguiapp->gtkapplication)); while (wlist) { win = wlist->data; wnext = wlist->next; gtk_widget_destroy(GTK_WIDGET(win)); wlist = wnext; } #endif } static void mmgui_main_application_startup_signal(GtkApplication *application, gpointer data) { mmgui_application_t mmguiapp; GMenu *menu; static GActionEntry app_actions[] = { { "preferences", mmgui_main_ui_preferences_menu_item_activate_signal, NULL, NULL, NULL }, { "about", mmgui_main_ui_about_menu_item_activate_signal, NULL, NULL, NULL }, { "quit", mmgui_main_ui_exit_menu_item_activate_signal, NULL, NULL, NULL }, }; mmguiapp = (mmgui_application_t)data; if ((application == NULL) || (mmguiapp == NULL)) return; g_action_map_add_action_entries(G_ACTION_MAP(application), app_actions, G_N_ELEMENTS(app_actions), mmguiapp); menu = g_menu_new(); g_menu_append(menu, _("Preferences"), "app.preferences"); gtk_application_add_accelerator(application, "p", "app.preferences", NULL); g_menu_append(menu, _("About"), "app.about"); g_menu_append(menu, _("Quit"), "app.quit"); gtk_application_add_accelerator(application, "q", "app.quit", NULL); gtk_application_set_app_menu(application, G_MENU_MODEL(menu)); g_object_unref(menu); } static void mmgui_main_application_activate_signal(GtkApplication *application, gpointer data) { mmgui_application_t mmguiapp; GList *windowlist; mmguiapp = (mmgui_application_t)data; if ((application == NULL) || (mmguiapp == NULL)) return; windowlist = gtk_application_get_windows(GTK_APPLICATION(application)); if (windowlist != NULL) { /*Present main window*/ gtk_window_present(GTK_WINDOW(windowlist->data)); /*Save window state*/ mmguiapp->options->minimized = FALSE; gmm_settings_set_boolean(mmguiapp->settings, "window_state_minimized", mmguiapp->options->minimized); } else { if (mmgui_main_application_build_user_interface(mmguiapp)) { /*Add main window to application window list*/ gtk_application_add_window(GTK_APPLICATION(application), GTK_WINDOW(mmguiapp->window->window)); /*Core object*/ mmguiapp->core = mmguicore_new(mmgui_main_event_callback, mmguiapp->limits, mmguiapp); if (mmguiapp->core == NULL) { mmgui_main_application_unresolved_error(mmguiapp, _("Error while initialization"), _("No one modem manager is available")); return; } /*Settings object*/ mmguiapp->settings = gmm_settings_open(RESOURCE_LOCALE_DOMAIN, "settings.conf"); /*Load global settings*/ mmgui_main_settings_load(mmguiapp); /*Upadate library cache: name needed libraries first*/ mmguiapp->libcache = mmgui_libpaths_cache_new("libnotify", "libcanberra", "libebook-1.2", "libmessaging-menu", "libindicate", NULL); /*Notifications object*/ mmguiapp->notifications = mmgui_notifications_new(mmguiapp->libcache); /*Address books object*/ mmguiapp->addressbooks = mmgui_addressbooks_new(mmguiapp->libcache); /*Open ayatana interface*/ mmguiapp->ayatana = mmgui_ayatana_new(mmguiapp->libcache, mmgui_main_ayatana_event_callback, mmguiapp); /*Get available devices*/ if (mmguiapp->core != NULL) { if (mmguicore_devices_enum(mmguiapp->core)) { mmgui_main_device_list_fill(mmguiapp); } } /*Load UI-specific settings and open device if any*/ mmgui_main_settings_ui_load(mmguiapp); /*Finally show window*/ if ((!mmguiapp->options->invisible) && (!mmguiapp->options->minimized)) { gtk_widget_show(mmguiapp->window->window); } /*Restore window geometry*/ if (mmguiapp->options->savegeometry) { if ((mmguiapp->options->wgwidth >= 1) && (mmguiapp->options->wgheight >= 1)) { gtk_window_resize(GTK_WINDOW(mmguiapp->window->window), mmguiapp->options->wgwidth, mmguiapp->options->wgheight); gtk_window_move(GTK_WINDOW(mmguiapp->window->window), mmguiapp->options->wgposx, mmguiapp->options->wgposy); } } /*Redraw traffic graph signal*/ g_signal_connect(G_OBJECT(mmguiapp->window->trafficdrawingarea), "draw", G_CALLBACK(mmgui_main_traffic_speed_plot_draw), mmguiapp); } else { mmgui_main_application_unresolved_error(mmguiapp, _("Error while initialization"), _("Interface building error")); return; } } } static void mmgui_main_application_shutdown_signal(GtkApplication *application, gpointer data) { mmgui_application_t mmguiapp; mmguiapp = (mmgui_application_t)data; if ((application == NULL) || (mmguiapp == NULL)) return; /*Close library cache*/ mmgui_libpaths_cache_close(mmguiapp->libcache); //Close notifications interface mmgui_notifications_close(mmguiapp->notifications); //Close addressbooks interface mmgui_addressbooks_close(mmguiapp->addressbooks); /*Close ayatana interface*/ mmgui_ayatana_close(mmguiapp->ayatana); //Close core interface mmguicore_close(mmguiapp->core); //Close settings interface gmm_settings_close(mmguiapp->settings); } #ifdef __GLIBC__ static void mmgui_main_application_backtrace_signal_handler(int sig, siginfo_t *info, ucontext_t *ucontext) { void *trace[10]; gchar **tracepoints = (char **)NULL; gint i, tracelen = 0; if (sig == SIGSEGV) { tracelen = backtrace(trace, 10); #if (defined(__i386__)) trace[1] = (void *) ucontext->uc_mcontext.gregs[REG_EIP]; #elif (defined(__x86_64__)) trace[1] = (void *) ucontext->uc_mcontext.gregs[REG_RIP]; #elif (defined(__ppc__) || defined(__powerpc__)) trace[1] = (void *) ucontext->uc_mcontext.regs->nip; #elif (defined(__arm__)) trace[1] = (void *) ucontext->uc_mcontext.arm_pc; #endif g_printf(_("Segmentation fault at address: %p\n"), info->si_addr); if (tracelen > 0) { g_printf(_("Stack trace:\n")); tracepoints = backtrace_symbols(trace, tracelen); for (i=1; ioptions = g_new0(struct _mmgui_cli_options, 1); mmguiapp->window = g_new0(struct _mmgui_main_window, 1); mmguiapp->limits = g_new0(struct _mmgui_traffic_limits, 1); //Predefined CLI options GOptionEntry entries[] = { { "invisible", 'i', 0, G_OPTION_ARG_NONE, &mmguiapp->options->invisible, _("Do not show window on start"), NULL }, //{ "nostatistics", 'n', 0, G_OPTION_ARG_NONE, &mmguiapp->options->nostatistics, "Disable traffic statistics", NULL }, //{ "nosmsupdate", 's', 0, G_OPTION_ARG_NONE, &mmguiapp->options->nosmsupdate, "Disable sms update", NULL }, { NULL } }; //Locale #ifndef LC_ALL #define LC_ALL 0 #endif //Backtrace handler #ifdef __GLIBC__ struct sigaction sa; sa.sa_sigaction = (void *)mmgui_main_application_backtrace_signal_handler; sigemptyset(&sa.sa_mask); sa.sa_flags = SA_RESTART | SA_SIGINFO; sigaction(SIGSEGV, &sa, NULL); #endif setlocale(LC_ALL, ""); bindtextdomain(RESOURCE_LOCALE_DOMAIN, RESOURCE_LOCALE_DIR); bind_textdomain_codeset(RESOURCE_LOCALE_DOMAIN, "UTF-8"); textdomain(RESOURCE_LOCALE_DOMAIN); g_set_application_name("Modem Manager GUI"); //CLI options parsing optcontext = g_option_context_new(_("- tool for EDGE/3G/4G modem specific functions control")); g_option_context_add_main_entries(optcontext, entries, RESOURCE_LOCALE_DOMAIN); g_option_context_add_group(optcontext, gtk_get_option_group(TRUE)); error = NULL; if (!g_option_context_parse(optcontext, &argc, &argv, &error)) { g_print(_("Command line option parsing failed: %s\n"), (error->message != NULL) ? error->message : "Unknown"); g_option_context_free(optcontext); g_error_free(error); g_free(mmguiapp->options); g_free(mmguiapp->window); g_free(mmguiapp->limits); g_free(mmguiapp); return EXIT_FAILURE; } g_option_context_free(optcontext); //Run GTK+ application mmguiapp->gtkapplication = gtk_application_new("org.gtk.ModemManagerGUI", 0); g_signal_connect(mmguiapp->gtkapplication, "startup", G_CALLBACK(mmgui_main_application_startup_signal), mmguiapp); g_signal_connect(mmguiapp->gtkapplication, "activate", G_CALLBACK(mmgui_main_application_activate_signal), mmguiapp); g_signal_connect(mmguiapp->gtkapplication, "shutdown", G_CALLBACK(mmgui_main_application_shutdown_signal), mmguiapp); status = g_application_run(G_APPLICATION(mmguiapp->gtkapplication), argc, argv); //Free previously allocated resources g_object_unref(G_OBJECT(mmguiapp->gtkapplication)); if (mmguiapp->options != NULL) { g_free(mmguiapp->options); } if (mmguiapp->window != NULL) { g_free(mmguiapp->window); } if (mmguiapp->limits != NULL) { g_free(mmguiapp->limits); } if (mmguiapp != NULL) { g_free(mmguiapp); } return status; } modem-manager-gui-0.0.16/src/main.h000066400000000000000000000015661217271411700167700ustar00rootroot00000000000000/* * main.h * * Copyright 2012-2013 Alex * * 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 . */ #ifndef __MAIN_H__ #define __MAIN_H__ #include #endif /* __MAIN_H__ */ modem-manager-gui-0.0.16/src/mmguicore.c000066400000000000000000002102701217271411700200200ustar00rootroot00000000000000/* * mmguicore.c * * Copyright 2013 Alex * * 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 . */ #include #include #include #include #include #include #include #include "mmguicore.h" #include "encoding.h" #include "smsdb.h" #include "trafficdb.h" #include "netlink.h" #include "resources.h" #define MMGUI_MIN_SMS_NUMBER_LENGTH 3 #define MMGUI_MAX_SMS_NUMBER_LENGTH 20 #define MMGUI_MIN_USSD_REQUEST_LENGTH 1 #define MMGUI_MAX_USSD_REQUEST_LENGTH 160 #define MMGUI_THREAD_STOP_CMD 0x00 gboolean mmguicore_devices_add(mmguicore_t mmguicore, mmguidevice_t device); gboolean mmguicore_devices_remove(mmguicore_t mmguicore, guint deviceid); gboolean mmguicore_devices_close(mmguicore_t mmguicore); void mmguicore_networks_scan_free(GSList *networks); static gchar *mmguicore_ussd_gsm7_to_ucs2(gchar *srcstr); static void mmguicore_contacts_free(GSList *contacts); static guint mmguicore_contacts_enum(mmguicore_t mmguicore); static gpointer mmguicore_work_thread(gpointer data); static void mmguicore_traffic_count(mmguicore_t mmguicore, guint64 rxbytes, guint64 txbytes); static void mmguicore_traffic_zero(mmguicore_t mmguicore); static gboolean mmgucore_get_device_traffic(mmguicore_t mmguicore, mmgui_traffic_stats_t stats); static void mmguicore_traffic_limits(mmguicore_t mmguicore); static void mmguicore_event_callback(enum _mmgui_event event, gpointer mmguicore, gpointer data) { mmguicore_t mmguicorelc; gchar *ussdanswer; mmguicorelc = (mmguicore_t)mmguicore; if (mmguicorelc == NULL) return; switch (event) { case MMGUI_EVENT_DEVICE_ADDED: mmguicore_devices_add(mmguicore, (mmguidevice_t)data); if (mmguicorelc->extcb != NULL) { (mmguicorelc->extcb)(event, mmguicorelc, data, mmguicorelc->userdata); } break; case MMGUI_EVENT_DEVICE_REMOVED: mmguicore_devices_remove(mmguicore, GPOINTER_TO_UINT(data)); if (mmguicorelc->extcb != NULL) { (mmguicorelc->extcb)(event, mmguicorelc, data, mmguicorelc->userdata); } break; case MMGUI_EVENT_DEVICE_ENABLED_STATUS: if (mmguicorelc->extcb != NULL) { (mmguicorelc->extcb)(event, mmguicorelc, data, mmguicorelc->userdata); } break; case MMGUI_EVENT_DEVICE_BLOCKED_STATUS: if (mmguicorelc->extcb != NULL) { (mmguicorelc->extcb)(event, mmguicorelc, data, mmguicorelc->userdata); } break; case MMGUI_EVENT_DEVICE_CONNECTION_STATUS: if (mmguicorelc->extcb != NULL) { (mmguicorelc->extcb)(event, mmguicorelc, data, mmguicorelc->userdata); } break; case MMGUI_EVENT_SMS_LIST_READY: if (mmguicorelc->extcb != NULL) { (mmguicorelc->extcb)(event, mmguicorelc, data, mmguicorelc->userdata); } break; case MMGUI_EVENT_SMS_COMPLETED: if (mmguicorelc->extcb != NULL) { (mmguicorelc->extcb)(event, mmguicorelc, data, mmguicorelc->userdata); } break; case MMGUI_EVENT_SMS_SENT: if (mmguicorelc->extcb != NULL) { (mmguicorelc->extcb)(event, mmguicorelc, data, mmguicorelc->userdata); } break; case MMGUI_EVENT_USSD_RESULT: if (mmguicore_ussd_get_encoding(mmguicore) == MMGUI_USSD_ENCODING_GSM7) { ussdanswer = (gchar *)data; } else if (mmguicore_ussd_get_encoding(mmguicore) == MMGUI_USSD_ENCODING_UCS2) { ussdanswer = mmguicore_ussd_gsm7_to_ucs2((gchar *)data); } if (mmguicorelc->extcb != NULL) { (mmguicorelc->extcb)(event, mmguicorelc, ussdanswer, mmguicorelc->userdata); } break; case MMGUI_EVENT_SCAN_RESULT: if (mmguicorelc->extcb != NULL) { (mmguicorelc->extcb)(event, mmguicorelc, data, mmguicorelc->userdata); } break; case MMGUI_EVENT_SIGNAL_LEVEL_CHANGE: if (mmguicorelc->extcb != NULL) { (mmguicorelc->extcb)(event, mmguicorelc, data, mmguicorelc->userdata); } break; case MMGUI_EVENT_NETWORK_MODE_CHANGE: if (mmguicorelc->extcb != NULL) { (mmguicorelc->extcb)(event, mmguicorelc, data, mmguicorelc->userdata); } break; case MMGUI_EVENT_NETWORK_REGISTRATION_CHANGE: if (mmguicorelc->extcb != NULL) { (mmguicorelc->extcb)(event, mmguicorelc, data, mmguicorelc->userdata); } break; case MMGUI_EVENT_MODEM_ENABLE_RESULT: /*Update device information*/ if (mmguicorelc->devices_information_func != NULL) { (mmguicorelc->devices_information_func)(mmguicorelc); } if (mmguicorelc->extcb != NULL) { (mmguicorelc->extcb)(event, mmguicorelc, data, mmguicorelc->userdata); } break; default: break; } } static void mmguicore_system_services_destroy_notify(gpointer data) { if (data != NULL) g_free(data); } static GHashTable *mmguicore_system_services_enum(void) { GDBusConnection *connection; GDBusProxy *proxy; GVariant *services; GError *error; GVariantIter siterl1, siterl2; GVariant *snodel1, *snodel2; gsize snamesize; gchar *servicename; GHashTable *serviceshash; error = NULL; connection = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error); if ((connection == NULL) && (error != NULL)) { g_debug("Core error: %s\n", error->message); g_error_free(error); return NULL; } error = NULL; proxy = g_dbus_proxy_new_sync(connection, G_DBUS_PROXY_FLAGS_NONE, NULL, "org.freedesktop.DBus", "/org/freedesktop/DBus", "org.freedesktop.DBus", NULL, &error); if ((proxy == NULL) && (error != NULL)) { g_debug("Core error: %s\n", error->message); g_error_free(error); g_object_unref(connection); return NULL; } error = NULL; services = g_dbus_proxy_call_sync(proxy, "ListNames", NULL, 0, -1, NULL, &error); if ((services == NULL) && (error != NULL)) { g_debug("Core error: %s\n", error->message); g_error_free(error); g_object_unref(proxy); g_object_unref(connection); return NULL; } serviceshash = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, mmguicore_system_services_destroy_notify); g_variant_iter_init(&siterl1, services); while ((snodel1 = g_variant_iter_next_value(&siterl1)) != NULL) { g_variant_iter_init(&siterl2, snodel1); while ((snodel2 = g_variant_iter_next_value(&siterl2)) != NULL) { snamesize = 256; servicename = g_strdup(g_variant_get_string(snodel2, &snamesize)); g_hash_table_insert(serviceshash, (gpointer)servicename, (gpointer)servicename); g_variant_unref(snodel2); } g_variant_unref(snodel1); } g_variant_unref(services); g_object_unref(proxy); g_object_unref(connection); return serviceshash; } static gint mmguicore_modules_sort(gconstpointer a, gconstpointer b) { mmguimodule_t mod1, mod2; mod1 = (mmguimodule_t)a; mod2 = (mmguimodule_t)b; if (mod1->priority == mod2->priority) { if (mod1->identifier == mod2->identifier) { return 0; } else if (mod1->identifier > mod2->identifier) { return 1; } else if (mod1->identifier < mod2->identifier) { return -1; } } else if (mod1->priority > mod2->priority) { return 1; } else if (mod1->priority < mod2->priority) { return -1; } } guint mmguicore_modules_enum(mmguicore_t mmguicore) { GHashTable *services; guint number = 0; GDir *moddir; const gchar *modname; gsize length; const gchar modext[] = ".so"; gchar *modpath; GModule *module; mmgui_module_init_func module_init; gboolean applicable; struct _mmguimodule smodule, *dmodule; if (mmguicore == NULL) return 0; services = mmguicore_system_services_enum(); if (services == NULL) return 0; moddir = g_dir_open(RESOURCE_MODULES_DIR, 0, NULL); if (moddir != NULL) { while ((modname = g_dir_read_name(moddir)) != NULL) { //Test file extension and filename length length = strlen(modname); if ((length > 3) && (length < 256) && (strncmp((const char *)modname + length - 3, (const char *)&modext, 3) == 0)) { modpath = g_strconcat(RESOURCE_MODULES_DIR, modname, NULL); if (g_file_test(modpath, G_FILE_TEST_EXISTS)) { //Open module module = g_module_open(modpath, G_MODULE_BIND_LAZY); if (module != NULL) { //Call init function if (g_module_symbol(module, "mmgui_module_init", (gpointer*)&module_init)) { if (module_init(&smodule)) { //Test service/file existence applicable = FALSE; switch (smodule.requirement) { case MMGUI_MODULE_REQUIREMENT_SERVICE: if (g_hash_table_lookup(services, smodule.servicename) != NULL) { applicable = TRUE; } break; case MMGUI_MODULE_REQUIREMENT_FILE: if (g_file_test(smodule.servicename, G_FILE_TEST_EXISTS)) { applicable = TRUE; } break; case MMGUI_MODULE_REQUIREMENT_NONE: applicable = TRUE; break; default: break; } //Add service to list if applicable if (applicable) { dmodule = g_malloc0(sizeof(struct _mmguimodule)); memcpy(dmodule, &smodule, sizeof(struct _mmguimodule)); strncpy(dmodule->filename, modname, length); dmodule->filename[length] = '\0'; mmguicore->modules = g_slist_prepend(mmguicore->modules, dmodule); g_printf("Module applicable: %s (%s)\n", dmodule->description, dmodule->filename); number++; } } } //Close module g_module_close(module); } } g_free(modpath); } } g_dir_close(moddir); } if (number > 0) { mmguicore->modules = g_slist_sort(mmguicore->modules, mmguicore_modules_sort); mmguicore->modules = g_slist_reverse(mmguicore->modules); } g_hash_table_destroy(services); return number; } static gboolean mmguicore_modules_free(mmguicore_t mmguicore) { if (mmguicore == NULL) return FALSE; if (mmguicore->modules == NULL) return FALSE; g_slist_free(mmguicore->modules); return TRUE; } static gboolean mmguicore_modules_mm_open(mmguicore_t mmguicore, mmguimodule_t mmguimodule) { gboolean openstatus; gchar *modulepath; if ((mmguicore == NULL) || (mmguimodule == NULL)) return FALSE; if (mmguimodule->type == MMGUI_MODULE_TYPE_CONNECTION_MANGER) return FALSE; modulepath = g_strconcat(RESOURCE_MODULES_DIR, mmguimodule->filename, NULL); mmguicore->module = g_module_open(modulepath, G_MODULE_BIND_LAZY); if (mmguicore->module != NULL) { openstatus = TRUE; //Module function pointers openstatus = openstatus && g_module_symbol(mmguicore->module, "mmgui_module_open", (gpointer *)&(mmguicore->open_func)); openstatus = openstatus && g_module_symbol(mmguicore->module, "mmgui_module_close", (gpointer *)&(mmguicore->close_func)); openstatus = openstatus && g_module_symbol(mmguicore->module, "mmgui_module_last_error", (gpointer *)&(mmguicore->last_error_func)); openstatus = openstatus && g_module_symbol(mmguicore->module, "mmgui_module_interrupt_operation", (gpointer *)&(mmguicore->interrupt_operation_func)); openstatus = openstatus && g_module_symbol(mmguicore->module, "mmgui_module_set_timeout", (gpointer *)&(mmguicore->set_timeout_func)); openstatus = openstatus && g_module_symbol(mmguicore->module, "mmgui_module_devices_enum", (gpointer *)&(mmguicore->devices_enum_func)); openstatus = openstatus && g_module_symbol(mmguicore->module, "mmgui_module_devices_open", (gpointer *)&(mmguicore->devices_open_func)); openstatus = openstatus && g_module_symbol(mmguicore->module, "mmgui_module_devices_close", (gpointer *)&(mmguicore->devices_close_func)); openstatus = openstatus && g_module_symbol(mmguicore->module, "mmgui_module_devices_state", (gpointer *)&(mmguicore->devices_state_func)); openstatus = openstatus && g_module_symbol(mmguicore->module, "mmgui_module_devices_update_state", (gpointer *)&(mmguicore->devices_update_state_func)); openstatus = openstatus && g_module_symbol(mmguicore->module, "mmgui_module_devices_information", (gpointer *)&(mmguicore->devices_information_func)); openstatus = openstatus && g_module_symbol(mmguicore->module, "mmgui_module_devices_enable", (gpointer *)&(mmguicore->devices_enable_func)); openstatus = openstatus && g_module_symbol(mmguicore->module, "mmgui_module_sms_enum", (gpointer *)&(mmguicore->sms_enum_func)); openstatus = openstatus && g_module_symbol(mmguicore->module, "mmgui_module_sms_get", (gpointer *)&(mmguicore->sms_get_func)); openstatus = openstatus && g_module_symbol(mmguicore->module, "mmgui_module_sms_delete", (gpointer *)&(mmguicore->sms_delete_func)); openstatus = openstatus && g_module_symbol(mmguicore->module, "mmgui_module_sms_send", (gpointer *)&(mmguicore->sms_send_func)); openstatus = openstatus && g_module_symbol(mmguicore->module, "mmgui_module_ussd_cancel_session", (gpointer *)&(mmguicore->ussd_cancel_session_func)); openstatus = openstatus && g_module_symbol(mmguicore->module, "mmgui_module_ussd_get_state", (gpointer *)&(mmguicore->ussd_get_state_func)); openstatus = openstatus && g_module_symbol(mmguicore->module, "mmgui_module_ussd_send", (gpointer *)&(mmguicore->ussd_send_func)); openstatus = openstatus && g_module_symbol(mmguicore->module, "mmgui_module_networks_scan", (gpointer *)&(mmguicore->networks_scan_func)); openstatus = openstatus && g_module_symbol(mmguicore->module, "mmgui_module_contacts_enum", (gpointer *)&(mmguicore->contacts_enum_func)); openstatus = openstatus && g_module_symbol(mmguicore->module, "mmgui_module_contacts_delete", (gpointer *)&(mmguicore->contacts_delete_func)); openstatus = openstatus && g_module_symbol(mmguicore->module, "mmgui_module_contacts_add", (gpointer *)&(mmguicore->contacts_add_func)); if (!openstatus) { //Module function pointers mmguicore->open_func = NULL; mmguicore->close_func = NULL; mmguicore->last_error_func = NULL; mmguicore->interrupt_operation_func = NULL; mmguicore->set_timeout_func = NULL; mmguicore->devices_enum_func = NULL; mmguicore->devices_open_func = NULL; mmguicore->devices_close_func = NULL; mmguicore->devices_state_func = NULL; mmguicore->devices_update_state_func = NULL; mmguicore->devices_information_func = NULL; mmguicore->devices_enable_func = NULL; mmguicore->sms_enum_func = NULL; mmguicore->sms_get_func = NULL; mmguicore->sms_delete_func = NULL; mmguicore->sms_send_func = NULL; mmguicore->ussd_cancel_session_func = NULL; mmguicore->ussd_get_state_func = NULL; mmguicore->ussd_send_func = NULL; mmguicore->networks_scan_func = NULL; mmguicore->contacts_enum_func = NULL; mmguicore->contacts_delete_func = NULL; mmguicore->contacts_add_func = NULL; g_module_close(mmguicore->module); g_printf("Failed to load modem manager: %s\n", mmguimodule->description); } } else { openstatus = FALSE; } g_free(modulepath); if (openstatus) { mmguicore->moduleptr = mmguimodule; (mmguicore->open_func)(mmguicore); g_printf("Modem manager: %s\n", mmguimodule->description); } else { mmguicore->moduleptr = NULL; mmguicore->module = NULL; } return openstatus; } static gboolean mmguicore_modules_cm_open(mmguicore_t mmguicore, mmguimodule_t mmguimodule) { gboolean openstatus; gchar *modulepath; if ((mmguicore == NULL) || (mmguimodule == NULL)) return FALSE; if (mmguimodule->type == MMGUI_MODULE_TYPE_MODEM_MANAGER) return FALSE; modulepath = g_strconcat(RESOURCE_MODULES_DIR, mmguimodule->filename, NULL); mmguicore->cmodule = g_module_open(modulepath, G_MODULE_BIND_LAZY); if (mmguicore->cmodule != NULL) { openstatus = TRUE; //Module function pointers openstatus = openstatus && g_module_symbol(mmguicore->cmodule, "mmgui_module_connection_open", (gpointer *)&(mmguicore->connection_open_func)); openstatus = openstatus && g_module_symbol(mmguicore->cmodule, "mmgui_module_connection_close", (gpointer *)&(mmguicore->connection_close_func)); openstatus = openstatus && g_module_symbol(mmguicore->cmodule, "mmgui_module_connection_last_error", (gpointer *)&(mmguicore->connection_last_error_func)); openstatus = openstatus && g_module_symbol(mmguicore->cmodule, "mmgui_module_device_connection_open", (gpointer *)&(mmguicore->device_connection_open_func)); openstatus = openstatus && g_module_symbol(mmguicore->cmodule, "mmgui_module_device_connection_close", (gpointer *)&(mmguicore->device_connection_close_func)); openstatus = openstatus && g_module_symbol(mmguicore->cmodule, "mmgui_module_device_connection_status", (gpointer *)&(mmguicore->device_connection_status_func)); openstatus = openstatus && g_module_symbol(mmguicore->cmodule, "mmgui_module_device_connection_timestamp", (gpointer *)&(mmguicore->device_connection_timestamp_func)); openstatus = openstatus && g_module_symbol(mmguicore->cmodule, "mmgui_module_device_connection_disconnect", (gpointer *)&(mmguicore->device_connection_disconnect_func)); if (!openstatus) { //Module function pointers mmguicore->connection_open_func = NULL; mmguicore->connection_close_func = NULL; mmguicore->connection_last_error_func = NULL; mmguicore->device_connection_open_func = NULL; mmguicore->device_connection_close_func = NULL; mmguicore->device_connection_status_func = NULL; mmguicore->device_connection_timestamp_func = NULL; mmguicore->device_connection_disconnect_func = NULL; g_module_close(mmguicore->cmodule); } } else { openstatus = FALSE; } g_free(modulepath); if (openstatus) { mmguicore->cmoduleptr = mmguimodule; (mmguicore->connection_open_func)(mmguicore); g_printf("Connection manager: %s\n", mmguimodule->description); } else { mmguicore->cmoduleptr = NULL; mmguicore->cmodule = NULL; } return openstatus; } static gboolean mmguicore_modules_close(mmguicore_t mmguicore) { if (mmguicore == NULL) return FALSE; //Modem manager module functions if (mmguicore->module != NULL) { if (mmguicore->close_func != NULL) { mmguicore->close_func(mmguicore); } g_module_close(mmguicore->module); mmguicore->module = NULL; //Module function pointers mmguicore->open_func = NULL; mmguicore->close_func = NULL; mmguicore->last_error_func = NULL; mmguicore->devices_enum_func = NULL; mmguicore->devices_open_func = NULL; mmguicore->devices_close_func = NULL; mmguicore->devices_state_func = NULL; mmguicore->devices_update_state_func = NULL; mmguicore->devices_information_func = NULL; mmguicore->devices_enable_func = NULL; mmguicore->sms_enum_func = NULL; mmguicore->sms_get_func = NULL; mmguicore->sms_delete_func = NULL; mmguicore->sms_send_func = NULL; mmguicore->ussd_cancel_session_func = NULL; mmguicore->ussd_get_state_func = NULL; mmguicore->ussd_send_func = NULL; mmguicore->networks_scan_func = NULL; mmguicore->contacts_enum_func = NULL; mmguicore->contacts_delete_func = NULL; mmguicore->contacts_add_func = NULL; mmguicore->moduleptr = NULL; } //Connection manager module functions if (mmguicore->cmodule != NULL) { if (mmguicore->connection_close_func != NULL) { mmguicore->connection_close_func(mmguicore); } g_module_close(mmguicore->cmodule); mmguicore->cmodule = NULL; //Module function pointers mmguicore->connection_open_func = NULL; mmguicore->connection_close_func = NULL; mmguicore->connection_last_error_func = NULL; mmguicore->device_connection_open_func = NULL; mmguicore->device_connection_close_func = NULL; mmguicore->device_connection_status_func = NULL; mmguicore->device_connection_timestamp_func = NULL; mmguicore->device_connection_disconnect_func = NULL; mmguicore->cmoduleptr = NULL; } return TRUE; } static gboolean mmguicore_modules_select(mmguicore_t mmguicore) { GSList *iterator; mmguimodule_t module; gboolean mmfound, cmfound; if (mmguicore == NULL) return FALSE; if (mmguicore->modules == NULL) return FALSE; if ((mmguicore->module != NULL) || (mmguicore->cmodule != NULL)) { mmguicore_modules_close(mmguicore); } mmfound = FALSE; cmfound = FALSE; for (iterator=mmguicore->modules; iterator; iterator=iterator->next) { module = iterator->data; if ((module->type == MMGUI_MODULE_TYPE_MODEM_MANAGER) && (!mmfound)) { mmfound = mmguicore_modules_mm_open(mmguicore, module); } else if ((module->type == MMGUI_MODULE_TYPE_CONNECTION_MANGER) && (!cmfound)) { cmfound = mmguicore_modules_cm_open(mmguicore, module); } else if ((mmfound) && (cmfound)) { break; } } return mmfound; } static void mmguicore_devices_free_single(mmguidevice_t device) { if (device != NULL) return; if (device->manufacturer != NULL) { g_free(device->manufacturer); } if (device->model != NULL) { g_free(device->model); } if (device->version != NULL) { g_free(device->version); } if (device->port != NULL) { g_free(device->port); } if (device->objectpath != NULL) { g_free(device->objectpath); } if (device->sysfspath != NULL) { g_free(device->sysfspath); } if (device->internalid != NULL) { g_free(device->internalid); } if (device->persistentid != NULL) { g_free(device->persistentid); } if (device->imei != NULL) { g_free(device->imei); } if (device->imsi != NULL) { g_free(device->imsi); } if (device->operatorcode != NULL) { g_free(device->operatorcode); } } static void mmguicore_devices_free_foreach(gpointer data, gpointer user_data) { mmguidevice_t device; if (data != NULL) return; device = (mmguidevice_t)data; mmguicore_devices_free_single(device); } static void mmguicore_devices_free(mmguicore_t mmguicore) { if (mmguicore == NULL) return; g_slist_foreach(mmguicore->devices, mmguicore_devices_free_foreach, NULL); g_slist_free(mmguicore->devices); mmguicore->devices = NULL; } gboolean mmguicore_devices_enum(mmguicore_t mmguicore) { GSList *iterator; mmguidevice_t device; if ((mmguicore == NULL) || (mmguicore->devices_enum_func == NULL)) return FALSE; if (mmguicore->devices != NULL) { mmguicore_devices_free(mmguicore); } (mmguicore->devices_enum_func)(mmguicore, &(mmguicore->devices)); for (iterator=mmguicore->devices; iterator; iterator=iterator->next) { device = iterator->data; printf("Device: %s, %s, %s [%u] [%s]\n", device->manufacturer, device->model, device->version, device->id, device->persistentid); } return TRUE; } gboolean mmguicore_devices_add(mmguicore_t mmguicore, mmguidevice_t device) { if ((mmguicore == NULL) || (device == NULL)) return FALSE; mmguicore->devices = g_slist_append(mmguicore->devices, device); g_printf("Device successfully added\n"); return TRUE; } static gint mmguicore_devices_remove_compare(gconstpointer a, gconstpointer b) { mmguidevice_t device; guint id; device = (mmguidevice_t)a; id = GPOINTER_TO_UINT(b); if (device->id < id) { return 1; } else if (device->id > id) { return -1; } else { return 0; } } gboolean mmguicore_devices_remove(mmguicore_t mmguicore, guint deviceid) { GSList *deviceptr; if (mmguicore == NULL) return FALSE; if (mmguicore->devices == NULL) return FALSE; deviceptr = g_slist_find_custom(mmguicore->devices, GUINT_TO_POINTER(deviceid), mmguicore_devices_remove_compare); if (deviceptr != NULL) { if (mmguicore->device != NULL) { if (mmguicore->device->id == deviceid) { //Close currently opened device mmguicore_devices_close(mmguicore); } } //Remove device structure from list mmguicore->devices = g_slist_remove(mmguicore->devices, deviceptr->data); //Free device structure mmguicore_devices_free_single(deviceptr->data); //g_printf("Device successfully removed\n"); return TRUE; } else { return FALSE; } } static gint mmguicore_devices_open_compare(gconstpointer a, gconstpointer b) { mmguidevice_t device; guint id; device = (mmguidevice_t)a; id = GPOINTER_TO_UINT(b); if (device->id < id) { return 1; } else if (device->id > id) { return -1; } else { return 0; } } gboolean mmguicore_devices_open(mmguicore_t mmguicore, guint deviceid, gboolean openfirst) { GSList *deviceptr; if (mmguicore == NULL) return FALSE; if ((mmguicore->devices == NULL) || (mmguicore->devices_open_func == NULL)) return FALSE; deviceptr = g_slist_find_custom(mmguicore->devices, GUINT_TO_POINTER(deviceid), mmguicore_devices_open_compare); if (deviceptr != NULL) { //Test currently opened device if (mmguicore->device != NULL) { if (mmguicore->device->id == deviceid) { //Already opened return TRUE; } else { //Close currently opened device mmguicore_devices_close(mmguicore); } } if ((mmguicore->devices_open_func)(mmguicore, deviceptr->data)) { mmguicore->device = deviceptr->data; //Update device information if (mmguicore->devices_information_func != NULL) { (mmguicore->devices_information_func)(mmguicore); //Open SMS database mmguicore->device->smsdb = mmgui_smsdb_open(mmguicore->device->persistentid, mmguicore->device->internalid); //Open traffic database mmguicore->device->trafficdb = mmgui_trafficdb_open(mmguicore->device->persistentid, mmguicore->device->internalid); //Open contacts mmguicore_contacts_enum(mmguicore); //For Huawei modem USSD answers must be converted if (g_ascii_strcasecmp(mmguicore->device->manufacturer, "huawei") == 0) { mmguicore->device->ussdencoding = MMGUI_USSD_ENCODING_UCS2; } else { mmguicore->device->ussdencoding = MMGUI_USSD_ENCODING_GSM7; } } //Open connection statistics source if (mmguicore->device_connection_open_func != NULL) { (mmguicore->device_connection_open_func)(mmguicore, deviceptr->data); } g_printf("Device successfully opened\n"); return TRUE; } } else if ((openfirst) && (deviceptr == NULL) && (mmguicore->devices != NULL)) { //Open first available device if specified is not found if (mmguicore->devices->data != NULL) { if (mmguicore->device != NULL) { //Close currently opened device mmguicore_devices_close(mmguicore); } if ((mmguicore->devices_open_func)(mmguicore, mmguicore->devices->data)) { mmguicore->device = mmguicore->devices->data; //Update device information if (mmguicore->devices_information_func != NULL) { (mmguicore->devices_information_func)(mmguicore); //Open SMS database mmguicore->device->smsdb = mmgui_smsdb_open(mmguicore->device->persistentid, mmguicore->device->internalid); //Open traffic database mmguicore->device->trafficdb = mmgui_trafficdb_open(mmguicore->device->persistentid, mmguicore->device->internalid); //Open contacts mmguicore_contacts_enum(mmguicore); //For Huawei modem USSD answers must be converted if (g_ascii_strcasecmp(mmguicore->device->manufacturer, "huawei") == 0) { mmguicore->device->ussdencoding = MMGUI_USSD_ENCODING_UCS2; } else { mmguicore->device->ussdencoding = MMGUI_USSD_ENCODING_GSM7; } } //Open connection statistics source if (mmguicore->device_connection_open_func != NULL) { (mmguicore->device_connection_open_func)(mmguicore, mmguicore->devices->data); } g_printf("First available device successfully opened\n"); return TRUE; } } } return FALSE; } gboolean mmguicore_devices_close(mmguicore_t mmguicore) { gboolean result; #if GLIB_CHECK_VERSION(2,32,0) g_mutex_lock(&mmguicore->workthreadmutex); #else g_mutex_lock(mmguicore->workthreadmutex); #endif result = FALSE; if (mmguicore->device != NULL) { if ((mmguicore->devices_close_func)(mmguicore)) { //Close SMS database mmguicore->device->smscaps = MMGUI_SMS_CAPS_NONE; mmgui_smsdb_close(mmguicore->device->smsdb); mmguicore->device->smsdb = NULL; //Close contacts mmguicore->device->contactscaps = MMGUI_CONTACTS_CAPS_NONE; mmguicore_contacts_free(mmguicore->device->contactslist); mmguicore->device->contactslist = NULL; //Info if (mmguicore->device->operatorname != NULL) { g_free(mmguicore->device->operatorname); mmguicore->device->operatorname = NULL; } if (mmguicore->device->operatorcode != NULL) { g_free(mmguicore->device->operatorcode); mmguicore->device->operatorcode = NULL; } if (mmguicore->device->imei != NULL) { g_free(mmguicore->device->imei); mmguicore->device->imei = NULL; } if (mmguicore->device->imsi != NULL) { g_free(mmguicore->device->imsi); mmguicore->device->imsi = NULL; } //USSD mmguicore->device->ussdcaps = MMGUI_USSD_CAPS_NONE; mmguicore->device->ussdencoding = MMGUI_USSD_ENCODING_GSM7; //Location mmguicore->device->locationcaps = MMGUI_LOCATION_CAPS_NONE; memset(mmguicore->device->loc3gppdata, 0, sizeof(mmguicore->device->loc3gppdata)); memset(mmguicore->device->locgpsdata, 0, sizeof(mmguicore->device->locgpsdata)); //Scan mmguicore->device->scancaps = MMGUI_SCAN_CAPS_NONE; //Close traffic database session mmgui_trafficdb_session_close(mmguicore->device->trafficdb); //Close traffic database mmgui_trafficdb_close(mmguicore->device->trafficdb); mmguicore->device->trafficdb = NULL; //Traffic mmguicore->device->rxbytes = 0; mmguicore->device->txbytes = 0; mmguicore->device->sessiontime = 0; mmguicore->device->speedchecktime = 0; mmguicore->device->smschecktime = 0; mmguicore->device->speedindex = 0; mmguicore->device->connected = FALSE; memset(mmguicore->device->speedvalues, 0, sizeof(mmguicore->device->speedvalues)); memset(mmguicore->device->interface, 0, sizeof(mmguicore->device->interface)); //Zero traffic values in UI mmguicore_traffic_zero(mmguicore); //Close connection state source if (mmguicore->device_connection_close_func != NULL) { (mmguicore->device_connection_close_func)(mmguicore); } //Device mmguicore->device = NULL; //Successfully closed g_printf("Device successfully closed\n"); result = TRUE; } } #if GLIB_CHECK_VERSION(2,32,0) g_mutex_unlock(&mmguicore->workthreadmutex); #else g_mutex_unlock(mmguicore->workthreadmutex); #endif return result; } gboolean mmguicore_devices_enable(mmguicore_t mmguicore, gboolean enabled) { if (mmguicore == NULL) return FALSE; if ((mmguicore->device == NULL) || (mmguicore->devices_enable_func == NULL)) return FALSE; return (mmguicore->devices_enable_func)(mmguicore, enabled); } GSList *mmguicore_devices_get_list(mmguicore_t mmguicore) { if (mmguicore == NULL) return NULL; return mmguicore->devices; } mmguidevice_t mmguicore_devices_get_current(mmguicore_t mmguicore) { if (mmguicore == NULL) return NULL; return mmguicore->device; } gboolean mmguicore_devices_get_enabled(mmguicore_t mmguicore) { if (mmguicore == NULL) return FALSE; if ((mmguicore->device == NULL) || (mmguicore->devices_state_func == NULL)) return FALSE; return (mmguicore->devices_state_func)(mmguicore, MMGUI_DEVICE_STATE_REQUEST_ENABLED); } gboolean mmguicore_devices_get_locked(mmguicore_t mmguicore) { if (mmguicore == NULL) return FALSE; if ((mmguicore->device == NULL) || (mmguicore->devices_state_func == NULL)) return FALSE; return (mmguicore->devices_state_func)(mmguicore, MMGUI_DEVICE_STATE_REQUEST_LOCKED); } gboolean mmguicore_devices_get_registered(mmguicore_t mmguicore) { if (mmguicore == NULL) return FALSE; if ((mmguicore->device == NULL) || (mmguicore->devices_state_func == NULL)) return FALSE; return (mmguicore->devices_state_func)(mmguicore, MMGUI_DEVICE_STATE_REQUEST_REGISTERED); } gboolean mmguicore_devices_get_connected(mmguicore_t mmguicore) { if (mmguicore == NULL) return FALSE; if (mmguicore->device == NULL) return FALSE; return mmguicore->device->connected; } gboolean mmguicore_devices_update_device_state(mmguicore_t mmguicore) { gboolean updated; if (mmguicore == NULL) return FALSE; if ((mmguicore->device == NULL) || (mmguicore->devices_update_state_func == NULL)) return FALSE; updated = FALSE; updated = (mmguicore->devices_update_state_func)(mmguicore); return updated; } const gchar *mmguicore_devices_get_identifier(mmguicore_t mmguicore) { if (mmguicore == NULL) return NULL; if (mmguicore->device == NULL) return NULL; return (const gchar *)mmguicore->device->persistentid; } const gchar *mmguicore_devices_get_internal_identifier(mmguicore_t mmguicore) { if (mmguicore == NULL) return NULL; if (mmguicore->device == NULL) return NULL; return (const gchar *)mmguicore->device->internalid; } gpointer mmguicore_devices_get_sms_db(mmguicore_t mmguicore) { if (mmguicore == NULL) return NULL; if (mmguicore->device == NULL) return NULL; return (gpointer)mmguicore->device->smsdb; } gpointer mmguicore_devices_get_traffic_db(mmguicore_t mmguicore) { if (mmguicore == NULL) return NULL; if (mmguicore->device == NULL) return NULL; return (gpointer)mmguicore->device->trafficdb; } gboolean mmguicore_devices_get_connection_status(mmguicore_t mmguicore) { if (mmguicore == NULL) return FALSE; if ((mmguicore->device == NULL) || (mmguicore->device_connection_status_func == NULL)) return FALSE; return (mmguicore->device_connection_status_func)(mmguicore); } guint64 mmguicore_devices_get_connection_timestamp(mmguicore_t mmguicore) { guint64 timestamp; timestamp = (guint64)time(NULL); if (mmguicore == NULL) return timestamp; if ((mmguicore->device == NULL) || (mmguicore->device_connection_timestamp_func == NULL)) return timestamp; timestamp = (mmguicore->device_connection_timestamp_func)(mmguicore); return timestamp; } guint mmguicore_devices_get_current_operation(mmguicore_t mmguicore) { if (mmguicore == NULL) return MMGUI_DEVICE_OPERATION_IDLE; if (mmguicore->device == NULL) return MMGUI_DEVICE_OPERATION_IDLE; return mmguicore->device->operation; } guint mmguicore_location_get_capabilities(mmguicore_t mmguicore) { if (mmguicore == NULL) return MMGUI_LOCATION_CAPS_NONE; if (mmguicore->device == NULL) return MMGUI_LOCATION_CAPS_NONE; return mmguicore->device->locationcaps; } guint mmguicore_sms_get_capabilities(mmguicore_t mmguicore) { if (mmguicore == NULL) return MMGUI_SMS_CAPS_NONE; if (mmguicore->device == NULL) return MMGUI_SMS_CAPS_NONE; return mmguicore->device->smscaps; } static gint mmguicore_sms_sort_index_compare(gconstpointer a, gconstpointer b) { mmgui_sms_message_t message1, message2; guint id1, id2; message1 = (mmgui_sms_message_t)a; message2 = (mmgui_sms_message_t)b; id1 = mmgui_smsdb_message_get_identifier(message1); id2 = mmgui_smsdb_message_get_identifier(message2); if (id1 < id2) { return -1; } else if (id1 > id2) { return 1; } else { return 0; } } static gint mmguicore_sms_sort_timestamp_compare(gconstpointer a, gconstpointer b) { mmgui_sms_message_t message1, message2; time_t ts1, ts2; message1 = (mmgui_sms_message_t)a; message2 = (mmgui_sms_message_t)b; ts1 = mmgui_smsdb_message_get_timestamp(message1); ts2 = mmgui_smsdb_message_get_timestamp(message2); if (difftime(ts1, ts2) < 0.0) { return -1; } else if (difftime(ts1, ts2) > 0.0) { return 1; } else { return 0; } } static void mmguicore_sms_merge_foreach(gpointer data, gpointer user_data) { mmgui_sms_message_t curmessage, srcmessage; const gchar *srcnumber, *curnumber; time_t srcts, curts; gboolean srcbinary, curbinary; guint ident; const gchar *text; curmessage = (mmgui_sms_message_t)data; srcmessage = (mmgui_sms_message_t)user_data; if ((srcmessage == NULL) || (srcmessage == curmessage) || (mmgui_smsdb_message_get_read(curmessage))) return; /*Number*/ srcnumber = mmgui_smsdb_message_get_number(srcmessage); curnumber = mmgui_smsdb_message_get_number(curmessage); /*Timestamp*/ srcts = mmgui_smsdb_message_get_timestamp(srcmessage); curts = mmgui_smsdb_message_get_timestamp(curmessage); /*Binary format*/ srcbinary = mmgui_smsdb_message_get_binary(srcmessage); curbinary = mmgui_smsdb_message_get_binary(curmessage); if ((g_str_equal(srcnumber, curnumber)) && (srcbinary == curbinary)) { if (abs((gint)difftime(srcts, curts)) <= 5) { //Copy identifier ident = mmgui_smsdb_message_get_identifier(curmessage); mmgui_smsdb_message_set_identifier(srcmessage, ident, TRUE); //Copy decoded text text = mmgui_smsdb_message_get_text(curmessage); if (!srcbinary) { mmgui_smsdb_message_set_text(srcmessage, text, TRUE); } else { mmgui_smsdb_message_set_binary(srcmessage, FALSE); mmgui_smsdb_message_set_text(srcmessage, text, TRUE); mmgui_smsdb_message_set_binary(srcmessage, TRUE); } //Mark message obsolete mmgui_smsdb_message_set_read(curmessage, TRUE); } } } GSList *mmguicore_sms_enum(mmguicore_t mmguicore, gboolean concatenation) { GSList *messages; guint nummessages; GSList *iterator; mmgui_sms_message_t message; if ((mmguicore == NULL) || (mmguicore->sms_enum_func == NULL)) return NULL; messages = NULL; nummessages = (mmguicore->sms_enum_func)(mmguicore, &messages); if (nummessages > 1) { if (concatenation) { //Sort messages by index messages = g_slist_sort(messages, mmguicore_sms_sort_index_compare); //Try to concatenate every message and mark already concatenated with 'read' flag for (iterator=messages; iterator; iterator=iterator->next) { message = iterator->data; if (!mmgui_smsdb_message_get_read(message)) { g_slist_foreach(messages, mmguicore_sms_merge_foreach, message); } } } //After all, sort messages by timestamp messages = g_slist_sort(messages, mmguicore_sms_sort_timestamp_compare); } return messages; } mmgui_sms_message_t mmguicore_sms_get(mmguicore_t mmguicore, guint index) { mmgui_sms_message_t message; if ((mmguicore == NULL) || (mmguicore->sms_get_func == NULL)) return NULL; message = (mmguicore->sms_get_func)(mmguicore, index); return message; } gboolean mmguicore_sms_delete(mmguicore_t mmguicore, guint index) { if ((mmguicore == NULL) || (mmguicore->sms_delete_func == NULL)) return FALSE; return (mmguicore->sms_delete_func)(mmguicore, index); } gboolean mmguicore_sms_validate_number(const gchar *number) { gboolean validated; gsize length, digitlength, i; validated = TRUE; if ((number != NULL) && (number[0] != '\0')) { length = strlen(number); if (number[0] == '+') { digitlength = length-1; } else { digitlength = length; } if ((digitlength < MMGUI_MIN_SMS_NUMBER_LENGTH) || (digitlength > MMGUI_MAX_SMS_NUMBER_LENGTH)) { validated = FALSE; } else { for (i=0; isms_send_func == NULL)) return FALSE; if ((number == NULL) || (text == NULL)) return FALSE; if ((!mmguicore_sms_validate_number(number)) || (text[0] == '\0')) return FALSE; return (mmguicore->sms_send_func)(mmguicore, number, text); } guint mmguicore_ussd_get_capabilities(mmguicore_t mmguicore) { if (mmguicore == NULL) return MMGUI_USSD_CAPS_NONE; if (mmguicore->device == NULL) return MMGUI_USSD_CAPS_NONE; return mmguicore->device->ussdcaps; } static gchar *mmguicore_ussd_gsm7_to_ucs2(gchar *srcstr) { gchar *decstr1, *decstr2; gsize strsize; gboolean srcstrvalid; if (srcstr == NULL) return NULL; decstr1 = g_strdup(srcstr); strsize = strlen(srcstr); srcstrvalid = g_utf8_validate((const gchar *)srcstr, -1, (const gchar **)NULL); if (strsize > 0) { /*Map UTF8 symbols using GSM7 table*/ decstr2 = utf8_map_gsm7(decstr1, strsize, &strsize); if (decstr2 != NULL) { /*Free temporary string and go next step*/ g_free(decstr1); } else { /*Return undecoded hash*/ return decstr1; } /*Translate UTF8 to GSM7*/ decstr1 = utf8_to_gsm7(decstr2, strsize, &strsize); if (decstr1 != NULL) { /*Free temporary string and go next step*/ g_free(decstr2); } else { /*String not decoded*/ if (srcstrvalid) { /*Return valid source string*/ g_free(decstr2); return g_strdup(srcstr); } else { /*Return undecoded hash*/ return decstr2; } } /*Translate UCS2 to UTF8*/ decstr2 = ucs2_to_utf8(decstr1, strsize, &strsize); if (decstr2 != NULL) { if (g_utf8_validate((const gchar *)decstr2, -1, (const gchar **)NULL)) { /*Decoded string validated*/ g_free(decstr1); return decstr2; } else { /*Decoded string not validated*/ g_free(decstr2); if (srcstrvalid) { /*Return valid source string*/ g_free(decstr1); return g_strdup(srcstr); } else { /*Return undecoded hash*/ return decstr1; } } } else { /*String not decoded*/ if (srcstrvalid) { /*Return valid source string*/ g_free(decstr1); return g_strdup(srcstr); } else { /*Return undecoded hash*/ return decstr1; } } } } enum _mmgui_ussd_validation mmguicore_ussd_validate_request(gchar *request) { enum _mmgui_ussd_validation statusid; gsize length, i; gboolean wrongsym; statusid = MMGUI_USSD_VALIDATION_INVALID; if ((request == NULL) && (request[0] == '\0')) return statusid; length = strlen(request); if (length > MMGUI_MAX_USSD_REQUEST_LENGTH) return statusid; if ((request[0] == '*') && (request[length-1] == '#') && (length > 2)) { wrongsym = FALSE; for (i=0; iussd_cancel_session_func == NULL)) return FALSE; return (mmguicore->ussd_cancel_session_func)(mmguicore); } enum _mmgui_ussd_state mmguicore_ussd_get_state(mmguicore_t mmguicore) { enum _mmgui_ussd_state stateid; stateid = MMGUI_USSD_STATE_UNKNOWN; if ((mmguicore == NULL) || (mmguicore->ussd_get_state_func == NULL)) return stateid; stateid = (mmguicore->ussd_get_state_func)(mmguicore); return stateid; } gboolean mmguicore_ussd_send(mmguicore_t mmguicore, gchar *request) { enum _mmgui_ussd_validation validationid; if ((mmguicore == NULL) || (mmguicore->ussd_send_func == NULL)) return FALSE; if (request == NULL) return FALSE; validationid = mmguicore_ussd_validate_request(request); return (mmguicore->ussd_send_func)(mmguicore, request, validationid); } gboolean mmguicore_ussd_set_encoding(mmguicore_t mmguicore, enum _mmgui_ussd_encoding encoding) { if ((mmguicore == NULL) || (mmguicore->device == NULL)) return FALSE; mmguicore->device->ussdencoding = encoding; return TRUE; } enum _mmgui_ussd_encoding mmguicore_ussd_get_encoding(mmguicore_t mmguicore) { if ((mmguicore == NULL) || (mmguicore->device == NULL)) return MMGUI_USSD_ENCODING_GSM7; return mmguicore->device->ussdencoding; } guint mmguicore_newtworks_scan_get_capabilities(mmguicore_t mmguicore) { if (mmguicore == NULL) return MMGUI_SCAN_CAPS_NONE; if (mmguicore->device == NULL) return MMGUI_SCAN_CAPS_NONE; return mmguicore->device->scancaps; } static void mmguicore_networks_scan_free_foreach(gpointer data, gpointer user_data) { mmgui_scanned_network_t network; if (data == NULL) return; network = (mmgui_scanned_network_t)data; if (network->operator_long != NULL) { g_free(network->operator_long); } if (network->operator_short != NULL) { g_free(network->operator_short); } } void mmguicore_networks_scan_free(GSList *networks) { if (networks == NULL) return; g_slist_foreach(networks, mmguicore_networks_scan_free_foreach, NULL); g_slist_free(networks); } gboolean mmguicore_networks_scan(mmguicore_t mmguicore) { if ((mmguicore == NULL) || (mmguicore->networks_scan_func == NULL)) return FALSE; return (mmguicore->networks_scan_func)(mmguicore); } guint mmguicore_contacts_get_capabilities(mmguicore_t mmguicore) { if (mmguicore == NULL) return MMGUI_CONTACTS_CAPS_NONE; if (mmguicore->device == NULL) return MMGUI_CONTACTS_CAPS_NONE; return mmguicore->device->contactscaps; } void mmguicore_contacts_free_single(mmgui_contact_t contact, gboolean freestruct) { if (contact == NULL) return; if (contact->name != NULL) { g_free(contact->name); } if (contact->number != NULL) { g_free(contact->number); } if (contact->email != NULL) { g_free(contact->email); } if (contact->group != NULL) { g_free(contact->group); } if (contact->name2 != NULL) { g_free(contact->name2); } if (contact->number2 != NULL) { g_free(contact->number2); } //Free contact structure if (freestruct) { g_free(contact); } } static void mmguicore_contacts_free_foreach(gpointer data, gpointer user_data) { mmgui_contact_t contact; if (data == NULL) return; contact = (mmgui_contact_t)data; mmguicore_contacts_free_single(contact, FALSE); } static void mmguicore_contacts_free(GSList *contacts) { if (contacts == NULL) return; g_slist_foreach(contacts, mmguicore_contacts_free_foreach, NULL); g_slist_free(contacts); } static guint mmguicore_contacts_enum(mmguicore_t mmguicore) { guint numcontacts; if ((mmguicore == NULL) || (mmguicore->contacts_enum_func == NULL)) return 0; if (mmguicore->device == NULL) return 0; if (mmguicore->device->contactslist != NULL) { mmguicore_contacts_free(mmguicore->device->contactslist); mmguicore->device->contactslist = NULL; } numcontacts = (mmguicore->contacts_enum_func)(mmguicore, &(mmguicore->device->contactslist)); return numcontacts; } GSList *mmguicore_contacts_list(mmguicore_t mmguicore) { if (mmguicore == NULL) return NULL; if (mmguicore->device == NULL) return NULL; if (!(mmguicore->device->contactscaps & MMGUI_CONTACTS_CAPS_EXPORT)) return NULL; return mmguicore->device->contactslist; } static gint mmguicore_contacts_get_compare(gconstpointer a, gconstpointer b) { mmgui_contact_t contact; guint id; contact = (mmgui_contact_t)a; id = GPOINTER_TO_UINT(b); if (contact->id < id) { return 1; } else if (contact->id > id) { return -1; } else { return 0; } } mmgui_contact_t mmguicore_contacts_get(mmguicore_t mmguicore, guint index) { GSList *contactptr; mmgui_contact_t contact; if (mmguicore == NULL) return NULL; if (mmguicore->device == NULL) return NULL; if (!(mmguicore->device->contactscaps & MMGUI_CONTACTS_CAPS_EXPORT)) return NULL; contactptr = g_slist_find_custom(mmguicore->device->contactslist, GUINT_TO_POINTER(index), mmguicore_contacts_get_compare); if (contactptr != NULL) { contact = (mmgui_contact_t)contactptr->data; return contact; } else { return NULL; } } static gint mmguicore_contacts_delete_compare(gconstpointer a, gconstpointer b) { mmgui_contact_t contact; guint id; contact = (mmgui_contact_t)a; id = GPOINTER_TO_UINT(b); if (contact->id < id) { return 1; } else if (contact->id > id) { return -1; } else { return 0; } } gboolean mmguicore_contacts_delete(mmguicore_t mmguicore, guint index) { gboolean result; GSList *contactptr; if ((mmguicore == NULL) || (mmguicore->contacts_delete_func == NULL)) return FALSE; if (mmguicore->device == NULL) return FALSE; if (!(mmguicore->device->contactscaps & MMGUI_CONTACTS_CAPS_EDIT)) return FALSE; result = (mmguicore->contacts_delete_func)(mmguicore, index); if (result) { contactptr = g_slist_find_custom(mmguicore->device->contactslist, GUINT_TO_POINTER(index), mmguicore_contacts_delete_compare); if (contactptr != NULL) { //Remove contact from list mmguicore_contacts_free_single(contactptr->data, FALSE); mmguicore->device->contactslist = g_slist_remove(mmguicore->device->contactslist, contactptr->data); } return TRUE; } else { return FALSE; } } gboolean mmguicore_contacts_add(mmguicore_t mmguicore, mmgui_contact_t contact) { gint index; if ((mmguicore == NULL) || (contact == NULL) || (mmguicore->contacts_add_func == NULL)) return FALSE; if ((contact->name == NULL) || (contact->number == NULL)) return FALSE; if ((!mmguicore_sms_validate_number(contact->number)) || (contact->name[0] == '\0')) return FALSE; if (!(mmguicore->device->contactscaps & MMGUI_CONTACTS_CAPS_EDIT)) return FALSE; index = (mmguicore->contacts_add_func)(mmguicore, contact); if (index > -1) { mmguicore->device->contactslist = g_slist_append(mmguicore->device->contactslist, contact); return TRUE; } else { return FALSE; } } GHashTable *mmguicore_connections_sync(mmguicore_t mmguicore) { GHashTableIter iter; gpointer key, value, extvalue; GSList *inslist, *rmlist, *iterator; mmgui_ext_connection_t extconnection; mmgui_netlink_connection_t nlconnection; if (mmguicore == NULL) return NULL; if ((mmguicore->netlink == NULL) || (mmguicore->connections == NULL)) return NULL; #if GLIB_CHECK_VERSION(2,32,0) g_mutex_lock(&mmguicore->connsyncmutex); #else g_mutex_lock(mmguicore->connsyncmutex); #endif inslist = NULL; rmlist = NULL; g_hash_table_iter_init(&iter, mmguicore->connections); while (g_hash_table_iter_next(&iter, &key, &value)) { extconnection = (mmgui_ext_connection_t)value; extconnection->existsflag = FALSE; } g_hash_table_iter_init(&iter, mmguicore->netlink->connections); while (g_hash_table_iter_next(&iter, &key, &value)) { nlconnection = (mmgui_netlink_connection_t)value; extvalue = g_hash_table_lookup(mmguicore->connections, key); if (nlconnection != NULL) { if (extvalue != NULL) { extconnection = (mmgui_ext_connection_t)extvalue; extconnection->state = nlconnection->state; extconnection->dqueue = nlconnection->dqueue; extconnection->existsflag = TRUE; } else { extconnection = g_new0(struct _mmgui_ext_connection, 1); extconnection->state = nlconnection->state; extconnection->family = nlconnection->family; extconnection->srcport = nlconnection->srcport; extconnection->dqueue = nlconnection->dqueue; extconnection->inode = nlconnection->inode; extconnection->userid = nlconnection->userid; extconnection->apppid = nlconnection->apppid; extconnection->appname = g_strdup(nlconnection->appname); extconnection->dsthostname = g_strdup(nlconnection->dsthostname); memcpy(extconnection->srcaddr, nlconnection->srcaddr, sizeof(extconnection->srcaddr)); memcpy(extconnection->dstaddr, nlconnection->dstaddr, sizeof(extconnection->dstaddr)); extconnection->existsflag = TRUE; inslist = g_slist_prepend(inslist, extconnection); } } } if (inslist != NULL) { for (iterator=inslist; iterator; iterator=iterator->next) { extconnection = (mmgui_ext_connection_t)iterator->data; g_hash_table_insert(mmguicore->connections, (gpointer)&extconnection->inode, extconnection); } g_slist_free(inslist); } g_hash_table_iter_init(&iter, mmguicore->connections); while (g_hash_table_iter_next(&iter, &key, &value)) { extconnection = (mmgui_ext_connection_t)value; if (!extconnection->existsflag) { rmlist = g_slist_prepend(rmlist, extconnection); } else { extconnection->existsflag = FALSE; } } if (rmlist != NULL) { for (iterator=rmlist; iterator; iterator=iterator->next) { extconnection = (mmgui_ext_connection_t)iterator->data; g_hash_table_remove(mmguicore->connections, (gpointer)&extconnection->inode); } g_slist_free(rmlist); } #if GLIB_CHECK_VERSION(2,32,0) g_mutex_unlock(&mmguicore->connsyncmutex); #else g_mutex_unlock(mmguicore->connsyncmutex); #endif return mmguicore->connections; } static void mmguicore_connections_hash_destroy(gpointer data) { mmgui_ext_connection_t connection; connection = (mmgui_ext_connection_t)data; if (connection->appname != NULL) { g_free(connection->appname); } if (connection->dsthostname != NULL) { g_free(connection->dsthostname); } if (connection != NULL) { g_free(connection); } } gchar *mmguicore_get_last_error(mmguicore_t mmguicore) { if ((mmguicore == NULL) || (mmguicore->last_error_func == NULL)) return NULL; return (mmguicore->last_error_func)(mmguicore); } gchar *mmguicore_get_last_connection_error(mmguicore_t mmguicore) { if ((mmguicore == NULL) || (mmguicore->connection_last_error_func == NULL)) return NULL; return (mmguicore->connection_last_error_func)(mmguicore); } gboolean mmguicore_interrupt_operation(mmguicore_t mmguicore) { if ((mmguicore == NULL) || (mmguicore->interrupt_operation_func == NULL)) return FALSE; return (mmguicore->interrupt_operation_func)(mmguicore); } mmguicore_t mmguicore_new(mmgui_event_ext_callback callback, mmgui_traffic_limits_t limits, gpointer userdata) { mmguicore_t mmguicore; mmguicore = g_new0(struct _mmguicore, 1); //Modules mmguicore->modules = NULL; //Modem manager module mmguicore->module = NULL; mmguicore->moduleptr = NULL; mmguicore->module = NULL; //Connection manager module mmguicore->cmodule = NULL; mmguicore->cmoduleptr = NULL; mmguicore->cmodule = NULL; //Modem manager module functions mmguicore->open_func = NULL; mmguicore->close_func = NULL; mmguicore->last_error_func = NULL; mmguicore->interrupt_operation_func = NULL; mmguicore->set_timeout_func = NULL; mmguicore->devices_enum_func = NULL; mmguicore->devices_open_func = NULL; mmguicore->devices_close_func = NULL; mmguicore->devices_state_func = NULL; mmguicore->devices_update_state_func = NULL; mmguicore->devices_information_func = NULL; mmguicore->devices_enable_func = NULL; mmguicore->sms_enum_func = NULL; mmguicore->sms_get_func = NULL; mmguicore->sms_delete_func = NULL; mmguicore->sms_send_func = NULL; mmguicore->ussd_cancel_session_func = NULL; mmguicore->ussd_get_state_func = NULL; mmguicore->ussd_send_func = NULL; mmguicore->networks_scan_func = NULL; mmguicore->contacts_enum_func = NULL; mmguicore->contacts_delete_func = NULL; mmguicore->contacts_add_func = NULL; //Connection manager module functions mmguicore->connection_open_func = NULL; mmguicore->connection_close_func = NULL; mmguicore->connection_last_error_func = NULL; mmguicore->device_connection_open_func = NULL; mmguicore->device_connection_close_func = NULL; mmguicore->device_connection_status_func = NULL; mmguicore->device_connection_timestamp_func = NULL; mmguicore->device_connection_disconnect_func = NULL; //Devices mmguicore->devices = NULL; mmguicore->device = NULL; //Internal callback mmguicore->eventcb = mmguicore_event_callback; //External callback mmguicore->extcb = callback; //Traffic limits mmguicore->limits = limits; //User data pointer mmguicore->userdata = userdata; //Open netlink interface mmguicore->netlink = mmgui_netlink_open(); //Create connections hash table mmguicore->connections = g_hash_table_new_full(g_int_hash, g_int_equal, NULL, (GDestroyNotify)mmguicore_connections_hash_destroy); //Enumerate available modules if (!mmguicore_modules_enum(mmguicore)) { g_free(mmguicore); g_debug("No modules found\n"); return NULL; } //Select module if (!mmguicore_modules_select(mmguicore)) { mmguicore_modules_close(mmguicore); mmguicore_modules_free(mmguicore); g_free(mmguicore); return NULL; } //Work thread if (pipe(mmguicore->workthreadctl) == 0) { #if GLIB_CHECK_VERSION(2,32,0) g_mutex_init(&mmguicore->workthreadmutex); g_mutex_init(&mmguicore->connsyncmutex); #else mmguicore->workthreadmutex = g_mutex_new(); mmguicore->connsyncmutex = g_mutex_new(); #endif #if GLIB_CHECK_VERSION(2,32,0) mmguicore->workthread = g_thread_new("Modem Manager GUI work thread", mmguicore_work_thread, mmguicore); #else mmguicore->workthread = g_thread_create(mmguicore_work_thread, mmguicore, TRUE, NULL); #endif } else { mmguicore->workthread = NULL; } return mmguicore; } void mmguicore_close(mmguicore_t mmguicore) { guint workthreadcmd; if (mmguicore == NULL) return; //Close opened device mmguicore_devices_close(mmguicore); //Stop work thread workthreadcmd = MMGUI_THREAD_STOP_CMD; if (mmguicore->workthread != NULL) { //Lock mutex #if GLIB_CHECK_VERSION(2,32,0) g_mutex_lock(&mmguicore->workthreadmutex); #else g_mutex_lock(mmguicore->workthreadmutex); #endif //Send command for thread termination if (write(mmguicore->workthreadctl[0], &workthreadcmd, sizeof(workthreadcmd)) > 0) { //Wait for thread termination g_thread_join(mmguicore->workthread); //Close thread control pipe close(mmguicore->workthreadctl[0]); //Drop mutex #if GLIB_CHECK_VERSION(2,32,0) g_mutex_clear(&mmguicore->workthreadmutex); g_mutex_clear(&mmguicore->connsyncmutex); #else g_mutex_free(mmguicore->workthreadmutex); g_mutex_free(mmguicore->connsyncmutex); #endif } } //Close netlink interface mmgui_netlink_close(mmguicore->netlink); //Destroy connections hash table g_hash_table_destroy(mmguicore->connections); //Close opened modules mmguicore_modules_close(mmguicore); //Free modules list mmguicore_modules_free(mmguicore); g_free(mmguicore); } static gpointer mmguicore_work_thread(gpointer data) { mmguicore_t mmguicore; //Shared buffer gchar databuf[8192]; //Polling variables guint activesockets; gint pollstatus; gint recvbytes; struct pollfd pollfds[3]; //Work thread control gint ctlfd, ctlfdnum; gint workthreadcmd; //Interface monitoring gint intfd, intfdnum; struct iovec intiov = {databuf, sizeof(databuf)}; struct msghdr intmsg; //Connections monitoring gint connfd, connfdnum; struct iovec conniov = {databuf, sizeof(databuf)}; struct msghdr connmsg; //Events struct _mmgui_netlink_interface_event event; time_t ifstatetime, currenttime; gboolean oldstate; gchar oldinterface[IFNAMSIZ]; mmguicore = (mmguicore_t)data; if (mmguicore == NULL) return NULL; activesockets = 0; ctlfd = mmguicore->workthreadctl[1]; if (ctlfd != -1) { ctlfdnum = activesockets; pollfds[ctlfdnum].fd = ctlfd; pollfds[ctlfdnum].events = POLLIN; activesockets++; } intfd = mmgui_netlink_get_interfaces_monitoring_socket_fd(mmguicore->netlink); if (intfd != -1) { intfdnum = activesockets; pollfds[intfdnum].fd = intfd; pollfds[intfdnum].events = POLLIN; intmsg.msg_name = (void *)mmgui_netlink_get_interfaces_monitoring_socket_address(mmguicore->netlink); intmsg.msg_namelen = sizeof(struct sockaddr_nl); intmsg.msg_iov = &intiov; intmsg.msg_iovlen = 1; intmsg.msg_control = NULL; intmsg.msg_controllen = 0; intmsg.msg_flags = 0; activesockets++; } connfd = mmgui_netlink_get_connections_monitoring_socket_fd(mmguicore->netlink); if (connfd != -1) { connfdnum = activesockets; pollfds[connfdnum].fd = connfd; pollfds[connfdnum].events = POLLIN; connmsg.msg_name = (void *)mmgui_netlink_get_connections_monitoring_socket_address(mmguicore->netlink); connmsg.msg_namelen = sizeof(struct sockaddr_nl); connmsg.msg_iov = &conniov; connmsg.msg_iovlen = 1; connmsg.msg_control = NULL; connmsg.msg_controllen = 0; connmsg.msg_flags = 0; activesockets++; } //First we have to get device state ifstatetime = time(NULL); while (TRUE) { pollstatus = poll(pollfds, activesockets, 1000); if (pollstatus > 0) { //Work thread control if (pollfds[ctlfdnum].revents & POLLIN) { recvbytes = read(ctlfd, &workthreadcmd, sizeof(workthreadcmd)); if (recvbytes > 0) { if (workthreadcmd == MMGUI_THREAD_STOP_CMD) { //Terminate thread break; } } else { g_debug("Work thread: Control command not received\n"); } } } //Lock mutex and work with device in safe mode #if GLIB_CHECK_VERSION(2,32,0) g_mutex_lock(&mmguicore->workthreadmutex); #else g_mutex_lock(mmguicore->workthreadmutex); #endif currenttime = time(NULL); if (mmguicore->device != NULL) { if (abs((gint)difftime(ifstatetime, currenttime)) <= 5) { //Save old values g_debug("Requesting network interface state information\n"); oldstate = mmguicore->device->connected; strncpy(oldinterface, mmguicore->device->interface, sizeof(oldinterface)); //Request new information if (mmguicore_devices_get_connection_status(mmguicore)) { g_debug("Got new interface state\n"); if ((oldstate != mmguicore->device->connected) || (!g_str_equal(oldinterface, mmguicore->device->interface))) { //State changed, no need to request information more ifstatetime = 0; //Zero values on disconnect if (!mmguicore->device->connected) { //Close traffic database session mmgui_trafficdb_session_close(mmguicore->device->trafficdb); //Zero traffic values in UI mmguicore_traffic_zero(mmguicore); /*Device disconnect signal*/ if (mmguicore->extcb != NULL) { (mmguicore->extcb)(MMGUI_EVENT_DEVICE_CONNECTION_STATUS, mmguicore, GUINT_TO_POINTER(FALSE), mmguicore->userdata); } } else { /*Get session start timestamp*/ mmguicore->device->sessionstarttime = (time_t)mmguicore_devices_get_connection_timestamp(mmguicore); mmguicore->device->sessiontime = llabs((gint64)difftime(currenttime, mmguicore->device->sessionstarttime)); g_debug("Session start time: %" G_GUINT64_FORMAT ", duration: %" G_GUINT64_FORMAT "\n", (guint64)mmguicore->device->sessionstarttime, mmguicore->device->sessiontime); //Open traffic database session mmgui_trafficdb_session_new(mmguicore->device->trafficdb, mmguicore->device->sessionstarttime); /*Device connect signal*/ if (mmguicore->extcb != NULL) { (mmguicore->extcb)(MMGUI_EVENT_DEVICE_CONNECTION_STATUS, mmguicore, GUINT_TO_POINTER(TRUE), mmguicore->userdata); } } g_debug("Interface state changed\n"); } } } } if (pollstatus == 0) { //Timeout - request data if (mmguicore->device != NULL) { if (mmguicore->device->connected) { mmgui_netlink_request_interface_statistics(mmguicore->netlink, mmguicore->device->interface); mmgui_netlink_request_connections_list(mmguicore->netlink, AF_INET | AF_INET6); } } } else if (pollstatus > 0) { //New data available //Interface monitoring if (pollfds[intfdnum].revents & POLLIN) { recvbytes = recvmsg(intfd, &intmsg, 0); if (recvbytes) { if (mmgui_netlink_read_interface_event(mmguicore->netlink, databuf, recvbytes, &event)) { //Traffic statisctics available if (event.type & MMGUI_NETLINK_INTERFACE_EVENT_TYPE_STATS) { if (mmguicore->device != NULL) { if ((mmguicore->device->connected) && (g_str_equal(mmguicore->device->interface, event.ifname))) { //Count traffic mmguicore_traffic_count(mmguicore, event.rxbytes, event.txbytes); } } } //Interface created if (event.type & MMGUI_NETLINK_INTERFACE_EVENT_TYPE_ADD) { g_debug("Created network interface event\n"); if (mmguicore->device != NULL) { if (!mmguicore->device->connected) { g_debug("Created network interface event signal\n"); ifstatetime = time(NULL); } } } //Interface removed if (event.type & MMGUI_NETLINK_INTERFACE_EVENT_TYPE_REMOVE) { g_debug("Removed network interface event\n"); if (mmguicore->device != NULL) { if ((mmguicore->device->connected) && (g_str_equal(mmguicore->device->interface, event.ifname))) { g_debug("Removed network interface event signal\n"); ifstatetime = time(NULL); } } } } } else { g_debug("Work thread: interface event not received\n"); } } //Connections monitoring if (pollfds[connfdnum].revents & POLLIN) { recvbytes = recvmsg(connfd, &connmsg, 0); if (recvbytes) { #if GLIB_CHECK_VERSION(2,32,0) g_mutex_lock(&mmguicore->connsyncmutex); #else g_mutex_lock(mmguicore->connsyncmutex); #endif if (mmgui_netlink_read_connections_list(mmguicore->netlink, databuf, recvbytes)) { if (mmguicore->extcb != NULL) { (mmguicore->extcb)(MMGUI_EVENT_UPDATE_CONNECTIONS_LIST, mmguicore, mmgui_netlink_get_connections_list(mmguicore->netlink), mmguicore->userdata); } } #if GLIB_CHECK_VERSION(2,32,0) g_mutex_unlock(&mmguicore->connsyncmutex); #else g_mutex_unlock(mmguicore->connsyncmutex); #endif } else { g_debug("Work thread: connections data not received\n"); } } } //Update internal device state mmguicore_devices_update_device_state(mmguicore); //Handle traffic limits mmguicore_traffic_limits(mmguicore); //Unlock mutex after work finished #if GLIB_CHECK_VERSION(2,32,0) g_mutex_unlock(&mmguicore->workthreadmutex); #else g_mutex_unlock(mmguicore->workthreadmutex); #endif } //Close thread control pipe descriptor close(mmguicore->workthreadctl[1]); return NULL; } static void mmguicore_traffic_count(mmguicore_t mmguicore, guint64 rxbytes, guint64 txbytes) { mmguidevice_t device; time_t currenttime; guint timeframe; struct _mmgui_traffic_update trafficupd; if (mmguicore == NULL) return; device = mmguicore->device; if (device == NULL) return; currenttime = time(NULL); if ((device->connected) && (device->rxbytes <= rxbytes) && (device->txbytes <= txbytes)) { if (device->speedchecktime != 0) { //Time period for speed calculation timeframe = (guint)difftime(currenttime, device->speedchecktime); device->sessiontime += timeframe; if (device->speedindex < MMGUI_SPEED_VALUES_NUMBER) { //Add new speed value device->speedvalues[0][device->speedindex] = (gfloat)((rxbytes - device->rxbytes)*8)/(gfloat)(timeframe*1024); device->speedvalues[1][device->speedindex] = (gfloat)((txbytes - device->txbytes)*8)/(gfloat)(timeframe*1024); device->speedindex++; } else { //Move speed values and add new one memmove(&device->speedvalues[0][0], &device->speedvalues[0][1], sizeof(device->speedvalues[0]) - sizeof(device->speedvalues[0][0])); memmove(&device->speedvalues[1][0], &device->speedvalues[1][1], sizeof(device->speedvalues[1]) - sizeof(device->speedvalues[1][0])); device->speedvalues[0][MMGUI_SPEED_VALUES_NUMBER-1] = (gfloat)((rxbytes - device->rxbytes)*8)/(gfloat)(timeframe*1024); device->speedvalues[1][MMGUI_SPEED_VALUES_NUMBER-1] = (gfloat)((txbytes - device->txbytes)*8)/(gfloat)(timeframe*1024); } /*Update database*/ trafficupd.fullrxbytes = device->rxbytes; trafficupd.fulltxbytes = device->txbytes; trafficupd.fulltime = device->sessiontime; trafficupd.deltarxbytes = rxbytes - device->rxbytes; trafficupd.deltatxbytes = txbytes - device->txbytes; trafficupd.deltaduration = timeframe; mmgui_trafficdb_traffic_update(mmguicore->device->trafficdb, &trafficupd); } //Update traffic count device->rxbytes = rxbytes; device->txbytes = txbytes; } //Set last update time device->speedchecktime = currenttime; //Callback if (mmguicore->extcb != NULL) { (mmguicore->extcb)(MMGUI_EVENT_NET_STATUS, mmguicore, device, mmguicore->userdata); } } static void mmguicore_traffic_zero(mmguicore_t mmguicore) { mmguidevice_t device; if (mmguicore == NULL) return; device = mmguicore->device; if (device == NULL) return; //Zero speed values if device is not connected anymore mmguicore->device->speedindex = 0; mmguicore->device->speedvalues[0][0] = 0.0; mmguicore->device->speedvalues[1][0] = 0.0; mmguicore->device->rxbytes = 0; mmguicore->device->txbytes = 0; //Set last update time mmguicore->device->speedchecktime = time(NULL); //Callback if (mmguicore->extcb != NULL) { (mmguicore->extcb)(MMGUI_EVENT_NET_STATUS, mmguicore, NULL, mmguicore->userdata); } } static void mmguicore_traffic_limits(mmguicore_t mmguicore) { if (mmguicore == NULL) return; if ((mmguicore->limits != NULL) && (mmguicore->device != NULL)) { //Traffic limit if (mmguicore->limits->trafficenabled) { if ((!mmguicore->limits->trafficexecuted) && (mmguicore->limits->trafficfull < (mmguicore->device->rxbytes + mmguicore->device->txbytes))) { mmguicore->limits->trafficexecuted = TRUE; if (mmguicore->limits->trafficaction == MMGUI_EVENT_ACTION_DISCONNECT) { if (mmguicore->device_connection_disconnect_func != NULL) { (mmguicore->device_connection_disconnect_func)(mmguicore); } } //Callback if (mmguicore->extcb != NULL) { (mmguicore->extcb)(MMGUI_EVENT_TRAFFIC_LIMIT, mmguicore, NULL, mmguicore->userdata); } } } //Time limit if (mmguicore->limits->timeenabled) { if ((!mmguicore->limits->timeexecuted) && (mmguicore->limits->timefull < mmguicore->device->sessiontime)) { mmguicore->limits->timeexecuted = TRUE; if (mmguicore->limits->timeaction == MMGUI_EVENT_ACTION_DISCONNECT) { if (mmguicore->device_connection_disconnect_func != NULL) { (mmguicore->device_connection_disconnect_func)(mmguicore); } } //Callback if (mmguicore->extcb != NULL) { (mmguicore->extcb)(MMGUI_EVENT_TIME_LIMIT, mmguicore, NULL, mmguicore->userdata); } } } } } modem-manager-gui-0.0.16/src/mmguicore.h000066400000000000000000000436021217271411700200300ustar00rootroot00000000000000/* * mmguicore.h * * Copyright 2013 Alex * * 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 . */ #ifndef __MMGUICORE_H__ #define __MMGUICORE_H__ #include #include #include #include "netlink.h" #include "smsdb.h" #define MMGUI_SPEED_VALUES_NUMBER 20 #define MMGUI_THREAD_SLEEP_PERIOD 1 /*seconds*/ enum _mmgui_event { MMGUI_EVENT_DEVICE_ADDED = 0, MMGUI_EVENT_DEVICE_REMOVED, MMGUI_EVENT_DEVICE_ENABLED_STATUS, MMGUI_EVENT_DEVICE_BLOCKED_STATUS, MMGUI_EVENT_DEVICE_CONNECTION_STATUS, MMGUI_EVENT_SMS_LIST_READY, MMGUI_EVENT_SMS_COMPLETED, MMGUI_EVENT_SMS_SENT, MMGUI_EVENT_SMS_REMOVED, MMGUI_EVENT_SIGNAL_LEVEL_CHANGE, MMGUI_EVENT_NETWORK_MODE_CHANGE, MMGUI_EVENT_NETWORK_REGISTRATION_CHANGE, MMGUI_EVENT_LOCATION_CHANGE, MMGUI_EVENT_MODEM_ENABLE_RESULT, MMGUI_EVENT_SCAN_RESULT, MMGUI_EVENT_USSD_RESULT, MMGUI_EVENT_NET_STATUS, MMGUI_EVENT_TRAFFIC_LIMIT, MMGUI_EVENT_TIME_LIMIT, MMGUI_EVENT_UPDATE_CONNECTIONS_LIST, }; //External event callback typedef void (*mmgui_event_ext_callback)(enum _mmgui_event event, gpointer mmguicore, gpointer data, gpointer userdata); //Internal event callback typedef void (*mmgui_event_int_callback)(enum _mmgui_event event, gpointer mmguicore, gpointer data); enum _mmgui_module_priority { //module priority levels MMGUI_MODULE_PRIORITY_LOW = 0x00, MMGUI_MODULE_PRIORITY_NORMAL, MMGUI_MODULE_PRIORITY_RECOMMENDED }; enum _mmgui_module_type { //module types MMGUI_MODULE_TYPE_MODEM_MANAGER = 0x00, MMGUI_MODULE_TYPE_CONNECTION_MANGER }; enum _mmgui_module_functions { //module functions bitmask MMGUI_MODULE_FUNCTION_BASIC = 0x00, //MMGUI_MODULE_FUNCTION_VOICECALL = 0x01 }; enum _mmgui_module_requirement { //module requirements MMGUI_MODULE_REQUIREMENT_SERVICE = 0x00, MMGUI_MODULE_REQUIREMENT_FILE, MMGUI_MODULE_REQUIREMENT_NONE }; struct _mmguimodule { //module description guint identifier; enum _mmgui_module_type type; enum _mmgui_module_requirement requirement; enum _mmgui_module_priority priority; enum _mmgui_module_functions functions; gchar servicename[256]; gchar description[256]; gchar filename[256]; }; typedef struct _mmguimodule *mmguimodule_t; enum _mmgui_device_types { MMGUI_DEVICE_TYPE_GSM = 1, MMGUI_DEVICE_TYPE_CDMA }; enum _mmgui_device_modes { MMGUI_DEVICE_MODE_UNKNOWN = 0, MMGUI_DEVICE_MODE_GSM, MMGUI_DEVICE_MODE_GSM_COMPACT, MMGUI_DEVICE_MODE_GPRS, MMGUI_DEVICE_MODE_EDGE, MMGUI_DEVICE_MODE_UMTS, MMGUI_DEVICE_MODE_HSDPA, MMGUI_DEVICE_MODE_HSUPA, MMGUI_DEVICE_MODE_HSPA, MMGUI_DEVICE_MODE_HSPA_PLUS, MMGUI_DEVICE_MODE_1XRTT, MMGUI_DEVICE_MODE_EVDO0, MMGUI_DEVICE_MODE_EVDOA, MMGUI_DEVICE_MODE_EVDOB, MMGUI_DEVICE_MODE_LTE }; enum _mmgui_network_availability { MMGUI_NA_UNKNOWN = 0, MMGUI_NA_AVAILABLE, MMGUI_NA_CURRENT, MMGUI_NA_FORBIDDEN }; enum _mmgui_access_tech { MMGUI_ACCESS_TECH_GSM = 0, MMGUI_ACCESS_TECH_GSM_COMPACT, MMGUI_ACCESS_TECH_UMTS, MMGUI_ACCESS_TECH_EDGE, MMGUI_ACCESS_TECH_HSDPA, MMGUI_ACCESS_TECH_HSUPA, MMGUI_ACCESS_TECH_HSPA, MMGUI_ACCESS_TECH_HSPA_PLUS, MMGUI_ACCESS_TECH_1XRTT, MMGUI_ACCESS_TECH_EVDO0, MMGUI_ACCESS_TECH_EVDOA, MMGUI_ACCESS_TECH_EVDOB, MMGUI_ACCESS_TECH_LTE, MMGUI_ACCESS_TECH_UNKNOWN }; enum _mmgui_ussd_encoding { MMGUI_USSD_ENCODING_GSM7 = 0, MMGUI_USSD_ENCODING_UCS2 }; enum _mmgui_reg_status { MMGUI_REG_STATUS_IDLE = 0, MMGUI_REG_STATUS_HOME, MMGUI_REG_STATUS_SEARCHING, MMGUI_REG_STATUS_DENIED, MMGUI_REG_STATUS_UNKNOWN, MMGUI_REG_STATUS_ROAMING }; enum _mmgui_device_state { MMGUI_DEVICE_STATE_UNKNOWN = 0, MMGUI_DEVICE_STATE_DISABLED = 10, MMGUI_DEVICE_STATE_DISABLING = 20, MMGUI_DEVICE_STATE_ENABLING = 30, MMGUI_DEVICE_STATE_ENABLED = 40, MMGUI_DEVICE_STATE_SEARCHING = 50, MMGUI_DEVICE_STATE_REGISTERED = 60, MMGUI_DEVICE_STATE_DISCONNECTING = 70, MMGUI_DEVICE_STATE_CONNECTING = 80, MMGUI_DEVICE_STATE_CONNECTED = 90 }; enum _mmgui_ussd_state { MMGUI_USSD_STATE_UNKNOWN = 0, MMGUI_USSD_STATE_IDLE, MMGUI_USSD_STATE_ACTIVE, MMGUI_USSD_STATE_USER_RESPONSE }; enum _mmgui_ussd_validation { MMGUI_USSD_VALIDATION_INVALID = 0, MMGUI_USSD_VALIDATION_REQUEST, MMGUI_USSD_VALIDATION_RESPONSE }; enum _mmgui_contacts_storage { MMGUI_CONTACTS_STORAGE_UNKNOWN = 0, MMGUI_MODEM_CONTACTS_STORAGE_ME = 1, MMGUI_MODEM_CONTACTS_STORAGE_SM = 2, MMGUI_MODEM_CONTACTS_STORAGE_MT = 3, }; /*Capbilities specifications*/ enum _mmgui_sms_capabilities { MMGUI_SMS_CAPS_NONE = 0, MMGUI_SMS_CAPS_RECEIVE = 1 << 1, MMGUI_SMS_CAPS_SEND = 1 << 2 }; enum _mmgui_ussd_capabilities { MMGUI_USSD_CAPS_NONE = 0, MMGUI_USSD_CAPS_SEND = 1 << 1 }; enum _mmgui_location_capabilities { MMGUI_LOCATION_CAPS_NONE = 0, MMGUI_LOCATION_CAPS_3GPP = 1 << 1, MMGUI_LOCATION_CAPS_GPS = 1 << 2 }; enum _mmgui_scan_capabilities { MMGUI_SCAN_CAPS_NONE = 0, MMGUI_SCAN_CAPS_OBSERVE = 1 << 1 }; enum _mmgui_contacts_capabilities { MMGUI_CONTACTS_CAPS_NONE = 0, MMGUI_CONTACTS_CAPS_EXPORT = 1 << 1, MMGUI_CONTACTS_CAPS_EDIT = 1 << 2, MMGUI_CONTACTS_CAPS_EXTENDED = 1 << 3 }; enum _mmgui_device_operation { MMGUI_DEVICE_OPERATION_IDLE = 0, MMGUI_DEVICE_OPERATION_ENABLE, MMGUI_DEVICE_OPERATION_SEND_SMS, MMGUI_DEVICE_OPERATION_SEND_USSD, MMGUI_DEVICE_OPERATION_SCAN, MMGUI_DEVICE_OPERATIONS }; enum _mmgui_device_state_request { MMGUI_DEVICE_STATE_REQUEST_ENABLED = 0, MMGUI_DEVICE_STATE_REQUEST_LOCKED, MMGUI_DEVICE_STATE_REQUEST_REGISTERED, MMGUI_DEVICE_STATE_REQUEST_CONNECTED }; enum _mmgui_event_action { MMGUI_EVENT_ACTION_NOTHING = 0, MMGUI_EVENT_ACTION_DISCONNECT }; struct _mmgui_scanned_network { enum _mmgui_network_availability status; enum _mmgui_access_tech access_tech; guint operator_num; gchar *operator_long; gchar *operator_short; }; typedef struct _mmgui_scanned_network *mmgui_scanned_network_t; struct _mmgui_ext_connection { guchar state; guchar family; gushort srcport; guint dqueue; guint inode; guint userid; guint apppid; gchar *appname; gchar *dsthostname; gchar srcaddr[INET6_ADDRSTRLEN + 8]; gchar dstaddr[INET6_ADDRSTRLEN + 8]; gboolean existsflag; }; typedef struct _mmgui_ext_connection *mmgui_ext_connection_t; struct _mmgui_contact { guint id; //Internal private number gchar *name; //Full name of the contact gchar *number; //Telephone number gchar *email; //Email address gchar *group; //Group this contact belongs to gchar *name2; //Additional contact name gchar *number2; //Additional contact telephone number gboolean hidden; //Boolean flag to specify whether this entry is hidden or not guint storage; //Phonebook in which the contact is stored }; typedef struct _mmgui_contact *mmgui_contact_t; struct _mmgui_traffic_limits { gboolean trafficenabled; gboolean trafficexecuted; guint trafficamount; guint trafficunits; guint64 trafficfull; gchar *trafficmessage; guint trafficaction; gboolean timeenabled; gboolean timeexecuted; guint timeamount; guint timeunits; guint64 timefull; gchar *timemessage; guint timeaction; }; typedef struct _mmgui_traffic_limits *mmgui_traffic_limits_t; struct _mmgui_traffic_stats { gint64 rxbytes; gint64 rxpackets; gint64 rxerrs; gint64 rxdrop; gint64 rxfifo; gint64 rxframe; gint64 rxcompressed; gint64 rxmulticast; gint64 txbytes; gint64 txpackets; gint64 txerrs; gint64 txdrop; gint64 txfifo; gint64 txcolls; gint64 txcarrier; gint64 txcompressed; }; typedef struct _mmgui_traffic_stats *mmgui_traffic_stats_t; struct _mmguidevice { guint id; /*State*/ gboolean enabled; gboolean blocked; gboolean registered; enum _mmgui_device_operation operation; //Info gchar *manufacturer; gchar *model; gchar *version; gchar *port; gchar *internalid; gchar *persistentid; gchar *objectpath; gchar *sysfspath; enum _mmgui_device_types type; gchar *imei; gchar *imsi; gchar *operatorcode; gchar *operatorname; enum _mmgui_reg_status regstatus; guint allmode; enum _mmgui_device_modes mode; guint siglevel; //Location guint locationcaps; guint loc3gppdata[4]; /*mcc/mnc/lac/ci*/ gfloat locgpsdata[4]; /*latitude/longitude/altitude/time*/ //SMS guint smscaps; gpointer smsdb; //USSD guint ussdcaps; enum _mmgui_ussd_encoding ussdencoding; //Scan guint scancaps; //Traffic guint64 rxbytes; guint64 txbytes; guint64 sessiontime; time_t speedchecktime; time_t smschecktime; gfloat speedvalues[2][MMGUI_SPEED_VALUES_NUMBER]; guint speedindex; gboolean connected; gchar interface[IFNAMSIZ]; time_t sessionstarttime; gpointer trafficdb; //Contacts guint contactscaps; GSList *contactslist; }; typedef struct _mmguidevice *mmguidevice_t; //Modem manager module functions typedef gboolean (*mmgui_module_init_func)(mmguimodule_t module); typedef gboolean (*mmgui_module_open_func)(gpointer mmguicore); typedef gboolean (*mmgui_module_close_func)(gpointer mmguicore); typedef gchar *(*mmgui_module_last_error_func)(gpointer mmguicore); typedef gboolean (*mmgui_module_interrupt_operation_func)(gpointer mmguicore); typedef gboolean (*mmgui_module_set_timeout_func)(gpointer mmguicore, guint operation, guint timeout); typedef guint (*mmgui_module_devices_enum_func)(gpointer mmguicore, GSList **devicelist); typedef gboolean (*mmgui_module_devices_open_func)(gpointer mmguicore, mmguidevice_t device); typedef gboolean (*mmgui_module_devices_close_func)(gpointer mmguicore); typedef gboolean (*mmgui_module_devices_state_func)(gpointer mmguicore, enum _mmgui_device_state_request request); typedef gboolean (*mmgui_module_devices_update_state_func)(gpointer mmguicore); typedef gboolean (*mmgui_module_devices_information_func)(gpointer mmguicore); typedef gboolean (*mmgui_module_devices_enable_func)(gpointer mmguicore, gboolean enabled); typedef guint (*mmgui_module_sms_enum_func)(gpointer mmguicore, GSList **smslist); typedef mmgui_sms_message_t (*mmgui_module_sms_get_func)(gpointer mmguicore, guint index); typedef gboolean (*mmgui_module_sms_delete_func)(gpointer mmguicore, guint index); typedef gboolean (*mmgui_module_sms_send_func)(gpointer mmguicore, gchar* number, gchar *text); typedef gboolean (*mmgui_module_ussd_cancel_session_func)(gpointer mmguicore); typedef enum _mmgui_ussd_state (*mmgui_module_ussd_get_state_func)(gpointer mmguicore); typedef gboolean (*mmgui_module_ussd_send_func)(gpointer mmguicore, gchar *request, enum _mmgui_ussd_validation validationid); typedef gboolean (*mmgui_module_networks_scan_func)(gpointer mmguicore); typedef guint (*mmgui_module_contacts_enum_func)(gpointer mmguicore, GSList **contactslist); typedef gboolean (*mmgui_module_contacts_delete_func)(gpointer mmguicore, guint index); typedef gint (*mmgui_module_contacts_add_func)(gpointer mmguicore, mmgui_contact_t contact); //Connection manager module functions typedef gboolean (*mmgui_module_connection_open_func)(gpointer mmguicore); typedef gboolean (*mmgui_module_connection_close_func)(gpointer mmguicore); typedef gchar *(*mmgui_module_connection_last_error_func)(gpointer mmguicore); typedef gboolean (*mmgui_module_device_connection_open_func)(gpointer mmguicore, mmguidevice_t device); typedef gboolean (*mmgui_module_device_connection_close_func)(gpointer mmguicore); typedef gboolean (*mmgui_module_device_connection_status_func)(gpointer mmguicore); typedef guint64 (*mmgui_module_device_connection_timestamp_func)(gpointer mmguicore); typedef gboolean (*mmgui_module_device_connection_disconnect_func)(gpointer mmguicore); struct _mmguicore { //Modules list GSList *modules; //Modem manager module GModule *module; gpointer moduledata; gpointer moduleptr; //Connection manager module GModule *cmodule; gpointer cmoduledata; gpointer cmoduleptr; //Modem manager module functions mmgui_module_open_func open_func; mmgui_module_close_func close_func; mmgui_module_last_error_func last_error_func; mmgui_module_interrupt_operation_func interrupt_operation_func; mmgui_module_set_timeout_func set_timeout_func; mmgui_module_devices_enum_func devices_enum_func; mmgui_module_devices_open_func devices_open_func; mmgui_module_devices_close_func devices_close_func; mmgui_module_devices_state_func devices_state_func; mmgui_module_devices_update_state_func devices_update_state_func; mmgui_module_devices_information_func devices_information_func; mmgui_module_devices_enable_func devices_enable_func; mmgui_module_sms_enum_func sms_enum_func; mmgui_module_sms_get_func sms_get_func; mmgui_module_sms_delete_func sms_delete_func; mmgui_module_sms_send_func sms_send_func; mmgui_module_ussd_cancel_session_func ussd_cancel_session_func; mmgui_module_ussd_get_state_func ussd_get_state_func; mmgui_module_ussd_send_func ussd_send_func; mmgui_module_networks_scan_func networks_scan_func; mmgui_module_contacts_enum_func contacts_enum_func; mmgui_module_contacts_delete_func contacts_delete_func; mmgui_module_contacts_add_func contacts_add_func; //Connection manager module functions mmgui_module_connection_open_func connection_open_func; mmgui_module_connection_close_func connection_close_func; mmgui_module_connection_last_error_func connection_last_error_func; mmgui_module_device_connection_open_func device_connection_open_func; mmgui_module_device_connection_close_func device_connection_close_func; mmgui_module_device_connection_status_func device_connection_status_func; mmgui_module_device_connection_timestamp_func device_connection_timestamp_func; mmgui_module_device_connection_disconnect_func device_connection_disconnect_func; //Devices GSList *devices; mmguidevice_t device; //Callbacks mmgui_event_int_callback eventcb; mmgui_event_ext_callback extcb; //Traffic limits mmgui_traffic_limits_t limits; //User data pointer gpointer userdata; //Netlink interface mmgui_netlink_t netlink; GHashTable *connections; //Work thread GThread *workthread; gint workthreadctl[2]; #if GLIB_CHECK_VERSION(2,32,0) GMutex workthreadmutex; GMutex connsyncmutex; #else GMutex *workthreadmutex; GMutex *connsyncmutex; #endif }; typedef struct _mmguicore *mmguicore_t; //Devices gboolean mmguicore_devices_open(mmguicore_t mmguicore, guint deviceid, gboolean openfirst); gboolean mmguicore_devices_enable(mmguicore_t mmguicore, gboolean enabled); GSList *mmguicore_devices_get_list(mmguicore_t mmguicore); mmguidevice_t mmguicore_devices_get_current(mmguicore_t mmguicore); gboolean mmguicore_devices_get_enabled(mmguicore_t mmguicore); gboolean mmguicore_devices_get_locked(mmguicore_t mmguicore); gboolean mmguicore_devices_get_registered(mmguicore_t mmguicore); gboolean mmguicore_devices_get_connected(mmguicore_t mmguicore); gboolean mmguicore_devices_update_device_state(mmguicore_t mmguicore); const gchar *mmguicore_devices_get_identifier(mmguicore_t mmguicore); const gchar *mmguicore_devices_get_internal_identifier(mmguicore_t mmguicore); gpointer mmguicore_devices_get_sms_db(mmguicore_t mmguicore); gpointer mmguicore_devices_get_traffic_db(mmguicore_t mmguicore); gboolean mmguicore_devices_get_connection_status(mmguicore_t mmguicore); guint64 mmguicore_devices_get_connection_timestamp(mmguicore_t mmguicore); guint mmguicore_devices_get_current_operation(mmguicore_t mmguicore); //Location guint mmguicore_location_get_capabilities(mmguicore_t mmguicore); //SMS guint mmguicore_sms_get_capabilities(mmguicore_t mmguicore); void mmguicore_sms_message_free(mmgui_sms_message_t message); GSList *mmguicore_sms_enum(mmguicore_t mmguicore, gboolean concatenation); mmgui_sms_message_t mmguicore_sms_get(mmguicore_t mmguicore, guint index); gboolean mmguicore_sms_delete(mmguicore_t mmguicore, guint index); gboolean mmguicore_sms_validate_number(const gchar *number); gboolean mmguicore_sms_send(mmguicore_t mmguicore, gchar *number, gchar *text); //USSD guint mmguicore_ussd_get_capabilities(mmguicore_t mmguicore); enum _mmgui_ussd_validation mmguicore_ussd_validate_request(gchar *request); gboolean mmguicore_ussd_cancel_session(mmguicore_t mmguicore); enum _mmgui_ussd_state mmguicore_ussd_get_state(mmguicore_t mmguicore); gboolean mmguicore_ussd_send(mmguicore_t mmguicore, gchar *request); gboolean mmguicore_ussd_set_encoding(mmguicore_t mmguicore, enum _mmgui_ussd_encoding encoding); enum _mmgui_ussd_encoding mmguicore_ussd_get_encoding(mmguicore_t mmguicore); //Scan guint mmguicore_newtworks_scan_get_capabilities(mmguicore_t mmguicore); void mmguicore_networks_scan_free(GSList *networks); gboolean mmguicore_networks_scan(mmguicore_t mmguicore); //Contacts guint mmguicore_contacts_get_capabilities(mmguicore_t mmguicore); void mmguicore_contacts_free_single(mmgui_contact_t contact, gboolean freestruct); GSList *mmguicore_contacts_list(mmguicore_t mmguicore); mmgui_contact_t mmguicore_contacts_get(mmguicore_t mmguicore, guint index); gboolean mmguicore_contacts_delete(mmguicore_t mmguicore, guint index); gboolean mmguicore_contacts_add(mmguicore_t mmguicore, mmgui_contact_t contact); //Connections GHashTable *mmguicore_connections_sync(mmguicore_t mmguicore); //MMGUI Core gchar *mmguicore_get_last_error(mmguicore_t mmguicore); gchar *mmguicore_get_last_connection_error(mmguicore_t mmguicore); gboolean mmguicore_interrupt_operation(mmguicore_t mmguicore); mmguicore_t mmguicore_new(mmgui_event_ext_callback callback, mmgui_traffic_limits_t limits, gpointer userdata); void mmguicore_close(mmguicore_t mmguicore); #endif /* __MMGUICORE_H__ */ modem-manager-gui-0.0.16/src/modules/000077500000000000000000000000001217271411700173335ustar00rootroot00000000000000modem-manager-gui-0.0.16/src/modules/Makefile000066400000000000000000000025351217271411700210000ustar00rootroot00000000000000include ../../Makefile_h GCCMOD = gcc -shared -fPIC #CFLAGS = -g -mtune=native -O3 LIBMOD = `pkg-config --cflags --libs glib-2.0` `pkg-config --cflags --libs gmodule-2.0` `pkg-config --cflags --libs gio-2.0` OBJMOD1 = mm06.o OBJMOD2 = mm07.o OBJMOD3 = nm09.o OBJMOD4 = pppd245.o LIBDIR = $(LIBPATH)/modem-manager-gui/modules/ all: mm06 mm07 nm09 pppd245 mm06: $(OBJMOD1) $(GCCMOD) $(OBJMOD1) $(LIBMOD) -o modmm_mm06.so mm07: $(OBJMOD2) $(GCCMOD) $(OBJMOD2) $(LIBMOD) -o modmm_mm07.so nm09: $(OBJMOD3) $(GCCMOD) $(OBJMOD3) $(LIBMOD) -o modcm_nm09.so pppd245: $(OBJMOD4) $(GCCMOD) $(OBJMOD4) $(LIBMOD) -o modcm_pppd245.so .c.o: $(GCCMOD) $(LIBMOD) -c $(CFLAGS) $< install: mkdir -p $(INSTALLPREFIX)$(DESTDIR)$(LIBDIR) cp modmm_mm06.so $(INSTALLPREFIX)$(DESTDIR)$(LIBDIR) cp modmm_mm07.so $(INSTALLPREFIX)$(DESTDIR)$(LIBDIR) cp modcm_nm09.so $(INSTALLPREFIX)$(DESTDIR)$(LIBDIR) cp modcm_pppd245.so $(INSTALLPREFIX)$(DESTDIR)$(LIBDIR) uninstall: rm -f $(INSTALLPREFIX)$(DESTDIR)$(LIBDIR)/modmm_mm06.so rm -f $(INSTALLPREFIX)$(DESTDIR)$(LIBDIR)/modmm_mm07.so rm -f $(INSTALLPREFIX)$(DESTDIR)$(LIBDIR)/modcm_nm09.so rm -f $(INSTALLPREFIX)$(DESTDIR)$(LIBDIR)/modcm_pppd245.so clean: rm -f *.o rm -f modmm_mm06.so rm -f modmm_mm07.so rm -f modcm_nm09.so rm -f modcm_pppd245.so modem-manager-gui-0.0.16/src/modules/mm06.c000066400000000000000000002437471217271411700202770ustar00rootroot00000000000000/* * mm06.c * * Copyright 2013 Alex * * 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 . */ #include #include #include #include #include #include #include "../mmguicore.h" #include "../smsdb.h" #define MMGUI_MODULE_SERVICE_NAME "org.freedesktop.ModemManager" #define MMGUI_MODULE_IDENTIFIER 60 #define MMGUI_MODULE_DESCRIPTION "Modem Manager <= 0.6.0/Wader" #define MMGUI_MODULE_ENABLE_OPERATION_TIMEOUT 20000 #define MMGUI_MODULE_SEND_SMS_OPERATION_TIMEOUT 35000 #define MMGUI_MODULE_SEND_USSD_OPERATION_TIMEOUT 25000 #define MMGUI_MODULE_NETWORKS_SCAN_OPERATION_TIMEOUT 60000 #define MMGUI_MODULE_SMS_POLL_INTERVAL 3 //Location types internal flags typedef enum { MODULE_INT_MODEM_LOCATION_CAPABILITY_UNKNOWN = 0x0, MODULE_INT_MODEM_LOCATION_CAPABILITY_GPS_NMEA = 0x1, MODULE_INT_MODEM_LOCATION_CAPABILITY_GSM_LAC_CI = 0x2 } ModuleIntModemLocationCapability; /*Registration types internal flags*/ typedef enum { MODULE_INT_GSM_NETWORK_REG_STATUS_IDLE = 0, MODULE_INT_GSM_NETWORK_REG_STATUS_HOME = 1, MODULE_INT_GSM_NETWORK_REG_STATUS_SEARCHING = 2, MODULE_INT_GSM_NETWORK_REG_STATUS_DENIED = 3, MODULE_INT_GSM_NETWORK_REG_STATUS_UNKNOWN = 4, MODULE_INT_GSM_NETWORK_REG_STATUS_ROAMING = 5 } ModuleIntGsmNetworkRegStatus; /*State internal flags*/ typedef enum { MODULE_INT_MODEM_STATE_UNKNOWN = 0, MODULE_INT_MODEM_STATE_DISABLED = 10, MODULE_INT_MODEM_STATE_DISABLING = 20, MODULE_INT_MODEM_STATE_ENABLING = 30, MODULE_INT_MODEM_STATE_ENABLED = 40, MODULE_INT_MODEM_STATE_SEARCHING = 50, MODULE_INT_MODEM_STATE_REGISTERED = 60, MODULE_INT_MODEM_STATE_DISCONNECTING = 70, MODULE_INT_MODEM_STATE_CONNECTING = 80, MODULE_INT_MODEM_STATE_CONNECTED = 90 }ModuleIntModemState; /*Service type*/ typedef enum { MODULE_INT_SERVICE_UNDEFINED = 0x0, MODULE_INT_SERVICE_MODEM_MANAGER = 0x1, MODULE_INT_SERVICE_WADER = 0x2 } ModuleIntService; //Private module variables struct _mmguimoduledata { //DBus connection GDBusConnection *connection; //DBus proxy objects GDBusProxy *managerproxy; GDBusProxy *cardproxy; GDBusProxy *netproxy; GDBusProxy *modemproxy; GDBusProxy *smsproxy; GDBusProxy *ussdproxy; GDBusProxy *locationproxy; GDBusProxy *timeproxy; GDBusProxy *contactsproxy; //Attached signal handlers gulong netsignal; gulong statesignal; gulong smssignal; //Property change signal gulong modempropsignal; gulong locationpropsignal; //Service type ModuleIntService service; //Legacy ModemManager versions gboolean needsmspolling; time_t polltimestamp; //Last error message gchar *errormessage; //Cancellable GCancellable *cancellable; //Operations timeouts guint timeouts[MMGUI_DEVICE_OPERATIONS]; }; typedef struct _mmguimoduledata *moduledata_t; static gboolean mmgui_module_device_registered_from_status(guint status); static mmguidevice_t mmgui_module_device_new(mmguicore_t mmguicore, const gchar *devpath); static gboolean mmgui_module_devices_update_registration(gpointer mmguicore, guint regstatus, gchar *operatorcode, gchar *operatorname); static gboolean mmgui_module_devices_update_device_mode(gpointer mmguicore, gint oldstate, gint newstate, guint changereason); static gboolean mmgui_module_devices_update_mode(gpointer mmguicore); static gboolean mmgui_module_devices_update_location(gpointer mmguicore, mmguidevice_t device); static gboolean mmgui_module_devices_enable_location(gpointer mmguicore, mmguidevice_t device, gboolean enable); static void mmgui_module_handle_error_message(mmguicore_t mmguicore, GError *error) { moduledata_t moduledata; if ((mmguicore == NULL) || (error == NULL)) return; moduledata = (moduledata_t)mmguicore->moduledata; if (moduledata == NULL) return; if (moduledata->errormessage != NULL) { g_free(moduledata->errormessage); } if (error->message != NULL) { moduledata->errormessage = g_strdup(error->message); } else { moduledata->errormessage = g_strdup("Unknown error"); } g_warning("%s: %s", MMGUI_MODULE_DESCRIPTION, moduledata->errormessage); } static guint mmgui_module_device_id(const gchar *devpath) { guint id; gchar *devidstr; devidstr = strrchr(devpath, '/') + 1; if ((devidstr != NULL) && (devidstr[0] != '\0')) { id = atoi(devidstr); } else { id = 0; } return id; } static void mmgui_signal_handler(GDBusProxy *proxy, const gchar *sender_name, const gchar *signal_name, GVariant *parameters, gpointer data) { mmguicore_t mmguicore; moduledata_t moduledata; gchar *devpath, *operatorcode, *operatorname; mmguidevice_t device; guint id, oldstate, newstate, changereason, regstatus; gboolean status; mmguicore = (mmguicore_t)data; if (mmguicore == NULL) return; moduledata = (moduledata_t)mmguicore->moduledata; if (moduledata == NULL) return; if (mmguicore->eventcb != NULL) { if (g_str_equal(signal_name, "DeviceAdded")) { g_variant_get(parameters, "(o)", &devpath); if (devpath != NULL) { g_printf("Added: %s\n", devpath); device = mmgui_module_device_new(mmguicore, devpath); (mmguicore->eventcb)(MMGUI_EVENT_DEVICE_ADDED, mmguicore, device); } } else if (g_str_equal(signal_name, "DeviceRemoved")) { g_variant_get(parameters, "(o)", &devpath); if (devpath != NULL) { id = mmgui_module_device_id(devpath); (mmguicore->eventcb)(MMGUI_EVENT_DEVICE_REMOVED, mmguicore, GUINT_TO_POINTER(id)); } } else if (g_str_equal(signal_name, "Completed")) { g_variant_get(parameters, "(ub)", &id, &status); if ((status) && (!moduledata->needsmspolling)) { (mmguicore->eventcb)(MMGUI_EVENT_SMS_COMPLETED, mmguicore, GUINT_TO_POINTER(id)); } } else if (g_str_equal(signal_name, "SignalQuality")) { g_variant_get(parameters, "(u)", &id); if (mmguicore->device != NULL) { mmguicore->device->siglevel = id; (mmguicore->eventcb)(MMGUI_EVENT_SIGNAL_LEVEL_CHANGE, mmguicore, mmguicore->device); } } else if (g_str_equal(signal_name, "NetworkMode")) { if (mmgui_module_devices_update_mode(mmguicore)) { (mmguicore->eventcb)(MMGUI_EVENT_NETWORK_MODE_CHANGE, mmguicore, mmguicore->device); } } else if (g_str_equal(signal_name, "RegistrationInfo")) { if (mmguicore->device != NULL) { g_variant_get(parameters, "(uss)", ®status, &operatorcode, &operatorname); if (mmgui_module_devices_update_registration(mmguicore, regstatus, operatorcode, operatorname)) { (mmguicore->eventcb)(MMGUI_EVENT_NETWORK_REGISTRATION_CHANGE, mmguicore, mmguicore->device); } } } else if (g_str_equal(signal_name, "StateChanged")) { if (mmguicore->device != NULL) { g_variant_get(parameters, "(uuu)", &oldstate, &newstate, &changereason); mmgui_module_devices_update_device_mode(mmguicore, oldstate, newstate, changereason); } } } g_debug("SIGNAL: %s (%s) argtype: %s\n", signal_name, sender_name, g_variant_get_type_string(parameters)); } static void mmgui_property_change_handler(GDBusProxy *proxy, GVariant *changed_properties, GStrv invalidated_properties, gpointer data) { mmguicore_t mmguicore; mmguidevice_t device; GVariantIter *iter; GVariant *item; const gchar *key; GVariant *value; guint statevalue; gboolean stateflag; if ((changed_properties == NULL) || (data == NULL)) return; mmguicore = (mmguicore_t)data; if (mmguicore->device == NULL) return; device = mmguicore->device; if (g_variant_n_children(changed_properties) > 0) { g_variant_get(changed_properties, "a{sv}", &iter); while (g_variant_iter_loop(iter, "{&sv}", &key, &value)) { if (g_str_equal(key, "Location")) { if (mmgui_module_devices_update_location(mmguicore, mmguicore->device)) { if (mmguicore->eventcb != NULL) { (mmguicore->eventcb)(MMGUI_EVENT_LOCATION_CHANGE, mmguicore, mmguicore->device); } } } g_debug("Property changed: %s\n", key); } g_variant_iter_free(iter); } } static gboolean mmgui_module_device_enabled_from_state(guint state) { gboolean enabled; switch (state) { case MODULE_INT_MODEM_STATE_UNKNOWN: case MODULE_INT_MODEM_STATE_DISABLED: case MODULE_INT_MODEM_STATE_DISABLING: case MODULE_INT_MODEM_STATE_ENABLING: enabled = FALSE; break; case MODULE_INT_MODEM_STATE_ENABLED: case MODULE_INT_MODEM_STATE_SEARCHING: case MODULE_INT_MODEM_STATE_REGISTERED: case MODULE_INT_MODEM_STATE_DISCONNECTING: case MODULE_INT_MODEM_STATE_CONNECTING: case MODULE_INT_MODEM_STATE_CONNECTED: enabled = TRUE; break; default: enabled = FALSE; break; } return enabled; } static gboolean mmgui_module_device_locked_from_unlock_string(gchar *ustring) { gboolean locked; if (ustring == NULL) return FALSE; if (ustring[0] == '\0') { locked = FALSE; } else { locked = TRUE; } return locked; } static gboolean mmgui_module_device_connected_from_state(gint state) { gboolean connected; switch (state) { case MODULE_INT_MODEM_STATE_UNKNOWN: case MODULE_INT_MODEM_STATE_DISABLED: case MODULE_INT_MODEM_STATE_DISABLING: case MODULE_INT_MODEM_STATE_ENABLING: case MODULE_INT_MODEM_STATE_ENABLED: case MODULE_INT_MODEM_STATE_SEARCHING: case MODULE_INT_MODEM_STATE_REGISTERED: case MODULE_INT_MODEM_STATE_DISCONNECTING: case MODULE_INT_MODEM_STATE_CONNECTING: connected = FALSE; break; case MODULE_INT_MODEM_STATE_CONNECTED: connected = TRUE; break; default: connected = FALSE; break; } return connected; } static gboolean mmgui_module_device_registered_from_status(guint status) { gboolean registered; switch (status) { case MODULE_INT_GSM_NETWORK_REG_STATUS_IDLE: registered = FALSE; break; case MODULE_INT_GSM_NETWORK_REG_STATUS_HOME: registered = TRUE; break; case MODULE_INT_GSM_NETWORK_REG_STATUS_SEARCHING: case MODULE_INT_GSM_NETWORK_REG_STATUS_DENIED: case MODULE_INT_GSM_NETWORK_REG_STATUS_UNKNOWN: registered = FALSE; break; case MODULE_INT_GSM_NETWORK_REG_STATUS_ROAMING: registered = TRUE; break; default: registered = FALSE; break; } return registered; } static mmguidevice_t mmgui_module_device_new(mmguicore_t mmguicore, const gchar *devpath) { mmguidevice_t device; moduledata_t moduledata; GDBusProxy *deviceproxy; GError *error; GVariant *deviceinfo; gchar *manufacturer, *model, *version, *blockstr; gsize strsize; if ((mmguicore == NULL) || (devpath == NULL)) return NULL; moduledata = (moduledata_t)mmguicore->moduledata; if (moduledata == NULL) return NULL; if (moduledata->connection == NULL) return NULL; device = g_new0(struct _mmguidevice, 1); //Save device identifier and object path device->id = mmgui_module_device_id(devpath); device->objectpath = g_strdup(devpath); //If service type not defined, guess it using device object path if (devpath != NULL) { if (moduledata->service == MODULE_INT_SERVICE_UNDEFINED) { if (strstr(devpath, "Modems") != NULL) { moduledata->service = MODULE_INT_SERVICE_MODEM_MANAGER; } else if (strstr(devpath, "Devices") != NULL) { moduledata->service = MODULE_INT_SERVICE_WADER; } } } device->operation = MMGUI_DEVICE_OPERATION_IDLE; //Zero values we can't get this moment //SMS device->smscaps = MMGUI_SMS_CAPS_NONE; device->smsdb = NULL; //Networks //Info device->operatorname = NULL; device->operatorcode = NULL; device->imei = NULL; device->imsi = NULL; //USSD device->ussdcaps = MMGUI_USSD_CAPS_NONE; device->ussdencoding = MMGUI_USSD_ENCODING_GSM7; //Location device->locationcaps = MMGUI_LOCATION_CAPS_NONE; memset(device->loc3gppdata, 0, sizeof(device->loc3gppdata)); memset(device->locgpsdata, 0, sizeof(device->locgpsdata)); //Scan device->scancaps = MMGUI_SCAN_CAPS_NONE; //Traffic device->rxbytes = 0; device->txbytes = 0; device->sessiontime = 0; device->speedchecktime = 0; device->smschecktime = 0; device->speedindex = 0; device->connected = FALSE; memset(device->speedvalues, 0, sizeof(device->speedvalues)); memset(device->interface, 0, sizeof(device->interface)); //Contacts device->contactscaps = MMGUI_CONTACTS_CAPS_NONE; device->contactslist = NULL; error = NULL; deviceproxy = g_dbus_proxy_new_sync(moduledata->connection, G_DBUS_PROXY_FLAGS_NONE, NULL, "org.freedesktop.ModemManager", devpath, "org.freedesktop.ModemManager.Modem", NULL, &error); if ((deviceproxy == NULL) && (error != NULL)) { mmgui_module_handle_error_message(mmguicore, error); g_error_free(error); g_object_unref(deviceproxy); //Fill default values device->manufacturer = g_strdup(_("Unknown")); device->model = g_strdup(_("Unknown")); device->version = g_strdup(_("Unknown")); device->port = g_strdup(_("Unknown")); device->type = MMGUI_DEVICE_TYPE_GSM; return device; } //Is device enabled deviceinfo = g_dbus_proxy_get_cached_property(deviceproxy, "Enabled"); if (deviceinfo != NULL) { device->enabled = g_variant_get_boolean(deviceinfo); g_variant_unref(deviceinfo); } else { device->enabled = TRUE; g_debug("Failed to retrieve device enabled state, assuming enabled\n"); } //Is device blocked deviceinfo = g_dbus_proxy_get_cached_property(deviceproxy, "UnlockRequired"); if (deviceinfo != NULL) { strsize = 256; blockstr = (gchar *)g_variant_get_string(deviceinfo, &strsize); device->blocked = mmgui_module_device_locked_from_unlock_string(blockstr); g_variant_unref(deviceinfo); } else { device->blocked = FALSE; g_debug("Failed to retrieve device blocked state, assuming not blocked\n"); } /*Wader needs to enable modem before working with it*/ if (moduledata->service == MODULE_INT_SERVICE_WADER) { if (!device->enabled) { error = NULL; g_dbus_proxy_call_sync(deviceproxy, "Enable", g_variant_new("(b)", TRUE), 0, -1, NULL, &error); if (error != NULL) { mmgui_module_handle_error_message(mmguicore, error); g_error_free(error); g_object_unref(deviceproxy); //Fill default values device->manufacturer = g_strdup(_("Unknown")); device->model = g_strdup(_("Unknown")); device->version = g_strdup(_("Unknown")); device->port = g_strdup(_("Unknown")); device->type = MMGUI_DEVICE_TYPE_GSM; return device; } } } error = NULL; deviceinfo = g_dbus_proxy_call_sync(deviceproxy, "GetInfo", NULL, 0, -1, NULL, &error); if ((deviceinfo == NULL) && (error != NULL)) { mmgui_module_handle_error_message(mmguicore, error); g_error_free(error); g_object_unref(deviceproxy); //Fill default values device->manufacturer = g_strdup(_("Unknown")); device->model = g_strdup(_("Unknown")); device->version = g_strdup(_("Unknown")); device->port = g_strdup(_("Unknown")); device->type = MMGUI_DEVICE_TYPE_GSM; return device; } g_variant_get(deviceinfo, "((sss))", &manufacturer, &model, &version); if (manufacturer != NULL) { device->manufacturer = g_strdup(manufacturer); } else { device->manufacturer = g_strdup(_("Unknown")); } if (model != NULL) { device->model = g_strdup(model); } else { device->model = g_strdup(_("Unknown")); } if (version != NULL) { device->version = g_strdup(version); } else { device->version = g_strdup(_("Unknown")); } g_variant_unref(deviceinfo); //Device path deviceinfo = g_dbus_proxy_get_cached_property(deviceproxy, "Device"); if (deviceinfo != NULL) { strsize = 256; device->port = g_strdup(g_variant_get_string(deviceinfo, &strsize)); g_variant_unref(deviceinfo); } else { device->sysfspath = NULL; g_debug("Failed to retrieve device path\n"); } //Need to get usb device serial for fallback traffic monitoring deviceinfo = g_dbus_proxy_get_cached_property(deviceproxy, "MasterDevice"); if (deviceinfo != NULL) { strsize = 256; device->sysfspath = g_strdup(g_variant_get_string(deviceinfo, &strsize)); g_variant_unref(deviceinfo); } else { device->sysfspath = NULL; g_debug("Failed to retrieve device serial specification\n"); } //Device type deviceinfo = g_dbus_proxy_get_cached_property(deviceproxy, "Type"); if (deviceinfo != NULL) { device->type = g_variant_get_uint32(deviceinfo); g_variant_unref(deviceinfo); } else { device->type = MMGUI_DEVICE_TYPE_GSM; g_debug("Failed to retrieve device type, assuming GSM\n"); } //Internal Modem Manager identifier (some services, e.g. Wader not using it) if (moduledata->service == MODULE_INT_SERVICE_MODEM_MANAGER) { deviceinfo = g_dbus_proxy_get_cached_property(deviceproxy, "DeviceIdentifier"); if (deviceinfo != NULL) { strsize = 256; device->internalid = g_strdup(g_variant_get_string(deviceinfo, &strsize)); g_variant_unref(deviceinfo); } else { device->internalid = NULL; g_debug("Failed to retrieve device internal identifier\n"); } } else { device->internalid = NULL; } //Persistent device identifier blockstr = g_strdup_printf("%s_%s_%s", device->manufacturer, device->model, device->version); device->persistentid = g_compute_checksum_for_string(G_CHECKSUM_MD5, (const gchar *)blockstr, -1); g_free(blockstr); g_object_unref(deviceproxy); return device; } G_MODULE_EXPORT gboolean mmgui_module_init(mmguimodule_t module) { if (module == NULL) return FALSE; module->type = MMGUI_MODULE_TYPE_MODEM_MANAGER; module->requirement = MMGUI_MODULE_REQUIREMENT_SERVICE; module->priority = MMGUI_MODULE_PRIORITY_LOW; module->identifier = MMGUI_MODULE_IDENTIFIER; module->functions = MMGUI_MODULE_FUNCTION_BASIC; g_snprintf(module->servicename, sizeof(module->servicename), MMGUI_MODULE_SERVICE_NAME); g_snprintf(module->description, sizeof(module->description), MMGUI_MODULE_DESCRIPTION); return TRUE; } G_MODULE_EXPORT gboolean mmgui_module_open(gpointer mmguicore) { mmguicore_t mmguicorelc; moduledata_t *moduledata; GError *error; if (mmguicore == NULL) return FALSE; mmguicorelc = (mmguicore_t)mmguicore; moduledata = (moduledata_t *)&mmguicorelc->moduledata; (*moduledata) = g_new0(struct _mmguimoduledata, 1); error = NULL; (*moduledata)->connection = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error); (*moduledata)->errormessage = NULL; if (((*moduledata)->connection == NULL) && (error != NULL)) { mmgui_module_handle_error_message(mmguicore, error); g_error_free(error); g_free(mmguicorelc->moduledata); return FALSE; } error = NULL; (*moduledata)->managerproxy = g_dbus_proxy_new_sync((*moduledata)->connection, G_DBUS_PROXY_FLAGS_NONE, NULL, "org.freedesktop.ModemManager", "/org/freedesktop/ModemManager", "org.freedesktop.ModemManager", NULL, &error); if (((*moduledata)->managerproxy == NULL) && (error != NULL)) { mmgui_module_handle_error_message(mmguicorelc, error); g_error_free(error); g_object_unref((*moduledata)->connection); g_free(mmguicorelc->moduledata); return FALSE; } g_signal_connect(G_OBJECT((*moduledata)->managerproxy), "g-signal", G_CALLBACK(mmgui_signal_handler), mmguicore); //Set service type to undefined before using any functions (*moduledata)->service = MODULE_INT_SERVICE_UNDEFINED; /*Cancellable*/ (*moduledata)->cancellable = g_cancellable_new(); /*Operations timeouts*/ (*moduledata)->timeouts[MMGUI_DEVICE_OPERATION_ENABLE] = MMGUI_MODULE_ENABLE_OPERATION_TIMEOUT; (*moduledata)->timeouts[MMGUI_DEVICE_OPERATION_SEND_SMS] = MMGUI_MODULE_SEND_SMS_OPERATION_TIMEOUT; (*moduledata)->timeouts[MMGUI_DEVICE_OPERATION_SEND_USSD] = MMGUI_MODULE_SEND_USSD_OPERATION_TIMEOUT; (*moduledata)->timeouts[MMGUI_DEVICE_OPERATION_SCAN] = MMGUI_MODULE_NETWORKS_SCAN_OPERATION_TIMEOUT; return TRUE; } G_MODULE_EXPORT gboolean mmgui_module_close(gpointer mmguicore) { mmguicore_t mmguicorelc; moduledata_t moduledata; if (mmguicore == NULL) return FALSE; mmguicorelc = (mmguicore_t)mmguicore; moduledata = (moduledata_t)(mmguicorelc->moduledata); //Close device //Stop subsystems if (moduledata != NULL) { if (moduledata->errormessage != NULL) { g_free(moduledata->errormessage); } if (moduledata->cancellable != NULL) { g_object_unref(moduledata->cancellable); moduledata->cancellable = NULL; } if (moduledata->managerproxy != NULL) { g_object_unref(moduledata->managerproxy); moduledata->managerproxy = NULL; } if (moduledata->connection != NULL) { g_object_unref(moduledata->connection); moduledata->connection = NULL; } g_free(moduledata); } return TRUE; } G_MODULE_EXPORT gchar *mmgui_module_last_error(gpointer mmguicore) { mmguicore_t mmguicorelc; moduledata_t moduledata; if (mmguicore == NULL) return NULL; mmguicorelc = (mmguicore_t)mmguicore; moduledata = (moduledata_t)(mmguicorelc->moduledata); return moduledata->errormessage; } G_MODULE_EXPORT gboolean mmgui_module_interrupt_operation(gpointer mmguicore) { mmguicore_t mmguicorelc; moduledata_t moduledata; mmguidevice_t device; if (mmguicore == NULL) return FALSE; mmguicorelc = (mmguicore_t)mmguicore; if (mmguicorelc->moduledata == NULL) return FALSE; moduledata = (moduledata_t)mmguicorelc->moduledata; if (mmguicorelc->device == NULL) return FALSE; device = mmguicorelc->device; if (device->operation == MMGUI_DEVICE_OPERATION_IDLE) return FALSE; if (moduledata->cancellable != NULL) { g_cancellable_cancel(moduledata->cancellable); return TRUE; } else { return FALSE; } } G_MODULE_EXPORT gboolean mmgui_module_set_timeout(gpointer mmguicore, guint operation, guint timeout) { mmguicore_t mmguicorelc; moduledata_t moduledata; if (mmguicore == NULL) return FALSE; mmguicorelc = (mmguicore_t)mmguicore; if (mmguicorelc->moduledata == NULL) return FALSE; moduledata = (moduledata_t)mmguicorelc->moduledata; if (timeout < 1000) timeout *= 1000; if (operation < MMGUI_DEVICE_OPERATIONS) { moduledata->timeouts[operation] = timeout; return TRUE; } else { return FALSE; } } G_MODULE_EXPORT guint mmgui_module_devices_enum(gpointer mmguicore, GSList **devicelist) { mmguicore_t mmguicorelc; moduledata_t moduledata; GError *error; GVariant *devices; guint devnum; GVariantIter diterl1, diterl2; GVariant *dnodel1, *dnodel2; gsize devpathsize; const gchar *devpath; if ((mmguicore == NULL) || (devicelist == NULL)) return 0; mmguicorelc = (mmguicore_t)mmguicore; if (mmguicorelc->moduledata == NULL) return 0; moduledata = (moduledata_t)mmguicorelc->moduledata; error = NULL; devices = g_dbus_proxy_call_sync(moduledata->managerproxy, "EnumerateDevices", NULL, 0, -1, NULL, &error); if ((devices == NULL) && (error != NULL)) { mmgui_module_handle_error_message(mmguicorelc, error); g_error_free(error); return 0; } devnum = 0; g_variant_iter_init(&diterl1, devices); while ((dnodel1 = g_variant_iter_next_value(&diterl1)) != NULL) { g_variant_iter_init(&diterl2, dnodel1); while ((dnodel2 = g_variant_iter_next_value(&diterl2)) != NULL) { devpathsize = 256; devpath = g_variant_get_string(dnodel2, &devpathsize); if (devpath != NULL) { //Add device to list *devicelist = g_slist_prepend(*devicelist, mmgui_module_device_new(mmguicore, devpath)); devnum++; g_variant_unref(dnodel2); } } g_variant_unref(dnodel1); } g_variant_unref(devices); return devnum; } G_MODULE_EXPORT gboolean mmgui_module_devices_state(gpointer mmguicore, enum _mmgui_device_state_request request) { mmguicore_t mmguicorelc; moduledata_t moduledata; mmguidevice_t device; GVariant *data; GError *error; gsize strsize = 256; gchar *lockstr, *operatorcode, *operatorname; guint regstatus; gboolean res; if (mmguicore == NULL) return FALSE; mmguicorelc = (mmguicore_t)mmguicore; if (mmguicorelc->moduledata == NULL) return FALSE; moduledata = (moduledata_t)mmguicorelc->moduledata; if (mmguicorelc->device == NULL) return FALSE; device = mmguicorelc->device; switch (request) { case MMGUI_DEVICE_STATE_REQUEST_ENABLED: /*Is device enabled*/ if (moduledata->modemproxy != NULL) { data = g_dbus_proxy_get_cached_property(moduledata->modemproxy, "Enabled"); if (data != NULL) { res = g_variant_get_boolean(data); if (device->operation != MMGUI_DEVICE_OPERATION_ENABLE) { device->enabled = res; } g_variant_unref(data); } else { res = FALSE; } } else { res = FALSE; } break; case MMGUI_DEVICE_STATE_REQUEST_LOCKED: /*Is device blocked*/ if (moduledata->modemproxy != NULL) { data = g_dbus_proxy_get_cached_property(moduledata->modemproxy, "UnlockRequired"); if (data != NULL) { lockstr = (gchar *)g_variant_get_string(data, &strsize); res = mmgui_module_device_locked_from_unlock_string(lockstr); device->blocked = res; g_variant_unref(data); } else { res = FALSE; } } else { res = FALSE; } break; case MMGUI_DEVICE_STATE_REQUEST_REGISTERED: /*Is device registered in network*/ if (moduledata->netproxy != NULL) { error = NULL; data = g_dbus_proxy_call_sync(moduledata->netproxy, "GetRegistrationInfo", NULL, 0, -1, NULL, &error); if ((data == NULL) && (error != NULL)) { mmgui_module_handle_error_message(mmguicorelc, error); g_error_free(error); res = FALSE; } else { g_variant_get(data, "((uss))", ®status, &operatorcode, &operatorname); if (mmgui_module_devices_update_registration(mmguicore, regstatus, operatorcode, operatorname)) { res = mmgui_module_device_registered_from_status(device->regstatus); } else { res = mmgui_module_device_registered_from_status(regstatus); } g_variant_unref(data); } } else { res = FALSE; } break; case MMGUI_DEVICE_STATE_REQUEST_CONNECTED: /*Is device connected (modem manager state)*/ if (moduledata->modemproxy != NULL) { data = g_dbus_proxy_get_cached_property(moduledata->modemproxy, "State"); if (data != NULL) { res = mmgui_module_device_connected_from_state(g_variant_get_uint32(data)); g_variant_unref(data); } else { res = FALSE; } } else { res = FALSE; } break; default: res = FALSE; break; } return res; } G_MODULE_EXPORT gboolean mmgui_module_devices_update_state(gpointer mmguicore) { mmguicore_t mmguicorelc; moduledata_t moduledata; mmguidevice_t device; time_t currenttime; guint msgnum; GError *error; GVariant *messages; GVariantIter miterl1, miterl2; GVariant *mnodel1, *mnodel2; if (mmguicore == NULL) return FALSE; mmguicorelc = (mmguicore_t)mmguicore; if (mmguicorelc->moduledata == NULL) return FALSE; moduledata = (moduledata_t)mmguicorelc->moduledata; if (mmguicorelc->device == NULL) return FALSE; device = mmguicorelc->device; if (moduledata->smsproxy == NULL) return FALSE; if (!device->enabled) return FALSE; if (!(device->smscaps & MMGUI_SMS_CAPS_RECEIVE)) return FALSE; if (moduledata->needsmspolling) { currenttime = time(NULL); if (abs((gint)difftime(moduledata->polltimestamp, currenttime)) >= MMGUI_MODULE_SMS_POLL_INTERVAL) { moduledata->polltimestamp = currenttime; error = NULL; messages = g_dbus_proxy_call_sync(moduledata->smsproxy, "List", NULL, 0, -1, NULL, &error); if ((messages == NULL) && (error != NULL)) { g_error_free(error); msgnum = 0; } else { msgnum = 0; g_variant_iter_init(&miterl1, messages); while ((mnodel1 = g_variant_iter_next_value(&miterl1)) != NULL) { g_variant_iter_init(&miterl2, mnodel1); while ((mnodel2 = g_variant_iter_next_value(&miterl2)) != NULL) { msgnum++; g_variant_unref(mnodel2); } g_variant_unref(mnodel1); } g_variant_unref(messages); } g_debug("SMS messages number from polling handler: %u\n", msgnum); if (msgnum > 0) { if (mmguicorelc->eventcb != NULL) { (mmguicorelc->eventcb)(MMGUI_EVENT_SMS_LIST_READY, mmguicore, GUINT_TO_POINTER(TRUE)); } } } } return TRUE; } static gboolean mmgui_module_devices_update_registration(gpointer mmguicore, guint regstatus, gchar *operatorcode, gchar *operatorname) { mmguicore_t mmguicorelc; mmguidevice_t device; if ((mmguicore == NULL) || (operatorcode == NULL) || (operatorname == NULL)) return FALSE; if (mmguicore == NULL) return FALSE; mmguicorelc = (mmguicore_t)mmguicore; if (mmguicorelc->device == NULL) return FALSE; device = mmguicorelc->device; if (device->operatorcode != NULL) { g_free(device->operatorcode); } if (device->operatorname != NULL) { g_free(device->operatorname); } device->registered = mmgui_module_device_registered_from_status(regstatus); device->operatorcode = g_strdup(operatorcode); device->operatorname = g_strdup(operatorname); return TRUE; } static gboolean mmgui_module_devices_update_device_mode(gpointer mmguicore, gint oldstate, gint newstate, guint changereason) { mmguicore_t mmguicorelc; moduledata_t moduledata; mmguidevice_t device; gboolean enabledsignal, blockedsignal, oldenabled, oldblocked; gsize strsize; GVariant *data; GError *error; gchar *blockstr; if (mmguicore == NULL) return FALSE; mmguicorelc = (mmguicore_t)mmguicore; if (mmguicorelc->moduledata == NULL) return FALSE; moduledata = (moduledata_t)mmguicorelc->moduledata; if (mmguicorelc->device == NULL) return FALSE; device = mmguicorelc->device; /*Upadate state flags*/ if (device->operation != MMGUI_DEVICE_OPERATION_ENABLE) { oldenabled = device->enabled; device->enabled = mmgui_module_device_enabled_from_state(newstate); } oldblocked = device->blocked; if (moduledata->modemproxy != NULL) { /*Device blocked status*/ data = g_dbus_proxy_get_cached_property(moduledata->modemproxy, "UnlockRequired"); if (data != NULL) { blockstr = (gchar *)g_variant_get_string(data, &strsize); device->blocked = mmgui_module_device_locked_from_unlock_string(blockstr); g_variant_unref(data); } else { device->blocked = FALSE; } } /*Is enabled signal needed */ if ((device->operation != MMGUI_DEVICE_OPERATION_ENABLE) && (oldenabled = device->enabled)) { enabledsignal = TRUE; } else { enabledsignal = FALSE; } /*Is blocked signal needed */ if (oldblocked != device->blocked) { blockedsignal = TRUE; } else { blockedsignal = FALSE; } /*Return if no signals will be sent*/ if ((!enabledsignal) && (!blockedsignal)) return TRUE; if (moduledata->cardproxy != NULL) { if (device->type == MMGUI_DEVICE_TYPE_GSM) { if (device->enabled) { //IMEI if (device->imei != NULL) { g_free(device->imei); device->imei = NULL; } error = NULL; data = g_dbus_proxy_call_sync(moduledata->cardproxy, "GetImei", NULL, 0, -1, NULL, &error); if ((data == NULL) && (error != NULL)) { mmgui_module_handle_error_message(mmguicorelc, error); g_error_free(error); } else { g_variant_get(data, "(s)", &device->imei); device->imei = g_strdup(device->imei); g_variant_unref(data); } } if (device->enabled) { //IMSI if (device->imsi != NULL) { g_free(device->imsi); device->imsi = NULL; } error = NULL; data = g_dbus_proxy_call_sync(moduledata->cardproxy, "GetImsi", NULL, 0, -1, NULL, &error); if ((data == NULL) && (error != NULL)) { mmgui_module_handle_error_message(mmguicorelc, error); g_error_free(error); } else { g_variant_get(data, "(s)", &device->imsi); device->imsi = g_strdup(device->imsi); g_variant_unref(data); } } } else if (device->type == MMGUI_DEVICE_TYPE_CDMA) { if (device->enabled) { //ESN if (device->imei != NULL) { g_free(device->imei); device->imei = NULL; } error = NULL; data = g_dbus_proxy_call_sync(moduledata->cardproxy, "GetEsn", NULL, 0, -1, NULL, &error); if ((data == NULL) && (error != NULL)) { mmgui_module_handle_error_message(mmguicorelc, error); g_error_free(error); } else { g_variant_get(data, "(s)", &device->imsi); device->imsi = g_strdup(device->imsi); g_variant_unref(data); } } //No IMSI in CDMA if (device->imsi != NULL) { g_free(device->imsi); device->imsi = NULL; } } } /*Enabled signal */ if (enabledsignal) { if (mmguicorelc->eventcb != NULL) { (mmguicorelc->eventcb)(MMGUI_EVENT_DEVICE_ENABLED_STATUS, mmguicorelc, GUINT_TO_POINTER(device->enabled)); } } /*Is blocked signal needed */ if (blockedsignal) { if (mmguicorelc->eventcb != NULL) { (mmguicorelc->eventcb)(MMGUI_EVENT_DEVICE_BLOCKED_STATUS, mmguicorelc, GUINT_TO_POINTER(device->blocked)); } } return TRUE; } static gboolean mmgui_module_devices_update_mode(gpointer mmguicore) { mmguicore_t mmguicorelc; moduledata_t moduledata; mmguidevice_t device; GVariant *data; if (mmguicore == NULL) return FALSE; mmguicorelc = (mmguicore_t)mmguicore; if (mmguicorelc->moduledata == NULL) return FALSE; moduledata = (moduledata_t)mmguicorelc->moduledata; if (mmguicorelc->device == NULL) return FALSE; device = mmguicorelc->device; if (moduledata->netproxy != NULL) { //Allowed mode data = g_dbus_proxy_get_cached_property(moduledata->netproxy, "AllowedMode"); device->allmode = g_variant_get_uint32(data); g_variant_unref(data); //Access technology data = g_dbus_proxy_get_cached_property(moduledata->netproxy, "AccessTechnology"); device->mode = g_variant_get_uint32(data); g_variant_unref(data); return TRUE; } return FALSE; } static gboolean mmgui_module_devices_update_location(gpointer mmguicore, mmguidevice_t device) { mmguicore_t mmguicorelc; moduledata_t moduledata; GVariant *data; GVariantIter *iter; guint32 locationtype; GVariant *locationdata; gchar *locationstring; gsize strlength; GError *error; if ((mmguicore == NULL) || (device == NULL)) return FALSE; mmguicorelc = (mmguicore_t)mmguicore; if (mmguicorelc->moduledata == NULL) return FALSE; moduledata = (moduledata_t)mmguicorelc->moduledata; if ((!(device->locationcaps & MMGUI_LOCATION_CAPS_3GPP)) && (!(device->locationcaps & MMGUI_LOCATION_CAPS_GPS))) return FALSE; error = NULL; data = g_dbus_proxy_call_sync(moduledata->locationproxy, "GetLocation", NULL, 0, -1, NULL, &error); if ((data != NULL) && (error == NULL)) { g_variant_get(data, "(a{uv})", &iter); while (g_variant_iter_next(iter, "{uv}", &locationtype, &locationdata)) { if ((locationtype == MODULE_INT_MODEM_LOCATION_CAPABILITY_GSM_LAC_CI) && (locationdata != NULL)) { //3GPP location strlength = 256; locationstring = g_strdup(g_variant_get_string(locationdata, &strlength)); device->loc3gppdata[0] = (guint)strtol(strsep(&locationstring, ","), NULL, 10); device->loc3gppdata[1] = (guint)strtol(strsep(&locationstring, ","), NULL, 10); device->loc3gppdata[2] = (guint)strtol(strsep(&locationstring, ","), NULL, 16); device->loc3gppdata[3] = (guint)strtol(strsep(&locationstring, ","), NULL, 16); g_free(locationstring); g_variant_unref(locationdata); g_debug("3GPP location: %u, %u, %4x, %4x", device->loc3gppdata[0], device->loc3gppdata[1], device->loc3gppdata[2], device->loc3gppdata[3]); } } g_variant_unref(data); return TRUE; } else { if (device->locationcaps & MMGUI_LOCATION_CAPS_3GPP) { memset(device->loc3gppdata, 0, sizeof(device->loc3gppdata)); } if (device->locationcaps & MMGUI_LOCATION_CAPS_GPS) { memset(device->locgpsdata, 0, sizeof(device->locgpsdata)); } mmgui_module_handle_error_message(mmguicorelc, error); g_error_free(error); return FALSE; } } static gboolean mmgui_module_devices_enable_location(gpointer mmguicore, mmguidevice_t device, gboolean enable) { mmguicore_t mmguicorelc; moduledata_t moduledata; GVariant *properties; guint locationtypes; GError *error; if ((mmguicore == NULL) || (device == NULL)) return FALSE; mmguicorelc = (mmguicore_t)mmguicore; if (mmguicorelc->moduledata == NULL) return FALSE; moduledata = (moduledata_t)mmguicorelc->moduledata; if (!device->enabled) return FALSE; if (moduledata->locationproxy == NULL) return FALSE; if ((enable) && ((device->locationcaps & MMGUI_LOCATION_CAPS_3GPP) || (device->locationcaps & MMGUI_LOCATION_CAPS_GPS))) return TRUE; if ((!enable) && ((!(device->locationcaps & MMGUI_LOCATION_CAPS_3GPP)) && (!(device->locationcaps & MMGUI_LOCATION_CAPS_GPS)))) return TRUE; if (enable) { //Determine supported capabilities and turn on location engine properties = g_dbus_proxy_get_cached_property(moduledata->locationproxy, "Capabilities"); if (properties != NULL) { locationtypes = g_variant_get_uint32(properties); if (locationtypes & MODULE_INT_MODEM_LOCATION_CAPABILITY_GSM_LAC_CI) { error = NULL; //Apply new settings g_dbus_proxy_call_sync(moduledata->locationproxy, "Enable", g_variant_new("(bb)", TRUE, TRUE), 0, -1, NULL, &error); //Set enabled properties if (error == NULL) { //3gpp location if (locationtypes & MODULE_INT_MODEM_LOCATION_CAPABILITY_GSM_LAC_CI) { device->locationcaps |= MMGUI_LOCATION_CAPS_3GPP; } return TRUE; } else { mmgui_module_handle_error_message(mmguicorelc, error); g_error_free(error); } } g_variant_unref(properties); } } else { error = NULL; g_dbus_proxy_call_sync(moduledata->locationproxy, "Enable", g_variant_new("(bb)", FALSE, FALSE), 0, -1, NULL, &error); if (error == NULL) { return TRUE; } else { mmgui_module_handle_error_message(mmguicorelc, error); g_error_free(error); } } return FALSE; } G_MODULE_EXPORT gboolean mmgui_module_devices_information(gpointer mmguicore) { mmguicore_t mmguicorelc; moduledata_t moduledata; mmguidevice_t device; GVariant *data; GError *error; gchar *blockstr; gsize strsize = 256; if (mmguicore == NULL) return FALSE; mmguicorelc = (mmguicore_t)mmguicore; if (mmguicorelc->moduledata == NULL) return FALSE; moduledata = (moduledata_t)mmguicorelc->moduledata; if (mmguicorelc->device == NULL) return FALSE; device = mmguicorelc->device; if (moduledata->modemproxy != NULL) { //Is device enabled data = g_dbus_proxy_get_cached_property(moduledata->modemproxy, "Enabled"); if (data != NULL) { device->enabled = g_variant_get_boolean(data); g_variant_unref(data); } else { device->enabled = TRUE; g_printf("Failed to get device enabled state\n"); } //Is device blocked data = g_dbus_proxy_get_cached_property(moduledata->modemproxy, "UnlockRequired"); if (data != NULL) { blockstr = (gchar *)g_variant_get_string(data, &strsize); device->blocked = mmgui_module_device_locked_from_unlock_string(blockstr); g_variant_unref(data); } else { device->blocked = FALSE; g_printf("Failed to get device blocked state\n"); } } if (moduledata->netproxy != NULL) { if (device->enabled) { //Signal level device->siglevel = 0; error = NULL; data = g_dbus_proxy_call_sync(moduledata->netproxy, "GetSignalQuality", NULL, 0, -1, NULL, &error); if ((data == NULL) && (error != NULL)) { mmgui_module_handle_error_message(mmguicorelc, error); g_error_free(error); } else { g_variant_get(data, "(u)", &device->siglevel); g_variant_unref(data); } } //Operator if (device->operatorcode != NULL) { g_free(device->operatorcode); device->operatorcode = NULL; } if (device->operatorname != NULL) { g_free(device->operatorname); device->operatorname = NULL; } device->regstatus = 0; error = NULL; data = g_dbus_proxy_call_sync(moduledata->netproxy, "GetRegistrationInfo", NULL, 0, -1, NULL, &error); if ((data == NULL) && (error != NULL)) { mmgui_module_handle_error_message(mmguicorelc, error); g_error_free(error); } else { g_variant_get(data, "((uss))", &device->regstatus, &device->operatorcode, &device->operatorname); device->registered = mmgui_module_device_registered_from_status(device->regstatus); device->operatorcode = g_strdup(device->operatorcode); device->operatorname = g_strdup(device->operatorname); g_variant_unref(data); } //Allowed mode data = g_dbus_proxy_get_cached_property(moduledata->netproxy, "AllowedMode"); if (data != NULL) { device->allmode = g_variant_get_uint32(data); g_variant_unref(data); } else { device->allmode = 0; g_printf("Failed to get device allowed mode\n"); } //Access technology data = g_dbus_proxy_get_cached_property(moduledata->netproxy, "AccessTechnology"); if (data != NULL) { device->mode = g_variant_get_uint32(data); g_variant_unref(data); } else { device->mode = 0; g_printf("Failed to get device access mode\n"); } } if (moduledata->cardproxy != NULL) { if (device->type == MMGUI_DEVICE_TYPE_GSM) { if (device->enabled) { //IMEI if (device->imei != NULL) { g_free(device->imei); device->imei = NULL; } error = NULL; data = g_dbus_proxy_call_sync(moduledata->cardproxy, "GetImei", NULL, 0, -1, NULL, &error); if ((data == NULL) && (error != NULL)) { mmgui_module_handle_error_message(mmguicorelc, error); g_error_free(error); } else { g_variant_get(data, "(s)", &device->imei); device->imei = g_strdup(device->imei); g_variant_unref(data); } } if (device->enabled) { //IMSI if (device->imsi != NULL) { g_free(device->imsi); device->imsi = NULL; } error = NULL; data = g_dbus_proxy_call_sync(moduledata->cardproxy, "GetImsi", NULL, 0, -1, NULL, &error); if ((data == NULL) && (error != NULL)) { mmgui_module_handle_error_message(mmguicorelc, error); g_error_free(error); } else { g_variant_get(data, "(s)", &device->imsi); device->imsi = g_strdup(device->imsi); g_variant_unref(data); } } } else if (device->type == MMGUI_DEVICE_TYPE_CDMA) { if (device->enabled) { //ESN if (device->imei != NULL) { g_free(device->imei); device->imei = NULL; } error = NULL; data = g_dbus_proxy_call_sync(moduledata->cardproxy, "GetEsn", NULL, 0, -1, NULL, &error); if ((data == NULL) && (error != NULL)) { mmgui_module_handle_error_message(mmguicorelc, error); g_error_free(error); } else { g_variant_get(data, "(s)", &device->imsi); device->imsi = g_strdup(device->imsi); g_variant_unref(data); } } //No IMSI in CDMA if (device->imsi != NULL) { g_free(device->imsi); device->imsi = NULL; } } } //Update location if (moduledata->service == MODULE_INT_SERVICE_MODEM_MANAGER) { mmgui_module_devices_update_location(mmguicore, device); } //Network time. This code makes ModemManager crash, so it commented out /*gchar *timev; if (moduledata->timeproxy != NULL) { error = NULL; data = g_dbus_proxy_call_sync(moduledata->timeproxy, "GetNetworkTime", NULL, 0, -1, NULL, &error); if ((data == NULL) && (error != NULL)) { mmgui_module_print_error_message(error); g_error_free(error); } else { g_variant_get(data, "(s)", &timev); //device->imsi = g_strdup(device->imsi); g_variant_unref(data); } }*/ return TRUE; } G_MODULE_EXPORT gboolean mmgui_module_devices_open(gpointer mmguicore, mmguidevice_t device) { mmguicore_t mmguicorelc; moduledata_t moduledata; GError *error; GVariant *data; if ((mmguicore == NULL) || (device == NULL)) return FALSE; mmguicorelc = (mmguicore_t)mmguicore; if (mmguicorelc->moduledata == NULL) return FALSE; moduledata = (moduledata_t)mmguicorelc->moduledata; //ModemManager uses 'Modems' prefix and Wader uses 'Devices' prefix //SIM card interface if (device->type == MMGUI_DEVICE_TYPE_GSM) { error = NULL; moduledata->cardproxy = g_dbus_proxy_new_sync(moduledata->connection, G_DBUS_PROXY_FLAGS_NONE, NULL, "org.freedesktop.ModemManager", device->objectpath, "org.freedesktop.ModemManager.Modem.Gsm.Card", NULL, &error); if ((moduledata->cardproxy == NULL) && (error != NULL)) { mmgui_module_handle_error_message(mmguicorelc, error); g_error_free(error); } } else if (device->type == MMGUI_DEVICE_TYPE_CDMA) { error = NULL; moduledata->cardproxy = g_dbus_proxy_new_sync(moduledata->connection, G_DBUS_PROXY_FLAGS_NONE, NULL, "org.freedesktop.ModemManager", device->objectpath, "org.freedesktop.ModemManager.Modem.Cdma", NULL, &error); if ((moduledata->cardproxy == NULL) && (error != NULL)) { mmgui_module_handle_error_message(mmguicorelc, error); g_error_free(error); } } //Mobile network interface error = NULL; moduledata->netproxy = g_dbus_proxy_new_sync(moduledata->connection, G_DBUS_PROXY_FLAGS_NONE, NULL, "org.freedesktop.ModemManager", device->objectpath, "org.freedesktop.ModemManager.Modem.Gsm.Network", NULL, &error); if ((moduledata->netproxy == NULL) && (error != NULL)) { device->scancaps = MMGUI_SCAN_CAPS_NONE; mmgui_module_handle_error_message(mmguicorelc, error); g_error_free(error); } else { device->scancaps = MMGUI_SCAN_CAPS_OBSERVE; moduledata->netsignal = g_signal_connect(moduledata->netproxy, "g-signal", G_CALLBACK(mmgui_signal_handler), mmguicore); } //Modem interface error = NULL; moduledata->modemproxy = g_dbus_proxy_new_sync(moduledata->connection, G_DBUS_PROXY_FLAGS_NONE, NULL, "org.freedesktop.ModemManager", device->objectpath, "org.freedesktop.ModemManager.Modem", NULL, &error); if ((moduledata->modemproxy == NULL) && (error != NULL)) { mmgui_module_handle_error_message(mmguicorelc, error); g_error_free(error); } else { moduledata->statesignal = g_signal_connect(moduledata->modemproxy, "g-signal", G_CALLBACK(mmgui_signal_handler), mmguicore); } //SMS interface error = NULL; moduledata->smsproxy = g_dbus_proxy_new_sync(moduledata->connection, G_DBUS_PROXY_FLAGS_NONE, NULL, "org.freedesktop.ModemManager", device->objectpath, "org.freedesktop.ModemManager.Modem.Gsm.SMS", NULL, &error); if ((moduledata->smsproxy == NULL) && (error != NULL)) { device->smscaps = MMGUI_SMS_CAPS_NONE; mmgui_module_handle_error_message(mmguicorelc, error); g_error_free(error); } else { device->smscaps = MMGUI_SMS_CAPS_RECEIVE | MMGUI_SMS_CAPS_SEND; moduledata->smssignal = g_signal_connect(moduledata->smsproxy, "g-signal", G_CALLBACK(mmgui_signal_handler), mmguicore); } //Assume fully-fuctional modem manager moduledata->needsmspolling = FALSE; if (moduledata->service == MODULE_INT_SERVICE_MODEM_MANAGER) { //USSD interface error = NULL; moduledata->ussdproxy = g_dbus_proxy_new_sync(moduledata->connection, G_DBUS_PROXY_FLAGS_NONE, NULL, "org.freedesktop.ModemManager", device->objectpath, "org.freedesktop.ModemManager.Modem.Gsm.Ussd", NULL, &error); if ((moduledata->ussdproxy == NULL) && (error != NULL)) { device->ussdcaps = MMGUI_USSD_CAPS_NONE; mmgui_module_handle_error_message(mmguicorelc, error); g_error_free(error); } else { device->ussdcaps = MMGUI_USSD_CAPS_SEND; } //Location interface (capabilities will be defined later) error = NULL; moduledata->locationproxy = g_dbus_proxy_new_sync(moduledata->connection, G_DBUS_PROXY_FLAGS_NONE, NULL, "org.freedesktop.ModemManager", device->objectpath, "org.freedesktop.ModemManager.Modem.Location", NULL, &error); if ((moduledata->locationproxy == NULL) && (error != NULL)) { mmgui_module_handle_error_message(mmguicorelc, error); g_error_free(error); } else { if (mmgui_module_devices_enable_location(mmguicore, device, TRUE)) { moduledata->locationpropsignal = g_signal_connect(moduledata->locationproxy, "g-properties-changed", G_CALLBACK(mmgui_property_change_handler), mmguicore); } } //Time interface error = NULL; moduledata->timeproxy = g_dbus_proxy_new_sync(moduledata->connection, G_DBUS_PROXY_FLAGS_NONE, NULL, "org.freedesktop.ModemManager", device->objectpath, "org.freedesktop.ModemManager.Modem.Time", NULL, &error); if ((moduledata->timeproxy == NULL) && (error != NULL)) { moduledata->needsmspolling = TRUE; moduledata->polltimestamp = time(NULL); device->smscaps &= ~MMGUI_SMS_CAPS_SEND; g_error_free(error); } else { data = g_dbus_proxy_get_cached_property(moduledata->timeproxy, "NetworkTimezone"); if (data != NULL) { g_debug("SMS messages polling disabled\n"); moduledata->needsmspolling = FALSE; g_object_unref(data); } else { g_debug("SMS messages polling enabled\n"); moduledata->needsmspolling = TRUE; moduledata->polltimestamp = time(NULL); device->smscaps &= ~MMGUI_SMS_CAPS_SEND; } } //No contacts API device->contactscaps = MMGUI_CONTACTS_CAPS_NONE; } else if (moduledata->service == MODULE_INT_SERVICE_WADER) { //Contacts manipulation interface supported only by Wader error = NULL; moduledata->contactsproxy = g_dbus_proxy_new_sync(moduledata->connection, G_DBUS_PROXY_FLAGS_NONE, NULL, "org.freedesktop.ModemManager", device->objectpath, "org.freedesktop.ModemManager.Modem.Gsm.Contacts", NULL, &error); if ((moduledata->contactsproxy == NULL) && (error != NULL)) { device->contactscaps = MMGUI_CONTACTS_CAPS_NONE; mmgui_module_handle_error_message(mmguicorelc, error); g_error_free(error); } else { device->contactscaps = MMGUI_CONTACTS_CAPS_EXPORT | MMGUI_CONTACTS_CAPS_EDIT; } //USSD interface is broken device->ussdcaps = MMGUI_USSD_CAPS_NONE; //No location API device->locationcaps = MMGUI_LOCATION_CAPS_NONE; } //Update device information using created proxy objects mmgui_module_devices_information(mmguicore); //Initialize SMS database return TRUE; } G_MODULE_EXPORT gboolean mmgui_module_devices_close(gpointer mmguicore) { mmguicore_t mmguicorelc; moduledata_t moduledata; if (mmguicore == NULL) return FALSE; mmguicorelc = (mmguicore_t)mmguicore; if (mmguicorelc->moduledata == NULL) return FALSE; moduledata = (moduledata_t)mmguicorelc->moduledata; //Close SMS database //Free resources //Change device pointer if (moduledata->cardproxy != NULL) { g_object_unref(moduledata->cardproxy); moduledata->cardproxy = NULL; } if (moduledata->netproxy != NULL) { if (g_signal_handler_is_connected(moduledata->netproxy, moduledata->netsignal)) { g_signal_handler_disconnect(moduledata->netproxy, moduledata->netsignal); } g_object_unref(moduledata->netproxy); moduledata->netproxy = NULL; } if (moduledata->modemproxy != NULL) { if (g_signal_handler_is_connected(moduledata->modemproxy, moduledata->statesignal)) { g_signal_handler_disconnect(moduledata->modemproxy, moduledata->statesignal); } g_object_unref(moduledata->modemproxy); moduledata->modemproxy = NULL; } if (moduledata->smsproxy != NULL) { if (g_signal_handler_is_connected(moduledata->smsproxy, moduledata->smssignal)) { g_signal_handler_disconnect(moduledata->smsproxy, moduledata->smssignal); } g_object_unref(moduledata->smsproxy); moduledata->smsproxy = NULL; } if (moduledata->service == MODULE_INT_SERVICE_MODEM_MANAGER) { if (moduledata->ussdproxy != NULL) { g_object_unref(moduledata->ussdproxy); moduledata->ussdproxy = NULL; } } if (moduledata->service == MODULE_INT_SERVICE_MODEM_MANAGER) { if (moduledata->locationproxy != NULL) { if (g_signal_handler_is_connected(moduledata->locationproxy, moduledata->locationpropsignal)) { g_signal_handler_disconnect(moduledata->locationproxy, moduledata->locationpropsignal); } g_object_unref(moduledata->locationproxy); moduledata->locationproxy = NULL; } if (moduledata->timeproxy != NULL) { g_object_unref(moduledata->timeproxy); moduledata->timeproxy = NULL; } } else if (moduledata->service == MODULE_INT_SERVICE_WADER) { if (moduledata->contactsproxy != NULL) { g_object_unref(moduledata->contactsproxy); moduledata->contactsproxy = NULL; } } return TRUE; } static gboolean mmgui_module_devices_restart_ussd(gpointer mmguicore) { mmguicore_t mmguicorelc; moduledata_t moduledata; mmguidevice_t device; GError *error; if (mmguicore == NULL) return FALSE; mmguicorelc = (mmguicore_t)mmguicore; if (mmguicorelc->moduledata == NULL) return FALSE; moduledata = (moduledata_t)mmguicorelc->moduledata; if (mmguicorelc->device == NULL) return FALSE; device = mmguicorelc->device; if (moduledata->ussdproxy != NULL) { device->ussdcaps = MMGUI_USSD_CAPS_NONE; g_object_unref(moduledata->ussdproxy); } if (moduledata->service == MODULE_INT_SERVICE_MODEM_MANAGER) { error = NULL; moduledata->ussdproxy = g_dbus_proxy_new_sync(moduledata->connection, G_DBUS_PROXY_FLAGS_NONE, NULL, "org.freedesktop.ModemManager", device->objectpath, "org.freedesktop.ModemManager.Modem.Gsm.Ussd", NULL, &error); if ((moduledata->ussdproxy == NULL) && (error != NULL)) { device->ussdcaps = MMGUI_USSD_CAPS_NONE; mmgui_module_handle_error_message(mmguicorelc, error); g_error_free(error); return FALSE; } else { device->ussdcaps = MMGUI_USSD_CAPS_SEND; return TRUE; } } } static void mmgui_module_devices_enable_handler(GDBusProxy *proxy, GAsyncResult *res, gpointer user_data) { mmguicore_t mmguicorelc; moduledata_t moduledata; GError *error; GVariant *result; gboolean newstate; mmguicorelc = (mmguicore_t)user_data; if (mmguicorelc == NULL) return; if (mmguicorelc->moduledata == NULL) return; moduledata = (moduledata_t)mmguicorelc->moduledata; error = NULL; result = g_dbus_proxy_call_finish(proxy, res, &error); if ((result == NULL) && (error != NULL)) { if ((moduledata->cancellable == NULL) || ((moduledata->cancellable != NULL) && (!g_cancellable_is_cancelled(moduledata->cancellable)))) { mmgui_module_handle_error_message(mmguicorelc, error); } g_error_free(error); newstate = FALSE; } else { g_variant_unref(result); newstate = mmguicorelc->device->enabled; //Update device state result = g_dbus_proxy_get_cached_property(proxy, "Enabled"); mmguicorelc->device->enabled = g_variant_get_boolean(result); g_variant_unref(result); //If device state changed - return TRUE if (newstate != mmguicorelc->device->enabled) { newstate = TRUE; } else { newstate = FALSE; } } if (mmguicorelc->device != NULL) { mmguicorelc->device->operation = MMGUI_DEVICE_OPERATION_IDLE; } if ((mmguicorelc->eventcb != NULL) && ((moduledata->cancellable == NULL) || ((moduledata->cancellable != NULL) && (!g_cancellable_is_cancelled(moduledata->cancellable))))) { (mmguicorelc->eventcb)(MMGUI_EVENT_MODEM_ENABLE_RESULT, user_data, GUINT_TO_POINTER(newstate)); } } G_MODULE_EXPORT gboolean mmgui_module_devices_enable(gpointer mmguicore, gboolean enabled) { mmguicore_t mmguicorelc; moduledata_t moduledata; if (mmguicore == NULL) return FALSE; mmguicorelc = (mmguicore_t)mmguicore; if (mmguicorelc->moduledata == NULL) return FALSE; moduledata = (moduledata_t)mmguicorelc->moduledata; if (moduledata->modemproxy == NULL) return FALSE; if (mmguicorelc->device == NULL) return FALSE; //Device already in requested state if (mmguicorelc->device->enabled == enabled) return TRUE; mmguicorelc->device->operation = MMGUI_DEVICE_OPERATION_ENABLE; if (moduledata->cancellable != NULL) { g_cancellable_reset(moduledata->cancellable); } g_dbus_proxy_call(moduledata->modemproxy, "Enable", g_variant_new("(b)", enabled), G_DBUS_CALL_FLAGS_NONE, moduledata->timeouts[MMGUI_DEVICE_OPERATION_ENABLE], moduledata->cancellable, (GAsyncReadyCallback)mmgui_module_devices_enable_handler, mmguicore); return TRUE; } static time_t mmgui_module_str_to_time(const gchar *str) { guint i, len; gchar strbuf[3]; struct tm btime; time_t timestamp; gint *fields[] = {&btime.tm_year, &btime.tm_mon, &btime.tm_mday, &btime.tm_hour, &btime.tm_min, &btime.tm_sec}; timestamp = time(NULL); if (str == NULL) return timestamp; len = strlen(str); if (len > 12) { if (str[12] == '+') { //v.0.4.998 timestamp format for (i=0; i<6; i++) { strncpy(strbuf, str+(i*2), 2); strbuf[2] = '\0'; *fields[i] = atoi(strbuf); } } else if (str[8] == ',') { //v.0.5.2 timestamp format for (i=0; i<6; i++) { strncpy(strbuf, str+(i*3), 2); strbuf[2] = '\0'; *fields[i] = atoi(strbuf); } } btime.tm_year += 100; btime.tm_mon -= 1; timestamp = mktime(&btime); } return timestamp; } static mmgui_sms_message_t mmgui_module_sms_retrieve(mmguicore_t mmguicore, GVariant *messagev) { moduledata_t moduledata; mmgui_sms_message_t message; GVariant *value; gsize strlength; const gchar *valuestr; gboolean gottext, gotindex; guint index; if ((mmguicore == NULL) || (messagev == NULL)) return NULL; if (mmguicore->moduledata == NULL) return NULL; moduledata = (moduledata_t)mmguicore->moduledata; message = mmgui_smsdb_message_create(); //Sender number value = g_variant_lookup_value(messagev, "number", G_VARIANT_TYPE_STRING); if (value != NULL) { strlength = 256; valuestr = g_variant_get_string(value, &strlength); mmgui_smsdb_message_set_number(message, valuestr); g_debug("SMS number: %s\n", valuestr); g_variant_unref(value); } else { mmgui_smsdb_message_set_number(message, "--"); } //Service center number value = g_variant_lookup_value(messagev, "smsc", G_VARIANT_TYPE_STRING); if (value != NULL) { strlength = 256; valuestr = g_variant_get_string(value, &strlength); mmgui_smsdb_message_set_service_number(message, valuestr); g_debug("SMS service center number: %s\n", valuestr); g_variant_unref(value); } else { mmgui_smsdb_message_set_service_number(message, "--"); } //Decoded message text gottext = FALSE; value = g_variant_lookup_value(messagev, "text", G_VARIANT_TYPE_STRING); if (value != NULL) { strlength = 256*160; valuestr = g_variant_get_string(value, &strlength); g_debug("SMS text: %s\n", valuestr); mmgui_smsdb_message_set_text(message, valuestr, FALSE); gottext = TRUE; g_variant_unref(value); } else { value = g_variant_lookup_value(messagev, "data", G_VARIANT_TYPE_BYTESTRING); if (value != NULL) { strlength = g_variant_get_size(value); if (strlength > 0) { valuestr = g_variant_get_data(value); mmgui_smsdb_message_set_binary(message, TRUE); mmgui_smsdb_message_set_data(message, valuestr, strlength, FALSE); gottext = TRUE; } g_variant_unref(value); } } //Message timestamp (ModemManager uses string, Wader uses double) if (moduledata->service == MODULE_INT_SERVICE_MODEM_MANAGER) { value = g_variant_lookup_value(messagev, "timestamp", G_VARIANT_TYPE_STRING); if (value != NULL) { strlength = 256; valuestr = g_variant_get_string(value, &strlength); mmgui_smsdb_message_set_timestamp(message, mmgui_module_str_to_time(valuestr)); //g_debug("SMS timestamp: %ul\n", message->timestamp); g_variant_unref(value); } } else if (moduledata->service == MODULE_INT_SERVICE_WADER) { value = g_variant_lookup_value(messagev, "timestamp", G_VARIANT_TYPE_DOUBLE); if (value != NULL) { mmgui_smsdb_message_set_timestamp(message, (time_t)g_variant_get_double(value)); //g_debug("SMS timestamp: %ul\n", message->timestamp); g_variant_unref(value); } } /*Message index (ModemManager uses unsigned integer, Wader uses signed one.) This is a critical parameter, so message will be skipped if index value unknown.*/ gotindex = FALSE; if (moduledata->service == MODULE_INT_SERVICE_MODEM_MANAGER) { value = g_variant_lookup_value(messagev, "index", G_VARIANT_TYPE_UINT32); if (value != NULL) { index = g_variant_get_uint32(value); g_variant_unref(value); gotindex = TRUE; } } else if (moduledata->service == MODULE_INT_SERVICE_WADER) { value = g_variant_lookup_value(messagev, "index", G_VARIANT_TYPE_INT32); if (value != NULL) { index = (guint)g_variant_get_int32(value); g_variant_unref(value); gotindex = TRUE; } } //Return message if ((!gotindex) || (!gottext)) { //Message identifier unknown or no text - skip it mmgui_smsdb_message_free(message); return NULL; } else { //Return message mmgui_smsdb_message_set_identifier(message, index, FALSE); g_debug("SMS index: %u\n", index); return message; } } G_MODULE_EXPORT guint mmgui_module_sms_enum(gpointer mmguicore, GSList **smslist) { mmguicore_t mmguicorelc; moduledata_t moduledata; GError *error; GVariant *messages; guint msgnum; GVariantIter miterl1, miterl2; GVariant *mnodel1, *mnodel2; mmgui_sms_message_t message; if ((mmguicore == NULL) || (smslist == NULL)) return 0; mmguicorelc = (mmguicore_t)mmguicore; if (mmguicorelc->moduledata == NULL) return 0; moduledata = (moduledata_t)mmguicorelc->moduledata; if (moduledata->smsproxy == NULL) return 0; if (mmguicorelc->device == NULL) return 0; if (!mmguicorelc->device->enabled) return 0; if (!(mmguicorelc->device->smscaps & MMGUI_SMS_CAPS_RECEIVE)) return 0; error = NULL; messages = g_dbus_proxy_call_sync(moduledata->smsproxy, "List", NULL, 0, -1, NULL, &error); if ((messages == NULL) && (error != NULL)) { mmgui_module_handle_error_message(mmguicorelc, error); g_error_free(error); return 0; } msgnum = 0; g_variant_iter_init(&miterl1, messages); while ((mnodel1 = g_variant_iter_next_value(&miterl1)) != NULL) { g_variant_iter_init(&miterl2, mnodel1); while ((mnodel2 = g_variant_iter_next_value(&miterl2)) != NULL) { message = mmgui_module_sms_retrieve(mmguicore, mnodel2); if (message != NULL) { *smslist = g_slist_prepend(*smslist, message); msgnum++; } g_variant_unref(mnodel2); } g_variant_unref(mnodel1); } g_variant_unref(messages); return msgnum; } G_MODULE_EXPORT mmgui_sms_message_t mmgui_module_sms_get(gpointer mmguicore, guint index) { mmguicore_t mmguicorelc; moduledata_t moduledata; GError *error; GVariant *indexv; GVariant *messagevt, *messagev; mmgui_sms_message_t message; if (mmguicore == NULL) return NULL; mmguicorelc = (mmguicore_t)mmguicore; if (mmguicorelc->moduledata == NULL) return NULL; moduledata = (moduledata_t)mmguicorelc->moduledata; if (moduledata->smsproxy == NULL) return NULL; if (mmguicorelc->device == NULL) return NULL; if (!mmguicorelc->device->enabled) return NULL; if (!(mmguicorelc->device->smscaps & MMGUI_SMS_CAPS_RECEIVE)) return NULL; error = NULL; indexv = g_variant_new("(u)", index); messagevt = g_dbus_proxy_call_sync(moduledata->smsproxy, "Get", indexv, 0, -1, NULL, &error); if ((messagevt == NULL) && (error != NULL)) { mmgui_module_handle_error_message(mmguicorelc, error); g_error_free(error); return NULL; } messagev = g_variant_get_child_value(messagevt, 0); message = mmgui_module_sms_retrieve(mmguicore, messagev); g_variant_unref(messagev); g_variant_unref(messagevt); return message; } G_MODULE_EXPORT gboolean mmgui_module_sms_delete(gpointer mmguicore, guint index) { mmguicore_t mmguicorelc; moduledata_t moduledata; GError *error; GVariant *indexv; if (mmguicore == NULL) return FALSE; mmguicorelc = (mmguicore_t)mmguicore; if (mmguicorelc->moduledata == NULL) return FALSE; moduledata = (moduledata_t)mmguicorelc->moduledata; if (moduledata->smsproxy == NULL) return FALSE; if (mmguicorelc->device == NULL) return FALSE; if (!mmguicorelc->device->enabled) return FALSE; if (!(mmguicorelc->device->smscaps & MMGUI_SMS_CAPS_RECEIVE)) return FALSE; error = NULL; indexv = g_variant_new("(u)", index); g_dbus_proxy_call_sync(moduledata->smsproxy, "Delete", indexv, 0, -1, NULL, &error); if (error != NULL) { mmgui_module_handle_error_message(mmguicorelc, error); g_error_free(error); return FALSE; } return TRUE; } static void mmgui_module_sms_send_handler(GDBusProxy *proxy, GAsyncResult *res, gpointer user_data) { mmguicore_t mmguicorelc; moduledata_t moduledata; GError *error; GVariant *result; gboolean sent; mmguicorelc = (mmguicore_t)user_data; if (mmguicorelc == NULL) return; if (mmguicorelc->moduledata == NULL) return; moduledata = (moduledata_t)mmguicorelc->moduledata; error = NULL; result = g_dbus_proxy_call_finish(proxy, res, &error); if ((result == NULL) && (error != NULL)) { if ((moduledata->cancellable == NULL) || ((moduledata->cancellable != NULL) && (!g_cancellable_is_cancelled(moduledata->cancellable)))) { mmgui_module_handle_error_message(mmguicorelc, error); } g_error_free(error); sent = FALSE; } else { g_variant_unref(result); sent = TRUE; } if (mmguicorelc->device != NULL) { mmguicorelc->device->operation = MMGUI_DEVICE_OPERATION_IDLE; } if ((mmguicorelc->eventcb != NULL) && ((moduledata->cancellable == NULL) || ((moduledata->cancellable != NULL) && (!g_cancellable_is_cancelled(moduledata->cancellable))))) { (mmguicorelc->eventcb)(MMGUI_EVENT_SMS_SENT, user_data, GUINT_TO_POINTER(sent)); } } G_MODULE_EXPORT gboolean mmgui_module_sms_send(gpointer mmguicore, gchar* number, gchar *text) { mmguicore_t mmguicorelc; moduledata_t moduledata; GVariantBuilder *builder; GVariant *array, *message; if ((number == NULL) || (text == NULL)) return FALSE; if (mmguicore == NULL) return FALSE; mmguicorelc = (mmguicore_t)mmguicore; if (mmguicorelc->moduledata == NULL) return FALSE; moduledata = (moduledata_t)mmguicorelc->moduledata; if (moduledata->smsproxy == NULL) return FALSE; if (mmguicorelc->device == NULL) return FALSE; if (!mmguicorelc->device->enabled) return FALSE; if (!(mmguicorelc->device->smscaps & MMGUI_SMS_CAPS_SEND)) return FALSE; builder = g_variant_builder_new(G_VARIANT_TYPE_ARRAY); g_variant_builder_add_parsed(builder, "{'number', <%s>}", number); g_variant_builder_add_parsed(builder, "{'text', <%s>}", text); array = g_variant_builder_end(builder); builder = g_variant_builder_new(G_VARIANT_TYPE_TUPLE); g_variant_builder_add_value(builder, array); message = g_variant_builder_end(builder); mmguicorelc->device->operation = MMGUI_DEVICE_OPERATION_SEND_SMS; if (moduledata->cancellable != NULL) { g_cancellable_reset(moduledata->cancellable); } g_dbus_proxy_call(moduledata->smsproxy, "Send", message, G_DBUS_CALL_FLAGS_NONE, moduledata->timeouts[MMGUI_DEVICE_OPERATION_SEND_SMS], moduledata->cancellable, (GAsyncReadyCallback)mmgui_module_sms_send_handler, mmguicore); return TRUE; } G_MODULE_EXPORT gboolean mmgui_module_ussd_cancel_session(gpointer mmguicore) { mmguicore_t mmguicorelc; moduledata_t moduledata; GError *error; if (mmguicore == NULL) return FALSE; mmguicorelc = (mmguicore_t)mmguicore; if (mmguicorelc->moduledata == NULL) return FALSE; moduledata = (moduledata_t)mmguicorelc->moduledata; if (moduledata->ussdproxy == NULL) return FALSE; if (mmguicorelc->device == NULL) return FALSE; if (!mmguicorelc->device->enabled) return FALSE; if (!(mmguicorelc->device->ussdcaps & MMGUI_USSD_CAPS_SEND)) return FALSE; error = NULL; g_dbus_proxy_call_sync(moduledata->ussdproxy, "Cancel", NULL, 0, -1, NULL, &error); if (error != NULL) { mmgui_module_handle_error_message(mmguicorelc, error); g_error_free(error); return FALSE; } return TRUE; } G_MODULE_EXPORT enum _mmgui_ussd_state mmgui_module_ussd_get_state(gpointer mmguicore) { mmguicore_t mmguicorelc; moduledata_t moduledata; GVariant *session; gchar *state; enum _mmgui_ussd_state stateid; gsize strsize; stateid = MMGUI_USSD_STATE_UNKNOWN; if (mmguicore == NULL) return stateid; mmguicorelc = (mmguicore_t)mmguicore; if (mmguicorelc->moduledata == NULL) return stateid; moduledata = (moduledata_t)mmguicorelc->moduledata; if (moduledata->ussdproxy == NULL) return stateid; if (mmguicorelc->device == NULL) return stateid; if (!mmguicorelc->device->enabled) return stateid; if (!(mmguicorelc->device->ussdcaps & MMGUI_USSD_CAPS_SEND)) return stateid; session = g_dbus_proxy_get_cached_property(moduledata->ussdproxy, "State"); if (session == NULL) return stateid; strsize = 256; state = (gchar *)g_variant_get_string(session, &strsize); if (state != NULL) { if (g_str_equal(state, "idle")) { stateid = MMGUI_USSD_STATE_IDLE; } else if (g_str_equal(state, "active")) { stateid = MMGUI_USSD_STATE_ACTIVE; } else if (g_str_equal(state, "user-response")) { stateid = MMGUI_USSD_STATE_USER_RESPONSE; } } g_variant_unref(session); return stateid; } static void mmgui_module_ussd_send_handler(GDBusProxy *proxy, GAsyncResult *res, gpointer user_data) { mmguicore_t mmguicorelc; moduledata_t moduledata; GError *error; GVariant *result; gchar *answer; mmguicorelc = (mmguicore_t)user_data; if (mmguicorelc == NULL) return; if (mmguicorelc->moduledata == NULL) return; moduledata = (moduledata_t)mmguicorelc->moduledata; error = NULL; answer = NULL; result = g_dbus_proxy_call_finish(proxy, res, &error); if ((result == NULL) && (error != NULL)) { /*For some reason after timeout ussd does not work - restart it*/ mmgui_module_devices_restart_ussd(mmguicorelc); if ((moduledata->cancellable == NULL) || ((moduledata->cancellable != NULL) && (!g_cancellable_is_cancelled(moduledata->cancellable)))) { mmgui_module_handle_error_message(mmguicorelc, error); } g_error_free(error); } else { g_variant_get(result, "(s)", &answer); answer = g_strdup(answer); g_variant_unref(result); } if (mmguicorelc->device != NULL) { mmguicorelc->device->operation = MMGUI_DEVICE_OPERATION_IDLE; } if ((mmguicorelc->eventcb != NULL) && ((moduledata->cancellable == NULL) || ((moduledata->cancellable != NULL) && (!g_cancellable_is_cancelled(moduledata->cancellable))))) { (mmguicorelc->eventcb)(MMGUI_EVENT_USSD_RESULT, user_data, answer); } } G_MODULE_EXPORT gboolean mmgui_module_ussd_send(gpointer mmguicore, gchar *request, enum _mmgui_ussd_validation validationid) { mmguicore_t mmguicorelc; moduledata_t moduledata; enum _mmgui_ussd_state sessionstate; GVariant *ussdreq; gchar *command; if ((mmguicore == NULL) || (request == NULL)) return FALSE; mmguicorelc = (mmguicore_t)mmguicore; if (mmguicorelc->moduledata == NULL) return FALSE; moduledata = (moduledata_t)mmguicorelc->moduledata; if (moduledata->ussdproxy == NULL) return FALSE; if (mmguicorelc->device == NULL) return FALSE; if (!mmguicorelc->device->enabled) return FALSE; if (!(mmguicorelc->device->ussdcaps & MMGUI_USSD_CAPS_SEND)) return FALSE; sessionstate = mmgui_module_ussd_get_state(mmguicore); if ((sessionstate == MMGUI_USSD_STATE_UNKNOWN) || (sessionstate == MMGUI_USSD_STATE_ACTIVE)) { mmgui_module_ussd_cancel_session(mmguicore); } ussdreq = g_variant_new("(s)", request); if (sessionstate == MMGUI_USSD_STATE_IDLE) { command = "Initiate"; } else if (sessionstate == MMGUI_USSD_STATE_USER_RESPONSE) { if (validationid == MMGUI_USSD_VALIDATION_REQUEST) { mmgui_module_ussd_cancel_session(mmguicore); command = "Initiate"; } else { command = "Respond"; } } mmguicorelc->device->operation = MMGUI_DEVICE_OPERATION_SEND_USSD; if (moduledata->cancellable != NULL) { g_cancellable_reset(moduledata->cancellable); } g_dbus_proxy_call(moduledata->ussdproxy, command, ussdreq, G_DBUS_CALL_FLAGS_NONE, moduledata->timeouts[MMGUI_DEVICE_OPERATION_SEND_USSD], moduledata->cancellable, (GAsyncReadyCallback)mmgui_module_ussd_send_handler, mmguicore); return TRUE; } static mmgui_scanned_network_t mmgui_module_network_retrieve(GVariant *networkv) { mmgui_scanned_network_t network; GVariant *value; gsize strlength; const gchar *valuestr; guint i; if (networkv == NULL) return NULL; network = g_new0(struct _mmgui_scanned_network, 1); //Mobile operator code (MCCMNC) value = g_variant_lookup_value(networkv, "operator-num", G_VARIANT_TYPE_STRING); if (value != NULL) { strlength = 256; valuestr = g_variant_get_string(value, &strlength); network->operator_num = atoi(valuestr); g_variant_unref(value); } else { network->operator_num = 0; } //Network access technology value = g_variant_lookup_value(networkv, "access-tech", G_VARIANT_TYPE_STRING); if (value != NULL) { strlength = 256; valuestr = g_variant_get_string(value, &strlength); network->access_tech = atoi(valuestr); g_variant_unref(value); } else { network->access_tech = MMGUI_ACCESS_TECH_GSM; } //Long-format name of operator value = g_variant_lookup_value(networkv, "operator-long", G_VARIANT_TYPE_STRING); if (value != NULL) { strlength = 256; valuestr = g_variant_get_string(value, &strlength); network->operator_long = g_strdup(valuestr); g_variant_unref(value); } else { network->operator_long = g_strdup("--"); } //Short-format name of operator value = g_variant_lookup_value(networkv, "operator-short", G_VARIANT_TYPE_STRING); if (value != NULL) { strlength = 256; valuestr = g_variant_get_string(value, &strlength); network->operator_short = g_strdup(valuestr); g_variant_unref(value); } else { network->operator_short = g_strdup("--"); } //Network availability status (this is a critical parameter, so entry will be skipped if value is unknown) value = g_variant_lookup_value(networkv, "status", G_VARIANT_TYPE_STRING); if (value != NULL) { strlength = 256; valuestr = g_variant_get_string(value, &strlength); network->status = atoi(valuestr); g_variant_unref(value); return network; } else { if (network->operator_long != NULL) g_free(network->operator_long); if (network->operator_short != NULL) g_free(network->operator_short); g_free(network); return NULL; } } static void mmgui_module_networks_scan_handler(GDBusProxy *proxy, GAsyncResult *res, gpointer user_data) { mmguicore_t mmguicorelc; moduledata_t moduledata; GError *error; GVariant *result; GSList *networks; GVariantIter niterl1, niterl2; GVariant *nnodel1, *nnodel2; mmgui_scanned_network_t network; mmguicorelc = (mmguicore_t)user_data; if (mmguicorelc == NULL) return; if (mmguicorelc->moduledata == NULL) return; moduledata = (moduledata_t)mmguicorelc->moduledata; error = NULL; networks = NULL; result = g_dbus_proxy_call_finish(proxy, res, &error); if ((result == NULL) && (error != NULL)) { if ((moduledata->cancellable == NULL) || ((moduledata->cancellable != NULL) && (!g_cancellable_is_cancelled(moduledata->cancellable)))) { mmgui_module_handle_error_message(mmguicorelc, error); } g_error_free(error); } else { g_variant_iter_init(&niterl1, result); while ((nnodel1 = g_variant_iter_next_value(&niterl1)) != NULL) { g_variant_iter_init(&niterl2, nnodel1); while ((nnodel2 = g_variant_iter_next_value(&niterl2)) != NULL) { network = mmgui_module_network_retrieve(nnodel2); if (network != NULL) { networks = g_slist_prepend(networks, network); } g_variant_unref(nnodel2); } g_variant_unref(nnodel1); } g_variant_unref(result); } if (mmguicorelc->device != NULL) { mmguicorelc->device->operation = MMGUI_DEVICE_OPERATION_IDLE; } if ((mmguicorelc->eventcb != NULL) && ((moduledata->cancellable == NULL) || ((moduledata->cancellable != NULL) && (!g_cancellable_is_cancelled(moduledata->cancellable))))) { (mmguicorelc->eventcb)(MMGUI_EVENT_SCAN_RESULT, user_data, networks); } } G_MODULE_EXPORT gboolean mmgui_module_networks_scan(gpointer mmguicore) { mmguicore_t mmguicorelc; moduledata_t moduledata; if (mmguicore == NULL) return FALSE; mmguicorelc = (mmguicore_t)mmguicore; if (mmguicorelc->moduledata == NULL) return FALSE; moduledata = (moduledata_t)mmguicorelc->moduledata; if (moduledata->netproxy == NULL) return FALSE; if (mmguicorelc->device == NULL) return FALSE; if (!mmguicorelc->device->enabled) return FALSE; if (!(mmguicorelc->device->scancaps & MMGUI_SCAN_CAPS_OBSERVE)) return FALSE; mmguicorelc->device->operation = MMGUI_DEVICE_OPERATION_SCAN; if (moduledata->cancellable != NULL) { g_cancellable_reset(moduledata->cancellable); } g_dbus_proxy_call(moduledata->netproxy, "Scan", NULL, G_DBUS_CALL_FLAGS_NONE, moduledata->timeouts[MMGUI_DEVICE_OPERATION_SCAN], moduledata->cancellable, (GAsyncReadyCallback)mmgui_module_networks_scan_handler, mmguicore); return TRUE; } static mmgui_contact_t mmgui_module_contact_retrieve(GVariant *contactv) { mmgui_contact_t contact; if (contactv == NULL) return NULL; contact = g_new0(struct _mmgui_contact, 1); g_variant_get(contactv, "(uss)", &contact->id, &contact->name, &contact->number); //Full name of the contact if (contact->name != NULL) { contact->name = g_strdup(contact->name); } else { g_free(contact); return NULL; } //Telephone number if (contact->number != NULL) { contact->number = g_strdup(contact->number); } else { g_free(contact->name); g_free(contact); return NULL; } //Email address contact->email = NULL; //Group this contact belongs to contact->group = g_strdup("SIM"); //Additional contact name contact->name2 = NULL; //Additional contact telephone number contact->number2 = NULL; //Boolean flag to specify whether this entry is hidden or not contact->hidden = FALSE; //Phonebook in which the contact is stored contact->storage = MMGUI_MODEM_CONTACTS_STORAGE_ME; return contact; } G_MODULE_EXPORT guint mmgui_module_contacts_enum(gpointer mmguicore, GSList **contactslist) { mmguicore_t mmguicorelc; moduledata_t moduledata; GError *error; GVariant *contacts; guint contactsnum; GVariantIter citerl1, citerl2; GVariant *cnodel1, *cnodel2; mmgui_contact_t contact; if ((mmguicore == NULL) || (contactslist == NULL)) return 0; mmguicorelc = (mmguicore_t)mmguicore; if (mmguicorelc->moduledata == NULL) return 0; moduledata = (moduledata_t)mmguicorelc->moduledata; if (moduledata->service != MODULE_INT_SERVICE_WADER) return 0; if (moduledata->contactsproxy == NULL) return 0; if (mmguicorelc->device == NULL) return 0; if (!mmguicorelc->device->enabled) return 0; if (!(mmguicorelc->device->contactscaps & MMGUI_CONTACTS_CAPS_EXPORT)) return 0; error = NULL; contacts = g_dbus_proxy_call_sync(moduledata->contactsproxy, "List", NULL, 0, -1, NULL, &error); if ((contacts == NULL) && (error != NULL)) { mmgui_module_handle_error_message(mmguicorelc, error); g_error_free(error); return 0; } contactsnum = 0; g_variant_iter_init(&citerl1, contacts); while ((cnodel1 = g_variant_iter_next_value(&citerl1)) != NULL) { g_variant_iter_init(&citerl2, cnodel1); while ((cnodel2 = g_variant_iter_next_value(&citerl2)) != NULL) { contact = mmgui_module_contact_retrieve(cnodel2); if (contact != NULL) { *contactslist = g_slist_prepend(*contactslist, contact); contactsnum++; } g_variant_unref(cnodel2); } g_variant_unref(cnodel1); } g_variant_unref(contacts); if (contactsnum > 0) { *contactslist = g_slist_reverse(*contactslist); } return contactsnum; } G_MODULE_EXPORT gboolean mmgui_module_contacts_delete(gpointer mmguicore, guint index) { mmguicore_t mmguicorelc; moduledata_t moduledata; GError *error; if (mmguicore == NULL) return FALSE; mmguicorelc = (mmguicore_t)mmguicore; if (mmguicorelc->moduledata == NULL) return FALSE; moduledata = (moduledata_t)mmguicorelc->moduledata; if (moduledata->contactsproxy == NULL) return FALSE; if (mmguicorelc->device == NULL) return FALSE; if (!mmguicorelc->device->enabled) return FALSE; if (!(mmguicorelc->device->contactscaps & MMGUI_CONTACTS_CAPS_EDIT)) return FALSE; error = NULL; g_dbus_proxy_call_sync(moduledata->contactsproxy, "Delete", g_variant_new("(u)", index), 0, -1, NULL, &error); if (error != NULL) { mmgui_module_handle_error_message(mmguicorelc, error); g_error_free(error); return FALSE; } return TRUE; } G_MODULE_EXPORT gint mmgui_module_contacts_add(gpointer mmguicore, mmgui_contact_t contact) { mmguicore_t mmguicorelc; moduledata_t moduledata; GVariant *contactv, *idv; GError *error; guint id; if ((mmguicore == NULL) || (contact == NULL)) return -1; mmguicorelc = (mmguicore_t)mmguicore; if (mmguicorelc->moduledata == NULL) return -1; moduledata = (moduledata_t)mmguicorelc->moduledata; if ((contact->name == NULL) || (contact->number == NULL)) return -1; if (moduledata->contactsproxy == NULL) return -1; if (mmguicorelc->device == NULL) return -1; if (!mmguicorelc->device->enabled) return -1; if (!(mmguicorelc->device->contactscaps & MMGUI_CONTACTS_CAPS_EDIT)) return -1; contactv = g_variant_new("(ss)", contact->name, contact->number); error = NULL; idv = g_dbus_proxy_call_sync(moduledata->contactsproxy, "Add", contactv, 0, -1, NULL, &error); if ((idv == NULL) && (error != NULL)) { mmgui_module_handle_error_message(mmguicorelc, error); g_error_free(error); return -1; } g_variant_get(idv, "(u)", &id); g_variant_unref(idv); contact->id = id; return id; } modem-manager-gui-0.0.16/src/modules/mm07.c000066400000000000000000002740311217271411700202660ustar00rootroot00000000000000/* * mm07.c * * Copyright 2013 Alex * * 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 . */ #include #include #include #include #include #include #include #include "../mmguicore.h" #include "../smsdb.h" #define MMGUI_MODULE_SERVICE_NAME "org.freedesktop.ModemManager1" #define MMGUI_MODULE_IDENTIFIER 70 #define MMGUI_MODULE_DESCRIPTION "Modem Manager >= 0.7.0" #define MMGUI_MODULE_ENABLE_OPERATION_TIMEOUT 20000 #define MMGUI_MODULE_SEND_SMS_OPERATION_TIMEOUT 35000 #define MMGUI_MODULE_SEND_USSD_OPERATION_TIMEOUT 25000 #define MMGUI_MODULE_NETWORKS_SCAN_OPERATION_TIMEOUT 60000 //Internal enumerations //Modem state internal flags typedef enum { MODULE_INT_MODEM_STATE_FAILED = -1, MODULE_INT_MODEM_STATE_UNKNOWN = 0, MODULE_INT_MODEM_STATE_INITIALIZING = 1, MODULE_INT_MODEM_STATE_LOCKED = 2, MODULE_INT_MODEM_STATE_DISABLED = 3, MODULE_INT_MODEM_STATE_DISABLING = 4, MODULE_INT_MODEM_STATE_ENABLING = 5, MODULE_INT_MODEM_STATE_ENABLED = 6, MODULE_INT_MODEM_STATE_SEARCHING = 7, MODULE_INT_MODEM_STATE_REGISTERED = 8, MODULE_INT_MODEM_STATE_DISCONNECTING = 9, MODULE_INT_MODEM_STATE_CONNECTING = 10, MODULE_INT_MODEM_STATE_CONNECTED = 11 } ModuleIntModemState; //Modem capability internal flags typedef enum { MODULE_INT_MODEM_CAPABILITY_NONE = 0, MODULE_INT_MODEM_CAPABILITY_POTS = 1 << 0, MODULE_INT_MODEM_CAPABILITY_CDMA_EVDO = 1 << 1, MODULE_INT_MODEM_CAPABILITY_GSM_UMTS = 1 << 2, MODULE_INT_MODEM_CAPABILITY_LTE = 1 << 3, MODULE_INT_MODEM_CAPABILITY_LTE_ADVANCED = 1 << 4, MODULE_INT_MODEM_CAPABILITY_IRIDIUM = 1 << 5, } ModuleIntModemCapability; //Modem registration internal flags typedef enum { MODULE_INT_MODEM_3GPP_REGISTRATION_STATE_IDLE = 0, MODULE_INT_MODEM_3GPP_REGISTRATION_STATE_HOME = 1, MODULE_INT_MODEM_3GPP_REGISTRATION_STATE_SEARCHING = 2, MODULE_INT_MODEM_3GPP_REGISTRATION_STATE_DENIED = 3, MODULE_INT_MODEM_3GPP_REGISTRATION_STATE_UNKNOWN = 4, MODULE_INT_MODEM_3GPP_REGISTRATION_STATE_ROAMING = 5, } ModuleIntModem3gppRegistrationState; //Modem USSD state internal flags typedef enum { MODULE_INT_MODEM_3GPP_USSD_SESSION_STATE_UNKNOWN = 0, MODULE_INT_MODEM_3GPP_USSD_SESSION_STATE_IDLE = 1, MODULE_INT_MODEM_3GPP_USSD_SESSION_STATE_ACTIVE = 2, MODULE_INT_MODEM_3GPP_USSD_SESSION_STATE_USER_RESPONSE = 3, } ModuleIntModem3gppUssdSessionState; //Modem network availability internal flags typedef enum { MODULE_INT_MODEM_3GPP_NETWORK_AVAILABILITY_UNKNOWN = 0, MODULE_INT_MODEM_3GPP_NETWORK_AVAILABILITY_AVAILABLE = 1, MODULE_INT_MODEM_3GPP_NETWORK_AVAILABILITY_CURRENT = 2, MODULE_INT_MODEM_3GPP_NETWORK_AVAILABILITY_FORBIDDEN = 3, } ModuleIntModem3gppNetworkAvailability; //Modem acess technology internal flags typedef enum { MODULE_INT_MODEM_ACCESS_TECHNOLOGY_UNKNOWN = 0, MODULE_INT_MODEM_ACCESS_TECHNOLOGY_POTS = 1 << 0, MODULE_INT_MODEM_ACCESS_TECHNOLOGY_GSM = 1 << 1, MODULE_INT_MODEM_ACCESS_TECHNOLOGY_GSM_COMPACT = 1 << 2, MODULE_INT_MODEM_ACCESS_TECHNOLOGY_GPRS = 1 << 3, MODULE_INT_MODEM_ACCESS_TECHNOLOGY_EDGE = 1 << 4, MODULE_INT_MODEM_ACCESS_TECHNOLOGY_UMTS = 1 << 5, MODULE_INT_MODEM_ACCESS_TECHNOLOGY_HSDPA = 1 << 6, MODULE_INT_MODEM_ACCESS_TECHNOLOGY_HSUPA = 1 << 7, MODULE_INT_MODEM_ACCESS_TECHNOLOGY_HSPA = 1 << 8, MODULE_INT_MODEM_ACCESS_TECHNOLOGY_HSPA_PLUS = 1 << 9, MODULE_INT_MODEM_ACCESS_TECHNOLOGY_1XRTT = 1 << 10, MODULE_INT_MODEM_ACCESS_TECHNOLOGY_EVDO0 = 1 << 11, MODULE_INT_MODEM_ACCESS_TECHNOLOGY_EVDOA = 1 << 12, MODULE_INT_MODEM_ACCESS_TECHNOLOGY_EVDOB = 1 << 13, MODULE_INT_MODEM_ACCESS_TECHNOLOGY_LTE = 1 << 14, MODULE_INT_MODEM_ACCESS_TECHNOLOGY_ANY = 0xFFFFFFFF, } ModuleIntModemAccessTechnology; //Location types internal flags typedef enum { MODULE_INT_MODEM_LOCATION_SOURCE_NONE = 0, MODULE_INT_MODEM_LOCATION_SOURCE_3GPP_LAC_CI = 1 << 0, MODULE_INT_MODEM_LOCATION_SOURCE_GPS_RAW = 1 << 1, MODULE_INT_MODEM_LOCATION_SOURCE_GPS_NMEA = 1 << 2, } ModuleIntModemLocationSource; //SMS message state internal flags typedef enum { MODULE_INT_SMS_STATE_UNKNOWN = 0, MODULE_INT_SMS_STATE_STORED = 1, MODULE_INT_SMS_STATE_RECEIVING = 2, MODULE_INT_SMS_STATE_RECEIVED = 3, MODULE_INT_SMS_STATE_SENDING = 4, MODULE_INT_SMS_STATE_SENT = 5, } ModuleIntSmsState; //SMS message internal type typedef enum { MODULE_INT_PDU_TYPE_UNKNOWN = 0, MODULE_INT_PDU_TYPE_DELIVER = 1, MODULE_INT_PDU_TYPE_SUBMIT = 2, MODULE_INT_PDU_TYPE_STATUS_REPORT = 3 } ModuleIntSmsPduType; //Private module variables struct _mmguimoduledata { //DBus connection GDBusConnection *connection; //DBus proxy objects GDBusObjectManager *objectmanager; GDBusProxy *cardproxy; GDBusProxy *netproxy; GDBusProxy *modemproxy; GDBusProxy *smsproxy; GDBusProxy *ussdproxy; GDBusProxy *locationproxy; GDBusProxy *timeproxy; GDBusProxy *contactsproxy; //Attached signal handlers gulong netpropsignal; gulong statesignal; gulong modempropsignal; gulong smssignal; gulong locationpropsignal; gulong timesignal; //Partial SMS messages GList *partialsms; //Last error message gchar *errormessage; //Cancellable GCancellable *cancellable; //Operations timeouts guint timeouts[MMGUI_DEVICE_OPERATIONS]; }; typedef struct _mmguimoduledata *moduledata_t; static gboolean mmgui_module_device_enabled_from_state(gint state); static gboolean mmgui_module_device_locked_from_state(gint state); static gboolean mmgui_module_device_connected_from_state(gint state); static gboolean mmgui_module_device_registered_from_state(gint state); static enum _mmgui_device_types mmgui_module_device_type_from_caps(gint caps); static enum _mmgui_reg_status mmgui_module_registration_status_translate(guint status); static enum _mmgui_network_availability mmgui_module_network_availability_status_translate(guint status); static enum _mmgui_access_tech mmgui_module_access_technology_translate(guint technology); static enum _mmgui_device_modes mmgui_module_access_mode_translate(guint mode); static gboolean mmgui_module_devices_update_device_mode(gpointer mmguicore, gint oldstate, gint newstate, guint changereason); static gboolean mmgui_module_devices_update_location(gpointer mmguicore, mmguidevice_t device); static gboolean mmgui_module_devices_enable_location(gpointer mmguicore, mmguidevice_t device, gboolean enable); static mmguidevice_t mmgui_module_device_new(mmguicore_t mmguicore, const gchar *devpath); static mmgui_sms_message_t mmgui_module_sms_retrieve(mmguicore_t mmguicore, const gchar *smspath); static gint mmgui_module_sms_get_id(mmguicore_t mmguicore, const gchar *smspath); static void mmgui_module_handle_error_message(mmguicore_t mmguicore, GError *error) { moduledata_t moduledata; if ((mmguicore == NULL) || (error == NULL)) return; moduledata = (moduledata_t)mmguicore->moduledata; if (moduledata == NULL) return; if (moduledata->errormessage != NULL) { g_free(moduledata->errormessage); } if (error->message != NULL) { moduledata->errormessage = g_strdup(error->message); } else { moduledata->errormessage = g_strdup("Unknown error"); } g_warning("%s: %s", MMGUI_MODULE_DESCRIPTION, moduledata->errormessage); } static guint mmgui_module_get_object_path_index(const gchar *objectpath) { guint id; gchar *objectpathid; objectpathid = strrchr(objectpath, '/') + 1; if ((objectpathid != NULL) && (objectpathid[0] != '\0')) { id = atoi(objectpathid); } else { id = 0; } return id; } static void mmgui_signal_handler(GDBusProxy *proxy, const gchar *sender_name, const gchar *signal_name, GVariant *parameters, gpointer data) { mmguicore_t mmguicore; moduledata_t moduledata; gchar *statusstr; gboolean statusflag; gint oldstate, newstate; guint changereason; if (data == NULL) return; mmguicore = (mmguicore_t)data; moduledata = (moduledata_t)mmguicore->moduledata; if (g_str_equal(signal_name, "Added")) { g_variant_get(parameters, "(ob)", &statusstr, &statusflag); if (statusflag) { /*Message received from network*/ moduledata->partialsms = g_list_prepend(moduledata->partialsms, g_strdup(statusstr)); } } else if (g_str_equal(signal_name, "StateChanged")) { g_variant_get(parameters, "(iiu)", &oldstate, &newstate, &changereason); /*Send signals if needed*/ mmgui_module_devices_update_device_mode(mmguicore, oldstate, newstate, changereason); } g_debug("SIGNAL: %s (%s) argtype: %s\n", signal_name, sender_name, g_variant_get_type_string(parameters)); } static void mmgui_property_change_handler(GDBusProxy *proxy, GVariant *changed_properties, GStrv invalidated_properties, gpointer data) { mmguicore_t mmguicore; mmguidevice_t device; GVariantIter *iter; GVariant *item; const gchar *key; GVariant *value; guint statevalue; gboolean stateflag; if ((changed_properties == NULL) || (data == NULL)) return; mmguicore = (mmguicore_t)data; if (mmguicore->device == NULL) return; device = mmguicore->device; if (g_variant_n_children(changed_properties) > 0) { g_variant_get(changed_properties, "a{sv}", &iter); while (g_variant_iter_loop(iter, "{&sv}", &key, &value)) { if (g_str_equal(key, "SignalQuality")) { g_variant_get(value, "(ub)", &statevalue, &stateflag); if (statevalue != device->siglevel) { device->siglevel = statevalue; if (mmguicore->eventcb != NULL) { (mmguicore->eventcb)(MMGUI_EVENT_SIGNAL_LEVEL_CHANGE, mmguicore, mmguicore->device); } } } else if (g_str_equal(key, "AccessTechnologies")) { statevalue = mmgui_module_access_mode_translate(g_variant_get_uint32(value)); if (statevalue != device->mode) { device->mode = statevalue; if (mmguicore->eventcb != NULL) { (mmguicore->eventcb)(MMGUI_EVENT_NETWORK_MODE_CHANGE, mmguicore, mmguicore->device); } } } else if (g_str_equal(key, "Location")) { if (mmgui_module_devices_update_location(mmguicore, mmguicore->device)) { if (mmguicore->eventcb != NULL) { (mmguicore->eventcb)(MMGUI_EVENT_LOCATION_CHANGE, mmguicore, mmguicore->device); } } } g_debug("Property changed: %s\n", key); } g_variant_iter_free(iter); } } static void mmgui_objectmanager_added_signal_handler(GDBusObjectManager *manager, GDBusObject *object, gpointer user_data) { mmguicore_t mmguicore; const gchar *devpath; mmguidevice_t device; if ((user_data == NULL) || (object == NULL)) return; mmguicore = (mmguicore_t)user_data; if (mmguicore->eventcb != NULL) { devpath = g_dbus_object_get_object_path(object); g_debug("Device added: %s\n", devpath); if (devpath != NULL) { device = mmgui_module_device_new(mmguicore, devpath); (mmguicore->eventcb)(MMGUI_EVENT_DEVICE_ADDED, mmguicore, device); } } } static void mmgui_objectmanager_removed_signal_handler(GDBusObjectManager *manager, GDBusObject *object, gpointer user_data) { mmguicore_t mmguicore; const gchar *devpath; guint id; if ((user_data == NULL) || (object == NULL)) return; mmguicore = (mmguicore_t)user_data; if (mmguicore->eventcb != NULL) { devpath = g_dbus_object_get_object_path(object); g_debug("Device removed: %s\n", devpath); if (devpath != NULL) { id = mmgui_module_get_object_path_index(devpath); (mmguicore->eventcb)(MMGUI_EVENT_DEVICE_REMOVED, mmguicore, GUINT_TO_POINTER(id)); } } } static gboolean mmgui_module_device_enabled_from_state(gint state) { gboolean enabled; switch (state) { case MODULE_INT_MODEM_STATE_FAILED: case MODULE_INT_MODEM_STATE_UNKNOWN: case MODULE_INT_MODEM_STATE_INITIALIZING: case MODULE_INT_MODEM_STATE_LOCKED: case MODULE_INT_MODEM_STATE_DISABLED: case MODULE_INT_MODEM_STATE_DISABLING: case MODULE_INT_MODEM_STATE_ENABLING: enabled = FALSE; break; case MODULE_INT_MODEM_STATE_ENABLED: case MODULE_INT_MODEM_STATE_SEARCHING: case MODULE_INT_MODEM_STATE_REGISTERED: case MODULE_INT_MODEM_STATE_DISCONNECTING: case MODULE_INT_MODEM_STATE_CONNECTING: case MODULE_INT_MODEM_STATE_CONNECTED: enabled = TRUE; break; default: enabled = FALSE; break; } return enabled; } static gboolean mmgui_module_device_locked_from_state(gint state) { gboolean locked; switch (state) { case MODULE_INT_MODEM_STATE_FAILED: case MODULE_INT_MODEM_STATE_UNKNOWN: case MODULE_INT_MODEM_STATE_INITIALIZING: locked = FALSE; break; case MODULE_INT_MODEM_STATE_LOCKED: locked = TRUE; break; case MODULE_INT_MODEM_STATE_DISABLED: case MODULE_INT_MODEM_STATE_DISABLING: case MODULE_INT_MODEM_STATE_ENABLING: case MODULE_INT_MODEM_STATE_ENABLED: case MODULE_INT_MODEM_STATE_SEARCHING: case MODULE_INT_MODEM_STATE_REGISTERED: case MODULE_INT_MODEM_STATE_DISCONNECTING: case MODULE_INT_MODEM_STATE_CONNECTING: case MODULE_INT_MODEM_STATE_CONNECTED: locked = FALSE; break; default: locked = FALSE; break; } return locked; } static gboolean mmgui_module_device_connected_from_state(gint state) { gboolean connected; switch (state) { case MODULE_INT_MODEM_STATE_FAILED: case MODULE_INT_MODEM_STATE_UNKNOWN: case MODULE_INT_MODEM_STATE_INITIALIZING: case MODULE_INT_MODEM_STATE_LOCKED: case MODULE_INT_MODEM_STATE_DISABLED: case MODULE_INT_MODEM_STATE_DISABLING: case MODULE_INT_MODEM_STATE_ENABLING: case MODULE_INT_MODEM_STATE_ENABLED: case MODULE_INT_MODEM_STATE_SEARCHING: case MODULE_INT_MODEM_STATE_REGISTERED: connected = FALSE; break; case MODULE_INT_MODEM_STATE_DISCONNECTING: connected = TRUE; break; case MODULE_INT_MODEM_STATE_CONNECTING: connected = FALSE; break; case MODULE_INT_MODEM_STATE_CONNECTED: connected = TRUE; break; default: connected = FALSE; break; } return connected; } static gboolean mmgui_module_device_registered_from_state(gint state) { gboolean registered; switch (state) { case MODULE_INT_MODEM_STATE_FAILED: case MODULE_INT_MODEM_STATE_UNKNOWN: case MODULE_INT_MODEM_STATE_INITIALIZING: case MODULE_INT_MODEM_STATE_LOCKED: case MODULE_INT_MODEM_STATE_DISABLED: case MODULE_INT_MODEM_STATE_DISABLING: case MODULE_INT_MODEM_STATE_ENABLING: case MODULE_INT_MODEM_STATE_ENABLED: case MODULE_INT_MODEM_STATE_SEARCHING: registered = FALSE; break; case MODULE_INT_MODEM_STATE_REGISTERED: case MODULE_INT_MODEM_STATE_DISCONNECTING: case MODULE_INT_MODEM_STATE_CONNECTING: case MODULE_INT_MODEM_STATE_CONNECTED: registered = TRUE; break; default: registered = FALSE; break; } return registered; } static enum _mmgui_device_types mmgui_module_device_type_from_caps(gint caps) { enum _mmgui_device_types type; switch (caps) { case MODULE_INT_MODEM_CAPABILITY_NONE: case MODULE_INT_MODEM_CAPABILITY_POTS: type = MMGUI_DEVICE_TYPE_GSM; break; case MODULE_INT_MODEM_CAPABILITY_CDMA_EVDO: type = MMGUI_DEVICE_TYPE_CDMA; break; case MODULE_INT_MODEM_CAPABILITY_GSM_UMTS: case MODULE_INT_MODEM_CAPABILITY_LTE: case MODULE_INT_MODEM_CAPABILITY_LTE_ADVANCED: case MODULE_INT_MODEM_CAPABILITY_IRIDIUM: type = MMGUI_DEVICE_TYPE_GSM; break; default: type = MMGUI_DEVICE_TYPE_GSM; break; } return type; } static enum _mmgui_reg_status mmgui_module_registration_status_translate(guint status) { enum _mmgui_reg_status tstatus; switch (status) { case MODULE_INT_MODEM_3GPP_REGISTRATION_STATE_IDLE: tstatus = MMGUI_REG_STATUS_IDLE; break; case MODULE_INT_MODEM_3GPP_REGISTRATION_STATE_HOME: tstatus = MMGUI_REG_STATUS_HOME; break; case MODULE_INT_MODEM_3GPP_REGISTRATION_STATE_SEARCHING: tstatus = MMGUI_REG_STATUS_SEARCHING; break; case MODULE_INT_MODEM_3GPP_REGISTRATION_STATE_DENIED: tstatus = MMGUI_REG_STATUS_DENIED; break; case MODULE_INT_MODEM_3GPP_REGISTRATION_STATE_UNKNOWN: tstatus = MMGUI_REG_STATUS_UNKNOWN; break; case MODULE_INT_MODEM_3GPP_REGISTRATION_STATE_ROAMING: tstatus = MMGUI_REG_STATUS_ROAMING; break; default: tstatus = MMGUI_REG_STATUS_UNKNOWN; break; } return tstatus; } static enum _mmgui_network_availability mmgui_module_network_availability_status_translate(guint status) { guint tstatus; switch (status) { case MODULE_INT_MODEM_3GPP_NETWORK_AVAILABILITY_UNKNOWN: tstatus = MMGUI_NA_UNKNOWN; break; case MODULE_INT_MODEM_3GPP_NETWORK_AVAILABILITY_AVAILABLE: tstatus = MMGUI_NA_AVAILABLE; break; case MODULE_INT_MODEM_3GPP_NETWORK_AVAILABILITY_CURRENT: tstatus = MMGUI_NA_CURRENT; break; case MODULE_INT_MODEM_3GPP_NETWORK_AVAILABILITY_FORBIDDEN: tstatus = MMGUI_NA_FORBIDDEN; break; default: tstatus = MMGUI_NA_UNKNOWN; break; } return tstatus; } static enum _mmgui_access_tech mmgui_module_access_technology_translate(guint technology) { enum _mmgui_access_tech ttechnology; switch (technology) { case MODULE_INT_MODEM_ACCESS_TECHNOLOGY_UNKNOWN: ttechnology = MMGUI_ACCESS_TECH_UNKNOWN; break; case MODULE_INT_MODEM_ACCESS_TECHNOLOGY_POTS: ttechnology = MMGUI_ACCESS_TECH_UNKNOWN; break; case MODULE_INT_MODEM_ACCESS_TECHNOLOGY_GSM: ttechnology = MMGUI_ACCESS_TECH_GSM; break; case MODULE_INT_MODEM_ACCESS_TECHNOLOGY_GSM_COMPACT: ttechnology = MMGUI_ACCESS_TECH_GSM_COMPACT; break; case MODULE_INT_MODEM_ACCESS_TECHNOLOGY_GPRS: ttechnology = MMGUI_ACCESS_TECH_EDGE; break; case MODULE_INT_MODEM_ACCESS_TECHNOLOGY_EDGE: ttechnology = MMGUI_ACCESS_TECH_EDGE; break; case MODULE_INT_MODEM_ACCESS_TECHNOLOGY_UMTS: ttechnology = MMGUI_ACCESS_TECH_UMTS; break; case MODULE_INT_MODEM_ACCESS_TECHNOLOGY_HSDPA: ttechnology = MMGUI_ACCESS_TECH_HSDPA; break; case MODULE_INT_MODEM_ACCESS_TECHNOLOGY_HSUPA: ttechnology = MMGUI_ACCESS_TECH_HSUPA; break; case MODULE_INT_MODEM_ACCESS_TECHNOLOGY_HSPA: ttechnology = MMGUI_ACCESS_TECH_HSPA; break; case MODULE_INT_MODEM_ACCESS_TECHNOLOGY_HSPA_PLUS: ttechnology = MMGUI_ACCESS_TECH_HSPA_PLUS; break; case MODULE_INT_MODEM_ACCESS_TECHNOLOGY_1XRTT: ttechnology = MMGUI_ACCESS_TECH_1XRTT; break; case MODULE_INT_MODEM_ACCESS_TECHNOLOGY_EVDO0: ttechnology = MMGUI_ACCESS_TECH_EVDO0; break; case MODULE_INT_MODEM_ACCESS_TECHNOLOGY_EVDOA: ttechnology = MMGUI_ACCESS_TECH_EVDOA; break; case MODULE_INT_MODEM_ACCESS_TECHNOLOGY_EVDOB: ttechnology = MMGUI_ACCESS_TECH_EVDOB; break; case MODULE_INT_MODEM_ACCESS_TECHNOLOGY_LTE: ttechnology = MMGUI_ACCESS_TECH_LTE; break; case MODULE_INT_MODEM_ACCESS_TECHNOLOGY_ANY: ttechnology = MMGUI_ACCESS_TECH_UNKNOWN; break; default: ttechnology = MMGUI_ACCESS_TECH_UNKNOWN; break; } return ttechnology; } static enum _mmgui_device_modes mmgui_module_access_mode_translate(guint mode) { enum _mmgui_device_modes tmode; switch (mode) { case MODULE_INT_MODEM_ACCESS_TECHNOLOGY_UNKNOWN: tmode = MMGUI_DEVICE_MODE_UNKNOWN; break; case MODULE_INT_MODEM_ACCESS_TECHNOLOGY_POTS: tmode = MMGUI_DEVICE_MODE_UNKNOWN; break; case MODULE_INT_MODEM_ACCESS_TECHNOLOGY_GSM: tmode = MMGUI_DEVICE_MODE_GSM; break; case MODULE_INT_MODEM_ACCESS_TECHNOLOGY_GSM_COMPACT: tmode = MMGUI_DEVICE_MODE_GSM_COMPACT; break; case MODULE_INT_MODEM_ACCESS_TECHNOLOGY_GPRS: tmode = MMGUI_DEVICE_MODE_GPRS; break; case MODULE_INT_MODEM_ACCESS_TECHNOLOGY_EDGE: tmode = MMGUI_DEVICE_MODE_EDGE; break; case MODULE_INT_MODEM_ACCESS_TECHNOLOGY_UMTS: tmode = MMGUI_DEVICE_MODE_UMTS; break; case MODULE_INT_MODEM_ACCESS_TECHNOLOGY_HSDPA: tmode = MMGUI_DEVICE_MODE_HSDPA; break; case MODULE_INT_MODEM_ACCESS_TECHNOLOGY_HSUPA: tmode = MMGUI_DEVICE_MODE_HSUPA; break; case MODULE_INT_MODEM_ACCESS_TECHNOLOGY_HSPA: tmode = MMGUI_DEVICE_MODE_HSPA; break; case MODULE_INT_MODEM_ACCESS_TECHNOLOGY_HSPA_PLUS: tmode = MMGUI_DEVICE_MODE_HSPA_PLUS; break; case MODULE_INT_MODEM_ACCESS_TECHNOLOGY_1XRTT: tmode = MMGUI_DEVICE_MODE_1XRTT; break; case MODULE_INT_MODEM_ACCESS_TECHNOLOGY_EVDO0: tmode = MMGUI_DEVICE_MODE_EVDO0; break; case MODULE_INT_MODEM_ACCESS_TECHNOLOGY_EVDOA: tmode = MMGUI_DEVICE_MODE_EVDOA; break; case MODULE_INT_MODEM_ACCESS_TECHNOLOGY_EVDOB: tmode = MMGUI_DEVICE_MODE_EVDOB; break; case MODULE_INT_MODEM_ACCESS_TECHNOLOGY_LTE: tmode = MMGUI_DEVICE_MODE_LTE; break; case MODULE_INT_MODEM_ACCESS_TECHNOLOGY_ANY: tmode = MMGUI_DEVICE_MODE_UNKNOWN; break; default: tmode = MMGUI_DEVICE_MODE_UNKNOWN; break; } return tmode; } static mmguidevice_t mmgui_module_device_new(mmguicore_t mmguicore, const gchar *devpath) { mmguidevice_t device; moduledata_t moduledata; GDBusProxy *deviceproxy; GError *error; GVariant *deviceinfo; gsize strsize; guint statevalue; gchar *blockstr; if ((mmguicore == NULL) || (devpath == NULL)) return NULL; moduledata = (moduledata_t)mmguicore->moduledata; if (moduledata->connection == NULL) return NULL; device = g_new0(struct _mmguidevice, 1); device->id = mmgui_module_get_object_path_index(devpath); device->objectpath = g_strdup(devpath); device->operation = MMGUI_DEVICE_OPERATION_IDLE; /*Zero values we can't get this moment*/ /*SMS*/ device->smscaps = MMGUI_SMS_CAPS_NONE; device->smsdb = NULL; /*Networks*/ /*Info*/ device->manufacturer = NULL; device->model = NULL; device->version = NULL; device->operatorname = NULL; device->operatorcode = NULL; device->imei = NULL; device->imsi = NULL; device->port = NULL; device->internalid = NULL; device->persistentid = NULL; device->sysfspath = NULL; /*USSD*/ device->ussdcaps = MMGUI_USSD_CAPS_NONE; device->ussdencoding = MMGUI_USSD_ENCODING_GSM7; /*Location*/ device->locationcaps = MMGUI_LOCATION_CAPS_NONE; memset(device->loc3gppdata, 0, sizeof(device->loc3gppdata)); memset(device->locgpsdata, 0, sizeof(device->locgpsdata)); /*Scan*/ device->scancaps = MMGUI_SCAN_CAPS_NONE; /*Traffic*/ device->rxbytes = 0; device->txbytes = 0; device->sessiontime = 0; device->speedchecktime = 0; device->smschecktime = 0; device->speedindex = 0; device->connected = FALSE; memset(device->speedvalues, 0, sizeof(device->speedvalues)); memset(device->interface, 0, sizeof(device->interface)); /*Contacts*/ device->contactscaps = MMGUI_CONTACTS_CAPS_NONE; device->contactslist = NULL; error = NULL; deviceproxy = g_dbus_proxy_new_sync(moduledata->connection, G_DBUS_PROXY_FLAGS_NONE, NULL, "org.freedesktop.ModemManager1", devpath, "org.freedesktop.ModemManager1.Modem", NULL, &error); if ((deviceproxy == NULL) && (error != NULL)) { mmgui_module_handle_error_message(mmguicore, error); g_error_free(error); g_object_unref(deviceproxy); /*Fill default values*/ device->manufacturer = g_strdup(_("Unknown")); device->model = g_strdup(_("Unknown")); device->version = g_strdup(_("Unknown")); device->port = g_strdup(_("Unknown")); device->type = MMGUI_DEVICE_TYPE_GSM; return device; } /*Device manufacturer*/ deviceinfo = g_dbus_proxy_get_cached_property(deviceproxy, "Manufacturer"); if (deviceinfo != NULL) { strsize = 256; device->manufacturer = g_strdup(g_variant_get_string(deviceinfo, &strsize)); g_variant_unref(deviceinfo); } else { device->manufacturer = g_strdup(_("Unknown")); } /*Device model*/ deviceinfo = g_dbus_proxy_get_cached_property(deviceproxy, "Model"); if (deviceinfo != NULL) { strsize = 256; device->model = g_strdup(g_variant_get_string(deviceinfo, &strsize)); g_variant_unref(deviceinfo); } else { device->model = g_strdup(_("Unknown")); } /*Device revision*/ deviceinfo = g_dbus_proxy_get_cached_property(deviceproxy, "Revision"); if (deviceinfo != NULL) { strsize = 256; device->version = g_strdup(g_variant_get_string(deviceinfo, &strsize)); g_variant_unref(deviceinfo); } else { device->version = g_strdup(_("Unknown")); } /*Device port*/ deviceinfo = g_dbus_proxy_get_cached_property(deviceproxy, "PrimaryPort"); if (deviceinfo != NULL) { strsize = 256; device->port = g_strdup(g_variant_get_string(deviceinfo, &strsize)); g_variant_unref(deviceinfo); } else { device->port = g_strdup(""); } /*Need to get usb device serial for fallback traffic monitoring*/ deviceinfo = g_dbus_proxy_get_cached_property(deviceproxy, "Device"); if (deviceinfo != NULL) { strsize = 256; device->sysfspath = g_strdup(g_variant_get_string(deviceinfo, &strsize)); g_variant_unref(deviceinfo); } else { device->sysfspath = g_strdup(""); } /*Device type (version 0.7.990 property)*/ deviceinfo = g_dbus_proxy_get_cached_property(deviceproxy, "ModemCapabilities"); if (deviceinfo != NULL) { statevalue = g_variant_get_uint32(deviceinfo); device->type = mmgui_module_device_type_from_caps(statevalue); g_variant_unref(deviceinfo); } else { /*Device type (version 0.7.991 property)*/ deviceinfo = g_dbus_proxy_get_cached_property(deviceproxy, "CurrentCapabilities"); if (deviceinfo != NULL) { statevalue = g_variant_get_uint32(deviceinfo); device->type = mmgui_module_device_type_from_caps(statevalue); g_variant_unref(deviceinfo); } else { device->type = MODULE_INT_MODEM_CAPABILITY_GSM_UMTS; } } /*Is device enabled, blocked and registered*/ deviceinfo = g_dbus_proxy_get_cached_property(deviceproxy, "State"); if (deviceinfo != NULL) { statevalue = g_variant_get_int32(deviceinfo); device->enabled = mmgui_module_device_enabled_from_state(statevalue); device->blocked = mmgui_module_device_locked_from_state(statevalue); device->registered = mmgui_module_device_registered_from_state(statevalue); g_variant_unref(deviceinfo); } else { device->enabled = TRUE; device->blocked = FALSE; device->registered = TRUE; } /*Internal Modem Manager identifier*/ deviceinfo = g_dbus_proxy_get_cached_property(deviceproxy, "DeviceIdentifier"); if (deviceinfo != NULL) { strsize = 256; device->internalid = g_strdup(g_variant_get_string(deviceinfo, &strsize)); g_variant_unref(deviceinfo); } else { device->internalid = NULL; } /*Persistent device identifier*/ blockstr = g_strdup_printf("%s_%s_%s", device->manufacturer, device->model, device->version); device->persistentid = g_compute_checksum_for_string(G_CHECKSUM_MD5, (const gchar *)blockstr, -1); g_free(blockstr); g_object_unref(deviceproxy); return device; } G_MODULE_EXPORT gboolean mmgui_module_init(mmguimodule_t module) { if (module == NULL) return FALSE; module->type = MMGUI_MODULE_TYPE_MODEM_MANAGER; module->requirement = MMGUI_MODULE_REQUIREMENT_SERVICE; module->priority = MMGUI_MODULE_PRIORITY_NORMAL; module->identifier = MMGUI_MODULE_IDENTIFIER; module->functions = MMGUI_MODULE_FUNCTION_BASIC; g_snprintf(module->servicename, sizeof(module->servicename), MMGUI_MODULE_SERVICE_NAME); g_snprintf(module->description, sizeof(module->description), MMGUI_MODULE_DESCRIPTION); return TRUE; } G_MODULE_EXPORT gboolean mmgui_module_open(gpointer mmguicore) { mmguicore_t mmguicorelc; moduledata_t *moduledata; GError *error; if (mmguicore == NULL) return FALSE; mmguicorelc = (mmguicore_t)mmguicore; moduledata = (moduledata_t *)&mmguicorelc->moduledata; (*moduledata) = g_new0(struct _mmguimoduledata, 1); error = NULL; (*moduledata)->connection = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error); (*moduledata)->errormessage = NULL; if (((*moduledata)->connection == NULL) && (error != NULL)) { mmgui_module_handle_error_message(mmguicorelc, error); g_error_free(error); g_free(mmguicorelc->moduledata); return FALSE; } error = NULL; (*moduledata)->objectmanager = g_dbus_object_manager_client_new_sync((*moduledata)->connection, G_DBUS_OBJECT_MANAGER_CLIENT_FLAGS_NONE, "org.freedesktop.ModemManager1", "/org/freedesktop/ModemManager1", NULL, NULL, NULL, NULL, &error); g_signal_connect(G_OBJECT((*moduledata)->objectmanager), "object-added", G_CALLBACK(mmgui_objectmanager_added_signal_handler), mmguicore); g_signal_connect(G_OBJECT((*moduledata)->objectmanager), "object-removed", G_CALLBACK(mmgui_objectmanager_removed_signal_handler), mmguicore); if (((*moduledata)->objectmanager == NULL) && (error != NULL)) { mmgui_module_handle_error_message(mmguicorelc, error); g_error_free(error); g_object_unref((*moduledata)->connection); g_free(mmguicorelc->moduledata); return FALSE; } /*Cancellable*/ (*moduledata)->cancellable = g_cancellable_new(); /*Operations timeouts*/ (*moduledata)->timeouts[MMGUI_DEVICE_OPERATION_ENABLE] = MMGUI_MODULE_ENABLE_OPERATION_TIMEOUT; (*moduledata)->timeouts[MMGUI_DEVICE_OPERATION_SEND_SMS] = MMGUI_MODULE_SEND_SMS_OPERATION_TIMEOUT; (*moduledata)->timeouts[MMGUI_DEVICE_OPERATION_SEND_USSD] = MMGUI_MODULE_SEND_USSD_OPERATION_TIMEOUT; (*moduledata)->timeouts[MMGUI_DEVICE_OPERATION_SCAN] = MMGUI_MODULE_NETWORKS_SCAN_OPERATION_TIMEOUT; return TRUE; } G_MODULE_EXPORT gboolean mmgui_module_close(gpointer mmguicore) { mmguicore_t mmguicorelc; moduledata_t moduledata; GError *error; if (mmguicore == NULL) return FALSE; mmguicorelc = (mmguicore_t)mmguicore; moduledata = (moduledata_t)(mmguicorelc->moduledata); //Close device //Stop subsystems if (moduledata != NULL) { if (moduledata->errormessage != NULL) { g_free(moduledata->errormessage); } if (moduledata->cancellable != NULL) { g_object_unref(moduledata->cancellable); moduledata->cancellable = NULL; } if (moduledata->objectmanager != NULL) { g_object_unref(moduledata->objectmanager); moduledata->objectmanager = NULL; } if (moduledata->connection != NULL) { g_object_unref(moduledata->connection); moduledata->connection = NULL; } g_free(moduledata); } return TRUE; } G_MODULE_EXPORT gchar *mmgui_module_last_error(gpointer mmguicore) { mmguicore_t mmguicorelc; moduledata_t moduledata; if (mmguicore == NULL) return NULL; mmguicorelc = (mmguicore_t)mmguicore; moduledata = (moduledata_t)(mmguicorelc->moduledata); return moduledata->errormessage; } G_MODULE_EXPORT gboolean mmgui_module_interrupt_operation(gpointer mmguicore) { mmguicore_t mmguicorelc; moduledata_t moduledata; mmguidevice_t device; if (mmguicore == NULL) return FALSE; mmguicorelc = (mmguicore_t)mmguicore; if (mmguicorelc->moduledata == NULL) return FALSE; moduledata = (moduledata_t)mmguicorelc->moduledata; if (mmguicorelc->device == NULL) return FALSE; device = mmguicorelc->device; if (device->operation == MMGUI_DEVICE_OPERATION_IDLE) return FALSE; if (moduledata->cancellable != NULL) { g_cancellable_cancel(moduledata->cancellable); return TRUE; } else { return FALSE; } } G_MODULE_EXPORT gboolean mmgui_module_set_timeout(gpointer mmguicore, guint operation, guint timeout) { mmguicore_t mmguicorelc; moduledata_t moduledata; if (mmguicore == NULL) return FALSE; mmguicorelc = (mmguicore_t)mmguicore; if (mmguicorelc->moduledata == NULL) return FALSE; moduledata = (moduledata_t)mmguicorelc->moduledata; if (timeout < 1000) timeout *= 1000; if (operation < MMGUI_DEVICE_OPERATIONS) { moduledata->timeouts[operation] = timeout; return TRUE; } else { return FALSE; } } G_MODULE_EXPORT guint mmgui_module_devices_enum(gpointer mmguicore, GSList **devicelist) { mmguicore_t mmguicorelc; moduledata_t moduledata; guint devnum; GList *objects, *object; const gchar *devpath; if ((mmguicore == NULL) || (devicelist == NULL)) return 0; mmguicorelc = (mmguicore_t)mmguicore; if (mmguicorelc->moduledata == NULL) return 0; moduledata = (moduledata_t)mmguicorelc->moduledata; devnum = 0; objects = g_dbus_object_manager_get_objects(moduledata->objectmanager); for (object = objects; object != NULL; object = object->next) { devpath = g_dbus_object_get_object_path(G_DBUS_OBJECT(object->data)); g_debug("Device object path: %s\n", devpath); *devicelist = g_slist_prepend(*devicelist, mmgui_module_device_new(mmguicore, devpath)); devnum++; } g_list_foreach(objects, (GFunc)g_object_unref, NULL); g_list_free(objects); return devnum; } G_MODULE_EXPORT gboolean mmgui_module_devices_state(gpointer mmguicore, enum _mmgui_device_state_request request) { mmguicore_t mmguicorelc; moduledata_t moduledata; mmguidevice_t device; GVariant *data; gint statevalue; gboolean res; if (mmguicore == NULL) return FALSE; mmguicorelc = (mmguicore_t)mmguicore; if (mmguicorelc->moduledata == NULL) return FALSE; moduledata = (moduledata_t)mmguicorelc->moduledata; if (mmguicorelc->device == NULL) return FALSE; device = mmguicorelc->device; if (moduledata->modemproxy == NULL) return FALSE; data = g_dbus_proxy_get_cached_property(moduledata->modemproxy, "State"); if (data != NULL) { statevalue = g_variant_get_int32(data); g_variant_unref(data); } else { return FALSE; } switch (request) { case MMGUI_DEVICE_STATE_REQUEST_ENABLED: /*Is device enabled*/ res = mmgui_module_device_enabled_from_state(statevalue); if (device->operation != MMGUI_DEVICE_OPERATION_ENABLE) { device->enabled = res; } break; case MMGUI_DEVICE_STATE_REQUEST_LOCKED: /*Is device blocked*/ res = mmgui_module_device_locked_from_state(statevalue); device->blocked = res; break; case MMGUI_DEVICE_STATE_REQUEST_REGISTERED: /*Is device registered in network*/ res = mmgui_module_device_registered_from_state(statevalue); device->registered = res; break; case MMGUI_DEVICE_STATE_REQUEST_CONNECTED: /*Is device connected (modem manager state)*/ res = mmgui_module_device_connected_from_state(statevalue); break; default: res = FALSE; break; } return res; } G_MODULE_EXPORT gboolean mmgui_module_devices_update_state(gpointer mmguicore) { mmguicore_t mmguicorelc; moduledata_t moduledata; mmguidevice_t device; gint messageid; GList *pslnode; GList *pslnext; gchar *pslpath; if (mmguicore == NULL) return FALSE; mmguicorelc = (mmguicore_t)mmguicore; if (mmguicorelc->moduledata == NULL) return FALSE; moduledata = (moduledata_t)mmguicorelc->moduledata; if (mmguicorelc->device == NULL) return FALSE; device = mmguicorelc->device; if (device->enabled) { //Search for completed messages in partial sms list if ((moduledata->partialsms != NULL) && (mmguicorelc->eventcb != NULL)) { pslnode = moduledata->partialsms; while (pslnode != NULL) { pslpath = (gchar *)pslnode->data; pslnext = g_list_next(pslnode); //If messageid is -1 then it is incomplete messageid = mmgui_module_sms_get_id(mmguicore, pslpath); if (messageid != -1) { //Free resources g_free(pslpath); //Remove list node moduledata->partialsms = g_list_delete_link(moduledata->partialsms, pslnode); //Send notification (mmguicorelc->eventcb)(MMGUI_EVENT_SMS_COMPLETED, mmguicore, GUINT_TO_POINTER((guint)messageid)); } pslnode = pslnext; } } } return TRUE; } static gboolean mmgui_module_devices_update_device_mode(gpointer mmguicore, gint oldstate, gint newstate, guint changereason) { mmguicore_t mmguicorelc; moduledata_t moduledata; mmguidevice_t device; gboolean enabledsignal, blockedsignal, regsignal; gsize strsize; GVariant *data; if (mmguicore == NULL) return FALSE; mmguicorelc = (mmguicore_t)mmguicore; if (mmguicorelc->moduledata == NULL) return FALSE; moduledata = (moduledata_t)mmguicorelc->moduledata; if (mmguicorelc->device == NULL) return FALSE; device = mmguicorelc->device; /*Upadate state flags*/ if (device->operation != MMGUI_DEVICE_OPERATION_ENABLE) { device->enabled = mmgui_module_device_enabled_from_state(newstate); } device->blocked = mmgui_module_device_locked_from_state(newstate); device->registered = mmgui_module_device_registered_from_state(newstate); /*Is enabled signal needed */ if ((device->operation != MMGUI_DEVICE_OPERATION_ENABLE) && (mmgui_module_device_enabled_from_state(oldstate) != device->enabled)) { enabledsignal = TRUE; } else { enabledsignal = FALSE; } /*Is blocked signal needed */ if (mmgui_module_device_locked_from_state(oldstate) != device->blocked) { blockedsignal = TRUE; } else { blockedsignal = FALSE; } /*Is registered signal needed */ if (mmgui_module_device_registered_from_state(oldstate) != device->registered) { regsignal = TRUE; } else { regsignal = FALSE; } /*Return if no signals will be sent*/ if ((!enabledsignal) && (!blockedsignal) && (!regsignal)) return TRUE; if (moduledata->netproxy != NULL) { //Operator information if (device->operatorcode != NULL) { g_free(device->operatorcode); device->operatorcode = NULL; } if (device->operatorname != NULL) { g_free(device->operatorname); device->operatorname = NULL; } //Registration state data = g_dbus_proxy_get_cached_property(moduledata->netproxy, "RegistrationState"); if (data != NULL) { device->regstatus = mmgui_module_registration_status_translate(g_variant_get_uint32(data)); g_variant_unref(data); } else { device->regstatus = MMGUI_REG_STATUS_UNKNOWN; } //Operator code data = g_dbus_proxy_get_cached_property(moduledata->netproxy, "OperatorCode"); if (data != NULL) { strsize = 256; device->operatorcode = g_strdup(g_variant_get_string(data, &strsize)); g_variant_unref(data); } else { device->operatorcode = NULL; } //Operator name data = g_dbus_proxy_get_cached_property(moduledata->netproxy, "OperatorName"); if (data != NULL) { strsize = 256; device->operatorname = g_strdup(g_variant_get_string(data, &strsize)); g_variant_unref(data); } else { device->operatorname = NULL; } } if (moduledata->modemproxy != NULL) { if (device->enabled) { //Device identifier (IMEI) if (device->imei != NULL) { g_free(device->imei); device->imei = NULL; } data = g_dbus_proxy_get_cached_property(moduledata->modemproxy, "EquipmentIdentifier"); if (data != NULL) { device->imei = g_strdup(g_variant_get_string(data, &strsize)); g_variant_unref(data); } else { device->imei = NULL; } } } if (moduledata->cardproxy != NULL) { if (device->type == MMGUI_DEVICE_TYPE_GSM) { if (device->enabled) { //IMSI if (device->imsi != NULL) { g_free(device->imsi); device->imsi = NULL; } //IMSI data = g_dbus_proxy_get_cached_property(moduledata->cardproxy, "Imsi"); if (data != NULL) { strsize = 256; device->imsi = g_strdup(g_variant_get_string(data, &strsize)); g_variant_unref(data); } else { device->imsi = NULL; } } } else if (device->type == MMGUI_DEVICE_TYPE_CDMA) { //No IMSI in CDMA if (device->imsi != NULL) { g_free(device->imsi); device->imsi = NULL; } } } /*Enabled signal */ if (enabledsignal) { if (mmguicorelc->eventcb != NULL) { (mmguicorelc->eventcb)(MMGUI_EVENT_DEVICE_ENABLED_STATUS, mmguicorelc, GUINT_TO_POINTER(device->enabled)); } } /*Is blocked signal needed */ if (blockedsignal) { if (mmguicorelc->eventcb != NULL) { (mmguicorelc->eventcb)(MMGUI_EVENT_DEVICE_BLOCKED_STATUS, mmguicorelc, GUINT_TO_POINTER(device->blocked)); } } /*Is registered signal needed */ if (regsignal) { if (mmguicorelc->eventcb != NULL) { (mmguicorelc->eventcb)(MMGUI_EVENT_NETWORK_REGISTRATION_CHANGE, mmguicorelc, device); } } return TRUE; } static gboolean mmgui_module_devices_update_location(gpointer mmguicore, mmguidevice_t device) { mmguicore_t mmguicorelc; moduledata_t moduledata; GVariant *data; GVariantIter *iter; guint32 locationtype; GVariant *locationdata; gchar *locationstring; gsize strlength; GError *error; if ((mmguicore == NULL) || (device == NULL)) return FALSE; mmguicorelc = (mmguicore_t)mmguicore; if (mmguicorelc->moduledata == NULL) return FALSE; moduledata = (moduledata_t)mmguicorelc->moduledata; if ((!(device->locationcaps & MMGUI_LOCATION_CAPS_3GPP)) && (!(device->locationcaps & MMGUI_LOCATION_CAPS_GPS))) return FALSE; error = NULL; data = g_dbus_proxy_call_sync(moduledata->locationproxy, "GetLocation", NULL, 0, -1, NULL, &error); if ((data != NULL) && (error == NULL)) { g_variant_get(data, "(a{uv})", &iter); while (g_variant_iter_next(iter, "{uv}", &locationtype, &locationdata)) { if ((locationtype == MODULE_INT_MODEM_LOCATION_SOURCE_3GPP_LAC_CI) && (locationdata != NULL)) { //3GPP location strlength = 256; locationstring = g_strdup(g_variant_get_string(locationdata, &strlength)); device->loc3gppdata[0] = (guint)strtol(strsep(&locationstring, ","), NULL, 10); device->loc3gppdata[1] = (guint)strtol(strsep(&locationstring, ","), NULL, 10); device->loc3gppdata[2] = (guint)strtol(strsep(&locationstring, ","), NULL, 16); device->loc3gppdata[3] = (guint)strtol(strsep(&locationstring, ","), NULL, 16); g_free(locationstring); g_variant_unref(locationdata); g_debug("3GPP location: %u, %u, %4x, %4x", device->loc3gppdata[0], device->loc3gppdata[1], device->loc3gppdata[2], device->loc3gppdata[3]); } else if ((locationtype == MODULE_INT_MODEM_LOCATION_SOURCE_GPS_RAW) && (locationdata != NULL)) { //GPS location locationdata = g_variant_lookup_value(data, "latitude", G_VARIANT_TYPE_STRING); if (locationdata != NULL) { strlength = 256; locationstring = (gchar *)g_variant_get_string(locationdata, &strlength); device->locgpsdata[0] = atof(locationstring); g_variant_unref(locationdata); } else { device->locgpsdata[0] = 0.0; } locationdata = g_variant_lookup_value(data, "longitude", G_VARIANT_TYPE_STRING); if (locationdata != NULL) { strlength = 256; locationstring = (gchar *)g_variant_get_string(locationdata, &strlength); device->locgpsdata[1] = atof(locationstring); g_variant_unref(locationdata); } else { device->locgpsdata[1] = 0.0; } locationdata = g_variant_lookup_value(data, "altitude", G_VARIANT_TYPE_STRING); if (locationdata != NULL) { strlength = 256; locationstring = (gchar *)g_variant_get_string(locationdata, &strlength); device->locgpsdata[2] = atof(locationstring); g_variant_unref(locationdata); } else { device->locgpsdata[2] = 0.0; } locationdata = g_variant_lookup_value(data, "utc-time", G_VARIANT_TYPE_STRING); if (locationdata != NULL) { strlength = 256; locationstring = (gchar *)g_variant_get_string(locationdata, &strlength); device->locgpsdata[3] = atof(locationstring); g_variant_unref(locationdata); } else { device->locgpsdata[3] = 0.0; } g_debug("GPS location: %2.3f, %2.3f, %2.3f, %6.0f", device->locgpsdata[0], device->locgpsdata[1], device->locgpsdata[2], device->locgpsdata[3]); } g_variant_unref(locationdata); } g_variant_unref(data); return TRUE; } else { if (device->locationcaps & MMGUI_LOCATION_CAPS_3GPP) { memset(device->loc3gppdata, 0, sizeof(device->loc3gppdata)); } if (device->locationcaps & MMGUI_LOCATION_CAPS_GPS) { memset(device->locgpsdata, 0, sizeof(device->locgpsdata)); } mmgui_module_handle_error_message(mmguicorelc, error); g_error_free(error); return FALSE; } } static gboolean mmgui_module_devices_enable_location(gpointer mmguicore, mmguidevice_t device, gboolean enable) { mmguicore_t mmguicorelc; moduledata_t moduledata; GVariant *properties; guint locationtypes, enabledtypes; GError *error; if ((mmguicore == NULL) || (device == NULL)) return FALSE; mmguicorelc = (mmguicore_t)mmguicore; if (mmguicorelc->moduledata == NULL) return FALSE; moduledata = (moduledata_t)mmguicorelc->moduledata; if (!device->enabled) return FALSE; if (moduledata->locationproxy == NULL) return FALSE; if ((enable) && ((device->locationcaps & MMGUI_LOCATION_CAPS_3GPP) || (device->locationcaps & MMGUI_LOCATION_CAPS_GPS))) return TRUE; if ((!enable) && ((!(device->locationcaps & MMGUI_LOCATION_CAPS_3GPP)) && (!(device->locationcaps & MMGUI_LOCATION_CAPS_GPS)))) return TRUE; if (enable) { //Determine supported capabilities and turn on location engine properties = g_dbus_proxy_get_cached_property(moduledata->locationproxy, "Capabilities"); if (properties != NULL) { locationtypes = g_variant_get_uint32(properties); if ((locationtypes & MODULE_INT_MODEM_LOCATION_SOURCE_3GPP_LAC_CI) || (locationtypes & MODULE_INT_MODEM_LOCATION_SOURCE_GPS_RAW)) { error = NULL; //Enable only needed capabilities enabledtypes = ((locationtypes & MODULE_INT_MODEM_LOCATION_SOURCE_3GPP_LAC_CI) | (locationtypes & MODULE_INT_MODEM_LOCATION_SOURCE_GPS_RAW)); //Apply new settings g_dbus_proxy_call_sync(moduledata->locationproxy, "Setup", g_variant_new("(ub)", enabledtypes, TRUE), 0, -1, NULL, &error); //Set enabled properties if (error == NULL) { //3gpp location if (locationtypes & MODULE_INT_MODEM_LOCATION_SOURCE_3GPP_LAC_CI) { device->locationcaps |= MMGUI_LOCATION_CAPS_3GPP; } //GPS location if (locationtypes & MODULE_INT_MODEM_LOCATION_SOURCE_GPS_RAW) { device->locationcaps |= MMGUI_LOCATION_CAPS_GPS; } return TRUE; } else { mmgui_module_handle_error_message(mmguicorelc, error); g_error_free(error); } } g_variant_unref(properties); } } else { error = NULL; g_dbus_proxy_call_sync(moduledata->locationproxy, "Setup", g_variant_new("(ub)", MODULE_INT_MODEM_LOCATION_SOURCE_NONE, FALSE), 0, -1, NULL, &error); if (error == NULL) { return TRUE; } else { mmgui_module_handle_error_message(mmguicorelc, error); g_error_free(error); } } return FALSE; } G_MODULE_EXPORT gboolean mmgui_module_devices_information(gpointer mmguicore) { mmguicore_t mmguicorelc; moduledata_t moduledata; mmguidevice_t device; GVariant *data; GError *error; gchar *blockstr; gsize strsize = 256; gint statevalue; gboolean stateflag; if (mmguicore == NULL) return FALSE; mmguicorelc = (mmguicore_t)mmguicore; if (mmguicorelc->moduledata == NULL) return FALSE; moduledata = (moduledata_t)mmguicorelc->moduledata; if (mmguicorelc->device == NULL) return FALSE; device = mmguicorelc->device; if (moduledata->modemproxy != NULL) { //Is device enabled and blocked data = g_dbus_proxy_get_cached_property(moduledata->modemproxy, "State"); if (data != NULL) { statevalue = g_variant_get_int32(data); device->enabled = mmgui_module_device_enabled_from_state(statevalue); device->blocked = mmgui_module_device_locked_from_state(statevalue); device->registered = mmgui_module_device_registered_from_state(statevalue); g_variant_unref(data); } else { device->enabled = FALSE; device->blocked = TRUE; } if (device->enabled) { //Device identifier (IMEI) if (device->imei != NULL) { g_free(device->imei); device->imei = NULL; } data = g_dbus_proxy_get_cached_property(moduledata->modemproxy, "EquipmentIdentifier"); if (data != NULL) { device->imei = g_strdup(g_variant_get_string(data, &strsize)); g_variant_unref(data); } else { device->imei = NULL; } //Signal level data = g_dbus_proxy_get_cached_property(moduledata->modemproxy, "SignalQuality"); if (data != NULL) { g_variant_get(data, "(ub)", &statevalue, &stateflag); device->siglevel = statevalue; g_variant_unref(data); } else { device->siglevel = 0; } //Used access technology data = g_dbus_proxy_get_cached_property(moduledata->modemproxy, "AccessTechnologies"); if (data != NULL) { device->mode = mmgui_module_access_mode_translate(g_variant_get_uint32(data)); g_variant_unref(data); } else { device->mode = MMGUI_DEVICE_MODE_UNKNOWN; } } } if (moduledata->netproxy != NULL) { //Operator information if (device->operatorcode != NULL) { g_free(device->operatorcode); device->operatorcode = NULL; } if (device->operatorname != NULL) { g_free(device->operatorname); device->operatorname = NULL; } //Registration state data = g_dbus_proxy_get_cached_property(moduledata->netproxy, "RegistrationState"); if (data != NULL) { device->regstatus = mmgui_module_registration_status_translate(g_variant_get_uint32(data)); g_variant_unref(data); } else { device->regstatus = MMGUI_REG_STATUS_UNKNOWN; } //Operator code data = g_dbus_proxy_get_cached_property(moduledata->netproxy, "OperatorCode"); if (data != NULL) { strsize = 256; device->operatorcode = g_strdup(g_variant_get_string(data, &strsize)); g_variant_unref(data); } else { device->operatorcode = NULL; } //Operator name data = g_dbus_proxy_get_cached_property(moduledata->netproxy, "OperatorName"); if (data != NULL) { strsize = 256; device->operatorname = g_strdup(g_variant_get_string(data, &strsize)); g_variant_unref(data); } else { device->operatorname = NULL; } } if (moduledata->cardproxy != NULL) { if (device->type == MMGUI_DEVICE_TYPE_GSM) { if (device->enabled) { //IMSI if (device->imsi != NULL) { g_free(device->imsi); device->imsi = NULL; } //IMSI data = g_dbus_proxy_get_cached_property(moduledata->cardproxy, "Imsi"); if (data != NULL) { strsize = 256; device->imsi = g_strdup(g_variant_get_string(data, &strsize)); g_variant_unref(data); } else { device->imsi = NULL; } } } else if (device->type == MMGUI_DEVICE_TYPE_CDMA) { //No IMSI in CDMA if (device->imsi != NULL) { g_free(device->imsi); device->imsi = NULL; } } } //Update location mmgui_module_devices_update_location(mmguicore, device); //Network time. This code makes ModemManager crash, so it commented out /*gchar *timev; if (moduledata->timeproxy != NULL) { error = NULL; data = g_dbus_proxy_call_sync(moduledata->timeproxy, "GetNetworkTime", NULL, 0, -1, NULL, &error); if ((data == NULL) && (error != NULL)) { mmgui_module_print_error_message(error); g_error_free(error); } else { g_variant_get(data, "(s)", &timev); //device->imsi = g_strdup(device->imsi); g_variant_unref(data); } }*/ return TRUE; } G_MODULE_EXPORT gboolean mmgui_module_devices_open(gpointer mmguicore, mmguidevice_t device) { mmguicore_t mmguicorelc; moduledata_t moduledata; const gchar *simpath; GVariant *simdata; GError *error; gsize strlength; if ((mmguicore == NULL) || (device == NULL)) return FALSE; mmguicorelc = (mmguicore_t)mmguicore; if (mmguicorelc->moduledata == NULL) return FALSE; moduledata = (moduledata_t)mmguicorelc->moduledata; if (device == NULL) return FALSE; if (device->objectpath == NULL) return FALSE; error = NULL; moduledata->netproxy = g_dbus_proxy_new_sync(moduledata->connection, G_DBUS_PROXY_FLAGS_NONE, NULL, "org.freedesktop.ModemManager1", device->objectpath, "org.freedesktop.ModemManager1.Modem.Modem3gpp", NULL, &error); if ((moduledata->netproxy == NULL) && (error != NULL)) { device->scancaps = MMGUI_SCAN_CAPS_NONE; mmgui_module_handle_error_message(mmguicorelc, error); g_error_free(error); } else { device->scancaps = MMGUI_SCAN_CAPS_OBSERVE; moduledata->netpropsignal = g_signal_connect(moduledata->netproxy, "g-properties-changed", G_CALLBACK(mmgui_property_change_handler), mmguicore); } error = NULL; moduledata->modemproxy = g_dbus_proxy_new_sync(moduledata->connection, G_DBUS_PROXY_FLAGS_NONE, NULL, "org.freedesktop.ModemManager1", device->objectpath, "org.freedesktop.ModemManager1.Modem", NULL, &error); if ((moduledata->modemproxy == NULL) && (error != NULL)) { mmgui_module_handle_error_message(mmguicorelc, error); g_error_free(error); } else { moduledata->statesignal = g_signal_connect(moduledata->modemproxy, "g-signal", G_CALLBACK(mmgui_signal_handler), mmguicore); moduledata->modempropsignal = g_signal_connect(moduledata->modemproxy, "g-properties-changed", G_CALLBACK(mmgui_property_change_handler), mmguicore); //Get path for SIM object simdata = g_dbus_proxy_get_cached_property(moduledata->modemproxy, "Sim"); strlength = 256; simpath = g_variant_get_string(simdata, &strlength); //If SIM object exists if (simpath != NULL) { error = NULL; moduledata->cardproxy = g_dbus_proxy_new_sync(moduledata->connection, G_DBUS_PROXY_FLAGS_NONE, NULL, "org.freedesktop.ModemManager1", simpath, "org.freedesktop.ModemManager1.Sim", NULL, &error); if ((moduledata->cardproxy == NULL) && (error != NULL)) { mmgui_module_handle_error_message(mmguicorelc, error); g_error_free(error); } } else { moduledata->cardproxy = NULL; } g_variant_unref(simdata); } error = NULL; moduledata->smsproxy = g_dbus_proxy_new_sync(moduledata->connection, G_DBUS_PROXY_FLAGS_NONE, NULL, "org.freedesktop.ModemManager1", device->objectpath, "org.freedesktop.ModemManager1.Modem.Messaging", NULL, &error); if ((moduledata->smsproxy == NULL) && (error != NULL)) { device->smscaps = MMGUI_SMS_CAPS_NONE; mmgui_module_handle_error_message(mmguicorelc, error); g_error_free(error); } else { device->smscaps = MMGUI_SMS_CAPS_RECEIVE | MMGUI_SMS_CAPS_SEND; moduledata->smssignal = g_signal_connect(moduledata->smsproxy, "g-signal", G_CALLBACK(mmgui_signal_handler), mmguicore); } error = NULL; moduledata->ussdproxy = g_dbus_proxy_new_sync(moduledata->connection, G_DBUS_PROXY_FLAGS_NONE, NULL, "org.freedesktop.ModemManager1", device->objectpath, "org.freedesktop.ModemManager1.Modem.Modem3gpp.Ussd", NULL, &error); if ((moduledata->ussdproxy == NULL) && (error != NULL)) { device->ussdcaps = MMGUI_USSD_CAPS_NONE; mmgui_module_handle_error_message(mmguicorelc, error); g_error_free(error); } else { device->ussdcaps = MMGUI_USSD_CAPS_SEND; } error = NULL; moduledata->locationproxy = g_dbus_proxy_new_sync(moduledata->connection, G_DBUS_PROXY_FLAGS_NONE, NULL, "org.freedesktop.ModemManager1", device->objectpath, "org.freedesktop.ModemManager1.Modem.Location", NULL, &error); if ((moduledata->locationproxy == NULL) && (error != NULL)) { mmgui_module_handle_error_message(mmguicorelc, error); g_error_free(error); } else { if (mmgui_module_devices_enable_location(mmguicore, device, TRUE)) { moduledata->locationpropsignal = g_signal_connect(moduledata->locationproxy, "g-properties-changed", G_CALLBACK(mmgui_property_change_handler), mmguicore); } } error = NULL; moduledata->timeproxy = g_dbus_proxy_new_sync(moduledata->connection, G_DBUS_PROXY_FLAGS_NONE, NULL, "org.freedesktop.ModemManager1", device->objectpath, "org.freedesktop.ModemManager1.Modem.Time", NULL, &error); if ((moduledata->timeproxy == NULL) && (error != NULL)) { mmgui_module_handle_error_message(mmguicorelc, error); g_error_free(error); } else { moduledata->timesignal = g_signal_connect(moduledata->timeproxy, "g-signal", G_CALLBACK(mmgui_signal_handler), mmguicore); } error = NULL; moduledata->contactsproxy = g_dbus_proxy_new_sync(moduledata->connection, G_DBUS_PROXY_FLAGS_NONE, NULL, "org.freedesktop.ModemManager1", device->objectpath, "org.freedesktop.ModemManager1.Modem.Contacts", NULL, &error); if ((moduledata->contactsproxy == NULL) && (error != NULL)) { device->contactscaps = MMGUI_CONTACTS_CAPS_NONE; mmgui_module_handle_error_message(mmguicorelc, error); g_error_free(error); } else { //Test if we really have working conatacts API error = NULL; simdata = g_dbus_proxy_call_sync(moduledata->contactsproxy, "GetCount", NULL, 0, -1, NULL, &error); if ((error != NULL) && (simdata == NULL)) { device->contactscaps = MMGUI_CONTACTS_CAPS_NONE; mmgui_module_handle_error_message(mmguicorelc, error); g_error_free(error); } else { device->contactscaps = MMGUI_CONTACTS_CAPS_EXPORT | MMGUI_CONTACTS_CAPS_EDIT | MMGUI_CONTACTS_CAPS_EXTENDED; g_variant_unref(simdata); } } //Update device information using created proxy objects mmgui_module_devices_information(mmguicore); //Add fresh partial sms list moduledata->partialsms = NULL; //Initialize SMS database return TRUE; } G_MODULE_EXPORT gboolean mmgui_module_devices_close(gpointer mmguicore) { mmguicore_t mmguicorelc; moduledata_t moduledata; GList *pslnode; GList *pslnext; gchar *pslpath; if (mmguicore == NULL) return FALSE; mmguicorelc = (mmguicore_t)mmguicore; if (mmguicorelc->moduledata == NULL) return FALSE; moduledata = (moduledata_t)mmguicorelc->moduledata; //Close SMS database //Free resources //Change device pointer //Free partial sms list if (moduledata->partialsms != NULL) { pslnode = moduledata->partialsms; while (pslnode != NULL) { pslpath = (gchar *)pslnode->data; pslnext = g_list_next(pslnode); if (pslpath) { g_free(pslpath); } pslnode = pslnext; } g_list_free(moduledata->partialsms); moduledata->partialsms = NULL; } if (moduledata->cardproxy != NULL) { g_object_unref(moduledata->cardproxy); moduledata->cardproxy = NULL; } if (moduledata->netproxy != NULL) { if (g_signal_handler_is_connected(moduledata->netproxy, moduledata->netpropsignal)) { g_signal_handler_disconnect(moduledata->netproxy, moduledata->netpropsignal); } g_object_unref(moduledata->netproxy); moduledata->netproxy = NULL; } if (moduledata->modemproxy != NULL) { if (g_signal_handler_is_connected(moduledata->modemproxy, moduledata->statesignal)) { g_signal_handler_disconnect(moduledata->modemproxy, moduledata->statesignal); } if (g_signal_handler_is_connected(moduledata->modemproxy, moduledata->modempropsignal)) { g_signal_handler_disconnect(moduledata->modemproxy, moduledata->modempropsignal); } g_object_unref(moduledata->modemproxy); moduledata->modemproxy = NULL; } if (moduledata->smsproxy != NULL) { if (g_signal_handler_is_connected(moduledata->smsproxy, moduledata->smssignal)) { g_signal_handler_disconnect(moduledata->smsproxy, moduledata->smssignal); } g_object_unref(moduledata->smsproxy); moduledata->smsproxy = NULL; } if (moduledata->ussdproxy != NULL) { g_object_unref(moduledata->ussdproxy); moduledata->ussdproxy = NULL; } if (moduledata->locationproxy != NULL) { if (g_signal_handler_is_connected(moduledata->locationproxy, moduledata->locationpropsignal)) { g_signal_handler_disconnect(moduledata->locationproxy, moduledata->locationpropsignal); } g_object_unref(moduledata->locationproxy); moduledata->locationproxy = NULL; } if (moduledata->timeproxy != NULL) { if (g_signal_handler_is_connected(moduledata->timeproxy, moduledata->timesignal)) { g_signal_handler_disconnect(moduledata->timeproxy, moduledata->timesignal); } g_object_unref(moduledata->timeproxy); moduledata->timeproxy = NULL; } if (moduledata->contactsproxy != NULL) { g_object_unref(moduledata->contactsproxy); moduledata->contactsproxy = NULL; } return TRUE; } static gboolean mmgui_module_devices_restart_ussd(gpointer mmguicore) { mmguicore_t mmguicorelc; moduledata_t moduledata; mmguidevice_t device; GError *error; if (mmguicore == NULL) return FALSE; mmguicorelc = (mmguicore_t)mmguicore; if (mmguicorelc->moduledata == NULL) return FALSE; moduledata = (moduledata_t)mmguicorelc->moduledata; if (mmguicorelc->device == NULL) return FALSE; device = mmguicorelc->device; if (moduledata->ussdproxy != NULL) { device->ussdcaps = MMGUI_USSD_CAPS_NONE; g_object_unref(moduledata->ussdproxy); } error = NULL; moduledata->ussdproxy = g_dbus_proxy_new_sync(moduledata->connection, G_DBUS_PROXY_FLAGS_NONE, NULL, "org.freedesktop.ModemManager1", device->objectpath, "org.freedesktop.ModemManager1.Modem.Modem3gpp.Ussd", NULL, &error); if ((moduledata->ussdproxy == NULL) && (error != NULL)) { device->ussdcaps = MMGUI_USSD_CAPS_NONE; mmgui_module_handle_error_message(mmguicorelc, error); g_error_free(error); return FALSE; } else { device->ussdcaps = MMGUI_USSD_CAPS_SEND; return TRUE; } } static void mmgui_module_devices_enable_handler(GDBusProxy *proxy, GAsyncResult *res, gpointer user_data) { mmguicore_t mmguicorelc; moduledata_t moduledata; GError *error; GVariant *data; gboolean newstate; guint32 statevalue; mmguicorelc = (mmguicore_t)user_data; if (mmguicorelc == NULL) return; if (mmguicorelc->moduledata == NULL) return; moduledata = (moduledata_t)mmguicorelc->moduledata; error = NULL; data = g_dbus_proxy_call_finish(proxy, res, &error); if ((data == NULL) && (error != NULL)) { if ((moduledata->cancellable == NULL) || ((moduledata->cancellable != NULL) && (!g_cancellable_is_cancelled(moduledata->cancellable)))) { mmgui_module_handle_error_message(mmguicorelc, error); } g_error_free(error); newstate = FALSE; } else { g_variant_unref(data); newstate = mmguicorelc->device->enabled; //Update device state data = g_dbus_proxy_get_cached_property(proxy, "State"); statevalue = g_variant_get_int32(data); mmguicorelc->device->enabled = mmgui_module_device_enabled_from_state(statevalue); g_variant_unref(data); //If device state changed - return TRUE if (newstate != mmguicorelc->device->enabled) { //Enable location API mmgui_module_devices_enable_location(mmguicorelc, mmguicorelc->device, TRUE); newstate = TRUE; } else { newstate = FALSE; } } if (mmguicorelc->device != NULL) { mmguicorelc->device->operation = MMGUI_DEVICE_OPERATION_IDLE; } if ((mmguicorelc->eventcb != NULL) && ((moduledata->cancellable == NULL) || ((moduledata->cancellable != NULL) && (!g_cancellable_is_cancelled(moduledata->cancellable))))) { (mmguicorelc->eventcb)(MMGUI_EVENT_MODEM_ENABLE_RESULT, user_data, GUINT_TO_POINTER(newstate)); } } G_MODULE_EXPORT gboolean mmgui_module_devices_enable(gpointer mmguicore, gboolean enabled) { mmguicore_t mmguicorelc; moduledata_t moduledata; if (mmguicore == NULL) return FALSE; mmguicorelc = (mmguicore_t)mmguicore; if (mmguicorelc->moduledata == NULL) return FALSE; moduledata = (moduledata_t)mmguicorelc->moduledata; if (moduledata->modemproxy == NULL) return FALSE; if (mmguicorelc->device == NULL) return FALSE; //Device already in requested state if (mmguicorelc->device->enabled == enabled) return TRUE; mmguicorelc->device->operation = MMGUI_DEVICE_OPERATION_ENABLE; if (moduledata->cancellable != NULL) { g_cancellable_reset(moduledata->cancellable); } g_dbus_proxy_call(moduledata->modemproxy, "Enable", g_variant_new("(b)", enabled), G_DBUS_CALL_FLAGS_NONE, moduledata->timeouts[MMGUI_DEVICE_OPERATION_ENABLE], moduledata->cancellable, (GAsyncReadyCallback)mmgui_module_devices_enable_handler, mmguicore); return TRUE; } static time_t mmgui_module_str_to_time(const gchar *str) { guint i, len; gchar strbuf[3]; struct tm btime; time_t timestamp; gint *fields[] = {&btime.tm_year, &btime.tm_mon, &btime.tm_mday, &btime.tm_hour, &btime.tm_min, &btime.tm_sec}; timestamp = time(NULL); if (str == NULL) return timestamp; len = strlen(str); if (len > 12) { if (str[12] == '+') { //v.0.4.998 timestamp format for (i=0; i<6; i++) { strncpy(strbuf, str+(i*2), 2); strbuf[2] = '\0'; *fields[i] = atoi(strbuf); } } else if (str[8] == ',') { //v.0.5.2 timestamp format for (i=0; i<6; i++) { strncpy(strbuf, str+(i*3), 2); strbuf[2] = '\0'; *fields[i] = atoi(strbuf); } } btime.tm_year += 100; btime.tm_mon -= 1; timestamp = mktime(&btime); } return timestamp; } static mmgui_sms_message_t mmgui_module_sms_retrieve(mmguicore_t mmguicore, const gchar *smspath/*, gboolean listpartial*/) { moduledata_t moduledata; mmgui_sms_message_t message; GDBusProxy *smsproxy; GError *error; GVariant *value; gsize strlength; const gchar *valuestr; guint index, state; gboolean gottext; if ((mmguicore == NULL) || (smspath == NULL)) return NULL; if (mmguicore->moduledata == NULL) return NULL; moduledata = (moduledata_t)mmguicore->moduledata; error = NULL; smsproxy = g_dbus_proxy_new_sync(moduledata->connection, G_DBUS_PROXY_FLAGS_NONE, NULL, "org.freedesktop.ModemManager1", smspath, "org.freedesktop.ModemManager1.Sms", NULL, &error); if ((smsproxy == NULL) && (error != NULL)) { mmgui_module_handle_error_message(mmguicore, error); g_error_free(error); //g_object_unref(smsproxy); return NULL; } //SMS message state value = g_dbus_proxy_get_cached_property(smsproxy, "State"); if (value != NULL) { state = g_variant_get_uint32(value); if (state != MODULE_INT_SMS_STATE_RECEIVED) { /*//Message is not fully received - skip it and add to list if needed if ((state == MODULE_INT_SMS_STATE_RECEIVING) && (listpartial)) { moduledata->partialsms = g_list_prepend(moduledata->partialsms, g_strdup(smspath)); }*/ g_variant_unref(value); g_object_unref(smsproxy); return NULL; } g_variant_unref(value); } else { //Something strange with this message - skip it g_object_unref(smsproxy); return NULL; } //SMS message type value = g_dbus_proxy_get_cached_property(smsproxy, "PduType"); if (value != NULL) { state = g_variant_get_uint32(value); if ((state == MODULE_INT_PDU_TYPE_UNKNOWN) || (state == MODULE_INT_PDU_TYPE_SUBMIT)) { //Only delivered messages and status reports needed this moment - maybe remove other? //TODO: remove message g_variant_unref(value); g_object_unref(smsproxy); return NULL; } g_variant_unref(value); } else { //Something strange with this message - skip it g_object_unref(smsproxy); return NULL; } message = mmgui_smsdb_message_create(); //Sender number value = g_dbus_proxy_get_cached_property(smsproxy, "Number"); if (value != NULL) { strlength = 256; valuestr = g_variant_get_string(value, &strlength); mmgui_smsdb_message_set_number(message, valuestr); g_debug("SMS number: %s\n", valuestr); g_variant_unref(value); } else { mmgui_smsdb_message_set_number(message, _("Unknown")); } //Service center number value = g_dbus_proxy_get_cached_property(smsproxy, "SMSC"); if (value != NULL) { strlength = 256; valuestr = g_variant_get_string(value, &strlength); mmgui_smsdb_message_set_service_number(message, valuestr); g_debug("SMS service number: %s\n", valuestr); g_variant_unref(value); } else { mmgui_smsdb_message_set_service_number(message, _("Unknown")); } //Decoded message text gottext = FALSE; value = g_dbus_proxy_get_cached_property(smsproxy, "Text"); if (value != NULL) { strlength = 256*160; valuestr = g_variant_get_string(value, &strlength); g_debug("SMS text: %s\n", valuestr); mmgui_smsdb_message_set_text(message, valuestr, FALSE); gottext = TRUE; g_variant_unref(value); } else { value = g_dbus_proxy_get_cached_property(smsproxy, "Data"); if (value != NULL) { strlength = g_variant_get_size(value); if (strlength > 0) { valuestr = g_variant_get_data(value); mmgui_smsdb_message_set_binary(message, TRUE); mmgui_smsdb_message_set_data(message, valuestr, strlength, FALSE); gottext = TRUE; } g_variant_unref(value); } } //Message timestamp value = g_dbus_proxy_get_cached_property(smsproxy, "Timestamp"); if (value != NULL) { strlength = 256; valuestr = g_variant_get_string(value, &strlength); mmgui_smsdb_message_set_timestamp(message, mmgui_module_str_to_time(valuestr)); g_debug("SMS timestamp: %lu\n", (gulong)message->timestamp); g_variant_unref(value); } //Message index index = mmgui_module_get_object_path_index(smspath); //Return message if (!gottext) { //Message has no text - skip it mmgui_smsdb_message_free(message); return NULL; } else { //Return message mmgui_smsdb_message_set_identifier(message, index, FALSE); g_debug("SMS index: %u\n", index); return message; } } static gint mmgui_module_sms_get_id(mmguicore_t mmguicore, const gchar *smspath) { moduledata_t moduledata; GDBusProxy *smsproxy; GError *error; GVariant *value; gint state; if ((mmguicore == NULL) || (smspath == NULL)) return -1; if (mmguicore->moduledata == NULL) return -1; moduledata = (moduledata_t)mmguicore->moduledata; error = NULL; smsproxy = g_dbus_proxy_new_sync(moduledata->connection, G_DBUS_PROXY_FLAGS_NONE, NULL, "org.freedesktop.ModemManager1", smspath, "org.freedesktop.ModemManager1.Sms", NULL, &error); if ((smsproxy == NULL) && (error != NULL)) { mmgui_module_handle_error_message(mmguicore, error); g_error_free(error); return -1; } //SMS message state value = g_dbus_proxy_get_cached_property(smsproxy, "State"); if (value != NULL) { state = g_variant_get_uint32(value); if (state == MODULE_INT_SMS_STATE_RECEIVED) { g_variant_unref(value); g_object_unref(smsproxy); return mmgui_module_get_object_path_index(smspath); } else { g_variant_unref(value); g_object_unref(smsproxy); return -1; } g_variant_unref(value); } else { //Something strange with this message g_object_unref(smsproxy); return -1; } } G_MODULE_EXPORT guint mmgui_module_sms_enum(gpointer mmguicore, GSList **smslist) { mmguicore_t mmguicorelc; moduledata_t moduledata; GError *error; GVariant *messages; guint msgnum; GVariantIter miterl1, miterl2; GVariant *mnodel1, *mnodel2; gsize strlength; const gchar *smspath; mmgui_sms_message_t message; if ((mmguicore == NULL) || (smslist == NULL)) return 0; mmguicorelc = (mmguicore_t)mmguicore; if (mmguicorelc->moduledata == NULL) return 0; moduledata = (moduledata_t)mmguicorelc->moduledata; if (moduledata->smsproxy == NULL) return 0; if (mmguicorelc->device == NULL) return 0; if (!mmguicorelc->device->enabled) return 0; if (!(mmguicorelc->device->smscaps & MMGUI_SMS_CAPS_RECEIVE)) return 0; error = NULL; messages = g_dbus_proxy_call_sync(moduledata->smsproxy, "List", NULL, 0, -1, NULL, &error); if ((messages == NULL) && (error != NULL)) { mmgui_module_handle_error_message(mmguicorelc, error); g_error_free(error); return 0; } msgnum = 0; g_variant_iter_init(&miterl1, messages); while ((mnodel1 = g_variant_iter_next_value(&miterl1)) != NULL) { g_variant_iter_init(&miterl2, mnodel1); while ((mnodel2 = g_variant_iter_next_value(&miterl2)) != NULL) { strlength = 256; smspath = g_variant_get_string(mnodel2, &strlength); g_debug("SMS message object path: %s\n", smspath); if (smspath != NULL) { message = mmgui_module_sms_retrieve(mmguicorelc, smspath); if (message != NULL) { *smslist = g_slist_prepend(*smslist, message); msgnum++; } } g_variant_unref(mnodel2); } g_variant_unref(mnodel1); } g_variant_unref(messages); return msgnum; } G_MODULE_EXPORT mmgui_sms_message_t mmgui_module_sms_get(gpointer mmguicore, guint index) { mmguicore_t mmguicorelc; moduledata_t moduledata; gchar *smspath; mmgui_sms_message_t message; if (mmguicore == NULL) return NULL; mmguicorelc = (mmguicore_t)mmguicore; if (mmguicorelc->moduledata == NULL) return NULL; moduledata = (moduledata_t)mmguicorelc->moduledata; if (mmguicorelc->device == NULL) return NULL; if (!mmguicorelc->device->enabled) return NULL; if (!(mmguicorelc->device->smscaps & MMGUI_SMS_CAPS_RECEIVE)) return NULL; smspath = g_strdup_printf("/org/freedesktop/ModemManager1/SMS/%u", index); message = mmgui_module_sms_retrieve(mmguicorelc, smspath); g_free(smspath); return message; } G_MODULE_EXPORT gboolean mmgui_module_sms_delete(gpointer mmguicore, guint index) { mmguicore_t mmguicorelc; moduledata_t moduledata; gchar *smspath; GError *error; if (mmguicore == NULL) return FALSE; mmguicorelc = (mmguicore_t)mmguicore; if (mmguicorelc->moduledata == NULL) return FALSE; moduledata = (moduledata_t)mmguicorelc->moduledata; if (moduledata->smsproxy == NULL) return FALSE; if (mmguicorelc->device == NULL) return FALSE; if (!mmguicorelc->device->enabled) return FALSE; if (!(mmguicorelc->device->smscaps & MMGUI_SMS_CAPS_RECEIVE)) return FALSE; smspath = g_strdup_printf("/org/freedesktop/ModemManager1/SMS/%u", index); error = NULL; g_dbus_proxy_call_sync(moduledata->smsproxy, "Delete", g_variant_new("(o)", smspath), 0, -1, NULL, &error); if (error != NULL) { mmgui_module_handle_error_message(mmguicorelc, error); g_error_free(error); g_free(smspath); return FALSE; } g_free(smspath); return TRUE; } static void mmgui_module_sms_send_handler(GDBusProxy *proxy, GAsyncResult *res, gpointer user_data) { mmguicore_t mmguicorelc; moduledata_t moduledata; GError *error; gboolean sent; const gchar *smspath; if (user_data == NULL) return; mmguicorelc = (mmguicore_t)user_data; if (mmguicorelc->moduledata == NULL) return; moduledata = (moduledata_t)mmguicorelc->moduledata; error = NULL; g_dbus_proxy_call_finish(proxy, res, &error); //Operation result if (error != NULL) { if ((moduledata->cancellable == NULL) || ((moduledata->cancellable != NULL) && (!g_cancellable_is_cancelled(moduledata->cancellable)))) { mmgui_module_handle_error_message(mmguicorelc, error); } g_error_free(error); sent = FALSE; } else { sent = TRUE; } smspath = g_dbus_proxy_get_object_path(proxy); if (smspath != NULL) { error = NULL; //Remove message from storage g_dbus_proxy_call_sync(moduledata->smsproxy, "Delete", g_variant_new("(o)", smspath), 0, -1, NULL, &error); if (error != NULL) { mmgui_module_handle_error_message(mmguicorelc, error); g_error_free(error); } } if (mmguicorelc->device != NULL) { mmguicorelc->device->operation = MMGUI_DEVICE_OPERATION_IDLE; } if ((mmguicorelc->eventcb != NULL) && ((moduledata->cancellable == NULL) || ((moduledata->cancellable != NULL) && (!g_cancellable_is_cancelled(moduledata->cancellable))))) { (mmguicorelc->eventcb)(MMGUI_EVENT_SMS_SENT, user_data, GUINT_TO_POINTER(sent)); } } G_MODULE_EXPORT gboolean mmgui_module_sms_send(gpointer mmguicore, gchar* number, gchar *text) { mmguicore_t mmguicorelc; moduledata_t moduledata; GVariantBuilder *builder; GVariant *array, *message, *smspathv; GError *error; gsize strlength; gchar *smspath; GDBusProxy *messageproxy; if ((number == NULL) || (text == NULL)) return FALSE; if (mmguicore == NULL) return FALSE; mmguicorelc = (mmguicore_t)mmguicore; if (mmguicorelc->moduledata == NULL) return FALSE; moduledata = (moduledata_t)mmguicorelc->moduledata; if (moduledata->smsproxy == NULL) return FALSE; if (mmguicorelc->device == NULL) return FALSE; if (!mmguicorelc->device->enabled) return FALSE; if (!(mmguicorelc->device->smscaps & MMGUI_SMS_CAPS_SEND)) return FALSE; builder = g_variant_builder_new(G_VARIANT_TYPE_ARRAY); g_variant_builder_add_parsed(builder, "{'number', <%s>}", number); g_variant_builder_add_parsed(builder, "{'text', <%s>}", text); array = g_variant_builder_end(builder); builder = g_variant_builder_new(G_VARIANT_TYPE_TUPLE); g_variant_builder_add_value(builder, array); message = g_variant_builder_end(builder); error = NULL; //Create new message smspathv = g_dbus_proxy_call_sync(moduledata->smsproxy, "Create", message, 0, -1, NULL, &error); if ((smspathv == NULL) && (error != NULL)) { mmgui_module_handle_error_message(mmguicorelc, error); g_error_free(error); return FALSE; } //Created SMS object path g_variant_get(smspathv, "(o)", &smspath); if (smspath == NULL) { g_debug("Failed to obtain object path for saved SMS message\n"); return FALSE; } error = NULL; //Create message proxy messageproxy = g_dbus_proxy_new_sync(moduledata->connection, G_DBUS_PROXY_FLAGS_NONE, NULL, "org.freedesktop.ModemManager1", smspath, "org.freedesktop.ModemManager1.Sms", NULL, &error); if ((messageproxy == NULL) && (error != NULL)) { mmgui_module_handle_error_message(mmguicorelc, error); g_error_free(error); g_free(smspath); return FALSE; } g_free(smspath); mmguicorelc->device->operation = MMGUI_DEVICE_OPERATION_SEND_SMS; if (moduledata->cancellable != NULL) { g_cancellable_reset(moduledata->cancellable); } //Send message g_dbus_proxy_call(messageproxy, "Send", NULL, G_DBUS_CALL_FLAGS_NONE, moduledata->timeouts[MMGUI_DEVICE_OPERATION_SEND_SMS], moduledata->cancellable, (GAsyncReadyCallback)mmgui_module_sms_send_handler, mmguicore); return TRUE; } G_MODULE_EXPORT gboolean mmgui_module_ussd_cancel_session(gpointer mmguicore) { mmguicore_t mmguicorelc; moduledata_t moduledata; GError *error; if (mmguicore == NULL) return FALSE; mmguicorelc = (mmguicore_t)mmguicore; if (mmguicorelc->moduledata == NULL) return FALSE; moduledata = (moduledata_t)mmguicorelc->moduledata; if (moduledata->ussdproxy == NULL) return FALSE; if (mmguicorelc->device == NULL) return FALSE; if (!mmguicorelc->device->enabled) return FALSE; if (!(mmguicorelc->device->ussdcaps & MMGUI_USSD_CAPS_SEND)) return FALSE; error = NULL; g_dbus_proxy_call_sync(moduledata->ussdproxy, "Cancel", NULL, 0, -1, NULL, &error); if (error != NULL) { mmgui_module_handle_error_message(mmguicorelc, error); g_error_free(error); return FALSE; } return TRUE; } G_MODULE_EXPORT enum _mmgui_ussd_state mmgui_module_ussd_get_state(gpointer mmguicore) { mmguicore_t mmguicorelc; moduledata_t moduledata; GVariant *session; guint state; enum _mmgui_ussd_state stateid; stateid = MMGUI_USSD_STATE_UNKNOWN; if (mmguicore == NULL) return stateid; mmguicorelc = (mmguicore_t)mmguicore; if (mmguicorelc->moduledata == NULL) return stateid; moduledata = (moduledata_t)mmguicorelc->moduledata; if (moduledata->ussdproxy == NULL) return stateid; if (mmguicorelc->device == NULL) return stateid; if (!mmguicorelc->device->enabled) return stateid; if (!(mmguicorelc->device->ussdcaps & MMGUI_USSD_CAPS_SEND)) return stateid; session = g_dbus_proxy_get_cached_property(moduledata->ussdproxy, "State"); if (session == NULL) return stateid; state = g_variant_get_uint32(session); switch (state) { case MODULE_INT_MODEM_3GPP_USSD_SESSION_STATE_UNKNOWN: stateid = MMGUI_USSD_STATE_UNKNOWN; break; case MODULE_INT_MODEM_3GPP_USSD_SESSION_STATE_IDLE: stateid = MMGUI_USSD_STATE_IDLE; break; case MODULE_INT_MODEM_3GPP_USSD_SESSION_STATE_ACTIVE: stateid = MMGUI_USSD_STATE_ACTIVE; break; case MODULE_INT_MODEM_3GPP_USSD_SESSION_STATE_USER_RESPONSE: stateid = MMGUI_USSD_STATE_USER_RESPONSE; break; default: stateid = MMGUI_USSD_STATE_UNKNOWN; break; } g_variant_unref(session); return stateid; } static void mmgui_module_ussd_send_handler(GDBusProxy *proxy, GAsyncResult *res, gpointer user_data) { mmguicore_t mmguicorelc; moduledata_t moduledata; GError *error; GVariant *result; gchar *answer; mmguicorelc = (mmguicore_t)user_data; if (mmguicorelc == NULL) return; if (mmguicorelc->moduledata == NULL) return; moduledata = (moduledata_t)mmguicorelc->moduledata; error = NULL; answer = NULL; result = g_dbus_proxy_call_finish(proxy, res, &error); if ((result == NULL) && (error != NULL)) { /*For some reason after timeout ussd does not work - restart it*/ mmgui_module_devices_restart_ussd(mmguicorelc); if ((moduledata->cancellable == NULL) || ((moduledata->cancellable != NULL) && (!g_cancellable_is_cancelled(moduledata->cancellable)))) { mmgui_module_handle_error_message(mmguicorelc, error); } g_error_free(error); } else { g_variant_get(result, "(s)", &answer); answer = g_strdup(answer); g_variant_unref(result); } if (mmguicorelc->device != NULL) { mmguicorelc->device->operation = MMGUI_DEVICE_OPERATION_IDLE; } if ((mmguicorelc->eventcb != NULL) && ((moduledata->cancellable == NULL) || ((moduledata->cancellable != NULL) && (!g_cancellable_is_cancelled(moduledata->cancellable))))) { (mmguicorelc->eventcb)(MMGUI_EVENT_USSD_RESULT, user_data, answer); } } G_MODULE_EXPORT gboolean mmgui_module_ussd_send(gpointer mmguicore, gchar *request, enum _mmgui_ussd_validation validationid) { mmguicore_t mmguicorelc; moduledata_t moduledata; enum _mmgui_ussd_state sessionstate; GVariant *ussdreq; gchar *command; if ((mmguicore == NULL) || (request == NULL)) return FALSE; mmguicorelc = (mmguicore_t)mmguicore; if (mmguicorelc->moduledata == NULL) return FALSE; moduledata = (moduledata_t)mmguicorelc->moduledata; if (moduledata->ussdproxy == NULL) return FALSE; if (mmguicorelc->device == NULL) return FALSE; if (!mmguicorelc->device->enabled) return FALSE; if (!(mmguicorelc->device->ussdcaps & MMGUI_USSD_CAPS_SEND)) return FALSE; sessionstate = mmgui_module_ussd_get_state(mmguicore); if ((sessionstate == MMGUI_USSD_STATE_UNKNOWN) || (sessionstate == MMGUI_USSD_STATE_ACTIVE)) { mmgui_module_ussd_cancel_session(mmguicore); } ussdreq = g_variant_new("(s)", request); if (sessionstate == MMGUI_USSD_STATE_IDLE) { command = "Initiate"; } else if (sessionstate == MMGUI_USSD_STATE_USER_RESPONSE) { if (validationid == MMGUI_USSD_VALIDATION_REQUEST) { mmgui_module_ussd_cancel_session(mmguicore); command = "Initiate"; } else { command = "Respond"; } } mmguicorelc->device->operation = MMGUI_DEVICE_OPERATION_SEND_USSD; if (moduledata->cancellable != NULL) { g_cancellable_reset(moduledata->cancellable); } g_dbus_proxy_call(moduledata->ussdproxy, command, ussdreq, G_DBUS_CALL_FLAGS_NONE, moduledata->timeouts[MMGUI_DEVICE_OPERATION_SEND_USSD], moduledata->cancellable, (GAsyncReadyCallback)mmgui_module_ussd_send_handler, mmguicore); return TRUE; } static mmgui_scanned_network_t mmgui_module_network_retrieve(GVariant *networkv) { mmgui_scanned_network_t network; GVariant *value; gsize strlength; const gchar *valuestr; guint i; if (networkv == NULL) return NULL; network = g_new0(struct _mmgui_scanned_network, 1); //Mobile operator code (MCCMNC) value = g_variant_lookup_value(networkv, "operator-code", G_VARIANT_TYPE_STRING); if (value != NULL) { strlength = 256; valuestr = g_variant_get_string(value, &strlength); network->operator_num = atoi(valuestr); g_variant_unref(value); } else { network->operator_num = 0; } //Network access technology value = g_variant_lookup_value(networkv, "access-technology", G_VARIANT_TYPE_UINT32); if (value != NULL) { network->access_tech = mmgui_module_access_technology_translate(g_variant_get_uint32(value)); g_variant_unref(value); } else { network->access_tech = MMGUI_ACCESS_TECH_GSM; } //Long-format name of operator value = g_variant_lookup_value(networkv, "operator-long", G_VARIANT_TYPE_STRING); if (value != NULL) { strlength = 256; valuestr = g_variant_get_string(value, &strlength); network->operator_long = g_strdup(valuestr); g_variant_unref(value); } else { network->operator_long = g_strdup(_("Unknown")); } //Short-format name of operator value = g_variant_lookup_value(networkv, "operator-short", G_VARIANT_TYPE_STRING); if (value != NULL) { strlength = 256; valuestr = g_variant_get_string(value, &strlength); network->operator_short = g_strdup(valuestr); g_variant_unref(value); } else { network->operator_short = g_strdup(_("Unknown")); } //Network availability status (this is a critical parameter, so entry will be skipped if value is unknown) value = g_variant_lookup_value(networkv, "status", G_VARIANT_TYPE_UINT32); if (value != NULL) { network->status = mmgui_module_network_availability_status_translate(g_variant_get_uint32(value)); g_variant_unref(value); return network; } else { if (network->operator_long != NULL) g_free(network->operator_long); if (network->operator_short != NULL) g_free(network->operator_short); g_free(network); return NULL; } } static void mmgui_module_networks_scan_handler(GDBusProxy *proxy, GAsyncResult *res, gpointer user_data) { mmguicore_t mmguicorelc; moduledata_t moduledata; GError *error; GVariant *result; GSList *networks; GVariantIter niterl1, niterl2, niterl3; GVariant *nnodel1, *nnodel2, *nnodel3; mmgui_scanned_network_t network; mmguicorelc = (mmguicore_t)user_data; if (mmguicorelc == NULL) return; if (mmguicorelc->moduledata == NULL) return; moduledata = (moduledata_t)mmguicorelc->moduledata; error = NULL; networks = NULL; result = g_dbus_proxy_call_finish(proxy, res, &error); if ((result == NULL) && (error != NULL)) { if ((moduledata->cancellable == NULL) || ((moduledata->cancellable != NULL) && (!g_cancellable_is_cancelled(moduledata->cancellable)))) { mmgui_module_handle_error_message(mmguicorelc, error); } g_error_free(error); } else { g_variant_iter_init(&niterl1, result); while ((nnodel1 = g_variant_iter_next_value(&niterl1)) != NULL) { g_variant_iter_init(&niterl2, nnodel1); while ((nnodel2 = g_variant_iter_next_value(&niterl2)) != NULL) { network = mmgui_module_network_retrieve(nnodel2); if (network != NULL) { networks = g_slist_prepend(networks, network); } g_variant_unref(nnodel2); } g_variant_unref(nnodel1); } g_variant_unref(result); } if (mmguicorelc->device != NULL) { mmguicorelc->device->operation = MMGUI_DEVICE_OPERATION_IDLE; } if ((mmguicorelc->eventcb != NULL) && ((moduledata->cancellable == NULL) || ((moduledata->cancellable != NULL) && (!g_cancellable_is_cancelled(moduledata->cancellable))))) { (mmguicorelc->eventcb)(MMGUI_EVENT_SCAN_RESULT, user_data, networks); } } G_MODULE_EXPORT gboolean mmgui_module_networks_scan(gpointer mmguicore) { mmguicore_t mmguicorelc; moduledata_t moduledata; if (mmguicore == NULL) return FALSE; mmguicorelc = (mmguicore_t)mmguicore; if (mmguicorelc->moduledata == NULL) return FALSE; moduledata = (moduledata_t)mmguicorelc->moduledata; if (moduledata->netproxy == NULL) return FALSE; if (mmguicorelc->device == NULL) return FALSE; if (!mmguicorelc->device->enabled) return FALSE; if (!(mmguicorelc->device->scancaps & MMGUI_SCAN_CAPS_OBSERVE)) return FALSE; mmguicorelc->device->operation = MMGUI_DEVICE_OPERATION_SCAN; if (moduledata->cancellable != NULL) { g_cancellable_reset(moduledata->cancellable); } g_dbus_proxy_call(moduledata->netproxy, "Scan", NULL, G_DBUS_CALL_FLAGS_NONE, moduledata->timeouts[MMGUI_DEVICE_OPERATION_SCAN], moduledata->cancellable, (GAsyncReadyCallback)mmgui_module_networks_scan_handler, mmguicore); return TRUE; } static mmgui_contact_t mmgui_module_contact_retrieve(GVariant *contactv) { mmgui_contact_t contact; GVariant *value; gsize strlength; const gchar *valuestr; if (contactv == NULL) return NULL; contact = g_new0(struct _mmgui_contact, 1); //Full name of the contact value = g_variant_lookup_value(contactv, "name", G_VARIANT_TYPE_STRING); if (value != NULL) { strlength = 256; valuestr = g_variant_get_string(value, &strlength); contact->name = g_strdup(valuestr); g_variant_unref(value); } else { contact->name = g_strdup(_("Unknown")); } //Telephone number value = g_variant_lookup_value(contactv, "number", G_VARIANT_TYPE_STRING); if (value != NULL) { strlength = 256; valuestr = g_variant_get_string(value, &strlength); contact->number = g_strdup(valuestr); g_variant_unref(value); } else { contact->number = g_strdup(_("Unknown")); } //Email address value = g_variant_lookup_value(contactv, "email", G_VARIANT_TYPE_STRING); if (value != NULL) { strlength = 256; valuestr = g_variant_get_string(value, &strlength); contact->email = g_strdup(valuestr); g_variant_unref(value); } else { contact->email = g_strdup(_("Unknown")); } //Group this contact belongs to value = g_variant_lookup_value(contactv, "group", G_VARIANT_TYPE_STRING); if (value != NULL) { strlength = 256; valuestr = g_variant_get_string(value, &strlength); contact->group = g_strdup(valuestr); g_variant_unref(value); } else { contact->group = g_strdup(_("Unknown")); } //Additional contact name value = g_variant_lookup_value(contactv, "name2", G_VARIANT_TYPE_STRING); if (value != NULL) { strlength = 256; valuestr = g_variant_get_string(value, &strlength); contact->name2 = g_strdup(valuestr); g_variant_unref(value); } else { contact->name2 = g_strdup(_("Unknown")); } //Additional contact telephone number value = g_variant_lookup_value(contactv, "number2", G_VARIANT_TYPE_STRING); if (value != NULL) { strlength = 256; valuestr = g_variant_get_string(value, &strlength); contact->number2 = g_strdup(valuestr); g_variant_unref(value); } else { contact->number2 = g_strdup(_("Unknown")); } //Boolean flag to specify whether this entry is hidden or not value = g_variant_lookup_value(contactv, "hidden", G_VARIANT_TYPE_BOOLEAN); if (value != NULL) { contact->hidden = g_variant_get_boolean(value); g_variant_unref(value); } else { contact->hidden = FALSE; } //Phonebook in which the contact is stored value = g_variant_lookup_value(contactv, "storage", G_VARIANT_TYPE_UINT32); if (value != NULL) { contact->storage = g_variant_get_uint32(value); g_variant_unref(value); } else { contact->storage = FALSE; } //Internal private number (this is a critical parameter, so entry will be skipped if value is unknown) value = g_variant_lookup_value(contactv, "index", G_VARIANT_TYPE_UINT32); if (value != NULL) { contact->id = g_variant_get_uint32(value); g_variant_unref(value); return contact; } else { if (contact->name != NULL) g_free(contact->name); if (contact->number != NULL) g_free(contact->number); if (contact->email != NULL) g_free(contact->email); if (contact->group != NULL) g_free(contact->group); if (contact->name2 != NULL) g_free(contact->name2); if (contact->number2 != NULL) g_free(contact->number2); g_free(contact); return NULL; } } G_MODULE_EXPORT guint mmgui_module_contacts_enum(gpointer mmguicore, GSList **contactslist) { mmguicore_t mmguicorelc; moduledata_t moduledata; GError *error; GVariant *contacts; guint contactsnum; GVariantIter citerl1, citerl2; GVariant *cnodel1, *cnodel2; mmgui_contact_t contact; if ((mmguicore == NULL) || (contactslist == NULL)) return 0; mmguicorelc = (mmguicore_t)mmguicore; if (mmguicorelc->moduledata == NULL) return 0; moduledata = (moduledata_t)mmguicorelc->moduledata; if (moduledata->contactsproxy == NULL) return 0; if (mmguicorelc->device == NULL) return 0; if (!mmguicorelc->device->enabled) return 0; if (!(mmguicorelc->device->contactscaps & MMGUI_CONTACTS_CAPS_EXPORT)) return 0; error = NULL; contacts = g_dbus_proxy_call_sync(moduledata->contactsproxy, "List", NULL, 0, -1, NULL, &error); if ((contacts == NULL) && (error != NULL)) { mmgui_module_handle_error_message(mmguicorelc, error); g_error_free(error); return 0; } contactsnum = 0; g_variant_iter_init(&citerl1, contacts); while ((cnodel1 = g_variant_iter_next_value(&citerl1)) != NULL) { g_variant_iter_init(&citerl2, cnodel1); while ((cnodel2 = g_variant_iter_next_value(&citerl2)) != NULL) { contact = mmgui_module_contact_retrieve(cnodel2); if (contact != NULL) { *contactslist = g_slist_prepend(*contactslist, contact); contactsnum++; } g_variant_unref(cnodel2); } g_variant_unref(cnodel1); } g_variant_unref(contacts); return contactsnum; } G_MODULE_EXPORT gboolean mmgui_module_contacts_delete(gpointer mmguicore, guint index) { mmguicore_t mmguicorelc; moduledata_t moduledata; GError *error; if (mmguicore == NULL) return FALSE; mmguicorelc = (mmguicore_t)mmguicore; if (mmguicorelc->moduledata == NULL) return FALSE; moduledata = (moduledata_t)mmguicorelc->moduledata; if (moduledata->contactsproxy == NULL) return FALSE; if (mmguicorelc->device == NULL) return FALSE; if (!mmguicorelc->device->enabled) return FALSE; if (!(mmguicorelc->device->contactscaps & MMGUI_CONTACTS_CAPS_EDIT)) return FALSE; error = NULL; g_dbus_proxy_call_sync(moduledata->contactsproxy, "Delete", g_variant_new("(i)", index), 0, -1, NULL, &error); if (error != NULL) { mmgui_module_handle_error_message(mmguicorelc, error); g_error_free(error); return FALSE; } return TRUE; } G_MODULE_EXPORT gint mmgui_module_contacts_add(gpointer mmguicore, gchar* name, gchar *number) { mmguicore_t mmguicorelc; moduledata_t moduledata; GVariantBuilder *builder; GVariant *array, *contact; GError *error; GVariant *idv; guint id; if ((mmguicore == NULL) || (name == NULL) || (number == NULL)) return -1; mmguicorelc = (mmguicore_t)mmguicore; if (mmguicorelc->moduledata == NULL) return -1; moduledata = (moduledata_t)mmguicorelc->moduledata; if (moduledata->contactsproxy == NULL) return -1; if (mmguicorelc->device == NULL) return -1; if (!mmguicorelc->device->enabled) return -1; if (!(mmguicorelc->device->contactscaps & MMGUI_CONTACTS_CAPS_EDIT)) return -1; builder = g_variant_builder_new(G_VARIANT_TYPE_ARRAY); g_variant_builder_add_parsed(builder, "{'name', <%s>}", name); g_variant_builder_add_parsed(builder, "{'number', <%s>}", number); g_variant_builder_add_parsed(builder, "{'hidden', <%b>}", FALSE); array = g_variant_builder_end(builder); builder = g_variant_builder_new(G_VARIANT_TYPE_TUPLE); g_variant_builder_add_value(builder, array); contact = g_variant_builder_end(builder); error = NULL; idv = g_dbus_proxy_call_sync(moduledata->contactsproxy, "Add", contact, 0, -1, NULL, &error); if ((idv == NULL) && (error != NULL)) { mmgui_module_handle_error_message(mmguicorelc, error); g_error_free(error); return -1; } g_variant_get(idv, "(u)", &id); g_variant_unref(idv); return id; } modem-manager-gui-0.0.16/src/modules/nm09.c000066400000000000000000000414241217271411700202670ustar00rootroot00000000000000/* * nm09.c * * Copyright 2013 Alex * * 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 . */ #include #include #include #include #include #include #include #include #include #include "../mmguicore.h" #define MMGUI_MODULE_SERVICE_NAME "org.freedesktop.NetworkManager" #define MMGUI_MODULE_IDENTIFIER 90 #define MMGUI_MODULE_DESCRIPTION "Network Manager >= 0.9.0" //Internal definitions #define MODULE_INT_PPPD_LOCK_FILE_PATH "/var/run/%s.pid" //Internal enumerations //Modem state internal flags typedef enum { MODULE_INT_DEVICE_STATE_UNKNOWN = 0, //The device is in an unknown state. MODULE_INT_DEVICE_STATE_UNMANAGED = 10, //The device is recognized but not managed by NetworkManager. MODULE_INT_DEVICE_STATE_UNAVAILABLE = 20, //The device cannot be used (carrier off, rfkill, etc). MODULE_INT_DEVICE_STATE_DISCONNECTED = 30, //The device is not connected. MODULE_INT_DEVICE_STATE_PREPARE = 40, //The device is preparing to connect. MODULE_INT_DEVICE_STATE_CONFIG = 50, //The device is being configured. MODULE_INT_DEVICE_STATE_NEED_AUTH = 60, //The device is awaiting secrets necessary to continue connection. MODULE_INT_DEVICE_STATE_IP_CONFIG = 70, //The IP settings of the device are being requested and configured. MODULE_INT_DEVICE_STATE_IP_CHECK = 80, //The device's IP connectivity ability is being determined. MODULE_INT_DEVICE_STATE_SECONDARIES = 90, //The device is waiting for secondary connections to be activated. MODULE_INT_DEVICE_STATE_ACTIVATED = 100, //The device is active. MODULE_INT_DEVICE_STATE_DEACTIVATING = 110, //The device's network connection is being torn down. MODULE_INT_DEVICE_STATE_FAILED = 120 //The device is in a failure state following an attempt to activate it. } ModuleIntDeviceState; //Device type internal flags typedef enum { MODULE_INT_DEVICE_TYPE_UNKNOWN = 0, //The device type is unknown. MODULE_INT_DEVICE_TYPE_ETHERNET = 1, //The device is wired Ethernet device. MODULE_INT_DEVICE_TYPE_WIFI = 2, //The device is an 802.11 WiFi device. MODULE_INT_DEVICE_TYPE_UNUSED1 = 3, //Unused MODULE_INT_DEVICE_TYPE_UNUSED2 = 4, //Unused MODULE_INT_DEVICE_TYPE_BT = 5, //The device is Bluetooth device that provides PAN or DUN capabilities. MODULE_INT_DEVICE_TYPE_OLPC_MESH = 6, //The device is an OLPC mesh networking device. MODULE_INT_DEVICE_TYPE_WIMAX = 7, //The device is an 802.16e Mobile WiMAX device. MODULE_INT_DEVICE_TYPE_MODEM = 8, //The device is a modem supporting one or more of analog telephone, CDMA/EVDO, GSM/UMTS/HSPA, or LTE standards to access a cellular or wireline data network. MODULE_INT_DEVICE_TYPE_INFINIBAND = 9, //The device is an IP-capable InfiniBand interface. MODULE_INT_DEVICE_TYPE_BOND = 10, //The device is a bond master interface. MODULE_INT_DEVICE_TYPE_VLAN = 11, //The device is a VLAN interface. MODULE_INT_DEVICE_TYPE_ADSL = 12, //The device is an ADSL device supporting PPPoE and PPPoATM protocols. MODULE_INT_DEVICE_TYPE_BRIDGE = 13 //The device is a bridge interface. } ModuleIntDeviceType; //Active connection state internal flags typedef enum { MODULE_INT_ACTIVE_CONNECTION_STATE_UNKNOWN = 0, /*The active connection is in an unknown state.*/ MODULE_INT_ACTIVE_CONNECTION_STATE_ACTIVATING = 1, /*The connection is activating.*/ MODULE_INT_ACTIVE_CONNECTION_STATE_ACTIVATED = 2, /*The connection is activated.*/ MODULE_INT_ACTIVE_CONNECTION_STATE_DEACTIVATING = 3, /*The connection is being torn down and cleaned up.*/ MODULE_INT_ACTIVE_CONNECTION_STATE_DEACTIVATED = 4 /*The connection is no longer active.*/ } ModuleIntActiveConnectionState; //Private module variables struct _mmguimoduledata { //DBus connection GDBusConnection *connection; //DBus proxy objects GDBusProxy *nmproxy; //Dbus object paths gchar *nmdevpath; //Last error message gchar *errormessage; }; typedef struct _mmguimoduledata *moduledata_t; static void mmgui_module_handle_error_message(mmguicore_t mmguicore, GError *error) { moduledata_t moduledata; if ((mmguicore == NULL) || (error == NULL)) return; moduledata = (moduledata_t)mmguicore->cmoduledata; if (moduledata == NULL) return; if (moduledata->errormessage != NULL) { g_free(moduledata->errormessage); } if (error->message != NULL) { moduledata->errormessage = g_strdup(error->message); } else { moduledata->errormessage = g_strdup("Unknown error"); } g_warning("%s: %s", MMGUI_MODULE_DESCRIPTION, moduledata->errormessage); } G_MODULE_EXPORT gboolean mmgui_module_init(mmguimodule_t module) { if (module == NULL) return FALSE; module->type = MMGUI_MODULE_TYPE_CONNECTION_MANGER; module->requirement = MMGUI_MODULE_REQUIREMENT_SERVICE; module->priority = MMGUI_MODULE_PRIORITY_NORMAL; module->identifier = MMGUI_MODULE_IDENTIFIER; module->functions = MMGUI_MODULE_FUNCTION_BASIC; g_snprintf(module->servicename, sizeof(module->servicename), MMGUI_MODULE_SERVICE_NAME); g_snprintf(module->description, sizeof(module->description), MMGUI_MODULE_DESCRIPTION); return TRUE; } G_MODULE_EXPORT gboolean mmgui_module_connection_open(gpointer mmguicore) { mmguicore_t mmguicorelc; moduledata_t *moduledata; GError *error; if (mmguicore == NULL) return FALSE; mmguicorelc = (mmguicore_t)mmguicore; moduledata = (moduledata_t *)&mmguicorelc->cmoduledata; (*moduledata) = g_new0(struct _mmguimoduledata, 1); error = NULL; (*moduledata)->connection = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error); (*moduledata)->errormessage = NULL; if (((*moduledata)->connection == NULL) && (error != NULL)) { mmgui_module_handle_error_message(mmguicorelc, error); g_error_free(error); g_free(mmguicorelc->moduledata); return FALSE; } error = NULL; (*moduledata)->nmproxy = g_dbus_proxy_new_sync((*moduledata)->connection, G_DBUS_PROXY_FLAGS_NONE, NULL, "org.freedesktop.NetworkManager", "/org/freedesktop/NetworkManager", "org.freedesktop.NetworkManager", NULL, &error); if (((*moduledata)->nmproxy == NULL) && (error != NULL)) { mmgui_module_handle_error_message(mmguicorelc, error); g_error_free(error); g_object_unref((*moduledata)->connection); g_free(mmguicorelc->cmoduledata); return FALSE; } (*moduledata)->nmdevpath = NULL; return TRUE; } G_MODULE_EXPORT gboolean mmgui_module_connection_close(gpointer mmguicore) { mmguicore_t mmguicorelc; moduledata_t moduledata; GError *error; if (mmguicore == NULL) return FALSE; mmguicorelc = (mmguicore_t)mmguicore; moduledata = (moduledata_t)(mmguicorelc->cmoduledata); if (moduledata != NULL) { if (moduledata->errormessage != NULL) { g_free(moduledata->errormessage); } if (moduledata->nmproxy != NULL) { g_object_unref(moduledata->nmproxy); moduledata->nmproxy = NULL; } if (moduledata->connection != NULL) { g_object_unref(moduledata->connection); moduledata->connection = NULL; } g_free(moduledata); } return TRUE; } G_MODULE_EXPORT gchar *mmgui_module_connection_last_error(gpointer mmguicore) { mmguicore_t mmguicorelc; moduledata_t moduledata; if (mmguicore == NULL) return NULL; mmguicorelc = (mmguicore_t)mmguicore; moduledata = (moduledata_t)(mmguicorelc->cmoduledata); return moduledata->errormessage; } G_MODULE_EXPORT gboolean mmgui_module_device_connection_open(gpointer mmguicore, mmguidevice_t device) { mmguicore_t mmguicorelc; moduledata_t moduledata; GError *error; GVariant *nmdevices; GVariantIter nmdeviterl1, nmdeviterl2; GVariant *nmdevnodel1, *nmdevnodel2; gsize strlength; const gchar *valuestr; GDBusProxy *nmdevproxy; GVariant *devproperties; const gchar *nmdevpath, *nmactconnpath; guint nmdevtype; if ((mmguicore == NULL) || (device == NULL)) return FALSE; mmguicorelc = (mmguicore_t)mmguicore; if (mmguicorelc->cmoduledata == NULL) return FALSE; moduledata = (moduledata_t)mmguicorelc->cmoduledata; if (device == NULL) return FALSE; if (device->objectpath == NULL) return FALSE; error = NULL; //First time just set it to NULL moduledata->nmdevpath = NULL; //Network Manager interface if (moduledata->nmproxy != NULL) { nmdevices = g_dbus_proxy_call_sync(moduledata->nmproxy, "GetDevices", NULL, 0, -1, NULL, &error); if ((nmdevices != NULL) && (error == NULL)) { g_variant_iter_init(&nmdeviterl1, nmdevices); while ((nmdevnodel1 = g_variant_iter_next_value(&nmdeviterl1)) != NULL) { g_variant_iter_init(&nmdeviterl2, nmdevnodel1); while ((nmdevnodel2 = g_variant_iter_next_value(&nmdeviterl2)) != NULL) { //Device path strlength = 256; valuestr = g_variant_get_string(nmdevnodel2, &strlength); //Device proxy error = NULL; nmdevproxy = g_dbus_proxy_new_sync(moduledata->connection, G_DBUS_PROXY_FLAGS_NONE, NULL, "org.freedesktop.NetworkManager", valuestr, "org.freedesktop.NetworkManager.Device", NULL, &error); if ((nmdevproxy != NULL) && (error == NULL)) { /*Device path*/ devproperties = g_dbus_proxy_get_cached_property(nmdevproxy, "Udi"); if (devproperties != NULL) { strlength = 256; nmdevpath = g_variant_get_string(devproperties, &strlength); g_variant_unref(devproperties); } /*Device type*/ devproperties = g_dbus_proxy_get_cached_property(nmdevproxy, "DeviceType"); if (devproperties != NULL) { nmdevtype = g_variant_get_uint32(devproperties); g_variant_unref(devproperties); } /*Active connection*/ devproperties = g_dbus_proxy_get_cached_property(nmdevproxy, "ActiveConnection"); if (devproperties != NULL) { strlength = 256; nmactconnpath = g_variant_get_string(devproperties, &strlength); g_variant_unref(devproperties); } /*Is it device we looking for*/ if ((nmdevtype == MODULE_INT_DEVICE_TYPE_MODEM) && (g_str_equal(device->objectpath, nmdevpath))) { /*Cache device path*/ moduledata->nmdevpath = g_strdup(valuestr); g_object_unref(nmdevproxy); break; } else { g_object_unref(nmdevproxy); } } else { //Failed to create Network Manager device proxy mmgui_module_device_connection_get_timestamp(mmguicorelc); g_error_free(error); } g_variant_unref(nmdevnodel2); } g_variant_unref(nmdevnodel1); } g_variant_unref(nmdevices); } else { //No devices found by Network Manager mmgui_module_handle_error_message(mmguicorelc, error); g_error_free(error); } } if (moduledata->nmdevpath != NULL) { return TRUE; } else { return FALSE; } } G_MODULE_EXPORT gboolean mmgui_module_device_connection_close(gpointer mmguicore) { mmguicore_t mmguicorelc; moduledata_t moduledata; if (mmguicore == NULL) return FALSE; mmguicorelc = (mmguicore_t)mmguicore; if (mmguicorelc->cmoduledata == NULL) return FALSE; moduledata = (moduledata_t)mmguicorelc->cmoduledata; if (moduledata->nmdevpath != NULL) { g_free(moduledata->nmdevpath); moduledata->nmdevpath = NULL; } return TRUE; } G_MODULE_EXPORT gboolean mmgui_module_device_connection_status(gpointer mmguicore) { mmguicore_t mmguicorelc; moduledata_t moduledata; GError *error; GDBusProxy *nmdevproxy; GVariant *devproperty; const gchar *devinterface; guint devstate; gsize strlength; if (mmguicore == NULL) return FALSE; mmguicorelc = (mmguicore_t)mmguicore; if (mmguicorelc->moduledata == NULL) return FALSE; moduledata = (moduledata_t)mmguicorelc->cmoduledata; if (mmguicorelc->device == NULL) return FALSE; if (moduledata->nmdevpath == NULL) return FALSE; error = NULL; //Device proxy nmdevproxy = g_dbus_proxy_new_sync(moduledata->connection, G_DBUS_PROXY_FLAGS_NONE, NULL, "org.freedesktop.NetworkManager", moduledata->nmdevpath, "org.freedesktop.NetworkManager.Device", NULL, &error); if ((nmdevproxy != NULL) && (error == NULL)) { devproperty = g_dbus_proxy_get_cached_property(nmdevproxy, "State"); devstate = g_variant_get_uint32(devproperty); g_variant_unref(devproperty); //If device connected, get interface name if (devstate == MODULE_INT_DEVICE_STATE_ACTIVATED) { devproperty = g_dbus_proxy_get_cached_property(nmdevproxy, "IpInterface"); strlength = 256; devinterface = g_variant_get_string(devproperty, &strlength); memset(mmguicorelc->device->interface, 0, IFNAMSIZ); strncpy(mmguicorelc->device->interface, devinterface, IFNAMSIZ); mmguicorelc->device->connected = TRUE; g_variant_unref(devproperty); } else { memset(mmguicorelc->device->interface, 0, IFNAMSIZ); mmguicorelc->device->connected = FALSE; } g_object_unref(nmdevproxy); } else { mmgui_module_handle_error_message(mmguicorelc, error); g_error_free(error); } return TRUE; } G_MODULE_EXPORT guint64 mmgui_module_device_connection_timestamp(gpointer mmguicore) { mmguicore_t mmguicorelc; moduledata_t moduledata; GError *error; GDBusProxy *nmdevproxy; GVariant *devproperty; const gchar *devinterface; guint devstate; gsize strlength; gchar lockfilepath[128]; guint64 timestamp; struct stat statbuf; if (mmguicore == NULL) return FALSE; mmguicorelc = (mmguicore_t)mmguicore; if (mmguicorelc->moduledata == NULL) return FALSE; moduledata = (moduledata_t)mmguicorelc->cmoduledata; if (mmguicorelc->device == NULL) return FALSE; if (moduledata->nmdevpath == NULL) return FALSE; /*Get current timestamp*/ timestamp = (guint64)time(NULL); error = NULL; /*Device proxy*/ nmdevproxy = g_dbus_proxy_new_sync(moduledata->connection, G_DBUS_PROXY_FLAGS_NONE, NULL, "org.freedesktop.NetworkManager", moduledata->nmdevpath, "org.freedesktop.NetworkManager.Device", NULL, &error); if ((nmdevproxy != NULL) && (error == NULL)) { devproperty = g_dbus_proxy_get_cached_property(nmdevproxy, "State"); devstate = g_variant_get_uint32(devproperty); g_variant_unref(devproperty); /*If device connected, get interface name*/ if (devstate == MODULE_INT_DEVICE_STATE_ACTIVATED) { devproperty = g_dbus_proxy_get_cached_property(nmdevproxy, "IpInterface"); if (devproperty != NULL) { strlength = 256; devinterface = g_variant_get_string(devproperty, &strlength); /*Form lock file path*/ memset(lockfilepath, 0, sizeof(lockfilepath)); g_snprintf(lockfilepath, sizeof(lockfilepath), MODULE_INT_PPPD_LOCK_FILE_PATH, devinterface); /*Get lock file modification timestamp*/ if (stat(lockfilepath, &statbuf) == 0) { timestamp = (guint64)statbuf.st_mtime; } g_variant_unref(devproperty); } } g_object_unref(nmdevproxy); } return timestamp; } G_MODULE_EXPORT gboolean mmgui_module_device_connection_disconnect(gpointer mmguicore) { mmguicore_t mmguicorelc; moduledata_t moduledata; GError *error; GDBusProxy *nmdevproxy; if (mmguicore == NULL) return FALSE; mmguicorelc = (mmguicore_t)mmguicore; if (mmguicorelc->moduledata == NULL) return FALSE; moduledata = (moduledata_t)mmguicorelc->cmoduledata; if (mmguicorelc->device == NULL) return FALSE; if (moduledata->nmdevpath == NULL) return FALSE; //If device already disconnected, return TRUE if (!mmguicorelc->device->connected) return TRUE; error = NULL; //Device proxy nmdevproxy = g_dbus_proxy_new_sync(moduledata->connection, G_DBUS_PROXY_FLAGS_NONE, NULL, "org.freedesktop.NetworkManager", moduledata->nmdevpath, "org.freedesktop.NetworkManager.Device", NULL, &error); if ((nmdevproxy == NULL) && (error != NULL)) { mmgui_module_handle_error_message(mmguicorelc, error); g_error_free(error); return FALSE; } //Call disconnect method g_dbus_proxy_call_sync(nmdevproxy, "Disconnect", NULL, 0, -1, NULL, &error); if (error != NULL) { mmgui_module_handle_error_message(mmguicorelc, error); g_error_free(error); g_object_unref(nmdevproxy); return FALSE; } g_object_unref(nmdevproxy); //Update device state mmguicorelc->device->connected = FALSE; return TRUE; } modem-manager-gui-0.0.16/src/modules/pppd245.c000066400000000000000000000402721217271411700207020ustar00rootroot00000000000000/* * pppd245.c * * Copyright 2013 Alex * * 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 . */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include "../mmguicore.h" #define MMGUI_MODULE_SERVICE_NAME "/usr/sbin/pppd" #define MMGUI_MODULE_IDENTIFIER 245 #define MMGUI_MODULE_DESCRIPTION "pppd >= 2.4.5" //Internal definitions #define MODULE_INT_PPPD_DB_FILE_PATH_1 "/var/run/pppd2.tdb" #define MODULE_INT_PPPD_DB_FILE_PATH_2 "/var/run/ppp/pppd2.tdb" #define MODULE_INT_PPPD_LOCK_FILE_PATH "/var/run/%s.pid" #define MODULE_INT_PPPD_DB_FILE_START_PARAMETER "ORIG_UID=" #define MODULE_INT_PPPD_DB_FILE_END_PARAMETER "USEPEERDNS=" #define MODULE_INT_PPPD_DB_FILE_DEVICE_PARAMETER "DEVICE=" #define MODULE_INT_PPPD_DB_FILE_INTERFACE_PARAMETER "IFNAME=" #define MODULE_INT_PPPD_DB_FILE_PID_PARAMETER "PPPD_PID=" #define MODULE_INT_PPPD_SYSFS_DEVICE_PATH "/sys/dev/char/%u:%u" #define MODULE_INT_PPPD_SYSFS_START_PARAMETER "devices/pci" #define MODULE_INT_PPPD_SYSFS_END_PARAMETER '/' //Private module variables struct _mmguimoduledata { //Device serial gchar devserial[32]; //Connected device information gchar conndevice[256]; gchar connserial[32]; gchar connifname[IFNAMSIZ]; //pppd service pid pid_t pid; //Last error message gchar *errormessage; }; typedef struct _mmguimoduledata *moduledata_t; static void mmgui_module_handle_error_message(mmguicore_t mmguicore, gchar *message) { moduledata_t moduledata; if (mmguicore == NULL) return; moduledata = (moduledata_t)mmguicore->cmoduledata; if (moduledata == NULL) return; if (moduledata->errormessage != NULL) { g_free(moduledata->errormessage); } if (message != NULL) { moduledata->errormessage = g_strdup(message); } else { moduledata->errormessage = g_strdup("Unknown error"); } g_warning("%s: %s", MMGUI_MODULE_DESCRIPTION, moduledata->errormessage); } static gchar *mmgui_module_pppd_strrstr(gchar *source, gsize sourcelen, gchar *entry, gsize entrylen) { gboolean found; gchar *sourceptr, *curptr; gsize ind; if ((source == NULL) || (entry == NULL)) return NULL; if ((sourcelen == 0) || (entrylen == 0)) return source; sourceptr = source + sourcelen - entrylen; for (curptr=sourceptr; curptr>=source; curptr--) { found = TRUE; for (ind=0; ind (bufsize - 1)) datalen = bufsize - 1; memcpy(buffer, segstart+paramlen, datalen); buffer[datalen] = '\0'; return buffer; } static gchar *mmgui_module_pppd_get_config_string(gpointer dbmapping, gsize dbsize) { gchar *segend, *segstart; gchar *result; if ((dbmapping == NULL) || (dbsize == 0)) return NULL; segend = mmgui_module_pppd_strrstr(dbmapping, dbsize, MODULE_INT_PPPD_DB_FILE_END_PARAMETER, strlen(MODULE_INT_PPPD_DB_FILE_END_PARAMETER)); if ((segend == NULL) || ((segend != NULL) && ((*segend) >= dbsize))) return NULL; segstart = mmgui_module_pppd_strrstr(dbmapping, dbsize-(*segend), MODULE_INT_PPPD_DB_FILE_START_PARAMETER, strlen(MODULE_INT_PPPD_DB_FILE_START_PARAMETER)); if ((segstart == NULL) || ((segstart != NULL) && (segend <= segstart))) return NULL; result = g_malloc0(segend-segstart+1); if (result == NULL) return NULL; memcpy(result, segstart, segend-segstart); return result; } static gchar *mmgui_module_pppd_get_device_serial(gchar *string, gchar *buffer, gsize bufsize) { gchar *segend, *segstart; gsize datalen, paramlen; if ((string == NULL) || (buffer == NULL) || (bufsize == 0)) return NULL; paramlen = strlen(MODULE_INT_PPPD_SYSFS_START_PARAMETER); segstart = strstr(string, MODULE_INT_PPPD_SYSFS_START_PARAMETER); if (segstart == NULL) return NULL; segstart = strchr(segstart + paramlen, MODULE_INT_PPPD_SYSFS_END_PARAMETER); if (segstart == NULL) return NULL; segend = strchr(segstart+paramlen, MODULE_INT_PPPD_SYSFS_END_PARAMETER); if (segend == NULL) return NULL; datalen = segend - segstart - 1; if (datalen > (bufsize - 1)) datalen = bufsize - 1; memcpy(buffer, segstart + 1, datalen); buffer[datalen] = '\0'; return buffer; } static gboolean mmgui_module_pppd_get_daemon_running(moduledata_t moduledata) { gchar pidfilepath[32], pidfiledata[32]; gint pidfilefd, status; struct flock pidfilelock; if (moduledata == NULL) return FALSE; if (moduledata->connifname[0] == '\0') return FALSE; memset(pidfilepath, 0, sizeof(pidfilepath)); memset(pidfiledata, 0, sizeof(pidfiledata)); snprintf(pidfilepath, sizeof(pidfilepath), MODULE_INT_PPPD_LOCK_FILE_PATH, moduledata->connifname); pidfilefd = open(pidfilepath, O_RDONLY); if (pidfilefd == -1) return FALSE; status = read(pidfilefd, pidfiledata, sizeof(pidfiledata)); close(pidfilefd); if ((status != -1) && ((pid_t)atoi(pidfiledata) == moduledata->pid)) { return TRUE; } else { return FALSE; } } static void mmgui_module_pppd_set_connection_status(gpointer mmguicore, gboolean connected) { mmguicore_t mmguicorelc; moduledata_t moduledata; if (mmguicore == NULL) return; mmguicorelc = (mmguicore_t)mmguicore; if (mmguicorelc->moduledata == NULL) return; moduledata = (moduledata_t)mmguicorelc->cmoduledata; if (mmguicorelc->device == NULL) return; if (connected) { memset(mmguicorelc->device->interface, 0, IFNAMSIZ); strncpy(mmguicorelc->device->interface, moduledata->connifname, IFNAMSIZ); mmguicorelc->device->connected = TRUE; } else { memset(mmguicorelc->device->interface, 0, IFNAMSIZ); mmguicorelc->device->connected = FALSE; } } G_MODULE_EXPORT gboolean mmgui_module_init(mmguimodule_t module) { if (module == NULL) return FALSE; module->type = MMGUI_MODULE_TYPE_CONNECTION_MANGER; module->requirement = MMGUI_MODULE_REQUIREMENT_FILE; module->priority = MMGUI_MODULE_PRIORITY_LOW; module->identifier = MMGUI_MODULE_IDENTIFIER; module->functions = MMGUI_MODULE_FUNCTION_BASIC; g_snprintf(module->servicename, sizeof(module->servicename), MMGUI_MODULE_SERVICE_NAME); g_snprintf(module->description, sizeof(module->description), MMGUI_MODULE_DESCRIPTION); return TRUE; } G_MODULE_EXPORT gboolean mmgui_module_connection_open(gpointer mmguicore) { mmguicore_t mmguicorelc; moduledata_t *moduledata; if (mmguicore == NULL) return FALSE; mmguicorelc = (mmguicore_t)mmguicore; moduledata = (moduledata_t *)&mmguicorelc->cmoduledata; (*moduledata) = g_new0(struct _mmguimoduledata, 1); (*moduledata)->errormessage = NULL; return TRUE; } G_MODULE_EXPORT gboolean mmgui_module_connection_close(gpointer mmguicore) { mmguicore_t mmguicorelc; moduledata_t moduledata; if (mmguicore == NULL) return FALSE; mmguicorelc = (mmguicore_t)mmguicore; moduledata = (moduledata_t)(mmguicorelc->cmoduledata); if (moduledata != NULL) { if (moduledata->errormessage != NULL) { g_free(moduledata->errormessage); } g_free(moduledata); } return TRUE; } G_MODULE_EXPORT gchar *mmgui_module_connection_last_error(gpointer mmguicore) { mmguicore_t mmguicorelc; moduledata_t moduledata; if (mmguicore == NULL) return NULL; mmguicorelc = (mmguicore_t)mmguicore; moduledata = (moduledata_t)(mmguicorelc->cmoduledata); return moduledata->errormessage; } G_MODULE_EXPORT gboolean mmgui_module_device_connection_open(gpointer mmguicore, mmguidevice_t device) { mmguicore_t mmguicorelc; moduledata_t moduledata; if ((mmguicore == NULL) || (device == NULL)) return FALSE; mmguicorelc = (mmguicore_t)mmguicore; if (mmguicorelc->cmoduledata == NULL) return FALSE; moduledata = (moduledata_t)mmguicorelc->cmoduledata; if (device->sysfspath == NULL) { mmgui_module_handle_error_message(mmguicorelc, "Device data not available"); return FALSE; } if (mmgui_module_pppd_get_device_serial(device->sysfspath, moduledata->devserial, sizeof(moduledata->devserial)) == NULL) { mmgui_module_handle_error_message(mmguicorelc, "Device serial not available"); return FALSE; } return TRUE; } G_MODULE_EXPORT gboolean mmgui_module_device_connection_close(gpointer mmguicore) { mmguicore_t mmguicorelc; moduledata_t moduledata; if (mmguicore == NULL) return FALSE; mmguicorelc = (mmguicore_t)mmguicore; if (mmguicorelc->moduledata == NULL) return FALSE; moduledata = (moduledata_t)mmguicorelc->cmoduledata; memset(moduledata->devserial, 0, sizeof(moduledata->devserial)); return TRUE; } G_MODULE_EXPORT gboolean mmgui_module_device_connection_status(gpointer mmguicore) { mmguicore_t mmguicorelc; moduledata_t moduledata; gint dbfd, state; struct stat statbuf; gpointer dbmapping; gchar *pppdconfig; gchar intbuf[16], sysfspath[128], sysfslink[128]; gchar *parameter; gint status, devmajor, devminor; if (mmguicore == NULL) return FALSE; mmguicorelc = (mmguicore_t)mmguicore; if (mmguicorelc->moduledata == NULL) return FALSE; moduledata = (moduledata_t)mmguicorelc->cmoduledata; if (mmguicorelc->device == NULL) return FALSE; if (moduledata->devserial[0] == '\0') return FALSE; /*Usual PPPD database path*/ dbfd = open(MODULE_INT_PPPD_DB_FILE_PATH_1, O_RDONLY); /*Try special path first*/ if (dbfd == -1) { /*Special PPPD database path (Fedora uses it)*/ dbfd = open(MODULE_INT_PPPD_DB_FILE_PATH_2, O_RDONLY); /*No database found*/ if (dbfd == -1) { mmgui_module_pppd_set_connection_status(mmguicore, FALSE); g_debug("Failed to open PPPD database file\n"); return TRUE; } } state = fstat(dbfd, &statbuf); if (state == -1) { mmgui_module_pppd_set_connection_status(mmguicore, FALSE); g_debug("Failed to get PPPD database file size\n"); close(dbfd); return TRUE; } dbmapping = mmap(0, statbuf.st_size, PROT_READ, MAP_SHARED, dbfd, 0); if(dbmapping == (void *)-1) { mmgui_module_pppd_set_connection_status(mmguicore, FALSE); mmgui_module_handle_error_message(mmguicorelc, "Failed to map PPPD database file into memory"); close(dbfd); return TRUE; } pppdconfig = mmgui_module_pppd_get_config_string(dbmapping, statbuf.st_size); if (pppdconfig == NULL) { mmgui_module_pppd_set_connection_status(mmguicore, FALSE); mmgui_module_handle_error_message(mmguicorelc, "Failed to get config"); munmap(dbmapping, statbuf.st_size); close(dbfd); return TRUE; } munmap(dbmapping, statbuf.st_size); close(dbfd); parameter = mmgui_module_pppd_get_config_fragment(pppdconfig, MODULE_INT_PPPD_DB_FILE_DEVICE_PARAMETER, moduledata->conndevice, sizeof(moduledata->conndevice)); if (parameter == NULL) { mmgui_module_pppd_set_connection_status(mmguicore, FALSE); g_debug("Device entry not found in PPPD database\n"); g_free(pppdconfig); return TRUE; } parameter = mmgui_module_pppd_get_config_fragment(pppdconfig, MODULE_INT_PPPD_DB_FILE_INTERFACE_PARAMETER, moduledata->connifname, sizeof(moduledata->connifname)); if (parameter == NULL) { mmgui_module_pppd_set_connection_status(mmguicore, FALSE); g_debug("Interface entry not found in PPPD database\n"); g_free(pppdconfig); return TRUE; } parameter = mmgui_module_pppd_get_config_fragment(pppdconfig, MODULE_INT_PPPD_DB_FILE_PID_PARAMETER, intbuf, sizeof(intbuf)); if (parameter == NULL) { mmgui_module_pppd_set_connection_status(mmguicore, FALSE); g_debug("PPPD pid not found in PPPD database\n"); g_free(pppdconfig); return TRUE; } else { moduledata->pid = (pid_t)atoi(parameter); } g_free(pppdconfig); if (!mmgui_module_pppd_get_daemon_running(moduledata)) { mmgui_module_pppd_set_connection_status(mmguicore, FALSE); g_debug("PPPD daemon is not running\n"); return TRUE; } status = stat(moduledata->conndevice, &statbuf); if ((status == -1) || ((status == 0) && (!S_ISCHR(statbuf.st_mode)))) { mmgui_module_pppd_set_connection_status(mmguicore, FALSE); g_debug("Device not suitable\n"); return TRUE; } devmajor = major(statbuf.st_rdev); devminor = minor(statbuf.st_rdev); memset(sysfspath, 0, sizeof(sysfspath)); memset(sysfslink, 0, sizeof(sysfslink)); snprintf(sysfspath, sizeof(sysfspath), MODULE_INT_PPPD_SYSFS_DEVICE_PATH, devmajor, devminor); status = readlink((const char *)sysfspath, sysfslink, sizeof(sysfslink)); if (status == -1) { mmgui_module_pppd_set_connection_status(mmguicore, FALSE); mmgui_module_handle_error_message(mmguicorelc, "Device sysfs path not available"); return TRUE; } sysfslink[status] = '\0'; if (mmgui_module_pppd_get_device_serial(sysfslink, moduledata->connserial, sizeof(moduledata->connserial)) == NULL) { mmgui_module_pppd_set_connection_status(mmguicore, FALSE); mmgui_module_handle_error_message(mmguicorelc, "Device serial not available"); return TRUE; } if (g_str_equal(moduledata->connserial, moduledata->devserial)) { mmgui_module_pppd_set_connection_status(mmguicore, TRUE); } else { mmgui_module_pppd_set_connection_status(mmguicore, FALSE); } return TRUE; } G_MODULE_EXPORT guint64 mmgui_module_device_connection_timestamp(gpointer mmguicore) { mmguicore_t mmguicorelc; moduledata_t moduledata; gchar lockfilepath[128]; guint64 timestamp; struct stat statbuf; if (mmguicore == NULL) return FALSE; mmguicorelc = (mmguicore_t)mmguicore; if (mmguicorelc->moduledata == NULL) return FALSE; moduledata = (moduledata_t)mmguicorelc->cmoduledata; if (mmguicorelc->device == NULL) return FALSE; /*Get current timestamp*/ timestamp = (guint64)time(NULL); /*Form lock file path*/ memset(lockfilepath, 0, sizeof(lockfilepath)); g_snprintf(lockfilepath, sizeof(lockfilepath), MODULE_INT_PPPD_LOCK_FILE_PATH, mmguicorelc->device->interface); /*Get lock file modification timestamp*/ if (stat(lockfilepath, &statbuf) == 0) { timestamp = (guint64)statbuf.st_mtime; } return timestamp; } G_MODULE_EXPORT gboolean mmgui_module_device_connection_disconnect(gpointer mmguicore) { mmguicore_t mmguicorelc; moduledata_t moduledata; GError *error; gchar *stderrdata = NULL; gint exitstatus = 0; gchar *argv[3] = {"/sbin/ifdown", NULL, NULL}; if (mmguicore == NULL) return FALSE; mmguicorelc = (mmguicore_t)mmguicore; if (mmguicorelc->moduledata == NULL) return FALSE; moduledata = (moduledata_t)mmguicorelc->cmoduledata; if (mmguicorelc->device == NULL) return FALSE; if (moduledata->devserial[0] == '\0') return FALSE; //If device already disconnected, return TRUE if (!mmguicorelc->device->connected) return TRUE; error = NULL; argv[1] = mmguicorelc->device->interface; if(g_spawn_sync(NULL, argv, NULL, G_SPAWN_STDOUT_TO_DEV_NULL, NULL, NULL, NULL, &stderrdata, &exitstatus, &error)) { //Disconnected - update device state memset(mmguicorelc->device->interface, 0, sizeof(mmguicorelc->device->interface)); mmguicorelc->device->connected = FALSE; return TRUE; } else { //Failed to disconnect if (error != NULL) { mmgui_module_handle_error_message(mmguicorelc, error->message); g_error_free(error); } else if (stderrdata != NULL) { mmgui_module_handle_error_message(mmguicorelc, stderrdata); g_free(stderrdata); } return FALSE; } } modem-manager-gui-0.0.16/src/netlink.c000066400000000000000000000427031217271411700175010ustar00rootroot00000000000000/* * netlink.c * * Copyright 2012-2013 Alex * * 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 . */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "netlink.h" #define MMGUI_NETLINK_INTERNAL_SEQUENCE_NUMBER 100000 static gboolean mmgui_netlink_numeric_name(gchar *dirname) { if ((dirname == NULL) || (!*dirname)) return FALSE; while (*dirname) { if (!isdigit(*dirname)) { return FALSE; } else { *dirname++; } } return TRUE; } static gboolean mmgui_netlink_process_access(gchar *dirname, uid_t uid) { gchar fullpath[128]; struct stat pathstat; if (!mmgui_netlink_numeric_name(dirname)) return FALSE; memset(fullpath, 0, sizeof(fullpath)); sprintf(fullpath, "/proc/%s", dirname); if (stat(fullpath, &pathstat) == -1) { return FALSE; } if (pathstat.st_uid != uid) { return FALSE; } return TRUE; } static gboolean mmgui_netlink_socket_access(gchar *dirname, gchar *sockname, guint inode) { gchar fullpath[128]; struct stat fdstat; if (!mmgui_netlink_numeric_name(sockname)) return FALSE; memset(fullpath, 0, sizeof(fullpath)); sprintf(fullpath, "/proc/%s/fd/%s", dirname, sockname); if (stat(fullpath, &fdstat) == -1) { return FALSE; } if (((fdstat.st_mode & S_IFMT) == S_IFSOCK) && (fdstat.st_ino == inode)) { return TRUE; } return FALSE; } static gchar *mmgui_netlink_process_name(gchar *dirname, gchar *appname, gsize appsize) { gint fd, i; gchar fpath[128]; ssize_t linkchars; if ((dirname == NULL) || (dirname[0] == '\0')) return NULL; if ((appname == NULL) || (appsize == 0)) return NULL; memset(fpath, 0, sizeof(fpath)); sprintf(fpath, "/proc/%s/exe", dirname); linkchars = readlink(fpath, appname, appsize-1); if (linkchars == 0) { memset(fpath, 0, sizeof(fpath)); sprintf(fpath, "/proc/%s/comm", dirname); fd = open(fpath, O_RDONLY); if (fd != -1) { linkchars = read(fd, appname, appsize-1); close(fd); } else { return NULL; } } appname[linkchars] = '\0'; for (i=linkchars; i>=0; i--) { if (appname[i] == '/') { memmove(appname+0, appname+i+1, linkchars-i-1); linkchars -= i+1; break; } } appname[linkchars] = '\0'; return appname; } static gboolean mmgui_netlink_get_process(guint inode, gchar *appname, gsize namesize, pid_t *apppid) { DIR *procdir, *fddir; struct dirent *procde, *fdde; char fdirpath[128], fdpath[128]; if ((appname == NULL) || (namesize == 0) || (apppid == NULL)) return FALSE; procdir = opendir("/proc"); if (procdir != NULL) { while (procde = readdir(procdir)) { if (mmgui_netlink_process_access(procde->d_name, getuid())) { memset(fdirpath, 0, sizeof(fdirpath)); sprintf(fdirpath, "/proc/%s/fd", procde->d_name); //enumerate file descriptors fddir = opendir(fdirpath); if (fddir != NULL) { while (fdde = readdir(fddir)) { if (mmgui_netlink_socket_access(procde->d_name, fdde->d_name, inode)) { //printf("%s:%s (%s)\n", procde->d_name, fdde->d_name, nlconnections_process_name(procde->d_name, appname, sizeof(appname))); *apppid = atoi(procde->d_name); mmgui_netlink_process_name(procde->d_name, appname, namesize); closedir(fddir); closedir(procdir); return TRUE; } } closedir(fddir); } } } closedir(procdir); } return FALSE; } gboolean mmgui_netlink_terminate_application(pid_t pid) { if (kill(pid, 0) == 0) { if (kill(pid, SIGTERM) == 0) { return TRUE; } } return FALSE; } gchar *mmgui_netlink_socket_state(guchar state) { switch (state) { case TCP_ESTABLISHED: return "Established"; case TCP_SYN_SENT: return "SYN sent"; case TCP_SYN_RECV: return "SYN recv"; case TCP_FIN_WAIT1: return "FIN wait"; case TCP_FIN_WAIT2: return "FIN wait"; case TCP_TIME_WAIT: return "Time wait"; case TCP_CLOSE: return "Close"; case TCP_CLOSE_WAIT: return "Close wait"; case TCP_LAST_ACK: return "Last ACK"; case TCP_LISTEN: return "Listen"; case TCP_CLOSING: return "Closing"; default: return "Unknown"; } } void mmgui_netlink_hash_destroy(gpointer data) { mmgui_netlink_connection_t connection; connection = (mmgui_netlink_connection_t)data; if (connection == NULL) return; if (connection->appname != NULL) g_free(connection->appname); if (connection->dsthostname != NULL) g_free(connection->dsthostname); g_free(connection); } static gboolean mmgui_netlink_hash_clear_foreach(gpointer key, gpointer value, gpointer user_data) { mmgui_netlink_connection_t connection; time_t currenttime; connection = (mmgui_netlink_connection_t)value; currenttime = *(time_t *)user_data; if (connection->updatetime == currenttime) { return FALSE; } else { //printf("Remove: %u\n", socket->inode); return TRUE; } } gboolean mmgui_netlink_request_connections_list(mmgui_netlink_t netlink, guint family) { struct _mmgui_netlink_connection_info_request request; gint status; if ((netlink == NULL) || ((!(family & AF_INET)) && (!(family & AF_INET6)))) return FALSE; memset(&request.msgheader, 0, sizeof(struct nlmsghdr)); request.msgheader.nlmsg_len = sizeof(struct _mmgui_netlink_connection_info_request); request.msgheader.nlmsg_type = TCPDIAG_GETSOCK; request.msgheader.nlmsg_flags = NLM_F_REQUEST | NLM_F_ROOT; request.msgheader.nlmsg_pid = getpid(); request.msgheader.nlmsg_seq = 0; memset(&request.nlreq, 0, sizeof(struct inet_diag_req)); request.nlreq.idiag_family = family; request.nlreq.idiag_states = ((1 << TCP_CLOSING + 1) - 1); request.msgheader.nlmsg_len = NLMSG_ALIGN(request.msgheader.nlmsg_len); status = send(netlink->connsocketfd, &request, request.msgheader.nlmsg_len, 0); if (status != -1) { return TRUE; } else { return FALSE; } } gboolean mmgui_netlink_read_connections_list(mmgui_netlink_t netlink, gchar *data, gsize datasize) { time_t currenttime; struct nlmsghdr *msgheader; struct inet_diag_msg *entry; mmgui_netlink_connection_t connection; struct hostent *dsthost; gchar srcbuf[INET6_ADDRSTRLEN]; gchar dstbuf[INET6_ADDRSTRLEN]; gchar appname[1024]; pid_t apppid; if ((netlink == NULL) || (data == NULL) || (datasize == 0)) return FALSE; //Get current time currenttime = time(NULL); //Work with data for (msgheader = (struct nlmsghdr *)data; NLMSG_OK(msgheader, (unsigned int)datasize); msgheader = NLMSG_NEXT(msgheader, datasize)) { if ((msgheader->nlmsg_type == NLMSG_ERROR) || (msgheader->nlmsg_type == NLMSG_DONE)) { break; } //New connections list if (msgheader->nlmsg_type == TCPDIAG_GETSOCK) { entry = (struct inet_diag_msg *)NLMSG_DATA(msgheader); if (entry != NULL) { if ((entry->idiag_uid == netlink->userid) || (netlink->userid == 0)) { if (!g_hash_table_contains(netlink->connections, (gconstpointer)&entry->idiag_inode)) { //Add new connection if (mmgui_netlink_get_process(entry->idiag_inode, appname, sizeof(appname), &apppid)) { connection = g_new(struct _mmgui_netlink_connection, 1); connection->inode = entry->idiag_inode; connection->family = entry->idiag_family; connection->userid = entry->idiag_uid; connection->updatetime = currenttime; connection->dqueue = entry->idiag_rqueue + entry->idiag_wqueue; connection->state = entry->idiag_state; connection->srcport = ntohs(entry->id.idiag_sport); g_snprintf(connection->srcaddr, sizeof(connection->srcaddr), "%s:%u", inet_ntop(entry->idiag_family, entry->id.idiag_src, srcbuf, INET6_ADDRSTRLEN), ntohs(entry->id.idiag_sport)); g_snprintf(connection->dstaddr, sizeof(connection->dstaddr), "%s:%u", inet_ntop(entry->idiag_family, entry->id.idiag_dst, dstbuf, INET6_ADDRSTRLEN), ntohs(entry->id.idiag_dport)); connection->appname = g_strdup(appname); connection->apppid = apppid; connection->dsthostname = NULL; /*dsthost = gethostbyaddr(entry->id.idiag_dst, sizeof(entry->id.idiag_dst), entry->idiag_family); if (dsthost != NULL) { connection->dsthostname = g_strdup(dsthost->h_name); } else {*/ connection->dsthostname = g_strdup(connection->dstaddr); /*}*/ g_hash_table_insert(netlink->connections, (gpointer)&connection->inode, connection); g_debug("Connection added: inode %u\n", entry->idiag_inode); } } else { //Update connection information (state, buffers fill, time) connection = g_hash_table_lookup(netlink->connections, (gconstpointer)&entry->idiag_inode); if (connection != NULL) { connection->updatetime = currenttime; connection->dqueue = entry->idiag_rqueue + entry->idiag_wqueue; connection->state = entry->idiag_state; g_debug("Connection updated: inode %u\n", entry->idiag_inode); } } } } } } //Remove connections that disappear g_hash_table_foreach_remove(netlink->connections, mmgui_netlink_hash_clear_foreach, ¤ttime); return TRUE; } gboolean mmgui_netlink_request_interface_statistics(mmgui_netlink_t netlink, gchar *interface) { struct _mmgui_netlink_interface_info_request request; guint ifindex; gint status; if ((netlink == NULL) || (interface == NULL)) return FALSE; if ((netlink->intsocketfd == -1) || (interface[0] == '\0')) return FALSE; ifindex = if_nametoindex(interface); if ((ifindex == 0) && (errno == ENXIO)) return FALSE; memset(&request, 0, sizeof(request)); request.msgheader.nlmsg_len = NLMSG_LENGTH(sizeof(struct ifinfomsg)); request.msgheader.nlmsg_type = RTM_GETLINK; request.msgheader.nlmsg_flags = NLM_F_REQUEST; request.msgheader.nlmsg_seq = MMGUI_NETLINK_INTERNAL_SEQUENCE_NUMBER; request.msgheader.nlmsg_pid = getpid(); request.ifinfo.ifi_family = AF_UNSPEC; request.ifinfo.ifi_index = ifindex; request.ifinfo.ifi_type = 0; request.ifinfo.ifi_flags = 0; request.ifinfo.ifi_change = 0xFFFFFFFF; request.msgheader.nlmsg_len = NLMSG_ALIGN(request.msgheader.nlmsg_len); status = send(netlink->intsocketfd, &request, request.msgheader.nlmsg_len, 0); if (status != -1) { return TRUE; } else { return FALSE; } } gboolean mmgui_netlink_read_interface_event(mmgui_netlink_t netlink, gchar *data, gsize datasize, mmgui_netlink_interface_event_t event) { struct nlmsghdr *msgheader; struct ifinfomsg *ifi; struct rtattr *rta; struct rtnl_link_stats *ifstats; struct rtnl_link_stats64 *ifstats64; gchar ifname[IFNAMSIZ]; gboolean have64bitstats; if ((netlink == NULL) || (data == NULL) || (datasize == 0) || (event == NULL)) return FALSE; //Work with data for (msgheader = (struct nlmsghdr *)data; NLMSG_OK(msgheader, (unsigned int)datasize); msgheader = NLMSG_NEXT(msgheader, datasize)) { if ((msgheader->nlmsg_type == NLMSG_ERROR) || (msgheader->nlmsg_type == NLMSG_DONE)) { break; } //New event if ((msgheader->nlmsg_type == RTM_NEWLINK) || (msgheader->nlmsg_type == RTM_DELLINK) || (msgheader->nlmsg_type == RTM_GETLINK)) { ifi = NLMSG_DATA(msgheader); rta = IFLA_RTA(ifi); //Copy valuable data first event->running = (ifi->ifi_flags & IFF_RUNNING); event->up = (ifi->ifi_flags & IFF_UP); if (if_indextoname(ifi->ifi_index, ifname) != NULL) { strncpy(event->ifname, ifname, sizeof(event->ifname)); } event->type = MMGUI_NETLINK_INTERFACE_EVENT_TYPE_UNKNOWN; //Detrmine type of event if (msgheader->nlmsg_seq == MMGUI_NETLINK_INTERNAL_SEQUENCE_NUMBER) { event->type = MMGUI_NETLINK_INTERFACE_EVENT_TYPE_STATS; } else { if (msgheader->nlmsg_type == RTM_NEWLINK) { event->type = MMGUI_NETLINK_INTERFACE_EVENT_TYPE_ADD; g_debug("[%u] New interface state: Running: %s, Up: %s, Name: %s\n", msgheader->nlmsg_seq, (ifi->ifi_flags & IFF_RUNNING) ? "Yes" : "No", (ifi->ifi_flags & IFF_UP) ? "Yes" : "No", if_indextoname(ifi->ifi_index, ifname)); } else if (msgheader->nlmsg_type == RTM_DELLINK) { event->type = MMGUI_NETLINK_INTERFACE_EVENT_TYPE_REMOVE; g_debug("[%u] Deleted interface state: Running: %s, Up: %s, Name: %s\n", msgheader->nlmsg_seq, (ifi->ifi_flags & IFF_RUNNING) ? "Yes" : "No", (ifi->ifi_flags & IFF_UP) ? "Yes" : "No", if_indextoname(ifi->ifi_index, ifname)); } else if (msgheader->nlmsg_type == RTM_GETLINK) { event->type = MMGUI_NETLINK_INTERFACE_EVENT_TYPE_STATS; g_debug("[%u] Requested interface state: Running: %s, Up: %s, Name: %s\n", msgheader->nlmsg_seq, (ifi->ifi_flags & IFF_RUNNING) ? "Yes" : "No", (ifi->ifi_flags & IFF_UP) ? "Yes" : "No", if_indextoname(ifi->ifi_index, ifname)); } } //If 64bit traffic statistics values are not available, 32bit values will be used anyway have64bitstats = FALSE; //Use tags to get additional data while (RTA_OK(rta, msgheader->nlmsg_len)) { if (rta->rta_type == IFLA_IFNAME) { strncpy(event->ifname, (char *)RTA_DATA(rta), sizeof(event->ifname)); g_debug("Tag: Device name: %s\n", (char *)RTA_DATA(rta)); } else if (rta->rta_type == IFLA_STATS) { ifstats = (struct rtnl_link_stats *)RTA_DATA(rta); if (!have64bitstats) { event->rxbytes = ifstats->rx_bytes; event->txbytes = ifstats->tx_bytes; if (!(event->type & MMGUI_NETLINK_INTERFACE_EVENT_TYPE_STATS)) { event->type |= MMGUI_NETLINK_INTERFACE_EVENT_TYPE_STATS; } } g_debug("Tag: Interface Statistics (32bit): RX: %u, TX: %u\n", ifstats->rx_bytes, ifstats->tx_bytes); } else if (rta->rta_type == IFLA_STATS64) { ifstats64 = (struct rtnl_link_stats64 *)RTA_DATA(rta); event->rxbytes = ifstats64->rx_bytes; event->txbytes = ifstats64->tx_bytes; have64bitstats = TRUE; if (!(event->type & MMGUI_NETLINK_INTERFACE_EVENT_TYPE_STATS)) { event->type |= MMGUI_NETLINK_INTERFACE_EVENT_TYPE_STATS; } g_debug("Tag: Interface Statistics (64bit): RX: %llu, TX: %llu\n", ifstats64->rx_bytes, ifstats64->tx_bytes); } else if (rta->rta_type == IFLA_LINK) { g_debug("Tag: Link type\n"); } else if (rta->rta_type == IFLA_ADDRESS) { g_debug("Tag: interface L2 address\n"); } else if (rta->rta_type == IFLA_UNSPEC) { g_debug("Tag: unspecified\n"); } else { g_debug("Tag: %u\n", rta->rta_type); } rta = RTA_NEXT(rta, msgheader->nlmsg_len); } } } return TRUE; } gint mmgui_netlink_get_connections_monitoring_socket_fd(mmgui_netlink_t netlink) { if (netlink == NULL) return -1; return netlink->connsocketfd; } gint mmgui_netlink_get_interfaces_monitoring_socket_fd(mmgui_netlink_t netlink) { if (netlink == NULL) return -1; return netlink->intsocketfd; } struct sockaddr_nl *mmgui_netlink_get_connections_monitoring_socket_address(mmgui_netlink_t netlink) { if (netlink == NULL) return NULL; return &(netlink->connaddr); } struct sockaddr_nl *mmgui_netlink_get_interfaces_monitoring_socket_address(mmgui_netlink_t netlink) { if (netlink == NULL) return NULL; return &(netlink->intaddr); } GHashTable *mmgui_netlink_get_connections_list(mmgui_netlink_t netlink) { if (netlink == NULL) return NULL; return netlink->connections; } void mmgui_netlink_close(mmgui_netlink_t netlink) { if (netlink == NULL) return; if (netlink->connsocketfd != -1) { close(netlink->connsocketfd); g_hash_table_destroy(netlink->connections); } if (netlink->intsocketfd != -1) { close(netlink->intsocketfd); } g_free(netlink); } mmgui_netlink_t mmgui_netlink_open(void) { mmgui_netlink_t netlink; netlink = g_new(struct _mmgui_netlink, 1); #ifndef NETLINK_SOCK_DIAG netlink->connsocketfd = socket(AF_NETLINK, SOCK_RAW, NETLINK_INET_DIAG); #else netlink->connsocketfd = socket(AF_NETLINK, SOCK_RAW, NETLINK_SOCK_DIAG); #endif if (netlink->connsocketfd != -1) { memset(&netlink->connaddr, 0, sizeof(struct sockaddr_nl)); netlink->connaddr.nl_family = AF_NETLINK; netlink->connaddr.nl_pid = getpid(); netlink->connaddr.nl_groups = 0; netlink->userid = getuid(); netlink->connections = g_hash_table_new_full(g_int_hash, g_int_equal, NULL, (GDestroyNotify)mmgui_netlink_hash_destroy); } else { netlink->connections = NULL; g_debug("Failed to open connections monitoring netlink socket\n"); } netlink->intsocketfd = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE); if (netlink->intsocketfd != -1) { memset(&netlink->intaddr, 0, sizeof(netlink->intaddr)); netlink->intaddr.nl_family = AF_NETLINK; netlink->intaddr.nl_groups = RTMGRP_LINK; netlink->intaddr.nl_pid = getpid(); if (bind(netlink->intsocketfd, (struct sockaddr *)&(netlink->intaddr), sizeof(netlink->intaddr)) == -1) { g_debug("Failed to bind network interfaces monitoring netlink socket\n"); close(netlink->intsocketfd); netlink->intsocketfd = -1; } } else { g_debug("Failed to open network interfaces monitoring netlink socket\n"); } return netlink; } modem-manager-gui-0.0.16/src/netlink.h000066400000000000000000000065271217271411700175120ustar00rootroot00000000000000/* * netlink.h * * Copyright 2012-2013 Alex * * 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 . */ #ifndef __NETLINK_H__ #define __NETLINK_H__ #include #include #include #include #include #include enum _mmgui_netlink_interface_event_type { MMGUI_NETLINK_INTERFACE_EVENT_TYPE_UNKNOWN = 0, MMGUI_NETLINK_INTERFACE_EVENT_TYPE_ADD = 1 << 0, MMGUI_NETLINK_INTERFACE_EVENT_TYPE_REMOVE = 1 << 1, MMGUI_NETLINK_INTERFACE_EVENT_TYPE_STATS = 1 << 2, }; struct _mmgui_netlink_connection { guint inode; guint dqueue; uid_t userid; time_t updatetime; pid_t apppid; gchar *appname; gchar *dsthostname; gchar srcaddr[INET6_ADDRSTRLEN + 8]; gchar dstaddr[INET6_ADDRSTRLEN + 8]; gushort srcport; guchar state; guchar family; }; typedef struct _mmgui_netlink_connection *mmgui_netlink_connection_t; struct _mmgui_netlink_connection_info_request { struct nlmsghdr msgheader; struct inet_diag_req nlreq; }; struct _mmgui_netlink_interface_info_request { struct nlmsghdr msgheader; struct ifinfomsg ifinfo; }; struct _mmgui_netlink_interface_event { enum _mmgui_netlink_interface_event_type type; gchar ifname[IFNAMSIZ]; gboolean running; gboolean up; guint64 rxbytes; guint64 txbytes; }; typedef struct _mmgui_netlink_interface_event *mmgui_netlink_interface_event_t; struct _mmgui_netlink { //Connections monitoring gint connsocketfd; pid_t userid; GHashTable *connections; struct sockaddr_nl connaddr; //Network interfaces monitoring gint intsocketfd; struct sockaddr_nl intaddr; }; typedef struct _mmgui_netlink *mmgui_netlink_t; gboolean mmgui_netlink_terminate_application(pid_t pid); gchar *mmgui_netlink_socket_state(guchar state); gboolean mmgui_netlink_update(mmgui_netlink_t netlink); gboolean mmgui_netlink_request_connections_list(mmgui_netlink_t netlink, guint family); gboolean mmgui_netlink_request_interface_statistics(mmgui_netlink_t netlink, gchar *interface); gboolean mmgui_netlink_read_interface_event(mmgui_netlink_t netlink, gchar *data, gsize datasize, mmgui_netlink_interface_event_t event); gint mmgui_netlink_get_connections_monitoring_socket_fd(mmgui_netlink_t netlink); gint mmgui_netlink_get_interfaces_monitoring_socket_fd(mmgui_netlink_t netlink); struct sockaddr_nl *mmgui_netlink_get_connections_monitoring_socket_address(mmgui_netlink_t netlink); struct sockaddr_nl *mmgui_netlink_get_interfaces_monitoring_socket_address(mmgui_netlink_t netlink); GHashTable *mmgui_netlink_get_connections_list(mmgui_netlink_t netlink); void mmgui_netlink_close(mmgui_netlink_t netlink); mmgui_netlink_t mmgui_netlink_open(void); #endif /* __NETLINK_H__ */ modem-manager-gui-0.0.16/src/notifications.c000066400000000000000000000201021217271411700206730ustar00rootroot00000000000000/* * notifications.c * * Copyright 2013 Alex * * 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 . */ #include #include #include #include #include #include "notifications.h" #include "resources.h" mmgui_notifications_t mmgui_notifications_new(mmgui_libpaths_cache_t libcache) { mmgui_notifications_t notifications; gboolean libopened; GtkSettings *gtksettings; gchar *gtksoundtheme; notifications = g_new0(struct _mmgui_notifications, 1); //libnotify notifications->notifymodule = NULL; //Open module notifications->notifymodule = g_module_open(mmgui_libpaths_cache_get_library_name(libcache, "libnotify"), G_MODULE_BIND_LAZY); if (notifications->notifymodule != NULL) { libopened = TRUE; libopened = libopened && g_module_symbol(notifications->notifymodule, "notify_init", (gpointer *)&(notifications->notify_init)); libopened = libopened && g_module_symbol(notifications->notifymodule, "notify_notification_new", (gpointer *)&(notifications->notify_notification_new)); libopened = libopened && g_module_symbol(notifications->notifymodule, "notify_notification_set_timeout", (gpointer *)&(notifications->notify_notification_set_timeout)); libopened = libopened && g_module_symbol(notifications->notifymodule, "notify_notification_set_hint", (gpointer *)&(notifications->notify_notification_set_hint)); libopened = libopened && g_module_symbol(notifications->notifymodule, "notify_notification_set_image_from_pixbuf", (gpointer *)&(notifications->notify_notification_set_image_from_pixbuf)); libopened = libopened && g_module_symbol(notifications->notifymodule, "notify_notification_set_category", (gpointer *)&(notifications->notify_notification_set_category)); libopened = libopened && g_module_symbol(notifications->notifymodule, "notify_notification_set_urgency", (gpointer *)&(notifications->notify_notification_set_urgency)); libopened = libopened && g_module_symbol(notifications->notifymodule, "notify_notification_show", (gpointer *)&(notifications->notify_notification_show)); //If some functions not exported, close library if (!libopened) { notifications->notify_init = NULL; notifications->notify_notification_new = NULL; notifications->notify_notification_set_timeout = NULL; notifications->notify_notification_set_hint = NULL; notifications->notify_notification_set_image_from_pixbuf = NULL; notifications->notify_notification_set_category = NULL; notifications->notify_notification_set_urgency = NULL; notifications->notify_notification_show = NULL; //Close module g_module_close(notifications->notifymodule); notifications->notifymodule = NULL; } else { //Initialize libnotify (notifications->notify_init)("Modem Manager GUI"); } } //libcanberra notifications->canberramodule = NULL; notifications->cacontext = NULL; //Open module notifications->canberramodule = g_module_open(mmgui_libpaths_cache_get_library_name(libcache, "libcanberra"), G_MODULE_BIND_LAZY); if (notifications->canberramodule != NULL) { libopened = TRUE; libopened = libopened && g_module_symbol(notifications->canberramodule, "ca_context_create", (gpointer *)&(notifications->ca_context_create)); libopened = libopened && g_module_symbol(notifications->canberramodule, "ca_context_destroy", (gpointer *)&(notifications->ca_context_destroy)); libopened = libopened && g_module_symbol(notifications->canberramodule, "ca_context_play", (gpointer *)&(notifications->ca_context_play)); libopened = libopened && g_module_symbol(notifications->canberramodule, "ca_context_change_props", (gpointer *)&(notifications->ca_context_change_props)); libopened = libopened && g_module_symbol(notifications->canberramodule, "ca_proplist_create", (gpointer *)&(notifications->ca_proplist_create)); libopened = libopened && g_module_symbol(notifications->canberramodule, "ca_proplist_destroy", (gpointer *)&(notifications->ca_proplist_destroy)); libopened = libopened && g_module_symbol(notifications->canberramodule, "ca_proplist_sets", (gpointer *)&(notifications->ca_proplist_sets)); libopened = libopened && g_module_symbol(notifications->canberramodule, "ca_context_play_full", (gpointer *)&(notifications->ca_context_play_full)); //If some functions not exported, close library if (!libopened) { notifications->ca_context_create = NULL; notifications->ca_context_destroy = NULL; notifications->ca_context_play = NULL; notifications->ca_context_change_props = NULL; notifications->ca_proplist_create = NULL; notifications->ca_proplist_destroy = NULL; notifications->ca_proplist_sets = NULL; notifications->ca_context_play_full = NULL; //Close module g_module_close(notifications->canberramodule); notifications->canberramodule = NULL; notifications->cacontext = NULL; } else { //Initialize libnotify (notifications->ca_context_create)(&(notifications->cacontext)); gtksettings = gtk_settings_get_default(); gtksoundtheme = NULL; g_object_get(gtksettings, "gtk-sound-theme-name", >ksoundtheme, NULL); if (gtksoundtheme != NULL) { (notifications->ca_context_change_props)(notifications->cacontext, "canberra.xdg-theme.name", gtksoundtheme, NULL); g_free(gtksoundtheme); } } } return notifications; } gboolean mmgui_notifications_show(mmgui_notifications_t notifications, gchar *caption, gchar *text, enum _mmgui_notifications_sound sound) { gpointer notification; gint caresult; ca_proplist *caproplist; if (notifications == NULL) return FALSE; if ((caption != NULL) && (text != NULL) && (notifications->notifymodule != NULL)) { notification = (notifications->notify_notification_new)(caption, text, NULL); if (notification != NULL) { (notifications->notify_notification_set_timeout)(notification, 3000); (notifications->notify_notification_show)(notification, NULL); } } if ((sound != MMGUI_NOTIFICATIONS_SOUND_NONE) && (notifications->canberramodule != NULL) && (notifications->cacontext != NULL)) { (notifications->ca_proplist_create)(&caproplist); switch (sound) { case MMGUI_NOTIFICATIONS_SOUND_MESSAGE: (notifications->ca_proplist_sets)(caproplist, "media.filename", RESOURCE_SOUND_MESSAGE); (notifications->ca_proplist_sets)(caproplist, "media.role", "event"); break; case MMGUI_NOTIFICATIONS_SOUND_INFO: (notifications->ca_proplist_sets)(caproplist, "event.id", "dialog-info"); (notifications->ca_proplist_sets)(caproplist, "media.role", "event"); break; case MMGUI_NOTIFICATIONS_SOUND_NONE: break; default: (notifications->ca_proplist_sets)(caproplist, "event.id", "dialog-error"); (notifications->ca_proplist_sets)(caproplist, "media.role", "event"); break; } caresult = (notifications->ca_context_play_full)(notifications->cacontext, 0, caproplist, NULL, NULL); (notifications->ca_proplist_destroy)(caproplist); } return TRUE; } void mmgui_notifications_close(mmgui_notifications_t notifications) { if (notifications == NULL) return; if (notifications->notifymodule != NULL) { //First close context if (notifications->cacontext != NULL) { (notifications->ca_context_destroy)(notifications->cacontext); } //Then unload module g_module_close(notifications->notifymodule); notifications->notifymodule = NULL; } if (notifications->canberramodule != NULL) { //Only module unload needed g_module_close(notifications->canberramodule); notifications->canberramodule = NULL; } g_free(notifications); } modem-manager-gui-0.0.16/src/notifications.h000066400000000000000000000105141217271411700207060ustar00rootroot00000000000000/* * notifications.h * * Copyright 2013 Alex * * 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 . */ #ifndef __MMGUINOTIFICATIONS_H__ #define __MMGUINOTIFICATIONS_H__ #include #include #include #include #include "libpaths.h" typedef enum { MMGUI_NOTIFICATIONS_URGENCY_LOW, MMGUI_NOTIFICATIONS_URGENCY_NORMAL, MMGUI_NOTIFICATIONS_URGENCY_CRITICAL, } NotificationsUrgency; typedef struct _ca_context ca_context; typedef struct _ca_proplist ca_proplist; typedef void (*ca_finish_callback_t)(ca_context *c, guint32 id, gint error_code, void *userdata); /*libnotify function prototypes*/ typedef gboolean (*notify_init_func)(const gchar * app_name); typedef gpointer (*notify_notification_new_func)(const char *summary, const char *body, const char *icon); typedef void (*notify_notification_set_timeout_func)(gpointer notification, gint timeout); typedef void (*notify_notification_set_hint_func)(gpointer notification, const char *key, GVariant *value); typedef void (*notify_notification_set_image_from_pixbuf_func)(gpointer notification, gpointer pixbuf); typedef void (*notify_notification_set_category_func)(gpointer notification, const char *category); typedef void (*notify_notification_set_urgency_func)(gpointer notification, NotificationsUrgency urgency); typedef void (*notify_notification_show_func)(gpointer notification, GError **error); /*libcanberra function prototypes*/ typedef void (*ca_finish_callback_t)(ca_context *c, guint32 id, gint error_code, gpointer userdata); typedef gint (*ca_context_create_func)(ca_context **); typedef gint (*ca_context_destroy_func)(ca_context *); typedef gint (*ca_context_play_func)(ca_context *c, guint32 id, ...); typedef gint (*ca_context_change_props_func)(ca_context *c, ...); typedef gint (*ca_proplist_create_func)(ca_proplist **); typedef gint (*ca_proplist_destroy_func)(ca_proplist *); typedef gint (*ca_proplist_sets_func)(ca_proplist *c, const gchar *key, const gchar *value); typedef gint (*ca_context_play_full_func)(ca_context *c, guint32 id, ca_proplist *p, ca_finish_callback_t cb, gpointer userdata); enum _mmgui_notifications_sound { MMGUI_NOTIFICATIONS_SOUND_NONE = 0, MMGUI_NOTIFICATIONS_SOUND_INFO, MMGUI_NOTIFICATIONS_SOUND_MESSAGE }; struct _mmgui_notifications { //Modules GModule *notifymodule; GModule *canberramodule; //libnotify functions notify_init_func notify_init; notify_notification_new_func notify_notification_new; notify_notification_set_timeout_func notify_notification_set_timeout; notify_notification_set_hint_func notify_notification_set_hint; notify_notification_set_image_from_pixbuf_func notify_notification_set_image_from_pixbuf; notify_notification_set_category_func notify_notification_set_category; notify_notification_set_urgency_func notify_notification_set_urgency; notify_notification_show_func notify_notification_show; //libcanberra functions ca_context_create_func ca_context_create; ca_context_destroy_func ca_context_destroy; ca_context_play_func ca_context_play; ca_context_change_props_func ca_context_change_props; ca_proplist_create_func ca_proplist_create; ca_proplist_destroy_func ca_proplist_destroy; ca_proplist_sets_func ca_proplist_sets; ca_context_play_full_func ca_context_play_full; //libcanberra context ca_context *cacontext; }; typedef struct _mmgui_notifications *mmgui_notifications_t; mmgui_notifications_t mmgui_notifications_new(mmgui_libpaths_cache_t libcache); gboolean mmgui_notifications_show(mmgui_notifications_t notifications, gchar *caption, gchar *text, enum _mmgui_notifications_sound sound); void mmgui_notifications_close(mmgui_notifications_t notifications); #endif /* __MMGUI_NOTIFICATIONS_H__ */ modem-manager-gui-0.0.16/src/settings.c000066400000000000000000000121151217271411700176670ustar00rootroot00000000000000/* * settings.c * * Copyright 2012 Alex * * 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 . */ #include #include #include #include #include "settings.h" settings_t gmm_settings_open(gchar *appname, gchar *filename) { settings_t settings; const gchar *homepath; gchar *confpath; gchar *filedata; gsize datasize; GError *error; if ((appname == NULL) || (filename == NULL)) return NULL; homepath = g_get_home_dir(); if (homepath == NULL) return NULL; confpath = g_build_filename(homepath, ".config", appname, NULL); if (g_mkdir_with_parents(confpath, 0755) != 0) { g_warning("Cant create program settings directory"); g_free(confpath); return NULL; } g_free(confpath); settings = g_new(struct _settings, 1); settings->filename = g_build_filename(homepath, ".config", appname, filename, NULL); settings->keyfile = g_key_file_new(); error = NULL; if (g_file_get_contents(settings->filename, &filedata, &datasize, &error)) { if (!g_key_file_load_from_data(settings->keyfile, filedata, datasize, G_KEY_FILE_NONE, &error)) { g_warning("No data loaded from file"); g_error_free(error); error = NULL; } } else { g_warning("No data loaded from file"); g_error_free(error); error = NULL; } return settings; } gboolean gmm_settings_close(settings_t settings) { gchar *filedata; gsize datasize; GError *error; if (settings == NULL) return FALSE; if ((settings->filename == NULL) || (settings->keyfile == NULL)) return FALSE; error = NULL; filedata = g_key_file_to_data(settings->keyfile, &datasize, &error); if (filedata != NULL) { if (!g_file_set_contents(settings->filename, filedata, datasize, &error)) { g_warning("No data saved to file"); g_error_free(error); error = NULL; } } else { g_warning("No data saved to file"); g_error_free(error); error = NULL; } g_free(filedata); g_free(settings->filename); g_key_file_free(settings->keyfile); g_free(settings); return TRUE; } gboolean gmm_settings_set_string(settings_t settings, gchar *key, gchar *value) { if ((settings == NULL) || (key == NULL) || (value == NULL)) return FALSE; g_key_file_set_string(settings->keyfile, "settings", key, value); return TRUE; } gchar *gmm_settings_get_string(settings_t settings, gchar *key, gchar *defvalue) { gchar *value; GError *error; if ((settings == NULL) || (key == NULL)) return g_strdup(defvalue); error = NULL; value = g_key_file_get_string(settings->keyfile, "settings", key, &error); if ((value == NULL) && (error != NULL)) { g_error_free(error); return g_strdup(defvalue); } else { return g_strdup(value); } } gboolean gmm_settings_set_boolean(settings_t settings, gchar *key, gboolean value) { if ((settings == NULL) || (key == NULL)) return FALSE; g_key_file_set_boolean(settings->keyfile, "settings", key, value); return TRUE; } gboolean gmm_settings_get_boolean(settings_t settings, gchar *key, gboolean defvalue) { gboolean value; GError *error; if ((settings == NULL) || (key == NULL)) return defvalue; error = NULL; value = g_key_file_get_boolean(settings->keyfile, "settings", key, &error); if ((error != NULL)) { g_error_free(error); return defvalue; } else { return value; } } gboolean gmm_settings_set_int(settings_t settings, gchar *key, gint value) { if ((settings == NULL) || (key == NULL)) return FALSE; g_key_file_set_integer(settings->keyfile, "settings", key, value); return TRUE; } gint gmm_settings_get_int(settings_t settings, gchar *key, gint defvalue) { gint value; GError *error; if ((settings == NULL) || (key == NULL)) return defvalue; error = NULL; value = g_key_file_get_integer(settings->keyfile, "settings", key, &error); if ((error != NULL)) { g_error_free(error); return defvalue; } else { return value; } } gboolean gmm_settings_set_double(settings_t settings, gchar *key, gdouble value) { if ((settings == NULL) || (key == NULL)) return FALSE; g_key_file_set_double(settings->keyfile, "settings", key, value); return TRUE; } gdouble gmm_settings_get_double(settings_t settings, gchar *key, gdouble defvalue) { gdouble value; GError *error; if ((settings == NULL) || (key == NULL)) return defvalue; error = NULL; value = g_key_file_get_boolean(settings->keyfile, "settings", key, &error); if ((error != NULL)) { g_error_free(error); return defvalue; } else { return value; } } modem-manager-gui-0.0.16/src/settings.h000066400000000000000000000033141217271411700176750ustar00rootroot00000000000000/* * settings.h * * Copyright 2012 Alex * * 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 . */ #ifndef __SETTINGS_H__ #define __SETTINGS_H__ struct _settings { gchar *filename; GKeyFile *keyfile; }; typedef struct _settings *settings_t; settings_t gmm_settings_open(gchar *appname, gchar *filename); gboolean gmm_settings_close(settings_t settings); gboolean gmm_settings_set_string(settings_t settings, gchar *key, gchar *value); gchar *gmm_settings_get_string(settings_t settings, gchar *key, gchar *defvalue); gboolean gmm_settings_set_boolean(settings_t settings, gchar *key, gboolean value); gboolean gmm_settings_get_boolean(settings_t settings, gchar *key, gboolean defvalue); gboolean gmm_settings_set_int(settings_t settings, gchar *key, gint value); gint gmm_settings_get_int(settings_t settings, gchar *key, gint defvalue); gboolean gmm_settings_set_double(settings_t settings, gchar *key, gdouble value); gdouble gmm_settings_get_double(settings_t settings, gchar *key, gdouble defvalue); #endif /* __SETTINGS_H__ */ modem-manager-gui-0.0.16/src/smsdb.c000066400000000000000000000555601217271411700171520ustar00rootroot00000000000000/* * smsdb.c * * Copyright 2012-2013 Alex * * 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 . */ #include #include #include #include #include #include #include #include #include "encoding.h" #include "smsdb.h" #define MMGUI_SMSDB_SMS_MESSAGE_XML "\n\t%s\n\t\n\t%u\n\t%s\n\t%s\n\t%u\n\t%u\n\n\n" #define MMGUI_SMSDB_READ_TAG "\n\t" #define MMGUI_SMSDB_TRAILER_TAG "\n\n\n" #define MMGUI_SMSDB_TRAILER_PARAMS "\n\t%u\n\t%u\n\n\n" #define MMGUI_SMSDB_ACCESS_MASK 0755 enum _mmgui_smsdb_xml_elements { MMGUI_SMSDB_XML_PARAM_NUMBER = 0, MMGUI_SMSDB_XML_PARAM_TIME, MMGUI_SMSDB_XML_PARAM_BINARY, MMGUI_SMSDB_XML_PARAM_SERVICENUMBER, MMGUI_SMSDB_XML_PARAM_TEXT, MMGUI_SMSDB_XML_PARAM_READ, MMGUI_SMSDB_XML_PARAM_FOLDER, MMGUI_SMSDB_XML_PARAM_NULL }; static gint mmgui_smsdb_xml_parameter = MMGUI_SMSDB_XML_PARAM_NULL; static gint mmgui_smsdb_sms_message_sort_compare(gconstpointer a, gconstpointer b); static void mmgui_smsdb_free_sms_list_foreach(gpointer data, gpointer user_data); static mmgui_sms_message_t mmgui_smsdb_xml_parse(gchar *xml, gsize size); static void mmgui_smsdb_xml_get_element(GMarkupParseContext *context, const gchar *element, const gchar **attr_names, const gchar **attr_values, gpointer data, GError **error); static void mmgui_smsdb_xml_get_value(GMarkupParseContext *context, const gchar *text, gsize size, gpointer data, GError **error); static void mmgui_smsdb_xml_end_element(GMarkupParseContext *context, const gchar *element, gpointer data, GError **error); smsdb_t mmgui_smsdb_open(const gchar *persistentid, const gchar *internalid) { smsdb_t smsdb; const gchar *newfilepath; const gchar *newfilename; gchar filename[64]; const gchar *oldfilename; if (persistentid == NULL) return NULL; //Form path using XDG standard newfilepath = g_build_path(G_DIR_SEPARATOR_S, g_get_user_data_dir(), "modem-manager-gui", "devices", persistentid, NULL); if (newfilepath == NULL) return NULL; //If directory structure not exists, create it if (!g_file_test(newfilepath, G_FILE_TEST_IS_DIR)) { if (g_mkdir_with_parents(newfilepath, S_IRUSR|S_IWUSR|S_IXUSR|S_IXGRP|S_IXOTH) == -1) { g_warning("Failed to make XDG data directory: %s", newfilepath); } } //Form file name newfilename = g_build_filename(newfilepath, "sms.gdbm", NULL); g_free((gchar *)newfilepath); if (newfilename == NULL) return NULL; //If file already exists, just work with it if ((!g_file_test(newfilename, G_FILE_TEST_EXISTS)) && (internalid != NULL)) { //Form old-style file path memset(filename, 0, sizeof(filename)); g_snprintf(filename, sizeof(filename), "sms-%s.gdbm", internalid); oldfilename = g_build_filename(g_get_home_dir(), ".config", "modem-manager-gui", filename, NULL); if (oldfilename != NULL) { //If file exists in old location, move it if (g_file_test(oldfilename, G_FILE_TEST_EXISTS)) { if (g_rename(oldfilename, newfilename) == -1) { g_warning("Failed to move file into XDG data directory: %s -> %s", oldfilename, newfilename); } } } g_free((gchar *)oldfilename); } smsdb = g_new(struct _smsdb, 1); smsdb->filepath = newfilename; smsdb->unreadmessages = 0; return smsdb; } gboolean mmgui_smsdb_close(smsdb_t smsdb) { if (smsdb == NULL) return FALSE; if (smsdb->filepath != NULL) { g_free((gchar *)smsdb->filepath); } smsdb->unreadmessages = 0; g_free(smsdb); return TRUE; } mmgui_sms_message_t mmgui_smsdb_message_create(void) { mmgui_sms_message_t message; message = g_new(struct _mmgui_sms_message, 1); message->timestamp = time(NULL); message->read = FALSE; message->binary = FALSE; message->folder = MMGUI_SMSDB_SMS_FOLDER_INCOMING; message->number = NULL; message->svcnumber = NULL; message->idents = NULL; message->text = NULL; return message; } void mmgui_smsdb_message_free(mmgui_sms_message_t message) { if (message == NULL) return; if (message->number != NULL) { g_free(message->number); } if (message->svcnumber != NULL) { g_free(message->svcnumber); } if (message->idents != NULL) { g_array_free(message->idents, TRUE); } if (message->text != NULL) { g_string_free(message->text, TRUE); } g_free(message); } static gchar *mmgui_smsdb_message_escape_number(const gchar *number) { size_t srclen, numlen; gchar *bcdnumber, *escnumber; if (number == NULL) return NULL; srclen = strlen(number); if (srclen == 0) return NULL; bcdnumber = bcd_to_utf8_ascii_part(number, srclen, &numlen); if (bcdnumber != NULL) { escnumber = encoding_clear_special_symbols(bcdnumber, numlen); } else { escnumber = encoding_clear_special_symbols(g_strdup(number), srclen); } return escnumber; } gboolean mmgui_smsdb_message_set_number(mmgui_sms_message_t message, const gchar *number) { gchar *escnumber; if ((message == NULL) || (number == NULL)) return FALSE; escnumber = mmgui_smsdb_message_escape_number(number); if (escnumber != NULL) { if (message->number != NULL) { g_free(message->number); } message->number = escnumber; return TRUE; } else { return FALSE; } } const gchar *mmgui_smsdb_message_get_number(mmgui_sms_message_t message) { if (message == NULL) return NULL; return message->number; } gboolean mmgui_smsdb_message_set_service_number(mmgui_sms_message_t message, const gchar *number) { gchar *escnumber; if ((message == NULL) || (number == NULL)) return FALSE; escnumber = mmgui_smsdb_message_escape_number(number); if (escnumber != NULL) { if (message->svcnumber != NULL) { g_free(message->svcnumber); } message->svcnumber = escnumber; return TRUE; } else { return FALSE; } } const gchar *mmgui_smsdb_message_get_service_number(mmgui_sms_message_t message) { if (message == NULL) return NULL; return message->svcnumber; } gboolean mmgui_smsdb_message_set_text(mmgui_sms_message_t message, const gchar *text, gboolean append) { if ((message == NULL) || (text == NULL)) return FALSE; if (message->binary) return FALSE; if (!append) { if (message->text != NULL) { g_string_free(message->text, TRUE); } message->text = g_string_new(text); } else { if (message->text != NULL) { message->text = g_string_append_c(message->text, ' '); message->text = g_string_append(message->text, text); } else { message->text = g_string_new(text); } } return TRUE; } const gchar *mmgui_smsdb_message_get_text(mmgui_sms_message_t message) { if (message == NULL) return NULL; if (message->text != NULL) { return message->text->str; } else { return NULL; } } gboolean mmgui_smsdb_message_set_data(mmgui_sms_message_t message, const gchar *data, gsize len, gboolean append) { guint srclen, index; if ((message == NULL) || (data == NULL) || (len == 0)) return FALSE; if (!message->binary) return FALSE; if (!append) { if (message->text != NULL) { g_string_free(message->text, TRUE); } message->text = g_string_new_len(NULL, len*2+1); for (index=0; indextext->str+(index*2), "0%1x", (guchar)data[index]); } else { g_sprintf(message->text->str+(index*2), "%2x", (guchar)data[index]); } } message->text->str[len*2] = '\0'; } else { if (message->text != NULL) { message->text = g_string_append(message->text, "00"); srclen = message->text->len-1; message->text = g_string_set_size(message->text, srclen+len*2+1); for (index=0; indextext->str+(srclen+index*2), "0%1x", (guchar)data[index]); } else { g_sprintf(message->text->str+(srclen+index*2), "%2x", (guchar)data[index]); } } message->text->str[srclen+len*2] = '\0'; } else { message->text = g_string_new_len(NULL, len*2+1); for (index=0; indextext->str+(index*2), "0%1x", (guchar)data[index]); } else { g_sprintf(message->text->str+(index*2), "%2x", (guchar)data[index]); } } message->text->str[len*2] = '\0'; } } return TRUE; } gboolean mmgui_smsdb_message_set_identifier(mmgui_sms_message_t message, guint ident, gboolean append) { if (message == NULL) return FALSE; if (!append) { if (message->idents != NULL) { g_array_free(message->idents, TRUE); } message->idents = g_array_new(FALSE, TRUE, sizeof(guint)); g_array_append_val(message->idents, ident); } else { if (message->idents != NULL) { g_array_append_val(message->idents, ident); } else { message->idents = g_array_new(FALSE, TRUE, sizeof(guint)); g_array_append_val(message->idents, ident); } } return TRUE; } guint mmgui_smsdb_message_get_identifier(mmgui_sms_message_t message) { guint ident; if (message == NULL) return 0; if (message->idents != NULL) { ident = g_array_index(message->idents, guint, 0); } else { ident = 0; } return ident; } gboolean mmgui_smsdb_message_set_timestamp(mmgui_sms_message_t message, time_t timestamp) { if (message == NULL) return FALSE; message->timestamp = timestamp; return TRUE; } time_t mmgui_smsdb_message_get_timestamp(mmgui_sms_message_t message) { if (message == NULL) return 0; return message->timestamp; } gboolean mmgui_smsdb_message_set_read(mmgui_sms_message_t message, gboolean read) { if (message == NULL) return FALSE; message->read = read; return TRUE; } gboolean mmgui_smsdb_message_get_read(mmgui_sms_message_t message) { if (message == NULL) return FALSE; return message->read; } gboolean mmgui_smsdb_message_set_folder(mmgui_sms_message_t message, enum _mmgui_smsdb_sms_folder folder) { if (message == NULL) return FALSE; switch (folder) { case MMGUI_SMSDB_SMS_FOLDER_INCOMING: message->folder = MMGUI_SMSDB_SMS_FOLDER_INCOMING; break; case MMGUI_SMSDB_SMS_FOLDER_SENT: message->folder = MMGUI_SMSDB_SMS_FOLDER_SENT; break; case MMGUI_SMSDB_SMS_FOLDER_DRAFTS: message->folder = MMGUI_SMSDB_SMS_FOLDER_DRAFTS; break; default: message->folder = MMGUI_SMSDB_SMS_FOLDER_INCOMING; break; } return TRUE; } enum _mmgui_smsdb_sms_folder mmgui_smsdb_message_get_folder(mmgui_sms_message_t message) { if (message == NULL) return MMGUI_SMSDB_SMS_FOLDER_INCOMING; return message->folder; } gboolean mmgui_smsdb_message_set_binary(mmgui_sms_message_t message, gboolean binary) { if (message == NULL) return FALSE; message->binary = binary; return TRUE; } gboolean mmgui_smsdb_message_get_binary(mmgui_sms_message_t message) { if (message == NULL) return FALSE; return message->binary; } gulong mmgui_smsdb_message_get_db_identifier(mmgui_sms_message_t message) { if (message == NULL) return 0; return message->dbid; } guint mmgui_smsdb_get_unread_messages(smsdb_t smsdb) { if (smsdb == NULL) return 0; return smsdb->unreadmessages; } gboolean mmgui_smsdb_add_sms(smsdb_t smsdb, mmgui_sms_message_t message) { GDBM_FILE db; gchar smsid[64]; gulong idvalue; gint idlen; datum key, data; gchar *smsnumber; gchar *smstext; gchar *smsxml; if ((smsdb == NULL) || (message == NULL)) return FALSE; if (smsdb->filepath == NULL) return FALSE; if ((message->number == NULL) || ((message->text->str == NULL))) return FALSE; db = gdbm_open((gchar *)smsdb->filepath, 0, GDBM_WRCREAT, MMGUI_SMSDB_ACCESS_MASK, 0); if (db == NULL) return FALSE; do { idvalue = (gulong)random(); memset(smsid, 0, sizeof(smsid)); idlen = snprintf(smsid, sizeof(smsid), "%lu", idvalue); key.dptr = (gchar *)smsid; key.dsize = idlen; } while (gdbm_exists(db, key)); message->dbid = idvalue; smsnumber = g_markup_escape_text(message->number, -1); if (smsnumber == NULL) { g_warning("Unable to convert SMS number string"); gdbm_close(db); return FALSE; } smstext = g_markup_escape_text(message->text->str, -1); if (smstext == NULL) { g_warning("Unable to convert SMS text string"); g_free(smsnumber); gdbm_close(db); return FALSE; } smsxml = g_strdup_printf(MMGUI_SMSDB_SMS_MESSAGE_XML, smsnumber, message->timestamp, message->binary, message->svcnumber, smstext, message->read, message->folder); data.dptr = smsxml; data.dsize = strlen(smsxml); if (gdbm_store(db, key, data, GDBM_REPLACE) == -1) { g_warning("Unable to write to database"); gdbm_close(db); g_free(smsxml); return FALSE; } gdbm_sync(db); gdbm_close(db); if (!message->read) { smsdb->unreadmessages++; } g_free(smsxml); g_free(smsnumber); g_free(smstext); return TRUE; } static gint mmgui_smsdb_sms_message_sort_compare(gconstpointer a, gconstpointer b) { mmgui_sms_message_t sms1, sms2; sms1 = (mmgui_sms_message_t)a; sms2 = (mmgui_sms_message_t)b; if (sms1->timestamp < sms2->timestamp) { return -1; } else if (sms1->timestamp > sms2->timestamp) { return 1; } else { return 0; } } GSList *mmgui_smsdb_read_sms_list(smsdb_t smsdb) { GDBM_FILE db; GSList *list; mmgui_sms_message_t message; datum key, data; gchar smsid[64]; if (smsdb == NULL) return NULL; if (smsdb->filepath == NULL) return NULL; db = gdbm_open((gchar *)smsdb->filepath, 0, GDBM_READER, MMGUI_SMSDB_ACCESS_MASK, 0); if (db == NULL) return NULL; smsdb->unreadmessages = 0; list = NULL; key = gdbm_firstkey(db); if (key.dptr != NULL) { do { data = gdbm_fetch(db, key); if (data.dptr != NULL) { message = mmgui_smsdb_xml_parse(data.dptr, data.dsize); if (message != NULL) { if (!message->read) { smsdb->unreadmessages++; } memset(smsid, 0, sizeof(smsid)); strncpy(smsid, key.dptr, key.dsize); message->dbid = strtoul(smsid, NULL, 0); list = g_slist_prepend(list, message); } } key = gdbm_nextkey(db, key); } while (key.dptr != NULL); } gdbm_close(db); if (list != NULL) { list = g_slist_sort(list, mmgui_smsdb_sms_message_sort_compare); } return list; } static void mmgui_smsdb_free_sms_list_foreach(gpointer data, gpointer user_data) { mmgui_sms_message_t message; if (data != NULL) return; message = (mmgui_sms_message_t)data; if (message->number != NULL) { g_free(message->number); } if (message->svcnumber != NULL) { g_free(message->svcnumber); } if (message->idents != NULL) { g_array_free(message->idents, TRUE); } if (message->text != NULL) { g_string_free(message->text, TRUE); } } void mmgui_smsdb_message_free_list(GSList *smslist) { if (smslist == NULL) return; g_slist_foreach(smslist, mmgui_smsdb_free_sms_list_foreach, NULL); g_slist_free(smslist); } mmgui_sms_message_t mmgui_smsdb_read_sms_message(smsdb_t smsdb, gulong idvalue) { GDBM_FILE db; gchar smsid[64]; gint idlen; datum key, data; mmgui_sms_message_t message; if (smsdb == NULL) return NULL; if (smsdb->filepath == NULL) return NULL; db = gdbm_open((gchar *)smsdb->filepath, 0, GDBM_READER, MMGUI_SMSDB_ACCESS_MASK, 0); if (db == NULL) return NULL; message = NULL; memset(smsid, 0, sizeof(smsid)); idlen = snprintf(smsid, sizeof(smsid), "%lu", idvalue); key.dptr = (gchar *)smsid; key.dsize = idlen; if (gdbm_exists(db, key)) { data = gdbm_fetch(db, key); if (data.dptr != NULL) { message = mmgui_smsdb_xml_parse(data.dptr, data.dsize); message->dbid = idvalue; } } gdbm_close(db); return message; } gboolean mmgui_smsdb_remove_sms_message(smsdb_t smsdb, gulong idvalue) { GDBM_FILE db; gchar smsid[64]; gint idlen, unreaddelta; datum key, data; gchar *node; if (smsdb == NULL) return FALSE; if (smsdb->filepath == NULL) return FALSE; db = gdbm_open((gchar *)smsdb->filepath, 0, GDBM_WRCREAT, MMGUI_SMSDB_ACCESS_MASK, 0); if (db == NULL) return FALSE; memset(smsid, 0, sizeof(smsid)); idlen = g_snprintf(smsid, sizeof(smsid), "%lu", idvalue); key.dptr = (gchar *)smsid; key.dsize = idlen; unreaddelta = 0; if (gdbm_exists(db, key)) { data = gdbm_fetch(db, key); if (data.dptr != NULL) { node = strstr(data.dptr, MMGUI_SMSDB_READ_TAG); if (node != NULL) { if ((node-data.dptr > 8) && (isdigit(node[8]))) { if (node[8] == '0') { unreaddelta = -1; } else { unreaddelta = 0; } } } else { unreaddelta = -1; } free(data.dptr); } if (gdbm_delete(db, key) == 0) { smsdb->unreadmessages += unreaddelta; gdbm_sync(db); gdbm_close(db); return TRUE; } } gdbm_close(db); return FALSE; } gboolean mmgui_smsdb_set_message_read_status(smsdb_t smsdb, gulong idvalue, gboolean readflag) { GDBM_FILE db; gint unreaddelta; gchar smsid[64]; gint idlen; datum key, data; gchar *node, *trailer, *newmsg; gchar newtrailer[64]; gint newtrailerlen; gboolean res; if (smsdb == NULL) return FALSE; if (smsdb->filepath == NULL) return FALSE; db = gdbm_open((gchar *)smsdb->filepath, 0, GDBM_WRITER, MMGUI_SMSDB_ACCESS_MASK, 0); if (db == NULL) return FALSE; memset(smsid, 0, sizeof(smsid)); idlen = snprintf(smsid, sizeof(smsid), "%lu", idvalue); key.dptr = (gchar *)smsid; key.dsize = idlen; res = FALSE; unreaddelta = 0; if (gdbm_exists(db, key)) { data = gdbm_fetch(db, key); if (data.dptr != NULL) { node = strstr(data.dptr, MMGUI_SMSDB_READ_TAG); if (node != NULL) { if ((node-data.dptr > 8) && (isdigit(node[8]))) { if ((readflag) && (node[8] == '0')) { unreaddelta = -1; node[8] = '1'; } else if ((!readflag) && (node[8] == '1')) { unreaddelta = 1; node[8] = '0'; } if (gdbm_store(db, key, data, GDBM_REPLACE) == 0) { smsdb->unreadmessages += unreaddelta; res = TRUE; } free(data.dptr); } } else { if (strstr(data.dptr, MMGUI_SMSDB_TRAILER_TAG) != NULL) { memset(newtrailer, 0, sizeof(newtrailer)); newtrailerlen = g_snprintf(newtrailer, sizeof(newtrailer), MMGUI_SMSDB_TRAILER_PARAMS, readflag, MMGUI_SMSDB_SMS_FOLDER_INCOMING); newmsg = g_malloc0(data.dsize-9+newtrailerlen+1); memcpy(newmsg, data.dptr, data.dsize-9); memcpy(newmsg+data.dsize-9, newtrailer, newtrailerlen); free(data.dptr); data.dptr = newmsg; data.dsize = data.dsize-9+newtrailerlen; if (readflag) { unreaddelta = -1; } else { unreaddelta = 0; } if (gdbm_store(db, key, data, GDBM_REPLACE) == 0) { smsdb->unreadmessages += unreaddelta; res = TRUE; } g_free(newmsg); } } } } gdbm_close(db); return res; } static mmgui_sms_message_t mmgui_smsdb_xml_parse(gchar *xml, gsize size) { mmgui_sms_message_t message; GMarkupParser mp; GMarkupParseContext *mpc; GError *error = NULL; message = g_new(struct _mmgui_sms_message, 1); message->timestamp = time(NULL); message->read = FALSE; message->folder = MMGUI_SMSDB_SMS_FOLDER_INCOMING; message->binary = FALSE; message->number = NULL; message->svcnumber = NULL; message->idents = NULL; message->text = NULL; mp.start_element = mmgui_smsdb_xml_get_element; mp.end_element = mmgui_smsdb_xml_end_element; mp.text = mmgui_smsdb_xml_get_value; mp.passthrough = NULL; mp.error = NULL; mpc = g_markup_parse_context_new(&mp, 0, (gpointer)message, NULL); g_markup_parse_context_parse(mpc, xml, size, &error); if (error != NULL) { //g_warning(error->message); g_error_free(error); g_markup_parse_context_free(mpc); return NULL; } g_markup_parse_context_free(mpc); return message; } static void mmgui_smsdb_xml_get_element(GMarkupParseContext *context, const gchar *element, const gchar **attr_names, const gchar **attr_values, gpointer data, GError **error) { if (g_str_equal(element, "number")) { mmgui_smsdb_xml_parameter = MMGUI_SMSDB_XML_PARAM_NUMBER; } else if (g_str_equal(element, "time")) { mmgui_smsdb_xml_parameter = MMGUI_SMSDB_XML_PARAM_TIME; } else if (g_str_equal(element, "binary")) { mmgui_smsdb_xml_parameter = MMGUI_SMSDB_XML_PARAM_BINARY; } else if (g_str_equal(element, "servicenumber")) { mmgui_smsdb_xml_parameter = MMGUI_SMSDB_XML_PARAM_SERVICENUMBER; } else if (g_str_equal(element, "text")) { mmgui_smsdb_xml_parameter = MMGUI_SMSDB_XML_PARAM_TEXT; } else if (g_str_equal(element, "read")) { mmgui_smsdb_xml_parameter = MMGUI_SMSDB_XML_PARAM_READ; } else if (g_str_equal(element, "folder")) { mmgui_smsdb_xml_parameter = MMGUI_SMSDB_XML_PARAM_FOLDER; } else { mmgui_smsdb_xml_parameter = MMGUI_SMSDB_XML_PARAM_NULL; } } static void mmgui_smsdb_xml_get_value(GMarkupParseContext *context, const gchar *text, gsize size, gpointer data, GError **error) { mmgui_sms_message_t message; gchar *numescstr, *textescstr; gsize numlen; message = (mmgui_sms_message_t)data; if (mmgui_smsdb_xml_parameter == MMGUI_SMSDB_XML_PARAM_NULL) return; switch (mmgui_smsdb_xml_parameter) { case MMGUI_SMSDB_XML_PARAM_NUMBER: numescstr = encoding_unescape_xml_markup(text, size); if (numescstr != NULL) { message->number = bcd_to_utf8_ascii_part(numescstr, strlen(numescstr), &numlen); g_free(numescstr); } else { message->number = bcd_to_utf8_ascii_part(text, size, &numlen); } if (message->number != NULL) { message->number = encoding_clear_special_symbols(message->number, numlen); } else { message->number = encoding_clear_special_symbols(g_strdup(text), size); } break; case MMGUI_SMSDB_XML_PARAM_TIME: message->timestamp = (time_t)atol(text); break; case MMGUI_SMSDB_XML_PARAM_BINARY: if (atoi(text)) { message->binary = TRUE; } else { message->binary = FALSE; } break; case MMGUI_SMSDB_XML_PARAM_SERVICENUMBER: message->svcnumber = g_strdup(text); break; case MMGUI_SMSDB_XML_PARAM_TEXT: textescstr = encoding_unescape_xml_markup(text, size); if (textescstr != NULL) { message->text = g_string_new(textescstr); g_free(textescstr); } else { message->text = g_string_new(text); } break; case MMGUI_SMSDB_XML_PARAM_READ: if (atoi(text)) { message->read = TRUE; } else { message->read = FALSE; } break; case MMGUI_SMSDB_XML_PARAM_FOLDER: message->folder = atoi(text); break; default: break; } } static void mmgui_smsdb_xml_end_element(GMarkupParseContext *context, const gchar *element, gpointer data, GError **error) { if (!g_str_equal(element, "sms")) { mmgui_smsdb_xml_parameter = MMGUI_SMSDB_XML_PARAM_NULL; } } modem-manager-gui-0.0.16/src/smsdb.h000066400000000000000000000071071217271411700171510ustar00rootroot00000000000000/* * smsdb.h * * Copyright 2012-2013 Alex * * 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 . */ #ifndef __SMSDB_H__ #define __SMSDB_H__ enum _mmgui_smsdb_sms_folder { MMGUI_SMSDB_SMS_FOLDER_INCOMING = 0, MMGUI_SMSDB_SMS_FOLDER_SENT, MMGUI_SMSDB_SMS_FOLDER_DRAFTS }; struct _smsdb { const gchar *filepath; guint unreadmessages; }; typedef struct _smsdb *smsdb_t; struct _mmgui_sms_message { gchar *number; gchar *svcnumber; GArray *idents; GString *text; gulong dbid; gboolean read; gboolean binary; guint folder; time_t timestamp; }; typedef struct _mmgui_sms_message *mmgui_sms_message_t; smsdb_t mmgui_smsdb_open(const gchar *persistentid, const gchar *internalid); gboolean mmgui_smsdb_close(smsdb_t smsdb); /*Message functions*/ mmgui_sms_message_t mmgui_smsdb_message_create(void); void mmgui_smsdb_message_free(mmgui_sms_message_t message); gboolean mmgui_smsdb_message_set_number(mmgui_sms_message_t message, const gchar *number); const gchar *mmgui_smsdb_message_get_number(mmgui_sms_message_t message); gboolean mmgui_smsdb_message_set_service_number(mmgui_sms_message_t message, const gchar *number); const gchar *mmgui_smsdb_message_get_service_number(mmgui_sms_message_t message); gboolean mmgui_smsdb_message_set_text(mmgui_sms_message_t message, const gchar *text, gboolean append); const gchar *mmgui_smsdb_message_get_text(mmgui_sms_message_t message); gboolean mmgui_smsdb_message_set_data(mmgui_sms_message_t message, const gchar *data, gsize len, gboolean append); gboolean mmgui_smsdb_message_set_identifier(mmgui_sms_message_t message, guint ident, gboolean append); guint mmgui_smsdb_message_get_identifier(mmgui_sms_message_t message); gboolean mmgui_smsdb_message_set_timestamp(mmgui_sms_message_t message, time_t timestamp); time_t mmgui_smsdb_message_get_timestamp(mmgui_sms_message_t message); gboolean mmgui_smsdb_message_set_read(mmgui_sms_message_t message, gboolean read); gboolean mmgui_smsdb_message_get_read(mmgui_sms_message_t message); gboolean mmgui_smsdb_message_set_folder(mmgui_sms_message_t message, enum _mmgui_smsdb_sms_folder folder); enum _mmgui_smsdb_sms_folder mmgui_smsdb_message_get_folder(mmgui_sms_message_t message); gboolean mmgui_smsdb_message_set_binary(mmgui_sms_message_t message, gboolean binary); gboolean mmgui_smsdb_message_get_binary(mmgui_sms_message_t message); gulong mmgui_smsdb_message_get_db_identifier(mmgui_sms_message_t message); /*General functions*/ guint mmgui_smsdb_get_unread_messages(smsdb_t smsdb); gboolean mmgui_smsdb_add_sms(smsdb_t smsdb, mmgui_sms_message_t message); GSList *mmgui_smsdb_read_sms_list(smsdb_t smsdb); void mmgui_smsdb_message_free_list(GSList *smslist); mmgui_sms_message_t mmgui_smsdb_read_sms_message(smsdb_t smsdb, gulong idvalue); gboolean mmgui_smsdb_remove_sms_message(smsdb_t smsdb, gulong idvalue); gboolean mmgui_smsdb_set_message_read_status(smsdb_t smsdb, gulong idvalue, gboolean readflag); #endif /* __SMSDB_H__ */ modem-manager-gui-0.0.16/src/strformat.c000066400000000000000000000203761217271411700200600ustar00rootroot00000000000000/* * strformat.c * * Copyright 2013 Alex * * 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 . */ #include #include #include #include #include #include "strformat.h" #include "mmguicore.h" gchar *mmgui_str_format_speed(gfloat speed, gchar *buffer, gsize bufsize, gboolean small) { gdouble fpvalue; if ((buffer == NULL) || (bufsize == 0)) return NULL; memset(buffer, 0, bufsize); if (speed < 1024.0) { if (small) { g_snprintf(buffer, bufsize, _("%.3f kbps"), speed); } else { g_snprintf(buffer, bufsize, _("%.3f kbps"), speed); } } else if ((speed >= 1024.0) && (speed < 1048576.0)) { fpvalue = speed / (gdouble)(1024.0); if (small) { g_snprintf(buffer, bufsize, _("%.3g Mbps"), fpvalue); } else { g_snprintf(buffer, bufsize, _("%.3g Mbps"), fpvalue); } } else { fpvalue = speed / (gdouble)(1048576.0); if (small) { g_snprintf(buffer, bufsize, _("%.3g Gbps"), fpvalue); } else { g_snprintf(buffer, bufsize, _("%.3g Gbps"), fpvalue); } } return buffer; } gchar *mmgui_str_format_time_number(guchar number, gchar *buffer, gsize bufsize) { if ((buffer == NULL) || (bufsize == 0)) return NULL; memset(buffer, 0, bufsize); if (number < 10) { g_snprintf(buffer, bufsize, "0%u", (guint)number); } else { g_snprintf(buffer, bufsize, "%u", (guint)number); } return buffer; } gchar *mmgui_str_format_time(guint64 seconds, gchar *buffer, gsize bufsize, gboolean small) { gchar secbuffer[3], minbuffer[3], hourbuffer[3]; if ((buffer == NULL) || (bufsize == 0)) return NULL; memset(buffer, 0, bufsize); if (seconds < 60) { if (small) { g_snprintf(buffer, bufsize, _("%u sec"), (guint)seconds); } else { g_snprintf(buffer, bufsize, _("%u sec"), (guint)seconds); } } else if ((seconds >= 60) && (seconds < 3600)) { if (small) { g_snprintf(buffer, bufsize, _("%s:%s"), mmgui_str_format_time_number(seconds%3600/60, minbuffer, sizeof(minbuffer)), mmgui_str_format_time_number(seconds%60, secbuffer, sizeof(secbuffer))); } else { g_snprintf(buffer, bufsize, _("%s:%s"), mmgui_str_format_time_number(seconds%3600/60, minbuffer, sizeof(minbuffer)), mmgui_str_format_time_number(seconds%60, secbuffer, sizeof(secbuffer))); } } else if ((seconds >= 3600) && (seconds < 86400)) { if (small) { g_snprintf(buffer, bufsize, _("%s:%s:%s"), mmgui_str_format_time_number(seconds%86400/3600, hourbuffer, sizeof(hourbuffer)), mmgui_str_format_time_number(seconds%3600/60, minbuffer, sizeof(minbuffer)), mmgui_str_format_time_number(seconds%60, secbuffer, sizeof(secbuffer))); } else { g_snprintf(buffer, bufsize, _("%s:%s:%s"), mmgui_str_format_time_number(seconds%86400/3600, hourbuffer, sizeof(hourbuffer)), mmgui_str_format_time_number(seconds%3600/60, minbuffer, sizeof(minbuffer)), mmgui_str_format_time_number(seconds%60, secbuffer, sizeof(secbuffer))); } } else { if (small) { g_snprintf(buffer, bufsize, _("%" G_GUINT64_FORMAT " day(s) %s:%s:%s"), seconds/86400, mmgui_str_format_time_number(seconds%86400/3600, hourbuffer, sizeof(hourbuffer)), mmgui_str_format_time_number(seconds%3600/60, minbuffer, sizeof(minbuffer)), mmgui_str_format_time_number(seconds%60, secbuffer, sizeof(secbuffer))); } else { g_snprintf(buffer, bufsize, _("%" G_GUINT64_FORMAT " day(s) %s:%s:%s"), seconds/86400, mmgui_str_format_time_number(seconds%86400/3600, hourbuffer, sizeof(hourbuffer)), mmgui_str_format_time_number(seconds%3600/60, minbuffer, sizeof(minbuffer)), mmgui_str_format_time_number(seconds%60, secbuffer, sizeof(secbuffer))); } } return buffer; } gchar *mmgui_str_format_bytes(guint64 bytes, gchar *buffer, gsize bufsize, gboolean small) { gdouble fpvalue; if ((buffer == NULL) || (bufsize == 0)) return NULL; memset(buffer, 0, bufsize); if (bytes < 1024) { if (small) { g_snprintf(buffer, bufsize, _("%u"), (guint)bytes); } else { g_snprintf(buffer, bufsize, _("%u"), (guint)bytes); } } else if ((bytes >= 1024) && (bytes < 1048576ull)) { fpvalue = bytes / (gdouble)(1024.0); if (small) { g_snprintf(buffer, bufsize, _("%.3g Kb"), fpvalue); } else { g_snprintf(buffer, bufsize, _("%.3g Kb"), fpvalue); } } else if ((bytes >= 1048576ull) && (bytes < 1073741824ull)) { fpvalue = bytes / (gdouble)(1048576.0); if (small) { g_snprintf(buffer, bufsize, _("%.3g Mb"), fpvalue); } else { g_snprintf(buffer, bufsize, _("%.3g Mb"), fpvalue); } } else if ((bytes >= 1073741824ull) && (bytes < 109951162800ull)) { fpvalue = bytes / (gdouble)(1073741824.0); if (small) { g_snprintf(buffer, bufsize, _("%.3g Gb"), fpvalue); } else { g_snprintf(buffer, bufsize, _("%.3g Gb"), fpvalue); } } else { fpvalue = bytes / (gdouble)(109951162800.0); if (small) { g_snprintf(buffer, bufsize, _("%.3g Tb"), fpvalue); } else { g_snprintf(buffer, bufsize, _("%.3g Tb"), fpvalue); } } return buffer; } gchar *mmgui_str_format_mode_string(enum _mmgui_device_modes mode) { switch (mode) { case MMGUI_DEVICE_MODE_UNKNOWN: return _("Unknown"); case MMGUI_DEVICE_MODE_GSM: return "GSM"; case MMGUI_DEVICE_MODE_GSM_COMPACT: return "Compact GSM"; case MMGUI_DEVICE_MODE_GPRS: return "GPRS"; case MMGUI_DEVICE_MODE_EDGE: return "EDGE (ETSI 27.007: \"GSM w/EGPRS\")"; case MMGUI_DEVICE_MODE_UMTS: return "UMTS (ETSI 27.007: \"UTRAN\")"; case MMGUI_DEVICE_MODE_HSDPA: return "HSDPA (ETSI 27.007: \"UTRAN w/HSDPA\")"; case MMGUI_DEVICE_MODE_HSUPA: return "HSUPA (ETSI 27.007: \"UTRAN w/HSUPA\")"; case MMGUI_DEVICE_MODE_HSPA: return "HSPA (ETSI 27.007: \"UTRAN w/HSDPA and HSUPA\")"; case MMGUI_DEVICE_MODE_HSPA_PLUS: return "HSPA+ (ETSI 27.007: \"UTRAN w/HSPA+\")"; case MMGUI_DEVICE_MODE_1XRTT: return "CDMA2000 1xRTT"; case MMGUI_DEVICE_MODE_EVDO0: return "CDMA2000 EVDO revision 0"; case MMGUI_DEVICE_MODE_EVDOA: return "CDMA2000 EVDO revision A"; case MMGUI_DEVICE_MODE_EVDOB: return "CDMA2000 EVDO revision B"; case MMGUI_DEVICE_MODE_LTE: return "LTE (ETSI 27.007: \"E-UTRAN\")"; default: return _("Unknown"); } } gchar *mmgui_str_format_na_status_string(enum _mmgui_network_availability status) { switch (status) { case MMGUI_NA_UNKNOWN: return _("Unknown"); case MMGUI_NA_AVAILABLE: return _("Available"); case MMGUI_NA_CURRENT: return _("Current"); case MMGUI_NA_FORBIDDEN: return _("Forbidden"); default: return _("Unknown"); } } gchar *mmgui_str_format_access_tech_string(enum _mmgui_access_tech status) { switch (status) { case MMGUI_ACCESS_TECH_GSM: return "GSM"; case MMGUI_ACCESS_TECH_GSM_COMPACT: return "GSM Compact"; case MMGUI_ACCESS_TECH_UMTS: return "UMTS"; case MMGUI_ACCESS_TECH_EDGE: return "EDGE"; case MMGUI_ACCESS_TECH_HSDPA: return "HSDPA"; case MMGUI_ACCESS_TECH_HSUPA: return "HSUPA"; case MMGUI_ACCESS_TECH_HSPA: return "HSPA"; default: return "Unknown"; } } gchar *mmgui_str_format_reg_status(enum _mmgui_reg_status status) { switch (status) { case MMGUI_REG_STATUS_IDLE: return _("Not registered"); case MMGUI_REG_STATUS_HOME: return _("Home network"); case MMGUI_REG_STATUS_SEARCHING: return _("Searching"); case MMGUI_REG_STATUS_DENIED: return _("Registration denied"); case MMGUI_REG_STATUS_UNKNOWN: return _("Unknown status"); case MMGUI_REG_STATUS_ROAMING: return _("Roaming network"); default: return _("Unknown status"); } } modem-manager-gui-0.0.16/src/strformat.h000066400000000000000000000031161217271411700200560ustar00rootroot00000000000000/* * strformat.h * * Copyright 2013 Alex * * 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 . */ #ifndef __STRFORMAT_H__ #define __STRFORMAT_H__ #include #include #include #include "mmguicore.h" gchar *mmgui_str_format_speed(gfloat speed, gchar *buffer, gsize bufsize, gboolean small); gchar *mmgui_str_format_time_number(guchar number, gchar *buffer, gsize bufsize); gchar *mmgui_str_format_time(guint64 seconds, gchar *buffer, gsize bufsize, gboolean small); gchar *mmgui_str_format_bytes(guint64 bytes, gchar *buffer, gsize bufsize, gboolean small); gchar *mmgui_str_format_mode_string(enum _mmgui_device_modes mode); gchar *mmgui_str_format_na_status_string(enum _mmgui_network_availability status); gchar *mmgui_str_format_access_tech_string(enum _mmgui_access_tech status); gchar *mmgui_str_format_reg_status(enum _mmgui_reg_status status); #endif /* __STRFORMAT_H__ */ modem-manager-gui-0.0.16/src/trafficdb.c000066400000000000000000000535021217271411700177600ustar00rootroot00000000000000/* * trafficdb.c * * Copyright 2012-2013 Alex * * 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 . */ #include #include #include #include #include #include #include #include #include "trafficdb.h" #define TRAFFICDB_DAY_XML "\n\t%" G_GUINT64_FORMAT "\n\t%" G_GUINT64_FORMAT "\n\t%" G_GUINT64_FORMAT "\n\t%u\n\t%" G_GUINT64_FORMAT "\n\t%" G_GUINT64_FORMAT "\n\t%" G_GUINT64_FORMAT "\n\t%u\n\n\n" enum _mmgui_trafficdb_xml_elements { TRAFFICDB_XML_PARAM_DAY_TIME = 0, TRAFFICDB_XML_PARAM_DAY_RX, TRAFFICDB_XML_PARAM_DAY_TX, TRAFFICDB_XML_PARAM_DAY_DURATION, TRAFFICDB_XML_PARAM_SESSION_TIME, TRAFFICDB_XML_PARAM_SESSION_RX, TRAFFICDB_XML_PARAM_SESSION_TX, TRAFFICDB_XML_PARAM_SESSION_DURATION, TRAFFICDB_XML_PARAM_NULL }; static gint mmgui_trafficdb_xml_parameter = TRAFFICDB_XML_PARAM_NULL; static mmgui_day_traffic_t mmgui_trafficdb_xml_parse(gchar *xml, gsize size); static void mmgui_trafficdb_xml_get_element(GMarkupParseContext *context, const gchar *element, const gchar **attr_names, const gchar **attr_values, gpointer data, GError **error); static void mmgui_trafficdb_xml_get_value(GMarkupParseContext *context, const gchar *text, gsize size, gpointer data, GError **error); static void mmgui_trafficdb_xml_end_element(GMarkupParseContext *context, const gchar *element, gpointer data, GError **error); #define MMGUI_TRAFFICDB_WEEK_END 6 #define MMGUI_TRAFFICDB_WEEK_BEGIN 0 #define MMGUI_TRAFFICDB_LEAP_YEAR_DAYS 366 #define MMGUI_TRAFFICDB_NORMAL_YEAR_DAYS 365 #define MMGUI_TRAFFICDB_LEAP_YEAR_FEBRUARY_DAYS 29 static unsigned int mmgui_trafficdb_month_days[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; static guint mmgui_trafficdb_get_month_days(guint month, guint year) { guint days; if (month > 11) return 0; if ((month == 1) && ((year % 4) == 0)) { days = MMGUI_TRAFFICDB_LEAP_YEAR_FEBRUARY_DAYS; } else { days = mmgui_trafficdb_month_days[month]; } return days; } static guint mmgui_trafficdb_get_year_days(guint year) { if ((year % 4) == 0) { return MMGUI_TRAFFICDB_LEAP_YEAR_DAYS; } else { return MMGUI_TRAFFICDB_NORMAL_YEAR_DAYS; } } static time_t mmgui_trafficdb_get_new_day_timesatmp(time_t currenttime) { struct tm *ltime; time_t restime; ltime = localtime((const time_t *)¤ttime); g_debug("Current timesatamp: [%u] %s", (guint)currenttime, ctime(¤ttime)); /*Day of week*/ if ((ltime->tm_wday + 1) > MMGUI_TRAFFICDB_WEEK_END) { ltime->tm_wday = MMGUI_TRAFFICDB_WEEK_BEGIN; } else { ltime->tm_wday++; } /*Year*/ if ((ltime->tm_yday + 1) >= mmgui_trafficdb_get_year_days(ltime->tm_year)) { ltime->tm_year++; ltime->tm_yday = 0; } else { ltime->tm_yday++; } /*Month*/ if ((ltime->tm_mday + 1) > mmgui_trafficdb_get_month_days(ltime->tm_mon, ltime->tm_year)) { if ((ltime->tm_mon + 1) > 11) { ltime->tm_mon = 0; } ltime->tm_mday = 0; } else { ltime->tm_mday++; } /*Hours, minutes, seconds*/ ltime->tm_hour = 0; ltime->tm_min = 0; ltime->tm_sec = 0; restime = mktime(ltime); g_debug("New day timestamp: [%u] %s", (guint)restime, ctime(&restime)); return restime; } static time_t mmgui_trafficdb_truncate_day_timesatmp(time_t currenttime) { struct tm *ltime; time_t restime; ltime = localtime((const time_t *)¤ttime); g_debug("Non-truncated timestamp: [%u] %s", (guint)currenttime, ctime(¤ttime)); /*Hours, minutes, seconds*/ ltime->tm_hour = 0; ltime->tm_min = 0; ltime->tm_sec = 0; restime = mktime(ltime); g_debug("Truncated timestamp: [%u] %s", (guint)restime, ctime(&restime)); return restime; } static time_t mmgui_trafficdb_get_month_begin_timestamp(guint month, guint year) { struct tm ltime; time_t restime; /*Year, month, day*/ ltime.tm_year = year - 1900; ltime.tm_mon = month; ltime.tm_mday = 1; /*Hours, minutes, seconds*/ ltime.tm_hour = 0; ltime.tm_min = 0; ltime.tm_sec = 0; restime = mktime(<ime); g_debug("Month begin timestamp: [%u] %s", (guint)restime, ctime(&restime)); return restime; } static time_t mmgui_trafficdb_get_month_end_timestamp(guint month, guint year) { struct tm ltime; time_t restime; /*Year, month, day*/ ltime.tm_year = year - 1900; ltime.tm_mon = month; ltime.tm_mday = mmgui_trafficdb_get_month_days(month, year); /*Hours, minutes, seconds*/ ltime.tm_hour = 23; ltime.tm_min = 59; ltime.tm_sec = 59; restime = mktime(<ime); g_debug("Month end timestamp: [%u] %s", (guint)restime, ctime(&restime)); return restime; } mmgui_trafficdb_t mmgui_trafficdb_open(const gchar *persistentid, const gchar *internalid) { mmgui_trafficdb_t trafficdb; const gchar *newfilepath; const gchar *newfilename; gchar filename[64]; const gchar *oldfilename; time_t currenttime; if (persistentid == NULL) return NULL; /*Form path using XDG standard*/ newfilepath = g_build_path(G_DIR_SEPARATOR_S, g_get_user_data_dir(), "modem-manager-gui", "devices", persistentid, NULL); if (newfilepath == NULL) return NULL; /*If directory structure not exists, create it*/ if (!g_file_test(newfilepath, G_FILE_TEST_IS_DIR)) { if (g_mkdir_with_parents(newfilepath, S_IRUSR|S_IWUSR|S_IXUSR|S_IXGRP|S_IXOTH) == -1) { g_warning("Failed to make XDG data directory: %s", newfilepath); } } /*Form file name*/ newfilename = g_build_filename(newfilepath, "traffic.gdbm", NULL); g_free((gchar *)newfilepath); if (newfilename == NULL) return NULL; /*If file already exists, just work with it*/ if ((!g_file_test(newfilename, G_FILE_TEST_EXISTS)) && (internalid != NULL)) { /*Form old-style file path*/ memset(filename, 0, sizeof(filename)); g_snprintf(filename, sizeof(filename), "traffic-%s.gdbm", internalid); oldfilename = g_build_filename(g_get_home_dir(), ".config", "modem-manager-gui", filename, NULL); if (oldfilename != NULL) { /*If file exists in old location, move it*/ if (g_file_test(oldfilename, G_FILE_TEST_EXISTS)) { if (g_rename(oldfilename, newfilename) == -1) { g_warning("Failed to move file into XDG data directory: %s -> %s", oldfilename, newfilename); } } } g_free((gchar *)oldfilename); } trafficdb = g_new(struct _mmgui_trafficdb, 1); currenttime = time(NULL); trafficdb->filepath = newfilename; trafficdb->presdaytime = mmgui_trafficdb_truncate_day_timesatmp(currenttime); trafficdb->nextdaytime = mmgui_trafficdb_get_new_day_timesatmp(currenttime); trafficdb->sessactive = FALSE; trafficdb->sessinitialized = FALSE; trafficdb->sessstate = MMGUI_TRAFFICDB_SESSION_STATE_UNKNOWN; trafficdb->dayrxbytes = 0; trafficdb->daytxbytes = 0; trafficdb->dayduration = 0; trafficdb->sesstime = 0; trafficdb->sessrxbytes = 0; trafficdb->sesstxbytes = 0; trafficdb->sessduration = 0; return trafficdb; } gboolean mmgui_trafficdb_close(mmgui_trafficdb_t trafficdb) { if (trafficdb == NULL) return FALSE; if (trafficdb->sessactive) { /*Close current session*/ mmgui_trafficdb_session_close(trafficdb); } if (trafficdb->filepath != NULL) { /*Free file path*/ g_free((gchar *)trafficdb->filepath); } g_free(trafficdb); return TRUE; } gboolean mmgui_trafficdb_traffic_update(mmgui_trafficdb_t trafficdb, mmgui_traffic_update_t update) { time_t currenttime, pastdaytime; gint sessdeltatime; mmgui_day_traffic_t pasttraffic; struct _mmgui_day_traffic traffic; if ((trafficdb == NULL) || (update == NULL)) return FALSE; if ((!trafficdb->sessactive) || (trafficdb->sessstate == MMGUI_TRAFFICDB_SESSION_STATE_UNKNOWN)) return FALSE; currenttime = time(NULL); if ((trafficdb->sessstate == MMGUI_TRAFFICDB_SESSION_STATE_NEW) && (!trafficdb->sessinitialized)) { /*Count time interval between day begin time and session start time*/ sessdeltatime = difftime(trafficdb->presdaytime, trafficdb->sesstime); /*Set session initial values*/ trafficdb->sessrxbytes = update->fullrxbytes; trafficdb->sesstxbytes = update->fulltxbytes; trafficdb->sessduration = update->fulltime; /*If session was started before day begin corrections needed*/ if (sessdeltatime > 0) { /*Current session*/ trafficdb->sessduration -= sessdeltatime; /*Past day session*/ pastdaytime = mmgui_trafficdb_truncate_day_timesatmp(trafficdb->sesstime); pasttraffic = mmgui_trafficdb_day_traffic_read(trafficdb, pastdaytime); if (pasttraffic != NULL) { pasttraffic->sessduration += sessdeltatime; /*Write to database*/ if (!mmgui_trafficdb_day_traffic_write(trafficdb, pasttraffic)) { g_debug("Failed to write traffic statistics to database\n"); } g_free(pasttraffic); } } trafficdb->sessinitialized = TRUE; } if (currenttime <= trafficdb->nextdaytime) { /*Count current values*/ trafficdb->sessrxbytes += update->deltarxbytes; trafficdb->sesstxbytes += update->deltatxbytes; trafficdb->sessduration += update->deltaduration; } else { /*Write current statistics*/ memset(&traffic, 0, sizeof(traffic)); traffic.daytime = trafficdb->presdaytime; traffic.dayrxbytes = trafficdb->dayrxbytes; traffic.daytxbytes = trafficdb->daytxbytes; traffic.dayduration = trafficdb->dayduration; traffic.sesstime = trafficdb->sesstime; traffic.sessrxbytes = trafficdb->sessrxbytes; traffic.sesstxbytes = trafficdb->sesstxbytes; traffic.sessduration = trafficdb->sessduration; /*Write to database*/ if (!mmgui_trafficdb_day_traffic_write(trafficdb, &traffic)) { g_debug("Failed to write traffic statistics to database\n"); } /*Correct values*/ trafficdb->dayrxbytes = 0; trafficdb->daytxbytes = 0; trafficdb->dayduration = 0; trafficdb->sessrxbytes = update->deltarxbytes; trafficdb->sesstxbytes = update->deltatxbytes; trafficdb->sessduration = update->deltaduration; trafficdb->presdaytime = mmgui_trafficdb_truncate_day_timesatmp(currenttime); trafficdb->nextdaytime = mmgui_trafficdb_get_new_day_timesatmp(currenttime); } return TRUE; } gboolean mmgui_trafficdb_session_new(mmgui_trafficdb_t trafficdb, time_t starttime) { time_t currenttime, daytime; mmgui_day_traffic_t traffic; if (trafficdb == NULL) return FALSE; if (trafficdb->sessactive) { //Close current session mmgui_trafficdb_session_close(trafficdb); } currenttime = time(NULL); daytime = mmgui_trafficdb_truncate_day_timesatmp(currenttime); traffic = mmgui_trafficdb_day_traffic_read(trafficdb, daytime); if (traffic) { /*Restore available session data*/ if (starttime == traffic->sesstime) { trafficdb->sessstate = MMGUI_TRAFFICDB_SESSION_STATE_OLD; trafficdb->sesstime = traffic->sesstime; trafficdb->dayrxbytes = traffic->dayrxbytes; trafficdb->daytxbytes = traffic->daytxbytes; trafficdb->dayduration = traffic->dayduration; trafficdb->sessrxbytes = traffic->sessrxbytes; trafficdb->sesstxbytes = traffic->sesstxbytes; trafficdb->sessduration = traffic->sessduration; } else { trafficdb->sessstate = MMGUI_TRAFFICDB_SESSION_STATE_NEW; trafficdb->sesstime = starttime; trafficdb->dayrxbytes = traffic->dayrxbytes + traffic->sessrxbytes; trafficdb->daytxbytes = traffic->daytxbytes + traffic->sesstxbytes; trafficdb->dayduration = traffic->dayduration + traffic->sessduration; trafficdb->sessrxbytes = 0; trafficdb->sesstxbytes = 0; trafficdb->sessduration = 0; } g_free(traffic); } else { /*No sessions started today*/ trafficdb->sessstate = MMGUI_TRAFFICDB_SESSION_STATE_NEW; trafficdb->sesstime = starttime; trafficdb->dayrxbytes = 0; trafficdb->daytxbytes = 0; trafficdb->dayduration = 0; trafficdb->sessrxbytes = 0; trafficdb->sesstxbytes = 0; trafficdb->sessduration = 0; } /*Set common values*/ trafficdb->presdaytime = mmgui_trafficdb_truncate_day_timesatmp(currenttime); trafficdb->nextdaytime = mmgui_trafficdb_get_new_day_timesatmp(currenttime); trafficdb->sessactive = TRUE; trafficdb->sessinitialized = FALSE; return TRUE; } gboolean mmgui_trafficdb_session_close(mmgui_trafficdb_t trafficdb) { time_t currenttime, daytime; struct _mmgui_day_traffic traffic; if (trafficdb == NULL) return FALSE; if (!trafficdb->sessactive) return FALSE; currenttime = time(NULL); daytime = mmgui_trafficdb_truncate_day_timesatmp(currenttime); /*Write current statistics*/ memset(&traffic, 0, sizeof(traffic)); traffic.daytime = daytime; traffic.dayrxbytes = trafficdb->dayrxbytes; traffic.daytxbytes = trafficdb->daytxbytes; traffic.dayduration = trafficdb->dayduration; traffic.sesstime = trafficdb->sesstime; traffic.sessrxbytes = trafficdb->sessrxbytes; traffic.sesstxbytes = trafficdb->sesstxbytes; traffic.sessduration = trafficdb->sessduration; /*Write to database*/ if (!mmgui_trafficdb_day_traffic_write(trafficdb, &traffic)) { g_debug("Failed to write traffic statistics to database\n"); } /*Zero values*/ trafficdb->nextdaytime = 0; trafficdb->sessactive = FALSE; trafficdb->sessinitialized = FALSE; trafficdb->sessstate = MMGUI_TRAFFICDB_SESSION_STATE_UNKNOWN; trafficdb->dayrxbytes = 0; trafficdb->daytxbytes = 0; trafficdb->dayduration = 0; trafficdb->sesstime = 0; trafficdb->sessrxbytes = 0; trafficdb->sesstxbytes = 0; trafficdb->sessduration = 0; return TRUE; } gboolean mmgui_trafficdb_session_get_day_traffic(mmgui_trafficdb_t trafficdb, mmgui_day_traffic_t traffic) { time_t currenttime; if ((trafficdb == NULL) || (traffic == NULL)) return FALSE; if (!trafficdb->sessactive) return FALSE; currenttime = time(NULL); traffic->daytime = mmgui_trafficdb_truncate_day_timesatmp(currenttime); traffic->dayrxbytes = trafficdb->dayrxbytes; traffic->daytxbytes = trafficdb->daytxbytes; traffic->dayduration = trafficdb->dayduration; traffic->sesstime = trafficdb->sesstime; traffic->sessrxbytes = trafficdb->sessrxbytes; traffic->sesstxbytes = trafficdb->sesstxbytes; traffic->sessduration = trafficdb->sessduration; return TRUE; } gboolean mmgui_trafficdb_day_traffic_write(mmgui_trafficdb_t trafficdb, mmgui_day_traffic_t daytraffic) { GDBM_FILE db; gchar dayid[64]; gulong idvalue; gint idlen; datum key, data; gchar *daytrafficxml; if ((trafficdb == NULL) || (daytraffic == NULL)) return FALSE; if (trafficdb->filepath == NULL) return FALSE; db = gdbm_open((gchar *)trafficdb->filepath, 0, GDBM_WRCREAT, 0755, 0); if (db == NULL) return FALSE; memset(dayid, 0, sizeof(dayid)); idlen = snprintf(dayid, sizeof(dayid), "%" G_GUINT64_FORMAT "", daytraffic->daytime); key.dptr = (gchar *)dayid; key.dsize = idlen; daytrafficxml = g_strdup_printf(TRAFFICDB_DAY_XML, daytraffic->daytime, daytraffic->dayrxbytes, daytraffic->daytxbytes, daytraffic->dayduration, daytraffic->sesstime, daytraffic->sessrxbytes, daytraffic->sesstxbytes, daytraffic->sessduration); data.dptr = daytrafficxml; data.dsize = strlen(daytrafficxml); if (gdbm_store(db, key, data, GDBM_REPLACE) == -1) { g_warning("Unable to write to database"); gdbm_close(db); g_free(daytrafficxml); return FALSE; } gdbm_sync(db); gdbm_close(db); g_free(daytrafficxml); return TRUE; } static gint mmgui_trafficdb_traffic_list_sort_compare(gconstpointer a, gconstpointer b) { mmgui_day_traffic_t day1, day2; day1 = (mmgui_day_traffic_t)a; day2 = (mmgui_day_traffic_t)b; if (day1->daytime < day2->daytime) { return -1; } else if (day1->daytime > day2->daytime) { return 1; } else { return 0; } } GSList *mmgui_trafficdb_get_traffic_list_for_month(mmgui_trafficdb_t trafficdb, guint month, guint year) { GDBM_FILE db; time_t begtime, endtime; time_t daytime; GSList *list; mmgui_day_traffic_t daytraffic; datum key, data; gchar dayid[64]; if (trafficdb == NULL) return NULL; if (trafficdb->filepath == NULL) return NULL; begtime = mmgui_trafficdb_get_month_begin_timestamp(month, year); endtime = mmgui_trafficdb_get_month_end_timestamp(month, year); db = gdbm_open((gchar *)trafficdb->filepath, 0, GDBM_READER, 0755, 0); if (db == NULL) return NULL; list = NULL; key = gdbm_firstkey(db); if (key.dptr != NULL) { do { memset(dayid, 0, sizeof(dayid)); strncpy(dayid, key.dptr, key.dsize); daytime = (time_t)strtoull(dayid, NULL, 10); if ((difftime(endtime, daytime) >= 0.0) && (difftime(daytime, begtime) > 0.0)) { data = gdbm_fetch(db, key); if (data.dptr != NULL) { daytraffic = mmgui_trafficdb_xml_parse(data.dptr, data.dsize); list = g_slist_prepend(list, daytraffic); } } key = gdbm_nextkey(db, key); } while (key.dptr != NULL); } gdbm_close(db); if (list != NULL) { list = g_slist_sort(list, mmgui_trafficdb_traffic_list_sort_compare); } return list; } void mmgui_trafficdb_free_traffic_list_for_month(GSList *trafficlist) { if (trafficlist == NULL) return; g_slist_foreach(trafficlist, (GFunc)g_free, NULL); g_slist_free(trafficlist); } mmgui_day_traffic_t mmgui_trafficdb_day_traffic_read(mmgui_trafficdb_t trafficdb, time_t daytime) { GDBM_FILE db; gchar dayid[64]; gint idlen; datum key, data; mmgui_day_traffic_t traffic; if (trafficdb == NULL) return NULL; if (trafficdb->filepath == NULL) return NULL; //Open database db = gdbm_open((gchar *)trafficdb->filepath, 0, GDBM_READER, 0755, 0); if (db == NULL) return NULL; traffic = NULL; memset(dayid, 0, sizeof(dayid)); idlen = snprintf(dayid, sizeof(dayid), "%" G_GUINT64_FORMAT "", (guint64)mmgui_trafficdb_truncate_day_timesatmp(daytime)); key.dptr = (gchar *)dayid; key.dsize = idlen; if (gdbm_exists(db, key)) { data = gdbm_fetch(db, key); if (data.dptr != NULL) { traffic = mmgui_trafficdb_xml_parse(data.dptr, data.dsize); } } gdbm_close(db); return traffic; } static mmgui_day_traffic_t mmgui_trafficdb_xml_parse(gchar *xml, gsize size) { mmgui_day_traffic_t traffic; GMarkupParser mp; GMarkupParseContext *mpc; GError *error = NULL; traffic = g_new(struct _mmgui_day_traffic, 1); traffic->daytime = 0; traffic->dayrxbytes = 0; traffic->daytxbytes = 0; traffic->dayduration = 0; traffic->sesstime = 0; traffic->sessrxbytes = 0; traffic->sesstxbytes = 0; traffic->sessduration = 0; mp.start_element = mmgui_trafficdb_xml_get_element; mp.end_element = mmgui_trafficdb_xml_end_element; mp.text = mmgui_trafficdb_xml_get_value; mp.passthrough = NULL; mp.error = NULL; mpc = g_markup_parse_context_new(&mp, 0, (gpointer)traffic, NULL); g_markup_parse_context_parse(mpc, xml, size, &error); if (error != NULL) { g_free(traffic); g_error_free(error); g_markup_parse_context_free(mpc); return NULL; } g_markup_parse_context_free(mpc); return traffic; } static void mmgui_trafficdb_xml_get_element(GMarkupParseContext *context, const gchar *element, const gchar **attr_names, const gchar **attr_values, gpointer data, GError **error) { if (g_str_equal(element, "daytime")) { mmgui_trafficdb_xml_parameter = TRAFFICDB_XML_PARAM_DAY_TIME; } else if (g_str_equal(element, "dayrxbytes")) { mmgui_trafficdb_xml_parameter = TRAFFICDB_XML_PARAM_DAY_RX; } else if (g_str_equal(element, "daytxbytes")) { mmgui_trafficdb_xml_parameter = TRAFFICDB_XML_PARAM_DAY_TX; } else if (g_str_equal(element, "dayduration")) { mmgui_trafficdb_xml_parameter = TRAFFICDB_XML_PARAM_DAY_DURATION; } else if (g_str_equal(element, "sesstime")) { mmgui_trafficdb_xml_parameter = TRAFFICDB_XML_PARAM_SESSION_TIME; } else if (g_str_equal(element, "sessrxbytes")) { mmgui_trafficdb_xml_parameter = TRAFFICDB_XML_PARAM_SESSION_RX; } else if (g_str_equal(element, "sesstxbytes")) { mmgui_trafficdb_xml_parameter = TRAFFICDB_XML_PARAM_SESSION_TX; } else if (g_str_equal(element, "sessduration")) { mmgui_trafficdb_xml_parameter = TRAFFICDB_XML_PARAM_SESSION_DURATION; } else { mmgui_trafficdb_xml_parameter = TRAFFICDB_XML_PARAM_NULL; } } static void mmgui_trafficdb_xml_get_value(GMarkupParseContext *context, const gchar *text, gsize size, gpointer data, GError **error) { mmgui_day_traffic_t daytraffic; daytraffic = (mmgui_day_traffic_t)data; if (mmgui_trafficdb_xml_parameter == TRAFFICDB_XML_PARAM_NULL) return; switch (mmgui_trafficdb_xml_parameter) { case TRAFFICDB_XML_PARAM_DAY_TIME: daytraffic->daytime = (guint64)strtoull(text, NULL, 10); break; case TRAFFICDB_XML_PARAM_DAY_RX: daytraffic->dayrxbytes = (guint64)strtoull(text, NULL, 10); break; case TRAFFICDB_XML_PARAM_DAY_TX: daytraffic->daytxbytes = (guint64)strtoull(text, NULL, 10); break; case TRAFFICDB_XML_PARAM_DAY_DURATION: daytraffic->dayduration = (guint)strtoul(text, NULL, 10); break; case TRAFFICDB_XML_PARAM_SESSION_TIME: daytraffic->sesstime = (guint64)strtoull(text, NULL, 10); break; case TRAFFICDB_XML_PARAM_SESSION_RX: daytraffic->sessrxbytes = (guint64)strtoull(text, NULL, 10); break; case TRAFFICDB_XML_PARAM_SESSION_TX: daytraffic->sesstxbytes = (guint64)strtoull(text, NULL, 10); break; case TRAFFICDB_XML_PARAM_SESSION_DURATION: daytraffic->sessduration = (guint)strtoul(text, NULL, 10); break; default: break; } } static void mmgui_trafficdb_xml_end_element(GMarkupParseContext *context, const gchar *element, gpointer data, GError **error) { if (!g_str_equal(element, "traffic")) { mmgui_trafficdb_xml_parameter = TRAFFICDB_XML_PARAM_NULL; } } modem-manager-gui-0.0.16/src/trafficdb.h000066400000000000000000000054161217271411700177660ustar00rootroot00000000000000/* * trafficdb.h * * Copyright 2012-2013 Alex * * 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 . */ #ifndef __TRAFFICDB_H__ #define __TRAFFICDB_H__ enum _mmgui_trafficdb_session_state { MMGUI_TRAFFICDB_SESSION_STATE_UNKNOWN = 0, MMGUI_TRAFFICDB_SESSION_STATE_NEW, MMGUI_TRAFFICDB_SESSION_STATE_OLD }; struct _mmgui_trafficdb { const gchar *filepath; gboolean sessactive; gboolean sessinitialized; time_t presdaytime; time_t nextdaytime; time_t sesstime; guint sessstate; guint64 dayrxbytes; guint64 daytxbytes; guint dayduration; guint64 sessrxbytes; guint64 sesstxbytes; guint64 sessduration; }; typedef struct _mmgui_trafficdb *mmgui_trafficdb_t; struct _mmgui_day_traffic { /*Day statistics*/ guint64 daytime; guint64 dayrxbytes; guint64 daytxbytes; guint dayduration; /*Last session statistics*/ guint64 sesstime; guint64 sessrxbytes; guint64 sesstxbytes; guint sessduration; }; typedef struct _mmgui_day_traffic *mmgui_day_traffic_t; struct _mmgui_traffic_update { guint64 fullrxbytes; guint64 fulltxbytes; guint64 fulltime; guint deltarxbytes; guint deltatxbytes; guint deltaduration; }; typedef struct _mmgui_traffic_update *mmgui_traffic_update_t; mmgui_trafficdb_t mmgui_trafficdb_open(const gchar *persistentid, const gchar *internalid); gboolean mmgui_trafficdb_close(mmgui_trafficdb_t trafficdb); gboolean mmgui_trafficdb_traffic_update(mmgui_trafficdb_t trafficdb, mmgui_traffic_update_t update); gboolean mmgui_trafficdb_session_new(mmgui_trafficdb_t trafficdb, time_t starttime); gboolean mmgui_trafficdb_session_close(mmgui_trafficdb_t trafficdb); gboolean mmgui_trafficdb_session_get_day_traffic(mmgui_trafficdb_t trafficdb, mmgui_day_traffic_t daytraffic); gboolean mmgui_trafficdb_day_traffic_write(mmgui_trafficdb_t trafficdb, mmgui_day_traffic_t daytraffic); GSList *mmgui_trafficdb_get_traffic_list_for_month(mmgui_trafficdb_t trafficdb, guint month, guint year); void mmgui_trafficdb_free_traffic_list_for_month(GSList *trafficlist); mmgui_day_traffic_t mmgui_trafficdb_day_traffic_read(mmgui_trafficdb_t trafficdb, time_t daytime); #endif /* __SMSDB_H__ */ modem-manager-gui-0.0.16/src/ussdlist.c000066400000000000000000000157101217271411700177050ustar00rootroot00000000000000/* * ussdlist.c * * Copyright 2012 Alex * * 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 . */ #include #include #include #include #include #include #include "ussdlist.h" #include "encoding.h" #define USSDLIST_XML_HEADER "\n\n" #define USSDLIST_XML_ENTRY "\n\t" #define USSDLIST_XML_FOOTER "\n" struct _ussdlist_user_data { ussdlist_read_callback callback; gpointer data; }; typedef struct _ussdlist_user_data *ussdlist_user_data_t; static GString *xmlstring = NULL; static const gchar *ussdlist_form_file_path(const gchar *persistentid, const gchar *internalid); static void ussdlist_xml_get_element(GMarkupParseContext *context, const gchar *element, const gchar **attr_names, const gchar **attr_values, gpointer data, GError **error); static const gchar *ussdlist_form_file_path(const gchar *persistentid, const gchar *internalid) { const gchar *newfilepath; const gchar *newfilename; gchar filename[64]; const gchar *oldfilename; if (persistentid == NULL) return NULL; //Form path using XDG standard newfilepath = g_build_path(G_DIR_SEPARATOR_S, g_get_user_data_dir(), "modem-manager-gui", "devices", persistentid, NULL); if (newfilepath == NULL) return NULL; //If directory structure not exists, create it if (!g_file_test(newfilepath, G_FILE_TEST_IS_DIR)) { if (g_mkdir_with_parents(newfilepath, S_IRUSR|S_IWUSR|S_IXUSR|S_IXGRP|S_IXOTH) == -1) { g_warning("Failed to make XDG data directory: %s", newfilepath); } } //Form file name newfilename = g_build_filename(newfilepath, "ussdlist.xml", NULL); g_free((gchar *)newfilepath); if (newfilename == NULL) return NULL; //If file already exists, just work with it if ((g_file_test(newfilename, G_FILE_TEST_EXISTS)) || (internalid == NULL)) { return newfilename; } //Form old-style file path memset(filename, 0, sizeof(filename)); g_snprintf(filename, sizeof(filename), "ussd-%s.xml", internalid); oldfilename = g_build_filename(g_get_home_dir(), ".config", "modem-manager-gui", filename, NULL); if (oldfilename == NULL) return newfilename; //If file exists in old location, move it if (g_file_test(oldfilename, G_FILE_TEST_EXISTS)) { if (g_rename(oldfilename, newfilename) == -1) { g_warning("Failed to move file into XDG data directory: %s -> %s", oldfilename, newfilename); } } g_free((gchar *)oldfilename); return newfilename; } gboolean ussdlist_read_commands(ussdlist_read_callback callback, const gchar *persistentid, const gchar *internalid, gpointer data) { const gchar *filepath; gchar *contents; gsize length; GError *error; GMarkupParser mp; GMarkupParseContext *mpc; struct _ussdlist_user_data userdata; if ((callback == NULL) || (persistentid == NULL)) return FALSE; filepath = ussdlist_form_file_path(persistentid, internalid); if (filepath == NULL) return FALSE; error = NULL; if (!g_file_get_contents((const gchar *)filepath, &contents, &length, &error)) { g_free((gchar *)filepath); g_error_free(error); return FALSE; } g_free((gchar *)filepath); mp.start_element = ussdlist_xml_get_element; mp.end_element = NULL; mp.text = NULL; mp.passthrough = NULL; mp.error = NULL; userdata.callback = callback; userdata.data = data; mpc = g_markup_parse_context_new(&mp, 0, (gpointer)&userdata, NULL); g_markup_parse_context_parse(mpc, contents, length, &error); if (error != NULL) { //g_warning(error->message); g_error_free(error); g_markup_parse_context_free(mpc); return FALSE; } g_markup_parse_context_free(mpc); return TRUE; } static void ussdlist_xml_get_element(GMarkupParseContext *context, const gchar *element, const gchar **attr_names, const gchar **attr_values, gpointer data, GError **error) { gint i; gchar *command, *description; gboolean reencode; ussdlist_user_data_t userdata; userdata = (ussdlist_user_data_t)data; if (g_str_equal(element, "ussdlist")) { if (g_str_equal(attr_names[0], "reencode")) { reencode = (gboolean)atoi(attr_values[0]); (userdata->callback)(NULL, NULL, reencode, userdata->data); } } else if (g_str_equal(element, "ussd")) { i = 0; command = NULL; description = NULL; while (attr_names[i] != NULL) { if (g_str_equal(attr_names[i], "command")) { command = encoding_unescape_xml_markup((const gchar *)attr_values[i], strlen(attr_values[i])); } else if (g_str_equal(attr_names[i], "description")) { description = encoding_unescape_xml_markup((const gchar *)attr_values[i], strlen(attr_values[i])); } i++; } if ((command != NULL) && (description != NULL)) { (userdata->callback)(command, description, FALSE, userdata->data); } if (command != NULL) g_free(command); if (description != NULL) g_free(description); } } gboolean ussdlist_start_xml_export(gboolean reencode) { if (xmlstring != NULL) { g_string_free(xmlstring, TRUE); xmlstring = NULL; } xmlstring = g_string_new(NULL); g_string_append_printf(xmlstring, USSDLIST_XML_HEADER, reencode); return TRUE; } gboolean ussdlist_add_command_to_xml_export(gchar *command, gchar *description) { gchar *esccommand, *escdescription; if (xmlstring == NULL) return FALSE; if ((command == NULL) || (description == NULL)) return FALSE; esccommand = g_markup_escape_text(command, -1); escdescription = g_markup_escape_text(description, -1); if ((esccommand != NULL) && (escdescription != NULL)) { g_string_append_printf(xmlstring, USSDLIST_XML_ENTRY, esccommand, escdescription); g_free(esccommand); g_free(escdescription); return TRUE; } if (esccommand != NULL) g_free(esccommand); if (escdescription != NULL) g_free(escdescription); return FALSE; } gboolean ussdlist_end_xml_export(const gchar *persistentid) { const gchar *filepath; GError *error; if ((xmlstring == NULL) || (persistentid == NULL)) return FALSE; g_string_append(xmlstring, USSDLIST_XML_FOOTER); filepath = ussdlist_form_file_path(persistentid, NULL); if (filepath == NULL) return FALSE; error = NULL; if (!g_file_set_contents((const gchar *)filepath, xmlstring->str, xmlstring->len, &error)) { g_free((gchar *)filepath); g_error_free(error); return FALSE; } g_free((gchar *)filepath); return TRUE; } modem-manager-gui-0.0.16/src/ussdlist.h000066400000000000000000000026611217271411700177130ustar00rootroot00000000000000/* * ussdlist.h * * Copyright 2012 Alex * * 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 . */ #ifndef __USSDLIST_H__ #define __USSDLIST_H__ #include struct _ussdlist_entry { gchar *command; gchar *description; }; typedef struct _ussdlist_entry *ussdlist_entry_t; typedef void (*ussdlist_read_callback)(gchar *command, gchar *description, gboolean reencode, gpointer data); gboolean ussdlist_read_commands(ussdlist_read_callback callback, const gchar *persistentid, const gchar *internalid, gpointer data); gboolean ussdlist_start_xml_export(gboolean reencode); gboolean ussdlist_add_command_to_xml_export(gchar *command, gchar *description); gboolean ussdlist_end_xml_export(const gchar *persistentid); #endif /* __USSDLIST_H__ */