pax_global_header00006660000000000000000000000064126531021250014507gustar00rootroot0000000000000052 comment=efd19477ade793cdb547c0f0972608e293aa8bf8 gnome-mpv-0.7/000077500000000000000000000000001265310212500132625ustar00rootroot00000000000000gnome-mpv-0.7/.gitignore000066400000000000000000000010601265310212500152470ustar00rootroot00000000000000# Files generated by autotools /autom4te.cache /aclocal.m4 /compile /configure /configure.sub /config.* /depcomp /install-sh /intltool-* /ltmain.sh /missing /ar-lib /libtool /test-driver /stamp-h1 /m4 Makefile.in.in Makefile.in Makefile config.* po/POTFILES po/stamp-it # Files generated by `make` *.o *.stamp *.la *.so *.dll *.a *.exe *.lo *.log *.trs *.test *.tar.xz .deps/ .libs/ data/*.valid data/gnome-mpv.appdata.xml data/gnome-mpv.desktop data/org.gnome-mpv.gschema.xml po/*.gmo po/.intltool-merge-cache .dirstamp src/gnome-mpv src/mpris/mpris_gdbus.* gnome-mpv-0.7/COPYING000066400000000000000000001045141265310212500143220ustar00rootroot00000000000000 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 . gnome-mpv-0.7/Makefile.am000066400000000000000000000007541265310212500153240ustar00rootroot00000000000000AUTOMAKE_OPTIONS = foreign SUBDIRS = src data po DISTCLEANFILES = intltool-extract \ intltool-merge \ intltool-update \ po/.intltool-merge-cache INTLTOOL_FILES = intltool-extract.in \ intltool-merge.in \ intltool-update.in EXTRA_DIST = README.md UPDATE_DESKTOP = update-desktop-database -q || : UPDATE_ICON = gtk-update-icon-cache -q $(datadir)/icons/hicolor/ || : install-data-hook: $(UPDATE_DESKTOP) $(UPDATE_ICON) uninstall-hook: $(UPDATE_DESKTOP) $(UPDATE_ICON) gnome-mpv-0.7/README.md000066400000000000000000000126001265310212500145400ustar00rootroot00000000000000# GNOME MPV GNOME MPV is a simple GTK+ frontend for mpv. GNOME MPV interacts with mpv via the client API exported by libmpv, allowing access to mpv's powerful playback capabilities. ## Dependencies - appstream-glib (build) - autotools (build) - autoconf-archive (build) - pkg-config (build) - gcc (build) - intltool (build) - python2 (build) - glib2 - gtk3 - libmpv - youtube-dl (optional) ## Installation ### GNU/Linux packages - Arch Linux: https://aur.archlinux.org/packages/gnome-mpv - Arch Linux (Git): https://aur.archlinux.org/packages/gnome-mpv-git - Debian testing: https://packages.debian.org/testing/gnome-mpv - Debian unstable: https://packages.debian.org/sid/gnome-mpv - Fedora (Copr): https://copr.fedoraproject.org/coprs/region51/gnome-mpv/ - Fedora (russianfedora): http://ru.fedoracommunity.org/repository - Fedora/OpenSUSE: https://build.opensuse.org/package/show/home:mermoldy:multimedia/gnome-mpv - Gentoo: http://gpo.zugaina.org/media-video/gnome-mpv - Solus: https://packages.solus-project.com/v1/g/gnome-mpv/ - Ubuntu: https://launchpad.net/~xuzhen666/+archive/ubuntu/gnome-mpv ### Source code Run the following command in the source code directory to build and install: ```sh ./autogen.sh && make && sudo make install ``` ## Usage ### Opening files There are 4 ways to open files in GNOME MPV. 1. Passing files and/or URIs as command line arguments. 2. Using the file chooser dialog box, accessible via the "Open" menu item. 3. Typing URI into the "Open Location" dialog box, accessible via the menu item with the same name. 4. Dragging and dropping files or URIs onto GNOME MPV. ### Manipulating playlist The playlist is hidden by default. To show the playlist, click the "Playlist" menu item or press F9. Files can be added by dragging and dropping files or URIs onto the playlist. Dropping files or URIs onto the video area will replace the content of the playlist. Playlist files or online playlists (eg. YouTube's playlist) will be automatically expanded into individual items when loaded. Items in the playlist can be reordered via drag-and-drop. To remove items from the playlist, select the item by clicking on it then press the delete button on your keyboard. ### Configuration GNOME MPV can be configured using the preferences dialog box accessible via the "Preferences" menu item. Playback-related settings can be loaded from an external file using the same syntax as mpv's `mpv.conf`. It is possible to load mpv's `mpv.conf` directly with no modification. GNOME MPV will not write to the file, so it is not necessary to make a separate copy of the file. The file must be specified and enabled in the preferences dialog under the "MPV Configuration" section. Options can also be passed to mpv using the "Extra MPV Options" text box in the preferences dialog. The syntax used is the same as mpv's command line options. ### Default keybindings Default GUI-related keybindings are defined as following: |Keys |Action | |---------------|-----------------------| |Ctrl+O |Open | |Ctrl+L |Open location | |Ctrl+S |Save playlist | |Ctrl+Q |Quit | |Ctrl+P |Preferences | |F9 |Toggle playlist | |F11 or F |Toggle fullscreen mode | |ESC |Exit fullscreen mode | |Ctrl+1 |Normal size | |Ctrl+2 |Double size | |Ctrl+3 |Half size | "Normal size", "Double size", and "Half size" resizes GNOME MPV window such that the video area is proportional to the size of the playing video. "Normal size" will resize the window so that the video area will be the same size as the video. "Double size" and "Half size" will resize the window so that the video area will be double and half the actual size of the video respectively. Because this requires information from the playing video, these actions will have no effect if no file is loaded or the current file is an audio file. There is also another set of default keybindings used for playback-related actions. They are defined in the macro `DEFAULT_KEYBINDS`, which can be found in [src/def.h](https://github.com/gnome-mpv/gnome-mpv/blob/master/src/def.h). The syntax used is exactly the same as mpv's `input.conf`. Additional keybindings can be defined in an external file using mpv's `input.conf` syntax. Because the syntax is the same, it is possible to load mpv's `input.conf` directly with no modification. It is not necessary to create a separate copy of the file as GNOME MPV will not write to the file. The file has to be loaded via the preferences dialog under the "Keybindings" section. In case of conflict with default keybindings, keybindings defined in external file will be given priority. ## Contributing Translations GNOME MPV uses [Zanata](https://zanata.org) to coordinate translations. You can find GNOME MPV's page [here](https://translate.zanata.org/zanata/iteration/view/gnome-mpv/master). If you'd like to add a new language, open an issue on GitHub. ## License GNOME MPV 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. GNOME MPV 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 GNOME MPV. If not, see . gnome-mpv-0.7/autogen.sh000077500000000000000000000011701265310212500152620ustar00rootroot00000000000000#!/bin/sh # Run this to generate all the initial makefiles, etc. srcdir=`dirname $0` test -z "$srcdir" && srcdir=. (test -f $srcdir/configure.ac) || { echo -n "**Error**: Directory "\`$srcdir\'" does not look like the top-level directory" exit 1 } aclocal --install -I m4 || exit 1 intltoolize --copy --automake || exit 1 autoreconf --install -Wno-portability || exit 1 if [ "$NOCONFIGURE" = "" ]; then $srcdir/configure "$@" || exit 1 if [ "$1" = "--help" ]; then exit 0 else echo "Now type \`make\' to compile" || exit 1 fi else echo "Skipping configure process." fi set +x gnome-mpv-0.7/configure.ac000066400000000000000000000046331265310212500155560ustar00rootroot00000000000000AC_PREREQ([2.69]) AC_INIT( [gnome-mpv], [0.7], [http://github.com/gnome-mpv/gnome-mpv/issues], [gnome-mpv], [http://github.com/gnome-mpv/gnome-mpv] ) AC_CONFIG_SRCDIR([src/main.c]) AC_USE_SYSTEM_EXTENSIONS AM_INIT_AUTOMAKE([1.12 tar-pax dist-xz no-dist-gzip subdir-objects foreign -Wall -Wno-portability]) AM_SILENT_RULES([yes]) AM_MAINTAINER_MODE([enable]) # i18n IT_PROG_INTLTOOL([0.40.6]) GETTEXT_PACKAGE=gnome-mpv AC_SUBST(GETTEXT_PACKAGE) AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [GETTEXT package name]) AM_GLIB_GNU_GETTEXT GLIB_GSETTINGS AC_ARG_ENABLE([debug], AS_HELP_STRING([--enable-debug], [turn on debugging])) AC_ARG_ENABLE([opengl-cb], AS_HELP_STRING([--disable-opengl-cb], [disable support for opengl-cb, which is required to work on Wayland])) AC_DEFUN([GM_CHECK_AX_MACRO], [m4_ifndef([$1], [m4_fatal($1[ is not defined. Is autoconf-archive installed?])])]) GM_CHECK_AX_MACRO([AX_APPEND_COMPILE_FLAGS]) GM_CHECK_AX_MACRO([AX_APPEND_LINK_FLAGS]) GM_CHECK_AX_MACRO([AX_REQUIRE_DEFINED]) AX_REQUIRE_DEFINED([APPSTREAM_XML]) APPSTREAM_XML AS_IF([test "x$enable_debug" = "xyes"], [ AX_APPEND_COMPILE_FLAGS([-O0 -g -fsanitize=address]) ], [ AX_APPEND_COMPILE_FLAGS([-O2]) ]) AX_APPEND_COMPILE_FLAGS([ \ -std=gnu99 \ -funsigned-char \ -fstack-protector-strong \ -fPIE \ -fPIC \ -Wall \ -Wextra \ -Wconversion \ -Winline \ -Wno-padded \ -Wno-unused-parameter \ -Wstrict-prototypes \ -Wmissing-prototypes \ -Werror=implicit-function-declaration \ -Werror=pointer-arith \ -Werror=init-self \ -Werror=format-security \ -Werror=format=2 \ -Werror=missing-include-dirs \ -Werror=date-time \ ]) AX_APPEND_LINK_FLAGS([ \ -pie \ -Wl,-z,relro \ -Wl,-z,now \ ]) # Checks for programs. AC_PROG_CC AC_PROG_CC_STDC # Checks for libraries. AS_IF([test "x$enable_opengl_cb" != "xno"], [ AC_DEFINE([OPENGL_CB_ENABLED]) PKG_CHECK_MODULES(DEPS, [gtk+-3.0 >= 3.16 glib-2.0 >= 2.40 mpv >= 1.16 epoxy]) ], [ PKG_CHECK_MODULES(DEPS, [gtk+-3.0 >= 3.14 glib-2.0 >= 2.40 mpv >= 1.16]) ]) AC_DEFINE([GLIB_VERSION_MIN_REQUIRED], [GLIB_VERSION_2_40], [Dont warn using older APIs]) AC_DEFINE([GLIB_VERSION_MAX_ALLOWED], [GLIB_VERSION_2_40], [Prevents using newer APIs]) # Checks for header files. AC_CHECK_HEADERS([string.h stdio.h stdlib.h locale.h ctype.h execinfo.h]) AC_CHECK_FUNCS([setlocale backtrace backtrace_symbols_fd exit]) AC_CONFIG_FILES([Makefile src/Makefile data/Makefile po/Makefile.in]) AC_OUTPUT gnome-mpv-0.7/data/000077500000000000000000000000001265310212500141735ustar00rootroot00000000000000gnome-mpv-0.7/data/Makefile.am000066400000000000000000000013151265310212500162270ustar00rootroot00000000000000gsettings_SCHEMAS = org.gnome-mpv.gschema.xml @GSETTINGS_RULES@ appstream_in_files = gnome-mpv.appdata.xml.in appstream_XML = $(appstream_in_files:.xml.in=.xml) @INTLTOOL_XML_RULE@ @APPSTREAM_XML_RULES@ desktopdir = $(datadir)/applications desktop_in_files = gnome-mpv.desktop.in desktop_DATA = $(desktop_in_files:.desktop.in=.desktop) @INTLTOOL_DESKTOP_RULE@ icondir = $(datadir)/icons/hicolor/scalable/apps icon_DATA = gnome-mpv.svg symicondir = $(datadir)/icons/hicolor/symbolic/apps symicon_DATA = gnome-mpv-symbolic.svg EXTRA_DIST = $(gsettings_SCHEMAS) $(appstream_in_files) $(desktop_in_files) \ gnome-mpv.desktop gnome-mpv.svg gnome-mpv-symbolic.svg \ mpris_gdbus.xml org.gnome-mpv.gschema.xml.in gnome-mpv-0.7/data/gnome-mpv-symbolic.svg000066400000000000000000000005211265310212500204360ustar00rootroot00000000000000 gnome-mpv-0.7/data/gnome-mpv.appdata.xml.in000066400000000000000000000031241265310212500206400ustar00rootroot00000000000000 gnome-mpv.desktop CC-BY-SA-4.0 GPL-3.0+ GNOME MPV GTK+ frontend for mpv <_p> GNOME MPV is a simple GTK+ frontend for mpv, which is a very powerful media player capable of playing virtually all video and audio formats. The design of GNOME MPV is based on GNOME HIG, though it is not dependent on any GNOME libraries. GNOME MPV also offers an option to disable client-side decorations (CSD) for better compatibility with non-GNOME systems. <_p>Features:
    <_li>Drag and drop playlist <_li>Loading external mpv configuration files <_li>MPRIS2 D-Bus interface
http://gnome-mpv.github.io/images/screenshot-0.png <_caption>The main window showing the application in action http://gnome-mpv.github.io/images/screenshot-1.png <_caption>The main window with CSD disabled http://gnome-mpv.github.io/images/screenshot-2.png <_caption>The main window with playlist open http://gnome-mpv.github.io http://github.com/gnome-mpv/gnome-mpv/issues gnome-mpv_at_openmailbox.org
gnome-mpv-0.7/data/gnome-mpv.desktop.in000066400000000000000000000021171265310212500201010ustar00rootroot00000000000000[Desktop Entry] Version=1.0 _Name=GNOME MPV _Comment=GTK+ frontend for mpv Exec=gnome-mpv %U Icon=gnome-mpv Terminal=false Type=Application StartupNotify=true Categories=GTK;GNOME;AudioVideo;Player;Video; MimeType=application/ogg;application/x-ogg;application/sdp;application/smil;application/x-smil;application/streamingmedia;application/x-streamingmedia;application/vnd.rn-realmedia;application/vnd.rn-realmedia-vbr;audio/aac;audio/x-aac;audio/m4a;audio/x-m4a;audio/mp1;audio/x-mp1;audio/mp2;audio/x-mp2;audio/mp3;audio/x-mp3;audio/mpeg;audio/x-mpeg;audio/mpegurl;audio/x-mpegurl;audio/mpg;audio/x-mpg;audio/rn-mpeg;audio/scpls;audio/x-scpls;audio/vnd.rn-realaudio;audio/wav;audio/x-pn-windows-pcm;audio/x-realaudio;audio/x-pn-realaudio;audio/x-ms-wma;audio/x-pls;audio/x-wav;video/mpeg;video/x-mpeg;video/x-mpeg2;video/mp4;video/msvideo;video/x-msvideo;video/quicktime;video/vnd.rn-realvideo;video/x-ms-afs;video/x-ms-asf;video/x-ms-wmv;video/x-ms-wmx;video/x-ms-wvxvideo;video/x-avi;video/x-fli;video/x-flv;video/x-theora;video/x-matroska;video/webm;audio/x-flac;audio/x-vorbis+ogg;video/x-ogm+ogg; gnome-mpv-0.7/data/gnome-mpv.svg000066400000000000000000000005211265310212500166170ustar00rootroot00000000000000 gnome-mpv-0.7/data/mpris_gdbus.xml000066400000000000000000000041621265310212500172360ustar00rootroot00000000000000 gnome-mpv-0.7/data/org.gnome-mpv.gschema.xml.in000066400000000000000000000054211265310212500214250ustar00rootroot00000000000000 true Enable or disable dark theme true Enable or disable client-side decorations false Whether or not to make file chooser dialog remember last folder accessed false Whether or not to redirect mpv log messages to console '' Options to pass to mpv '' Path to mpv configuration file false Load or don't load mpv configuration file '' Path to mpv input configuration file false Load or don't load mpv input configuration file 640 Width of the window 480 Height of the window 1.0 Volume of player 250 Width of the playlist false Show or not show the playlist '' URI of the last folder accessed gnome-mpv-0.7/po/000077500000000000000000000000001265310212500137005ustar00rootroot00000000000000gnome-mpv-0.7/po/LINGUAS000066400000000000000000000000411265310212500147200ustar00rootroot00000000000000cs de_DE fr ja ro ru zh_CN zh_TW gnome-mpv-0.7/po/POTFILES.in000066400000000000000000000004431265310212500154560ustar00rootroot00000000000000[type: gettext/gsettings]data/org.gnome-mpv.gschema.xml.in [type: gettext/xml]data/gnome-mpv.appdata.xml.in [type: gettext/ini]data/gnome-mpv.desktop.in src/actionctl.c src/common.c src/main.c src/menu.c src/mpv.c src/open_loc_dialog.c src/playlist.c src/playlist_widget.c src/pref_dialog.c gnome-mpv-0.7/po/cs.po000066400000000000000000000205051265310212500146470ustar00rootroot00000000000000# Czech translations for gnome-mpv package # gnome-mpv # Copyright (C) 2015 THE gnome-mpv'S COPYRIGHT HOLDER # This file is distributed under the same license as the gnome-mpv package. # Tomáš Marný, 2015. # gnome-mpv , 2015. #zanata # gnome-mpv , 2016. #zanata msgid "" msgstr "" "Project-Id-Version: gnome-mpv 0.2\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2015-11-23 10:58-0500\n" "PO-Revision-Date: 2015-08-15 10:05-0400\n" "Last-Translator: Language-Team: Czech\n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: cs\n" "Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2\n" "X-Generator: Zanata 3.8.2\n" #: ../data/org.gnome-mpv.gschema.xml.in.h:1 msgid "Enable or disable dark theme" msgstr "" #: ../data/org.gnome-mpv.gschema.xml.in.h:2 msgid "Enable or disable client-side decorations" msgstr "" #: ../data/org.gnome-mpv.gschema.xml.in.h:3 msgid "" "Whether or not to make file chooser dialog remember last folder accessed" msgstr "" #: ../data/org.gnome-mpv.gschema.xml.in.h:4 msgid "Whether or not to redirect mpv log messages to console" msgstr "" #: ../data/org.gnome-mpv.gschema.xml.in.h:5 msgid "Options to pass to mpv" msgstr "" #: ../data/org.gnome-mpv.gschema.xml.in.h:6 msgid "Path to mpv configuration file" msgstr "" #: ../data/org.gnome-mpv.gschema.xml.in.h:7 msgid "Load or don't load mpv configuration file" msgstr "" #: ../data/org.gnome-mpv.gschema.xml.in.h:8 msgid "Path to mpv input configuration file" msgstr "" #: ../data/org.gnome-mpv.gschema.xml.in.h:9 msgid "Load or don't load mpv input configuration file" msgstr "" #: ../data/org.gnome-mpv.gschema.xml.in.h:10 msgid "Width of the window" msgstr "" #: ../data/org.gnome-mpv.gschema.xml.in.h:11 msgid "Height of the window" msgstr "" #: ../data/org.gnome-mpv.gschema.xml.in.h:12 msgid "Volume of player" msgstr "" #: ../data/org.gnome-mpv.gschema.xml.in.h:13 msgid "Width of the playlist" msgstr "" #: ../data/org.gnome-mpv.gschema.xml.in.h:14 msgid "Show or not show the playlist" msgstr "" #: ../data/org.gnome-mpv.gschema.xml.in.h:15 msgid "URI of the last folder accessed" msgstr "" #: ../data/gnome-mpv.appdata.xml.in.h:1 msgid "" "GNOME MPV is a simple GTK+ frontend for mpv, which is a very powerful media " "player capable of playing virtually all video and audio formats. The design " "of GNOME MPV is based on GNOME HIG, though it is not dependent on any GNOME " "libraries. GNOME MPV also offers an option to disable client-side " "decorations (CSD) for better compatibility with non-GNOME systems." msgstr "" #: ../data/gnome-mpv.appdata.xml.in.h:2 msgid "Features:" msgstr "" #: ../data/gnome-mpv.appdata.xml.in.h:3 msgid "Drag and drop playlist" msgstr "" #: ../data/gnome-mpv.appdata.xml.in.h:4 msgid "Loading external mpv configuration files" msgstr "" #: ../data/gnome-mpv.appdata.xml.in.h:5 msgid "MPRIS2 D-Bus interface" msgstr "" #: ../data/gnome-mpv.appdata.xml.in.h:6 msgid "The main window showing the application in action" msgstr "" #: ../data/gnome-mpv.appdata.xml.in.h:7 msgid "The main window with CSD disabled" msgstr "" #: ../data/gnome-mpv.appdata.xml.in.h:8 msgid "The main window with playlist open" msgstr "" #: ../data/gnome-mpv.desktop.in.h:1 ../src/main.c:552 msgid "GNOME MPV" msgstr "GNOME MPV" #: ../data/gnome-mpv.desktop.in.h:2 msgid "GTK+ frontend for mpv" msgstr "" #: ../src/actionctl.c:106 #, fuzzy msgid "Add File to Playlist" msgstr "_Přepnout seznam skladeb" #: ../src/actionctl.c:107 msgid "Open File" msgstr "Otevřít soubor" #: ../src/actionctl.c:110 ../src/actionctl.c:409 ../src/open_loc_dialog.c:83 #: ../src/playlist.c:60 ../src/pref_dialog.c:267 msgid "_Cancel" msgstr "_Zrušit" #: ../src/actionctl.c:112 ../src/actionctl.c:411 ../src/menu.c:121 #: ../src/menu.c:390 ../src/open_loc_dialog.c:81 msgid "_Open" msgstr "_Otevřít" #: ../src/actionctl.c:251 #, c-format msgid "" "Enabling or disabling client-side decorations requires restarting %s to take" " effect." msgstr "" "Povolení nebo zakázání dekorací na straně klienta vyžaduje restartování %s." #: ../src/actionctl.c:406 msgid "Load External…" msgstr "" #: ../src/actionctl.c:482 msgid "A GTK frontend for MPV" msgstr "GTK frontend pro MPV" #: ../src/common.c:236 msgid "Error" msgstr "" #: ../src/common.c:401 msgid "" "Keybindings that require Property Expansion are not supported and have been " "ignored." msgstr "" #: ../src/main.c:525 ../src/menu.c:138 msgid "_Preferences" msgstr "_Předvolby" #: ../src/main.c:526 ../src/menu.c:169 msgid "_About" msgstr "_O programu" #: ../src/main.c:527 ../src/menu.c:122 msgid "_Quit" msgstr "_Ukončit" #: ../src/main.c:677 #, c-format msgid "" "Preferences is now stored using GSettings. Your preferences have been " "migrated from the configuration file. A backup copy of the configuration " "file can be found at \"%s\"." msgstr "" #: ../src/menu.c:39 msgid "None" msgstr "" #. For simplicity, also dup the default string used when the #. * track has no title. #: ../src/menu.c:54 msgid "Unknown" msgstr "" #: ../src/menu.c:119 msgid "_File" msgstr "_Soubor" #: ../src/menu.c:125 ../src/menu.c:393 msgid "Open _Location" msgstr "_Otevřít umístění" #: ../src/menu.c:128 ../src/menu.c:296 msgid "_Save Playlist" msgstr "_Uložit seznam skladeb" #: ../src/menu.c:135 msgid "_Edit" msgstr "_Upravit" #: ../src/menu.c:145 msgid "_View" msgstr "_Zobrazit" #: ../src/menu.c:148 ../src/menu.c:292 msgid "_Toggle Playlist" msgstr "_Přepnout seznam skladeb" #: ../src/menu.c:151 msgid "_Fullscreen" msgstr "_Celá obrazovka" #: ../src/menu.c:154 ../src/menu.c:300 msgid "_Normal Size" msgstr "_Normální velikost" #: ../src/menu.c:157 ../src/menu.c:304 msgid "_Double Size" msgstr "_Dvojnásobná velikost" #: ../src/menu.c:160 ../src/menu.c:308 msgid "_Half Size" msgstr "_Poloviční velikost" #: ../src/menu.c:167 msgid "_Help" msgstr "_Nápověda" #: ../src/menu.c:179 ../src/menu.c:316 msgid "_Video Track" msgstr "" #: ../src/menu.c:196 ../src/menu.c:200 ../src/menu.c:346 ../src/menu.c:351 msgid "_Load External..." msgstr "" #: ../src/menu.c:210 ../src/menu.c:335 msgid "_Audio Track" msgstr "" #: ../src/menu.c:214 ../src/menu.c:339 msgid "S_ubtitle Track" msgstr "" #: ../src/mpv.c:304 msgid "Playing" msgstr "" #: ../src/mpv.c:596 #, c-format msgid "Playback was terminated abnormally. Reason: %s." msgstr "" #: ../src/mpv.c:1087 msgid "Failed to apply one or more MPV options." msgstr "" #: ../src/open_loc_dialog.c:77 msgid "Location:" msgstr "Umístění:" #: ../src/open_loc_dialog.c:93 msgid "Open Location" msgstr "Otevřít umístění" #: ../src/playlist.c:57 #, fuzzy msgid "Save Playlist" msgstr "_Uložit seznam skladeb" #: ../src/playlist.c:62 ../src/pref_dialog.c:269 msgid "_Save" msgstr "_Uložit" #: ../src/playlist_widget.c:44 msgid "_Add…" msgstr "" #: ../src/playlist_widget.c:45 msgid "Loop" msgstr "" #: ../src/playlist_widget.c:90 msgid "Playlist" msgstr "Seznam skladeb" #: ../src/pref_dialog.c:105 msgid "MPV configuration file:" msgstr "Konfigurační soubor MPV:" #: ../src/pref_dialog.c:106 msgid "MPV input configuration file:" msgstr "Vstupní konfigurační soubor MPV:" #: ../src/pref_dialog.c:107 msgid "Extra MPV options:" msgstr "Extra možnosti MPV:" #: ../src/pref_dialog.c:108 msgid "General" msgstr "Hlavní" #: ../src/pref_dialog.c:109 msgid "MPV Configuration" msgstr "Nastavení MPV" #: ../src/pref_dialog.c:110 msgid "Keybindings" msgstr "Klávesové zkratky" #: ../src/pref_dialog.c:111 msgid "Miscellaneous" msgstr "Různé" #: ../src/pref_dialog.c:126 msgid "Enable client-side decorations" msgstr "Povolit dekorace na straně klienta" #: ../src/pref_dialog.c:130 msgid "Enable dark theme" msgstr "Povolit tmavý motiv" #: ../src/pref_dialog.c:134 msgid "Remember last file's location" msgstr "" #: ../src/pref_dialog.c:138 msgid "MPV configuration file" msgstr "Konfigurační soubor MPV" #: ../src/pref_dialog.c:143 msgid "MPV input configuration file" msgstr "Vstupní konfigurační soubor MPV" #: ../src/pref_dialog.c:148 msgid "Load MPV configuration file" msgstr "Načíst konfigurační soubor MPV" #: ../src/pref_dialog.c:152 msgid "Load MPV input configuration file" msgstr "Načíst vstupní konfigurační soubor MPV" #: ../src/pref_dialog.c:285 msgid "Preferences" msgstr "Předvolby" gnome-mpv-0.7/po/de_DE.po000066400000000000000000000212151265310212500152010ustar00rootroot00000000000000# German (de_DE) translations for gnome-mpv package. # gnome-mpv # Copyright (C) 2015 THE gnome-mpv'S COPYRIGHT HOLDER # This file is distributed under the same license as the gnone-mpv package. # Vincent Bermel , 2015. # gnome-mpv , 2015. #zanata # gnome-mpv , 2016. #zanata msgid "" msgstr "" "Project-Id-Version: gnome-mpv 0.6\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2015-11-23 10:58-0500\n" "PO-Revision-Date: 2015-10-26 07:55-0400\n" "Last-Translator: Vincent Bermel \n" "Language-Team: German Translations\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: de-DE\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" "X-Generator: Zanata 3.8.2\n" #: ../data/org.gnome-mpv.gschema.xml.in.h:1 msgid "Enable or disable dark theme" msgstr "" #: ../data/org.gnome-mpv.gschema.xml.in.h:2 msgid "Enable or disable client-side decorations" msgstr "" #: ../data/org.gnome-mpv.gschema.xml.in.h:3 msgid "" "Whether or not to make file chooser dialog remember last folder accessed" msgstr "" #: ../data/org.gnome-mpv.gschema.xml.in.h:4 msgid "Whether or not to redirect mpv log messages to console" msgstr "" #: ../data/org.gnome-mpv.gschema.xml.in.h:5 msgid "Options to pass to mpv" msgstr "" #: ../data/org.gnome-mpv.gschema.xml.in.h:6 msgid "Path to mpv configuration file" msgstr "" #: ../data/org.gnome-mpv.gschema.xml.in.h:7 msgid "Load or don't load mpv configuration file" msgstr "" #: ../data/org.gnome-mpv.gschema.xml.in.h:8 msgid "Path to mpv input configuration file" msgstr "" #: ../data/org.gnome-mpv.gschema.xml.in.h:9 msgid "Load or don't load mpv input configuration file" msgstr "" #: ../data/org.gnome-mpv.gschema.xml.in.h:10 msgid "Width of the window" msgstr "" #: ../data/org.gnome-mpv.gschema.xml.in.h:11 msgid "Height of the window" msgstr "" #: ../data/org.gnome-mpv.gschema.xml.in.h:12 msgid "Volume of player" msgstr "" #: ../data/org.gnome-mpv.gschema.xml.in.h:13 msgid "Width of the playlist" msgstr "" #: ../data/org.gnome-mpv.gschema.xml.in.h:14 msgid "Show or not show the playlist" msgstr "" #: ../data/org.gnome-mpv.gschema.xml.in.h:15 msgid "URI of the last folder accessed" msgstr "" #: ../data/gnome-mpv.appdata.xml.in.h:1 msgid "" "GNOME MPV is a simple GTK+ frontend for mpv, which is a very powerful media " "player capable of playing virtually all video and audio formats. The design " "of GNOME MPV is based on GNOME HIG, though it is not dependent on any GNOME " "libraries. GNOME MPV also offers an option to disable client-side " "decorations (CSD) for better compatibility with non-GNOME systems." msgstr "" #: ../data/gnome-mpv.appdata.xml.in.h:2 msgid "Features:" msgstr "" #: ../data/gnome-mpv.appdata.xml.in.h:3 msgid "Drag and drop playlist" msgstr "" #: ../data/gnome-mpv.appdata.xml.in.h:4 msgid "Loading external mpv configuration files" msgstr "" #: ../data/gnome-mpv.appdata.xml.in.h:5 msgid "MPRIS2 D-Bus interface" msgstr "" #: ../data/gnome-mpv.appdata.xml.in.h:6 msgid "The main window showing the application in action" msgstr "" #: ../data/gnome-mpv.appdata.xml.in.h:7 msgid "The main window with CSD disabled" msgstr "" #: ../data/gnome-mpv.appdata.xml.in.h:8 msgid "The main window with playlist open" msgstr "" #: ../data/gnome-mpv.desktop.in.h:1 ../src/main.c:552 msgid "GNOME MPV" msgstr "GNOME MPV" #: ../data/gnome-mpv.desktop.in.h:2 msgid "GTK+ frontend for mpv" msgstr "" #: ../src/actionctl.c:106 msgid "Add File to Playlist" msgstr "Datei zur _Wiedergabeliste hinzufügen" #: ../src/actionctl.c:107 msgid "Open File" msgstr "Datei öffnen" #: ../src/actionctl.c:110 ../src/actionctl.c:409 ../src/open_loc_dialog.c:83 #: ../src/playlist.c:60 ../src/pref_dialog.c:267 msgid "_Cancel" msgstr "_Abbrechen" #: ../src/actionctl.c:112 ../src/actionctl.c:411 ../src/menu.c:121 #: ../src/menu.c:390 ../src/open_loc_dialog.c:81 msgid "_Open" msgstr "Ö_ffnen" #: ../src/actionctl.c:251 #, c-format msgid "" "Enabling or disabling client-side decorations requires restarting %s to take" " effect." msgstr "Die Änderungen erfordern einen Neustart von %s." #: ../src/actionctl.c:406 msgid "Load External…" msgstr "" #: ../src/actionctl.c:482 msgid "A GTK frontend for MPV" msgstr "Eine GTK-Oberfläche für MPV" #: ../src/common.c:236 msgid "Error" msgstr "" #: ../src/common.c:401 msgid "" "Keybindings that require Property Expansion are not supported and have been " "ignored." msgstr "" "Tastenbelegungen, die Property Expansion benötigen werden nicht unterstützt." #: ../src/main.c:525 ../src/menu.c:138 msgid "_Preferences" msgstr "_Einstellungen" #: ../src/main.c:526 ../src/menu.c:169 msgid "_About" msgstr "_Info" #: ../src/main.c:527 ../src/menu.c:122 msgid "_Quit" msgstr "_Beenden" #: ../src/main.c:677 #, c-format msgid "" "Preferences is now stored using GSettings. Your preferences have been " "migrated from the configuration file. A backup copy of the configuration " "file can be found at \"%s\"." msgstr "" "Die Benutzereinstellungen werden fortan von GSettings verwaltet. Ihre " "Einstellungen wurden aus der Konfigurationsdatei übernommen. Eine " "Sicherheitskopie dieser Datei befindet sich unter \"%s\"." #: ../src/menu.c:39 msgid "None" msgstr "" #. For simplicity, also dup the default string used when the #. * track has no title. #: ../src/menu.c:54 msgid "Unknown" msgstr "" #: ../src/menu.c:119 msgid "_File" msgstr "_Datei" #: ../src/menu.c:125 ../src/menu.c:393 msgid "Open _Location" msgstr "_Adresse öffnen" #: ../src/menu.c:128 ../src/menu.c:296 msgid "_Save Playlist" msgstr "Wiedergabeliste _speichern" #: ../src/menu.c:135 msgid "_Edit" msgstr "_Bearbeiten" #: ../src/menu.c:145 msgid "_View" msgstr "_Ansicht" #: ../src/menu.c:148 ../src/menu.c:292 msgid "_Toggle Playlist" msgstr "_Wiedergabeliste ein/aus" #: ../src/menu.c:151 msgid "_Fullscreen" msgstr "_Vollbild" #: ../src/menu.c:154 ../src/menu.c:300 msgid "_Normal Size" msgstr "_Normale Videogröße" #: ../src/menu.c:157 ../src/menu.c:304 msgid "_Double Size" msgstr "_Doppelte Videogröße" #: ../src/menu.c:160 ../src/menu.c:308 msgid "_Half Size" msgstr "_Halbe Videogröße" #: ../src/menu.c:167 msgid "_Help" msgstr "_Hilfe" #: ../src/menu.c:179 ../src/menu.c:316 msgid "_Video Track" msgstr "" #: ../src/menu.c:196 ../src/menu.c:200 ../src/menu.c:346 ../src/menu.c:351 msgid "_Load External..." msgstr "" #: ../src/menu.c:210 ../src/menu.c:335 msgid "_Audio Track" msgstr "" #: ../src/menu.c:214 ../src/menu.c:339 msgid "S_ubtitle Track" msgstr "" #: ../src/mpv.c:304 msgid "Playing" msgstr "" #: ../src/mpv.c:596 #, c-format msgid "Playback was terminated abnormally. Reason: %s." msgstr "" #: ../src/mpv.c:1087 msgid "Failed to apply one or more MPV options." msgstr "" #: ../src/open_loc_dialog.c:77 msgid "Location:" msgstr "Adresse:" #: ../src/open_loc_dialog.c:93 msgid "Open Location" msgstr "Adresse öffnen" #: ../src/playlist.c:57 msgid "Save Playlist" msgstr "Wiedergabeliste speichern" #: ../src/playlist.c:62 ../src/pref_dialog.c:269 msgid "_Save" msgstr "_Speichern" #: ../src/playlist_widget.c:44 msgid "_Add…" msgstr "" #: ../src/playlist_widget.c:45 msgid "Loop" msgstr "Wiederholen" #: ../src/playlist_widget.c:90 msgid "Playlist" msgstr "Wiedergabeliste" #: ../src/pref_dialog.c:105 msgid "MPV configuration file:" msgstr "MPV-Konfigurationsdatei" #: ../src/pref_dialog.c:106 msgid "MPV input configuration file:" msgstr "Datei mit MPV-Tastenbelegungen" #: ../src/pref_dialog.c:107 msgid "Extra MPV options:" msgstr "Weitere Optionen für MPV" #: ../src/pref_dialog.c:108 msgid "General" msgstr "Allgemein" #: ../src/pref_dialog.c:109 msgid "MPV Configuration" msgstr "MPV-Einstellungen" #: ../src/pref_dialog.c:110 msgid "Keybindings" msgstr "Tastenbelegungen" #: ../src/pref_dialog.c:111 msgid "Miscellaneous" msgstr "Sonstiges" #: ../src/pref_dialog.c:126 msgid "Enable client-side decorations" msgstr "Kombinierte Titel-/Menüleiste (CSD)" #: ../src/pref_dialog.c:130 msgid "Enable dark theme" msgstr "Dunkles Thema verwenden" #: ../src/pref_dialog.c:134 msgid "Remember last file's location" msgstr "Speicherort der zuletzt gespielten Datei merken" #: ../src/pref_dialog.c:138 msgid "MPV configuration file" msgstr "MPV-Konfigurationsdatei" #: ../src/pref_dialog.c:143 msgid "MPV input configuration file" msgstr "Datei mit MPV-Tastenbelegungen" #: ../src/pref_dialog.c:148 msgid "Load MPV configuration file" msgstr "MPV-Konfiguration aus Datei laden" #: ../src/pref_dialog.c:152 msgid "Load MPV input configuration file" msgstr "MPV-Tastenbelegung aus Datei laden" #: ../src/pref_dialog.c:285 msgid "Preferences" msgstr "Einstellungen" gnome-mpv-0.7/po/fr.po000066400000000000000000000213321265310212500146500ustar00rootroot00000000000000# French translations for gnome-mpv package # gnome-mpvパッケージに対する日本語翻訳. # Copyright (C) 2015 The gnome-mpv'u copyright holder # This file is distributed under the same license as the gnome-mpv package. # Harenome Ranaivorarivony Razanajato , 2015. # gnome-mpv , 2015. #zanata # gnome-mpv , 2016. #zanata msgid "" msgstr "" "Project-Id-Version: gnome-mpv 0.5\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2015-11-23 10:58-0500\n" "PO-Revision-Date: 2016-01-15 06:36-0500\n" "Last-Translator: gnome-mpv \n" "Language-Team: Français\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: fr\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" "X-Generator: Zanata 3.8.2\n" "X-Poedit-Basepath: ../src\n" "X-Poedit-SearchPath-0: .\n" "X-Poedit-SearchPathExcluded-0: mpv.c\n" #: ../data/org.gnome-mpv.gschema.xml.in.h:1 msgid "Enable or disable dark theme" msgstr "" #: ../data/org.gnome-mpv.gschema.xml.in.h:2 msgid "Enable or disable client-side decorations" msgstr "" #: ../data/org.gnome-mpv.gschema.xml.in.h:3 msgid "" "Whether or not to make file chooser dialog remember last folder accessed" msgstr "" #: ../data/org.gnome-mpv.gschema.xml.in.h:4 msgid "Whether or not to redirect mpv log messages to console" msgstr "" #: ../data/org.gnome-mpv.gschema.xml.in.h:5 msgid "Options to pass to mpv" msgstr "" #: ../data/org.gnome-mpv.gschema.xml.in.h:6 msgid "Path to mpv configuration file" msgstr "" #: ../data/org.gnome-mpv.gschema.xml.in.h:7 msgid "Load or don't load mpv configuration file" msgstr "" #: ../data/org.gnome-mpv.gschema.xml.in.h:8 msgid "Path to mpv input configuration file" msgstr "" #: ../data/org.gnome-mpv.gschema.xml.in.h:9 msgid "Load or don't load mpv input configuration file" msgstr "" #: ../data/org.gnome-mpv.gschema.xml.in.h:10 msgid "Width of the window" msgstr "" #: ../data/org.gnome-mpv.gschema.xml.in.h:11 msgid "Height of the window" msgstr "" #: ../data/org.gnome-mpv.gschema.xml.in.h:12 msgid "Volume of player" msgstr "" #: ../data/org.gnome-mpv.gschema.xml.in.h:13 msgid "Width of the playlist" msgstr "" #: ../data/org.gnome-mpv.gschema.xml.in.h:14 msgid "Show or not show the playlist" msgstr "" #: ../data/org.gnome-mpv.gschema.xml.in.h:15 msgid "URI of the last folder accessed" msgstr "" #: ../data/gnome-mpv.appdata.xml.in.h:1 msgid "" "GNOME MPV is a simple GTK+ frontend for mpv, which is a very powerful media " "player capable of playing virtually all video and audio formats. The design " "of GNOME MPV is based on GNOME HIG, though it is not dependent on any GNOME " "libraries. GNOME MPV also offers an option to disable client-side " "decorations (CSD) for better compatibility with non-GNOME systems." msgstr "" #: ../data/gnome-mpv.appdata.xml.in.h:2 msgid "Features:" msgstr "" #: ../data/gnome-mpv.appdata.xml.in.h:3 msgid "Drag and drop playlist" msgstr "" #: ../data/gnome-mpv.appdata.xml.in.h:4 msgid "Loading external mpv configuration files" msgstr "" #: ../data/gnome-mpv.appdata.xml.in.h:5 msgid "MPRIS2 D-Bus interface" msgstr "" #: ../data/gnome-mpv.appdata.xml.in.h:6 msgid "The main window showing the application in action" msgstr "" #: ../data/gnome-mpv.appdata.xml.in.h:7 msgid "The main window with CSD disabled" msgstr "" #: ../data/gnome-mpv.appdata.xml.in.h:8 msgid "The main window with playlist open" msgstr "" #: ../data/gnome-mpv.desktop.in.h:1 ../src/main.c:552 msgid "GNOME MPV" msgstr "GNOME MPV" #: ../data/gnome-mpv.desktop.in.h:2 msgid "GTK+ frontend for mpv" msgstr "" #: ../src/actionctl.c:106 #, fuzzy msgid "Add File to Playlist" msgstr "_Afficher la liste de lecture" #: ../src/actionctl.c:107 msgid "Open File" msgstr "Ouvrir un fichier" #: ../src/actionctl.c:110 ../src/actionctl.c:409 ../src/open_loc_dialog.c:83 #: ../src/playlist.c:60 ../src/pref_dialog.c:267 msgid "_Cancel" msgstr "_Annuler" #: ../src/actionctl.c:112 ../src/actionctl.c:411 ../src/menu.c:121 #: ../src/menu.c:390 ../src/open_loc_dialog.c:81 msgid "_Open" msgstr "_Ouvrir" #: ../src/actionctl.c:251 #, c-format msgid "" "Enabling or disabling client-side decorations requires restarting %s to take" " effect." msgstr "" "L'activation ou la désactivation des décorations fenêtre prendra effet après" " un redémarrage de %s." #: ../src/actionctl.c:406 msgid "Load External…" msgstr "" #: ../src/actionctl.c:482 msgid "A GTK frontend for MPV" msgstr "Une interface GTK pour MPV" #: ../src/common.c:236 msgid "Error" msgstr "" #: ../src/common.c:401 msgid "" "Keybindings that require Property Expansion are not supported and have been " "ignored." msgstr "" "Les raccourcis clavier qui reposent sur l'expansion de propriété sont " "ignorés car ils ne sont pas pris en charge." #: ../src/main.c:525 ../src/menu.c:138 msgid "_Preferences" msgstr "_Préférences" #: ../src/main.c:526 ../src/menu.c:169 msgid "_About" msgstr "À _propos" #: ../src/main.c:527 ../src/menu.c:122 msgid "_Quit" msgstr "_Quitter" #: ../src/main.c:677 #, c-format msgid "" "Preferences is now stored using GSettings. Your preferences have been " "migrated from the configuration file. A backup copy of the configuration " "file can be found at \"%s\"." msgstr "" #: ../src/menu.c:39 msgid "None" msgstr "" #. For simplicity, also dup the default string used when the #. * track has no title. #: ../src/menu.c:54 msgid "Unknown" msgstr "" #: ../src/menu.c:119 msgid "_File" msgstr "_Fichier" #: ../src/menu.c:125 ../src/menu.c:393 msgid "Open _Location" msgstr "Ouvrir un _répertoire" #: ../src/menu.c:128 ../src/menu.c:296 msgid "_Save Playlist" msgstr "_Enregistrer la liste de lecture" #: ../src/menu.c:135 msgid "_Edit" msgstr "É_diter" #: ../src/menu.c:145 msgid "_View" msgstr "_Vue" #: ../src/menu.c:148 ../src/menu.c:292 msgid "_Toggle Playlist" msgstr "_Afficher la liste de lecture" #: ../src/menu.c:151 msgid "_Fullscreen" msgstr "_Plein écran" #: ../src/menu.c:154 ../src/menu.c:300 msgid "_Normal Size" msgstr "Taille _Normale" #: ../src/menu.c:157 ../src/menu.c:304 msgid "_Double Size" msgstr "Taille _Double" #: ../src/menu.c:160 ../src/menu.c:308 msgid "_Half Size" msgstr "Taille _Moitié" #: ../src/menu.c:167 msgid "_Help" msgstr "_Aide" #: ../src/menu.c:179 ../src/menu.c:316 msgid "_Video Track" msgstr "" #: ../src/menu.c:196 ../src/menu.c:200 ../src/menu.c:346 ../src/menu.c:351 msgid "_Load External..." msgstr "" #: ../src/menu.c:210 ../src/menu.c:335 msgid "_Audio Track" msgstr "" #: ../src/menu.c:214 ../src/menu.c:339 msgid "S_ubtitle Track" msgstr "" #: ../src/mpv.c:304 msgid "Playing" msgstr "" #: ../src/mpv.c:596 #, c-format msgid "Playback was terminated abnormally. Reason: %s." msgstr "" #: ../src/mpv.c:1087 msgid "Failed to apply one or more MPV options." msgstr "" #: ../src/open_loc_dialog.c:77 msgid "Location:" msgstr "Emplacement:" #: ../src/open_loc_dialog.c:93 msgid "Open Location" msgstr "Ouvrir un répertoire" #: ../src/playlist.c:57 #, fuzzy msgid "Save Playlist" msgstr "_Enregistrer la liste de lecture" #: ../src/playlist.c:62 ../src/pref_dialog.c:269 msgid "_Save" msgstr "_Enregistrer" #: ../src/playlist_widget.c:44 msgid "_Add…" msgstr "" #: ../src/playlist_widget.c:45 msgid "Loop" msgstr "" #: ../src/playlist_widget.c:90 msgid "Playlist" msgstr "Liste de lecture" #: ../src/pref_dialog.c:105 msgid "MPV configuration file:" msgstr "Fichier de configuration MPV:" #: ../src/pref_dialog.c:106 msgid "MPV input configuration file:" msgstr "Fichier de configuration des raccourcis clavier MPV:" #: ../src/pref_dialog.c:107 msgid "Extra MPV options:" msgstr "Options supplémentaires pour MPV" #: ../src/pref_dialog.c:108 msgid "General" msgstr "Général" #: ../src/pref_dialog.c:109 msgid "MPV Configuration" msgstr "Configuration MPV" #: ../src/pref_dialog.c:110 msgid "Keybindings" msgstr "Raccourcis clavier" #: ../src/pref_dialog.c:111 msgid "Miscellaneous" msgstr "Divers" #: ../src/pref_dialog.c:126 msgid "Enable client-side decorations" msgstr "Activer les décorations fenêtre" #: ../src/pref_dialog.c:130 msgid "Enable dark theme" msgstr "Activer le thème sombre" #: ../src/pref_dialog.c:134 msgid "Remember last file's location" msgstr "" #: ../src/pref_dialog.c:138 msgid "MPV configuration file" msgstr "Fichier de configuration MPV" #: ../src/pref_dialog.c:143 msgid "MPV input configuration file" msgstr "Fichier de configuration MPV d'entrée" #: ../src/pref_dialog.c:148 msgid "Load MPV configuration file" msgstr "Charger un fichier de configuration MPV" #: ../src/pref_dialog.c:152 msgid "Load MPV input configuration file" msgstr "Charger un fichier de configuration des raccourcis clavier MPV" #: ../src/pref_dialog.c:285 msgid "Preferences" msgstr "Préférences" gnome-mpv-0.7/po/ja.po000066400000000000000000000210101265310212500146240ustar00rootroot00000000000000# Japanese translations for gnome-mpv package # gnome-mpvパッケージに対する日本語翻訳. # Copyright (C) 2015 THE gnome-mpv'S COPYRIGHT HOLDER # This file is distributed under the same license as the gnome-mpv package. # Tista , 2015. # gnome-mpv , 2015. #zanata # gnome-mpv , 2016. #zanata msgid "" msgstr "" "Project-Id-Version: gnome-mpv 0.2\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2015-11-23 10:58-0500\n" "PO-Revision-Date: 2016-01-11 11:19-0500\n" "Last-Translator: gnome-mpv \n" "Language-Team: Japanese <>\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: ja\n" "Plural-Forms: nplurals=1; plural=0;\n" "X-Generator: Zanata 3.8.2\n" #: ../data/org.gnome-mpv.gschema.xml.in.h:1 msgid "Enable or disable dark theme" msgstr "" #: ../data/org.gnome-mpv.gschema.xml.in.h:2 msgid "Enable or disable client-side decorations" msgstr "" #: ../data/org.gnome-mpv.gschema.xml.in.h:3 msgid "" "Whether or not to make file chooser dialog remember last folder accessed" msgstr "" #: ../data/org.gnome-mpv.gschema.xml.in.h:4 msgid "Whether or not to redirect mpv log messages to console" msgstr "" #: ../data/org.gnome-mpv.gschema.xml.in.h:5 msgid "Options to pass to mpv" msgstr "" #: ../data/org.gnome-mpv.gschema.xml.in.h:6 msgid "Path to mpv configuration file" msgstr "" #: ../data/org.gnome-mpv.gschema.xml.in.h:7 msgid "Load or don't load mpv configuration file" msgstr "" #: ../data/org.gnome-mpv.gschema.xml.in.h:8 msgid "Path to mpv input configuration file" msgstr "" #: ../data/org.gnome-mpv.gschema.xml.in.h:9 msgid "Load or don't load mpv input configuration file" msgstr "" #: ../data/org.gnome-mpv.gschema.xml.in.h:10 msgid "Width of the window" msgstr "" #: ../data/org.gnome-mpv.gschema.xml.in.h:11 msgid "Height of the window" msgstr "" #: ../data/org.gnome-mpv.gschema.xml.in.h:12 msgid "Volume of player" msgstr "" #: ../data/org.gnome-mpv.gschema.xml.in.h:13 msgid "Width of the playlist" msgstr "" #: ../data/org.gnome-mpv.gschema.xml.in.h:14 msgid "Show or not show the playlist" msgstr "" #: ../data/org.gnome-mpv.gschema.xml.in.h:15 msgid "URI of the last folder accessed" msgstr "" #: ../data/gnome-mpv.appdata.xml.in.h:1 msgid "" "GNOME MPV is a simple GTK+ frontend for mpv, which is a very powerful media " "player capable of playing virtually all video and audio formats. The design " "of GNOME MPV is based on GNOME HIG, though it is not dependent on any GNOME " "libraries. GNOME MPV also offers an option to disable client-side " "decorations (CSD) for better compatibility with non-GNOME systems." msgstr "" #: ../data/gnome-mpv.appdata.xml.in.h:2 msgid "Features:" msgstr "" #: ../data/gnome-mpv.appdata.xml.in.h:3 msgid "Drag and drop playlist" msgstr "" #: ../data/gnome-mpv.appdata.xml.in.h:4 msgid "Loading external mpv configuration files" msgstr "" #: ../data/gnome-mpv.appdata.xml.in.h:5 msgid "MPRIS2 D-Bus interface" msgstr "" #: ../data/gnome-mpv.appdata.xml.in.h:6 msgid "The main window showing the application in action" msgstr "" #: ../data/gnome-mpv.appdata.xml.in.h:7 msgid "The main window with CSD disabled" msgstr "" #: ../data/gnome-mpv.appdata.xml.in.h:8 msgid "The main window with playlist open" msgstr "" #: ../data/gnome-mpv.desktop.in.h:1 ../src/main.c:552 msgid "GNOME MPV" msgstr "GNOME MPV" #: ../data/gnome-mpv.desktop.in.h:2 msgid "GTK+ frontend for mpv" msgstr "" #: ../src/actionctl.c:106 msgid "Add File to Playlist" msgstr "プレイリストの表示・非表示" #: ../src/actionctl.c:107 msgid "Open File" msgstr "ファイルを開く" #: ../src/actionctl.c:110 ../src/actionctl.c:409 ../src/open_loc_dialog.c:83 #: ../src/playlist.c:60 ../src/pref_dialog.c:267 msgid "_Cancel" msgstr "キャンセル(_C)" #: ../src/actionctl.c:112 ../src/actionctl.c:411 ../src/menu.c:121 #: ../src/menu.c:390 ../src/open_loc_dialog.c:81 msgid "_Open" msgstr "開く(_O)" #: ../src/actionctl.c:251 #, c-format msgid "" "Enabling or disabling client-side decorations requires restarting %s to take" " effect." msgstr "CSDの有効・無効は %s の再起動が必要です。" #: ../src/actionctl.c:406 msgid "Load External…" msgstr "" #: ../src/actionctl.c:482 msgid "A GTK frontend for MPV" msgstr "MPVのGTKフロントエンド" #: ../src/common.c:236 msgid "Error" msgstr "" #: ../src/common.c:401 msgid "" "Keybindings that require Property Expansion are not supported and have been " "ignored." msgstr "拡張キーバインドはサポートされず、無効化されます。" #: ../src/main.c:525 ../src/menu.c:138 msgid "_Preferences" msgstr "設定(_P)" #: ../src/main.c:526 ../src/menu.c:169 msgid "_About" msgstr "このアプリケーションについて(_A)" #: ../src/main.c:527 ../src/menu.c:122 msgid "_Quit" msgstr "終了(_Q)" #: ../src/main.c:677 #, c-format msgid "" "Preferences is now stored using GSettings. Your preferences have been " "migrated from the configuration file. A backup copy of the configuration " "file can be found at \"%s\"." msgstr "" #: ../src/menu.c:39 msgid "None" msgstr "" #. For simplicity, also dup the default string used when the #. * track has no title. #: ../src/menu.c:54 msgid "Unknown" msgstr "" #: ../src/menu.c:119 msgid "_File" msgstr "ファイル(_F)" #: ../src/menu.c:125 ../src/menu.c:393 msgid "Open _Location" msgstr "開く場所(_L)" #: ../src/menu.c:128 ../src/menu.c:296 msgid "_Save Playlist" msgstr "プレイリストの保存(_S)" #: ../src/menu.c:135 msgid "_Edit" msgstr "編集(_E)" #: ../src/menu.c:145 msgid "_View" msgstr "表示(_V)" #: ../src/menu.c:148 ../src/menu.c:292 msgid "_Toggle Playlist" msgstr "プレイリストの表示・非表示(_T)" #: ../src/menu.c:151 msgid "_Fullscreen" msgstr "全画面表示(_F)" #: ../src/menu.c:154 ../src/menu.c:300 msgid "_Normal Size" msgstr "通常のサイズ(_N)" #: ../src/menu.c:157 ../src/menu.c:304 msgid "_Double Size" msgstr "2倍のサイズ(_D)" #: ../src/menu.c:160 ../src/menu.c:308 msgid "_Half Size" msgstr "半分のサイズ(_H)" #: ../src/menu.c:167 msgid "_Help" msgstr "ヘルプ(_H)" #: ../src/menu.c:179 ../src/menu.c:316 msgid "_Video Track" msgstr "" #: ../src/menu.c:196 ../src/menu.c:200 ../src/menu.c:346 ../src/menu.c:351 msgid "_Load External..." msgstr "" #: ../src/menu.c:210 ../src/menu.c:335 msgid "_Audio Track" msgstr "" #: ../src/menu.c:214 ../src/menu.c:339 msgid "S_ubtitle Track" msgstr "" #: ../src/mpv.c:304 msgid "Playing" msgstr "" #: ../src/mpv.c:596 #, c-format msgid "Playback was terminated abnormally. Reason: %s." msgstr "" #: ../src/mpv.c:1087 msgid "Failed to apply one or more MPV options." msgstr "" #: ../src/open_loc_dialog.c:77 msgid "Location:" msgstr "場所:" #: ../src/open_loc_dialog.c:93 msgid "Open Location" msgstr "場所を開く" #: ../src/playlist.c:57 #, fuzzy msgid "Save Playlist" msgstr "_プレイリストの保存" #: ../src/playlist.c:62 ../src/pref_dialog.c:269 msgid "_Save" msgstr "保存(_S)" #: ../src/playlist_widget.c:44 msgid "_Add…" msgstr "" #: ../src/playlist_widget.c:45 msgid "Loop" msgstr "" #: ../src/playlist_widget.c:90 msgid "Playlist" msgstr "プレイリスト" #: ../src/pref_dialog.c:105 msgid "MPV configuration file:" msgstr "MPV設定ファイル:" #: ../src/pref_dialog.c:106 msgid "MPV input configuration file:" msgstr "MPV入力設定ファイル:" #: ../src/pref_dialog.c:107 msgid "Extra MPV options:" msgstr "その他のMPVオプション:" #: ../src/pref_dialog.c:108 msgid "General" msgstr "一般" #: ../src/pref_dialog.c:109 msgid "MPV Configuration" msgstr "MPVの設定" #: ../src/pref_dialog.c:110 msgid "Keybindings" msgstr "キーバインド" #: ../src/pref_dialog.c:111 msgid "Miscellaneous" msgstr "その他" #: ../src/pref_dialog.c:126 msgid "Enable client-side decorations" msgstr "CSDを有効にする" #: ../src/pref_dialog.c:130 msgid "Enable dark theme" msgstr "暗いテーマを有効にする" #: ../src/pref_dialog.c:134 msgid "Remember last file's location" msgstr "" #: ../src/pref_dialog.c:138 msgid "MPV configuration file" msgstr "MPV設定ファイル" #: ../src/pref_dialog.c:143 msgid "MPV input configuration file" msgstr "MPV入力設定ファイル" #: ../src/pref_dialog.c:148 msgid "Load MPV configuration file" msgstr "MPV設定ファイルをロードする" #: ../src/pref_dialog.c:152 msgid "Load MPV input configuration file" msgstr "MPV入力設定ファイルをロードする" #: ../src/pref_dialog.c:285 msgid "Preferences" msgstr "設定" gnome-mpv-0.7/po/ro.po000066400000000000000000000213361265310212500146650ustar00rootroot00000000000000# Romanian (ro_RO) translations for gnome-mpv package. # gnome-mpv # Copyright (C) 2015 THE gnome-mpv'S COPYRIGHT HOLDER # This file is distributed under the same license as the gnone-mpv package. # Robert Datcu , 2015. # gnome-mpv , 2015. #zanata # gnome-mpv , 2016. #zanata msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2016-01-19 16:48+0700\n" "PO-Revision-Date: 2016-01-15 06:40-0500\n" "Last-Translator: gnome-mpv \n" "Language-Team: Romanian Translations\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: ro\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" "X-Generator: Zanata 3.8.2\n" #: ../data/org.gnome-mpv.gschema.xml.in.h:1 msgid "Enable or disable dark theme" msgstr "" #: ../data/org.gnome-mpv.gschema.xml.in.h:2 msgid "Enable or disable client-side decorations" msgstr "" #: ../data/org.gnome-mpv.gschema.xml.in.h:3 msgid "" "Whether or not to make file chooser dialog remember last folder accessed" msgstr "" #: ../data/org.gnome-mpv.gschema.xml.in.h:4 msgid "Whether or not to redirect mpv log messages to console" msgstr "" #: ../data/org.gnome-mpv.gschema.xml.in.h:5 msgid "Options to pass to mpv" msgstr "" #: ../data/org.gnome-mpv.gschema.xml.in.h:6 msgid "Path to mpv configuration file" msgstr "" #: ../data/org.gnome-mpv.gschema.xml.in.h:7 msgid "Load or don't load mpv configuration file" msgstr "" #: ../data/org.gnome-mpv.gschema.xml.in.h:8 msgid "Path to mpv input configuration file" msgstr "" #: ../data/org.gnome-mpv.gschema.xml.in.h:9 msgid "Load or don't load mpv input configuration file" msgstr "" #: ../data/org.gnome-mpv.gschema.xml.in.h:10 msgid "Width of the window" msgstr "" #: ../data/org.gnome-mpv.gschema.xml.in.h:11 msgid "Height of the window" msgstr "" #: ../data/org.gnome-mpv.gschema.xml.in.h:12 msgid "Volume of player" msgstr "" #: ../data/org.gnome-mpv.gschema.xml.in.h:13 msgid "Width of the playlist" msgstr "" #: ../data/org.gnome-mpv.gschema.xml.in.h:14 msgid "Show or not show the playlist" msgstr "" #: ../data/org.gnome-mpv.gschema.xml.in.h:15 msgid "URI of the last folder accessed" msgstr "" #: ../data/gnome-mpv.appdata.xml.in.h:1 msgid "" "GNOME MPV is a simple GTK+ frontend for mpv, which is a very powerful media " "player capable of playing virtually all video and audio formats. The design " "of GNOME MPV is based on GNOME HIG, though it is not dependent on any GNOME " "libraries. GNOME MPV also offers an option to disable client-side " "decorations (CSD) for better compatibility with non-GNOME systems." msgstr "" #: ../data/gnome-mpv.appdata.xml.in.h:2 msgid "Features:" msgstr "" #: ../data/gnome-mpv.appdata.xml.in.h:3 msgid "Drag and drop playlist" msgstr "" #: ../data/gnome-mpv.appdata.xml.in.h:4 msgid "Loading external mpv configuration files" msgstr "" #: ../data/gnome-mpv.appdata.xml.in.h:5 msgid "MPRIS2 D-Bus interface" msgstr "" #: ../data/gnome-mpv.appdata.xml.in.h:6 msgid "The main window showing the application in action" msgstr "" #: ../data/gnome-mpv.appdata.xml.in.h:7 msgid "The main window with CSD disabled" msgstr "" #: ../data/gnome-mpv.appdata.xml.in.h:8 msgid "The main window with playlist open" msgstr "" #: ../data/gnome-mpv.desktop.in.h:1 ../src/main.c:552 msgid "GNOME MPV" msgstr "GNOME MPV" #: ../data/gnome-mpv.desktop.in.h:2 msgid "GTK+ frontend for mpv" msgstr "" #: ../src/actionctl.c:106 msgid "Add File to Playlist" msgstr "Adaugă un fișier Listei de Redare" #: ../src/actionctl.c:107 msgid "Open File" msgstr "Deschide Fișier" #: ../src/actionctl.c:110 ../src/actionctl.c:409 ../src/open_loc_dialog.c:83 #: ../src/playlist.c:60 ../src/pref_dialog.c:267 msgid "_Cancel" msgstr "_Anulează" #: ../src/actionctl.c:112 ../src/actionctl.c:411 ../src/menu.c:121 #: ../src/menu.c:390 ../src/open_loc_dialog.c:81 msgid "_Open" msgstr "_Deschide" #: ../src/actionctl.c:251 #, c-format msgid "" "Enabling or disabling client-side decorations requires restarting %s to take" " effect." msgstr "" "Activarea sau dezactivarea decorațiilor ferestrelor (CSD) necesită " "repornirea %s." #: ../src/actionctl.c:406 msgid "Load External…" msgstr "" #: ../src/actionctl.c:482 msgid "A GTK frontend for MPV" msgstr "O interfață GTK pentru MPV" #: ../src/common.c:236 msgid "Error" msgstr "" #: ../src/common.c:401 msgid "" "Keybindings that require Property Expansion are not supported and have been " "ignored." msgstr "" "Combinațiile de taste care necesită extinderea proprietăților nu sunt " "suportate și au fost ignorate." #: ../src/main.c:525 ../src/menu.c:138 msgid "_Preferences" msgstr "_Preferințe" #: ../src/main.c:526 ../src/menu.c:169 msgid "_About" msgstr "_Despre" #: ../src/main.c:527 ../src/menu.c:122 msgid "_Quit" msgstr "Î_nchide" #: ../src/main.c:677 #, c-format msgid "" "Preferences is now stored using GSettings. Your preferences have been " "migrated from the configuration file. A backup copy of the configuration " "file can be found at \"%s\"." msgstr "" "Preferințele sunt stocate folosind GSettings. Preferințele tale au fost " "transferate din fișierul de configurare. O copie de rezervă a fișierului de " "configurare poate fi găsită la \"%s\"." #: ../src/menu.c:39 msgid "None" msgstr "" #. For simplicity, also dup the default string used when the #. * track has no title. #: ../src/menu.c:54 msgid "Unknown" msgstr "" #: ../src/menu.c:119 msgid "_File" msgstr "_Fișier" #: ../src/menu.c:125 ../src/menu.c:393 msgid "Open _Location" msgstr "_Deschide Adresa" #: ../src/menu.c:128 ../src/menu.c:296 msgid "_Save Playlist" msgstr "_Salvează Lista Redare" #: ../src/menu.c:135 msgid "_Edit" msgstr "_Modifică" #: ../src/menu.c:145 msgid "_View" msgstr "_Vizualizare" #: ../src/menu.c:148 ../src/menu.c:292 msgid "_Toggle Playlist" msgstr "_Afișează Lista Redare" #: ../src/menu.c:151 msgid "_Fullscreen" msgstr "_Tot ecranul" #: ../src/menu.c:154 ../src/menu.c:300 msgid "_Normal Size" msgstr "_Dimensiune Normală" #: ../src/menu.c:157 ../src/menu.c:304 msgid "_Double Size" msgstr "_Dimensiune Dublă" #: ../src/menu.c:160 ../src/menu.c:308 msgid "_Half Size" msgstr "_Dimensiune Înjumătățită" #: ../src/menu.c:167 msgid "_Help" msgstr "_Ajutor" #: ../src/menu.c:179 ../src/menu.c:316 msgid "_Video Track" msgstr "" #: ../src/menu.c:196 ../src/menu.c:200 ../src/menu.c:346 ../src/menu.c:351 msgid "_Load External..." msgstr "" #: ../src/menu.c:210 ../src/menu.c:335 msgid "_Audio Track" msgstr "" #: ../src/menu.c:214 ../src/menu.c:339 msgid "S_ubtitle Track" msgstr "" #: ../src/mpv.c:304 msgid "Playing" msgstr "" #: ../src/mpv.c:596 #, c-format msgid "Playback was terminated abnormally. Reason: %s." msgstr "" #: ../src/mpv.c:1087 msgid "Failed to apply one or more MPV options." msgstr "" #: ../src/open_loc_dialog.c:77 msgid "Location:" msgstr "Adresă:" #: ../src/open_loc_dialog.c:93 msgid "Open Location" msgstr "Deschide Adresa" #: ../src/playlist.c:57 msgid "Save Playlist" msgstr "Salvează Lista de Redare" #: ../src/playlist.c:62 ../src/pref_dialog.c:269 msgid "_Save" msgstr "_Salvează" #: ../src/playlist_widget.c:44 msgid "_Add…" msgstr "" #: ../src/playlist_widget.c:45 msgid "Loop" msgstr "Buclă" #: ../src/playlist_widget.c:90 msgid "Playlist" msgstr "Listă de redare" #: ../src/pref_dialog.c:105 msgid "MPV configuration file:" msgstr "fișier configurare MPV:" #: ../src/pref_dialog.c:106 msgid "MPV input configuration file:" msgstr "fișier MPV configurare combinații taste:" #: ../src/pref_dialog.c:107 msgid "Extra MPV options:" msgstr "Extraopțiuni MPV:" #: ../src/pref_dialog.c:108 msgid "General" msgstr "General" #: ../src/pref_dialog.c:109 msgid "MPV Configuration" msgstr "Configurare MPV" #: ../src/pref_dialog.c:110 msgid "Keybindings" msgstr "Combinații Taste" #: ../src/pref_dialog.c:111 msgid "Miscellaneous" msgstr "Diverse" #: ../src/pref_dialog.c:126 msgid "Enable client-side decorations" msgstr "Activează decorațiile ferestrelor (CSD)" #: ../src/pref_dialog.c:130 msgid "Enable dark theme" msgstr "Activează tema întunecată" #: ../src/pref_dialog.c:134 msgid "Remember last file's location" msgstr "Ține minte adresa ultimului fișier" #: ../src/pref_dialog.c:138 msgid "MPV configuration file" msgstr "fișier configurare MPV" #: ../src/pref_dialog.c:143 msgid "MPV input configuration file" msgstr "fișier MPV combinații taste" #: ../src/pref_dialog.c:148 msgid "Load MPV configuration file" msgstr "Încarcă fișierul de configurare MPV" #: ../src/pref_dialog.c:152 msgid "Load MPV input configuration file" msgstr "Încarcă fișierul MPV de combinații taste" #: ../src/pref_dialog.c:285 msgid "Preferences" msgstr "Preferințe" gnome-mpv-0.7/po/ru.po000066400000000000000000000266601265310212500147000ustar00rootroot00000000000000# Maxim Orlov , 2016. #zanata msgid "" msgstr "" "Project-Id-Version: 0.6\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2016-01-04 00:00+0700\n" "PO-Revision-Date: 2016-01-22 03:02-0500\n" "Last-Translator: Maxim Orlov \n" "Language-Team: Russian\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" "X-Generator: Zanata 3.8.2\n" #: ../data/org.gnome-mpv.gschema.xml.in.h:1 msgid "Enable or disable dark theme" msgstr "Включить или отключить тёмную тему" #: ../data/org.gnome-mpv.gschema.xml.in.h:2 msgid "Enable or disable client-side decorations" msgstr "Включить или отключить CSD" #: ../data/org.gnome-mpv.gschema.xml.in.h:3 msgid "" "Whether or not to make file chooser dialog remember last folder accessed" msgstr "Запомнить или нет последнее расположение в диалоге открытия файла" #: ../data/org.gnome-mpv.gschema.xml.in.h:4 msgid "Whether or not to redirect mpv log messages to console" msgstr "Перенаправить выхлоп MPV в консоль" #: ../data/org.gnome-mpv.gschema.xml.in.h:5 msgid "Options to pass to mpv" msgstr "Перейти к опциям MPV" #: ../data/org.gnome-mpv.gschema.xml.in.h:6 msgid "Path to mpv configuration file" msgstr "Путь к файлу конфигурации MPV" #: ../data/org.gnome-mpv.gschema.xml.in.h:7 msgid "Load or don't load mpv configuration file" msgstr "Загрузить файл конфигурации MPV" #: ../data/org.gnome-mpv.gschema.xml.in.h:8 msgid "Path to mpv input configuration file" msgstr "Путь к файлу конфигурации ввода MPV" #: ../data/org.gnome-mpv.gschema.xml.in.h:9 msgid "Load or don't load mpv input configuration file" msgstr "Загрузить файл конфигурации ввода MPV" #: ../data/org.gnome-mpv.gschema.xml.in.h:10 msgid "Width of the window" msgstr "Ширина" #: ../data/org.gnome-mpv.gschema.xml.in.h:11 msgid "Height of the window" msgstr "Высота" #: ../data/org.gnome-mpv.gschema.xml.in.h:12 msgid "Volume of player" msgstr "Громкость" #: ../data/org.gnome-mpv.gschema.xml.in.h:13 msgid "Width of the playlist" msgstr "Ширина списка воспроизведения" #: ../data/org.gnome-mpv.gschema.xml.in.h:14 msgid "Show or not show the playlist" msgstr "Показать или скрыть список воспроизведения" #: ../data/org.gnome-mpv.gschema.xml.in.h:15 msgid "URI of the last folder accessed" msgstr "Адрес последнего открытого файла" #: ../data/gnome-mpv.appdata.xml.in.h:1 msgid "" "GNOME MPV is a simple GTK+ frontend for mpv, which is a very powerful media " "player capable of playing virtually all video and audio formats. The design " "of GNOME MPV is based on GNOME HIG, though it is not dependent on any GNOME " "libraries. GNOME MPV also offers an option to disable client-side " "decorations (CSD) for better compatibility with non-GNOME systems." msgstr "" "GNOME MPV - это простая GTK+ оболочка для MPV, поэтому является очень мощным" " медиаплеером, который способен воспроизводить практически все видео и аудио" " форматы. Дизайн GNOME MPV соответствует GNOME HIG. GNOME MPV также " "предлагает опцию, чтобы отключить декорирование на стороне клиента (CSD) для" " лучшей совместимости с системами, отличными от GNOME." #: ../data/gnome-mpv.appdata.xml.in.h:2 msgid "Features:" msgstr "Возможности:" #: ../data/gnome-mpv.appdata.xml.in.h:3 msgid "Drag and drop playlist" msgstr "Перетаскивание списка воспроизведения" #: ../data/gnome-mpv.appdata.xml.in.h:4 msgid "Loading external mpv configuration files" msgstr "Загрузка внешних конфигурационных файлов MPV" #: ../data/gnome-mpv.appdata.xml.in.h:5 msgid "MPRIS2 D-Bus interface" msgstr "Интерфейс MPRIS2 D-Bus" #: ../data/gnome-mpv.appdata.xml.in.h:6 msgid "The main window showing the application in action" msgstr "Главное окно, показывающее приложение в действии" #: ../data/gnome-mpv.appdata.xml.in.h:7 msgid "The main window with CSD disabled" msgstr "Главное окно с отключённым CSD" #: ../data/gnome-mpv.appdata.xml.in.h:8 msgid "The main window with playlist open" msgstr "Главное окно с открытым списком воспроизведения" #: ../data/gnome-mpv.desktop.in.h:1 ../src/main.c:552 msgid "GNOME MPV" msgstr "GNOME MPV" #: ../data/gnome-mpv.desktop.in.h:2 msgid "GTK+ frontend for mpv" msgstr "GTK+ интерфейс для MPV" #: ../src/actionctl.c:106 msgid "Add File to Playlist" msgstr "Добавить файл в список воспроизведения" #: ../src/actionctl.c:107 msgid "Open File" msgstr "Открыть файл" #: ../src/actionctl.c:110 ../src/actionctl.c:409 ../src/open_loc_dialog.c:83 #: ../src/playlist.c:60 ../src/pref_dialog.c:267 msgid "_Cancel" msgstr "_Отмена" #: ../src/actionctl.c:112 ../src/actionctl.c:411 ../src/menu.c:121 #: ../src/menu.c:390 ../src/open_loc_dialog.c:81 msgid "_Open" msgstr "_Открыть" #: ../src/actionctl.c:251 #, c-format msgid "" "Enabling or disabling client-side decorations requires restarting %s to take" " effect." msgstr "" "Чтобы изменения вступили в силу, необходимо перезапустить приложение %s." #: ../src/actionctl.c:406 msgid "Load External…" msgstr "Загрузить внешние…" #: ../src/actionctl.c:482 msgid "A GTK frontend for MPV" msgstr "GTK интерфейс для MPV" #: ../src/common.c:236 msgid "Error" msgstr "Ошибка" #: ../src/common.c:401 msgid "" "Keybindings that require Property Expansion are not supported and have been " "ignored." msgstr "" "Комбинации клавиш, которым требуются расширенные возможности не " "поддерживаются и были проигнорированы." #: ../src/main.c:525 ../src/menu.c:138 msgid "_Preferences" msgstr "_Настройки" #: ../src/main.c:526 ../src/menu.c:169 msgid "_About" msgstr "_О программе" #: ../src/main.c:527 ../src/menu.c:122 msgid "_Quit" msgstr "_Выйти" #: ../src/main.c:677 #, c-format msgid "" "Preferences is now stored using GSettings. Your preferences have been " "migrated from the configuration file. A backup copy of the configuration " "file can be found at \"%s\"." msgstr "" "Параметры настроек теперь хранятся посредством GSettings. Резервную копию " "файла конфигурации можно найти в \"%s\"." #: ../src/menu.c:39 msgid "None" msgstr "Ничего" #. For simplicity, also dup the default string used when the #. * track has no title. #: ../src/menu.c:54 msgid "Unknown" msgstr "Неизвестный" #: ../src/menu.c:119 msgid "_File" msgstr "_Файл" #: ../src/menu.c:125 ../src/menu.c:393 msgid "Open _Location" msgstr "Открыть _адрес" #: ../src/menu.c:128 ../src/menu.c:296 msgid "_Save Playlist" msgstr "_Сохранить список воспроизведения" #: ../src/menu.c:135 msgid "_Edit" msgstr "_Правка" #: ../src/menu.c:145 msgid "_View" msgstr "_Вид" #: ../src/menu.c:148 ../src/menu.c:292 msgid "_Toggle Playlist" msgstr "_Показать / Скрыть список воспроизведения" #: ../src/menu.c:151 msgid "_Fullscreen" msgstr "_Полноэкранный режим" #: ../src/menu.c:154 ../src/menu.c:300 msgid "_Normal Size" msgstr "_Нормальный размер" #: ../src/menu.c:157 ../src/menu.c:304 msgid "_Double Size" msgstr "_Двойной размер" #: ../src/menu.c:160 ../src/menu.c:308 msgid "_Half Size" msgstr "_Половинный размер" #: ../src/menu.c:167 msgid "_Help" msgstr "_Справка" #: ../src/menu.c:179 ../src/menu.c:316 msgid "_Video Track" msgstr "_Видео дорожка" #: ../src/menu.c:196 ../src/menu.c:200 ../src/menu.c:346 ../src/menu.c:351 msgid "_Load External..." msgstr "_Загрузить внешние…" #: ../src/menu.c:210 ../src/menu.c:335 msgid "_Audio Track" msgstr "_Аудио дорожка" #: ../src/menu.c:214 ../src/menu.c:339 msgid "S_ubtitle Track" msgstr "Дорожка с_убтитров" #: ../src/mpv.c:304 msgid "Playing" msgstr "Воспроизведение" #: ../src/mpv.c:596 #, c-format msgid "Playback was terminated abnormally. Reason: %s." msgstr "Воспроизведение было прекращено. Причина: %s." #: ../src/mpv.c:1087 msgid "Failed to apply one or more MPV options." msgstr "Не удалось применить одну или несколько опций MPV." #: ../src/open_loc_dialog.c:77 msgid "Location:" msgstr "Адрес:" #: ../src/open_loc_dialog.c:93 msgid "Open Location" msgstr "Открыть адрес" #: ../src/playlist.c:57 msgid "Save Playlist" msgstr "Сохранить список воспроизведения" #: ../src/playlist.c:62 ../src/pref_dialog.c:269 msgid "_Save" msgstr "_Сохранить" #: ../src/playlist_widget.c:44 msgid "_Add…" msgstr "_Добавить…" #: ../src/playlist_widget.c:45 msgid "Loop" msgstr "Повторить" #: ../src/playlist_widget.c:90 msgid "Playlist" msgstr "Список воспроизведения" #: ../src/pref_dialog.c:105 msgid "MPV configuration file:" msgstr "Файл конфигурации MPV:" #: ../src/pref_dialog.c:106 msgid "MPV input configuration file:" msgstr "Файл конфигурации ввода MPV:" #: ../src/pref_dialog.c:107 msgid "Extra MPV options:" msgstr "Дополнительные опции MPV:" #: ../src/pref_dialog.c:108 msgid "General" msgstr "Общие" #: ../src/pref_dialog.c:109 msgid "MPV Configuration" msgstr "Конфигурация MPV" #: ../src/pref_dialog.c:110 msgid "Keybindings" msgstr "Комбинации клавиш" #: ../src/pref_dialog.c:111 msgid "Miscellaneous" msgstr "Разное" #: ../src/pref_dialog.c:126 msgid "Enable client-side decorations" msgstr "Включить / Отключить CSD" #: ../src/pref_dialog.c:130 msgid "Enable dark theme" msgstr "Использовать тёмный вариант темы" #: ../src/pref_dialog.c:134 msgid "Remember last file's location" msgstr "Запомнить последнее расположение файла" #: ../src/pref_dialog.c:138 msgid "MPV configuration file" msgstr "Файл конфигурации MPV" #: ../src/pref_dialog.c:143 msgid "MPV input configuration file" msgstr "Файл конфигурации ввода MPV" #: ../src/pref_dialog.c:148 msgid "Load MPV configuration file" msgstr "Загрузить файл конфигурации MPV" #: ../src/pref_dialog.c:152 msgid "Load MPV input configuration file" msgstr "Загрузить файл конфигурации ввода MPV" #: ../src/pref_dialog.c:285 msgid "Preferences" msgstr "Настройки" gnome-mpv-0.7/po/zh_CN.po000066400000000000000000000232741265310212500152510ustar00rootroot00000000000000# Chinese translations for gnome-mpv package # gnome-mpv 软件包的简体中文翻译. # Copyright (C) 2015 THE GNOME-MPV'S COPYRIGHT HOLDER # This file is distributed under the same license as the gnome-mpv package. # sun , 2015. # Mingye Wang , 2015. # gnome-mpv , 2015. #zanata # Mingye Wang , 2016. #zanata msgid "" msgstr "" "Project-Id-Version: gnome-mpv 0.6\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2015-11-16 21:24+0800\n" "PO-Revision-Date: 2016-01-24 12:32-0500\n" "Last-Translator: Mingye Wang \n" "Language-Team: AOSC zh_CN \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: zh-CN\n" "Plural-Forms: nplurals=1; plural=0;\n" "X-Generator: Zanata 3.8.2\n" #: ../data/org.gnome-mpv.gschema.xml.in.h:1 msgid "Enable or disable dark theme" msgstr "启用或禁用暗色主题" #: ../data/org.gnome-mpv.gschema.xml.in.h:2 msgid "Enable or disable client-side decorations" msgstr "启用或禁用客户端装饰" #: ../data/org.gnome-mpv.gschema.xml.in.h:3 msgid "" "Whether or not to make file chooser dialog remember last folder accessed" msgstr "是否让文件选择对话框记住最近访问的文件夹" #: ../data/org.gnome-mpv.gschema.xml.in.h:4 msgid "Whether or not to redirect mpv log messages to console" msgstr "是否将 mpv 日志信息重定向到控制台" #: ../data/org.gnome-mpv.gschema.xml.in.h:5 msgid "Options to pass to mpv" msgstr "要传递给 mpv 的选项" #: ../data/org.gnome-mpv.gschema.xml.in.h:6 msgid "Path to mpv configuration file" msgstr "mpv 配置文件的路径" #: ../data/org.gnome-mpv.gschema.xml.in.h:7 msgid "Load or don't load mpv configuration file" msgstr "是否载入 mpv 配置文件" #: ../data/org.gnome-mpv.gschema.xml.in.h:8 msgid "Path to mpv input configuration file" msgstr "mpv 输入配置文件的路径" #: ../data/org.gnome-mpv.gschema.xml.in.h:9 msgid "Load or don't load mpv input configuration file" msgstr "是否载入 mpv 输入配置文件" #: ../data/org.gnome-mpv.gschema.xml.in.h:10 msgid "Width of the window" msgstr "窗口宽度" #: ../data/org.gnome-mpv.gschema.xml.in.h:11 msgid "Height of the window" msgstr "窗口高度" #: ../data/org.gnome-mpv.gschema.xml.in.h:12 msgid "Volume of player" msgstr "播放器音量" #: ../data/org.gnome-mpv.gschema.xml.in.h:13 msgid "Width of the playlist" msgstr "播放列表宽度" #: ../data/org.gnome-mpv.gschema.xml.in.h:14 msgid "Show or not show the playlist" msgstr "是否显示播放列表" #: ../data/org.gnome-mpv.gschema.xml.in.h:15 msgid "URI of the last folder accessed" msgstr "最近访问的文件夹 URI" #: ../data/gnome-mpv.appdata.xml.in.h:1 msgid "" "GNOME MPV is a simple GTK+ frontend for mpv, which is a very powerful media " "player capable of playing virtually all video and audio formats. The design " "of GNOME MPV is based on GNOME HIG, though it is not dependent on any GNOME " "libraries. GNOME MPV also offers an option to disable client-side " "decorations (CSD) for better compatibility with non-GNOME systems." msgstr "" "GNOME MPV 是一个简单的 GTK+ mpv 前端,mpv 是一个功能强大的媒体播放器,可用于播放几乎所有的视频和音频格式。尽管该程序不依赖于任何" " GNOME 库,GNOME MPV 是一个基于 GNOME HIG(人机界面准则)设计的程序。GNOME MPV " "还提供禁用客户端装饰(CSD)的选项以为不运行 GNOME 的系统提供更好的兼容性。" #: ../data/gnome-mpv.appdata.xml.in.h:2 msgid "Features:" msgstr "特性:" #: ../data/gnome-mpv.appdata.xml.in.h:3 msgid "Drag and drop playlist" msgstr "拖放播放列表" #: ../data/gnome-mpv.appdata.xml.in.h:4 msgid "Loading external mpv configuration files" msgstr "正在载入外部 mpv 配置文件" #: ../data/gnome-mpv.appdata.xml.in.h:5 msgid "MPRIS2 D-Bus interface" msgstr "MPRIS2 D-Bus 界面" #: ../data/gnome-mpv.appdata.xml.in.h:6 msgid "The main window showing the application in action" msgstr "显示运行中应用的主窗口" #: ../data/gnome-mpv.appdata.xml.in.h:7 msgid "The main window with CSD disabled" msgstr "关闭了 CSD 的主窗口" #: ../data/gnome-mpv.appdata.xml.in.h:8 msgid "The main window with playlist open" msgstr "打开了播放列表的主窗口" #: ../data/gnome-mpv.desktop.in.h:1 ../src/main.c:552 msgid "GNOME MPV" msgstr "GNOME MPV" #: ../data/gnome-mpv.desktop.in.h:2 msgid "GTK+ frontend for mpv" msgstr "MPV 的 GTK 前端程序" #: ../src/actionctl.c:106 msgid "Add File to Playlist" msgstr "添加文件到播放列表" #: ../src/actionctl.c:107 msgid "Open File" msgstr "打开文件" #: ../src/actionctl.c:110 ../src/actionctl.c:409 ../src/open_loc_dialog.c:83 #: ../src/playlist.c:60 ../src/pref_dialog.c:267 msgid "_Cancel" msgstr "取消(_C)" #: ../src/actionctl.c:112 ../src/actionctl.c:411 ../src/menu.c:121 #: ../src/menu.c:390 ../src/open_loc_dialog.c:81 msgid "_Open" msgstr "打开(_O)" #: ../src/actionctl.c:251 #, c-format msgid "" "Enabling or disabling client-side decorations requires restarting %s to take" " effect." msgstr "启用或禁用客户端装饰需要重启 %s 生效。" #: ../src/actionctl.c:406 msgid "Load External…" msgstr "载入外部配置文件…" #: ../src/actionctl.c:482 msgid "A GTK frontend for MPV" msgstr "MPV 的 GTK 前端程序" #: ../src/common.c:236 msgid "Error" msgstr "错误" #: ../src/common.c:401 msgid "" "Keybindings that require Property Expansion are not supported and have been " "ignored." msgstr "需要属性扩展的键绑定不被支持,已被忽略。" #: ../src/main.c:525 ../src/menu.c:138 msgid "_Preferences" msgstr "首选项(_P)" #: ../src/main.c:526 ../src/menu.c:169 msgid "_About" msgstr "关于(_A)" #: ../src/main.c:527 ../src/menu.c:122 msgid "_Quit" msgstr "退出(_Q)" #: ../src/main.c:677 #, c-format msgid "" "Preferences is now stored using GSettings. Your preferences have been " "migrated from the configuration file. A backup copy of the configuration " "file can be found at \"%s\"." msgstr "现在本软件使用 GSettings 存储首选项。您的首选项已从配置文件中迁移到 GSettings 中,配置文件的副本被保存在“%s”。" #: ../src/menu.c:39 msgid "None" msgstr "无" #. For simplicity, also dup the default string used when the #. * track has no title. #: ../src/menu.c:54 msgid "Unknown" msgstr "未知" #: ../src/menu.c:119 msgid "_File" msgstr "文件(_F)" #: ../src/menu.c:125 ../src/menu.c:393 msgid "Open _Location" msgstr "打开位置(_L)" #: ../src/menu.c:128 ../src/menu.c:296 msgid "_Save Playlist" msgstr "保存播放列表(_S)" #: ../src/menu.c:135 msgid "_Edit" msgstr "编辑(_E)" #: ../src/menu.c:145 msgid "_View" msgstr "视图(_V)" #: ../src/menu.c:148 ../src/menu.c:292 msgid "_Toggle Playlist" msgstr "切换播放列表(_T)" #: ../src/menu.c:151 msgid "_Fullscreen" msgstr "全屏(_F)" #: ../src/menu.c:154 ../src/menu.c:300 msgid "_Normal Size" msgstr "正常尺寸(_N)" #: ../src/menu.c:157 ../src/menu.c:304 msgid "_Double Size" msgstr "两倍尺寸(_D)" #: ../src/menu.c:160 ../src/menu.c:308 msgid "_Half Size" msgstr "一半尺寸(_H)" #: ../src/menu.c:167 msgid "_Help" msgstr "帮助(_F)" #: ../src/menu.c:179 ../src/menu.c:316 msgid "_Video Track" msgstr "视频轨道(_V)" #: ../src/menu.c:196 ../src/menu.c:200 ../src/menu.c:346 ../src/menu.c:351 msgid "_Load External..." msgstr "载入外部配置文件(_L)…" #: ../src/menu.c:210 ../src/menu.c:335 msgid "_Audio Track" msgstr "音轨(_A)" #: ../src/menu.c:214 ../src/menu.c:339 msgid "S_ubtitle Track" msgstr "字幕轨道(_U)" #: ../src/mpv.c:304 msgid "Playing" msgstr "正在播放" #: ../src/mpv.c:596 #, c-format msgid "Playback was terminated abnormally. Reason: %s." msgstr "回放被异常终止。原因:%s。" #: ../src/mpv.c:1087 msgid "Failed to apply one or more MPV options." msgstr "应用一个或多个 MPV 选项失败。" #: ../src/open_loc_dialog.c:77 msgid "Location:" msgstr "位置:" #: ../src/open_loc_dialog.c:93 msgid "Open Location" msgstr "打开位置" #: ../src/playlist.c:57 msgid "Save Playlist" msgstr "保存播放列表" #: ../src/playlist.c:62 ../src/pref_dialog.c:269 msgid "_Save" msgstr "保存(_S)" #: ../src/playlist_widget.c:44 msgid "_Add…" msgstr "添加(_A)…" #: ../src/playlist_widget.c:45 msgid "Loop" msgstr "循环" #: ../src/playlist_widget.c:90 msgid "Playlist" msgstr "播放列表" #: ../src/pref_dialog.c:105 msgid "MPV configuration file:" msgstr "MPV 配置文件:" #: ../src/pref_dialog.c:106 msgid "MPV input configuration file:" msgstr "MPV 输入配置文件:" #: ../src/pref_dialog.c:107 msgid "Extra MPV options:" msgstr "额外的 MPV 选项:" #: ../src/pref_dialog.c:108 msgid "General" msgstr "常规" #: ../src/pref_dialog.c:109 msgid "MPV Configuration" msgstr "MPV 配置" #: ../src/pref_dialog.c:110 msgid "Keybindings" msgstr "键绑定" #: ../src/pref_dialog.c:111 msgid "Miscellaneous" msgstr "杂项" #: ../src/pref_dialog.c:126 msgid "Enable client-side decorations" msgstr "启用客户端装饰" #: ../src/pref_dialog.c:130 msgid "Enable dark theme" msgstr "启用暗色主题" #: ../src/pref_dialog.c:134 msgid "Remember last file's location" msgstr "记住最后一次打开位置" #: ../src/pref_dialog.c:138 msgid "MPV configuration file" msgstr "MPV 配置文件" #: ../src/pref_dialog.c:143 msgid "MPV input configuration file" msgstr "MPV 输入配置文件" #: ../src/pref_dialog.c:148 msgid "Load MPV configuration file" msgstr "加载 MPV 配置文件" #: ../src/pref_dialog.c:152 msgid "Load MPV input configuration file" msgstr "加载 MPV 输入配置文件" #: ../src/pref_dialog.c:285 msgid "Preferences" msgstr "首选项" gnome-mpv-0.7/po/zh_TW.po000066400000000000000000000232221265310212500152740ustar00rootroot00000000000000# Chinese translations for gnome-mpv package # gnome-mpv 套件的正體中文翻譯 # Copyright (C) 2015 THE GNOME-MPV'S COPYRIGHT HOLDER # This file is distributed under the same license as the gnome-mpv package. # sun , 2015. # Mingye Wang , 2015. # gnome-mpv , 2015. #zanata # Mingye Wang , 2016. #zanata msgid "" msgstr "" "Project-Id-Version: gnome-mpv 0.6\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2015-11-16 21:24+0800\n" "PO-Revision-Date: 2016-01-24 12:32-0500\n" "Last-Translator: Mingye Wang \n" "Language-Team: zh_Hant \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: zh-TW\n" "Plural-Forms: nplurals=1; plural=0;\n" "X-Generator: Zanata 3.8.2\n" #: ../data/org.gnome-mpv.gschema.xml.in.h:1 msgid "Enable or disable dark theme" msgstr "啟用或禁用暗色主題" #: ../data/org.gnome-mpv.gschema.xml.in.h:2 msgid "Enable or disable client-side decorations" msgstr "啟用或禁用客戶端裝飾" #: ../data/org.gnome-mpv.gschema.xml.in.h:3 msgid "" "Whether or not to make file chooser dialog remember last folder accessed" msgstr "是否讓檔案選擇對話窗記住最近訪問的資料夾" #: ../data/org.gnome-mpv.gschema.xml.in.h:4 msgid "Whether or not to redirect mpv log messages to console" msgstr "是否將 mpv 日誌資訊重定向到控制檯" #: ../data/org.gnome-mpv.gschema.xml.in.h:5 msgid "Options to pass to mpv" msgstr "要傳遞給 mpv 的選項" #: ../data/org.gnome-mpv.gschema.xml.in.h:6 msgid "Path to mpv configuration file" msgstr "mpv 配置檔的路徑" #: ../data/org.gnome-mpv.gschema.xml.in.h:7 msgid "Load or don't load mpv configuration file" msgstr "是否載入 mpv 配置檔" #: ../data/org.gnome-mpv.gschema.xml.in.h:8 msgid "Path to mpv input configuration file" msgstr "mpv 輸入配置檔的路徑" #: ../data/org.gnome-mpv.gschema.xml.in.h:9 msgid "Load or don't load mpv input configuration file" msgstr "是否載入 mpv 輸入配置檔" #: ../data/org.gnome-mpv.gschema.xml.in.h:10 msgid "Width of the window" msgstr "視窗寬度" #: ../data/org.gnome-mpv.gschema.xml.in.h:11 msgid "Height of the window" msgstr "視窗高度" #: ../data/org.gnome-mpv.gschema.xml.in.h:12 msgid "Volume of player" msgstr "播放器音量" #: ../data/org.gnome-mpv.gschema.xml.in.h:13 msgid "Width of the playlist" msgstr "播放列表寬度" #: ../data/org.gnome-mpv.gschema.xml.in.h:14 msgid "Show or not show the playlist" msgstr "是否顯示播放列表" #: ../data/org.gnome-mpv.gschema.xml.in.h:15 msgid "URI of the last folder accessed" msgstr "最近訪問的資料夾 URI" #: ../data/gnome-mpv.appdata.xml.in.h:1 msgid "" "GNOME MPV is a simple GTK+ frontend for mpv, which is a very powerful media " "player capable of playing virtually all video and audio formats. The design " "of GNOME MPV is based on GNOME HIG, though it is not dependent on any GNOME " "libraries. GNOME MPV also offers an option to disable client-side " "decorations (CSD) for better compatibility with non-GNOME systems." msgstr "" "GNOME MPV 是一個簡單的 GTK+ mpv 前端,mpv 是一個功能強大的媒體播放器,可用於播放幾乎所有的視訊和音訊格式。儘管該程式不依賴於任何" " GNOME 庫,GNOME MPV 是一個基於 GNOME HIG(人機介面準則)設計的程式。GNOME MPV " "還提供禁用客戶端裝飾(CSD)的選項以為不執行 GNOME 的系統提供更好的相容性。" #: ../data/gnome-mpv.appdata.xml.in.h:2 msgid "Features:" msgstr "特性:" #: ../data/gnome-mpv.appdata.xml.in.h:3 msgid "Drag and drop playlist" msgstr "拖放播放列表" #: ../data/gnome-mpv.appdata.xml.in.h:4 msgid "Loading external mpv configuration files" msgstr "正在載入外部 mpv 配置檔" #: ../data/gnome-mpv.appdata.xml.in.h:5 msgid "MPRIS2 D-Bus interface" msgstr "MPRIS2 D-Bus 介面" #: ../data/gnome-mpv.appdata.xml.in.h:6 msgid "The main window showing the application in action" msgstr "顯示執行中套用的主視窗" #: ../data/gnome-mpv.appdata.xml.in.h:7 msgid "The main window with CSD disabled" msgstr "關閉了 CSD 的主視窗" #: ../data/gnome-mpv.appdata.xml.in.h:8 msgid "The main window with playlist open" msgstr "打開了播放列表的主視窗" #: ../data/gnome-mpv.desktop.in.h:1 ../src/main.c:552 msgid "GNOME MPV" msgstr "GNOME MPV" #: ../data/gnome-mpv.desktop.in.h:2 msgid "GTK+ frontend for mpv" msgstr "MPV 之 GTK 前端程式" #: ../src/actionctl.c:106 msgid "Add File to Playlist" msgstr "新增檔案到播放列表" #: ../src/actionctl.c:107 msgid "Open File" msgstr "開啟檔案" #: ../src/actionctl.c:110 ../src/actionctl.c:409 ../src/open_loc_dialog.c:83 #: ../src/playlist.c:60 ../src/pref_dialog.c:267 msgid "_Cancel" msgstr "取消(_C)" #: ../src/actionctl.c:112 ../src/actionctl.c:411 ../src/menu.c:121 #: ../src/menu.c:390 ../src/open_loc_dialog.c:81 msgid "_Open" msgstr "開啟(_O)" #: ../src/actionctl.c:251 #, c-format msgid "" "Enabling or disabling client-side decorations requires restarting %s to take" " effect." msgstr "啟用或禁用客戶端裝飾需要重啟 %s 生效。" #: ../src/actionctl.c:406 msgid "Load External…" msgstr "載入外部配置檔…" #: ../src/actionctl.c:482 msgid "A GTK frontend for MPV" msgstr "MPV 的 GTK 前端程式" #: ../src/common.c:236 msgid "Error" msgstr "錯誤" #: ../src/common.c:401 msgid "" "Keybindings that require Property Expansion are not supported and have been " "ignored." msgstr "不支援需要屬性擴充的鍵綁定,已被忽略。" #: ../src/main.c:525 ../src/menu.c:138 msgid "_Preferences" msgstr "偏好設定(_P)" #: ../src/main.c:526 ../src/menu.c:169 msgid "_About" msgstr "關於(_A)" #: ../src/main.c:527 ../src/menu.c:122 msgid "_Quit" msgstr "退出(_Q)" #: ../src/main.c:677 #, c-format msgid "" "Preferences is now stored using GSettings. Your preferences have been " "migrated from the configuration file. A backup copy of the configuration " "file can be found at \"%s\"." msgstr "現在本軟體使用 GSettings 儲存偏好設定。您的偏好設定已從配置檔中遷移到 GSettings 中,配置檔的副本被儲存在「%s」。" #: ../src/menu.c:39 msgid "None" msgstr "無" #. For simplicity, also dup the default string used when the #. * track has no title. #: ../src/menu.c:54 msgid "Unknown" msgstr "未知" #: ../src/menu.c:119 msgid "_File" msgstr "檔案(_F)" #: ../src/menu.c:125 ../src/menu.c:393 msgid "Open _Location" msgstr "開啟位置(_L)" #: ../src/menu.c:128 ../src/menu.c:296 msgid "_Save Playlist" msgstr "儲存播放列表(_S)" #: ../src/menu.c:135 msgid "_Edit" msgstr "編輯(_E)" #: ../src/menu.c:145 msgid "_View" msgstr "檢視(_V)" #: ../src/menu.c:148 ../src/menu.c:292 msgid "_Toggle Playlist" msgstr "切換播放列表(_T)" #: ../src/menu.c:151 msgid "_Fullscreen" msgstr "全屏(_F)" #: ../src/menu.c:154 ../src/menu.c:300 msgid "_Normal Size" msgstr "正常尺寸(_N)" #: ../src/menu.c:157 ../src/menu.c:304 msgid "_Double Size" msgstr "兩倍尺寸(_D)" #: ../src/menu.c:160 ../src/menu.c:308 msgid "_Half Size" msgstr "一半尺寸(_H)" #: ../src/menu.c:167 msgid "_Help" msgstr "幫助(_F)" #: ../src/menu.c:179 ../src/menu.c:316 msgid "_Video Track" msgstr "視訊軌道(_V)" #: ../src/menu.c:196 ../src/menu.c:200 ../src/menu.c:346 ../src/menu.c:351 msgid "_Load External..." msgstr "載入外部(_L)…" #: ../src/menu.c:210 ../src/menu.c:335 msgid "_Audio Track" msgstr "音軌(_A)" #: ../src/menu.c:214 ../src/menu.c:339 msgid "S_ubtitle Track" msgstr "字幕軌道(_U)" #: ../src/mpv.c:304 msgid "Playing" msgstr "正在播放" #: ../src/mpv.c:596 #, c-format msgid "Playback was terminated abnormally. Reason: %s." msgstr "回放被異常終止。原因:%s。" #: ../src/mpv.c:1087 msgid "Failed to apply one or more MPV options." msgstr "套用一個或多個 MPV 選項失敗。" #: ../src/open_loc_dialog.c:77 msgid "Location:" msgstr "位置:" #: ../src/open_loc_dialog.c:93 msgid "Open Location" msgstr "開啟位置" #: ../src/playlist.c:57 msgid "Save Playlist" msgstr "儲存播放列表" #: ../src/playlist.c:62 ../src/pref_dialog.c:269 msgid "_Save" msgstr "儲存(_S)" #: ../src/playlist_widget.c:44 msgid "_Add…" msgstr "新增(_A)…" #: ../src/playlist_widget.c:45 msgid "Loop" msgstr "迴圈" #: ../src/playlist_widget.c:90 msgid "Playlist" msgstr "播放列表" #: ../src/pref_dialog.c:105 msgid "MPV configuration file:" msgstr "MPV 配置檔:" #: ../src/pref_dialog.c:106 msgid "MPV input configuration file:" msgstr "MPV 輸入配置檔:" #: ../src/pref_dialog.c:107 msgid "Extra MPV options:" msgstr "額外的 MPV 選項:" #: ../src/pref_dialog.c:108 msgid "General" msgstr "常規" #: ../src/pref_dialog.c:109 msgid "MPV Configuration" msgstr "MPV 配置" #: ../src/pref_dialog.c:110 msgid "Keybindings" msgstr "鍵繫結" #: ../src/pref_dialog.c:111 msgid "Miscellaneous" msgstr "雜項" #: ../src/pref_dialog.c:126 msgid "Enable client-side decorations" msgstr "啟用客戶端裝飾" #: ../src/pref_dialog.c:130 msgid "Enable dark theme" msgstr "啟用暗色主題" #: ../src/pref_dialog.c:134 msgid "Remember last file's location" msgstr "記住最後一次開啟位置" #: ../src/pref_dialog.c:138 msgid "MPV configuration file" msgstr "MPV 配置檔" #: ../src/pref_dialog.c:143 msgid "MPV input configuration file" msgstr "MPV 輸入配置檔" #: ../src/pref_dialog.c:148 msgid "Load MPV configuration file" msgstr "載入 MPV 配置檔" #: ../src/pref_dialog.c:152 msgid "Load MPV input configuration file" msgstr "載入 MPV 輸入配置檔" #: ../src/pref_dialog.c:285 msgid "Preferences" msgstr "偏好設定" gnome-mpv-0.7/src/000077500000000000000000000000001265310212500140515ustar00rootroot00000000000000gnome-mpv-0.7/src/Makefile.am000066400000000000000000000023241265310212500161060ustar00rootroot00000000000000AUTOMAKE_OPTIONS = foreign bin_PROGRAMS = gnome-mpv mpris_generated = mpris/mpris_gdbus.c mpris/mpris_gdbus.h $(mpris_generated): $(top_srcdir)/data/mpris_gdbus.xml gdbus-codegen --c-namespace mpris --generate-c-code mpris/mpris_gdbus $< && \ sed -i '1i#pragma GCC diagnostic ignored \"-Wconversion\"' mpris/mpris_gdbus.c mpris_files = mpris/mpris.c mpris/mpris.h mpris/mpris_base.c \ mpris/mpris_base.h mpris/mpris_player.c mpris/mpris_player.h \ $(mpris_generated) media_key_files = media_keys/media_keys.c media_keys/media_keys.h BUILT_SOURCES = $(mpris_generated) gnome_mpv_SOURCES = main.c def.h \ actionctl.c actionctl.h \ common.c common.h \ control_box.c control_box.h \ keybind.c keybind.h \ main_window.c main_window.h \ menu.c menu.h \ mpv.c mpv.h \ open_loc_dialog.c open_loc_dialog.h \ playbackctl.c playbackctl.h \ playlist.c playlist.h \ playlist_widget.c playlist_widget.h \ pref_dialog.c pref_dialog.h \ pref_store.c pref_store.h \ track.c track.h \ $(mpris_files) $(media_key_files) gnome_mpv_CFLAGS = $(DEPS_CFLAGS) \ -DG_SETTINGS_ENABLE_BACKEND \ -DPACKAGE_LOCALEDIR=\""$(localedir)"\" gnome_mpv_LDADD = $(DEPS_LIBS) CLEANFILES = $(mpris_generated) gnome-mpv-0.7/src/actionctl.c000066400000000000000000000324341265310212500162030ustar00rootroot00000000000000/* * Copyright (c) 2015-2016 gnome-mpv * * This file is part of GNOME MPV. * * GNOME MPV 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. * * GNOME MPV 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 GNOME MPV. If not, see . */ #include #include "actionctl.h" #include "def.h" #include "mpv.h" #include "playlist.h" #include "open_loc_dialog.h" #include "pref_dialog.h" #include "common.h" #define G_SETTINGS_KEY_PREF_MAP(VAR, PREF) \ const struct \ { \ GType type; \ const gchar *key; \ gpointer value; \ } \ VAR[] = { {G_TYPE_BOOLEAN, "csd-enable", \ &pref->csd_enable}, \ {G_TYPE_BOOLEAN, "dark-theme-enable", \ &pref->dark_theme_enable}, \ {G_TYPE_BOOLEAN, "last-folder-enable", \ &pref->last_folder_enable}, \ {G_TYPE_BOOLEAN, "mpv-config-enable", \ &pref->mpv_config_enable}, \ {G_TYPE_BOOLEAN, "mpv-input-config-enable", \ &pref->mpv_input_config_enable}, \ {G_TYPE_STRING, "mpv-config-file", \ &pref->mpv_config_file}, \ {G_TYPE_STRING, "mpv-input-config-file", \ &pref->mpv_input_config_file}, \ {G_TYPE_STRING, "mpv-options", \ &pref->mpv_options}, \ {G_TYPE_INVALID, NULL, NULL} }; static void open_handler( GSimpleAction *action, GVariant *param, gpointer data ); static void open_loc_handler( GSimpleAction *action, GVariant *param, gpointer data ); static void pref_handler( GSimpleAction *action, GVariant *param, gpointer data ); static void quit_handler( GSimpleAction *action, GVariant *param, gpointer data ); static void track_select_handler( GSimpleAction *action, GVariant *param, gpointer data ); static void load_track_handler( GSimpleAction *action, GVariant *param, gpointer data ); static void fullscreen_handler( GSimpleAction *action, GVariant *param, gpointer data ); static void normal_size_handler( GSimpleAction *action, GVariant *param, gpointer data ); static void double_size_handler( GSimpleAction *action, GVariant *param, gpointer data ); static void half_size_handler( GSimpleAction *action, GVariant *param, gpointer data ); static void about_handler( GSimpleAction *action, GVariant *param, gpointer data ); static pref_store *get_pref(GSettings *settings); static void set_pref(GSettings *settings, pref_store *pref); static void open_handler( GSimpleAction *action, GVariant *param, gpointer data ) { gmpv_handle *ctx = data; GSettings *config = NULL; GtkFileChooser *file_chooser; GtkWidget *open_dialog; gboolean last_folder_enable; gboolean append; g_variant_get(param, "b", &append); open_dialog = gtk_file_chooser_dialog_new( append? _("Add File to Playlist"): _("Open File"), GTK_WINDOW(ctx->gui), GTK_FILE_CHOOSER_ACTION_OPEN, _("_Cancel"), GTK_RESPONSE_CANCEL, _("_Open"), GTK_RESPONSE_ACCEPT, NULL ); file_chooser = GTK_FILE_CHOOSER(open_dialog); last_folder_enable = g_settings_get_boolean( ctx->config, "last-folder-enable" ); if(last_folder_enable) { gchar *last_folder_uri; config = g_settings_new(CONFIG_WIN_STATE); last_folder_uri = g_settings_get_string (config, "last-folder-uri"); if(last_folder_uri && strlen(last_folder_uri) > 0) { gtk_file_chooser_set_current_folder_uri (file_chooser, last_folder_uri); } g_free(last_folder_uri); } gtk_file_chooser_set_select_multiple(file_chooser, TRUE); if(gtk_dialog_run(GTK_DIALOG(open_dialog)) == GTK_RESPONSE_ACCEPT) { GSList *uri_list = gtk_file_chooser_get_filenames(file_chooser); GSList *uri = uri_list; ctx->paused = FALSE; while(uri) { mpv_load( ctx, uri->data, (append || uri != uri_list), TRUE ); uri = g_slist_next(uri); } if(last_folder_enable) { gchar *last_folder_uri = gtk_file_chooser_get_current_folder_uri (file_chooser); g_settings_set_string (config, "last-folder-uri", last_folder_uri ?: "" ); g_free(last_folder_uri); } g_slist_free_full(uri_list, g_free); } gtk_widget_destroy(open_dialog); g_clear_object(&config); } static void open_loc_handler( GSimpleAction *action, GVariant *param, gpointer data ) { gmpv_handle *ctx = (gmpv_handle*)data; OpenLocDialog *open_loc_dialog; open_loc_dialog = OPEN_LOC_DIALOG(open_loc_dialog_new(GTK_WINDOW(ctx->gui))); if(gtk_dialog_run(GTK_DIALOG(open_loc_dialog)) == GTK_RESPONSE_ACCEPT) { const gchar *loc_str; loc_str = open_loc_dialog_get_string(open_loc_dialog); ctx->paused = FALSE; mpv_load(ctx, loc_str, FALSE, TRUE); } gtk_widget_destroy(GTK_WIDGET(open_loc_dialog)); } static void loop_handler( GSimpleAction *action, GVariant *value, gpointer data ) { gmpv_handle *ctx = data; gboolean loop = g_variant_get_boolean(value); g_simple_action_set_state(action, value); mpv_check_error(mpv_set_property_string( ctx->mpv_ctx, "loop", loop?"inf":"no" )); } static void pref_handler( GSimpleAction *action, GVariant *param, gpointer data ) { const gchar *quit_cmd[] = {"quit_watch_later", NULL}; gmpv_handle *ctx = data; pref_store *old_pref; pref_store *new_pref; PrefDialog *pref_dialog; old_pref = get_pref(ctx->config); pref_dialog = PREF_DIALOG(pref_dialog_new(GTK_WINDOW(ctx->gui))); pref_dialog_set_pref(pref_dialog, old_pref); if(gtk_dialog_run(GTK_DIALOG(pref_dialog)) == GTK_RESPONSE_ACCEPT) { gint64 playlist_pos; gdouble time_pos; gint playlist_pos_rc; gint time_pos_rc; new_pref = pref_dialog_get_pref(pref_dialog); set_pref(ctx->config, new_pref); if(old_pref->csd_enable != new_pref->csd_enable) { GtkWidget *dialog = gtk_message_dialog_new ( GTK_WINDOW(ctx->gui), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, _("Enabling or disabling " "client-side decorations " "requires restarting %s to " "take effect." ), g_get_application_name() ); gtk_dialog_run(GTK_DIALOG(dialog)); gtk_widget_destroy(dialog); } g_object_set( ctx->gui->settings, "gtk-application-prefer-dark-theme", new_pref->dark_theme_enable, NULL ); mpv_check_error(mpv_set_property_string( ctx->mpv_ctx, "pause", "yes" )); playlist_pos_rc = mpv_get_property( ctx->mpv_ctx, "playlist-pos", MPV_FORMAT_INT64, &playlist_pos ); time_pos_rc = mpv_get_property( ctx->mpv_ctx, "time-pos", MPV_FORMAT_DOUBLE, &time_pos ); /* Reset ctx->mpv_ctx */ mpv_check_error(mpv_command(ctx->mpv_ctx, quit_cmd)); mpv_quit(ctx); ctx->mpv_ctx = mpv_create(); mpv_init(ctx); mpv_set_wakeup_callback( ctx->mpv_ctx, mpv_wakeup_callback, ctx ); gtk_widget_queue_draw(GTK_WIDGET(ctx->gui)); if(ctx->playlist_store) { gint rc; rc = mpv_request_event( ctx->mpv_ctx, MPV_EVENT_FILE_LOADED, 0 ); mpv_check_error(rc); mpv_load(ctx, NULL, FALSE, TRUE); rc = mpv_request_event( ctx->mpv_ctx, MPV_EVENT_FILE_LOADED, 1 ); mpv_check_error(rc); if(playlist_pos_rc >= 0 && playlist_pos > 0) { mpv_set_property( ctx->mpv_ctx, "playlist-pos", MPV_FORMAT_INT64, &playlist_pos ); } if(time_pos_rc >= 0 && time_pos > 0) { mpv_set_property( ctx->mpv_ctx, "time-pos", MPV_FORMAT_DOUBLE, &time_pos ); } mpv_set_property( ctx->mpv_ctx, "pause", MPV_FORMAT_FLAG, &ctx->paused ); } load_keybind( ctx, new_pref->mpv_input_config_enable? new_pref->mpv_input_config_file:NULL, new_pref->mpv_input_config_enable ); pref_store_free(new_pref); } gtk_widget_destroy(GTK_WIDGET(pref_dialog)); pref_store_free(old_pref); } static void quit_handler( GSimpleAction *action, GVariant *param, gpointer data ) { quit(data); } static void track_select_handler( GSimpleAction *action, GVariant *value, gpointer data ) { gmpv_handle *ctx = data; gint64 id; gchar *name; const gchar *mpv_prop; g_object_get(action, "name", &name, NULL); g_variant_get(value, "x", &id); g_simple_action_set_state(action, value); if(g_strcmp0(name, "audio_select") == 0) { mpv_prop = "aid"; } else if(g_strcmp0(name, "video_select") == 0) { mpv_prop = "vid"; } else if(g_strcmp0(name, "sub_select") == 0) { mpv_prop = "sid"; } else { g_assert_not_reached(); } if(id >= 0) { mpv_set_property(ctx->mpv_ctx, mpv_prop, MPV_FORMAT_INT64, &id); } else { mpv_set_property_string(ctx->mpv_ctx, mpv_prop, "no"); } } static void load_track_handler( GSimpleAction *action, GVariant *param, gpointer data ) { gmpv_handle *ctx = (gmpv_handle*)data; GtkFileChooser *file_chooser; GtkWidget *open_dialog; const gchar *cmd_name; g_variant_get(param, "s", &cmd_name); open_dialog = gtk_file_chooser_dialog_new( _("Load External…"), GTK_WINDOW(ctx->gui), GTK_FILE_CHOOSER_ACTION_OPEN, _("_Cancel"), GTK_RESPONSE_CANCEL, _("_Open"), GTK_RESPONSE_ACCEPT, NULL ); file_chooser = GTK_FILE_CHOOSER(open_dialog); gtk_file_chooser_set_select_multiple(file_chooser, TRUE); if(gtk_dialog_run(GTK_DIALOG(open_dialog)) == GTK_RESPONSE_ACCEPT) { const gchar *cmd[] = {cmd_name, NULL, NULL}; GSList *uri_list = gtk_file_chooser_get_filenames(file_chooser); GSList *uri = uri_list; while(uri) { cmd[1] = uri->data; mpv_command(ctx->mpv_ctx, cmd); uri = g_slist_next(uri); } g_slist_free_full(uri_list, g_free); } mpv_load_gui_update(ctx); gtk_widget_destroy(open_dialog); } static void fullscreen_handler( GSimpleAction *action, GVariant *param, gpointer data ) { toggle_fullscreen(data); } static void normal_size_handler( GSimpleAction *action, GVariant *param, gpointer data ) { resize_window_to_fit((gmpv_handle *)data, 1); } static void double_size_handler( GSimpleAction *action, GVariant *param, gpointer data ) { resize_window_to_fit((gmpv_handle *)data, 2); } static void half_size_handler( GSimpleAction *action, GVariant *param, gpointer data ) { resize_window_to_fit((gmpv_handle *)data, 0.5); } static void about_handler( GSimpleAction *action, GVariant *param, gpointer data ) { gmpv_handle *ctx = (gmpv_handle*)data; gtk_show_about_dialog( GTK_WINDOW(ctx->gui), "logo-icon-name", ICON_NAME, "version", VERSION, "comments", _("A GTK frontend for MPV"), "website", "https://github.com/gnome-mpv/gnome-mpv", "license-type", GTK_LICENSE_GPL_3_0, "copyright", "\u00A9 2014-2016 The GNOME MPV authors", NULL ); } static pref_store *get_pref(GSettings *settings) { pref_store *pref = pref_store_new(); G_SETTINGS_KEY_PREF_MAP(map, pref) for(gint i = 0; map[i].key; i++) { GVariant *value = g_settings_get_value(settings, map[i].key); if(map[i].type == G_TYPE_BOOLEAN) { *((gboolean *)map[i].value) = g_variant_get_boolean(value); } else if(map[i].type == G_TYPE_STRING) { *((gchar **)map[i].value) = g_strdup(g_variant_get_string(value, NULL)); } else { g_assert_not_reached(); } g_variant_unref(value); } return pref; } static void set_pref(GSettings *settings, pref_store *pref) { G_SETTINGS_KEY_PREF_MAP(map, pref) for(gint i = 0; map[i].key; i++) { GVariant *value = NULL; if(map[i].type == G_TYPE_BOOLEAN) { value = g_variant_new_boolean (*((gboolean *)map[i].value)); } else if(map[i].type == G_TYPE_STRING) { value = g_variant_new_string (*((gchar **)map[i].value)); } else { g_assert_not_reached(); } if(!g_settings_set_value(settings, map[i].key, value)) { g_warning("Failed to set GSettings key %s", map[i].key); } } } void actionctl_map_actions(gmpv_handle *ctx) { const GActionEntry entries[] = { {.name = "open", .activate = open_handler, .parameter_type = "b"}, {.name = "quit", .activate = quit_handler}, {.name = "about", .activate = about_handler}, {.name = "pref", .activate = pref_handler}, {.name = "openloc", .activate = open_loc_handler}, {.name = "loop", .state = "false", .change_state = loop_handler}, {.name = "playlist_toggle", .activate = playlist_toggle_handler}, {.name = "playlist_save", .activate = playlist_save_handler}, {.name = "audio_select", .change_state = track_select_handler, .state = "@x 1", .parameter_type = "x"}, {.name = "video_select", .change_state = track_select_handler, .state = "@x 1", .parameter_type = "x"}, {.name = "sub_select", .change_state = track_select_handler, .state = "@x 1", .parameter_type = "x"}, {.name = "load_track", .activate = load_track_handler, .parameter_type = "s"}, {.name = "fullscreen", .activate = fullscreen_handler}, {.name = "normalsize", .activate = normal_size_handler}, {.name = "doublesize", .activate = double_size_handler}, {.name = "halfsize", .activate = half_size_handler} }; g_action_map_add_action_entries( G_ACTION_MAP(ctx->app), entries, G_N_ELEMENTS(entries), ctx ); } gnome-mpv-0.7/src/actionctl.h000066400000000000000000000015021265310212500162000ustar00rootroot00000000000000/* * Copyright (c) 2015 gnome-mpv * * This file is part of GNOME MPV. * * GNOME MPV 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. * * GNOME MPV 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 GNOME MPV. If not, see . */ #ifndef ACTIONCTL_H #define ACTIONCTL_H #include "common.h" void actionctl_map_actions(gmpv_handle *ctx); #endif gnome-mpv-0.7/src/common.c000066400000000000000000000177721265310212500155230ustar00rootroot00000000000000/* * Copyright (c) 2014-2015 gnome-mpv * * This file is part of GNOME MPV. * * GNOME MPV 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. * * GNOME MPV 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 GNOME MPV. If not, see . */ #include #include #include #include "common.h" #include "def.h" #include "mpv.h" #include "keybind.h" #include "main_window.h" #include "control_box.h" #include "playlist_widget.h" gchar *get_config_dir_path(void) { return g_build_filename( g_get_user_config_dir(), CONFIG_DIR, NULL ); } gchar *get_config_file_path(void) { gchar *config_dir; gchar *result; config_dir = get_config_dir_path(); result = g_build_filename(config_dir, "gnome-mpv.conf", NULL); g_free(config_dir); return result; } gchar *get_path_from_uri(const gchar *uri) { GFile *file = g_vfs_get_file_for_uri(g_vfs_get_default(), uri); gchar *path = g_file_get_path(file); if(file) { g_object_unref(file); } return path?path:g_strdup(uri); } gchar *get_name_from_path(const gchar *path) { const gchar *scheme = g_uri_parse_scheme(path); gchar *basename = NULL; /* Check whether the given path is likely to be a local path */ if(!scheme && path) { basename = g_path_get_basename(path); } return basename?basename:g_strdup(path); } gboolean quit(gpointer data) { const gchar *cmd[] = {"quit", NULL}; gmpv_handle *ctx = data; if(ctx->mpv_ctx) { mpv_command(ctx->mpv_ctx, cmd); mpv_quit(ctx); ctx->mpv_ctx = NULL; } if(!ctx->gui->fullscreen) { main_window_save_state(ctx->gui); } g_application_quit(G_APPLICATION(ctx->app)); return FALSE; } /* This only supports migrating from v0.5's config file */ gboolean migrate_config(gmpv_handle *ctx) { gchar *config_file = get_config_file_path(); gchar *backup_config_file = g_strconcat(config_file, ".bak", NULL); gboolean result = FALSE; if(g_file_test(config_file, G_FILE_TEST_EXISTS)) { /* Backup the old config file */ GFile *src = g_file_new_for_path(config_file); GFile *dest = g_file_new_for_path(backup_config_file); result = g_file_move( src, dest, G_FILE_COPY_OVERWRITE, NULL, NULL, NULL, NULL ); g_object_unref(src); g_object_unref(dest); } if(result) { /* Load settings from the backup file */ const gchar *key_list[] = { "csd-enable", "dark-theme-enable", "mpv-input-config-enable", "mpv-config-enable", "mpv-input-config-file", "mpv-config-file", "mpv-options", NULL }; GSettingsBackend *backend; GSettings *keyfile_settings; GSettings *default_settings; const gchar **iter; backend = g_keyfile_settings_backend_new ( backup_config_file, "/org/gnome-mpv/gnome-mpv/", "main" ); keyfile_settings = g_settings_new_with_backend( CONFIG_ROOT, backend ); default_settings = g_settings_new(CONFIG_ROOT); iter = key_list; while(*iter) { GVariant *value; value = g_settings_get_value(keyfile_settings, *iter); g_settings_set_value(default_settings, *iter, value); iter++; g_variant_unref(value); } g_object_unref(backend); g_object_unref(keyfile_settings); g_object_unref(default_settings); } g_free(config_file); g_free(backup_config_file); return result; } gboolean update_seek_bar(gpointer data) { gmpv_handle *ctx = data; gdouble time_pos; gint rc; rc = mpv_get_property( ctx->mpv_ctx, "time-pos", MPV_FORMAT_DOUBLE, &time_pos ); if(rc >= 0) { ControlBox *control_box = CONTROL_BOX(ctx->gui->control_box); gtk_range_set_value ( GTK_RANGE(control_box->seek_bar), time_pos ); } return TRUE; } void seek(gmpv_handle *ctx, gdouble time) { const gchar *cmd[] = {"seek", NULL, "absolute", NULL}; if(!ctx->loaded) { mpv_load(ctx, NULL, FALSE, TRUE); } else { gchar *value_str = g_strdup_printf("%.2f", time); cmd[1] = value_str; mpv_command(ctx->mpv_ctx, cmd); update_seek_bar(ctx); g_free(value_str); } } void show_error_dialog(gmpv_handle *ctx, const gchar *prefix, const gchar *msg) { GtkWidget *dialog; GtkWidget *msg_area; GList *iter; dialog = gtk_message_dialog_new ( GTK_WINDOW(ctx->gui), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, _("Error") ); msg_area = gtk_message_dialog_get_message_area (GTK_MESSAGE_DIALOG(dialog)); iter = gtk_container_get_children(GTK_CONTAINER(msg_area)); while(iter) { if(GTK_IS_LABEL(iter->data)) { GtkLabel *label = iter->data; gtk_label_set_line_wrap_mode (label, PANGO_WRAP_WORD_CHAR); } iter = g_list_next(iter); } g_list_free(iter); if(prefix) { gchar *prefix_escaped = g_markup_printf_escaped("%s", prefix); gchar *msg_escaped = g_markup_printf_escaped("%s", msg); gtk_message_dialog_format_secondary_markup ( GTK_MESSAGE_DIALOG(dialog), "[%s] %s", prefix_escaped, msg_escaped ); g_free(prefix_escaped); g_free(msg_escaped); } else { gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG(dialog), "%s", msg); } gtk_dialog_run(GTK_DIALOG(dialog)); gtk_widget_destroy(dialog); } void remove_current_playlist_entry(gmpv_handle *ctx) { const gchar *cmd[] = {"playlist_remove", NULL, NULL}; PlaylistWidget *playlist; GtkTreePath *path; playlist = PLAYLIST_WIDGET(ctx->gui->playlist); gtk_tree_view_get_cursor ( GTK_TREE_VIEW(playlist->tree_view), &path, NULL ); if(path) { gint index; gchar *index_str; index = gtk_tree_path_get_indices(path)[0]; index_str = g_strdup_printf("%d", index); cmd[1] = index_str; g_signal_handlers_block_matched ( playlist->list_store, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, ctx ); playlist_widget_remove(playlist, index); if(ctx->loaded) { mpv_check_error(mpv_command(ctx->mpv_ctx, cmd)); } if(playlist_widget_empty(playlist)) { control_box_set_enabled (CONTROL_BOX(ctx->gui->control_box), FALSE); } g_signal_handlers_unblock_matched ( playlist->list_store, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, ctx ); g_free(index_str); } } void resize_window_to_fit(gmpv_handle *ctx, gdouble multiplier) { gchar *video = mpv_get_property_string(ctx->mpv_ctx, "video"); gint64 width; gint64 height; gint mpv_width_rc; gint mpv_height_rc; mpv_width_rc = mpv_get_property( ctx->mpv_ctx, "dwidth", MPV_FORMAT_INT64, &width ); mpv_height_rc = mpv_get_property( ctx->mpv_ctx, "dheight", MPV_FORMAT_INT64, &height ); if(video && strncmp(video, "no", 3) != 0 && mpv_width_rc >= 0 && mpv_height_rc >= 0) { gint width_margin; gint height_margin; gint new_width; gint new_height; width_margin = main_window_get_width_margin(ctx->gui); height_margin = main_window_get_height_margin(ctx->gui); new_width = (gint)(multiplier*(gdouble)width)+width_margin; new_height = (gint)(multiplier*(gdouble)height)+height_margin; gtk_window_resize( GTK_WINDOW(ctx->gui), new_width, new_height ); } mpv_free(video); } void toggle_fullscreen(gmpv_handle *ctx) { main_window_toggle_fullscreen(ctx->gui); mpv_set_property( ctx->mpv_ctx, "fullscreen", MPV_FORMAT_FLAG, &ctx->gui->fullscreen ); } void load_keybind( gmpv_handle *ctx, const gchar *config_path, gboolean notify_propexp ) { gboolean propexp; ctx->keybind_list = keybind_parse_config_with_defaults(config_path, &propexp); if(notify_propexp && propexp) { const gchar *msg = _( "Keybindings that require Property " "Expansion are not supported and have " "been ignored." ); show_error_dialog(ctx, NULL, msg); } } gnome-mpv-0.7/src/common.h000066400000000000000000000041011265310212500155060ustar00rootroot00000000000000/* * Copyright (c) 2014-2015 gnome-mpv * * This file is part of GNOME MPV. * * GNOME MPV 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. * * GNOME MPV 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 GNOME MPV. If not, see . */ #ifndef COMMON_H #define COMMON_H #include #include #include "main_window.h" typedef struct module_log_level module_log_level; typedef struct gmpv_handle gmpv_handle; struct module_log_level { gchar *prefix; mpv_log_level level; }; struct gmpv_handle { mpv_handle *mpv_ctx; gchar **files; mpv_opengl_cb_context *opengl_ctx; gboolean opengl_ready; gboolean paused; gboolean loaded; gboolean new_file; gboolean sub_visible; gboolean init_load; gint64 vid_area_wid; guint inhibit_cookie; gint playlist_move_dest; GSList *log_level_list; GSList *keybind_list; GSettings *config; GtkApplication *app; MainWindow *gui; GtkWidget *fs_control; GtkListStore *playlist_store; }; gchar *get_config_dir_path(void); gchar *get_config_file_path(void); gchar *get_path_from_uri(const gchar *uri); gchar *get_name_from_path(const gchar *path); gboolean quit(gpointer data); gboolean migrate_config(gmpv_handle *ctx); gboolean update_seek_bar(gpointer data); void seek(gmpv_handle *ctx, gdouble time); void show_error_dialog(gmpv_handle *ctx, const gchar *prefix, const gchar *msg); void remove_current_playlist_entry(gmpv_handle *ctx); void resize_window_to_fit(gmpv_handle *ctx, gdouble multiplier); void toggle_fullscreen(gmpv_handle *ctx); void load_keybind( gmpv_handle *ctx, const gchar *config_path, gboolean notify_ignore ); #endif gnome-mpv-0.7/src/control_box.c000066400000000000000000000175071265310212500165570ustar00rootroot00000000000000/* * Copyright (c) 2014-2015 gnome-mpv * * This file is part of GNOME MPV. * * GNOME MPV 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. * * GNOME MPV 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 GNOME MPV. If not, see . */ #include "control_box.h" static gchar *seek_bar_format_handler( GtkScale *scale, gdouble value, gpointer data ); static void control_box_init(ControlBox *box); G_DEFINE_TYPE(ControlBox, control_box, GTK_TYPE_BOX) static gchar *seek_bar_format_handler( GtkScale *scale, gdouble value, gpointer data ) { gint sec = (gint)value; gint length = ((ControlBox *)data)->seek_bar_length; char *output = NULL; /* Longer than one hour */ if(length > 3600 && sec >= 0) { output = g_strdup_printf( "%02d:%02d:%02d/" "%02d:%02d:%02d", sec/3600, (sec%3600)/60, sec%60, length/3600, (length%3600)/60, length%60 ); } else { /* Set variable to 0 if the value is negative */ length *= (length >= 0); sec *= (sec >= 0); output = g_strdup_printf( "%02d:%02d/" "%02d:%02d", (sec%3600)/60, sec%60, (length%3600)/60, length%60 ); } return output; } static void control_box_class_init(ControlBoxClass *klass) { } static void control_box_init(ControlBox *box) { GtkWidget *play_icon; GtkWidget *stop_icon; GtkWidget *forward_icon; GtkWidget *rewind_icon; GtkWidget *previous_icon; GtkWidget *next_icon; GtkWidget *fullscreen_icon; box->seek_bar_length = -1; box->play_button = gtk_button_new_with_label(NULL); box->stop_button = gtk_button_new_with_label(NULL); box->forward_button = gtk_button_new_with_label(NULL); box->rewind_button = gtk_button_new_with_label(NULL); box->next_button = gtk_button_new_with_label(NULL); box->previous_button = gtk_button_new_with_label(NULL); box->fullscreen_button = gtk_button_new_with_label(NULL); box->volume_button = gtk_volume_button_new(); box->seek_bar = gtk_scale_new(GTK_ORIENTATION_HORIZONTAL, NULL); play_icon = gtk_image_new_from_icon_name( "media-playback-start-symbolic", GTK_ICON_SIZE_BUTTON ); stop_icon = gtk_image_new_from_icon_name( "media-playback-stop-symbolic", GTK_ICON_SIZE_BUTTON ); forward_icon = gtk_image_new_from_icon_name( "media-seek-forward-symbolic", GTK_ICON_SIZE_BUTTON ); rewind_icon = gtk_image_new_from_icon_name( "media-seek-backward-symbolic", GTK_ICON_SIZE_BUTTON ); next_icon = gtk_image_new_from_icon_name( "media-skip-forward-symbolic", GTK_ICON_SIZE_BUTTON ); previous_icon = gtk_image_new_from_icon_name( "media-skip-backward-symbolic", GTK_ICON_SIZE_BUTTON ); fullscreen_icon = gtk_image_new_from_icon_name( "view-fullscreen-symbolic", GTK_ICON_SIZE_BUTTON ); gtk_style_context_add_class ( gtk_widget_get_style_context(GTK_WIDGET(box)), GTK_STYLE_CLASS_BACKGROUND ); gtk_range_set_increments(GTK_RANGE(box->seek_bar), 10, 10); gtk_widget_set_sensitive(box->volume_button, FALSE); g_object_set(box->play_button, "relief", GTK_RELIEF_NONE, NULL); g_object_set(box->stop_button, "relief", GTK_RELIEF_NONE, NULL); g_object_set(box->forward_button, "relief", GTK_RELIEF_NONE, NULL); g_object_set(box->rewind_button, "relief", GTK_RELIEF_NONE, NULL); g_object_set(box->next_button, "relief", GTK_RELIEF_NONE, NULL); g_object_set(box->previous_button, "relief", GTK_RELIEF_NONE, NULL); g_object_set(box->fullscreen_button, "relief", GTK_RELIEF_NONE, NULL); g_object_set(box->seek_bar, "value-pos", GTK_POS_RIGHT, NULL); g_object_set(box->seek_bar, "digits", 2, NULL); gtk_widget_set_can_focus(box->previous_button, FALSE); gtk_widget_set_can_focus(box->rewind_button, FALSE); gtk_widget_set_can_focus(box->play_button, FALSE); gtk_widget_set_can_focus(box->stop_button, FALSE); gtk_widget_set_can_focus(box->forward_button, FALSE); gtk_widget_set_can_focus(box->next_button, FALSE); gtk_widget_set_can_focus(box->seek_bar, FALSE); gtk_widget_set_can_focus(box->volume_button, FALSE); gtk_widget_set_can_focus(box->fullscreen_button, FALSE); gtk_button_set_image (GTK_BUTTON(box->play_button), play_icon); gtk_button_set_image (GTK_BUTTON(box->stop_button), stop_icon); gtk_button_set_image (GTK_BUTTON(box->forward_button), forward_icon); gtk_button_set_image (GTK_BUTTON(box->rewind_button), rewind_icon); gtk_button_set_image (GTK_BUTTON(box->next_button), next_icon); gtk_button_set_image (GTK_BUTTON(box->previous_button), previous_icon); gtk_button_set_image (GTK_BUTTON(box->fullscreen_button), fullscreen_icon); gtk_container_add (GTK_CONTAINER(box), box->previous_button); gtk_container_add (GTK_CONTAINER(box), box->rewind_button); gtk_container_add (GTK_CONTAINER(box), box->play_button); gtk_container_add (GTK_CONTAINER(box), box->stop_button); gtk_container_add (GTK_CONTAINER(box), box->forward_button); gtk_container_add (GTK_CONTAINER(box), box->next_button); gtk_box_pack_start (GTK_BOX(box), box->seek_bar, TRUE, TRUE, 0); gtk_container_add (GTK_CONTAINER(box), box->volume_button); gtk_container_add (GTK_CONTAINER(box), box->fullscreen_button); g_signal_connect( box->seek_bar, "format-value", G_CALLBACK(seek_bar_format_handler), box ); } GtkWidget *control_box_new(void) { return GTK_WIDGET(g_object_new(control_box_get_type(), NULL)); } void control_box_set_enabled(ControlBox *box, gboolean enabled) { gtk_widget_set_sensitive(box->previous_button, enabled); gtk_widget_set_sensitive(box->rewind_button, enabled); gtk_widget_set_sensitive(box->stop_button, enabled); gtk_widget_set_sensitive(box->play_button, enabled); gtk_widget_set_sensitive(box->forward_button, enabled); gtk_widget_set_sensitive(box->next_button, enabled); } void control_box_set_chapter_enabled(ControlBox *box, gboolean enabled) { if(enabled) { gtk_widget_show_all(box->previous_button); gtk_widget_show_all(box->next_button); } else { gtk_widget_hide(box->previous_button); gtk_widget_hide(box->next_button); } } void control_box_set_seek_bar_length(ControlBox *box, gint length) { box->seek_bar_length = length; gtk_range_set_range(GTK_RANGE(box->seek_bar), 0, length); } void control_box_set_volume(ControlBox *box, gdouble volume) { gtk_scale_button_set_value (GTK_SCALE_BUTTON(box->volume_button), volume); } gdouble control_box_get_volume(ControlBox *box) { return gtk_scale_button_get_value(GTK_SCALE_BUTTON(box->volume_button)); } void control_box_set_playing_state(ControlBox *box, gboolean playing) { GtkWidget *play_icon; play_icon = gtk_image_new_from_icon_name ( playing ?"media-playback-pause-symbolic" :"media-playback-start-symbolic", GTK_ICON_SIZE_BUTTON ); gtk_button_set_image(GTK_BUTTON(box->play_button), play_icon); } void control_box_set_fullscreen_state(ControlBox *box, gboolean fullscreen) { GtkWidget *fullscreen_icon; fullscreen_icon = gtk_image_new_from_icon_name ( fullscreen ?"view-restore-symbolic" :"view-fullscreen-symbolic", GTK_ICON_SIZE_BUTTON ); gtk_button_set_image( GTK_BUTTON(box->fullscreen_button), fullscreen_icon ); } void control_box_set_fullscreen_btn_visible(ControlBox *box, gboolean value) { gtk_widget_set_visible(box->fullscreen_button, value); } void control_box_reset_control(ControlBox *box) { control_box_set_seek_bar_length(box, 0); control_box_set_playing_state(box, FALSE); control_box_set_chapter_enabled(box, FALSE); control_box_set_fullscreen_state(box, FALSE); } gnome-mpv-0.7/src/control_box.h000066400000000000000000000045131265310212500165550ustar00rootroot00000000000000/* * Copyright (c) 2014-2015 gnome-mpv * * This file is part of GNOME MPV. * * GNOME MPV 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. * * GNOME MPV 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 GNOME MPV. If not, see . */ #ifndef CONTROL_BOX_H #define CONTROL_BOX_H #include G_BEGIN_DECLS #define CONTROL_BOX_TYPE (control_box_get_type ()) #define CONTROL_BOX(obj) \ (G_TYPE_CHECK_INSTANCE_CAST((obj), CONTROL_BOX_TYPE, ControlBox)) #define CONTROL_BOX_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST((klass), CONTROL_BOX_TYPE, ControlBoxClass)) #define IS_CONTROL_BOX(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE((obj), CONTROL_BOX_TYPE)) #define IS_CONTROL_BOX_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE((klass), CONTROL_BOX_TYPE)) struct _ControlBox { GtkBox parent_instance; gint seek_bar_length; GtkWidget *play_button; GtkWidget *stop_button; GtkWidget *forward_button; GtkWidget *rewind_button; GtkWidget *next_button; GtkWidget *previous_button; GtkWidget *volume_button; GtkWidget *fullscreen_button; GtkWidget *seek_bar; }; struct _ControlBoxClass { GtkBoxClass parent_class; }; typedef struct _ControlBox ControlBox; typedef struct _ControlBoxClass ControlBoxClass; GtkWidget *control_box_new(void); GType control_box_get_type(void); void control_box_set_enabled(ControlBox *box, gboolean enabled); void control_box_set_chapter_enabled(ControlBox *box, gboolean enabled); void control_box_set_seek_bar_length(ControlBox *box, gint length); void control_box_set_volume(ControlBox *box, gdouble volume); gdouble control_box_get_volume(ControlBox *box); void control_box_set_playing_state(ControlBox *box, gboolean playing); void control_box_set_fullscreen_state(ControlBox *box, gboolean fullscreen); void control_box_set_fullscreen_btn_visible(ControlBox *box, gboolean value); void control_box_reset_control(ControlBox *box); G_END_DECLS #endif gnome-mpv-0.7/src/def.h000066400000000000000000000121221265310212500147560ustar00rootroot00000000000000/* * Copyright (c) 2014-2015 gnome-mpv * * This file is part of GNOME MPV. * * GNOME MPV 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. * * GNOME MPV 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 GNOME MPV. If not, see . */ #ifndef DEF_H #define DEF_H #define APP_ID "org.gnome-mpv" #define ICON_NAME "gnome-mpv" #define CONFIG_DIR "gnome-mpv" #define CONFIG_ROOT APP_ID #define CONFIG_WIN_STATE APP_ID".window-state" #define DEFAULT_LOG_LEVEL MPV_LOG_LEVEL_ERROR #define MPRIS_TRACK_ID_PREFIX "/org/gnome_mpv/Track/" #define MPRIS_BUS_NAME "org.mpris.MediaPlayer2.gnome-mpv" #define MPRIS_OBJ_ROOT_PATH "/org/mpris/MediaPlayer2" #define PLAYLIST_DEFAULT_WIDTH 200 #define PLAYLIST_CSD_WIDTH_OFFSET 52 #define MAIN_WINDOW_DEFAULT_WIDTH 625 #define MAIN_WINDOW_DEFAULT_HEIGHT 400 #define SEEK_BAR_UPDATE_INTERVAL 250 #define FS_CONTROL_HIDE_DELAY 1 #define KEYSTRING_MAX_LEN 8 #define DEFAULT_KEYBINDS { "SPACE cycle pause",\ "p cycle pause",\ "v osd-msg cycle sub-visibility",\ "s osd-msg screenshot",\ "S osd-msg screenshot video",\ "j osd-msg cycle sub",\ "J osd-msg cycle sub down",\ "@ osd-msg cycle chapter",\ "! osd-msg cycle chapter down",\ "< playlist_prev",\ "> playlist_next",\ "U stop",\ "RIGHT no-osd seek 10",\ "LEFT no-osd seek -10",\ "UP no-osd seek 60",\ "DOWN no-osd seek -60",\ "Q quit_watch_later",\ "MOUSE_BTN0_DBL cycle fullscreen",\ "MOUSE_BTN2 cycle pause",\ NULL } #define KEYSTRING_MAP { "<", "less",\ ">", "greater",\ "PGUP", "Page_Up",\ "PGDWN", "Page_Down",\ "BS", "BackSpace",\ "SPACE", "space",\ ".", "period",\ ",", "comma",\ "`", "grave",\ "~", "asciitilde",\ "!", "exclam",\ "@", "at",\ "SHARP", "numbersign",\ "$", "dollar",\ "%", "percent",\ "^", "caret",\ "&", "ampersand",\ "*", "asterisk",\ "-", "minus",\ "_", "underscore",\ "=", "equal",\ "+", "plus",\ ";", "semicolon",\ ":", "colon",\ "'", "apostrophe",\ "\"", "quotedbl",\ "/", "slash",\ "\\", "backslash",\ "(", "parenleft",\ ")", "parenright",\ "[", "bracketleft",\ "]", "bracketright",\ "RIGHT", "Right",\ "LEFT", "Left",\ "UP", "Up",\ "DOWN", "Down",\ NULL } #define SUPPORTED_PROTOCOLS { "cdda",\ "rtmp",\ "rtsp",\ "http",\ "https",\ "mms",\ "mmst",\ "mmsh",\ "mmshttp",\ "rtp",\ "httpproxy",\ "hls",\ "rtmpe",\ "rtmps",\ "rtmpt",\ "rtmpte",\ "rtmpts",\ "srtp",\ "lavf",\ "ffmpeg",\ "udp",\ "ftp",\ "tcp",\ "tls",\ "unix",\ "sftp",\ "md5",\ "concat",\ "avdevice",\ "av",\ "dvb",\ "tv",\ "pvr",\ "smb",\ "file",\ "dvdread",\ "dvd",\ "dvdnav",\ "bd",\ "br",\ "bluray",\ "bdnav",\ "brnav",\ "bluraynav",\ "memory",\ "null",\ "mf",\ "edl",\ "rar",\ NULL } #define SUPPORTED_MIME_TYPES { "application/ogg",\ "application/x-ogg",\ "application/sdp",\ "application/smil",\ "application/x-smil",\ "application/streamingmedia",\ "application/x-streamingmedia",\ "application/vnd.rn-realmedia",\ "application/vnd.rn-realmedia-vbr",\ "audio/aac",\ "audio/x-aac",\ "audio/m4a",\ "audio/x-m4a",\ "audio/mp1",\ "audio/x-mp1",\ "audio/mp2",\ "audio/x-mp2",\ "audio/mp3",\ "audio/x-mp3",\ "audio/mpeg",\ "audio/x-mpeg",\ "audio/mpegurl",\ "audio/x-mpegurl",\ "audio/mpg",\ "audio/x-mpg",\ "audio/rn-mpeg",\ "audio/ogg",\ "audio/scpls",\ "audio/x-scpls",\ "audio/vnd.rn-realaudio",\ "audio/wav",\ "audio/x-pn-windows-pcm",\ "audio/x-realaudio",\ "audio/x-pn-realaudio",\ "audio/x-ms-wma",\ "audio/x-pls",\ "audio/x-wav",\ "video/mpeg",\ "video/x-mpeg",\ "video/x-mpeg2",\ "video/mp4",\ "video/msvideo",\ "video/x-msvideo",\ "video/ogg",\ "video/quicktime",\ "video/vnd.rn-realvideo",\ "video/x-ms-afs",\ "video/x-ms-asf",\ "video/x-ms-wmv",\ "video/x-ms-wmx",\ "video/x-ms-wvxvideo",\ "video/x-avi",\ "video/x-fli",\ "video/x-flv",\ "video/x-theora",\ "video/x-matroska",\ "video/webm",\ "audio/x-flac",\ "audio/x-vorbis+ogg",\ "video/x-ogm+ogg",\ "audio/x-shorten",\ "audio/x-ape",\ "audio/x-wavpack",\ "audio/x-tta",\ "audio/AMR",\ "audio/ac3",\ "video/mp2t",\ "audio/flac",\ NULL } #endif gnome-mpv-0.7/src/keybind.c000066400000000000000000000151621265310212500156470ustar00rootroot00000000000000/* * Copyright (c) 2015-2016 gnome-mpv * * This file is part of GNOME MPV. * * GNOME MPV 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. * * GNOME MPV 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 GNOME MPV. If not, see . */ #include #include #include "keybind.h" #include "def.h" keybind *keybind_parse_config_line(const gchar *line, gboolean *propexp) { keybind *result = NULL; gchar **tokens; gchar **keys; gchar *linebuf; gint offset; gint index; linebuf = g_strdup(line); if(propexp) { *propexp = FALSE; } if(linebuf) { offset = -1; /* Remove comments */ while(linebuf[++offset] != '#' && linebuf[offset] != '\0'); if(linebuf[offset] == '#') { linebuf[offset] = '\0'; } g_strstrip(linebuf); /* Fail if the command require Property Expansion other than * "$$" which translates to just "$". */ if(!g_regex_match_simple("\\$[^\\$]", linebuf, 0, 0)) { gchar *old_linebuf; GRegex *regex; old_linebuf = linebuf; regex = g_regex_new("\\$\\$", 0, 0, NULL); linebuf = g_regex_replace_literal (regex, old_linebuf, -1, 0, "$", 0, NULL); g_free(old_linebuf); g_regex_unref(regex); regex = g_regex_new("\\s+", 0, 0, NULL); tokens = g_regex_split_full( regex, linebuf, -1, 0, 0, 2, NULL ); g_regex_unref(regex); keys = tokens?g_strsplit(tokens[0], "+", -1):NULL; if(keys) { result = g_malloc(sizeof(keybind)); result->mouse = FALSE; result->modifier = 0x0; result->keyval = 0x0; result->command = NULL; } } else { if(propexp) { *propexp = TRUE; } result = NULL; } } index = -1; /* Parse key */ while(result && keys[++index]) { guint keyval; /* Modifiers */ if(g_ascii_strncasecmp(keys[index], "shift", 5) == 0) { keyval = GDK_SHIFT_MASK; } else if(g_ascii_strncasecmp(keys[index], "ctrl", 4) == 0) { keyval = GDK_CONTROL_MASK; } else if(g_ascii_strncasecmp(keys[index], "alt", 3) == 0) { keyval = GDK_MOD1_MASK; } /* Mouse */ else if(g_regex_match_simple( "MOUSE_BTN[0-9]*(_DBL)?", keys[index], 0, 0 )) { /* Button number */ result->mouse = TRUE; keyval = (guint)g_ascii_strtoull (keys[index]+9, NULL, 10)+1; if(g_regex_match_simple("_DBL$", keys[index], 0, 0)) { /* Set modifier to indicate double click */ result->modifier = 0x1; } } /* Non-modifier keys */ else { const gchar *keystrmap[] = KEYSTRING_MAP; const gsize keystrlen = KEYSTRING_MAX_LEN; const gchar *match = NULL; gint i; /* Translate key string to GDK key name */ for(i = 0; !match && keystrmap[i]; i += 2) { gint rc = g_ascii_strncasecmp( keys[index], keystrmap[i], keystrlen ); if(rc == 0) { match = keystrmap[i+1]; } } keyval = gdk_keyval_from_name(match?match:keys[index]); } /* Invalid key */ if(keyval == GDK_KEY_VoidSymbol) { free(result); result = NULL; } else if(!result->mouse && (keyval == GDK_SHIFT_MASK || keyval == GDK_CONTROL_MASK || keyval == GDK_MOD1_MASK)) { result->modifier |= keyval; } else { result->keyval = keyval; } } if(result) { result->command = g_strdup(tokens[1]); g_strfreev(tokens); g_strfreev(keys); g_free(linebuf); } return result; } GSList *keybind_parse_config(const gchar *config_path, gboolean* propexp) { GSList *result; GFile *config_file; GError *error; GFileInputStream *config_file_stream; GInputStream *config_input_stream; GDataInputStream *config_data_stream; gchar *linebuf; gsize linebuf_size; if(propexp) { *propexp = FALSE; } result = NULL; error = NULL; config_file = g_file_new_for_path(config_path); config_file_stream = g_file_read(config_file, NULL, NULL); config_input_stream = G_INPUT_STREAM(config_file_stream); config_data_stream = g_data_input_stream_new(config_input_stream); linebuf = (gchar *)0xdeadbeef; linebuf_size = 0; while(!error && linebuf) { gint offset = -1; linebuf = g_data_input_stream_read_line ( config_data_stream, &linebuf_size, NULL, &error ); /* Find the beginning of the comment, if any */ while( linebuf && /* ++offset can never be less than 0 */ (guint)(++offset) < linebuf_size && linebuf[offset] != '#' ); if(offset > 0) { keybind *keybind; gboolean line_propexp; /* Ignore the comment */ linebuf[offset] = '\0'; keybind = keybind_parse_config_line( linebuf, &line_propexp ); if(keybind) { result = g_slist_append(result, keybind); } if(propexp && line_propexp) { *propexp = TRUE; } } g_free(linebuf); } /* linebuf should be NULL if the read completes sucessfully */ if(linebuf || error) { perror("Failed to read mpv key bindings"); result = NULL; } else { g_input_stream_close(config_input_stream, NULL, NULL); g_object_unref(config_file); } /* Reverse the list so that bindings defined later in the file will have * priority over the ones defined earlier. */ return g_slist_reverse(result); } gchar *keybind_get_command( gmpv_handle *ctx, gboolean mouse, guint modifier, guint keyval ) { GSList *iter = ctx->keybind_list; keybind *kb = iter->data; while(kb && (kb->modifier != modifier || kb->keyval != keyval)) { iter = g_slist_next(iter); kb = iter?iter->data:NULL; } return kb?kb->command:NULL; } GSList *keybind_parse_config_with_defaults( const gchar *config_path, gboolean *propexp ) { const gchar *default_kb[] = DEFAULT_KEYBINDS; gint index; GSList *default_kb_list; GSList *config_kb_list; index = -1; default_kb_list = NULL; config_kb_list = config_path? keybind_parse_config(config_path, propexp): NULL; while(default_kb[++index]) { keybind *keybind; gboolean line_propexp; keybind = keybind_parse_config_line( default_kb[index], &line_propexp ); if(keybind) { default_kb_list = g_slist_append(default_kb_list, keybind); } if(propexp && line_propexp) { *propexp = TRUE; } } /* Key bindings from configuration file gets prority over default ones */ return config_kb_list? g_slist_concat(config_kb_list, default_kb_list): default_kb_list; } gnome-mpv-0.7/src/keybind.h000066400000000000000000000023501265310212500156470ustar00rootroot00000000000000/* * Copyright (c) 2015 gnome-mpv * * This file is part of GNOME MPV. * * GNOME MPV 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. * * GNOME MPV 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 GNOME MPV. If not, see . */ #ifndef KEYBIND_H #define KEYBIND_H #include "common.h" struct keybind { gboolean mouse; guint modifier; guint keyval; gchar *command; }; typedef struct keybind keybind; keybind *keybind_parse_config_line(const gchar *line, gboolean *propexp); GSList *keybind_parse_config(const gchar *config_path, gboolean *propexp); gchar *keybind_get_command( gmpv_handle *ctx, gboolean mouse, guint modifier, guint keyval ); GSList *keybind_parse_config_with_defaults( const gchar *config_path, gboolean *propexp ); #endif gnome-mpv-0.7/src/main.c000066400000000000000000000412421265310212500151440ustar00rootroot00000000000000/* * Copyright (c) 2014-2015 gnome-mpv * * This file is part of GNOME MPV. * * GNOME MPV 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. * * GNOME MPV 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 GNOME MPV. If not, see . */ #include #include #include #include #ifdef OPENGL_CB_ENABLED #include #ifdef GDK_WINDOWING_X11 #include #include #endif #ifdef GDK_WINDOWING_WAYLAND #include #include #endif #ifdef GDK_WINDOWING_WIN32 #include #include #endif #else #ifdef GDK_WINDOWING_X11 #include #else #error "X11 GDK backend is required when opengl-cb is disabled." #endif #endif #include "def.h" #include "common.h" #include "menu.h" #include "mpv.h" #include "keybind.h" #include "playlist.h" #include "playbackctl.h" #include "actionctl.h" #include "main_window.h" #include "control_box.h" #include "playlist_widget.h" #include "mpris/mpris.h" #include "media_keys/media_keys.h" static gboolean draw_handler(GtkWidget *widget, cairo_t *cr, gpointer data); static gboolean load_files(gpointer data); static gboolean delete_handler( GtkWidget *widget, GdkEvent* event, gpointer data ); static void setup_dnd_targets(gmpv_handle *ctx); static void connect_signals(gmpv_handle *ctx); static void add_accelerator( GtkApplication *app, const char *accel, const char *action ); static void setup_accelerators(gmpv_handle *ctx); static GMenu *build_app_menu(void); static void app_startup_handler(GApplication *app, gpointer data); static void app_activate_handler(GApplication *app, gpointer data); static void app_open_handler( GApplication *app, gpointer files, gint n_files, gchar *hint, gpointer data ); static void drag_data_handler( GtkWidget *widget, GdkDragContext *context, gint x, gint y, GtkSelectionData *sel_data, guint info, guint time, gpointer data); static gboolean key_press_handler( GtkWidget *widget, GdkEvent *event, gpointer data ); static gboolean mouse_press_handler( GtkWidget *widget, GdkEvent *event, gpointer data ); static gboolean get_use_opengl(void); static gint64 get_xid(GtkWidget *widget); #ifdef OPENGL_CB_ENABLED static void *get_proc_address(void *fn_ctx, const gchar *name); static gboolean vid_area_render_handler( GtkGLArea *area, GdkGLContext *context, gpointer data ); static void *get_proc_address(void *fn_ctx, const gchar *name) { GdkDisplay *display = gdk_display_get_default(); #ifdef GDK_WINDOWING_WAYLAND if (GDK_IS_WAYLAND_DISPLAY(display)) return eglGetProcAddress(name); #endif #ifdef GDK_WINDOWING_X11 if (GDK_IS_X11_DISPLAY(display)) return (void *)(intptr_t)glXGetProcAddressARB((const GLubyte *)name); #endif #ifdef GDK_WINDOWING_WIN32 if (GDK_IS_WIN32_DISPLAY(display)) return wglGetProcAddress(name); #endif g_assert_not_reached(); } static gboolean vid_area_render_handler( GtkGLArea *area, GdkGLContext *context, gpointer data ) { gmpv_handle *ctx = data; int width; int height; int fbo; if(!ctx->opengl_ready) { mpv_check_error(mpv_opengl_cb_init_gl( ctx->opengl_ctx, NULL, get_proc_address, NULL )); ctx->opengl_ready = TRUE; } width = gtk_widget_get_allocated_width(GTK_WIDGET(area)); height = (-1)*gtk_widget_get_allocated_height(GTK_WIDGET(area)); fbo = -1; glGetIntegerv(GL_FRAMEBUFFER_BINDING, &fbo); mpv_opengl_cb_draw(ctx->opengl_ctx, fbo, width, height); return TRUE; } #endif static gboolean draw_handler(GtkWidget *widget, cairo_t *cr, gpointer data) { gmpv_handle *ctx = data; guint signal_id = g_signal_lookup("draw", MAIN_WINDOW_TYPE); g_signal_handlers_disconnect_matched( widget, G_SIGNAL_MATCH_ID |G_SIGNAL_MATCH_DATA, signal_id, 0, 0, NULL, ctx ); mpv_init(ctx); mpv_set_wakeup_callback(ctx->mpv_ctx, mpv_wakeup_callback, ctx); if(!ctx->files) { control_box_set_enabled (CONTROL_BOX(ctx->gui->control_box), FALSE); } return FALSE; } static gboolean load_files(gpointer data) { gmpv_handle *ctx = data; if(ctx->files) { gint i = 0; ctx->paused = FALSE; playlist_widget_clear(PLAYLIST_WIDGET(ctx->gui->playlist)); for(i = 0; ctx->files[i]; i++) { gchar *name = get_name_from_path(ctx->files[i]); if(ctx->init_load) { playlist_widget_append ( PLAYLIST_WIDGET (ctx->gui->playlist), name, ctx->files[i] ); } else { mpv_load( ctx, ctx->files[i], (i != 0), TRUE ); } g_free(name); } g_strfreev(ctx->files); } return FALSE; } static gboolean delete_handler( GtkWidget *widget, GdkEvent *event, gpointer data ) { quit(data); return FALSE; } static void drag_data_handler( GtkWidget *widget, GdkDragContext *context, gint x, gint y, GtkSelectionData *sel_data, guint info, guint time, gpointer data) { gboolean append = (widget == ((gmpv_handle *)data)->gui->playlist); if(sel_data && gtk_selection_data_get_length(sel_data) > 0) { gmpv_handle *ctx = data; gchar **uri_list = gtk_selection_data_get_uris(sel_data); ctx->paused = FALSE; if(uri_list) { int i; for(i = 0; uri_list[i]; i++) { mpv_load( ctx, uri_list[i], (append || i != 0), TRUE ); } g_strfreev(uri_list); } else { const guchar *raw_data = gtk_selection_data_get_data(sel_data); mpv_load(ctx, (const gchar *)raw_data, append, TRUE); } } } static gboolean key_press_handler( GtkWidget *widget, GdkEvent *event, gpointer data ) { gmpv_handle *ctx = data; guint keyval = ((GdkEventKey*)event)->keyval; guint state = ((GdkEventKey*)event)->state; gchar *command; const guint mod_mask = GDK_MODIFIER_MASK &~(GDK_SHIFT_MASK |GDK_LOCK_MASK |GDK_MOD2_MASK |GDK_MOD3_MASK |GDK_MOD4_MASK |GDK_MOD5_MASK); /* Ignore insignificant modifiers (eg. numlock) */ state &= mod_mask; command = keybind_get_command(ctx, FALSE, state, keyval); /* Try user-specified keys first, then fallback to hard-coded keys */ if(command) { mpv_command_string(ctx->mpv_ctx, command); } else if((state&mod_mask) == 0) { /* Accept F11 and f for entering/exiting fullscreen mode. ESC is * only used for exiting fullscreen mode. F11 is handled via * accelrator. */ if((ctx->gui->fullscreen && keyval == GDK_KEY_Escape) || keyval == GDK_KEY_f) { GAction *action ; action = g_action_map_lookup_action (G_ACTION_MAP(ctx->app), "fullscreen"); g_action_activate(action, NULL); } else if(keyval == GDK_KEY_Delete && main_window_get_playlist_visible(ctx->gui)) { remove_current_playlist_entry(ctx); } } return FALSE; } static gboolean mouse_press_handler( GtkWidget *widget, GdkEvent *event, gpointer data ) { gmpv_handle *ctx = data; GdkEventButton *btn_event = (GdkEventButton *)event; gchar *command; command = keybind_get_command( ctx, TRUE, btn_event->type == GDK_2BUTTON_PRESS, btn_event->button ); if(command) { mpv_command_string(ctx->mpv_ctx, command); } return TRUE; } static void app_activate_handler(GApplication *app, gpointer data) { gtk_window_present(GTK_WINDOW(((gmpv_handle *)data)->gui)); } static gboolean get_use_opengl(void) { #if defined(OPENGL_CB_ENABLED) && defined(GDK_WINDOWING_X11) /* TODO: Add option to use opengl on X11 */ return !GDK_IS_X11_DISPLAY(gdk_display_get_default()) ; #elif defined(OPENGL_CB_ENABLED) /* In theory this can work on any backend supporting GtkGLArea */ return TRUE; #else return FALSE; #endif } static gint64 get_xid(GtkWidget *widget) { #ifdef GDK_WINDOWING_X11 return (gint64)gdk_x11_window_get_xid(gtk_widget_get_window(widget)); #else return -1; #endif } static void app_open_handler( GApplication *app, gpointer files, gint n_files, gchar *hint, gpointer data ) { gmpv_handle *ctx = data; gint i; if(n_files > 0) { ctx->files = g_malloc(sizeof(GFile *)*(gsize)(n_files+1)); for(i = 0; i < n_files; i++) { ctx->files[i] = g_file_get_uri(((GFile **)files)[i]); } ctx->files[i] = NULL; g_idle_add(load_files, ctx); } } static void setup_dnd_targets(gmpv_handle *ctx) { PlaylistWidget *playlist; GtkTargetEntry target_entry[3]; playlist = PLAYLIST_WIDGET(ctx->gui->playlist); target_entry[0].target = "text/uri-list"; target_entry[0].flags = 0; target_entry[0].info = 0; target_entry[1].target = "text/plain"; target_entry[1].flags = 0; target_entry[1].info = 1; target_entry[2].target = "STRING"; target_entry[2].flags = 0; target_entry[2].info = 1; gtk_drag_dest_set( GTK_WIDGET(ctx->gui->vid_area), GTK_DEST_DEFAULT_ALL, target_entry, 3, GDK_ACTION_LINK ); gtk_drag_dest_set( GTK_WIDGET(playlist), GTK_DEST_DEFAULT_ALL, target_entry, 3, GDK_ACTION_COPY ); gtk_drag_dest_add_uri_targets(GTK_WIDGET(ctx->gui->vid_area)); gtk_drag_dest_add_uri_targets(GTK_WIDGET(playlist)); } static void connect_signals(gmpv_handle *ctx) { PlaylistWidget *playlist = PLAYLIST_WIDGET(ctx->gui->playlist); playbackctl_connect_signals(ctx); #ifdef OPENGL_CB_ENABLED if(main_window_get_use_opengl(ctx->gui)) { g_signal_connect( ctx->gui->vid_area, "render", G_CALLBACK(vid_area_render_handler), ctx ); } #endif g_signal_connect( ctx->gui->vid_area, "drag-data-received", G_CALLBACK(drag_data_handler), ctx ); g_signal_connect( ctx->gui->playlist, "drag-data-received", G_CALLBACK(drag_data_handler), ctx ); g_signal_connect( ctx->gui, "draw", G_CALLBACK(draw_handler), ctx ); g_signal_connect( ctx->gui, "delete-event", G_CALLBACK(delete_handler), ctx ); g_signal_connect( ctx->gui, "key-press-event", G_CALLBACK(key_press_handler), ctx ); g_signal_connect( ctx->gui->vid_area, "button-press-event", G_CALLBACK(mouse_press_handler), ctx ); g_signal_connect( playlist->tree_view, "row-activated", G_CALLBACK(playlist_row_handler), ctx ); g_signal_connect( playlist->list_store, "row-inserted", G_CALLBACK(playlist_row_inserted_handler), ctx ); g_signal_connect( playlist->list_store, "row-deleted", G_CALLBACK(playlist_row_deleted_handler), ctx ); } static inline void add_accelerator( GtkApplication *app, const char *accel, const char *action ) { const char *const accels[] = {accel, NULL}; gtk_application_set_accels_for_action(app, action, accels); } static void setup_accelerators(gmpv_handle *ctx) { add_accelerator(ctx->app, "o", "app.open(false)"); add_accelerator(ctx->app, "l", "app.openloc"); add_accelerator(ctx->app, "S", "app.playlist_save"); add_accelerator(ctx->app, "q", "app.quit"); add_accelerator(ctx->app, "p", "app.pref"); add_accelerator(ctx->app, "F9", "app.playlist_toggle"); add_accelerator(ctx->app, "1", "app.normalsize"); add_accelerator(ctx->app, "2", "app.doublesize"); add_accelerator(ctx->app, "3", "app.halfsize"); add_accelerator(ctx->app, "F11", "app.fullscreen"); } static GMenu *build_app_menu() { GMenu *menu; GMenu *top_section; GMenu *bottom_section; GMenuItem *pref_menu_item; GMenuItem *about_menu_item; GMenuItem *quit_menu_item; menu = g_menu_new(); top_section = g_menu_new(); bottom_section = g_menu_new(); pref_menu_item = g_menu_item_new(_("_Preferences"), "app.pref"); about_menu_item = g_menu_item_new(_("_About"), "app.about"); quit_menu_item = g_menu_item_new(_("_Quit"), "app.quit"); g_menu_append_section(menu, NULL, G_MENU_MODEL(top_section)); g_menu_append_section(menu, NULL, G_MENU_MODEL(bottom_section)); g_menu_append_item(top_section, pref_menu_item); g_menu_append_item(bottom_section, about_menu_item); g_menu_append_item(bottom_section, quit_menu_item); return menu; } static void app_startup_handler(GApplication *app, gpointer data) { gmpv_handle *ctx = data; const gchar *vid_area_style = ".gmpv-vid-area{background-color: black}"; GtkCssProvider *style_provider; gboolean css_loaded; gboolean use_opengl; gboolean config_migrated; gboolean mpvinput_enable; gboolean csd_enable; gboolean dark_theme_enable; gchar *mpvinput; setlocale(LC_NUMERIC, "C"); g_set_application_name(_("GNOME MPV")); gtk_window_set_default_icon_name(ICON_NAME); bindtextdomain(GETTEXT_PACKAGE, PACKAGE_LOCALEDIR); bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8"); textdomain(GETTEXT_PACKAGE); use_opengl = get_use_opengl(); ctx->mpv_ctx = mpv_create(); ctx->files = NULL; ctx->opengl_ctx = NULL; ctx->opengl_ready = FALSE; ctx->paused = TRUE; ctx->loaded = FALSE; ctx->new_file = TRUE; ctx->sub_visible = TRUE; ctx->init_load = TRUE; ctx->inhibit_cookie = 0; ctx->playlist_move_dest = -1; ctx->log_level_list = NULL; ctx->keybind_list = NULL; ctx->config = g_settings_new(CONFIG_ROOT); ctx->app = GTK_APPLICATION(app); ctx->gui = MAIN_WINDOW(main_window_new(ctx->app, use_opengl)); ctx->fs_control = NULL; ctx->playlist_store = PLAYLIST_WIDGET(ctx->gui->playlist)->list_store; config_migrated = migrate_config(ctx); style_provider = gtk_css_provider_new(); css_loaded = gtk_css_provider_load_from_data (style_provider, vid_area_style, -1, NULL); if(!css_loaded) { g_warning ("Failed to apply background color css"); } gtk_style_context_add_provider_for_screen ( gtk_window_get_screen(GTK_WINDOW(ctx->gui)), GTK_STYLE_PROVIDER(style_provider), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION ); g_object_unref(style_provider); csd_enable = g_settings_get_boolean (ctx->config, "csd-enable"); dark_theme_enable = g_settings_get_boolean (ctx->config, "dark-theme-enable"); mpvinput_enable = g_settings_get_boolean (ctx->config, "mpv-input-config-enable"); mpvinput = g_settings_get_string (ctx->config, "mpv-input-config-file"); if(csd_enable) { gtk_application_set_app_menu (ctx->app, G_MENU_MODEL(build_app_menu())); main_window_enable_csd(ctx->gui); } else { GMenu *full_menu = g_menu_new(); menu_build_full(full_menu, NULL, NULL, NULL); gtk_application_set_app_menu (ctx->app, NULL); gtk_application_set_menubar(ctx->app, G_MENU_MODEL(full_menu)); } gtk_widget_show_all(GTK_WIDGET(ctx->gui)); if(csd_enable) { control_box_set_fullscreen_btn_visible (CONTROL_BOX(ctx->gui->control_box), FALSE); } control_box_set_chapter_enabled (CONTROL_BOX(ctx->gui->control_box), FALSE); if(!main_window_get_use_opengl(ctx->gui)) { ctx->vid_area_wid = get_xid(ctx->gui->vid_area); } g_assert( main_window_get_use_opengl(ctx->gui) || ctx->vid_area_wid != -1 ); main_window_load_state(ctx->gui); setup_accelerators(ctx); setup_dnd_targets(ctx); actionctl_map_actions(ctx); connect_signals(ctx); load_keybind(ctx, mpvinput_enable?mpvinput:NULL, FALSE); mpris_init(ctx); media_keys_init(ctx); g_object_set( ctx->gui->settings, "gtk-application-prefer-dark-theme", dark_theme_enable, NULL ); g_timeout_add( SEEK_BAR_UPDATE_INTERVAL, (GSourceFunc)update_seek_bar, ctx ); if(config_migrated) { gchar *config_file; gchar *backup_config_file; GtkWidget *dialog; config_file = get_config_file_path(); backup_config_file = g_strconcat(config_file, ".bak", NULL); dialog = gtk_message_dialog_new ( GTK_WINDOW(ctx->gui), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, _("Preferences is now stored using " "GSettings. Your preferences have been " "migrated from the configuration file. " "A backup copy of the configuration " "file can be found at \"%s\"."), backup_config_file ); gtk_dialog_run(GTK_DIALOG(dialog)); gtk_widget_destroy(dialog); g_free(config_file); g_free(backup_config_file); } g_free(mpvinput); } int main(int argc, char **argv) { GtkApplication *app; gmpv_handle *ctx; gint status; #ifndef OPENGL_CB_ENABLED gdk_set_allowed_backends("x11"); #endif app = gtk_application_new(APP_ID, G_APPLICATION_HANDLES_OPEN); ctx = g_malloc(sizeof(gmpv_handle)); g_signal_connect( app, "startup", G_CALLBACK(app_startup_handler), ctx ); g_signal_connect( app, "activate", G_CALLBACK(app_activate_handler), ctx ); g_signal_connect( app, "open", G_CALLBACK(app_open_handler), ctx ); status = g_application_run(G_APPLICATION(app), argc, argv); g_object_unref(app); return status; } gnome-mpv-0.7/src/main_window.c000066400000000000000000000423111265310212500165310ustar00rootroot00000000000000/* * Copyright (c) 2014-2015 gnome-mpv * * This file is part of GNOME MPV. * * GNOME MPV 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. * * GNOME MPV 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 GNOME MPV. If not, see . */ #include "def.h" #include "menu.h" #include "playlist_widget.h" #include "main_window.h" #include "control_box.h" enum { PROP_0, PROP_USE_OPENGL, N_PROPERTIES }; struct _MainWindowPrivate { gboolean use_opengl; }; static void vid_area_init(MainWindow *wnd, gboolean use_opengl); static GtkWidget *vid_area_new(gboolean use_opengl); static gboolean timeout_handler(gpointer data); static gboolean finalize_load_state(gpointer data); G_DEFINE_TYPE_WITH_PRIVATE(MainWindow, main_window, GTK_TYPE_APPLICATION_WINDOW) static void main_window_set_property( GObject *object, guint property_id, const GValue *value, GParamSpec *pspec ) { MainWindow *self = MAIN_WINDOW(object); /* PROP_USE_OPENGL can only be set once during construction */ if(property_id == PROP_USE_OPENGL) { self->priv->use_opengl = g_value_get_boolean(value); vid_area_init(self, self->priv->use_opengl); } else { G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec); } } static void main_window_get_property( GObject *object, guint property_id, GValue *value, GParamSpec *pspec ) { MainWindow *self = MAIN_WINDOW(object); if(property_id == PROP_USE_OPENGL) { g_value_set_boolean(value, self->priv->use_opengl); } else { G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec); } } static gboolean fs_control_enter_handler( GtkWidget *widget, GdkEvent *event, gpointer data ) { MAIN_WINDOW(data)->fs_control_hover = TRUE; return FALSE; } static gboolean fs_control_leave_handler( GtkWidget *widget, GdkEvent *event, gpointer data ) { MAIN_WINDOW(data)->fs_control_hover = FALSE; return FALSE; } static gboolean motion_notify_handler(GtkWidget *widget, GdkEventMotion *event) { MainWindow *wnd = MAIN_WINDOW(widget); GdkCursor *cursor; cursor = gdk_cursor_new_from_name( gdk_display_get_default(), "default" ); gdk_window_set_cursor (gtk_widget_get_window(GTK_WIDGET(wnd->vid_area)), cursor); if(wnd->fullscreen) { gtk_widget_show(wnd->control_box); } if(wnd->timeout_tag > 0) { g_source_remove(wnd->timeout_tag); } wnd->timeout_tag = g_timeout_add_seconds( FS_CONTROL_HIDE_DELAY, timeout_handler, wnd ); return GTK_WIDGET_CLASS(main_window_parent_class) ->motion_notify_event(widget, event); } static gboolean configure_handler( GtkWidget *widget, GdkEvent *event, gpointer data ) { MainWindow *wnd = data; GdkEventConfigure *conf_event = (GdkEventConfigure *)event; guint signal_id = g_signal_lookup("configure-event", MAIN_WINDOW_TYPE); if(wnd->init_width == conf_event->width) { g_signal_handlers_disconnect_matched( wnd, G_SIGNAL_MATCH_ID |G_SIGNAL_MATCH_DATA, signal_id, 0, 0, NULL, data); g_idle_add((GSourceFunc)finalize_load_state, data); } return FALSE; } static void vid_area_init(MainWindow *wnd, gboolean use_opengl) { /* vid_area cannot be initialized more than once */ if(!wnd->vid_area) { GtkStyleContext *style_context; wnd->vid_area = vid_area_new(use_opengl); style_context = gtk_widget_get_style_context(wnd->vid_area); gtk_style_context_add_class(style_context, "gmpv-vid-area"); /* GDK_BUTTON_RELEASE_MASK is needed so that GtkMenuButtons can * hide their menus when vid_area is clicked. */ gtk_widget_add_events( wnd->vid_area, GDK_BUTTON_PRESS_MASK| GDK_BUTTON_RELEASE_MASK ); gtk_container_add( GTK_CONTAINER(wnd->vid_area_overlay), wnd->vid_area ); gtk_paned_pack1( GTK_PANED(wnd->vid_area_paned), wnd->vid_area_overlay, TRUE, TRUE ); } } static GtkWidget *vid_area_new(gboolean use_opengl) { #ifdef OPENGL_CB_ENABLED return use_opengl?gtk_gl_area_new():gtk_drawing_area_new(); #else return gtk_drawing_area_new(); #endif } static gboolean timeout_handler(gpointer data) { MainWindow *wnd; ControlBox *control_box; GtkScaleButton *button; GtkWidget *popup; wnd = data; control_box = CONTROL_BOX(wnd->control_box); button = GTK_SCALE_BUTTON(control_box->volume_button); popup = gtk_scale_button_get_popup(button); if(wnd->fullscreen && !wnd->fs_control_hover && !gtk_widget_is_visible(popup)) { GdkWindow *window; GdkCursor *cursor; window = gtk_widget_get_window(GTK_WIDGET(wnd->vid_area)); cursor = gdk_cursor_new_for_display (gdk_display_get_default(), GDK_BLANK_CURSOR); gdk_window_set_cursor(window, cursor); gtk_widget_hide(wnd->control_box); } wnd->timeout_tag = 0; return FALSE; } static gboolean finalize_load_state(gpointer data) { MainWindow *wnd = data; gtk_paned_set_position( GTK_PANED(wnd->vid_area_paned), wnd->init_width-wnd->playlist_width ); if(wnd->init_playlist_visible != main_window_get_playlist_visible(wnd)) { wnd->playlist_visible = wnd->init_playlist_visible; gtk_widget_set_visible( wnd->playlist, wnd->init_playlist_visible ); } return FALSE; } void main_window_save_state(MainWindow *wnd) { GSettings *settings; gint width; gint height; gint handle_pos; gdouble volume; settings = g_settings_new(CONFIG_WIN_STATE); handle_pos = gtk_paned_get_position(GTK_PANED(wnd->vid_area_paned)); volume = control_box_get_volume(CONTROL_BOX(wnd->control_box)); gtk_window_get_size(GTK_WINDOW(wnd), &width, &height); g_settings_set_int(settings, "width", width); g_settings_set_int(settings, "height", height); g_settings_set_double(settings, "volume", volume); g_settings_set_boolean( settings, "show-playlist", wnd->playlist_visible ); if(main_window_get_playlist_visible(wnd)) { g_settings_set_int( settings, "playlist-width", width-handle_pos ); } else { g_settings_set_int( settings, "playlist-width", wnd->playlist_width ); } g_clear_object(&settings); } void main_window_load_state(MainWindow *wnd) { GSettings *settings = g_settings_new(CONFIG_WIN_STATE); wnd->init_width = g_settings_get_int(settings, "width"); wnd->init_height = g_settings_get_int(settings, "height"); wnd->init_playlist_visible = g_settings_get_boolean(settings, "show-playlist"); g_signal_connect( wnd, "configure-event", G_CALLBACK(configure_handler), wnd ); /* This is needed even when show_playlist==false to initialize some * internal variables. */ main_window_set_playlist_visible(wnd, TRUE); wnd->playlist_width = g_settings_get_int(settings, "playlist-width"); control_box_set_volume( CONTROL_BOX(wnd->control_box), g_settings_get_double(settings, "volume") ); gtk_window_resize(GTK_WINDOW(wnd), wnd->init_width, wnd->init_height); g_clear_object(&settings); } void main_window_update_track_list( MainWindow *wnd, const GSList *audio_list, const GSList *video_list, const GSList *sub_list ) { if(main_window_get_csd_enabled(wnd)) { GMenu *menu = g_menu_new(); menu_build_menu_btn(menu, audio_list, video_list, sub_list); gtk_menu_button_set_menu_model ( GTK_MENU_BUTTON(wnd->menu_hdr_btn), G_MENU_MODEL(menu) ); } else { GtkApplication *app; GMenu *menu; app = gtk_window_get_application(GTK_WINDOW(wnd)); menu = G_MENU(gtk_application_get_menubar(app)); if(menu) { g_menu_remove_all(menu); menu_build_full(menu, audio_list, video_list, sub_list); } } } static void main_window_class_init(MainWindowClass *klass) { GObjectClass *obj_class = G_OBJECT_CLASS(klass); GtkWidgetClass *wgt_class = GTK_WIDGET_CLASS(klass); GParamSpec *pspec = NULL; obj_class->set_property = main_window_set_property; obj_class->get_property = main_window_get_property; wgt_class->motion_notify_event = motion_notify_handler; g_signal_new( "mpv-init", G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_FIRST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0 ); g_signal_new( "mpv-playback-restart", G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_FIRST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0 ); g_signal_new( "mpv-prop-change", G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_FIRST, 0, NULL, NULL, g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING ); pspec = g_param_spec_boolean ( "use-opengl", "Use OpenGL", "Whether or not to set up video area for opengl-cb", FALSE, G_PARAM_CONSTRUCT_ONLY|G_PARAM_READWRITE ); g_object_class_install_property(obj_class, PROP_USE_OPENGL, pspec); } static void main_window_init(MainWindow *wnd) { /* wnd->vid_area will be initialized when use-opengl property is set */ wnd->priv = main_window_get_instance_private(wnd); wnd->fullscreen = FALSE; wnd->playlist_visible = FALSE; wnd->fs_control_hover = FALSE; wnd->playlist_width = PLAYLIST_DEFAULT_WIDTH; wnd->timeout_tag = 0; wnd->init_width = MAIN_WINDOW_DEFAULT_WIDTH; wnd->init_height = MAIN_WINDOW_DEFAULT_HEIGHT; wnd->settings = gtk_settings_get_default(); wnd->header_bar = gtk_header_bar_new(); wnd->open_hdr_btn = NULL; wnd->fullscreen_hdr_btn = NULL; wnd->menu_hdr_btn = NULL; wnd->main_box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); wnd->vid_area_paned = gtk_paned_new(GTK_ORIENTATION_HORIZONTAL); wnd->vid_area_overlay = gtk_overlay_new(); wnd->control_box = control_box_new(); wnd->playlist = playlist_widget_new(); gtk_widget_add_events( wnd->vid_area_overlay, GDK_ENTER_NOTIFY_MASK |GDK_LEAVE_NOTIFY_MASK ); gtk_header_bar_set_show_close_button( GTK_HEADER_BAR(wnd->header_bar), TRUE ); gtk_window_set_title(GTK_WINDOW(wnd), g_get_application_name()); gtk_paned_set_position( GTK_PANED(wnd->vid_area_paned), MAIN_WINDOW_DEFAULT_WIDTH -PLAYLIST_DEFAULT_WIDTH ); gtk_window_set_default_size( GTK_WINDOW(wnd), MAIN_WINDOW_DEFAULT_WIDTH, MAIN_WINDOW_DEFAULT_HEIGHT ); gtk_box_pack_start (GTK_BOX(wnd->main_box), wnd->vid_area_paned, TRUE, TRUE, 0); gtk_paned_pack2 (GTK_PANED(wnd->vid_area_paned), wnd->playlist, FALSE, TRUE); gtk_container_add (GTK_CONTAINER(wnd->main_box), wnd->control_box); gtk_container_add (GTK_CONTAINER(wnd), wnd->main_box); g_signal_connect( wnd->vid_area_overlay, "enter-notify-event", G_CALLBACK(fs_control_enter_handler), wnd ); g_signal_connect( wnd->vid_area_overlay, "leave-notify-event", G_CALLBACK(fs_control_leave_handler), wnd ); } GtkWidget *main_window_new(GtkApplication *app, gboolean use_opengl) { return GTK_WIDGET(g_object_new( main_window_get_type(), "application", app, "use-opengl", use_opengl, NULL )); } void main_window_toggle_fullscreen(MainWindow *wnd) { ControlBox *control_box = CONTROL_BOX(wnd->control_box); GtkContainer* main_box = GTK_CONTAINER(wnd->main_box); GtkContainer *overlay = GTK_CONTAINER(wnd->vid_area_overlay); if(wnd->fullscreen) { GdkCursor *cursor; GdkWindow *vid_area; gtk_widget_set_halign(wnd->control_box, GTK_ALIGN_FILL); gtk_widget_set_valign(wnd->control_box, GTK_ALIGN_FILL); gtk_widget_set_size_request(wnd->control_box, -1, -1); g_object_ref(wnd->control_box); gtk_container_remove(overlay, wnd->control_box); gtk_container_add(main_box, wnd->control_box); g_object_unref(wnd->control_box); control_box_set_fullscreen_state(control_box, FALSE); gtk_window_unfullscreen(GTK_WINDOW(wnd)); gtk_widget_show(wnd->control_box); if(main_window_get_csd_enabled(wnd)) { control_box_set_fullscreen_btn_visible (CONTROL_BOX(wnd->control_box), FALSE); } else { gtk_application_window_set_show_menubar (GTK_APPLICATION_WINDOW(wnd), TRUE); } if(wnd->playlist_visible) { gtk_widget_show(wnd->playlist); } cursor = gdk_cursor_new_from_name (gdk_display_get_default(), "default"); vid_area = gtk_widget_get_window(GTK_WIDGET(wnd->vid_area)); gdk_window_set_cursor(vid_area, cursor); wnd->fullscreen = FALSE; } else { GdkScreen *screen; GdkWindow *window; GdkRectangle monitor_geom; gint width; gint monitor; screen = gtk_window_get_screen(GTK_WINDOW(wnd)); window = gtk_widget_get_window(GTK_WIDGET(wnd)); monitor = gdk_screen_get_monitor_at_window(screen, window); gdk_screen_get_monitor_geometry(screen, monitor, &monitor_geom); width = monitor_geom.width/2; gtk_widget_set_halign(wnd->control_box, GTK_ALIGN_CENTER); gtk_widget_set_valign(wnd->control_box, GTK_ALIGN_END); gtk_widget_set_size_request(wnd->control_box, width, -1); g_object_ref(wnd->control_box); gtk_container_remove(main_box, wnd->control_box); gtk_overlay_add_overlay(GTK_OVERLAY(overlay), wnd->control_box); g_object_unref(wnd->control_box); control_box_set_fullscreen_state(control_box, TRUE); gtk_window_fullscreen(GTK_WINDOW(wnd)); gtk_window_present(GTK_WINDOW(wnd)); gtk_widget_hide(wnd->control_box); if(main_window_get_csd_enabled(wnd)) { control_box_set_fullscreen_btn_visible (CONTROL_BOX(wnd->control_box), TRUE); } else { gtk_application_window_set_show_menubar (GTK_APPLICATION_WINDOW(wnd), FALSE); } if(wnd->playlist_visible) { gtk_widget_hide(wnd->playlist); } wnd->fullscreen = TRUE; timeout_handler(wnd); } } void main_window_reset(MainWindow *wnd) { gtk_window_set_title(GTK_WINDOW(wnd), g_get_application_name()); control_box_reset_control(CONTROL_BOX(wnd->control_box)); } gint main_window_get_width_margin(MainWindow *wnd) { return gtk_widget_get_allocated_width(GTK_WIDGET(wnd)) - gtk_widget_get_allocated_width(wnd->vid_area); } gint main_window_get_height_margin(MainWindow *wnd) { return gtk_widget_get_allocated_height(GTK_WIDGET(wnd)) - gtk_widget_get_allocated_height(wnd->vid_area); } gboolean main_window_get_use_opengl(MainWindow *wnd) { return wnd->priv->use_opengl; } void main_window_enable_csd(MainWindow *wnd) { GMenu *menu_btn_menu; GMenu *open_btn_menu; GIcon *open_icon; GIcon *fullscreen_icon; GIcon *menu_icon; open_btn_menu = g_menu_new(); menu_btn_menu = g_menu_new(); open_icon = g_themed_icon_new_with_default_fallbacks ("list-add-symbolic"); fullscreen_icon = g_themed_icon_new_with_default_fallbacks ("view-fullscreen-symbolic"); menu_icon = g_themed_icon_new_with_default_fallbacks ("view-list-symbolic"); wnd->playlist_width = PLAYLIST_DEFAULT_WIDTH+PLAYLIST_CSD_WIDTH_OFFSET; wnd->open_hdr_btn = gtk_menu_button_new(); wnd->fullscreen_hdr_btn = gtk_button_new(); wnd->menu_hdr_btn = gtk_menu_button_new(); menu_build_open_btn(open_btn_menu); menu_build_menu_btn(menu_btn_menu, NULL, NULL, NULL); gtk_widget_set_can_focus(wnd->open_hdr_btn, FALSE); gtk_widget_set_can_focus(wnd->fullscreen_hdr_btn, FALSE); gtk_widget_set_can_focus(wnd->menu_hdr_btn, FALSE); gtk_button_set_image ( GTK_BUTTON(wnd->fullscreen_hdr_btn), gtk_image_new_from_gicon (fullscreen_icon, GTK_ICON_SIZE_MENU )); gtk_button_set_image ( GTK_BUTTON(wnd->open_hdr_btn), gtk_image_new_from_gicon (open_icon, GTK_ICON_SIZE_MENU )); gtk_button_set_image ( GTK_BUTTON(wnd->menu_hdr_btn), gtk_image_new_from_gicon (menu_icon, GTK_ICON_SIZE_MENU )); gtk_menu_button_set_menu_model ( GTK_MENU_BUTTON(wnd->open_hdr_btn), G_MENU_MODEL(open_btn_menu) ); gtk_menu_button_set_menu_model ( GTK_MENU_BUTTON(wnd->menu_hdr_btn), G_MENU_MODEL(menu_btn_menu) ); gtk_header_bar_pack_start (GTK_HEADER_BAR(wnd->header_bar), wnd->open_hdr_btn); gtk_header_bar_pack_end (GTK_HEADER_BAR(wnd->header_bar), wnd->menu_hdr_btn); gtk_header_bar_pack_end (GTK_HEADER_BAR(wnd->header_bar), wnd->fullscreen_hdr_btn); gtk_actionable_set_action_name (GTK_ACTIONABLE(wnd->fullscreen_hdr_btn), "app.fullscreen"); gtk_paned_set_position( GTK_PANED(wnd->vid_area_paned), MAIN_WINDOW_DEFAULT_WIDTH -PLAYLIST_DEFAULT_WIDTH -PLAYLIST_CSD_WIDTH_OFFSET ); gtk_window_set_titlebar(GTK_WINDOW(wnd), wnd->header_bar); gtk_window_set_title(GTK_WINDOW(wnd), g_get_application_name()); } gboolean main_window_get_csd_enabled(MainWindow *wnd) { return wnd->open_hdr_btn && wnd->fullscreen_hdr_btn && wnd->menu_hdr_btn; } void main_window_set_playlist_visible(MainWindow *wnd, gboolean visible) { gint offset; gint handle_pos; gint width; gint height; offset = main_window_get_csd_enabled(wnd)?PLAYLIST_CSD_WIDTH_OFFSET:0; handle_pos = gtk_paned_get_position(GTK_PANED(wnd->vid_area_paned)); gtk_window_get_size(GTK_WINDOW(wnd), &width, &height); if(!visible && wnd->playlist_visible) { wnd->playlist_width = width-handle_pos; } wnd->playlist_visible = visible; gtk_widget_set_visible(wnd->playlist, visible); /* For some unknown reason, width needs to be adjusted by some offset * (50px) when CSD is enabled for the resulting size to be correct. */ gtk_window_resize( GTK_WINDOW(wnd), visible ?width+wnd->playlist_width-offset :handle_pos+offset, height ); } gboolean main_window_get_playlist_visible(MainWindow *wnd) { return gtk_widget_get_visible(GTK_WIDGET(wnd->playlist)); } gnome-mpv-0.7/src/main_window.h000066400000000000000000000054531265310212500165440ustar00rootroot00000000000000/* * Copyright (c) 2014-2015 gnome-mpv * * This file is part of GNOME MPV. * * GNOME MPV 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. * * GNOME MPV 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 GNOME MPV. If not, see . */ #ifndef MAIN_WINDOW_H #define MAIN_WINDOW_H #include G_BEGIN_DECLS #define MAIN_WINDOW_TYPE (main_window_get_type ()) #define MAIN_WINDOW(obj) \ (G_TYPE_CHECK_INSTANCE_CAST((obj), MAIN_WINDOW_TYPE, MainWindow)) #define MAIN_WINDOW_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST((klass), MAIN_WINDOW_TYPE, MainWindowClass)) #define IS_MAIN_WINDOW(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE((obj), MAIN_WINDOW_TYPE)) #define IS_MAIN_WINDOW_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE((klass), MAIN_WINDOW_TYPE)) typedef struct _MainWindow MainWindow; typedef struct _MainWindowClass MainWindowClass; typedef struct _MainWindowPrivate MainWindowPrivate; struct _MainWindow { GtkApplicationWindow parent_instance; MainWindowPrivate *priv; gboolean fullscreen; gboolean playlist_visible; gboolean fs_control_hover; gint playlist_width; gint init_width; gint init_height; gint init_playlist_visible; guint timeout_tag; GtkSettings* settings; GtkWidget *header_bar; GtkWidget *open_hdr_btn; GtkWidget *fullscreen_hdr_btn; GtkWidget *menu_hdr_btn; GtkWidget *main_box; GtkWidget *vid_area_paned; GtkWidget *vid_area_overlay; GtkWidget *vid_area; GtkWidget *control_box; GtkWidget *playlist; }; struct _MainWindowClass { GtkApplicationWindowClass parent_class; }; GtkWidget *main_window_new(GtkApplication *app, gboolean use_opengl); GType main_window_get_type(void); void main_window_toggle_fullscreen(MainWindow *wnd); void main_window_reset(MainWindow *wnd); void main_window_save_state(MainWindow *wnd); void main_window_load_state(MainWindow *wnd); void main_window_update_track_list( MainWindow *wnd, const GSList *audio_list, const GSList *video_list, const GSList *sub_list ); gint main_window_get_width_margin(MainWindow *wnd); gint main_window_get_height_margin(MainWindow *wnd); gboolean main_window_get_use_opengl(MainWindow *wnd); void main_window_enable_csd(MainWindow *wnd); gboolean main_window_get_csd_enabled(MainWindow *wnd); void main_window_set_playlist_visible(MainWindow *wnd, gboolean visible); gboolean main_window_get_playlist_visible(MainWindow *wnd); G_END_DECLS #endif gnome-mpv-0.7/src/media_keys/000077500000000000000000000000001265310212500161635ustar00rootroot00000000000000gnome-mpv-0.7/src/media_keys/media_keys.c000066400000000000000000000106011265310212500204370ustar00rootroot00000000000000/* * Copyright (c) 2015 gnome-mpv * * This file is part of GNOME MPV. * * GNOME MPV 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. * * GNOME MPV 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 GNOME MPV. If not, see . */ #include "media_keys.h" #include "def.h" static void set_paused(gmpv_handle *ctx, gboolean paused); static gboolean delete_handler( GtkWidget *widget, GdkEvent *event, gpointer data ); static void media_key_press_handler( GDBusProxy *proxy, gchar *sender_name, gchar *signal_name, GVariant *parameters, gpointer data ); static void proxy_ready_handler( GObject *source_object, GAsyncResult *res, gpointer data ); static void session_ready_handler( GObject *source_object, GAsyncResult *res, gpointer data ); static void set_paused(gmpv_handle *ctx, gboolean paused) { ctx->paused = paused; mpv_set_property( ctx->mpv_ctx, "pause", MPV_FORMAT_FLAG, &ctx->paused ); } static gboolean delete_handler( GtkWidget *widget, GdkEvent *event, gpointer data ) { media_keys *inst = data; g_signal_handler_disconnect( inst->gmpv_ctx->gui, inst->shutdown_sig_id ); g_signal_handler_disconnect( inst->proxy, inst->g_signal_sig_id ); g_object_unref(inst->proxy); g_object_unref(inst->session_bus_conn); g_free(inst); return FALSE; } static void media_key_press_handler( GDBusProxy *proxy, gchar *sender_name, gchar *signal_name, GVariant *parameters, gpointer data ) { media_keys *inst = data; gchar *application = NULL; gchar *key = NULL; if(g_strcmp0(signal_name, "MediaPlayerKeyPressed") == 0) { g_variant_get(parameters, "(&s&s)", &application, &key); } if(g_strcmp0(application, APP_ID) == 0) { if(g_strcmp0(key, "Next") == 0) { const gchar *cmd[] = {"playlist_next", "weak", NULL}; mpv_command(inst->gmpv_ctx->mpv_ctx, cmd); } else if(g_strcmp0(key, "Previous") == 0) { const gchar *cmd[] = {"playlist_prev", "weak", NULL}; mpv_command(inst->gmpv_ctx->mpv_ctx, cmd); } else if(g_strcmp0(key, "Pause") == 0) { set_paused(inst->gmpv_ctx, TRUE); } else if(g_strcmp0(key, "Stop") == 0) { const gchar *cmd[] = {"stop", NULL}; mpv_command(inst->gmpv_ctx->mpv_ctx, cmd); } else if(g_strcmp0(key, "Play") == 0) { set_paused(inst->gmpv_ctx, !inst->gmpv_ctx->paused); } else if(g_strcmp0(key, "FastForward") == 0) { const gchar *cmd[] = {"seek", "10", NULL}; mpv_command(inst->gmpv_ctx->mpv_ctx, cmd); } else if(g_strcmp0(key, "Rewind") == 0) { const gchar *cmd[] = {"seek", "-10", NULL}; mpv_command(inst->gmpv_ctx->mpv_ctx, cmd); } } } static void proxy_ready_handler( GObject *source_object, GAsyncResult *res, gpointer data ) { media_keys *inst = data; inst->proxy = g_dbus_proxy_new_finish(res, NULL); inst->g_signal_sig_id = g_signal_connect( inst->proxy, "g-signal", G_CALLBACK(media_key_press_handler), inst ); g_dbus_proxy_call( inst->proxy, "GrabMediaPlayerKeys", g_variant_new("(su)", APP_ID, 0), G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL, inst ); } static void session_ready_handler( GObject *source_object, GAsyncResult *res, gpointer data ) { media_keys *inst = data; inst->session_bus_conn = g_bus_get_finish(res, NULL); g_dbus_proxy_new( inst->session_bus_conn, G_DBUS_PROXY_FLAGS_NONE, NULL, "org.gnome.SettingsDaemon", "/org/gnome/SettingsDaemon/MediaKeys", "org.gnome.SettingsDaemon.MediaKeys", NULL, proxy_ready_handler, inst ); } void media_keys_init(gmpv_handle *gmpv_ctx) { media_keys *inst = g_malloc(sizeof(media_keys)); inst->gmpv_ctx = gmpv_ctx; inst->shutdown_sig_id = 0; inst->proxy = NULL; inst->session_bus_conn = NULL; inst->shutdown_sig_id = g_signal_connect( inst->gmpv_ctx->gui, "delete-event", G_CALLBACK(delete_handler), inst ); g_bus_get(G_BUS_TYPE_SESSION, NULL, session_ready_handler, inst); } gnome-mpv-0.7/src/media_keys/media_keys.h000066400000000000000000000020041265310212500204420ustar00rootroot00000000000000/* * Copyright (c) 2015 gnome-mpv * * This file is part of GNOME MPV. * * GNOME MPV 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. * * GNOME MPV 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 GNOME MPV. If not, see . */ #ifndef MEDIA_KEYS_H #define MEDIA_KEYS_H #include "common.h" typedef struct media_keys media_keys; struct media_keys { gmpv_handle *gmpv_ctx; gulong g_signal_sig_id; gulong shutdown_sig_id; GDBusProxy *proxy; GDBusConnection *session_bus_conn; }; void media_keys_init(gmpv_handle *gmpv_ctx); #endif gnome-mpv-0.7/src/menu.c000066400000000000000000000247221265310212500151700ustar00rootroot00000000000000/* * Copyright (c) 2015-2016 gnome-mpv * * This file is part of GNOME MPV. * * GNOME MPV 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. * * GNOME MPV 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 GNOME MPV. If not, see . */ #include #include "menu.h" #include "track.h" static void build_menu_from_track_list( GMenu *menu, const GSList *list, const gchar *action ); void build_menu_from_track_list( GMenu *menu, const GSList *list, const gchar *action ) { const GSList *iter = list; const glong max_len = 32; gchar *detailed_action; detailed_action = g_strdup_printf("app.%s(@x -1)", action); g_menu_append(menu, _("None"), detailed_action); g_free(detailed_action); while(iter) { Track *entry; glong entry_title_len; gchar *entry_title; gchar *title; entry = iter->data; /* For simplicity, also dup the default string used when the * track has no title. */ entry_title = g_strdup(entry->title?:_("Unknown")); /* Maximum number of bytes per UTF-8 character is 4 */ entry_title_len = g_utf8_strlen(entry_title, 4*(max_len+1)); if(entry_title_len > max_len) { /* Truncate the string */ *(g_utf8_offset_to_pointer(entry_title, max_len)) = '\0'; } detailed_action = g_strdup_printf( "app.%s" "(@x %" G_GINT64_FORMAT ")", action, entry->id ); /* Ellipsize the title if it's longer than max_len */ title = g_strdup_printf( entry->lang? "%s%s (%s)":"%s%s", entry_title, (entry_title_len > max_len)? "…":"", entry->lang ); g_menu_append(menu, title, detailed_action); iter = g_slist_next(iter); g_free(detailed_action); g_free(entry_title); g_free(title); } } void menu_build_full( GMenu *menu, const GSList *audio_list, const GSList *video_list, const GSList *sub_list ) { GMenu *file_menu; GMenu *edit_menu; GMenu *view_menu; GMenu *help_menu; GMenuItem *file_menu_item; GMenuItem *open_menu_item; GMenuItem *quit_menu_item; GMenuItem *open_loc_menu_item; GMenuItem *save_playlist_menu_item; GMenuItem *edit_menu_item; GMenuItem *pref_menu_item; GMenuItem *view_menu_item; GMenuItem *playlist_menu_item; GMenuItem *fullscreen_menu_item; GMenuItem *normal_size_menu_item; GMenuItem *double_size_menu_item; GMenuItem *half_size_menu_item; GMenuItem *help_menu_item; GMenuItem *about_menu_item; /* File */ file_menu = g_menu_new(); file_menu_item = g_menu_item_new_submenu (_("_File"), G_MENU_MODEL(file_menu)); open_menu_item = g_menu_item_new(_("_Open"), "app.open(false)"); quit_menu_item = g_menu_item_new(_("_Quit"), "app.quit"); open_loc_menu_item = g_menu_item_new(_("Open _Location"), "app.openloc"); save_playlist_menu_item = g_menu_item_new(_("_Save Playlist"), "app.playlist_save"); /* Edit */ edit_menu = g_menu_new(); edit_menu_item = g_menu_item_new_submenu (_("_Edit"), G_MENU_MODEL(edit_menu)); pref_menu_item = g_menu_item_new(_("_Preferences"), "app.pref"); /* View */ view_menu = g_menu_new(); view_menu_item = g_menu_item_new_submenu (_("_View"), G_MENU_MODEL(view_menu)); playlist_menu_item = g_menu_item_new(_("_Toggle Playlist"), "app.playlist_toggle"); fullscreen_menu_item = g_menu_item_new(_("_Fullscreen"), "app.fullscreen"); normal_size_menu_item = g_menu_item_new(_("_Normal Size"), "app.normalsize"); double_size_menu_item = g_menu_item_new(_("_Double Size"), "app.doublesize"); half_size_menu_item = g_menu_item_new(_("_Half Size"), "app.halfsize"); /* Help */ help_menu = g_menu_new(); help_menu_item = g_menu_item_new_submenu (_("_Help"), G_MENU_MODEL(help_menu)); about_menu_item = g_menu_item_new(_("_About"), "app.about"); if(video_list) { GMenu *video_menu = g_menu_new(); build_menu_from_track_list (video_menu, video_list, "video_select"); g_menu_append_submenu( edit_menu, _("_Video Track"), G_MENU_MODEL(video_menu) ); } /* If there is no track, then no file is playing and we can just leave * out track-related menu items. However, if there is something playing, * show both menu items for audio and subtitle tracks even if they are * empty so that the users can load external ones if they want. */ if(video_list || audio_list || sub_list) { GMenu *audio_menu = g_menu_new(); GMenu *sub_menu = g_menu_new(); GMenuItem *load_audio_menu_item; GMenuItem *load_sub_menu_item; load_audio_menu_item = g_menu_item_new( _("_Load External..."), "app.load_track('audio-add')" ); load_sub_menu_item = g_menu_item_new( _("_Load External..."), "app.load_track('sub-add')" ); build_menu_from_track_list (audio_menu, audio_list, "audio_select"); build_menu_from_track_list (sub_menu, sub_list, "sub_select"); g_menu_append_submenu( edit_menu, _("_Audio Track"), G_MENU_MODEL(audio_menu) ); g_menu_append_submenu( edit_menu, _("S_ubtitle Track"), G_MENU_MODEL(sub_menu) ); g_menu_append_item(audio_menu, load_audio_menu_item); g_menu_append_item(sub_menu, load_sub_menu_item); g_object_unref(load_audio_menu_item); g_object_unref(load_sub_menu_item); } g_menu_append_item(menu, file_menu_item); g_menu_append_item(file_menu, open_menu_item); g_menu_append_item(file_menu, open_loc_menu_item); g_menu_append_item(file_menu, save_playlist_menu_item); g_menu_append_item(file_menu, quit_menu_item); g_menu_append_item(menu, edit_menu_item); g_menu_append_item(edit_menu, pref_menu_item); g_menu_append_item(menu, view_menu_item); g_menu_append_item(view_menu, playlist_menu_item); g_menu_append_item(view_menu, fullscreen_menu_item); g_menu_append_item(view_menu, normal_size_menu_item); g_menu_append_item(view_menu, double_size_menu_item); g_menu_append_item(view_menu, half_size_menu_item); g_menu_append_item(menu, help_menu_item); g_menu_append_item(help_menu, about_menu_item); g_object_unref(file_menu_item); g_object_unref(open_menu_item); g_object_unref(open_loc_menu_item); g_object_unref(save_playlist_menu_item); g_object_unref(quit_menu_item); g_object_unref(edit_menu_item); g_object_unref(pref_menu_item); g_object_unref(view_menu_item); g_object_unref(playlist_menu_item); g_object_unref(fullscreen_menu_item); g_object_unref(normal_size_menu_item); g_object_unref(double_size_menu_item); g_object_unref(half_size_menu_item); g_object_unref(help_menu_item); g_object_unref(about_menu_item); } void menu_build_menu_btn( GMenu *menu, const GSList *audio_list, const GSList *video_list, const GSList *sub_list ) { GMenu *playlist; GMenu *track; GMenu *view; GMenuItem *playlist_section; GMenuItem *track_section; GMenuItem *view_section; GMenuItem *playlist_toggle_menu_item; GMenuItem *playlist_save_menu_item; GMenuItem *normal_size_menu_item; GMenuItem *double_size_menu_item; GMenuItem *half_size_menu_item; playlist = g_menu_new(); track = g_menu_new(); view = g_menu_new(); playlist_section = g_menu_item_new_section(NULL, G_MENU_MODEL(playlist)); track_section = g_menu_item_new_section(NULL, G_MENU_MODEL(track)); view_section = g_menu_item_new_section(NULL, G_MENU_MODEL(view)); playlist_toggle_menu_item = g_menu_item_new (_("_Toggle Playlist"), "app.playlist_toggle"); playlist_save_menu_item = g_menu_item_new (_("_Save Playlist"), "app.playlist_save"); normal_size_menu_item = g_menu_item_new (_("_Normal Size"), "app.normalsize"); double_size_menu_item = g_menu_item_new (_("_Double Size"), "app.doublesize"); half_size_menu_item = g_menu_item_new (_("_Half Size"), "app.halfsize"); if(video_list) { GMenu *video = g_menu_new(); GMenuItem *video_menu_item; video_menu_item = g_menu_item_new_submenu ( _("_Video Track"), G_MENU_MODEL(video) ); build_menu_from_track_list(video, video_list, "video_select"); g_menu_append_item(track, video_menu_item); g_object_unref(video_menu_item); } if(video_list || audio_list || sub_list) { GMenu *audio = g_menu_new(); GMenu *subtitle = g_menu_new(); GMenuItem *audio_menu_item; GMenuItem *subtitle_menu_item; GMenuItem *load_audio_menu_item; GMenuItem *load_sub_menu_item; audio_menu_item = g_menu_item_new_submenu (_("_Audio Track"), G_MENU_MODEL(audio)); subtitle_menu_item = g_menu_item_new_submenu (_("S_ubtitle Track"), G_MENU_MODEL(subtitle)); build_menu_from_track_list(audio, audio_list, "audio_select"); build_menu_from_track_list(subtitle, sub_list, "sub_select"); load_audio_menu_item = g_menu_item_new ( _("_Load External..."), "app.load_track('audio-add')" ); load_sub_menu_item = g_menu_item_new ( _("_Load External..."), "app.load_track('sub-add')" ); g_menu_append_item(track, audio_menu_item); g_menu_append_item(track, subtitle_menu_item); g_menu_append_item(audio, load_audio_menu_item); g_menu_append_item(subtitle, load_sub_menu_item); g_object_unref(audio_menu_item); g_object_unref(subtitle_menu_item); g_object_unref(load_audio_menu_item); g_object_unref(load_sub_menu_item); } g_menu_append_item(playlist, playlist_toggle_menu_item); g_menu_append_item(playlist, playlist_save_menu_item); g_menu_append_item(view, normal_size_menu_item); g_menu_append_item(view, double_size_menu_item); g_menu_append_item(view, half_size_menu_item); g_menu_append_item(menu, playlist_section); g_menu_append_item(menu, track_section); g_menu_append_item(menu, view_section); g_object_unref(playlist_toggle_menu_item); g_object_unref(playlist_save_menu_item); g_object_unref(normal_size_menu_item); g_object_unref(double_size_menu_item); g_object_unref(half_size_menu_item); g_object_unref(playlist_section); g_object_unref(track_section); g_object_unref(view_section); } void menu_build_open_btn(GMenu *menu) { GMenuItem *open_menu_item; GMenuItem *open_loc_menu_item; open_menu_item = g_menu_item_new(_("_Open"), "app.open(false)"); open_loc_menu_item = g_menu_item_new(_("Open _Location"), "app.openloc"); g_menu_append_item(menu, open_menu_item); g_menu_append_item(menu, open_loc_menu_item); g_object_unref(open_menu_item); g_object_unref(open_loc_menu_item); } gnome-mpv-0.7/src/menu.h000066400000000000000000000020551265310212500151700ustar00rootroot00000000000000/* * Copyright (c) 2015 gnome-mpv * * This file is part of GNOME MPV. * * GNOME MPV 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. * * GNOME MPV 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 GNOME MPV. If not, see . */ #ifndef MENU_H #define MENU_H #include void menu_build_full( GMenu *menu, const GSList *audio_list, const GSList *video_list, const GSList *sub_list ); void menu_build_menu_btn( GMenu *menu, const GSList *audio_list, const GSList *video_list, const GSList *sub_list ); void menu_build_open_btn(GMenu *menu); #endif gnome-mpv-0.7/src/mpris/000077500000000000000000000000001265310212500152035ustar00rootroot00000000000000gnome-mpv-0.7/src/mpris/mpris.c000066400000000000000000000074741265310212500165150ustar00rootroot00000000000000/* * Copyright (c) 2015 gnome-mpv * * This file is part of GNOME MPV. * * GNOME MPV 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. * * GNOME MPV 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 GNOME MPV. If not, see . */ #include #include #include #include "mpris.h" #include "mpris_base.h" #include "mpris_player.h" #include "mpris_gdbus.h" /* auto-generated */ #include "def.h" static void bus_acquired_handler( GDBusConnection *connection, const gchar *name, gpointer data ); static void name_lost_handler( GDBusConnection *connection, const gchar *name, gpointer data ); static gboolean delete_handler( GtkWidget *widget, GdkEvent *event, gpointer data ); static void unregister(mpris *inst); static void bus_acquired_handler( GDBusConnection *connection, const gchar *name, gpointer data ) { mpris *inst = data; inst->session_bus_conn = connection; mpris_base_register(inst); mpris_player_register(inst); } static void name_lost_handler( GDBusConnection *connection, const gchar *name, gpointer data ) { unregister(data); } static gboolean delete_handler( GtkWidget *widget, GdkEvent *event, gpointer data ) { mpris *inst = data; g_signal_handler_disconnect( inst->gmpv_ctx->gui, inst->shutdown_sig_id ); unregister(inst); g_bus_unown_name(inst->name_id); g_free(inst); return FALSE; } static void unregister(mpris *inst) { if(inst->base_reg_id > 0) { mpris_base_unregister(inst); } if(inst->player_reg_id > 0) { mpris_player_unregister(inst); } } void mpris_emit_prop_changed(mpris *inst, const mpris_prop_val_pair *prop_list) { const mpris_prop_val_pair *current; GDBusInterfaceInfo *iface; GVariantBuilder builder; GVariant *sig_args; current = prop_list; iface = mpris_org_mpris_media_player2_interface_info(); g_variant_builder_init(&builder, G_VARIANT_TYPE("a{sv}")); while(current && current->name != NULL) { g_variant_builder_add( &builder, "{sv}", current->name, current->value ); current++; } sig_args = g_variant_new( "(sa{sv}as)", iface->name, &builder, NULL ); g_dbus_connection_emit_signal ( inst->session_bus_conn, NULL, MPRIS_OBJ_ROOT_PATH, "org.freedesktop.DBus.Properties", "PropertiesChanged", sig_args, NULL ); } GVariant *mpris_build_g_variant_string_array(const gchar** list) { GVariantBuilder builder; gint i; g_variant_builder_init(&builder, G_VARIANT_TYPE("as")); for(i = 0; list[i]; i++) { g_variant_builder_add(&builder, "s", list[i]); } return g_variant_new("as", &builder); } void mpris_init(gmpv_handle *gmpv_ctx) { mpris *inst = g_malloc(sizeof(mpris)); inst->gmpv_ctx = gmpv_ctx; inst->name_id = 0; inst->base_reg_id = 0; inst->player_reg_id = 0; inst->shutdown_sig_id = 0; inst->base_sig_id_list = NULL; inst->player_sig_id_list = NULL; inst->pending_seek = -1; inst->base_prop_table = NULL; inst->player_prop_table = NULL; inst->session_bus_conn = NULL; inst->shutdown_sig_id = g_signal_connect( inst->gmpv_ctx->gui, "delete-event", G_CALLBACK(delete_handler), inst ); inst->name_id = g_bus_own_name( G_BUS_TYPE_SESSION, MPRIS_BUS_NAME, G_BUS_NAME_OWNER_FLAGS_NONE, (GBusAcquiredCallback) bus_acquired_handler, NULL, (GBusNameLostCallback) name_lost_handler, inst, NULL ); } gnome-mpv-0.7/src/mpris/mpris.h000066400000000000000000000026141265310212500165110ustar00rootroot00000000000000/* * Copyright (c) 2015 gnome-mpv * * This file is part of GNOME MPV. * * GNOME MPV 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. * * GNOME MPV 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 GNOME MPV. If not, see . */ #ifndef MPRIS_H #define MPRIS_H #include "common.h" typedef struct mpris mpris; typedef struct mpris_prop_val_pair mpris_prop_val_pair; struct mpris { gmpv_handle* gmpv_ctx; guint name_id; guint base_reg_id; guint player_reg_id; gulong shutdown_sig_id; gulong *base_sig_id_list; gulong *player_sig_id_list; gdouble pending_seek; GHashTable *base_prop_table; GHashTable *player_prop_table; GDBusConnection *session_bus_conn; }; struct mpris_prop_val_pair { gchar *name; GVariant *value; }; void mpris_emit_prop_changed(mpris *inst, const mpris_prop_val_pair *prop_list); GVariant *mpris_build_g_variant_string_array(const gchar** list); void mpris_init(gmpv_handle *gmpv_ctx); #endif gnome-mpv-0.7/src/mpris/mpris_base.c000066400000000000000000000153211265310212500174750ustar00rootroot00000000000000/* * Copyright (c) 2015 gnome-mpv * * This file is part of GNOME MPV. * * GNOME MPV 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. * * GNOME MPV 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 GNOME MPV. If not, see . */ #include "mpris_base.h" #include "mpris_gdbus.h" #include "def.h" static void prop_table_init(mpris *inst); static void method_handler( GDBusConnection *connection, const gchar *sender, const gchar *object_path, const gchar *interface_name, const gchar *method_name, GVariant *parameters, GDBusMethodInvocation *invocation, gpointer data ); static GVariant *get_prop_handler( GDBusConnection *connection, const gchar *sender, const gchar *object_path, const gchar *interface_name, const gchar *property_name, GError **error, gpointer data ); static gboolean set_prop_handler( GDBusConnection *connection, const gchar *sender, const gchar *object_path, const gchar *interface_name, const gchar *property_name, GVariant *value, GError **error, gpointer data ); static gboolean window_state_handler( GtkWidget *widget, GdkEvent *event, gpointer data ); static GVariant *get_supported_uri_schemes(void); static GVariant *get_supported_mime_types(void); static void prop_table_init(mpris *inst) { const gpointer default_values[] = { "CanQuit", g_variant_new_boolean(TRUE), "CanSetFullscreen", g_variant_new_boolean(TRUE), "CanRaise", g_variant_new_boolean(TRUE), "Fullscreen", g_variant_new_boolean(FALSE), "HasTrackList", g_variant_new_boolean(FALSE), "Identity", g_variant_new_string(g_get_application_name()), "DesktopEntry", g_variant_new_string(ICON_NAME), "SupportedUriSchemes", get_supported_uri_schemes(), "SupportedMimeTypes", get_supported_mime_types(), NULL }; gint i; for(i = 0; default_values[i]; i += 2) { g_hash_table_insert( inst->base_prop_table, default_values[i], default_values[i+1] ); } } static void method_handler( GDBusConnection *connection, const gchar *sender, const gchar *object_path, const gchar *interface_name, const gchar *method_name, GVariant *parameters, GDBusMethodInvocation *invocation, gpointer data ) { mpris *inst = data; if(g_strcmp0(method_name, "Raise") == 0) { gtk_window_present(GTK_WINDOW(inst->gmpv_ctx->gui)); } else if(g_strcmp0(method_name, "Quit") == 0) { quit(inst->gmpv_ctx); } g_dbus_method_invocation_return_value (invocation, g_variant_new("()", NULL)); } static GVariant *get_prop_handler( GDBusConnection *connection, const gchar *sender, const gchar *object_path, const gchar *interface_name, const gchar *property_name, GError **error, gpointer data ) { mpris *inst = data; GVariant *value; value = g_hash_table_lookup( inst->base_prop_table, property_name ); return value?g_variant_ref(value):NULL; } static gboolean set_prop_handler( GDBusConnection *connection, const gchar *sender, const gchar *object_path, const gchar *interface_name, const gchar *property_name, GVariant *value, GError **error, gpointer data ) { mpris *inst = data; if(g_strcmp0(property_name, "Fullscreen") == 0 && g_variant_get_boolean(value) != inst->gmpv_ctx->gui->fullscreen) { toggle_fullscreen(inst->gmpv_ctx); } else { g_hash_table_replace( ((mpris *) data)->base_prop_table, g_strdup(property_name), g_variant_ref(value) ); } return TRUE; /* This function should always succeed */ } static gboolean window_state_handler( GtkWidget *widget, GdkEvent *event, gpointer data ) { mpris *inst = data; GdkEventWindowState *window_state_event = (GdkEventWindowState *)event; if(window_state_event->changed_mask & GDK_WINDOW_STATE_FULLSCREEN) { GDBusInterfaceInfo *iface; GVariantBuilder builder; GVariant *value; GVariant *sig_args; g_variant_builder_init(&builder, G_VARIANT_TYPE("a{sv}")); iface = mpris_org_mpris_media_player2_interface_info(); value = g_variant_new_boolean(inst->gmpv_ctx->gui->fullscreen); g_variant_builder_add(&builder, "{sv}", "Fullscreen", value); sig_args = g_variant_new( "(sa{sv}as)", iface->name, &builder, NULL ); g_dbus_connection_emit_signal ( inst->session_bus_conn, NULL, MPRIS_OBJ_ROOT_PATH, "org.freedesktop.DBus.Properties", "PropertiesChanged", sig_args, NULL ); g_hash_table_replace( ((mpris *) data)->base_prop_table, g_strdup("Fullscreen"), g_variant_ref(value) ); } return FALSE; } static GVariant *get_supported_uri_schemes(void) { const gchar *protocols[] = SUPPORTED_PROTOCOLS; return mpris_build_g_variant_string_array(protocols); } static GVariant *get_supported_mime_types(void) { const gchar *mime_types[] = SUPPORTED_MIME_TYPES; return mpris_build_g_variant_string_array(mime_types); } void mpris_base_register(mpris *inst) { GDBusInterfaceVTable vtable; GDBusInterfaceInfo *iface; iface = mpris_org_mpris_media_player2_interface_info(); inst->base_prop_table = g_hash_table_new_full ( g_str_hash, g_str_equal, NULL, (GDestroyNotify) g_variant_unref ); inst->base_sig_id_list = g_malloc(2*sizeof(gulong)); inst->base_sig_id_list[0] = g_signal_connect( inst->gmpv_ctx->gui, "window-state-event", G_CALLBACK(window_state_handler), inst ); inst->base_sig_id_list[1] = 0; prop_table_init(inst); vtable.method_call = (GDBusInterfaceMethodCallFunc)method_handler; vtable.get_property = (GDBusInterfaceGetPropertyFunc)get_prop_handler; vtable.set_property = (GDBusInterfaceSetPropertyFunc)set_prop_handler; inst->base_reg_id = g_dbus_connection_register_object ( inst->session_bus_conn, MPRIS_OBJ_ROOT_PATH, iface, &vtable, inst, NULL, NULL ); } void mpris_base_unregister(mpris *inst) { gulong *current_sig_id = inst->base_sig_id_list; if(current_sig_id) { while(current_sig_id && *current_sig_id > 0) { g_signal_handler_disconnect( inst->gmpv_ctx->gui, *current_sig_id ); current_sig_id++; } g_dbus_connection_unregister_object( inst->session_bus_conn, inst->base_reg_id ); g_hash_table_remove_all(inst->base_prop_table); g_hash_table_unref(inst->base_prop_table); g_clear_pointer(&inst->base_sig_id_list, g_free); } } gnome-mpv-0.7/src/mpris/mpris_base.h000066400000000000000000000015451265310212500175050ustar00rootroot00000000000000/* * Copyright (c) 2015 gnome-mpv * * This file is part of GNOME MPV. * * GNOME MPV 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. * * GNOME MPV 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 GNOME MPV. If not, see . */ #ifndef MPRIS_BASE_H #define MPRIS_BASE_H #include "mpris.h" void mpris_base_register(mpris *inst); void mpris_base_unregister(mpris *inst); #endif gnome-mpv-0.7/src/mpris/mpris_player.c000066400000000000000000000413541265310212500200640ustar00rootroot00000000000000/* * Copyright (c) 2015 gnome-mpv * * This file is part of GNOME MPV. * * GNOME MPV 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. * * GNOME MPV 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 GNOME MPV. If not, see . */ #include #include "mpris_player.h" #include "mpris_gdbus.h" #include "mpv.h" #include "def.h" static void set_paused(gmpv_handle *ctx, gboolean paused); static void prop_table_init(mpris *inst); static void method_handler( GDBusConnection *connection, const gchar *sender, const gchar *object_path, const gchar *interface_name, const gchar *method_name, GVariant *parameters, GDBusMethodInvocation *invocation, gpointer data ); static GVariant *get_prop_handler( GDBusConnection *connection, const gchar *sender, const gchar *object_path, const gchar *interface_name, const gchar *property_name, GError **error, gpointer data ); static gboolean set_prop_handler( GDBusConnection *connection, const gchar *sender, const gchar *object_path, const gchar *interface_name, const gchar *property_name, GVariant *value, GError **error, gpointer data ); static void playback_status_update_handler(mpris *inst); static void playlist_update_handler(mpris *inst); static void speed_update_handler(mpris *inst); static void metadata_update_handler(mpris *inst); static void volume_update_handler(mpris *inst); static void mpv_init_handler(MainWindow *wnd, gpointer data); static void mpv_playback_restart_handler(MainWindow *wnd, gpointer data); static void mpv_prop_change_handler( MainWindow *wnd, gchar *name, gpointer data ); static void set_paused(gmpv_handle *ctx, gboolean paused) { ctx->paused = paused; mpv_set_property( ctx->mpv_ctx, "pause", MPV_FORMAT_FLAG, &ctx->paused ); } static void prop_table_init(mpris *inst) { /* Position is retrieved from mpv on-demand */ const gpointer default_values[] = { "PlaybackStatus", g_variant_new_string("Stopped"), "Rate", g_variant_new_double(1.0), "Metadata", g_variant_new("a{sv}", NULL), "Volume", g_variant_new_double(1.0), "MinimumRate", g_variant_new_double(0.01), "MaximumRate", g_variant_new_double(100.0), "CanGoNext", g_variant_new_boolean(FALSE), "CanGoPrevious", g_variant_new_boolean(FALSE), "CanPlay", g_variant_new_boolean(TRUE), "CanPause", g_variant_new_boolean(TRUE), "CanSeek", g_variant_new_boolean(FALSE), "CanControl", g_variant_new_boolean(TRUE), NULL }; gint i; for(i = 0; default_values[i]; i += 2) { g_hash_table_insert( inst->player_prop_table, default_values[i], default_values[i+1] ); } } static void method_handler( GDBusConnection *connection, const gchar *sender, const gchar *object_path, const gchar *interface_name, const gchar *method_name, GVariant *parameters, GDBusMethodInvocation *invocation, gpointer data ) { mpris *inst = data; if(g_strcmp0(method_name, "Next") == 0) { const gchar *cmd[] = {"playlist_next", "weak", NULL}; mpv_command(inst->gmpv_ctx->mpv_ctx, cmd); } else if(g_strcmp0(method_name, "Previous") == 0) { const gchar *cmd[] = {"playlist_prev", "weak", NULL}; mpv_command(inst->gmpv_ctx->mpv_ctx, cmd); } else if(g_strcmp0(method_name, "Pause") == 0) { set_paused(inst->gmpv_ctx, TRUE); } else if(g_strcmp0(method_name, "PlayPause") == 0) { set_paused(inst->gmpv_ctx, !inst->gmpv_ctx->paused); } else if(g_strcmp0(method_name, "Stop") == 0) { const gchar *cmd[] = {"stop", NULL}; mpv_command(inst->gmpv_ctx->mpv_ctx, cmd); } else if(g_strcmp0(method_name, "Play") == 0) { set_paused(inst->gmpv_ctx, FALSE); } else if(g_strcmp0(method_name, "Seek") == 0) { gint64 offset_us; gdouble position; g_variant_get(parameters, "(x)", &offset_us); mpv_get_property( inst->gmpv_ctx->mpv_ctx, "time-pos", MPV_FORMAT_DOUBLE, &position ); position += (gdouble)offset_us/1.0e6; mpv_set_property( inst->gmpv_ctx->mpv_ctx, "time-pos", MPV_FORMAT_DOUBLE, &position ); g_dbus_connection_emit_signal ( inst->session_bus_conn, NULL, MPRIS_OBJ_ROOT_PATH, interface_name, "Seeked", g_variant_new("(x)", (gint64)(position*1e6)), NULL ); } else if(g_strcmp0(method_name, "SetPosition") == 0) { const gchar *prefix = MPRIS_TRACK_ID_PREFIX; const gsize prefix_len = strlen(prefix); gint64 index; gint64 old_index; gint64 time_us; const gchar *track_id; g_variant_get(parameters, "(&ox)", &track_id, &time_us); if(strncmp(track_id, prefix, prefix_len) == 0) { inst->pending_seek = (gdouble)time_us/1.0e6; index = g_ascii_strtoll(track_id+prefix_len, NULL, 0); mpv_get_property( inst->gmpv_ctx->mpv_ctx, "playlist-pos", MPV_FORMAT_INT64, &old_index ); if(index != old_index) { mpv_set_property( inst->gmpv_ctx->mpv_ctx, "playlist-pos", MPV_FORMAT_INT64, &index ); } else { mpv_playback_restart_handler (inst->gmpv_ctx->gui, inst); } } } else if(g_strcmp0(method_name, "OpenUri") == 0) { const gchar *uri; g_variant_get(parameters, "(&s)", &uri); mpv_load(inst->gmpv_ctx, uri, FALSE, TRUE); } g_dbus_method_invocation_return_value (invocation, g_variant_new("()", NULL)); } static GVariant *get_prop_handler( GDBusConnection *connection, const gchar *sender, const gchar *object_path, const gchar *interface_name, const gchar *property_name, GError **error, gpointer data ) { mpris *inst = data; GVariant *value; if(g_strcmp0(property_name, "Position") == 0) { gdouble position; gint rc; rc = mpv_get_property( inst->gmpv_ctx->mpv_ctx, "time-pos", MPV_FORMAT_DOUBLE, &position ); value = g_variant_new_int64((gint64)((rc >= 0)*position*1e6)); } else { value = g_hash_table_lookup( inst->player_prop_table, property_name ); } return value?g_variant_ref(value):NULL; } static gboolean set_prop_handler( GDBusConnection *connection, const gchar *sender, const gchar *object_path, const gchar *interface_name, const gchar *property_name, GVariant *value, GError **error, gpointer data ) { mpris *inst = data; if(g_strcmp0(property_name, "Rate") == 0) { gdouble rate = g_variant_get_double(value); mpv_set_property( inst->gmpv_ctx->mpv_ctx, "speed", MPV_FORMAT_DOUBLE, &rate ); } else if(g_strcmp0(property_name, "Volume") == 0) { gdouble volume = 100*g_variant_get_double(value); mpv_set_property( inst->gmpv_ctx->mpv_ctx, "volume", MPV_FORMAT_DOUBLE, &volume ); } g_hash_table_replace( inst->player_prop_table, g_strdup(property_name), g_variant_ref(value) ); return TRUE; /* This function should always succeed */ } static void playback_status_update_handler(mpris *inst) { const gchar *state; mpris_prop_val_pair *prop_list; GVariant *state_value; GVariant *can_seek_value; gint idle; gint core_idle; gboolean can_seek; mpv_get_property( inst->gmpv_ctx->mpv_ctx, "idle", MPV_FORMAT_FLAG, &idle ); mpv_get_property( inst->gmpv_ctx->mpv_ctx, "core-idle", MPV_FORMAT_FLAG, &core_idle ); if(!core_idle && !idle) { state = "Playing"; can_seek = TRUE; mpv_playback_restart_handler(inst->gmpv_ctx->gui, inst); } else if(core_idle && idle) { state = "Stopped"; can_seek = FALSE; } else { state = "Paused"; can_seek = TRUE; } state_value = g_variant_new_string(state); can_seek_value = g_variant_new_boolean(can_seek); g_hash_table_replace( inst->player_prop_table, "PlaybackStatus", g_variant_ref(state_value) ); g_hash_table_replace( inst->player_prop_table, "CanSeek", g_variant_ref(can_seek_value) ); prop_list = (mpris_prop_val_pair[]) { {"PlaybackStatus", state_value}, {"CanSeek", can_seek_value}, {NULL, NULL} }; mpris_emit_prop_changed(inst, prop_list); } static void playlist_update_handler(mpris *inst) { mpris_prop_val_pair *prop_list; GVariant *can_prev_value; GVariant *can_next_value; gboolean can_prev; gboolean can_next; gint64 playlist_count; gint64 playlist_pos; gint rc = 0; rc |= mpv_get_property( inst->gmpv_ctx->mpv_ctx, "playlist-count", MPV_FORMAT_INT64, &playlist_count ); rc |= mpv_get_property( inst->gmpv_ctx->mpv_ctx, "playlist-pos", MPV_FORMAT_INT64, &playlist_pos ); can_prev = (rc >= 0 && playlist_pos > 0); can_next = (rc >= 0 && playlist_pos < playlist_count-1); can_prev_value = g_variant_new_boolean(can_prev); can_next_value = g_variant_new_boolean(can_next); g_hash_table_replace ( inst->player_prop_table, "CanGoPrevious", g_variant_ref(can_prev_value) ); g_hash_table_replace ( inst->player_prop_table, "CanGoNext", g_variant_ref(can_next_value) ); prop_list = (mpris_prop_val_pair[]) { {"CanGoPrevious", can_prev_value}, {"CanGoNext", can_next_value}, {NULL, NULL} }; mpris_emit_prop_changed(inst, prop_list); } static void speed_update_handler(mpris *inst) { gdouble speed; GVariant *value; mpris_prop_val_pair *prop_list; mpv_get_property( inst->gmpv_ctx->mpv_ctx, "speed", MPV_FORMAT_DOUBLE, &speed ); value = g_variant_new_double(speed); g_hash_table_replace ( inst->player_prop_table, "Rate", g_variant_ref(value) ); prop_list = (mpris_prop_val_pair[]) {{"Rate", value}, {NULL, NULL}}; mpris_emit_prop_changed(inst, prop_list); } static void metadata_update_handler(mpris *inst) { const struct { const gchar *mpv_name; const gchar *xesam_name; const gboolean is_array; } tag_map[] = { {"Album", "xesam:album", FALSE}, {"Album_Artist", "xesam:albumArtist", TRUE}, {"Artist", "xesam:artist", TRUE}, {"Comment", "xesam:comment", TRUE}, {"Composer", "xesam:composer", FALSE}, {"Genre", "xesam:genre", TRUE}, {"Title", "xesam:title", FALSE}, {NULL, NULL, FALSE} }; mpris_prop_val_pair *prop_list; GVariantBuilder builder; GVariant *value; gchar *uri; gdouble duration; gint64 playlist_pos; gint rc; gint i; g_variant_builder_init(&builder, G_VARIANT_TYPE("a{sv}")); uri = mpv_get_property_string(inst->gmpv_ctx->mpv_ctx, "path"); if(uri) { g_variant_builder_add( &builder, "{sv}", "xesam:url", g_variant_new_string(uri) ); mpv_free(uri); } rc = mpv_get_property( inst->gmpv_ctx->mpv_ctx, "duration", MPV_FORMAT_DOUBLE, &duration ); if(rc >= 0) { gint64 length = (gint64)(duration*1e6); g_variant_builder_add( &builder, "{sv}", "mpris:length", g_variant_new_int64(length) ); } rc = mpv_get_property( inst->gmpv_ctx->mpv_ctx, "playlist-pos", MPV_FORMAT_INT64, &playlist_pos ); if(rc >= 0) { gchar *playlist_pos_str; gchar *trackid; playlist_pos_str = g_strdup_printf( "%" G_GINT64_FORMAT, playlist_pos ); trackid = g_strconcat( MPRIS_TRACK_ID_PREFIX, playlist_pos_str, NULL ); g_variant_builder_add( &builder, "{sv}", "mpris:trackid", g_variant_new_object_path(trackid) ); g_free(playlist_pos_str); g_free(trackid); } for(i = 0; tag_map[i].mpv_name; i++) { gchar *mpv_prop; gchar *value_buf; mpv_prop = g_strconcat( "metadata/by-key/", tag_map[i].mpv_name, NULL ); value_buf = mpv_get_property_string (inst->gmpv_ctx->mpv_ctx, mpv_prop); if(value_buf) { GVariantBuilder tag_builder; GVariant *tag_value; tag_value = g_variant_new_string(value_buf); if(tag_map[i].is_array) { g_variant_builder_init (&tag_builder, G_VARIANT_TYPE("as")); g_variant_builder_add_value (&tag_builder, tag_value); } g_variant_builder_add ( &builder, "{sv}", tag_map[i].xesam_name, tag_map[i].is_array? g_variant_new("as", &tag_builder): tag_value ); } mpv_free(value_buf); g_free(mpv_prop); } value = g_variant_new("a{sv}", &builder); g_hash_table_replace ( inst->player_prop_table, "Metadata", g_variant_ref(value) ); prop_list = (mpris_prop_val_pair[]) {{"Metadata", value}, {NULL, NULL}}; mpris_emit_prop_changed(inst, prop_list); mpv_playback_restart_handler(inst->gmpv_ctx->gui, inst); } static void volume_update_handler(mpris *inst) { mpris_prop_val_pair *prop_list; gdouble volume; GVariant *value; mpv_get_property( inst->gmpv_ctx->mpv_ctx, "volume", MPV_FORMAT_DOUBLE, &volume ); value = g_variant_new_double(volume/100.0); g_hash_table_replace ( inst->player_prop_table, "Volume", g_variant_ref(value) ); prop_list = (mpris_prop_val_pair[]) {{"Volume", value}, {NULL, NULL}}; mpris_emit_prop_changed(inst, prop_list); } static void mpv_init_handler(MainWindow *wnd, gpointer data) { mpris *inst = data; mpv_observe_property( inst->gmpv_ctx->mpv_ctx, 0, "idle", MPV_FORMAT_FLAG ); mpv_observe_property( inst->gmpv_ctx->mpv_ctx, 0, "core-idle", MPV_FORMAT_FLAG ); mpv_observe_property( inst->gmpv_ctx->mpv_ctx, 0, "speed", MPV_FORMAT_DOUBLE ); mpv_observe_property( inst->gmpv_ctx->mpv_ctx, 0, "metadata", MPV_FORMAT_NODE ); mpv_observe_property( inst->gmpv_ctx->mpv_ctx, 0, "volume", MPV_FORMAT_DOUBLE ); mpv_observe_property( inst->gmpv_ctx->mpv_ctx, 0, "playlist-pos", MPV_FORMAT_INT64 ); mpv_observe_property( inst->gmpv_ctx->mpv_ctx, 0, "playlist-count", MPV_FORMAT_INT64 ); } static void mpv_playback_restart_handler(MainWindow *wnd, gpointer data) { mpris *inst = data; GDBusInterfaceInfo *iface; gdouble position; if(inst->pending_seek > 0) { position = inst->pending_seek; inst->pending_seek = -1; mpv_set_property( inst->gmpv_ctx->mpv_ctx, "time-pos", MPV_FORMAT_DOUBLE, &position ); } else { mpv_get_property( inst->gmpv_ctx->mpv_ctx, "time-pos", MPV_FORMAT_DOUBLE, &position ); } iface = mpris_org_mpris_media_player2_player_interface_info(); g_dbus_connection_emit_signal ( inst->session_bus_conn, NULL, MPRIS_OBJ_ROOT_PATH, iface->name, "Seeked", g_variant_new("(x)", (gint64)(position*1e6)), NULL ); } static void mpv_prop_change_handler( MainWindow *wnd, gchar *name, gpointer data ) { mpris *inst = data; if(g_strcmp0(name, "core-idle") == 0 || g_strcmp0(name, "idle") == 0) { playback_status_update_handler(inst); } else if(g_strcmp0(name, "playlist-pos") == 0 || g_strcmp0(name, "playlist-count") == 0) { playlist_update_handler(inst); } else if(g_strcmp0(name, "speed") == 0) { speed_update_handler(inst); } else if(g_strcmp0(name, "metadata") == 0) { metadata_update_handler(inst); } else if(g_strcmp0(name, "volume") == 0) { volume_update_handler(inst); } } void mpris_player_register(mpris *inst) { GDBusInterfaceInfo *iface; GDBusInterfaceVTable vtable; iface = mpris_org_mpris_media_player2_player_interface_info(); inst->player_prop_table = g_hash_table_new_full ( g_str_hash, g_str_equal, NULL, (GDestroyNotify) g_variant_unref ); inst->player_sig_id_list = g_malloc(4*sizeof(gulong)); inst->player_sig_id_list[0] = g_signal_connect( inst->gmpv_ctx->gui, "mpv-init", G_CALLBACK(mpv_init_handler), inst ); inst->player_sig_id_list[1] = g_signal_connect( inst->gmpv_ctx->gui, "mpv-playback-restart", G_CALLBACK(mpv_playback_restart_handler), inst ); inst->player_sig_id_list[2] = g_signal_connect( inst->gmpv_ctx->gui, "mpv-prop-change", G_CALLBACK(mpv_prop_change_handler), inst ); inst->player_sig_id_list[3] = 0; mpv_init_handler(inst->gmpv_ctx->gui, inst); prop_table_init(inst); vtable.method_call = (GDBusInterfaceMethodCallFunc)method_handler; vtable.get_property = (GDBusInterfaceGetPropertyFunc)get_prop_handler; vtable.set_property = (GDBusInterfaceSetPropertyFunc)set_prop_handler; inst->player_reg_id = g_dbus_connection_register_object ( inst->session_bus_conn, MPRIS_OBJ_ROOT_PATH, iface, &vtable, inst, NULL, NULL ); } void mpris_player_unregister(mpris *inst) { gulong *current_sig_id = inst->player_sig_id_list; if(current_sig_id) { while(current_sig_id && *current_sig_id > 0) { g_signal_handler_disconnect( inst->gmpv_ctx->gui, *current_sig_id ); current_sig_id++; } g_dbus_connection_unregister_object( inst->session_bus_conn, inst->player_reg_id ); g_hash_table_remove_all(inst->player_prop_table); g_hash_table_unref(inst->player_prop_table); g_clear_pointer(&inst->player_sig_id_list, g_free); } } gnome-mpv-0.7/src/mpris/mpris_player.h000066400000000000000000000015551265310212500200700ustar00rootroot00000000000000/* * Copyright (c) 2015 gnome-mpv * * This file is part of GNOME MPV. * * GNOME MPV 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. * * GNOME MPV 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 GNOME MPV. If not, see . */ #ifndef MPRIS_PLAYER_H #define MPRIS_PLAYER_H #include "mpris.h" void mpris_player_register(mpris *inst); void mpris_player_unregister(mpris *inst); #endif gnome-mpv-0.7/src/mpv.c000066400000000000000000000615631265310212500150320ustar00rootroot00000000000000/* * Copyright (c) 2014-2016 gnome-mpv * * This file is part of GNOME MPV. * * GNOME MPV 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. * * GNOME MPV 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 GNOME MPV. If not, see . */ #include #include #include #include #include "mpv.h" #include "def.h" #include "track.h" #include "playlist.h" #include "control_box.h" #include "playlist_widget.h" static void parse_dim_string( gmpv_handle *ctx, const gchar *mpv_geom_str, gint *width, gint *height ); static void handle_autofit_opt(gmpv_handle *ctx); static void handle_msg_level_opt(gmpv_handle *ctx); static void handle_property_change_event( gmpv_handle *ctx, mpv_event_property* prop); static void opengl_callback(void *cb_ctx); static void uninit_opengl_cb(gmpv_handle *ctx); static Track *parse_track_list(mpv_node_list *node); static void parse_dim_string( gmpv_handle *ctx, const gchar *mpv_geom_str, gint *width, gint *height ) { GdkScreen *screen = NULL; gint width_margin = main_window_get_width_margin(ctx->gui); gint height_margin = main_window_get_height_margin(ctx->gui); gint screen_width = -1; gint screen_height = -1; gchar **tokens = NULL; gint i = -1; screen = gdk_screen_get_default(); screen_width = gdk_screen_get_width(screen); screen_height = gdk_screen_get_height(screen); tokens = g_strsplit(mpv_geom_str, "x", 2); *width = 0; *height = 0; while(tokens && tokens[++i] && i < 4) { gdouble multiplier = -1; gint value = -1; value = (gint)g_ascii_strtoll(tokens[i], NULL, 0); if(tokens[i][strnlen(tokens[i], 256)-1] == '%') { multiplier = value/100.0; } if(i == 0) { if(multiplier == -1) { *width = value; } else { *width = (gint)(multiplier*screen_width); } } else if(i == 1) { if(multiplier == -1) { *height = value; } else { *height = (gint)(multiplier*screen_height); } } } if(*width != 0 && *height == 0) { /* If height is not specified, set it to screen height. This * should correctly emulate vanilla mpv's behavior since we * always preserve aspect ratio when autofitting. */ *height = screen_height; } if(*width != 0 && *height != 0) { *width += width_margin; *height += height_margin; } else { /* Keep width and height as-is. */ GtkWidget *vid_area = ctx->gui->vid_area; *width = gtk_widget_get_allocated_width(vid_area)+ width_margin; *height = gtk_widget_get_allocated_height(vid_area)+ height_margin; } g_strfreev(tokens); } static void handle_autofit_opt(gmpv_handle *ctx) { gchar *optbuf = NULL; gchar *geom = NULL; optbuf = mpv_get_property_string(ctx->mpv_ctx, "options/autofit"); if(optbuf && strlen(optbuf) > 0) { gint autofit_width = 0; gint autofit_height = 0; gint64 vid_width = 0; gint64 vid_height = 0; gdouble width_ratio = -1; gdouble height_ratio = -1; gint rc = 0; rc |= mpv_get_property( ctx->mpv_ctx, "dwidth", MPV_FORMAT_INT64, &vid_width ); rc |= mpv_get_property( ctx->mpv_ctx, "dheight", MPV_FORMAT_INT64, &vid_height ); if(rc >= 0) { parse_dim_string( ctx, optbuf, &autofit_width, &autofit_height ); width_ratio = (gdouble)autofit_width/ (gdouble)vid_width; height_ratio = (gdouble)autofit_height/ (gdouble)vid_height; } if(rc >= 0 && width_ratio > 0 && height_ratio > 0) { if(width_ratio > 1 && height_ratio > 1) { resize_window_to_fit(ctx, 1); } else { /* Resize the window so that it is as big as * possible within the limits imposed by * 'autofit' while preseving the aspect ratio. */ resize_window_to_fit ( ctx, (width_ratio < height_ratio) ?width_ratio :height_ratio ); } } } mpv_free(optbuf); g_free(geom); } static void handle_msg_level_opt(gmpv_handle *ctx) { const struct { gchar *name; mpv_log_level level; } level_map[] = { {"no", MPV_LOG_LEVEL_NONE}, {"fatal", MPV_LOG_LEVEL_FATAL}, {"error", MPV_LOG_LEVEL_ERROR}, {"warn", MPV_LOG_LEVEL_WARN}, {"info", MPV_LOG_LEVEL_INFO}, {"v", MPV_LOG_LEVEL_V}, {"debug", MPV_LOG_LEVEL_DEBUG}, {"trace", MPV_LOG_LEVEL_TRACE}, {NULL, MPV_LOG_LEVEL_NONE} }; gchar *optbuf = NULL; gchar **tokens = NULL; mpv_log_level min_level = DEFAULT_LOG_LEVEL; gint i; optbuf = mpv_get_property_string(ctx->mpv_ctx, "options/msg-level"); if(optbuf) { tokens = g_strsplit(optbuf, ",", 0); } if(ctx->log_level_list) { g_slist_free_full(ctx->log_level_list, g_free); ctx->log_level_list = NULL; } for(i = 0; tokens && tokens[i]; i++) { gchar **pair = g_strsplit(tokens[i], "=", 2); module_log_level *level = g_malloc(sizeof(module_log_level)); gboolean found = FALSE; gint j; level->prefix = g_strdup(pair[0]); for(j = 0; level_map[j].name && !found; j++) { if(g_strcmp0(pair[1], level_map[j].name) == 0) { level->level = level_map[j].level; found = TRUE; } } /* Ignore if the given level is invalid */ if(found) { /* Lower log levels have higher values */ if(level->level > min_level) { min_level = level->level; } if(g_strcmp0(level->prefix, "all") != 0) { ctx->log_level_list = g_slist_append (ctx->log_level_list, level); } } g_strfreev(pair); } for(i = 0; level_map[i].level != min_level; i++); mpv_check_error (mpv_request_log_messages(ctx->mpv_ctx, level_map[i].name)); mpv_free(optbuf); g_strfreev(tokens); } static void handle_property_change_event( gmpv_handle *ctx, mpv_event_property* prop) { if(g_strcmp0(prop->name, "pause") == 0) { GtkWindow *wnd = GTK_WINDOW(ctx->gui); GtkApplication *app = gtk_window_get_application(wnd); gboolean idle; ctx->paused = prop->data?*((int *)prop->data):TRUE; mpv_get_property(ctx->mpv_ctx, "idle", MPV_FORMAT_FLAG, &idle); if(idle && !ctx->paused) { mpv_load(ctx, NULL, FALSE, TRUE); } if(!ctx->paused) { ctx->inhibit_cookie = gtk_application_inhibit ( app, wnd, GTK_APPLICATION_INHIBIT_IDLE, _("Playing") ); } else if(ctx->inhibit_cookie != 0) { gtk_application_uninhibit(app, ctx->inhibit_cookie); } mpv_load_gui_update(ctx); } else if(g_strcmp0(prop->name, "volume") == 0 && (ctx->init_load || ctx->loaded)) { gchar *aid = mpv_get_property_string(ctx->mpv_ctx, "aid"); ControlBox *control_box = CONTROL_BOX(ctx->gui->control_box); if(g_strcmp0(aid, "no") == 0) { gtk_widget_set_sensitive (control_box->volume_button, FALSE); } else { gdouble volume; volume = prop->data?*((double *)prop->data)/100.0:0; gtk_widget_set_sensitive (control_box->volume_button, TRUE); g_signal_handlers_block_matched ( control_box->volume_button, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, ctx ); control_box_set_volume(control_box, volume); g_signal_handlers_unblock_matched ( control_box->volume_button, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, ctx ); } mpv_free(aid); } else if(g_strcmp0(prop->name, "fullscreen") == 0) { int *data = prop->data; int fullscreen = data?*data:-1; if(fullscreen != -1 && fullscreen != ctx->gui->fullscreen) { main_window_toggle_fullscreen(MAIN_WINDOW(ctx->gui)); } } else if(g_strcmp0(prop->name, "eof-reached") == 0 && prop->data && *((int *)prop->data) == 1) { ctx->paused = TRUE; ctx->loaded = FALSE; main_window_reset(ctx->gui); playlist_reset(ctx); } } static void opengl_callback(void *cb_ctx) { #ifdef OPENGL_CB_ENABLED gmpv_handle *ctx = cb_ctx; if(ctx->opengl_ctx) { gtk_gl_area_queue_render(GTK_GL_AREA(ctx->gui->vid_area)); } #endif } static void uninit_opengl_cb(gmpv_handle *ctx) { #ifdef OPENGL_CB_ENABLED gtk_gl_area_make_current(GTK_GL_AREA(ctx->gui->vid_area)); mpv_opengl_cb_uninit_gl(ctx->opengl_ctx); #endif } static Track *parse_track_list(mpv_node_list *node) { Track *entry = track_new(); for(gint i = 0; i < node->num; i++) { if(g_strcmp0(node->keys[i], "type") == 0) { const gchar *type = node->values[i].u.string; if(g_strcmp0(type, "audio") == 0) { entry->type = TRACK_TYPE_AUDIO; } else if(g_strcmp0(type, "video") == 0) { entry->type = TRACK_TYPE_VIDEO; } else if(g_strcmp0(type, "sub") == 0) { entry->type = TRACK_TYPE_SUBTITLE; } } else if(g_strcmp0(node->keys[i], "title") == 0) { entry->title = g_strdup(node->values[i].u.string); } else if(g_strcmp0(node->keys[i], "lang") == 0) { entry->lang = g_strdup(node->values[i].u.string); } else if(g_strcmp0(node->keys[i], "id") == 0) { entry->id = node->values[i].u.int64; } } return entry; } void mpv_wakeup_callback(void *data) { g_idle_add((GSourceFunc)mpv_handle_event, data); } void mpv_log_handler(gmpv_handle *ctx, mpv_event_log_message* message) { GSList *iter = ctx->log_level_list; module_log_level *level = NULL; gsize event_prefix_len = strlen(message->prefix); gboolean found = FALSE; if(iter) { level = iter->data; } while(iter && !found) { gsize prefix_len; gint cmp; prefix_len = strlen(level->prefix); cmp = strncmp( level->prefix, message->prefix, (event_prefix_len < prefix_len)? event_prefix_len:prefix_len ); /* Allow both exact match and prefix match */ if(cmp == 0 && (prefix_len == event_prefix_len || (prefix_len < event_prefix_len && message->prefix[prefix_len] == '/'))) { found = TRUE; } else { iter = g_slist_next(iter); level = iter?iter->data:NULL; } } if(!iter || (message->log_level <= level->level)) { gchar *buf = g_strdup(message->text); gsize len = strlen(buf); if(len > 1) { /* g_message() automatically adds a newline * character when using the default log handler, * but log messages from mpv already come * terminated with a newline character so we * need to take it out. */ if(buf[len-1] == '\n') { buf[len-1] = '\0'; } g_message("[%s] %s", message->prefix, buf); } g_free(buf); } } void mpv_check_error(int status) { void *array[10]; size_t size; if(status < 0) { size = (size_t)backtrace(array, 10); g_critical("MPV API error: %s\n", mpv_error_string(status)); backtrace_symbols_fd(array, (int)size, STDERR_FILENO); exit(EXIT_FAILURE); } } gboolean mpv_handle_event(gpointer data) { gmpv_handle *ctx = data; mpv_event *event = NULL; gboolean done = FALSE; while(!done) { event = mpv_wait_event(ctx->mpv_ctx, 0); if(event->event_id == MPV_EVENT_PROPERTY_CHANGE) { mpv_event_property *prop = event->data; handle_property_change_event(ctx, prop); g_signal_emit_by_name( ctx->gui, "mpv-prop-change", g_strdup(prop->name) ); } else if(event->event_id == MPV_EVENT_IDLE) { if(ctx->init_load) { mpv_load(ctx, NULL, FALSE, FALSE); } else if(ctx->loaded) { gint rc; ctx->paused = TRUE; ctx->loaded = FALSE; rc = mpv_set_property( ctx->mpv_ctx, "pause", MPV_FORMAT_FLAG, &ctx->paused ); mpv_check_error(rc); main_window_reset(ctx->gui); playlist_reset(ctx); } ctx->init_load = FALSE; } else if(event->event_id == MPV_EVENT_FILE_LOADED) { ctx->loaded = TRUE; ctx->init_load = FALSE; mpv_update_playlist(ctx); mpv_load_gui_update(ctx); } else if(event->event_id == MPV_EVENT_END_FILE) { mpv_event_end_file *ef_event = event->data; ctx->init_load = FALSE; if(ctx->loaded) { ctx->new_file = FALSE; } if(ef_event->reason == MPV_END_FILE_REASON_ERROR) { const gchar *err_str; gchar *msg; err_str = mpv_error_string(ef_event->error); msg = g_strdup_printf ( _("Playback was terminated " "abnormally. Reason: %s."), err_str ); show_error_dialog(ctx, NULL, msg); g_free(msg); } } else if(event->event_id == MPV_EVENT_VIDEO_RECONFIG) { if(ctx->new_file) { handle_autofit_opt(ctx); } } else if(event->event_id == MPV_EVENT_PLAYBACK_RESTART) { mpv_load_gui_update(ctx); g_signal_emit_by_name( ctx->gui, "mpv-playback-restart" ); } else if(event->event_id == MPV_EVENT_SHUTDOWN) { quit(ctx); done = TRUE; } else if(event->event_id == MPV_EVENT_LOG_MESSAGE) { mpv_log_handler(ctx, event->data); } else if(event->event_id == MPV_EVENT_NONE) { done = TRUE; } } return FALSE; } void mpv_update_playlist(gmpv_handle *ctx) { /* The length of "playlist//filename" including null-terminator (19) * plus the number of digits in the maximum value of 64 bit int (19). */ const gsize filename_prop_str_size = 38; PlaylistWidget *playlist; GtkListStore *store; GtkTreeIter iter; mpv_node mpv_playlist; gchar *filename_prop_str; gboolean iter_end; gint playlist_count; gint i; playlist = PLAYLIST_WIDGET(ctx->gui->playlist); store = playlist->list_store; filename_prop_str = g_malloc(filename_prop_str_size); iter_end = FALSE; mpv_check_error(mpv_get_property( ctx->mpv_ctx, "playlist", MPV_FORMAT_NODE, &mpv_playlist )); playlist_count = mpv_playlist.u.list->num; g_signal_handlers_block_matched ( playlist->list_store, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, ctx ); gtk_tree_model_get_iter_first(GTK_TREE_MODEL(store), &iter); for(i = 0; i < playlist_count; i++) { gint prop_count = 0; gchar *uri = NULL; gchar *title = NULL; gchar *name = NULL; gchar *old_name = NULL; gchar *old_uri = NULL; prop_count = mpv_playlist.u.list->values[i].u.list->num; /* The first entry must always exist */ uri = mpv_playlist.u.list ->values[i].u.list ->values[0].u.string; /* Try retrieving the title from mpv playlist */ if(prop_count >= 4) { title = mpv_playlist.u.list ->values[i].u.list ->values[3].u.string; } name = title?title:get_name_from_path(uri); if(!iter_end) { gtk_tree_model_get ( GTK_TREE_MODEL(store), &iter, PLAYLIST_NAME_COLUMN, &old_name, PLAYLIST_URI_COLUMN, &old_uri, -1 ); if(g_strcmp0(name, old_name) != 0) { gtk_list_store_set ( store, &iter, PLAYLIST_NAME_COLUMN, name, -1 ); } if(g_strcmp0(uri, old_uri) != 0) { gtk_list_store_set ( store, &iter, PLAYLIST_URI_COLUMN, uri, -1 ); } iter_end = !gtk_tree_model_iter_next (GTK_TREE_MODEL(store), &iter); g_free(old_name); g_free(old_uri); } /* Append entries to the playlist if there are fewer entries in * the playlist widget than mpv's playlist. */ else { playlist_widget_append(playlist, name, uri); } mpv_free(uri); g_free(name); } /* If there are more entries in the playlist widget than mpv's playlist, * remove the excess entries from the playlist widget. */ if(!iter_end) { while(gtk_list_store_remove(store, &iter)); } gtk_tree_view_columns_autosize(GTK_TREE_VIEW(playlist->tree_view)); g_signal_handlers_unblock_matched ( playlist->list_store, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, ctx ); g_free(filename_prop_str); mpv_free_node_contents(&mpv_playlist); } void mpv_load_gui_update(gmpv_handle *ctx) { ControlBox *control_box; mpv_node track_list; gchar* title; gint64 chapter_count; gint64 playlist_pos; gdouble length; gdouble volume; control_box = CONTROL_BOX(ctx->gui->control_box); title = mpv_get_property_string(ctx->mpv_ctx, "media-title"); if(title) { gtk_window_set_title(GTK_WINDOW(ctx->gui), title); mpv_free(title); } mpv_check_error(mpv_set_property( ctx->mpv_ctx, "pause", MPV_FORMAT_FLAG, &ctx->paused)); if(mpv_get_property( ctx->mpv_ctx, "track-list", MPV_FORMAT_NODE, &track_list) >= 0) { mpv_node_list *org_list = track_list.u.list; GSList *audio_list = NULL; GSList *video_list = NULL; GSList *sub_list = NULL; GAction *action = NULL; gint64 aid = -1; gint64 sid = -1; mpv_get_property( ctx->mpv_ctx, "aid", MPV_FORMAT_INT64, &aid ); mpv_get_property( ctx->mpv_ctx, "sid", MPV_FORMAT_INT64, &sid ); action = g_action_map_lookup_action (G_ACTION_MAP(ctx->app), "audio_select"); g_simple_action_set_state (G_SIMPLE_ACTION(action), g_variant_new_int64(aid)); action = g_action_map_lookup_action (G_ACTION_MAP(ctx->app), "sub_select"); g_simple_action_set_state (G_SIMPLE_ACTION(action), g_variant_new_int64(sid)); for(gint i = 0; i < org_list->num; i++) { Track *entry; GSList **list; entry = parse_track_list (org_list->values[i].u.list); if(entry->type == TRACK_TYPE_AUDIO) { list = &audio_list; } else if(entry->type == TRACK_TYPE_VIDEO) { list = &video_list; } else if(entry->type == TRACK_TYPE_SUBTITLE) { list = &sub_list; } else { g_assert(FALSE); } *list = g_slist_prepend(*list, entry); } audio_list = g_slist_reverse(audio_list); video_list = g_slist_reverse(video_list); sub_list = g_slist_reverse(sub_list); main_window_update_track_list (ctx->gui, audio_list, video_list, sub_list); g_slist_free_full (audio_list, (GDestroyNotify)track_free); g_slist_free_full (video_list, (GDestroyNotify)track_free); g_slist_free_full (sub_list, (GDestroyNotify)track_free); } if(mpv_get_property( ctx->mpv_ctx, "playlist-pos", MPV_FORMAT_INT64, &playlist_pos) >= 0) { playlist_widget_set_indicator_pos ( PLAYLIST_WIDGET(ctx->gui->playlist), (gint)playlist_pos ); } if(mpv_get_property( ctx->mpv_ctx, "chapters", MPV_FORMAT_INT64, &chapter_count) >= 0) { control_box_set_chapter_enabled( control_box, (chapter_count > 1) ); } if(mpv_get_property( ctx->mpv_ctx, "volume", MPV_FORMAT_DOUBLE, &volume) >= 0) { control_box_set_volume(control_box, volume/100); } if(mpv_get_property( ctx->mpv_ctx, "length", MPV_FORMAT_DOUBLE, &length) >= 0) { control_box_set_seek_bar_length(control_box, (gint)length); } control_box_set_playing_state(control_box, !ctx->paused); } gint mpv_apply_args(mpv_handle *mpv_ctx, gchar *args) { gchar *opt_begin = args?strstr(args, "--"):NULL; gint fail_count = 0; while(opt_begin) { gchar *opt_end = strstr(opt_begin, " --"); gchar *token; gchar *token_arg; gsize token_size; /* Point opt_end to the end of the input string if the current * option is the last one. */ if(!opt_end) { opt_end = args+strlen(args); } /* Traverse the string backwards until non-space character is * found. This removes spaces after the option token. */ while( --opt_end != opt_begin && (*opt_end == ' ' || *opt_end == '\n') ); token_size = (gsize)(opt_end-opt_begin); token = g_malloc(token_size); strncpy(token, opt_begin+2, token_size-1); token[token_size-1] = '\0'; token_arg = strpbrk(token, "= "); if(token_arg) { *token_arg = '\0'; token_arg++; } else { /* Default to empty string if there is no explicit * argument */ token_arg = ""; } /* Ignore --autofit since it triggers weird behavior in mpv when * running on Wayland and opengl-cb is disabled */ if(g_strcmp0(token, "autofit") != 0 /* Failing to apply extra options is non-fatal */ && mpv_set_option_string(mpv_ctx, token, token_arg) < 0) { fail_count++; g_warning( "Failed to apply option: --%s=%s\n", token, token_arg ); } opt_begin = strstr(opt_end, " --"); if(opt_begin) { opt_begin++; } g_free(token); } return fail_count*(-1); } void mpv_init(gmpv_handle *ctx) { GSettings *settings = g_settings_new(CONFIG_WIN_STATE); gdouble volume = g_settings_get_double(settings, "volume")*100; gboolean mpvconf_enable = FALSE; gchar *config_dir = get_config_dir_path(); gchar *mpvconf = NULL; gchar *mpvopt = NULL; /* Set default options */ mpv_check_error(mpv_set_option_string(ctx->mpv_ctx, "osd-level", "1")); mpv_check_error(mpv_set_option_string(ctx->mpv_ctx, "softvol", "yes")); mpv_check_error(mpv_set_option_string( ctx->mpv_ctx, "msg-level", "ffmpeg=fatal" )); mpv_check_error(mpv_set_option_string( ctx->mpv_ctx, "audio-client-name", ICON_NAME )); mpv_check_error(mpv_set_option_string( ctx->mpv_ctx, "title", "${media-title}" )); mpv_check_error(mpv_set_option_string( ctx->mpv_ctx, "pause", "yes" )); mpv_check_error(mpv_set_option_string( ctx->mpv_ctx, "ytdl", "yes" )); mpv_check_error(mpv_set_option_string( ctx->mpv_ctx, "input-cursor", "no" )); mpv_check_error(mpv_set_option_string( ctx->mpv_ctx, "cursor-autohide", "no" )); mpv_check_error(mpv_set_option_string( ctx->mpv_ctx, "softvol-max", "100" )); mpv_check_error(mpv_set_option_string( ctx->mpv_ctx, "config", "yes" )); mpv_check_error(mpv_set_option_string( ctx->mpv_ctx, "screenshot-template", "gnome-mpv-shot%n" )); mpv_check_error(mpv_set_option_string( ctx->mpv_ctx, "config-dir", config_dir )); mpv_check_error(mpv_set_option( ctx->mpv_ctx, "volume", MPV_FORMAT_DOUBLE, &volume )); if(!main_window_get_use_opengl(ctx->gui)) { mpv_check_error(mpv_set_option( ctx->mpv_ctx, "wid", MPV_FORMAT_INT64, &ctx->vid_area_wid )); } mpv_check_error(mpv_observe_property( ctx->mpv_ctx, 0, "pause", MPV_FORMAT_FLAG )); mpv_check_error(mpv_observe_property( ctx->mpv_ctx, 0, "eof-reached", MPV_FORMAT_FLAG )); mpv_check_error(mpv_observe_property( ctx->mpv_ctx, 0, "fullscreen", MPV_FORMAT_FLAG )); mpv_check_error(mpv_observe_property( ctx->mpv_ctx, 0, "volume", MPV_FORMAT_DOUBLE )); mpvconf_enable = g_settings_get_boolean (ctx->config, "mpv-config-enable"); mpvconf = g_settings_get_string (ctx->config, "mpv-config-file"); mpvopt = g_settings_get_string (ctx->config, "mpv-options"); if(mpvconf_enable) { mpv_load_config_file(ctx->mpv_ctx, mpvconf); } /* Apply extra options */ if(mpv_apply_args(ctx->mpv_ctx, mpvopt) < 0) { const gchar *msg = _("Failed to apply one or more MPV options."); show_error_dialog(ctx, NULL, msg); } if(main_window_get_use_opengl(ctx->gui)) { mpv_check_error(mpv_set_option_string( ctx->mpv_ctx, "vo", "opengl-cb" )); } mpv_check_error(mpv_initialize(ctx->mpv_ctx)); handle_msg_level_opt(ctx); g_signal_emit_by_name(ctx->gui, "mpv-init"); ctx->opengl_ctx = mpv_get_sub_api(ctx->mpv_ctx, MPV_SUB_API_OPENGL_CB); mpv_opengl_cb_set_update_callback( ctx->opengl_ctx, opengl_callback, ctx ); g_clear_object(&settings); g_free(config_dir); g_free(mpvconf); g_free(mpvopt); } void mpv_quit(gmpv_handle *ctx) { if(gtk_widget_get_realized(ctx->gui->vid_area) && main_window_get_use_opengl(ctx->gui)) { uninit_opengl_cb(ctx); ctx->opengl_ready = FALSE; } mpv_terminate_destroy(ctx->mpv_ctx); } void mpv_load( gmpv_handle *ctx, const gchar *uri, gboolean append, gboolean update ) { const gchar *load_cmd[] = {"loadfile", NULL, NULL, NULL}; GtkListStore *playlist_store; GtkTreeIter iter; gboolean empty; playlist_store = GTK_LIST_STORE(ctx->playlist_store); empty = !gtk_tree_model_get_iter_first (GTK_TREE_MODEL(playlist_store), &iter); load_cmd[2] = (append && !empty)?"append":"replace"; if(!append && uri && update) { playlist_widget_clear (PLAYLIST_WIDGET(ctx->gui->playlist)); ctx->new_file = TRUE; ctx->loaded = FALSE; } if(!uri) { gboolean rc; gboolean append; rc = gtk_tree_model_get_iter_first (GTK_TREE_MODEL(playlist_store), &iter); append = FALSE; while(rc) { gchar *uri; gtk_tree_model_get( GTK_TREE_MODEL(playlist_store), &iter, PLAYLIST_URI_COLUMN, &uri, -1 ); /* append = FALSE only on first iteration */ mpv_load(ctx, uri, append, FALSE); append = TRUE; rc = gtk_tree_model_iter_next (GTK_TREE_MODEL(playlist_store), &iter); g_free(uri); } } if(uri && playlist_store) { gchar *path = get_path_from_uri(uri); load_cmd[1] = path; if(!append) { ctx->loaded = FALSE; } if(update) { gchar *name = get_name_from_path(path); playlist_widget_append ( PLAYLIST_WIDGET(ctx->gui->playlist), name, uri ); g_free(name); } control_box_set_enabled (CONTROL_BOX(ctx->gui->control_box), TRUE); mpv_check_error(mpv_request_event( ctx->mpv_ctx, MPV_EVENT_END_FILE, 0 )); mpv_check_error(mpv_command(ctx->mpv_ctx, load_cmd)); mpv_check_error(mpv_set_property( ctx->mpv_ctx, "pause", MPV_FORMAT_FLAG, &ctx->paused )); mpv_check_error(mpv_request_event( ctx->mpv_ctx, MPV_EVENT_END_FILE, 1 )); g_free(path); } } gnome-mpv-0.7/src/mpv.h000066400000000000000000000023571265310212500150330ustar00rootroot00000000000000/* * Copyright (c) 2014 gnome-mpv * * This file is part of GNOME MPV. * * GNOME MPV 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. * * GNOME MPV 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 GNOME MPV. If not, see . */ #ifndef MPV_H #define MPV_H #include "common.h" void mpv_wakeup_callback(void *data); void mpv_log_handler(gmpv_handle *ctx, mpv_event_log_message* message); void mpv_check_error(int status); gboolean mpv_handle_event(gpointer data); void mpv_update_playlist(gmpv_handle *ctx); void mpv_load_gui_update(gmpv_handle *ctx); gint mpv_apply_args(mpv_handle *mpv_ctx, char *args); void mpv_init(gmpv_handle *ctx); void mpv_quit(gmpv_handle *ctx); void mpv_load( gmpv_handle *ctx, const gchar *uri, gboolean append, gboolean update ); #endif gnome-mpv-0.7/src/open_loc_dialog.c000066400000000000000000000101671265310212500173370ustar00rootroot00000000000000/* * Copyright (c) 2014 gnome-mpv * * This file is part of GNOME MPV. * * GNOME MPV 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. * * GNOME MPV 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 GNOME MPV. If not, see . */ #include #include "open_loc_dialog.h" #include "main_window.h" struct _OpenLocDialog { GtkDialog parent_instance; GtkWidget *content_area; GtkWidget *content_box; GtkWidget *loc_label; GtkWidget *loc_entry; }; struct _OpenLocDialogClass { GtkDialogClass parent_class; }; G_DEFINE_TYPE(OpenLocDialog, open_loc_dialog, GTK_TYPE_DIALOG) static gboolean key_press_handler (GtkWidget *widget, GdkEventKey *event) { guint keyval = event->keyval; guint state = event->state; const guint mod_mask = GDK_MODIFIER_MASK &~(GDK_SHIFT_MASK |GDK_LOCK_MASK |GDK_MOD2_MASK |GDK_MOD3_MASK |GDK_MOD4_MASK |GDK_MOD5_MASK); if((state&mod_mask) == 0 && keyval == GDK_KEY_Return) { gtk_dialog_response(GTK_DIALOG(widget), GTK_RESPONSE_ACCEPT); } return GTK_WIDGET_CLASS(open_loc_dialog_parent_class)->key_press_event (widget, event); } static void open_loc_dialog_class_init(OpenLocDialogClass *klass) { GtkWidgetClass *wid_class = GTK_WIDGET_CLASS(klass); wid_class->key_press_event = key_press_handler; } static void open_loc_dialog_init(OpenLocDialog *dlg) { GdkGeometry geom; geom.max_width = G_MAXINT; geom.max_height = 0; dlg->content_box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6); dlg->content_area = gtk_dialog_get_content_area(GTK_DIALOG(dlg)); dlg->loc_label = gtk_label_new(_("Location:")); dlg->loc_entry = gtk_entry_new(); gtk_dialog_add_buttons( GTK_DIALOG(dlg), _("_Open"), GTK_RESPONSE_ACCEPT, _("_Cancel"), GTK_RESPONSE_REJECT, NULL ); gtk_window_set_geometry_hints( GTK_WINDOW(dlg), GTK_WIDGET(dlg), &geom, GDK_HINT_MAX_SIZE ); gtk_window_set_modal(GTK_WINDOW(dlg), 1); gtk_window_set_title(GTK_WINDOW(dlg), _("Open Location")); gtk_container_set_border_width(GTK_CONTAINER(dlg->content_area), 12); if(!gtk_dialog_get_header_bar(GTK_DIALOG(dlg))) { gtk_widget_set_margin_bottom(dlg->content_box, 6); } gtk_window_set_geometry_hints( GTK_WINDOW(dlg), GTK_WIDGET(dlg), &geom, GDK_HINT_MAX_SIZE ); gtk_container_add(GTK_CONTAINER(dlg->content_area), dlg->content_box); gtk_box_pack_start( GTK_BOX(dlg->content_box), dlg->loc_label, FALSE, FALSE, 0 ); gtk_box_pack_start( GTK_BOX(dlg->content_box), dlg->loc_entry, TRUE, TRUE, 0 ); gtk_window_set_default_size(GTK_WINDOW(dlg), 350, -1); gtk_dialog_set_default_response (GTK_DIALOG(dlg), GTK_RESPONSE_ACCEPT); } GtkWidget *open_loc_dialog_new(GtkWindow *parent) { GtkWidget *dlg; GtkWidget *header_bar; gboolean csd_enabled; csd_enabled = main_window_get_csd_enabled(MAIN_WINDOW(parent)); dlg = g_object_new( open_loc_dialog_get_type(), "use-header-bar", csd_enabled, NULL ); header_bar = gtk_dialog_get_header_bar(GTK_DIALOG(dlg)); if(header_bar) { GtkWidget *cancel_btn = gtk_dialog_get_widget_for_response (GTK_DIALOG(dlg), GTK_RESPONSE_REJECT); gtk_container_child_set( GTK_CONTAINER(header_bar), cancel_btn, "pack-type", GTK_PACK_START, NULL ); gtk_header_bar_set_show_close_button (GTK_HEADER_BAR(header_bar), FALSE); } gtk_widget_hide_on_delete(dlg); gtk_window_set_transient_for(GTK_WINDOW(dlg), parent); gtk_widget_show_all(dlg); return dlg; } const gchar *open_loc_dialog_get_string(OpenLocDialog *dlg) { return gtk_entry_get_text(GTK_ENTRY(dlg->loc_entry)); } guint64 open_loc_dialog_get_string_length(OpenLocDialog *dlg) { return gtk_entry_get_text_length(GTK_ENTRY(dlg->loc_entry)); } gnome-mpv-0.7/src/open_loc_dialog.h000066400000000000000000000031331265310212500173370ustar00rootroot00000000000000/* * Copyright (c) 2014 gnome-mpv * * This file is part of GNOME MPV. * * GNOME MPV 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. * * GNOME MPV 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 GNOME MPV. If not, see . */ #ifndef OPEN_LOC_DIALOG_H #define OPEN_LOC_DIALOG_H #include G_BEGIN_DECLS #define OPEN_LOC_DIALOG_TYPE (open_loc_dialog_get_type ()) #define OPEN_LOC_DIALOG(obj) \ (G_TYPE_CHECK_INSTANCE_CAST((obj), OPEN_LOC_DIALOG_TYPE, OpenLocDialog)) #define OPEN_LOC_DIALOG_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST \ ((klass), OPEN_LOC_DIALOG_TYPE, OpenLocDialogClass)) #define IS_OPEN_LOC_DIALOG(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE((obj), OPEN_LOC_DIALOG_TYPE)) #define IS_OPEN_LOC_DIALOG_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE((klass), OPEN_LOC_DIALOG_TYPE)) typedef struct _OpenLocDialog OpenLocDialog; typedef struct _OpenLocDialogClass OpenLocDialogClass; GtkWidget *open_loc_dialog_new(GtkWindow *parent); GType open_loc_dialog_get_type(void); const gchar *open_loc_dialog_get_string(OpenLocDialog *dlg); guint64 open_loc_dialog_get_string_length(OpenLocDialog *dlg); G_END_DECLS #endif gnome-mpv-0.7/src/playbackctl.c000066400000000000000000000100301265310212500165000ustar00rootroot00000000000000/* * Copyright (c) 2015 gnome-mpv * * This file is part of GNOME MPV. * * GNOME MPV 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. * * GNOME MPV 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 GNOME MPV. If not, see . */ #include #include "playbackctl.h" #include "control_box.h" #include "common.h" #include "mpv.h" static void play_handler(GtkWidget *widget, gpointer data); static void stop_handler(GtkWidget *widget, gpointer data); static void seek_handler( GtkWidget *widget, GtkScrollType scroll, gdouble value, gpointer data ); static void forward_handler(GtkWidget *widget, gpointer data); static void rewind_handler(GtkWidget *widget, gpointer data); static void chapter_previous_handler(GtkWidget *widget, gpointer data); static void chapter_next_handler(GtkWidget *widget, gpointer data); static void volume_handler(GtkWidget *widget, gdouble value, gpointer data); static void fullscreen_handler(GtkWidget *button, gpointer data); static void play_handler(GtkWidget *widget, gpointer data) { gmpv_handle *ctx = data; ctx->paused = !ctx->paused; mpv_check_error(mpv_set_property( ctx->mpv_ctx, "pause", MPV_FORMAT_FLAG, &ctx->paused )); } static void stop_handler(GtkWidget *widget, gpointer data) { gmpv_handle *ctx = data; const gchar *cmd[] = {"stop", NULL}; mpv_command(ctx->mpv_ctx, cmd); } static void seek_handler( GtkWidget *widget, GtkScrollType scroll, gdouble value, gpointer data ) { seek(data, value); } static void forward_handler(GtkWidget *widget, gpointer data) { gmpv_handle *ctx = data; const gchar *cmd[] = {"seek", "10", NULL}; mpv_command(ctx->mpv_ctx, cmd); } static void rewind_handler(GtkWidget *widget, gpointer data) { gmpv_handle *ctx = data; const gchar *cmd[] = {"seek", "-10", NULL}; mpv_command(ctx->mpv_ctx, cmd); } static void chapter_previous_handler(GtkWidget *widget, gpointer data) { gmpv_handle *ctx = data; const gchar *cmd[] = {"osd-msg", "cycle", "chapter", "down", NULL}; mpv_command(ctx->mpv_ctx, cmd); } static void chapter_next_handler(GtkWidget *widget, gpointer data) { gmpv_handle *ctx = data; const gchar *cmd[] = {"osd-msg", "cycle", "chapter", NULL}; mpv_command(ctx->mpv_ctx, cmd); } static void volume_handler(GtkWidget *widget, gdouble value, gpointer data) { gmpv_handle *ctx = data; value *= 100; mpv_set_property(ctx->mpv_ctx, "volume", MPV_FORMAT_DOUBLE, &value); } static void fullscreen_handler(GtkWidget *widget, gpointer data) { toggle_fullscreen(data); } void playbackctl_connect_signals(gmpv_handle *ctx) { ControlBox *control_box = CONTROL_BOX(ctx->gui->control_box); g_signal_connect( control_box->play_button, "clicked", G_CALLBACK(play_handler), ctx ); g_signal_connect( control_box->stop_button, "clicked", G_CALLBACK(stop_handler), ctx ); g_signal_connect( control_box->seek_bar, "change-value", G_CALLBACK(seek_handler), ctx ); g_signal_connect( control_box->forward_button, "clicked", G_CALLBACK(forward_handler), ctx ); g_signal_connect( control_box->rewind_button, "clicked", G_CALLBACK(rewind_handler), ctx ); g_signal_connect( control_box->previous_button, "clicked", G_CALLBACK(chapter_previous_handler), ctx ); g_signal_connect( control_box->next_button, "clicked", G_CALLBACK(chapter_next_handler), ctx ); g_signal_connect( control_box->volume_button, "value-changed", G_CALLBACK(volume_handler), ctx ); g_signal_connect( control_box->fullscreen_button, "clicked", G_CALLBACK(fullscreen_handler), ctx ); } gnome-mpv-0.7/src/playbackctl.h000066400000000000000000000015451265310212500165200ustar00rootroot00000000000000/* * Copyright (c) 2015 gnome-mpv * * This file is part of GNOME MPV. * * GNOME MPV 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. * * GNOME MPV 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 GNOME MPV. If not, see . */ #ifndef PLAYBACKCTL_H #define PLAYBACKCTL_H #include "playbackctl.h" #include "common.h" void playbackctl_connect_signals(gmpv_handle *ctx); #endif gnome-mpv-0.7/src/playlist.c000066400000000000000000000104571265310212500160650ustar00rootroot00000000000000/* * Copyright (c) 2014-2015 gnome-mpv * * This file is part of GNOME MPV. * * GNOME MPV 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. * * GNOME MPV 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 GNOME MPV. If not, see . */ #include #include "playlist.h" #include "common.h" #include "playlist_widget.h" void playlist_toggle_handler( GSimpleAction *action, GVariant *param, gpointer data ) { gmpv_handle *ctx = data; gboolean visible = gtk_widget_get_visible(ctx->gui->playlist); main_window_set_playlist_visible(ctx->gui, !visible); } void playlist_save_handler( GSimpleAction *action, GVariant *param, gpointer data ) { gmpv_handle *ctx = data; PlaylistWidget *playlist; GFile *dest_file; GOutputStream *dest_stream; GtkFileChooser *file_chooser; GtkWidget *save_dialog; GError *error; GtkTreeIter iter; gboolean rc; playlist = PLAYLIST_WIDGET(ctx->gui->playlist); dest_file = NULL; dest_stream = NULL; error = NULL; rc = FALSE; save_dialog = gtk_file_chooser_dialog_new( _("Save Playlist"), GTK_WINDOW(ctx->gui), GTK_FILE_CHOOSER_ACTION_SAVE, _("_Cancel"), GTK_RESPONSE_CANCEL, _("_Save"), GTK_RESPONSE_ACCEPT, NULL ); file_chooser = GTK_FILE_CHOOSER(save_dialog); gtk_file_chooser_set_do_overwrite_confirmation(file_chooser, TRUE); gtk_file_chooser_set_current_name(file_chooser, "playlist.m3u"); if(gtk_dialog_run(GTK_DIALOG(save_dialog)) == GTK_RESPONSE_ACCEPT) { /* There should be only one file selected. */ dest_file = gtk_file_chooser_get_file(file_chooser); } gtk_widget_destroy(save_dialog); if(dest_file) { GFileOutputStream *dest_file_stream; dest_file_stream = g_file_replace( dest_file, NULL, FALSE, G_FILE_CREATE_NONE, NULL, &error ); dest_stream = G_OUTPUT_STREAM(dest_file_stream); rc = gtk_tree_model_get_iter_first (GTK_TREE_MODEL(playlist->list_store), &iter); rc &= !!dest_stream; } while(rc) { gchar *uri; gsize written; gtk_tree_model_get( GTK_TREE_MODEL(playlist->list_store), &iter, PLAYLIST_URI_COLUMN, &uri, -1 ); rc &= g_output_stream_printf( dest_stream, &written, NULL, &error, "%s\n", uri ); rc &= gtk_tree_model_iter_next (GTK_TREE_MODEL(playlist->list_store), &iter); } if(dest_stream) { g_output_stream_close(dest_stream, NULL, &error); } if(dest_file) { g_object_unref(dest_file); } if(error) { show_error_dialog(ctx, NULL, error->message); g_error_free(error); } } void playlist_row_handler( GtkTreeView *tree_view, GtkTreePath *path, GtkTreeViewColumn *column, gpointer data ) { gmpv_handle *ctx = data; gint *indices = gtk_tree_path_get_indices(path); if(indices) { gint64 index = indices[0]; mpv_set_property( ctx->mpv_ctx, "playlist-pos", MPV_FORMAT_INT64, &index ); } } void playlist_row_inserted_handler( GtkTreeModel *tree_model, GtkTreePath *path, GtkTreeIter *iter, gpointer data ) { gmpv_handle *ctx = data; ctx->playlist_move_dest = gtk_tree_path_get_indices(path)[0]; } void playlist_row_deleted_handler( GtkTreeModel *tree_model, GtkTreePath *path, gpointer data ) { gmpv_handle *ctx = data; const gchar *cmd[] = {"playlist_move", NULL, NULL, NULL}; gchar *src_str; gchar *dest_str; gint src; gint dest; src = gtk_tree_path_get_indices(path)[0]; dest = ctx->playlist_move_dest; if(dest >= 0) { src_str = g_strdup_printf("%d", (src > dest)?--src:src); dest_str = g_strdup_printf("%d", dest); ctx->playlist_move_dest = -1; cmd[1] = src_str; cmd[2] = dest_str; mpv_command(ctx->mpv_ctx, cmd); g_free(src_str); g_free(dest_str); } } void playlist_reset(gmpv_handle *ctx) { PlaylistWidget *playlist = PLAYLIST_WIDGET(ctx->gui->playlist); playlist_widget_set_indicator_pos(playlist, 0); } gnome-mpv-0.7/src/playlist.h000066400000000000000000000030051265310212500160610ustar00rootroot00000000000000/* * Copyright (c) 2014-2015 gnome-mpv * * This file is part of GNOME MPV. * * GNOME MPV 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. * * GNOME MPV 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 GNOME MPV. If not, see . */ #ifndef PLAYLIST_H #define PLAYLIST_H #include "common.h" #include void playlist_toggle_handler( GSimpleAction *action, GVariant *param, gpointer data ); void playlist_save_handler( GSimpleAction *action, GVariant *param, gpointer data ); void playlist_previous_handler(GtkWidget *widget, gpointer data); void playlist_next_handler(GtkWidget *widget, gpointer data); void playlist_row_handler( GtkTreeView *tree_view, GtkTreePath *path, GtkTreeViewColumn *column, gpointer data ); void playlist_row_inserted_handler( GtkTreeModel *tree_model, GtkTreePath *path, GtkTreeIter *iter, gpointer data ); void playlist_row_deleted_handler( GtkTreeModel *tree_model, GtkTreePath *path, gpointer data ); void playlist_reset(gmpv_handle *ctx); #endif gnome-mpv-0.7/src/playlist_widget.c000066400000000000000000000111351265310212500174220ustar00rootroot00000000000000/* * Copyright (c) 2014-2015 gnome-mpv * * This file is part of GNOME MPV. * * GNOME MPV 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. * * GNOME MPV 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 GNOME MPV. If not, see . */ #include #include "playlist_widget.h" G_DEFINE_TYPE(PlaylistWidget, playlist_widget, GTK_TYPE_SCROLLED_WINDOW) static gboolean mouse_press_handler( GtkWidget *widget, GdkEvent *event, gpointer data ) { GdkEventButton *btn_event = (GdkEventButton *)event; gboolean handled; handled = ( btn_event->type == GDK_BUTTON_PRESS && btn_event->button == 3 ); if(handled) { GMenu *menu; GMenuItem *add_menu_item; GMenuItem *loop_menu_item; GtkWidget *ctx_menu; menu = g_menu_new(); add_menu_item = g_menu_item_new(_("_Add…"), "app.open(true)"); loop_menu_item = g_menu_item_new(_("Loop"), "app.loop"); g_menu_append_item(menu, add_menu_item); g_menu_append_item(menu, loop_menu_item); g_menu_freeze(menu); ctx_menu = gtk_menu_new_from_model(G_MENU_MODEL(menu)); gtk_menu_attach_to_widget(GTK_MENU(ctx_menu), widget, NULL); gtk_widget_show_all(ctx_menu); gtk_menu_popup( GTK_MENU(ctx_menu), NULL, NULL, NULL, NULL, btn_event->button, btn_event->time ); } return handled; } static void playlist_widget_class_init(PlaylistWidgetClass *klass) { } static void playlist_widget_init(PlaylistWidget *wgt) { wgt->indicator_renderer = gtk_cell_renderer_text_new(); wgt->title_renderer = gtk_cell_renderer_text_new(); wgt->list_store = gtk_list_store_new( 3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING ); wgt->tree_view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(wgt->list_store)); wgt->indicator_column = gtk_tree_view_column_new_with_attributes ( "\xe2\x80\xa2", /* UTF-8 bullet */ wgt->indicator_renderer, "text", 0, NULL ); wgt->title_column = gtk_tree_view_column_new_with_attributes (_("Playlist"), wgt->title_renderer, "text", 1, NULL); g_signal_connect( wgt->tree_view, "button-press-event", G_CALLBACK(mouse_press_handler), NULL ); gtk_widget_set_can_focus(GTK_WIDGET(wgt->tree_view), FALSE); gtk_tree_view_set_reorderable(GTK_TREE_VIEW(wgt->tree_view), TRUE); gtk_tree_view_append_column (GTK_TREE_VIEW(wgt->tree_view), wgt->indicator_column); gtk_tree_view_append_column (GTK_TREE_VIEW(wgt->tree_view), wgt->title_column); gtk_container_add(GTK_CONTAINER(wgt), wgt->tree_view); } GtkWidget *playlist_widget_new() { return GTK_WIDGET(g_object_new(playlist_widget_get_type(), NULL)); } void playlist_widget_append( PlaylistWidget *wgt, const gchar *name, const gchar *uri ) { GtkTreeIter iter; gtk_list_store_append(wgt->list_store, &iter); gtk_list_store_set (wgt->list_store, &iter, PLAYLIST_NAME_COLUMN, name, -1); gtk_list_store_set (wgt->list_store, &iter, PLAYLIST_URI_COLUMN, uri, -1); gtk_tree_view_columns_autosize(GTK_TREE_VIEW(wgt->tree_view)); } void playlist_widget_remove(PlaylistWidget *wgt, gint pos) { GtkTreeIter iter; gboolean rc; rc = gtk_tree_model_get_iter_first (GTK_TREE_MODEL(wgt->list_store), &iter); while(rc && --pos >= 0) { rc = gtk_tree_model_iter_next (GTK_TREE_MODEL(wgt->list_store), &iter); } if(rc) { gtk_list_store_remove(wgt->list_store, &iter); gtk_tree_view_columns_autosize(GTK_TREE_VIEW(wgt->tree_view)); } } void playlist_widget_clear(PlaylistWidget *wgt) { gtk_list_store_clear(wgt->list_store); } gboolean playlist_widget_empty(PlaylistWidget *wgt) { GtkTreeIter iter; int rc; rc = gtk_tree_model_get_iter_first (GTK_TREE_MODEL(wgt->list_store), &iter); return !rc; } void playlist_widget_set_indicator_pos(PlaylistWidget *wgt, gint pos) { GtkTreeIter iter; gboolean rc; rc = gtk_tree_model_get_iter_first (GTK_TREE_MODEL(wgt->list_store), &iter); while(rc) { if(pos-- == 0) { /* Put UTF-8 'right-pointing triangle' at requested row */ gtk_list_store_set (wgt->list_store, &iter, 0, "\xe2\x96\xb6", -1); } else { /* Clear other rows */ gtk_list_store_set(wgt->list_store, &iter, 0, "", -1); } rc = gtk_tree_model_iter_next (GTK_TREE_MODEL(wgt->list_store), &iter); } } gnome-mpv-0.7/src/playlist_widget.h000066400000000000000000000047661265310212500174430ustar00rootroot00000000000000/* * Copyright (c) 2014 gnome-mpv * * This file is part of GNOME MPV. * * GNOME MPV 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. * * GNOME MPV 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 GNOME MPV. If not, see . */ #ifndef PLAYLIST_WIDGET_H #define PLAYLIST_WIDGET_H #include G_BEGIN_DECLS #define PLAYLIST_WIDGET_TYPE (playlist_widget_get_type ()) #define PLAYLIST_WIDGET(obj) \ (G_TYPE_CHECK_INSTANCE_CAST \ ((obj), PLAYLIST_WIDGET_TYPE, PlaylistWidget)) #define PLAYLIST_WIDGET_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST \ ((klass), PLAYLIST_WIDGET_TYPE, PlaylistWidgetClass)) #define IS_PLAYLIST_WIDGET(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE((obj), PLAYLIST_WIDGET_TYPE)) #define IS_PLAYLIST_WIDGET_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE((klass), PLAYLIST_WIDGET_TYPE)) enum PlaylistStoreColumn { PLAYLIST_INDICATOR_COLUMN, PLAYLIST_NAME_COLUMN, PLAYLIST_URI_COLUMN, PLAYLIST_N_COLUMNS }; struct _PlaylistWidget { GtkScrolledWindow parent_instance; GtkWidget *tree_view; GtkListStore *list_store; GtkTreeViewColumn *indicator_column; GtkTreeViewColumn *title_column; GtkCellRenderer *indicator_renderer; GtkCellRenderer *title_renderer; }; struct _PlaylistWidgetClass { GtkScrolledWindowClass parent_class; }; typedef struct _PlaylistWidget PlaylistWidget; typedef struct _PlaylistWidgetClass PlaylistWidgetClass; typedef enum PlaylistStoreColumn PlaylistStoreColumn; GtkWidget *playlist_widget_new(void); GType playlist_widget_get_type(void); gboolean playlist_widget_empty(PlaylistWidget *wgt); void playlist_widget_clear(PlaylistWidget *wgt); void playlist_widget_get_iter_first(PlaylistWidget *wgt, GtkTreeIter *iter); void playlist_widget_iter_next(PlaylistWidget *wgt, GtkTreeIter *iter); void playlist_widget_get_uri(PlaylistWidget *wgt, gint pos); void playlist_widget_set_indicator_pos(PlaylistWidget *wgt, gint pos); void playlist_widget_remove(PlaylistWidget *wgt, gint pos); void playlist_widget_append( PlaylistWidget *wgt, const gchar *name, const gchar *uri ); G_END_DECLS #endif gnome-mpv-0.7/src/pref_dialog.c000066400000000000000000000250451265310212500164760ustar00rootroot00000000000000/* * Copyright (c) 2014-2016 gnome-mpv * * This file is part of GNOME MPV. * * GNOME MPV 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. * * GNOME MPV 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 GNOME MPV. If not, see . */ #include #include "pref_dialog.h" #include "main_window.h" #define TOGGLE_BTN_PREF_MAP(VAR, DLG, PREF) \ const struct \ { \ GtkToggleButton *btn; \ gboolean *value; \ } \ VAR[] = { {GTK_TOGGLE_BUTTON(DLG->csd_enable_check), \ &PREF->csd_enable}, \ {GTK_TOGGLE_BUTTON(DLG->dark_theme_enable_check), \ &PREF->dark_theme_enable}, \ {GTK_TOGGLE_BUTTON(DLG->last_folder_enable_check), \ &PREF->last_folder_enable}, \ {GTK_TOGGLE_BUTTON(DLG->mpv_input_enable_check), \ &PREF->mpv_input_config_enable}, \ {GTK_TOGGLE_BUTTON(DLG->mpv_conf_enable_check), \ &PREF->mpv_config_enable}, \ {NULL, NULL} }; struct _PrefDialog { GtkDialog parent_instance; GtkWidget *grid; GtkWidget *content_area; GtkWidget *csd_enable_check; GtkWidget *dark_theme_enable_check; GtkWidget *last_folder_enable_check; GtkWidget *mpv_input_enable_check; GtkWidget *mpv_input_button; GtkWidget *mpv_conf_enable_check; GtkWidget *mpv_conf_button; GtkWidget *mpv_options_entry; }; struct _PrefDialogClass { GtkDialogClass parent_class; }; G_DEFINE_TYPE(PrefDialog, pref_dialog, GTK_TYPE_DIALOG) static gboolean key_press_handler(GtkWidget *widget, GdkEventKey *event) { guint keyval = event->keyval; guint state = event->state; const guint mod_mask = GDK_MODIFIER_MASK &~(GDK_SHIFT_MASK |GDK_LOCK_MASK |GDK_MOD2_MASK |GDK_MOD3_MASK |GDK_MOD4_MASK |GDK_MOD5_MASK); if((state&mod_mask) == 0 && keyval == GDK_KEY_Return) { gtk_dialog_response(GTK_DIALOG(widget), GTK_RESPONSE_ACCEPT); } return GTK_WIDGET_CLASS(pref_dialog_parent_class)->key_press_event (widget, event); } static void pref_dialog_constructed(GObject *obj) { gboolean csd_enabled; g_object_get(obj, "use-header-bar", &csd_enabled, NULL); if(!csd_enabled) { gtk_widget_set_margin_bottom(PREF_DIALOG(obj)->grid, 12); } G_OBJECT_CLASS(pref_dialog_parent_class)->constructed(obj); } static void pref_dialog_class_init(PrefDialogClass *klass) { GtkWidgetClass *wid_class = GTK_WIDGET_CLASS(klass); wid_class->key_press_event = key_press_handler; G_OBJECT_CLASS(wid_class)->constructed = pref_dialog_constructed; } static void pref_dialog_init(PrefDialog *dlg) { GdkGeometry geom; GtkWidget *mpv_conf_label; GtkWidget *mpv_input_label; GtkWidget *mpv_options_label; GtkWidget *general_group_label; GtkWidget *mpv_conf_group_label; GtkWidget *mpv_input_group_label; GtkWidget *misc_group_label; gint grid_row; mpv_conf_label = gtk_label_new(_("MPV configuration file:")); mpv_input_label = gtk_label_new(_("MPV input configuration file:")); mpv_options_label = gtk_label_new(_("Extra MPV options:")); general_group_label = gtk_label_new(_("General")); mpv_conf_group_label = gtk_label_new(_("MPV Configuration")); mpv_input_group_label = gtk_label_new(_("Keybindings")); misc_group_label = gtk_label_new(_("Miscellaneous")); grid_row = 0; /* This 'locks' the height of the dialog while allowing the width to be * freely adjusted. */ geom.max_width = G_MAXINT; geom.max_height = 0; dlg->grid = gtk_grid_new(); dlg->content_area = gtk_dialog_get_content_area(GTK_DIALOG(dlg)); dlg->mpv_options_entry = gtk_entry_new(); dlg->csd_enable_check = gtk_check_button_new_with_label (_("Enable client-side decorations")); dlg->dark_theme_enable_check = gtk_check_button_new_with_label (_("Enable dark theme")); dlg->last_folder_enable_check = gtk_check_button_new_with_label (_("Remember last file's location")); dlg->mpv_conf_button = gtk_file_chooser_button_new ( _("MPV configuration file"), GTK_FILE_CHOOSER_ACTION_OPEN ); dlg->mpv_input_button = gtk_file_chooser_button_new ( _("MPV input configuration file"), GTK_FILE_CHOOSER_ACTION_OPEN ); dlg->mpv_conf_enable_check = gtk_check_button_new_with_label (_("Load MPV configuration file")); dlg->mpv_input_enable_check = gtk_check_button_new_with_label (_("Load MPV input configuration file")); gtk_label_set_use_markup(GTK_LABEL(general_group_label), TRUE); gtk_label_set_use_markup(GTK_LABEL(mpv_conf_group_label), TRUE); gtk_label_set_use_markup(GTK_LABEL(mpv_input_group_label), TRUE); gtk_label_set_use_markup(GTK_LABEL(misc_group_label), TRUE); gtk_widget_set_margin_top(mpv_conf_group_label, 12); gtk_widget_set_margin_top(mpv_input_group_label, 12); gtk_widget_set_margin_top(misc_group_label, 12); gtk_grid_set_row_spacing(GTK_GRID(dlg->grid), 6); gtk_grid_set_column_spacing(GTK_GRID(dlg->grid), 12); gtk_widget_set_halign(mpv_conf_label, GTK_ALIGN_START); gtk_widget_set_halign(mpv_input_label, GTK_ALIGN_START); gtk_widget_set_halign(mpv_options_label, GTK_ALIGN_START); gtk_widget_set_halign(general_group_label, GTK_ALIGN_START); gtk_widget_set_halign(mpv_conf_group_label, GTK_ALIGN_START); gtk_widget_set_halign(mpv_input_group_label, GTK_ALIGN_START); gtk_widget_set_halign(misc_group_label, GTK_ALIGN_START); gtk_widget_set_hexpand(mpv_conf_label, FALSE); gtk_widget_set_hexpand(mpv_input_label, FALSE); gtk_widget_set_hexpand(mpv_options_label, FALSE); gtk_widget_set_hexpand(dlg->mpv_conf_button, TRUE); gtk_widget_set_hexpand(dlg->mpv_input_button, TRUE); gtk_widget_set_hexpand(dlg->mpv_options_entry, TRUE); gtk_widget_set_margin_start(mpv_conf_label, 12); gtk_widget_set_margin_start(mpv_input_label, 12); gtk_widget_set_margin_start(mpv_options_label, 12); gtk_widget_set_margin_start(dlg->csd_enable_check, 12); gtk_widget_set_margin_start(dlg->dark_theme_enable_check, 12); gtk_widget_set_margin_start(dlg->last_folder_enable_check, 12); gtk_widget_set_margin_start(dlg->mpv_conf_enable_check, 12); gtk_widget_set_margin_start(dlg->mpv_input_enable_check, 12); gtk_widget_set_margin_start(dlg->mpv_options_entry, 12); gtk_widget_set_size_request(dlg->mpv_conf_button, 100, -1); gtk_widget_set_size_request(dlg->mpv_input_button, 100, -1); gtk_window_set_geometry_hints( GTK_WINDOW(dlg), GTK_WIDGET(dlg), &geom, GDK_HINT_MAX_SIZE ); gtk_container_set_border_width(GTK_CONTAINER(dlg->content_area), 12); gtk_container_add(GTK_CONTAINER(dlg->content_area), dlg->grid); gtk_grid_attach( GTK_GRID(dlg->grid), general_group_label, 0, grid_row++, 1, 1 ); gtk_grid_attach( GTK_GRID(dlg->grid), dlg->csd_enable_check, 0, grid_row++, 2, 1 ); gtk_grid_attach( GTK_GRID(dlg->grid), dlg->dark_theme_enable_check, 0, grid_row++, 2, 1 ); gtk_grid_attach( GTK_GRID(dlg->grid), dlg->last_folder_enable_check, 0, grid_row++, 2, 1 ); gtk_grid_attach( GTK_GRID(dlg->grid), mpv_conf_group_label, 0, grid_row++, 1, 1 ); gtk_grid_attach( GTK_GRID(dlg->grid), dlg->mpv_conf_enable_check, 0, grid_row++, 2, 1 ); gtk_grid_attach( GTK_GRID(dlg->grid), mpv_conf_label, 0, grid_row, 1, 1 ); gtk_grid_attach( GTK_GRID(dlg->grid), dlg->mpv_conf_button, 1, grid_row++, 1, 1 ); gtk_grid_attach( GTK_GRID(dlg->grid), mpv_input_group_label, 0, grid_row++, 1, 1 ); gtk_grid_attach( GTK_GRID(dlg->grid), dlg->mpv_input_enable_check, 0, grid_row++, 2, 1 ); gtk_grid_attach( GTK_GRID(dlg->grid), mpv_input_label, 0, grid_row, 1, 1 ); gtk_grid_attach( GTK_GRID(dlg->grid), dlg->mpv_input_button, 1, grid_row++, 1, 1 ); gtk_grid_attach( GTK_GRID(dlg->grid), misc_group_label, 0, grid_row++, 1, 1 ); gtk_grid_attach( GTK_GRID(dlg->grid), mpv_options_label, 0, grid_row++, 1, 1 ); gtk_grid_attach( GTK_GRID(dlg->grid), dlg->mpv_options_entry, 0, grid_row++, 2, 1 ); gtk_dialog_add_buttons( GTK_DIALOG(dlg), _("_Cancel"), GTK_RESPONSE_REJECT, _("_Save"), GTK_RESPONSE_ACCEPT, NULL ); gtk_dialog_set_default_response (GTK_DIALOG(dlg), GTK_RESPONSE_ACCEPT); } GtkWidget *pref_dialog_new(GtkWindow *parent) { GtkWidget *dlg; GtkWidget *header_bar; gboolean csd_enabled; csd_enabled = main_window_get_csd_enabled(MAIN_WINDOW(parent)); dlg = g_object_new( pref_dialog_get_type(), "title", _("Preferences"), "modal", TRUE, "transient-for", parent, "use-header-bar", csd_enabled, NULL ); header_bar = gtk_dialog_get_header_bar(GTK_DIALOG(dlg)); if(header_bar) { /* The defaults use PACK_END which is ugly with multiple buttons */ GtkWidget *cancel_btn = gtk_dialog_get_widget_for_response (GTK_DIALOG(dlg), GTK_RESPONSE_REJECT); gtk_container_child_set( GTK_CONTAINER(header_bar), cancel_btn, "pack-type", GTK_PACK_START, NULL ); gtk_header_bar_set_show_close_button (GTK_HEADER_BAR(header_bar), FALSE); } gtk_widget_hide_on_delete(dlg); gtk_widget_show_all(dlg); return dlg; } pref_store *pref_dialog_get_pref(PrefDialog *dlg) { pref_store *pref = g_malloc(sizeof(pref_store)); GtkFileChooser *conf_chooser = GTK_FILE_CHOOSER(dlg->mpv_conf_button); GtkFileChooser *input_chooser = GTK_FILE_CHOOSER(dlg->mpv_input_button); GtkEntry *mpv_options_entry = GTK_ENTRY(dlg->mpv_options_entry); TOGGLE_BTN_PREF_MAP(toggle_btn, dlg, pref) for(gint i = 0; toggle_btn[i].btn; i++) { *(toggle_btn[i].value) = gtk_toggle_button_get_active(toggle_btn[i].btn); } pref->mpv_config_file = gtk_file_chooser_get_filename(conf_chooser); pref->mpv_input_config_file = gtk_file_chooser_get_filename(input_chooser); pref->mpv_options = g_strdup(gtk_entry_get_text(mpv_options_entry)); return pref; } void pref_dialog_set_pref(PrefDialog *dlg, pref_store *pref) { GtkFileChooser *conf_chooser = GTK_FILE_CHOOSER(dlg->mpv_conf_button); GtkFileChooser *input_chooser = GTK_FILE_CHOOSER(dlg->mpv_input_button); GtkEntry *mpv_options_entry = GTK_ENTRY(dlg->mpv_options_entry); TOGGLE_BTN_PREF_MAP(toggle_btn, dlg, pref) for(gint i = 0; toggle_btn[i].btn; i++) { gtk_toggle_button_set_active (toggle_btn[i].btn, *(toggle_btn[i].value)); } gtk_file_chooser_set_filename (conf_chooser, pref->mpv_config_file); gtk_file_chooser_set_filename (input_chooser, pref->mpv_input_config_file); gtk_entry_set_text (mpv_options_entry, pref->mpv_options); } gnome-mpv-0.7/src/pref_dialog.h000066400000000000000000000030371265310212500165000ustar00rootroot00000000000000/* * Copyright (c) 2014-2015 gnome-mpv * * This file is part of GNOME MPV. * * GNOME MPV 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. * * GNOME MPV 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 GNOME MPV. If not, see . */ #ifndef PREF_DIALOG_H #define PREF_DIALOG_H #include #include "pref_store.h" G_BEGIN_DECLS #define PREF_DIALOG_TYPE (pref_dialog_get_type ()) #define PREF_DIALOG(obj) \ (G_TYPE_CHECK_INSTANCE_CAST((obj), PREF_DIALOG_TYPE, PrefDialog)) #define PREF_DIALOG_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST((klass), PREF_DIALOG_TYPE, PrefDialogClass)) #define IS_PREF_DIALOG(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE((obj), PREF_DIALOG_TYPE)) #define IS_PREF_DIALOG_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE((klass), PREF_DIALOG_TYPE)) typedef struct _PrefDialog PrefDialog; typedef struct _PrefDialogClass PrefDialogClass; GtkWidget *pref_dialog_new(GtkWindow *parent); GType pref_dialog_get_type(void); pref_store *pref_dialog_get_pref(PrefDialog *dlg); void pref_dialog_set_pref(PrefDialog *dlg, pref_store *pref); G_END_DECLS #endif gnome-mpv-0.7/src/pref_store.c000066400000000000000000000024071265310212500163700ustar00rootroot00000000000000/* * Copyright (c) 2015-2016 gnome-mpv * * This file is part of GNOME MPV. * * GNOME MPV 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. * * GNOME MPV 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 GNOME MPV. If not, see . */ #include "pref_store.h" pref_store *pref_store_new() { pref_store *pref = g_malloc(sizeof(pref_store)); pref->dark_theme_enable = TRUE; pref->csd_enable = TRUE; pref->last_folder_enable = FALSE; pref->mpv_input_config_enable = FALSE; pref->mpv_config_enable = FALSE; pref->mpv_input_config_file = NULL; pref->mpv_config_file = NULL; pref->mpv_options = NULL; return pref; } void pref_store_free(pref_store *pref) { if(pref) { g_free(pref->mpv_input_config_file); g_free(pref->mpv_config_file); g_free(pref->mpv_options); g_free(pref); } } gnome-mpv-0.7/src/pref_store.h000066400000000000000000000021641265310212500163750ustar00rootroot00000000000000/* * Copyright (c) 2015-2016 gnome-mpv * * This file is part of GNOME MPV. * * GNOME MPV 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. * * GNOME MPV 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 GNOME MPV. If not, see . */ #ifndef PREF_H #define PREF_H #include struct pref_store { gboolean dark_theme_enable; gboolean csd_enable; gboolean last_folder_enable; gboolean mpv_input_config_enable; gboolean mpv_config_enable; gchar *mpv_input_config_file; gchar *mpv_config_file; gchar *mpv_options; }; typedef struct pref_store pref_store; pref_store *pref_store_new(void); void pref_store_free(pref_store *pref); #endif gnome-mpv-0.7/src/track.c000066400000000000000000000020111265310212500153130ustar00rootroot00000000000000/* * Copyright (c) 2015 gnome-mpv * * This file is part of GNOME MPV. * * GNOME MPV 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. * * GNOME MPV 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 GNOME MPV. If not, see . */ #include "track.h" Track *track_new(void) { Track *entry = g_malloc(sizeof(Track)); entry->type = TRACK_TYPE_INVALID; entry->title = NULL; entry->lang = NULL; entry->id = 0; return entry; } void track_free(Track *entry) { if(entry) { g_free(entry->title); g_free(entry->lang); g_free(entry); } } gnome-mpv-0.7/src/track.h000066400000000000000000000020621265310212500153260ustar00rootroot00000000000000/* * Copyright (c) 2015 gnome-mpv * * This file is part of GNOME MPV. * * GNOME MPV 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. * * GNOME MPV 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 GNOME MPV. If not, see . */ #ifndef TRACK_H #define TRACK_H #include typedef enum TrackType TrackType; typedef struct Track Track; enum TrackType { TRACK_TYPE_INVALID, TRACK_TYPE_AUDIO, TRACK_TYPE_VIDEO, TRACK_TYPE_SUBTITLE }; struct Track { TrackType type; gint64 id; gchar *title; gchar *lang; }; Track *track_new(void); void track_free(Track *entry); #endif gnome-mpv-0.7/zanata.xml000066400000000000000000000005171265310212500152650ustar00rootroot00000000000000 https://translate.zanata.org/zanata/ gnome-mpv master gettext po po