pax_global_header00006660000000000000000000000064135232374340014520gustar00rootroot0000000000000052 comment=d5ca39a27e707c3609a8c5bfb636e8fedb3997b3 brisk-menu-0.6.0/000077500000000000000000000000001352323743400135775ustar00rootroot00000000000000brisk-menu-0.6.0/.clang-format000066400000000000000000000050461352323743400161570ustar00rootroot00000000000000--- AccessModifierOffset: 0 AlignAfterOpenBracket: true AlignConsecutiveAssignments: false #uncomment for clang 3.9 #AlignConsecutiveDeclarations: false AlignEscapedNewlinesLeft: false AlignOperands: true AlignTrailingComments: true AllowAllParametersOfDeclarationOnNextLine: true AllowShortBlocksOnASingleLine: false AllowShortCaseLabelsOnASingleLine: false AllowShortFunctionsOnASingleLine: None AllowShortIfStatementsOnASingleLine: false AllowShortLoopsOnASingleLine: false # AlwaysBreakAfterDefinitionReturnType: None #uncomment for clang 3.9 #AlwaysBreakAfterReturnType: None AlwaysBreakBeforeMultilineStrings: true AlwaysBreakTemplateDeclarations: false BinPackArguments: false BinPackParameters: true # BraceWrapping: (not set since BreakBeforeBraces is not Custom) BreakBeforeBinaryOperators: None # BreakAfterJavaFieldAnnotations: (not java) BreakBeforeBinaryOperators: None BreakBeforeBraces: Linux BreakBeforeTernaryOperators: true BreakConstructorInitializersBeforeComma: false #uncomment for clang 3.9 #BreakStringLiterals: false ColumnLimit: 100 CommentPragmas: '\*\<' ConstructorInitializerAllOnOneLineOrOnePerLine: false ConstructorInitializerIndentWidth: 4 ContinuationIndentWidth: 4 Cpp11BracedListStyle: false DerivePointerAlignment: false DisableFormat: false ExperimentalAutoDetectBinPacking: false ForEachMacros: [ ] #Uncomment for clang 3.9 #IncludeCategories: # - Regex: '^"' # Priority: 1 # IncludeIsMainRegex: (project doesn't use a main includes that can add other includes via regex) IndentCaseLabels: false IndentWidth: 8 IndentWrappedFunctionNames: false # JavaScriptQuotes: (not javascript) KeepEmptyLinesAtTheStartOfBlocks: false Language: Cpp MacroBlockBegin: '' MacroBlockEnd: '' MaxEmptyLinesToKeep: 1 NamespaceIndentation: None # ObjCBlockIndentWidth: (not objc) # ObjCSpaceAfterProperty: (not objc) # ObjCSpaceBeforeProtocolList: (not objc) PenaltyBreakBeforeFirstCallParameter: 400 PenaltyBreakComment: 0 # PenaltyBreakFirstLessLess: (not cpp) PenaltyBreakString: 500 PenaltyExcessCharacter: 10000 PenaltyReturnTypeOnItsOwnLine: 600 PointerAlignment: Right #uncomment for clang 3.9 #ReflowComments: true #uncomment for clang 3.9 #SortIncludes: true SpaceAfterCStyleCast: false SpaceBeforeAssignmentOperators: true SpaceBeforeParens: ControlStatements SpaceInEmptyParentheses: false SpacesBeforeTrailingComments: 1 SpacesInAngles: false SpacesInCStyleCastParentheses: false # SpacesInContainerLiterals: (not objc or javascript) SpacesInParentheses: false SpacesInSquareBrackets: false Standard: Cpp11 TabWidth: 8 UseTab: Never ... brisk-menu-0.6.0/AUTHORS000066400000000000000000000012041352323743400146440ustar00rootroot00000000000000Adam Hobaugh Daniel Greenwood Eric Turgeon <4249848+ericbsd@users.noreply.github.com> Federico Damián Schonborn gabrc52 gabrielfin Ikey Doherty Joshua Strobl Kim Malmo Martin Wimpress Mike Gabriel Pierre-Yves raveit65 Staudey Stefan Ric Stefan Ric Victor Kareh brisk-menu-0.6.0/LICENSE000066400000000000000000000431521352323743400146110ustar00rootroot00000000000000GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) 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 this service 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 make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. 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. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute 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 and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), 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 distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the 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 a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, 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. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE 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. 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 convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. {description} Copyright (C) {year} {fullname} 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 2 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, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision 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, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. {signature of Ty Coon}, 1 April 1989 Ty Coon, President of Vice This 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. brisk-menu-0.6.0/LICENSE.CC-BY-SA-4.0000066400000000000000000000470441352323743400162110ustar00rootroot00000000000000Attribution-ShareAlike 4.0 International ======================================================================= Creative Commons Corporation ("Creative Commons") is not a law firm and does not provide legal services or legal advice. Distribution of Creative Commons public licenses does not create a lawyer-client or other relationship. Creative Commons makes its licenses and related information available on an "as-is" basis. Creative Commons gives no warranties regarding its licenses, any material licensed under their terms and conditions, or any related information. Creative Commons disclaims all liability for damages resulting from their use to the fullest extent possible. Using Creative Commons Public Licenses Creative Commons public licenses provide a standard set of terms and conditions that creators and other rights holders may use to share original works of authorship and other material subject to copyright and certain other rights specified in the public license below. The following considerations are for informational purposes only, are not exhaustive, and do not form part of our licenses. Considerations for licensors: Our public licenses are intended for use by those authorized to give the public permission to use material in ways otherwise restricted by copyright and certain other rights. Our licenses are irrevocable. Licensors should read and understand the terms and conditions of the license they choose before applying it. Licensors should also secure all rights necessary before applying our licenses so that the public can reuse the material as expected. Licensors should clearly mark any material not subject to the license. This includes other CC- licensed material, or material used under an exception or limitation to copyright. More considerations for licensors: wiki.creativecommons.org/Considerations_for_licensors Considerations for the public: By using one of our public licenses, a licensor grants the public permission to use the licensed material under specified terms and conditions. If the licensor's permission is not necessary for any reason--for example, because of any applicable exception or limitation to copyright--then that use is not regulated by the license. Our licenses grant only permissions under copyright and certain other rights that a licensor has authority to grant. Use of the licensed material may still be restricted for other reasons, including because others have copyright or other rights in the material. A licensor may make special requests, such as asking that all changes be marked or described. Although not required by our licenses, you are encouraged to respect those requests where reasonable. More_considerations for the public: wiki.creativecommons.org/Considerations_for_licensees ======================================================================= Creative Commons Attribution-ShareAlike 4.0 International Public License By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution-ShareAlike 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions. Section 1 -- Definitions. a. Adapted Material means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image. b. Adapter's License means the license You apply to Your Copyright and Similar Rights in Your contributions to Adapted Material in accordance with the terms and conditions of this Public License. c. BY-SA Compatible License means a license listed at creativecommons.org/compatiblelicenses, approved by Creative Commons as essentially the equivalent of this Public License. d. Copyright and Similar Rights means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights. e. Effective Technological Measures means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements. f. Exceptions and Limitations means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material. g. License Elements means the license attributes listed in the name of a Creative Commons Public License. The License Elements of this Public License are Attribution and ShareAlike. h. Licensed Material means the artistic or literary work, database, or other material to which the Licensor applied this Public License. i. Licensed Rights means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license. j. Licensor means the individual(s) or entity(ies) granting rights under this Public License. k. Share means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them. l. Sui Generis Database Rights means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world. m. You means the individual or entity exercising the Licensed Rights under this Public License. Your has a corresponding meaning. Section 2 -- Scope. a. License grant. 1. Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to: a. reproduce and Share the Licensed Material, in whole or in part; and b. produce, reproduce, and Share Adapted Material. 2. Exceptions and Limitations. For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions. 3. Term. The term of this Public License is specified in Section 6(a). 4. Media and formats; technical modifications allowed. The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section 2(a) (4) never produces Adapted Material. 5. Downstream recipients. a. Offer from the Licensor -- Licensed Material. Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights under the terms and conditions of this Public License. b. Additional offer from the Licensor -- Adapted Material. Every recipient of Adapted Material from You automatically receives an offer from the Licensor to exercise the Licensed Rights in the Adapted Material under the conditions of the Adapter's License You apply. c. No downstream restrictions. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material. 6. No endorsement. Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is, connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section 3(a)(1)(A)(i). b. Other rights. 1. Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives and/or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights, but not otherwise. 2. Patent and trademark rights are not licensed under this Public License. 3. To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties. Section 3 -- License Conditions. Your exercise of the Licensed Rights is expressly made subject to the following conditions. a. Attribution. 1. If You Share the Licensed Material (including in modified form), You must: a. retain the following if it is supplied by the Licensor with the Licensed Material: i. identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by pseudonym if designated); ii. a copyright notice; iii. a notice that refers to this Public License; iv. a notice that refers to the disclaimer of warranties; v. a URI or hyperlink to the Licensed Material to the extent reasonably practicable; b. indicate if You modified the Licensed Material and retain an indication of any previous modifications; and c. indicate the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License. 2. You may satisfy the conditions in Section 3(a)(1) in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information. 3. If requested by the Licensor, You must remove any of the information required by Section 3(a)(1)(A) to the extent reasonably practicable. b. ShareAlike. In addition to the conditions in Section 3(a), if You Share Adapted Material You produce, the following conditions also apply. 1. The Adapter's License You apply must be a Creative Commons license with the same License Elements, this version or later, or a BY-SA Compatible License. 2. You must include the text of, or the URI or hyperlink to, the Adapter's License You apply. You may satisfy this condition in any reasonable manner based on the medium, means, and context in which You Share Adapted Material. 3. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, Adapted Material that restrict exercise of the rights granted under the Adapter's License You apply. Section 4 -- Sui Generis Database Rights. Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material: a. for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database; b. if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material, including for purposes of Section 3(b); and c. You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database. For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights. Section 5 -- Disclaimer of Warranties and Limitation of Liability. a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS, IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION, WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS, ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU. b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION, NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT, INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES, COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR IN PART, THIS LIMITATION MAY NOT APPLY TO YOU. c. The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability. Section 6 -- Term and Termination. a. This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically. b. Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates: 1. automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or 2. upon express reinstatement by the Licensor. For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License. c. For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License. d. Sections 1, 5, 6, 7, and 8 survive termination of this Public License. Section 7 -- Other Terms and Conditions. a. The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed. b. Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License. Section 8 -- Interpretation. a. For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License. b. To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions. c. No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor. d. Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority. ======================================================================= Creative Commons is not a party to its public licenses. Notwithstanding, Creative Commons may elect to apply one of its public licenses to material it publishes and in those instances will be considered the "Licensor." Except for the limited purpose of indicating that material is shared under a Creative Commons public license or as otherwise permitted by the Creative Commons policies published at creativecommons.org/policies, Creative Commons does not authorize the use of the trademark "Creative Commons" or any other trademark or logo of Creative Commons without its prior written consent including, without limitation, in connection with any unauthorized modifications to any of its public licenses or any other arrangements, understandings, or agreements concerning use of licensed material. For the avoidance of doubt, this paragraph does not form part of the public licenses. Creative Commons may be contacted at creativecommons.org.brisk-menu-0.6.0/README.md000066400000000000000000000062671352323743400150710ustar00rootroot00000000000000brisk-menu ========== [![Coverity Scan](https://img.shields.io/coverity/scan/11139.svg)](https://scan.coverity.com/projects/solus-project-brisk-menu) [![License](https://img.shields.io/badge/License-GPL%202.0-blue.svg)](https://opensource.org/licenses/GPL-2.0) brisk-menu is a modern and efficient menu designed to improve the MATE Desktop Environment with modern, first-class options. The purpose of this project is to provide a usable menu as seen in other desktops without the bloat and performance issues. brisk-menu is **distro-agnostic** and the reporting of portability issues is encouraged. ![screenshot](https://raw.githubusercontent.com/getsolus/brisk-menu/master/.github/main.png) brisk-menu is a **collaborative** project between [Solus](https://getsol.us/) and [Ubuntu MATE](https://ubuntu-mate.org/) ![ubuntu_mate_logo](https://ubuntu-mate.org/gallery/Artwork/design-guide/Main_Logo.png) ![solus_logo](https://build.getsol.us/logo.png) Features -------- - Keyboard centric (mice welcome too, of course) - Hotkey support (defaults to Super, configurable in gsettings) - Stupid-fast - Efficient, useful searching with prioritised listings - Modular backend design split from the frontend, allowing new backends in future (hint: the frontend is not tied to `.desktop` files) - Context menus for `.desktop` actions (incognito mode, etc.) - Pin shortcuts to the `Favourites` backend and directly to the desktop using the context menu (unpin too!) - Configurable label (hide/text) - Automatically adapt to vertical panels - Automatically reload - Filter via categories - Session/screensaver controls - Drag & drop support for launchers - Sidebar launcher support - GTK3 + CSS styling options - Fully correct `X11` WM integration (grab policy and window types) - Not Python. **Planned** These planned features will be implemented in the future: - Settings UI to control further visual aspects (labels/icons/options) - Improved styling for the window edge + search entry. More will be added. ![screenshot_context](https://raw.githubusercontent.com/getsolus/brisk-menu/master/.github/context.png) Building Brisk Menu ------------------- **Requirements:** * GTK 3.18 or greater * GTK 3.18 build of Mate 1.16 or greater * **Modern** `meson` (`0.40.x`+) and `ninja` (Ubuntu users should use xenial-backports) **Build Process:** ```bash meson --buildtype plain build --prefix=/usr ninja -C build -j$(($(getconf _NPROCESSORS_ONLN)+1)) sudo ninja -C build install ```` **Development on Solus:** ```bash meson build --buildtype debugoptimized --prefix=/usr --sysconfdir=/etc --libdir=/usr/lib64 --libexecdir=/usr/lib64/brisk-menu ninja -C build -j$(($(getconf _NPROCESSORS_ONLN)+1)) sudo ninja -C build install ``` License -------- Copyright © 2016-2019 Brisk Menu Developers `brisk-menu` is available under the terms of the `GPL-2.0` license. The `brisk_system-log-out-symbolic.svg` icon is a copy of `application-exit-symbolic.svg` to use within Brisk. This icon is copyright © Sam Hewitt, from the [Paper Icons](https://github.com/snwh/paper-icon-theme) theme, available under the terms of the [CC-BY-SA-4.0 license](https://creativecommons.org/licenses/by-sa/4.0/). brisk-menu-0.6.0/data/000077500000000000000000000000001352323743400145105ustar00rootroot00000000000000brisk-menu-0.6.0/data/brisk.gresource.xml000066400000000000000000000004451352323743400203440ustar00rootroot00000000000000 classic/styling.css dash/styling.css dash/styling-light.css brisk-menu-0.6.0/data/brisk_system-log-out-symbolic.svg000066400000000000000000000116031352323743400231530ustar00rootroot00000000000000 image/svg+xml Paper Symbolic Icon Theme Paper Symbolic Icon Theme brisk-menu-0.6.0/data/classic/000077500000000000000000000000001352323743400161315ustar00rootroot00000000000000brisk-menu-0.6.0/data/classic/styling.css000066400000000000000000000001641352323743400203350ustar00rootroot00000000000000.brisk-button-vertical { padding: 0px; margin: 0px; } .brisk-button { padding: 0px; margin: 0px; } brisk-menu-0.6.0/data/com.solus-project.brisk-menu.gschema.xml000066400000000000000000000047131352323743400243060ustar00rootroot00000000000000 ['matecc.desktop'] Pinned Shortcuts These shortcuts will appear in the Brisk Menu sidepane. [''] Favourites Favourite items false Use dark theme variant for Brisk Menu Use the dark theme for Brisk Menu aka night mode false Activate categories with mouse rollover Categories will be activated by hovering with the mouse 'top' Search bar position Where the search bar will appear in the menu 'classic' Window type The window we're going to display 'Super_L' Keyboard shortcut Accelerator key for opening and closing the menu. "" Button label text Change the label text for the menu button true Button label visibility Control the visibility of the main button label brisk-menu-0.6.0/data/com.solus_project.brisk.BriskMenu.mate-panel-applet.in000066400000000000000000000003351352323743400270250ustar00rootroot00000000000000[Applet Factory] Id=BriskMenuFactory Location=@LIBEXECDIR@/brisk-menu Name=Brisk Menu Factory Description=Brisk Menu Factory [BriskMenu] Name=Brisk Menu Description=An efficient menu for the MATE desktop Icon=start-here brisk-menu-0.6.0/data/dash/000077500000000000000000000000001352323743400154275ustar00rootroot00000000000000brisk-menu-0.6.0/data/dash/styling-light.css000066400000000000000000000015631352323743400207440ustar00rootroot00000000000000.brisk-button-vertical { padding: 0px; margin: 0px; } .brisk-button { padding: 0px; margin: 0px; } .brisk-dash { background-color: alpha(@dark_bg_color, 0.95); } .brisk-dash .dash-category-button { border: 1px solid transparent; background-color: transparent; font-weight: bold; } .brisk-dash .dash-category-button:checked { background-color: mix(@dark_bg_color, #000000, 0.2); border: 1px solid alpha(@dark_fg_color, 0.1); } .brisk-dash .dash-category-button:hover { background-color: mix(@dark_bg_color, #000000, 0.2); border: 1px solid alpha(#000, 0.2); } .brisk-dash .header { background-color: mix(@dark_bg_color, #000000, 0.1); border-bottom: 1px solid mix(@dark_bg_color, #000000, 0.35); box-shadow: 0px 1px 1px alpha(@dark_fg_color, 0.04); } .brisk-dash .header .section-box-holder { margin: 5px; } scrolledwindow { border: none; }brisk-menu-0.6.0/data/dash/styling.css000066400000000000000000000015741352323743400176410ustar00rootroot00000000000000.brisk-button-vertical { padding: 0px; margin: 0px; } .brisk-button { padding: 0px; margin: 0px; } .brisk-dash { background-color: alpha(@theme_bg_color, 0.95); } .brisk-dash .dash-category-button { border: 1px solid transparent; background-color: transparent; font-weight: bold; } .brisk-dash .dash-category-button:checked { background-color: mix(@theme_bg_color, #000000, 0.2); border: 1px solid alpha(@theme_fg_color, 0.1); } .brisk-dash .dash-category-button:hover { background-color: mix(@theme_bg_color, #000000, 0.2); border: 1px solid alpha(#000, 0.2); } .brisk-dash .header { background-color: mix(@theme_bg_color, #000000, 0.1); border-bottom: 1px solid mix(@theme_base_color, #000000, 0.35); box-shadow: 0px 1px 1px alpha(@theme_fg_color, 0.04); } .brisk-dash .header .section-box-holder { margin: 5px; } scrolledwindow { border: none; }brisk-menu-0.6.0/data/meson.build000066400000000000000000000036751352323743400166650ustar00rootroot00000000000000# We'll generate resources in this build directory, so we'll need the include path data_include = include_directories('.') # Sort our our resources (causes meson to look for "glib-2.0" dependency) brisk_resources = gnome.compile_resources( 'brisk-resources', 'brisk.gresource.xml', source_dir: meson.current_source_dir(), c_name: 'brisk_resources', extra_args: [ '--manual-register', ], ) # libsaver_glue provides dbus code for the MATE screensaver libsaver_glue = gnome.gdbus_codegen( 'libsaver-glue', 'org.mate.ScreenSaver.xml', interface_prefix : 'org.mate.', namespace : 'Mate', ) # libsession_glue provides dbus code for the MATE/GNOME session libsession_glue = gnome.gdbus_codegen( 'libsession-glue', 'org.gnome.SessionManager.xml', interface_prefix : 'org.gnome.', namespace : 'Gnome', ) icons = [ 'brisk_system-log-out-symbolic.svg', ] # Install our icons iconsdir = join_paths(path_datadir, 'icons', 'hicolor', 'scalable', 'actions') install_data( icons, install_dir: iconsdir, ) # Prepare to configure our files. data_conf = configuration_data() data_conf.set('LIBEXECDIR', path_libexecdir) # Write applet configuration appletdir = join_paths(path_datadir, 'mate-panel', 'applets') configure_file( input: 'com.solus_project.brisk.BriskMenu.mate-panel-applet.in', output: 'com.solus_project.brisk.BriskMenu.mate-panel-applet', configuration: data_conf, install_dir: appletdir, ) # Write d-bus activation unit for standalone Brisk Menu servicedir = join_paths(path_datadir, 'dbus-1', 'services') configure_file( input: 'org.mate.panel.applet.BriskMenuFactory.service.in', output: 'org.mate.panel.applet.BriskMenuFactory.service', configuration: data_conf, install_dir: servicedir, ) # Install gschemas gschemadir = join_paths(path_datadir, 'glib-2.0', 'schemas') install_data( 'com.solus-project.brisk-menu.gschema.xml', install_dir: gschemadir, ) brisk-menu-0.6.0/data/org.gnome.SessionManager.xml000066400000000000000000000010031352323743400220340ustar00rootroot00000000000000 brisk-menu-0.6.0/data/org.mate.ScreenSaver.xml000066400000000000000000000005351352323743400211700ustar00rootroot00000000000000 brisk-menu-0.6.0/data/org.mate.panel.applet.BriskMenuFactory.service.in000066400000000000000000000001311352323743400260160ustar00rootroot00000000000000[D-BUS Service] Name=org.mate.panel.applet.BriskMenuFactory Exec=@LIBEXECDIR@/brisk-menu brisk-menu-0.6.0/meson.build000066400000000000000000000071011352323743400157400ustar00rootroot00000000000000project( 'brisk-menu', ['c'], version: '0.6.0', license: [ 'GPL-2.0', 'CC-BY-SA-4.0', ], default_options: [ 'c_std=c11', 'prefix=/usr', 'sysconfdir=/etc', ], ) am_cflags = [ '-fstack-protector', '-Wall', '-pedantic', '-Wstrict-prototypes', '-Wundef', '-fno-common', '-Werror-implicit-function-declaration', '-Wformat', '-Wformat-security', '-Werror=format-security', '-Wconversion', '-Wunused-variable', '-Wunreachable-code', '-W', '-D_FORTIFY_SOURCE=2', ] gtk_version_flags = [ '-DGDK_VERSION_MAX_ALLOWED=GDK_VERSION_3_18', '-DGDK_VERSION_MIN_REQUIRED=GDK_VERSION_3_18', '-DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_44', '-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_44', ] # Add our main flags add_global_arguments(am_cflags, language: 'c') # Handle glib schemas & icons meson.add_install_script('meson_post_install.sh') # Ensure we limit the GTK version used! add_global_arguments(gtk_version_flags, language: 'c') # Need GNOME module throughout Brisk build gnome = import('gnome') # Required minimum versions gtk_min_version = '>= 3.18.0' mate_min_version = '>= 1.21.0' glib_min_version = '>= 2.44.0' # GTK/UI deps dep_gtk3 = dependency('gtk+-3.0', version: gtk_min_version) dep_gio_unix = dependency('gio-unix-2.0', version: glib_min_version) dep_gdkx11 = dependency('gdk-x11-3.0', version: gtk_min_version) dep_x11 = dependency('x11') # MATE dependencies dep_mate_applet = dependency('libmatepanelapplet-4.0', version: mate_min_version) dep_mate_menu = dependency('libmate-menu', version: mate_min_version) # Misc dep_notify = dependency('libnotify', version: '>= 0.7.0') # Get configuration bits together path_prefix = get_option('prefix') path_sysconfdir = join_paths(path_prefix, get_option('sysconfdir')) path_datadir = join_paths(path_prefix, get_option('datadir')) path_libexecdir = join_paths(path_prefix, get_option('libexecdir')) path_bindir = join_paths(path_prefix, get_option('bindir')) path_localedir = join_paths(path_prefix, get_option('localedir')) # Sort out config.h now cdata = configuration_data() # General options.. cdata.set_quoted('PACKAGE_VERSION', meson.project_version()) cdata.set_quoted('PACKAGE_URL', 'https://getsol.us') # Ensure locales will work cdata.set_quoted('GETTEXT_PACKAGE', meson.project_name()) cdata.set_quoted('MATELOCALEDIR', path_localedir) cdata.set('ENABLE_NLS', '1') # Write config.h now config_h = configure_file( configuration: cdata, output: 'config.h', ) config_h_dir = include_directories('.') # We're going to allow controlling this as either building a .so variant of # Brisk Menu, or as a standalone binary # # For now just limit to stand-alone.. with_applet_type = 'stand-alone' # Handle data before anything else subdir('data') # Now go build the source subdir('src') # And now translations subdir('po') report = [ ' Build configuration:', ' ====================', '', ' prefix: @0@'.format(path_prefix), ' datadir: @0@'.format(path_datadir), ' sysconfdir: @0@'.format(path_sysconfdir), ' bindir: @0@'.format(path_bindir), ' libexecdir: @0@'.format(path_libexecdir), '', ' MATE Applet:', ' ============', '', ' applet type: @0@'.format(with_applet_type), ] # Output some stuff to validate the build config message('\n\n\n' + '\n'.join(report) + '\n\n') brisk-menu-0.6.0/meson_post_install.sh000077500000000000000000000010261352323743400200510ustar00rootroot00000000000000#!/bin/sh # Borrowed from: https://github.com/vinszent/gnome-twitch/blob/master/meson_post_install.sh # <3 TingPing ^^ if [ -z $DESTDIR ]; then SYSTEM=$(uname) if [ "${SYSTEM}" = "FreeBSD" ]; then PREFIX=${MESON_INSTALL_PREFIX:-/usr/local} else PREFIX=${MESON_INSTALL_PREFIX:-/usr} fi echo 'Compiling GSchema' glib-compile-schemas "$PREFIX/share/glib-2.0/schemas" echo 'Updating desktop database' update-desktop-database -q echo 'Updating icon cache' gtk-update-icon-cache -q -t -f "$PREFIX/share/icons/hicolor" fi brisk-menu-0.6.0/po/000077500000000000000000000000001352323743400142155ustar00rootroot00000000000000brisk-menu-0.6.0/po/LINGUAS000066400000000000000000000003201352323743400152350ustar00rootroot00000000000000ar ca_ES ca da_DK de el en_GB es_419 es_AR es_ES es_MX es es_US eu fi fr_FR gl_ES he hr_HR hu id_ID it_IT it ja kk lt ne_NP nl_BE nl_NL pl pt_BR pt_PT ro_RO ru si sk sr_RS@latin sr_RS sv_SE tr uk zh_CN zh_TW brisk-menu-0.6.0/po/POTFILES.in000066400000000000000000000006551352323743400160000ustar00rootroot00000000000000src/backend/all-items/all-backend.c src/backend/all-items/all-section.c src/backend/apps/apps-backend.c src/backend/favourites/favourites-backend.c src/backend/favourites/favourites-desktop.c src/backend/favourites/favourites-section.c src/frontend/classic/category-button.c src/frontend/classic/classic-window.c src/frontend/dash/category-button.c src/frontend/dash/dash-window.c src/mate-applet/applet.c src/mate-applet/main.c brisk-menu-0.6.0/po/ar.po000066400000000000000000000035741352323743400151700ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2017-05-19 00:31+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: MUHAAB SHAAM , 2017\n" "Language-Team: Arabic (https://www.transifex.com/solus-project/teams/68407/ar/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: ar\n" "Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5;\n" #: ../src/mate-applet/applet.c:78 msgid "_Edit Menus" msgstr "تحرير القوائم" #: ../src/mate-applet/applet.c:368 msgid "Menu" msgstr "القائمة" #: ../src/mate-applet/applet.c:504 msgid "Brisk Menu Launcher" msgstr "تنشيط قائمة مطلق التطبيقات" #: ../src/frontend/category-button.c:115 msgid "All" msgstr "الكل" #: ../src/frontend/menu-session.c:144 msgid "End the current session" msgstr "إنهاء الجلسة الحالية" #: ../src/frontend/menu-session.c:155 msgid "Lock the screen" msgstr "قفل الشاشة" #: ../src/frontend/menu-session.c:166 msgid "Turn off the device" msgstr "أوقف تشغيل الجهاز" #. Translators: This is the text shown in the "search box" with no content #: ../src/frontend/menu-window.c:140 msgid "Type to search" msgstr "اكتب للبحث" #. Translators: This message is shown when the search results are empty #: ../src/frontend/menu-window.c:202 msgid "Sorry, no items found" msgstr "عذراً، لم يتم العثور على أية عناصر" #: ../src/backend/apps/apps-backend.c:111 msgid "Applications" msgstr "تطبيقات" brisk-menu-0.6.0/po/brisk-menu.pot000066400000000000000000000047701352323743400170250ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the brisk-menu package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: brisk-menu\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-02-08 11:02+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: src/backend/all-items/all-backend.c:52 msgid "All Items" msgstr "" #: src/backend/all-items/all-section.c:102 #: src/frontend/classic/category-button.c:115 #: src/frontend/dash/category-button.c:111 msgid "All" msgstr "" #: src/backend/apps/apps-backend.c:116 msgid "Applications" msgstr "" #: src/backend/favourites/favourites-backend.c:56 #: src/backend/favourites/favourites-section.c:148 msgid "Favourites" msgstr "" #: src/backend/favourites/favourites-backend.c:74 msgid "Unpin from favourites menu" msgstr "" #: src/backend/favourites/favourites-backend.c:78 msgid "Pin to favourites menu" msgstr "" #: src/backend/favourites/favourites-desktop.c:222 msgid "Unpin from desktop" msgstr "" #: src/backend/favourites/favourites-desktop.c:227 msgid "Pin to desktop" msgstr "" #: src/frontend/classic/classic-window.c:71 msgid "Classic" msgstr "" #. Translators: This is the text shown in the "search box" with no content #: src/frontend/classic/classic-window.c:395 #: src/frontend/dash/dash-window.c:358 msgid "Type to search" msgstr "" #. Translators: This message is shown when the search results are empty #: src/frontend/classic/classic-window.c:453 msgid "Sorry, no items found" msgstr "" #: src/frontend/classic/classic-window.c:659 msgid "End the current session" msgstr "" #: src/frontend/classic/classic-window.c:670 msgid "Lock the screen" msgstr "" #: src/frontend/classic/classic-window.c:681 msgid "Turn off the device" msgstr "" #: src/frontend/dash/dash-window.c:63 msgid "Dash" msgstr "" #: src/mate-applet/applet.c:248 msgid "Menu" msgstr "" #: src/mate-applet/applet.c:337 msgid "Failed to launch menu editor" msgstr "" #: src/mate-applet/applet.c:338 msgid "Please install 'menulibre' or 'mozo' to edit menus" msgstr "" #: src/mate-applet/main.c:52 msgid "_Edit Menus" msgstr "" #: src/mate-applet/main.c:60 msgid "_About" msgstr "" #: src/mate-applet/main.c:92 src/mate-applet/main.c:104 msgid "Brisk Menu Launcher" msgstr "" brisk-menu-0.6.0/po/ca.po000066400000000000000000000032751352323743400151470ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2017-05-19 00:31+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Davidmp , 2017\n" "Language-Team: Catalan (https://www.transifex.com/solus-project/teams/68407/ca/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: ca\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #: ../src/mate-applet/applet.c:78 msgid "_Edit Menus" msgstr "_Edita els menús." #: ../src/mate-applet/applet.c:368 msgid "Menu" msgstr "Menú" #: ../src/mate-applet/applet.c:504 msgid "Brisk Menu Launcher" msgstr "Llançador del menú Brisk" #: ../src/frontend/category-button.c:115 msgid "All" msgstr "Tot" #: ../src/frontend/menu-session.c:144 msgid "End the current session" msgstr "Acaba la sessió actual." #: ../src/frontend/menu-session.c:155 msgid "Lock the screen" msgstr "Bloqueja la pantalla." #: ../src/frontend/menu-session.c:166 msgid "Turn off the device" msgstr "Atura el dispositiu." #. Translators: This is the text shown in the "search box" with no content #: ../src/frontend/menu-window.c:140 msgid "Type to search" msgstr "Teclegeu per cercar..." #. Translators: This message is shown when the search results are empty #: ../src/frontend/menu-window.c:202 msgid "Sorry, no items found" msgstr "Perdoneu, no s'ha trobat res." #: ../src/backend/apps/apps-backend.c:111 msgid "Applications" msgstr "Aplicacions" brisk-menu-0.6.0/po/ca_ES.po000066400000000000000000000033041352323743400155270ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2017-05-19 00:31+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Davidmp , 2017\n" "Language-Team: Catalan (Spain) (https://www.transifex.com/solus-project/teams/68407/ca_ES/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: ca_ES\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #: ../src/mate-applet/applet.c:78 msgid "_Edit Menus" msgstr "_Edita els menús" #: ../src/mate-applet/applet.c:368 msgid "Menu" msgstr "Menú" #: ../src/mate-applet/applet.c:504 msgid "Brisk Menu Launcher" msgstr "Llançador del menú Brisk" #: ../src/frontend/category-button.c:115 msgid "All" msgstr "Tot" #: ../src/frontend/menu-session.c:144 msgid "End the current session" msgstr "Acaba la sessió actual" #: ../src/frontend/menu-session.c:155 msgid "Lock the screen" msgstr "Bloqueja la pantalla" #: ../src/frontend/menu-session.c:166 msgid "Turn off the device" msgstr "Atura el dispositiu" #. Translators: This is the text shown in the "search box" with no content #: ../src/frontend/menu-window.c:140 msgid "Type to search" msgstr "Teclegeu per cercar" #. Translators: This message is shown when the search results are empty #: ../src/frontend/menu-window.c:202 msgid "Sorry, no items found" msgstr "Perdoneu, no s'ha trobat res." #: ../src/backend/apps/apps-backend.c:111 msgid "Applications" msgstr "Aplicacions" brisk-menu-0.6.0/po/da_DK.po000066400000000000000000000032451352323743400155230ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2017-05-19 00:31+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Yavuznie , 2017\n" "Language-Team: Danish (Denmark) (https://www.transifex.com/solus-project/teams/68407/da_DK/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: da_DK\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #: ../src/mate-applet/applet.c:78 msgid "_Edit Menus" msgstr "_Rediger Menu'er" #: ../src/mate-applet/applet.c:368 msgid "Menu" msgstr "Menu" #: ../src/mate-applet/applet.c:504 msgid "Brisk Menu Launcher" msgstr "Brisk Start Menu" #: ../src/frontend/category-button.c:115 msgid "All" msgstr "Alle" #: ../src/frontend/menu-session.c:144 msgid "End the current session" msgstr "Afslut nuværende session" #: ../src/frontend/menu-session.c:155 msgid "Lock the screen" msgstr "Lås skærmen" #: ../src/frontend/menu-session.c:166 msgid "Turn off the device" msgstr "Sluk maskinen" #. Translators: This is the text shown in the "search box" with no content #: ../src/frontend/menu-window.c:140 msgid "Type to search" msgstr "Skriv for at søge" #. Translators: This message is shown when the search results are empty #: ../src/frontend/menu-window.c:202 msgid "Sorry, no items found" msgstr "Desværre, intet fundet" #: ../src/backend/apps/apps-backend.c:111 msgid "Applications" msgstr "Applikationer" brisk-menu-0.6.0/po/de.po000066400000000000000000000032661352323743400151540ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2017-05-19 00:31+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Peter Hansen , 2017\n" "Language-Team: German (https://www.transifex.com/solus-project/teams/68407/de/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: de\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #: ../src/mate-applet/applet.c:78 msgid "_Edit Menus" msgstr "_Bearbeiten des Menüs" #: ../src/mate-applet/applet.c:368 msgid "Menu" msgstr "Menü" #: ../src/mate-applet/applet.c:504 msgid "Brisk Menu Launcher" msgstr "Brisk Menü Starter" #: ../src/frontend/category-button.c:115 msgid "All" msgstr "Alles" #: ../src/frontend/menu-session.c:144 msgid "End the current session" msgstr "Abmelden" #: ../src/frontend/menu-session.c:155 msgid "Lock the screen" msgstr "Bildschirm sperren" #: ../src/frontend/menu-session.c:166 msgid "Turn off the device" msgstr "Herunterfahren" #. Translators: This is the text shown in the "search box" with no content #: ../src/frontend/menu-window.c:140 msgid "Type to search" msgstr "Tippen um zu suchen" #. Translators: This message is shown when the search results are empty #: ../src/frontend/menu-window.c:202 msgid "Sorry, no items found" msgstr "Es wurden leider keine Ergebnisse gefunden" #: ../src/backend/apps/apps-backend.c:111 msgid "Applications" msgstr "Anwendungen" brisk-menu-0.6.0/po/el.po000066400000000000000000000035421352323743400151610ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2017-05-19 00:31+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Antreas Skoufi , 2017\n" "Language-Team: Greek (https://www.transifex.com/solus-project/teams/68407/el/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: el\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #: ../src/mate-applet/applet.c:78 msgid "_Edit Menus" msgstr "_Τροποποιήση Μενού" #: ../src/mate-applet/applet.c:368 msgid "Menu" msgstr "Μενού" #: ../src/mate-applet/applet.c:504 msgid "Brisk Menu Launcher" msgstr "Εκκινητής Brisk Menu" #: ../src/frontend/category-button.c:115 msgid "All" msgstr "Όλα" #: ../src/frontend/menu-session.c:144 msgid "End the current session" msgstr "Τερματισμός τρέχουσας συνεδρίας" #: ../src/frontend/menu-session.c:155 msgid "Lock the screen" msgstr "Κλείδωμα οθόνης" #: ../src/frontend/menu-session.c:166 msgid "Turn off the device" msgstr "Απενεργοποίηση συσκευής" #. Translators: This is the text shown in the "search box" with no content #: ../src/frontend/menu-window.c:140 msgid "Type to search" msgstr "Τύπος αναζητησής" #. Translators: This message is shown when the search results are empty #: ../src/frontend/menu-window.c:202 msgid "Sorry, no items found" msgstr "Συγνώμη, δεν βρέθηκε κάποιο αντικείμενο" #: ../src/backend/apps/apps-backend.c:111 msgid "Applications" msgstr "Εφαρμογές" brisk-menu-0.6.0/po/en_GB.po000066400000000000000000000022441352323743400155310ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2017-01-21 04:56+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Ikey Doherty , 2017\n" "Language-Team: English (United Kingdom) (https://www.transifex.com/solus-project/teams/68407/en_GB/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: en_GB\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #. Now add the label #: ../src/applet.c:177 msgid "Menu" msgstr "Menu" #: ../src/applet.c:265 msgid "Brisk Menu Launcher" msgstr "Brisk Menu Launcher" #: ../src/category-button.c:130 msgid "All" msgstr "All" #: ../src/menu-session.c:144 msgid "End the current session" msgstr "End the current session" #: ../src/menu-session.c:155 msgid "Lock the screen" msgstr "Lock the screen" #: ../src/menu-session.c:166 msgid "Turn off the device" msgstr "Turn off the device" brisk-menu-0.6.0/po/es.po000066400000000000000000000033131352323743400151640ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2017-05-19 00:31+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Robert Orzanna , 2017\n" "Language-Team: Spanish (https://www.transifex.com/solus-project/teams/68407/es/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: es\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #: ../src/mate-applet/applet.c:78 msgid "_Edit Menus" msgstr "_Editar menús" #: ../src/mate-applet/applet.c:368 msgid "Menu" msgstr "Menú" #: ../src/mate-applet/applet.c:504 msgid "Brisk Menu Launcher" msgstr "Lanzador de Menú Brisk" #: ../src/frontend/category-button.c:115 msgid "All" msgstr "Todo" #: ../src/frontend/menu-session.c:144 msgid "End the current session" msgstr "Finalizar la sesión actual" #: ../src/frontend/menu-session.c:155 msgid "Lock the screen" msgstr "Bloquear la pantalla" #: ../src/frontend/menu-session.c:166 msgid "Turn off the device" msgstr "Apagar el dispositivo" #. Translators: This is the text shown in the "search box" with no content #: ../src/frontend/menu-window.c:140 msgid "Type to search" msgstr "Escribe para buscar" #. Translators: This message is shown when the search results are empty #: ../src/frontend/menu-window.c:202 msgid "Sorry, no items found" msgstr "Lo sentimos, no se encontraron artículos" #: ../src/backend/apps/apps-backend.c:111 msgid "Applications" msgstr "Aplicaciones" brisk-menu-0.6.0/po/es_419.po000066400000000000000000000022751352323743400155670ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2017-01-21 04:56+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Josué Vargas , 2017\n" "Language-Team: Spanish (Latin America) (https://www.transifex.com/solus-project/teams/68407/es_419/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: es_419\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #. Now add the label #: ../src/applet.c:177 msgid "Menu" msgstr "Menú" #: ../src/applet.c:265 msgid "Brisk Menu Launcher" msgstr "Lanzador del Menú Brisk" #: ../src/category-button.c:130 msgid "All" msgstr "Todo" #: ../src/menu-session.c:144 msgid "End the current session" msgstr "Terminar la sesión actual" #: ../src/menu-session.c:155 msgid "Lock the screen" msgstr "Bloquear la pantalla" #: ../src/menu-session.c:166 msgid "Turn off the device" msgstr "Apagar el dispositivo" brisk-menu-0.6.0/po/es_AR.po000066400000000000000000000033571352323743400155560ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2017-05-19 00:31+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Federico Damián Schonborn , 2017\n" "Language-Team: Spanish (Argentina) (https://www.transifex.com/solus-project/teams/68407/es_AR/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: es_AR\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #: ../src/mate-applet/applet.c:78 msgid "_Edit Menus" msgstr "Editar menús" #: ../src/mate-applet/applet.c:368 msgid "Menu" msgstr "Menú" #: ../src/mate-applet/applet.c:504 msgid "Brisk Menu Launcher" msgstr "Lanzador del Menú Brisk" #: ../src/frontend/category-button.c:115 msgid "All" msgstr "Todo" #: ../src/frontend/menu-session.c:144 msgid "End the current session" msgstr "Terminar la sesión actual" #: ../src/frontend/menu-session.c:155 msgid "Lock the screen" msgstr "Bloquear la pantalla" #: ../src/frontend/menu-session.c:166 msgid "Turn off the device" msgstr "Apagar el dispositivo" #. Translators: This is the text shown in the "search box" with no content #: ../src/frontend/menu-window.c:140 msgid "Type to search" msgstr "Escribe para buscar" #. Translators: This message is shown when the search results are empty #: ../src/frontend/menu-window.c:202 msgid "Sorry, no items found" msgstr "Disculpa, no encontré ningún item" #: ../src/backend/apps/apps-backend.c:111 msgid "Applications" msgstr "Aplicaciones" brisk-menu-0.6.0/po/es_ES.po000066400000000000000000000033371352323743400155610ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2017-05-19 00:31+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Francisco Rangel , 2017\n" "Language-Team: Spanish (Spain) (https://www.transifex.com/solus-project/teams/68407/es_ES/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: es_ES\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #: ../src/mate-applet/applet.c:78 msgid "_Edit Menus" msgstr "_Menús de Edición" #: ../src/mate-applet/applet.c:368 msgid "Menu" msgstr "Menú" #: ../src/mate-applet/applet.c:504 msgid "Brisk Menu Launcher" msgstr "Lanzador del Menú Brisk" #: ../src/frontend/category-button.c:115 msgid "All" msgstr "Todo" #: ../src/frontend/menu-session.c:144 msgid "End the current session" msgstr "Terminar la sesión actual" #: ../src/frontend/menu-session.c:155 msgid "Lock the screen" msgstr "Bloquear la pantalla" #: ../src/frontend/menu-session.c:166 msgid "Turn off the device" msgstr "Apagar el dispositivo" #. Translators: This is the text shown in the "search box" with no content #: ../src/frontend/menu-window.c:140 msgid "Type to search" msgstr "Escriba para buscar" #. Translators: This message is shown when the search results are empty #: ../src/frontend/menu-window.c:202 msgid "Sorry, no items found" msgstr "Lo siento, no se encuentra el archivo" #: ../src/backend/apps/apps-backend.c:111 msgid "Applications" msgstr "Aplicaciones" brisk-menu-0.6.0/po/es_MX.po000066400000000000000000000033151352323743400155720ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2017-05-19 00:31+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Alex Aralvarado , 2017\n" "Language-Team: Spanish (Mexico) (https://www.transifex.com/solus-project/teams/68407/es_MX/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: es_MX\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #: ../src/mate-applet/applet.c:78 msgid "_Edit Menus" msgstr "_Editar menús" #: ../src/mate-applet/applet.c:368 msgid "Menu" msgstr "Menú" #: ../src/mate-applet/applet.c:504 msgid "Brisk Menu Launcher" msgstr "Lanzador del menú Brisk" #: ../src/frontend/category-button.c:115 msgid "All" msgstr "Todo" #: ../src/frontend/menu-session.c:144 msgid "End the current session" msgstr "Terminar la sesión actual" #: ../src/frontend/menu-session.c:155 msgid "Lock the screen" msgstr "Bloquear la pantalla" #: ../src/frontend/menu-session.c:166 msgid "Turn off the device" msgstr "Apagar el dispositivo" #. Translators: This is the text shown in the "search box" with no content #: ../src/frontend/menu-window.c:140 msgid "Type to search" msgstr "Escriba para buscar" #. Translators: This message is shown when the search results are empty #: ../src/frontend/menu-window.c:202 msgid "Sorry, no items found" msgstr "Perdón, no se encontró" #: ../src/backend/apps/apps-backend.c:111 msgid "Applications" msgstr "Aplicaciones" brisk-menu-0.6.0/po/es_US.po000066400000000000000000000022731352323743400155770ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2017-01-21 04:56+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Josué Vargas , 2017\n" "Language-Team: Spanish (United States) (https://www.transifex.com/solus-project/teams/68407/es_US/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: es_US\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #. Now add the label #: ../src/applet.c:177 msgid "Menu" msgstr "Menú" #: ../src/applet.c:265 msgid "Brisk Menu Launcher" msgstr "Lanzador del Menú Brisk" #: ../src/category-button.c:130 msgid "All" msgstr "Todo" #: ../src/menu-session.c:144 msgid "End the current session" msgstr "Terminar la sesión actual" #: ../src/menu-session.c:155 msgid "Lock the screen" msgstr "Bloquear la pantalla" #: ../src/menu-session.c:166 msgid "Turn off the device" msgstr "Apagar el dispositivo" brisk-menu-0.6.0/po/eu.po000066400000000000000000000032451352323743400151720ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2017-05-19 00:31+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: John Smith , 2017\n" "Language-Team: Basque (https://www.transifex.com/solus-project/teams/68407/eu/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: eu\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #: ../src/mate-applet/applet.c:78 msgid "_Edit Menus" msgstr "_Menuak Editatu" #: ../src/mate-applet/applet.c:368 msgid "Menu" msgstr "Menua" #: ../src/mate-applet/applet.c:504 msgid "Brisk Menu Launcher" msgstr "Brisk Menu Abiarazlea" #: ../src/frontend/category-button.c:115 msgid "All" msgstr "Dena" #: ../src/frontend/menu-session.c:144 msgid "End the current session" msgstr "Amaitu uneko saioa" #: ../src/frontend/menu-session.c:155 msgid "Lock the screen" msgstr "Blokeatu pantaila" #: ../src/frontend/menu-session.c:166 msgid "Turn off the device" msgstr "Gailua itzali" #. Translators: This is the text shown in the "search box" with no content #: ../src/frontend/menu-window.c:140 msgid "Type to search" msgstr "Idatzi bilatzeko" #. Translators: This message is shown when the search results are empty #: ../src/frontend/menu-window.c:202 msgid "Sorry, no items found" msgstr "Ez da elementurik aurkitu" #: ../src/backend/apps/apps-backend.c:111 msgid "Applications" msgstr "Aplikazioak" brisk-menu-0.6.0/po/fi.po000066400000000000000000000033051352323743400151540ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2017-05-19 00:31+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Puppelimies , 2017\n" "Language-Team: Finnish (https://www.transifex.com/solus-project/teams/68407/fi/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: fi\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #: ../src/mate-applet/applet.c:78 msgid "_Edit Menus" msgstr "_Muokkaa valikoita" #: ../src/mate-applet/applet.c:368 msgid "Menu" msgstr "Valikko" #: ../src/mate-applet/applet.c:504 msgid "Brisk Menu Launcher" msgstr "Brisk Valikko Käynnistysohjelma" #: ../src/frontend/category-button.c:115 msgid "All" msgstr "Kaikki" #: ../src/frontend/menu-session.c:144 msgid "End the current session" msgstr "Lopeta nykyinen sessio" #: ../src/frontend/menu-session.c:155 msgid "Lock the screen" msgstr "Lukitse näyttö" #: ../src/frontend/menu-session.c:166 msgid "Turn off the device" msgstr "Sulje laite" #. Translators: This is the text shown in the "search box" with no content #: ../src/frontend/menu-window.c:140 msgid "Type to search" msgstr "Kirjoita etsiäksesi" #. Translators: This message is shown when the search results are empty #: ../src/frontend/menu-window.c:202 msgid "Sorry, no items found" msgstr "Valitettavasti kohteita ei löytynyt" #: ../src/backend/apps/apps-backend.c:111 msgid "Applications" msgstr "Sovellukset" brisk-menu-0.6.0/po/fr_FR.po000066400000000000000000000033201352323743400155510ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2017-05-19 00:31+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: fredbezies , 2017\n" "Language-Team: French (France) (https://www.transifex.com/solus-project/teams/68407/fr_FR/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: fr_FR\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" #: ../src/mate-applet/applet.c:78 msgid "_Edit Menus" msgstr "_Éditer les Menus" #: ../src/mate-applet/applet.c:368 msgid "Menu" msgstr "Menu" #: ../src/mate-applet/applet.c:504 msgid "Brisk Menu Launcher" msgstr "Lanceur de Menu Brisk" #: ../src/frontend/category-button.c:115 msgid "All" msgstr "Tout" #: ../src/frontend/menu-session.c:144 msgid "End the current session" msgstr "Fermer la session en cours" #: ../src/frontend/menu-session.c:155 msgid "Lock the screen" msgstr "Verrouiller l'écran" #: ../src/frontend/menu-session.c:166 msgid "Turn off the device" msgstr "Éteindre l'appareil" #. Translators: This is the text shown in the "search box" with no content #: ../src/frontend/menu-window.c:140 msgid "Type to search" msgstr "Taper pour rechercher" #. Translators: This message is shown when the search results are empty #: ../src/frontend/menu-window.c:202 msgid "Sorry, no items found" msgstr "Désolé, aucun élément trouvé" #: ../src/backend/apps/apps-backend.c:111 msgid "Applications" msgstr "Applications" brisk-menu-0.6.0/po/gl_ES.po000066400000000000000000000033211352323743400155450ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2017-05-19 00:31+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Juan Banga , 2017\n" "Language-Team: Galician (Spain) (https://www.transifex.com/solus-project/teams/68407/gl_ES/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: gl_ES\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #: ../src/mate-applet/applet.c:78 msgid "_Edit Menus" msgstr "_Editar menús" #: ../src/mate-applet/applet.c:368 msgid "Menu" msgstr "Menú" #: ../src/mate-applet/applet.c:504 msgid "Brisk Menu Launcher" msgstr "Lanzador do Menú Brisk" #: ../src/frontend/category-button.c:115 msgid "All" msgstr "Todos" #: ../src/frontend/menu-session.c:144 msgid "End the current session" msgstr "Fin da sesión actual" #: ../src/frontend/menu-session.c:155 msgid "Lock the screen" msgstr "Bloquear a pantalla" #: ../src/frontend/menu-session.c:166 msgid "Turn off the device" msgstr "Apagar o equipo" #. Translators: This is the text shown in the "search box" with no content #: ../src/frontend/menu-window.c:140 msgid "Type to search" msgstr "Escribe para buscar" #. Translators: This message is shown when the search results are empty #: ../src/frontend/menu-window.c:202 msgid "Sorry, no items found" msgstr "Sentímolo, non se atoparon resultados" #: ../src/backend/apps/apps-backend.c:111 msgid "Applications" msgstr "Aplicacións" brisk-menu-0.6.0/po/he.po000066400000000000000000000033541352323743400151560ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2017-05-19 00:31+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Moriel Ever , 2017\n" "Language-Team: Hebrew (https://www.transifex.com/solus-project/teams/68407/he/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: he\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #: ../src/mate-applet/applet.c:78 msgid "_Edit Menus" msgstr "_ערוך תפריטים" #: ../src/mate-applet/applet.c:368 msgid "Menu" msgstr "תפריט" #: ../src/mate-applet/applet.c:504 msgid "Brisk Menu Launcher" msgstr "מפעיל תפריט בריסק" #: ../src/frontend/category-button.c:115 msgid "All" msgstr "הכל" #: ../src/frontend/menu-session.c:144 msgid "End the current session" msgstr "סיים את הפעילות" #: ../src/frontend/menu-session.c:155 msgid "Lock the screen" msgstr "נעל את המסך" #: ../src/frontend/menu-session.c:166 msgid "Turn off the device" msgstr "כבה את המכשיר" #. Translators: This is the text shown in the "search box" with no content #: ../src/frontend/menu-window.c:140 msgid "Type to search" msgstr "הקלד כדי לחפש" #. Translators: This message is shown when the search results are empty #: ../src/frontend/menu-window.c:202 msgid "Sorry, no items found" msgstr "מחילה, לא נמצא אף פריט" #: ../src/backend/apps/apps-backend.c:111 msgid "Applications" msgstr "יישומים" brisk-menu-0.6.0/po/hr_HR.po000066400000000000000000000034261352323743400155640ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2017-05-19 00:31+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Ivica Kolić , 2017\n" "Language-Team: Croatian (Croatia) (https://www.transifex.com/solus-project/teams/68407/hr_HR/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: hr_HR\n" "Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" #: ../src/mate-applet/applet.c:78 msgid "_Edit Menus" msgstr "_Uredi izbornike" #: ../src/mate-applet/applet.c:368 msgid "Menu" msgstr "Izbornik" #: ../src/mate-applet/applet.c:504 msgid "Brisk Menu Launcher" msgstr "Pokretač Brisk izbornika" #: ../src/frontend/category-button.c:115 msgid "All" msgstr "Sve" #: ../src/frontend/menu-session.c:144 msgid "End the current session" msgstr "Završi trenutnu sesiju" #: ../src/frontend/menu-session.c:155 msgid "Lock the screen" msgstr "Zaključaj zaslon" #: ../src/frontend/menu-session.c:166 msgid "Turn off the device" msgstr "Isključi uređaj" #. Translators: This is the text shown in the "search box" with no content #: ../src/frontend/menu-window.c:140 msgid "Type to search" msgstr "Tipkajte za pretragu" #. Translators: This message is shown when the search results are empty #: ../src/frontend/menu-window.c:202 msgid "Sorry, no items found" msgstr "Oprostite, nijedna stavka nije nađena" #: ../src/backend/apps/apps-backend.c:111 msgid "Applications" msgstr "Programi" brisk-menu-0.6.0/po/hu.po000066400000000000000000000033641352323743400151770ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2017-05-19 00:31+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Béla Ádám Kungazda , 2017\n" "Language-Team: Hungarian (https://www.transifex.com/solus-project/teams/68407/hu/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: hu\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #: ../src/mate-applet/applet.c:78 msgid "_Edit Menus" msgstr "_Menü Szerkesztése" #: ../src/mate-applet/applet.c:368 msgid "Menu" msgstr "Menü" #: ../src/mate-applet/applet.c:504 msgid "Brisk Menu Launcher" msgstr "Brisk Menü indító" #: ../src/frontend/category-button.c:115 msgid "All" msgstr "Összes" #: ../src/frontend/menu-session.c:144 msgid "End the current session" msgstr "Jelenlegi munkamenet befejezése" #: ../src/frontend/menu-session.c:155 msgid "Lock the screen" msgstr "Képernyő zárolása" #: ../src/frontend/menu-session.c:166 msgid "Turn off the device" msgstr "Az eszköz kikapcsolása" #. Translators: This is the text shown in the "search box" with no content #: ../src/frontend/menu-window.c:140 msgid "Type to search" msgstr "Írj be szöveget a kereséshez" #. Translators: This message is shown when the search results are empty #: ../src/frontend/menu-window.c:202 msgid "Sorry, no items found" msgstr "Sajnáljuk, nem találtunk megfelelő elemet" #: ../src/backend/apps/apps-backend.c:111 msgid "Applications" msgstr "Alkalmazások" brisk-menu-0.6.0/po/id_ID.po000066400000000000000000000032661352323743400155340ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2017-05-19 00:31+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Afrizal Yusren , 2017\n" "Language-Team: Indonesian (Indonesia) (https://www.transifex.com/solus-project/teams/68407/id_ID/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: id_ID\n" "Plural-Forms: nplurals=1; plural=0;\n" #: ../src/mate-applet/applet.c:78 msgid "_Edit Menus" msgstr "_Sunting Menu" #: ../src/mate-applet/applet.c:368 msgid "Menu" msgstr "Menu" #: ../src/mate-applet/applet.c:504 msgid "Brisk Menu Launcher" msgstr "Peluncur Brisk Menu" #: ../src/frontend/category-button.c:115 msgid "All" msgstr "Semua" #: ../src/frontend/menu-session.c:144 msgid "End the current session" msgstr "Akhiri sesi saat ini" #: ../src/frontend/menu-session.c:155 msgid "Lock the screen" msgstr "Kunci layar" #: ../src/frontend/menu-session.c:166 msgid "Turn off the device" msgstr "Matikan perangkat" #. Translators: This is the text shown in the "search box" with no content #: ../src/frontend/menu-window.c:140 msgid "Type to search" msgstr "Ketik untuk mencari" #. Translators: This message is shown when the search results are empty #: ../src/frontend/menu-window.c:202 msgid "Sorry, no items found" msgstr "Maaf, tidak ada item yang ditemukan" #: ../src/backend/apps/apps-backend.c:111 msgid "Applications" msgstr "Aplikasi" brisk-menu-0.6.0/po/it.po000066400000000000000000000032741352323743400151770ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2017-05-19 00:31+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Leonardo , 2017\n" "Language-Team: Italian (https://www.transifex.com/solus-project/teams/68407/it/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: it\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #: ../src/mate-applet/applet.c:78 msgid "_Edit Menus" msgstr "_Modifica Menu" #: ../src/mate-applet/applet.c:368 msgid "Menu" msgstr "Menu" #: ../src/mate-applet/applet.c:504 msgid "Brisk Menu Launcher" msgstr "Brisk Menu Launcher" #: ../src/frontend/category-button.c:115 msgid "All" msgstr "Tutto" #: ../src/frontend/menu-session.c:144 msgid "End the current session" msgstr "Termina la sessione corrente" #: ../src/frontend/menu-session.c:155 msgid "Lock the screen" msgstr "Blocca lo schermo" #: ../src/frontend/menu-session.c:166 msgid "Turn off the device" msgstr "Spegni il dispositivo" #. Translators: This is the text shown in the "search box" with no content #: ../src/frontend/menu-window.c:140 msgid "Type to search" msgstr "Digita per cercare" #. Translators: This message is shown when the search results are empty #: ../src/frontend/menu-window.c:202 msgid "Sorry, no items found" msgstr "Spiacente, nessun elemento trovato" #: ../src/backend/apps/apps-backend.c:111 msgid "Applications" msgstr "Applicazioni" brisk-menu-0.6.0/po/it_IT.po000066400000000000000000000033221352323743400155650ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2017-05-19 00:31+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Andrea Cassioli , 2017\n" "Language-Team: Italian (Italy) (https://www.transifex.com/solus-project/teams/68407/it_IT/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: it_IT\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #: ../src/mate-applet/applet.c:78 msgid "_Edit Menus" msgstr "_Modifica Menu" #: ../src/mate-applet/applet.c:368 msgid "Menu" msgstr "Menu" #: ../src/mate-applet/applet.c:504 msgid "Brisk Menu Launcher" msgstr "Brisk Menu Launcher" #: ../src/frontend/category-button.c:115 msgid "All" msgstr "Tutto" #: ../src/frontend/menu-session.c:144 msgid "End the current session" msgstr "Termina la sessione corrente" #: ../src/frontend/menu-session.c:155 msgid "Lock the screen" msgstr "Blocca lo schermo" #: ../src/frontend/menu-session.c:166 msgid "Turn off the device" msgstr "Spegni il dispositivo" #. Translators: This is the text shown in the "search box" with no content #: ../src/frontend/menu-window.c:140 msgid "Type to search" msgstr "Digita per cercare" #. Translators: This message is shown when the search results are empty #: ../src/frontend/menu-window.c:202 msgid "Sorry, no items found" msgstr "Spiacente, nessun elemento trovato" #: ../src/backend/apps/apps-backend.c:111 msgid "Applications" msgstr "Applicazioni" brisk-menu-0.6.0/po/ja.po000066400000000000000000000023411352323743400151470ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2017-01-21 04:56+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: ふうせん Fu-sen. | BALLOON a.k.a. Fu-sen. , 2017\n" "Language-Team: Japanese (https://www.transifex.com/solus-project/teams/68407/ja/)\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" #. Now add the label #: ../src/applet.c:177 msgid "Menu" msgstr "メニュー" #: ../src/applet.c:265 msgid "Brisk Menu Launcher" msgstr "Brisk Menu ランチャー" #: ../src/category-button.c:130 msgid "All" msgstr "すべて" #: ../src/menu-session.c:144 msgid "End the current session" msgstr "現在のセッションを終了" #: ../src/menu-session.c:155 msgid "Lock the screen" msgstr "スクリーンをロック" #: ../src/menu-session.c:166 msgid "Turn off the device" msgstr "デバイスをオフにする" brisk-menu-0.6.0/po/kk.po000066400000000000000000000025611352323743400151660ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2017-05-16 23:14+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Baurzhan Muftakhidinov , 2017\n" "Language-Team: Kazakh (https://www.transifex.com/solus-project/teams/68407/kk/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: kk\n" "Plural-Forms: nplurals=1; plural=0;\n" #: ../src/mate-applet/applet.c:76 msgid "_Edit Menus" msgstr "Мәзірлерді түз_ету" #: ../src/mate-applet/applet.c:359 msgid "Menu" msgstr "Мәзір" #: ../src/mate-applet/applet.c:455 msgid "Brisk Menu Launcher" msgstr "Brisk мәзір жөнелткіші" #: ../src/frontend/category-button.c:130 msgid "All" msgstr "Барлығы" #: ../src/frontend/menu-session.c:144 msgid "End the current session" msgstr "Ағымдағы сессияны анықтау" #: ../src/frontend/menu-session.c:155 msgid "Lock the screen" msgstr "Экранды блоктау" #: ../src/frontend/menu-session.c:166 msgid "Turn off the device" msgstr "Құрылғыны сөндіру" brisk-menu-0.6.0/po/lt.po000066400000000000000000000033711352323743400152000ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2017-05-19 00:31+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Moo , 2017\n" "Language-Team: Lithuanian (https://www.transifex.com/solus-project/teams/68407/lt/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: lt\n" "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n%100<10 || n%100>=20) ? 1 : 2);\n" #: ../src/mate-applet/applet.c:78 msgid "_Edit Menus" msgstr "_Taisyti meniu" #: ../src/mate-applet/applet.c:368 msgid "Menu" msgstr "Meniu" #: ../src/mate-applet/applet.c:504 msgid "Brisk Menu Launcher" msgstr "Brisk meniu leistukas" #: ../src/frontend/category-button.c:115 msgid "All" msgstr "Visos" #: ../src/frontend/menu-session.c:144 msgid "End the current session" msgstr "Užbaigti esamą seansą" #: ../src/frontend/menu-session.c:155 msgid "Lock the screen" msgstr "Užrakinti ekraną" #: ../src/frontend/menu-session.c:166 msgid "Turn off the device" msgstr "Išjungti įrenginį" #. Translators: This is the text shown in the "search box" with no content #: ../src/frontend/menu-window.c:140 msgid "Type to search" msgstr "Rašykite, norėdami ieškoti" #. Translators: This message is shown when the search results are empty #: ../src/frontend/menu-window.c:202 msgid "Sorry, no items found" msgstr "Atleiskite, nerasta jokių elementų" #: ../src/backend/apps/apps-backend.c:111 msgid "Applications" msgstr "Programos" brisk-menu-0.6.0/po/meson.build000066400000000000000000000001121352323743400163510ustar00rootroot00000000000000i18n = import('i18n') i18n.gettext(meson.project_name(), preset: 'glib') brisk-menu-0.6.0/po/ne_NP.po000066400000000000000000000025011352323743400155520ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2017-01-21 04:56+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Diwaker Ghimire , 2017\n" "Language-Team: Nepali (Nepal) (https://www.transifex.com/solus-project/teams/68407/ne_NP/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: ne_NP\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #. Now add the label #: ../src/applet.c:177 msgid "Menu" msgstr "मेनु" #: ../src/applet.c:265 msgid "Brisk Menu Launcher" msgstr "बि्स्क मेनु लन्चर" #: ../src/category-button.c:130 msgid "All" msgstr "सबै" #: ../src/menu-session.c:144 msgid "End the current session" msgstr "वर्तमान सत्र अन्त गर्नुहोस्" #: ../src/menu-session.c:155 msgid "Lock the screen" msgstr "स्क्रिन लक गर्नुहोस्" #: ../src/menu-session.c:166 msgid "Turn off the device" msgstr "डिभाइस अफ गर्नुहोस्" brisk-menu-0.6.0/po/nl_BE.po000066400000000000000000000032341352323743400155360ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2017-05-19 00:31+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Geert Verheyde , 2017\n" "Language-Team: Dutch (Belgium) (https://www.transifex.com/solus-project/teams/68407/nl_BE/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: nl_BE\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #: ../src/mate-applet/applet.c:78 msgid "_Edit Menus" msgstr "_Menus aanpassen" #: ../src/mate-applet/applet.c:368 msgid "Menu" msgstr "Menu" #: ../src/mate-applet/applet.c:504 msgid "Brisk Menu Launcher" msgstr "Brisk Menu Starter" #: ../src/frontend/category-button.c:115 msgid "All" msgstr "Alles" #: ../src/frontend/menu-session.c:144 msgid "End the current session" msgstr "Afmelden" #: ../src/frontend/menu-session.c:155 msgid "Lock the screen" msgstr "Vergrendelen" #: ../src/frontend/menu-session.c:166 msgid "Turn off the device" msgstr "Afsluiten" #. Translators: This is the text shown in the "search box" with no content #: ../src/frontend/menu-window.c:140 msgid "Type to search" msgstr "Wat zoek je?" #. Translators: This message is shown when the search results are empty #: ../src/frontend/menu-window.c:202 msgid "Sorry, no items found" msgstr "Helaas, niets gevonden" #: ../src/backend/apps/apps-backend.c:111 msgid "Applications" msgstr "Toepassingen" brisk-menu-0.6.0/po/nl_NL.po000066400000000000000000000032331352323743400155600ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2017-05-19 00:31+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Thimo dZ , 2017\n" "Language-Team: Dutch (Netherlands) (https://www.transifex.com/solus-project/teams/68407/nl_NL/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: nl_NL\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #: ../src/mate-applet/applet.c:78 msgid "_Edit Menus" msgstr "_Menu's aanpassen" #: ../src/mate-applet/applet.c:368 msgid "Menu" msgstr "Menu" #: ../src/mate-applet/applet.c:504 msgid "Brisk Menu Launcher" msgstr "Brisk Menu Starter" #: ../src/frontend/category-button.c:115 msgid "All" msgstr "Alles" #: ../src/frontend/menu-session.c:144 msgid "End the current session" msgstr "Afmelden" #: ../src/frontend/menu-session.c:155 msgid "Lock the screen" msgstr "Vergrendelen" #: ../src/frontend/menu-session.c:166 msgid "Turn off the device" msgstr "Afsluiten" #. Translators: This is the text shown in the "search box" with no content #: ../src/frontend/menu-window.c:140 msgid "Type to search" msgstr "Wat zoek je?" #. Translators: This message is shown when the search results are empty #: ../src/frontend/menu-window.c:202 msgid "Sorry, no items found" msgstr "Helaas, niets gevonden" #: ../src/backend/apps/apps-backend.c:111 msgid "Applications" msgstr "Toepassingen" brisk-menu-0.6.0/po/pl.po000066400000000000000000000035121352323743400151710ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2017-05-19 00:31+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: m4sk1n , 2017\n" "Language-Team: Polish (https://www.transifex.com/solus-project/teams/68407/pl/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: pl\n" "Plural-Forms: nplurals=4; plural=(n==1 ? 0 : (n%10>=2 && n%10<=4) && (n%100<12 || n%100>14) ? 1 : n!=1 && (n%10>=0 && n%10<=1) || (n%10>=5 && n%10<=9) || (n%100>=12 && n%100<=14) ? 2 : 3);\n" #: ../src/mate-applet/applet.c:78 msgid "_Edit Menus" msgstr "_Edytuj menu" #: ../src/mate-applet/applet.c:368 msgid "Menu" msgstr "Menu" #: ../src/mate-applet/applet.c:504 msgid "Brisk Menu Launcher" msgstr "Brisk Menu Launcher" #: ../src/frontend/category-button.c:115 msgid "All" msgstr "Wszystkie" #: ../src/frontend/menu-session.c:144 msgid "End the current session" msgstr "Zakończ obecną sesję" #: ../src/frontend/menu-session.c:155 msgid "Lock the screen" msgstr "Zablokuj ekran" #: ../src/frontend/menu-session.c:166 msgid "Turn off the device" msgstr "Wyłącz urządzenie" #. Translators: This is the text shown in the "search box" with no content #: ../src/frontend/menu-window.c:140 msgid "Type to search" msgstr "Wprowadź tekst, aby wyszukać" #. Translators: This message is shown when the search results are empty #: ../src/frontend/menu-window.c:202 msgid "Sorry, no items found" msgstr "Nie znaleziono pasujących wyników" #: ../src/backend/apps/apps-backend.c:111 msgid "Applications" msgstr "Aplikacje" brisk-menu-0.6.0/po/pt_BR.po000066400000000000000000000033101352323743400155600ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2017-05-19 00:31+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Fábio Nogueira , 2017\n" "Language-Team: Portuguese (Brazil) (https://www.transifex.com/solus-project/teams/68407/pt_BR/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: pt_BR\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" #: ../src/mate-applet/applet.c:78 msgid "_Edit Menus" msgstr "_Editar menus" #: ../src/mate-applet/applet.c:368 msgid "Menu" msgstr "Menu" #: ../src/mate-applet/applet.c:504 msgid "Brisk Menu Launcher" msgstr "Lançador Brisk" #: ../src/frontend/category-button.c:115 msgid "All" msgstr "Tudo" #: ../src/frontend/menu-session.c:144 msgid "End the current session" msgstr "Encerrar a sessão atual" #: ../src/frontend/menu-session.c:155 msgid "Lock the screen" msgstr "Bloquear a tela" #: ../src/frontend/menu-session.c:166 msgid "Turn off the device" msgstr "Desligar o dispositivo" #. Translators: This is the text shown in the "search box" with no content #: ../src/frontend/menu-window.c:140 msgid "Type to search" msgstr "Digite para procurar" #. Translators: This message is shown when the search results are empty #: ../src/frontend/menu-window.c:202 msgid "Sorry, no items found" msgstr "Desculpe, nenhum item encontrado" #: ../src/backend/apps/apps-backend.c:111 msgid "Applications" msgstr "Aplicações" brisk-menu-0.6.0/po/pt_PT.po000066400000000000000000000033331352323743400156050ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2017-05-19 00:31+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: António Ribeiro , 2017\n" "Language-Team: Portuguese (Portugal) (https://www.transifex.com/solus-project/teams/68407/pt_PT/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: pt_PT\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #: ../src/mate-applet/applet.c:78 msgid "_Edit Menus" msgstr "_Editar Menus" #: ../src/mate-applet/applet.c:368 msgid "Menu" msgstr "Menu" #: ../src/mate-applet/applet.c:504 msgid "Brisk Menu Launcher" msgstr "Lançandor de Menu Brisk" #: ../src/frontend/category-button.c:115 msgid "All" msgstr "Tudo" #: ../src/frontend/menu-session.c:144 msgid "End the current session" msgstr "Fechar a sessão atual" #: ../src/frontend/menu-session.c:155 msgid "Lock the screen" msgstr "Bloquear o ecrã" #: ../src/frontend/menu-session.c:166 msgid "Turn off the device" msgstr "Desligar o dispositivo" #. Translators: This is the text shown in the "search box" with no content #: ../src/frontend/menu-window.c:140 msgid "Type to search" msgstr "Escreva para pesquisar" #. Translators: This message is shown when the search results are empty #: ../src/frontend/menu-window.c:202 msgid "Sorry, no items found" msgstr "Desculpe, nenhum item encontrado" #: ../src/backend/apps/apps-backend.c:111 msgid "Applications" msgstr "Aplicações" brisk-menu-0.6.0/po/ro_RO.po000066400000000000000000000033741352323743400156040ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2017-05-19 00:31+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Dexter Rufus , 2017\n" "Language-Team: Romanian (Romania) (https://www.transifex.com/solus-project/teams/68407/ro_RO/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: ro_RO\n" "Plural-Forms: nplurals=3; plural=(n==1?0:(((n%100>19)||((n%100==0)&&(n!=0)))?2:1));\n" #: ../src/mate-applet/applet.c:78 msgid "_Edit Menus" msgstr "_Editează meniuri" #: ../src/mate-applet/applet.c:368 msgid "Menu" msgstr "Meniu" #: ../src/mate-applet/applet.c:504 msgid "Brisk Menu Launcher" msgstr "Lansatorul de meniu Brisk" #: ../src/frontend/category-button.c:115 msgid "All" msgstr "Toate" #: ../src/frontend/menu-session.c:144 msgid "End the current session" msgstr "Închide sesiunea curentă" #: ../src/frontend/menu-session.c:155 msgid "Lock the screen" msgstr "Blocare ecran" #: ../src/frontend/menu-session.c:166 msgid "Turn off the device" msgstr "Oprire" #. Translators: This is the text shown in the "search box" with no content #: ../src/frontend/menu-window.c:140 msgid "Type to search" msgstr "Tastează pentru a căuta" #. Translators: This message is shown when the search results are empty #: ../src/frontend/menu-window.c:202 msgid "Sorry, no items found" msgstr "Îmi pare rău, nu s-au găsit obiecte" #: ../src/backend/apps/apps-backend.c:111 msgid "Applications" msgstr "Aplicații" brisk-menu-0.6.0/po/ru.po000066400000000000000000000036701352323743400152110ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2017-05-19 00:31+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Danila Avdoshkin , 2017\n" "Language-Team: Russian (https://www.transifex.com/solus-project/teams/68407/ru/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: ru\n" "Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n%100>=11 && n%100<=14)? 2 : 3);\n" #: ../src/mate-applet/applet.c:78 msgid "_Edit Menus" msgstr "_Редактировать меню" #: ../src/mate-applet/applet.c:368 msgid "Menu" msgstr "Меню" #: ../src/mate-applet/applet.c:504 msgid "Brisk Menu Launcher" msgstr "Лаунчер Brisk Menu" #: ../src/frontend/category-button.c:115 msgid "All" msgstr "Все" #: ../src/frontend/menu-session.c:144 msgid "End the current session" msgstr "Завершить текущий сеанс" #: ../src/frontend/menu-session.c:155 msgid "Lock the screen" msgstr "Заблокировать экран" #: ../src/frontend/menu-session.c:166 msgid "Turn off the device" msgstr "Выключить устройство" #. Translators: This is the text shown in the "search box" with no content #: ../src/frontend/menu-window.c:140 msgid "Type to search" msgstr "Введите запрос" #. Translators: This message is shown when the search results are empty #: ../src/frontend/menu-window.c:202 msgid "Sorry, no items found" msgstr "Ничего не найдено" #: ../src/backend/apps/apps-backend.c:111 msgid "Applications" msgstr "Приложения" brisk-menu-0.6.0/po/si.po000066400000000000000000000024701352323743400151730ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2017-01-21 04:56+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Thisara Kasun , 2017\n" "Language-Team: Sinhala (https://www.transifex.com/solus-project/teams/68407/si/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: si\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #. Now add the label #: ../src/applet.c:177 msgid "Menu" msgstr "මෙනුව​" #: ../src/applet.c:265 msgid "Brisk Menu Launcher" msgstr "බ්‍රිස්ක් මෙනුව​" #: ../src/category-button.c:130 msgid "All" msgstr "සියලු" #: ../src/menu-session.c:144 msgid "End the current session" msgstr "පවතින සැසිය නිමා කරන්න​" #: ../src/menu-session.c:155 msgid "Lock the screen" msgstr "තිරය අගුළු දමන්න​" #: ../src/menu-session.c:166 msgid "Turn off the device" msgstr "පරිගණකය විසන්ධි කරන්න​" brisk-menu-0.6.0/po/sk.po000066400000000000000000000033641352323743400152000ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2017-05-19 00:31+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Dušan Kazik , 2017\n" "Language-Team: Slovak (https://www.transifex.com/solus-project/teams/68407/sk/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: sk\n" "Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n" #: ../src/mate-applet/applet.c:78 msgid "_Edit Menus" msgstr "_Upraviť ponuky" #: ../src/mate-applet/applet.c:368 msgid "Menu" msgstr "Ponuka" #: ../src/mate-applet/applet.c:504 msgid "Brisk Menu Launcher" msgstr "Spúšťač ponuky Brisk" #: ../src/frontend/category-button.c:115 msgid "All" msgstr "Všetko" #: ../src/frontend/menu-session.c:144 msgid "End the current session" msgstr "Ukončiť aktuálnu reláciu" #: ../src/frontend/menu-session.c:155 msgid "Lock the screen" msgstr "Uzamknúť obrazovku" #: ../src/frontend/menu-session.c:166 msgid "Turn off the device" msgstr "Vypnúť zariadenie" #. Translators: This is the text shown in the "search box" with no content #: ../src/frontend/menu-window.c:140 msgid "Type to search" msgstr "Zadajte, čo sa má vyhľadať" #. Translators: This message is shown when the search results are empty #: ../src/frontend/menu-window.c:202 msgid "Sorry, no items found" msgstr "Prepáčte, nenašli sa žiadne položky" #: ../src/backend/apps/apps-backend.c:111 msgid "Applications" msgstr "Aplikácie" brisk-menu-0.6.0/po/sr_RS.po000066400000000000000000000036461352323743400156160ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2017-05-19 00:31+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Nikola Tatalović , 2017\n" "Language-Team: Serbian (Serbia) (https://www.transifex.com/solus-project/teams/68407/sr_RS/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: sr_RS\n" "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" #: ../src/mate-applet/applet.c:78 msgid "_Edit Menus" msgstr "_Уреди Меније" #: ../src/mate-applet/applet.c:368 msgid "Menu" msgstr "Мени" #: ../src/mate-applet/applet.c:504 msgid "Brisk Menu Launcher" msgstr "Бриск Мени Покретач" #: ../src/frontend/category-button.c:115 msgid "All" msgstr "Све" #: ../src/frontend/menu-session.c:144 msgid "End the current session" msgstr "Окончај тренутну сесију" #: ../src/frontend/menu-session.c:155 msgid "Lock the screen" msgstr "Закључај екран" #: ../src/frontend/menu-session.c:166 msgid "Turn off the device" msgstr "Искључи уређај" #. Translators: This is the text shown in the "search box" with no content #: ../src/frontend/menu-window.c:140 msgid "Type to search" msgstr "Упишите како бисте претражили" #. Translators: This message is shown when the search results are empty #: ../src/frontend/menu-window.c:202 msgid "Sorry, no items found" msgstr "Извините, ниједна ставка није нађена" #: ../src/backend/apps/apps-backend.c:111 msgid "Applications" msgstr "Програми" brisk-menu-0.6.0/po/sr_RS@latin.po000066400000000000000000000034631352323743400167430ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2017-05-19 00:31+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Nikola Tatalović , 2017\n" "Language-Team: Serbian (Latin) (Serbia) (https://www.transifex.com/solus-project/teams/68407/sr_RS%40latin/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: sr_RS@latin\n" "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" #: ../src/mate-applet/applet.c:78 msgid "_Edit Menus" msgstr "_Uredi Menije" #: ../src/mate-applet/applet.c:368 msgid "Menu" msgstr "Meni" #: ../src/mate-applet/applet.c:504 msgid "Brisk Menu Launcher" msgstr "Brisk Meni Pokretač" #: ../src/frontend/category-button.c:115 msgid "All" msgstr "Sve" #: ../src/frontend/menu-session.c:144 msgid "End the current session" msgstr "Okončaj trenutnu sesiju" #: ../src/frontend/menu-session.c:155 msgid "Lock the screen" msgstr "Zaključaj ekran" #: ../src/frontend/menu-session.c:166 msgid "Turn off the device" msgstr "Isključi uređaj" #. Translators: This is the text shown in the "search box" with no content #: ../src/frontend/menu-window.c:140 msgid "Type to search" msgstr "Upišite kako biste pretražili" #. Translators: This message is shown when the search results are empty #: ../src/frontend/menu-window.c:202 msgid "Sorry, no items found" msgstr "Izvinite, nijedna stavka nije nađena" #: ../src/backend/apps/apps-backend.c:111 msgid "Applications" msgstr "Programi" brisk-menu-0.6.0/po/sv_SE.po000066400000000000000000000033061352323743400155760ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2017-05-19 00:31+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Puppelimies , 2017\n" "Language-Team: Swedish (Sweden) (https://www.transifex.com/solus-project/teams/68407/sv_SE/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: sv_SE\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #: ../src/mate-applet/applet.c:78 msgid "_Edit Menus" msgstr "_Redigera menyer" #: ../src/mate-applet/applet.c:368 msgid "Menu" msgstr "Meny" #: ../src/mate-applet/applet.c:504 msgid "Brisk Menu Launcher" msgstr "Brisk Meny Startprogram" #: ../src/frontend/category-button.c:115 msgid "All" msgstr "Alla" #: ../src/frontend/menu-session.c:144 msgid "End the current session" msgstr "Avsluta pågående session" #: ../src/frontend/menu-session.c:155 msgid "Lock the screen" msgstr "Lås skärmen" #: ../src/frontend/menu-session.c:166 msgid "Turn off the device" msgstr "Stäng av enheten" #. Translators: This is the text shown in the "search box" with no content #: ../src/frontend/menu-window.c:140 msgid "Type to search" msgstr "Skriv för att söka" #. Translators: This message is shown when the search results are empty #: ../src/frontend/menu-window.c:202 msgid "Sorry, no items found" msgstr "Tyvärr, inga objekt hittades" #: ../src/backend/apps/apps-backend.c:111 msgid "Applications" msgstr "Applikationer" brisk-menu-0.6.0/po/tr.po000066400000000000000000000033111352323743400152000ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2017-05-19 00:31+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Egemen Metin Turan , 2017\n" "Language-Team: Turkish (https://www.transifex.com/solus-project/teams/68407/tr/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: tr\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" #: ../src/mate-applet/applet.c:78 msgid "_Edit Menus" msgstr "_Menüyü Düzenle" #: ../src/mate-applet/applet.c:368 msgid "Menu" msgstr "Menü" #: ../src/mate-applet/applet.c:504 msgid "Brisk Menu Launcher" msgstr "Brisk Menü Başlatıcısı" #: ../src/frontend/category-button.c:115 msgid "All" msgstr "Tümü" #: ../src/frontend/menu-session.c:144 msgid "End the current session" msgstr "Geçerli oturumu sonlandır" #: ../src/frontend/menu-session.c:155 msgid "Lock the screen" msgstr "Ekranı kilitle" #: ../src/frontend/menu-session.c:166 msgid "Turn off the device" msgstr "Cihazı kapat" #. Translators: This is the text shown in the "search box" with no content #: ../src/frontend/menu-window.c:140 msgid "Type to search" msgstr "Arama yapmak için yaz" #. Translators: This message is shown when the search results are empty #: ../src/frontend/menu-window.c:202 msgid "Sorry, no items found" msgstr "Üzgünüm, hiçbir öğe bulunamadı" #: ../src/backend/apps/apps-backend.c:111 msgid "Applications" msgstr "Uygulamalar" brisk-menu-0.6.0/po/uk.po000066400000000000000000000024441352323743400152000ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2017-01-21 04:56+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Vlad Denysenko , 2017\n" "Language-Team: Ukrainian (https://www.transifex.com/solus-project/teams/68407/uk/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: uk\n" "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" #. Now add the label #: ../src/applet.c:177 msgid "Menu" msgstr "Меню" #: ../src/applet.c:265 msgid "Brisk Menu Launcher" msgstr "Запускач Brisk Menu" #: ../src/category-button.c:130 msgid "All" msgstr "Усі" #: ../src/menu-session.c:144 msgid "End the current session" msgstr "Завершити поточний сеанс" #: ../src/menu-session.c:155 msgid "Lock the screen" msgstr "Заблокувати екран" #: ../src/menu-session.c:166 msgid "Turn off the device" msgstr "Вимкнути пристрій" brisk-menu-0.6.0/po/update_linguas.sh000077500000000000000000000002001352323743400175500ustar00rootroot00000000000000#!/bin/sh tx pull -a --minimum-perc=100 cd po rm LINGUAS for i in *.po ; do echo `echo $i|sed 's/.po$//'` >> LINGUAS done brisk-menu-0.6.0/po/zh_CN.po000066400000000000000000000032231352323743400155560ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2017-05-19 00:31+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Kevin Liu , 2017\n" "Language-Team: Chinese (China) (https://www.transifex.com/solus-project/teams/68407/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" #: ../src/mate-applet/applet.c:78 msgid "_Edit Menus" msgstr "编辑菜单" #: ../src/mate-applet/applet.c:368 msgid "Menu" msgstr "菜单" #: ../src/mate-applet/applet.c:504 msgid "Brisk Menu Launcher" msgstr "Brisk菜单启动器" #: ../src/frontend/category-button.c:115 msgid "All" msgstr "全部" #: ../src/frontend/menu-session.c:144 msgid "End the current session" msgstr "结束当前活动" #: ../src/frontend/menu-session.c:155 msgid "Lock the screen" msgstr "锁定屏幕" #: ../src/frontend/menu-session.c:166 msgid "Turn off the device" msgstr "关闭设备" #. Translators: This is the text shown in the "search box" with no content #: ../src/frontend/menu-window.c:140 msgid "Type to search" msgstr "搜索" #. Translators: This message is shown when the search results are empty #: ../src/frontend/menu-window.c:202 msgid "Sorry, no items found" msgstr "抱歉,没有找到该项目" #: ../src/backend/apps/apps-backend.c:111 msgid "Applications" msgstr "应用" brisk-menu-0.6.0/po/zh_TW.po000066400000000000000000000022241352323743400156100ustar00rootroot00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2017-01-21 04:56+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Cheng-Chia Tseng , 2017\n" "Language-Team: Chinese (Taiwan) (https://www.transifex.com/solus-project/teams/68407/zh_TW/)\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" #. Now add the label #: ../src/applet.c:177 msgid "Menu" msgstr "選單" #: ../src/applet.c:265 msgid "Brisk Menu Launcher" msgstr "Brisk 選單啟動器" #: ../src/category-button.c:130 msgid "All" msgstr "全部" #: ../src/menu-session.c:144 msgid "End the current session" msgstr "結束目前作業階段" #: ../src/menu-session.c:155 msgid "Lock the screen" msgstr "鎖定螢幕" #: ../src/menu-session.c:166 msgid "Turn off the device" msgstr "關閉裝置" brisk-menu-0.6.0/src/000077500000000000000000000000001352323743400143665ustar00rootroot00000000000000brisk-menu-0.6.0/src/backend/000077500000000000000000000000001352323743400157555ustar00rootroot00000000000000brisk-menu-0.6.0/src/backend/all-items/000077500000000000000000000000001352323743400176445ustar00rootroot00000000000000brisk-menu-0.6.0/src/backend/all-items/all-backend.c000066400000000000000000000061111352323743400221440ustar00rootroot00000000000000/* * This file is part of brisk-menu. * * Copyright © 2017-2019 Brisk Menu Developers * * 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 2 of the License, or * (at your option) any later version. */ #define _GNU_SOURCE #include "util.h" BRISK_BEGIN_PEDANTIC #include "all-backend.h" #include "all-section.h" #include BRISK_END_PEDANTIC struct _BriskAllItemsBackendClass { BriskBackendClass parent_class; }; /** * BriskAllItemsBackend implements support for .desktop files in Brisk */ struct _BriskAllItemsBackend { BriskBackend parent; }; G_DEFINE_TYPE(BriskAllItemsBackend, brisk_all_items_backend, BRISK_TYPE_BACKEND) static gboolean brisk_all_items_backend_load(BriskBackend *backend); /** * Tell the frontends what we are */ static unsigned int brisk_all_items_backend_get_flags(__brisk_unused__ BriskBackend *backend) { return BRISK_BACKEND_SOURCE; } static const gchar *brisk_all_items_backend_get_id(__brisk_unused__ BriskBackend *backend) { return "all-items"; } static const gchar *brisk_all_items_backend_get_display_name(__brisk_unused__ BriskBackend *backend) { return _("All Items"); } /** * brisk_all_items_backend_dispose: * * Clean up a BriskAllItemsBackend instance */ static void brisk_all_items_backend_dispose(GObject *obj) { G_OBJECT_CLASS(brisk_all_items_backend_parent_class)->dispose(obj); } /** * brisk_all_items_backend_class_init: * * Handle class initialisation */ static void brisk_all_items_backend_class_init(BriskAllItemsBackendClass *klazz) { GObjectClass *obj_class = G_OBJECT_CLASS(klazz); BriskBackendClass *b_class = BRISK_BACKEND_CLASS(klazz); /* Backend vtable hookup */ b_class->get_flags = brisk_all_items_backend_get_flags; b_class->get_id = brisk_all_items_backend_get_id; b_class->get_display_name = brisk_all_items_backend_get_display_name; b_class->load = brisk_all_items_backend_load; /* gobject vtable hookup */ obj_class->dispose = brisk_all_items_backend_dispose; } /** * brisk_all_items_backend_init: * * Handle construction of the BriskAllItemsBackend */ static void brisk_all_items_backend_init(__brisk_unused__ BriskAllItemsBackend *self) { } /** * brisk_all_items_backend_load: * * On load we just emit a new stock section item */ static gboolean brisk_all_items_backend_load(BriskBackend *backend) { brisk_backend_section_added(backend, brisk_all_items_section_new()); return TRUE; } /** * brisk_all_items_backend_new: * * Return a newly created BriskAllItemsBackend */ BriskBackend *brisk_all_items_backend_new(void) { return g_object_new(BRISK_TYPE_ALL_ITEMS_BACKEND, NULL); } /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 8 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=8 tabstop=8 expandtab: * :indentSize=8:tabSize=8:noTabs=true: */ brisk-menu-0.6.0/src/backend/all-items/all-backend.h000066400000000000000000000036161352323743400221600ustar00rootroot00000000000000/* * This file is part of brisk-menu. * * Copyright © 2017-2019 Brisk Menu Developers * * 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 2 of the License, or * (at your option) any later version. */ #pragma once #include "../backend.h" #include G_BEGIN_DECLS typedef struct _BriskAllItemsBackend BriskAllItemsBackend; typedef struct _BriskAllItemsBackendClass BriskAllItemsBackendClass; #define BRISK_TYPE_ALL_ITEMS_BACKEND brisk_all_items_backend_get_type() #define BRISK_ALL_ITEMS_BACKEND(o) \ (G_TYPE_CHECK_INSTANCE_CAST((o), BRISK_TYPE_ALL_ITEMS_BACKEND, BriskAllItemsBackend)) #define BRISK_IS_ALL_ITEMS_BACKEND(o) \ (G_TYPE_CHECK_INSTANCE_TYPE((o), BRISK_TYPE_ALL_ITEMS_BACKEND)) #define BRISK_ALL_ITEMS_BACKEND_CLASS(o) \ (G_TYPE_CHECK_CLASS_CAST((o), BRISK_TYPE_ALL_ITEMS_BACKEND, BriskAllItemsBackendClass)) #define BRISK_IS_ALL_ITEMS_BACKEND_CLASS(o) \ (G_TYPE_CHECK_CLASS_TYPE((o), BRISK_TYPE_ALL_ITEMS_BACKEND)) #define BRISK_ALL_ITEMS_BACKEND_GET_CLASS(o) \ (G_TYPE_INSTANCE_GET_CLASS((o), BRISK_TYPE_ALL_ITEMS_BACKEND, BriskAllItemsBackendClass)) GType brisk_all_items_backend_get_type(void); BriskBackend *brisk_all_items_backend_new(void); G_END_DECLS /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 8 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=8 tabstop=8 expandtab: * :indentSize=8:tabSize=8:noTabs=true: */ brisk-menu-0.6.0/src/backend/all-items/all-section.c000066400000000000000000000101241352323743400222200ustar00rootroot00000000000000/* * This file is part of brisk-menu. * * Copyright © 2017-2019 Brisk Menu Developers * * 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 2 of the License, or * (at your option) any later version. */ #define _GNU_SOURCE #include "util.h" BRISK_BEGIN_PEDANTIC #include "all-section.h" #include #include BRISK_END_PEDANTIC struct _BriskAllItemsSectionClass { BriskSectionClass parent_class; }; /** * BriskAllItemsSection is an incredibly simple backend that simple adds a single * section to the sidebar, and is allowed to display any item when the category * is active. * * It also serves as a great starting point for anyone wishing to implement their * own backends. */ struct _BriskAllItemsSection { BriskSection parent; GIcon *icon; /**icon); G_OBJECT_CLASS(brisk_all_items_section_parent_class)->dispose(obj); } /** * brisk_all_items_section_class_init: * * Handle class initialisation */ static void brisk_all_items_section_class_init(BriskAllItemsSectionClass *klazz) { BriskSectionClass *s_class = BRISK_SECTION_CLASS(klazz); GObjectClass *obj_class = G_OBJECT_CLASS(klazz); /* item vtable hookup */ s_class->get_id = brisk_all_items_section_get_id; s_class->get_name = brisk_all_items_section_get_name; s_class->get_icon = brisk_all_items_section_get_icon; s_class->get_backend_id = brisk_all_items_section_get_backend_id; s_class->can_show_item = brisk_all_items_section_can_show_item; obj_class->dispose = brisk_all_items_section_dispose; } /** * brisk_all_items_section_init: * * Handle construction of the BriskAllItemsSection. Does absolutely nothing * special outside of creating our icon. */ static void brisk_all_items_section_init(BriskAllItemsSection *self) { self->icon = g_themed_icon_new_with_default_fallbacks("starred"); } static const gchar *brisk_all_items_section_get_id(__brisk_unused__ BriskSection *section) { return "all-items:main"; } static const gchar *brisk_all_items_section_get_name(__brisk_unused__ BriskSection *section) { return _("All"); } static const GIcon *brisk_all_items_section_get_icon(BriskSection *section) { BriskAllItemsSection *self = BRISK_ALL_ITEMS_SECTION(section); return (const GIcon *)self->icon; } static const gchar *brisk_all_items_section_get_backend_id(__brisk_unused__ BriskSection *item) { return "all-items"; } /** * Being the magical "all" filter, we return TRUE for everything. * Cuz we can show them all. :3 */ static gboolean brisk_all_items_section_can_show_item(__brisk_unused__ BriskSection *section, __brisk_unused__ BriskItem *item) { return TRUE; } /** * brisk_all_items_section_new: * * Return a new BriskAllItemsSection */ BriskSection *brisk_all_items_section_new() { return g_object_new(BRISK_TYPE_ALL_ITEMS_SECTION, NULL); } /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 8 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=8 tabstop=8 expandtab: * :indentSize=8:tabSize=8:noTabs=true: */ brisk-menu-0.6.0/src/backend/all-items/all-section.h000066400000000000000000000036441352323743400222360ustar00rootroot00000000000000/* * This file is part of brisk-menu. * * Copyright © 2017-2019 Brisk Menu Developers * * 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 2 of the License, or * (at your option) any later version. */ #pragma once #include #include #include "../section.h" G_BEGIN_DECLS typedef struct _BriskAllItemsSection BriskAllItemsSection; typedef struct _BriskAllItemsSectionClass BriskAllItemsSectionClass; #define BRISK_TYPE_ALL_ITEMS_SECTION brisk_all_items_section_get_type() #define BRISK_ALL_ITEMS_SECTION(o) \ (G_TYPE_CHECK_INSTANCE_CAST((o), BRISK_TYPE_ALL_ITEMS_SECTION, BriskAllItemsSection)) #define BRISK_IS_ALL_ITEMS_SECTION(o) \ (G_TYPE_CHECK_INSTANCE_TYPE((o), BRISK_TYPE_ALL_ITEMS_SECTION)) #define BRISK_ALL_ITEMS_SECTION_CLASS(o) \ (G_TYPE_CHECK_CLASS_CAST((o), BRISK_TYPE_ALL_ITEMS_SECTION, BriskAllItemsSectionClass)) #define BRISK_IS_ALL_ITEMS_SECTION_CLASS(o) \ (G_TYPE_CHECK_CLASS_TYPE((o), BRISK_TYPE_ALL_ITEMS_SECTION)) #define BRISK_ALL_ITEMS_SECTION_GET_CLASS(o) \ (G_TYPE_INSTANCE_GET_CLASS((o), BRISK_TYPE_ALL_ITEMS_SECTION, BriskAllItemsSectionClass)) GType brisk_all_items_section_get_type(void); BriskSection *brisk_all_items_section_new(void); G_END_DECLS /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 8 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=8 tabstop=8 expandtab: * :indentSize=8:tabSize=8:noTabs=true: */ brisk-menu-0.6.0/src/backend/apps/000077500000000000000000000000001352323743400167205ustar00rootroot00000000000000brisk-menu-0.6.0/src/backend/apps/apps-backend.c000066400000000000000000000400431352323743400214150ustar00rootroot00000000000000/* * This file is part of brisk-menu. * * Copyright © 2017-2019 Brisk Menu Developers * * 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 2 of the License, or * (at your option) any later version. */ #define _GNU_SOURCE #include "util.h" BRISK_BEGIN_PEDANTIC #include "apps-backend.h" #include "apps-item.h" #include "apps-section.h" #include #include #define MATEMENU_I_KNOW_THIS_IS_UNSTABLE #include BRISK_END_PEDANTIC /** * Main application menu ID */ #define APPS_MENU_ID "mate-applications.menu" /** * Settings menu ID */ #define SETTINGS_MENU_ID "mate-settings.menu" /** * We'll perform reloads 2 seconds after we get the last change * notification */ #define BRISK_RELOAD_TIME 2000 struct _BriskAppsBackendClass { BriskBackendClass parent_class; }; /** * BriskAppsBackend implements support for .desktop files in Brisk */ struct _BriskAppsBackend { BriskBackend parent; GAppInfoMonitor *monitor; guint monitor_source_id; gboolean loaded; GSList *pending_sections; }; G_DEFINE_TYPE(BriskAppsBackend, brisk_apps_backend, BRISK_TYPE_BACKEND) typedef gchar *gstrv; DEF_AUTOFREE(gstrv, g_strfreev) DEF_AUTOFREE(GSimpleAction, g_object_unref) static gboolean brisk_apps_backend_load(BriskBackend *backend); static gboolean brisk_apps_backend_build_from_tree(BriskAppsBackend *self, const gchar *id); static void brisk_apps_backend_recurse_root(BriskAppsBackend *self, MateMenuTreeDirectory *directory, MateMenuTreeDirectory *root); static void brisk_apps_backend_changed(BriskAppsBackend *backend, gpointer v); static gboolean brisk_apps_backend_reload(BriskAppsBackend *backend); static void brisk_apps_backend_launch_action(GSimpleAction *action, GVariant *parameter, BriskBackend *backend); DEF_AUTOFREE(gchar, g_free) DEF_AUTOFREE(GSList, g_slist_free) DEF_AUTOFREE(MateMenuTreeDirectory, matemenu_tree_item_unref) DEF_AUTOFREE(MateMenuTreeEntry, matemenu_tree_item_unref) DEF_AUTOFREE(MateMenuTreeIter, matemenu_tree_iter_unref) DEF_AUTOFREE(MateMenuTree, g_object_unref) DEF_AUTOFREE(GDesktopAppInfo, g_object_unref) DEF_AUTOFREE(GError, g_error_free) /** * Due to a glib weirdness we must fully invalidate the monitor's cache * to force reload events to work again. */ static inline void brisk_apps_backend_reset_monitor(void) { g_list_free_full(g_app_info_get_all(), g_object_unref); } /** * Reset the pending sections */ static inline void brisk_apps_backend_reset_pending(BriskAppsBackend *self) { if (!self->pending_sections) { return; } /* We use floating references, don't unref them */ g_slist_free(self->pending_sections); self->pending_sections = NULL; } /** * Tell the frontends what we are */ static unsigned int brisk_apps_backend_get_flags(__brisk_unused__ BriskBackend *backend) { return BRISK_BACKEND_SOURCE; } static const gchar *brisk_apps_backend_get_id(__brisk_unused__ BriskBackend *backend) { return "apps"; } static const gchar *brisk_apps_backend_get_display_name(__brisk_unused__ BriskBackend *backend) { return _("Applications"); } static GMenu *brisk_apps_backend_get_item_actions(BriskBackend *backend, BriskItem *item, GActionGroup *group) { GMenu *ret = NULL; GDesktopAppInfo *info = NULL; ret = g_menu_new(); info = g_desktop_app_info_new(brisk_item_get_id(item)); const gchar *const *actions = g_desktop_app_info_list_actions(info); for (guint i = 0; i < g_strv_length((gstrv *)actions); i++) { autofree(gchar) *action_id = NULL; autofree(gchar) *menu_id = NULL; const gchar *action_name = NULL; autofree(GSimpleAction) *action = NULL; action_id = g_strdup_printf("apps.action-%d", i); menu_id = g_strdup_printf("brisk-context-items.%s", action_id); action_name = g_desktop_app_info_get_action_name(info, actions[i]); /* Make the action now */ action = g_simple_action_new(action_id, NULL); g_action_map_add_action(G_ACTION_MAP(group), G_ACTION(action)); g_object_set_data_full(G_OBJECT(action), "__aname", (gpointer)g_strdup(actions[i]), g_free); g_object_set_data_full(G_OBJECT(action), "__appinfo", (gpointer)info, g_object_unref); g_signal_connect(action, "activate", G_CALLBACK(brisk_apps_backend_launch_action), backend); /* whack it in the menu */ g_menu_append(ret, action_name, menu_id); } return ret; } /** * brisk_apps_backend_dispose: * * Clean up a BriskAppsBackend instance */ static void brisk_apps_backend_dispose(GObject *obj) { BriskAppsBackend *self = BRISK_APPS_BACKEND(obj); g_clear_object(&self->monitor); brisk_apps_backend_reset_pending(self); G_OBJECT_CLASS(brisk_apps_backend_parent_class)->dispose(obj); } /** * brisk_apps_backend_class_init: * * Handle class initialisation */ static void brisk_apps_backend_class_init(BriskAppsBackendClass *klazz) { GObjectClass *obj_class = G_OBJECT_CLASS(klazz); BriskBackendClass *b_class = BRISK_BACKEND_CLASS(klazz); /* Backend vtable hookup */ b_class->get_flags = brisk_apps_backend_get_flags; b_class->get_id = brisk_apps_backend_get_id; b_class->get_display_name = brisk_apps_backend_get_display_name; b_class->load = brisk_apps_backend_load; b_class->get_item_actions = brisk_apps_backend_get_item_actions; /* gobject vtable hookup */ obj_class->dispose = brisk_apps_backend_dispose; } /** * brisk_apps_backend_init: * * Handle construction of the BriskAppsBackend */ static void brisk_apps_backend_init(BriskAppsBackend *self) { self->monitor = g_app_info_monitor_get(); g_signal_connect_swapped(self->monitor, "changed", G_CALLBACK(brisk_apps_backend_changed), self); } /** * brisk_apps_backend_changed: * * The application availability has now changed due to some on disk alteration. * Schedule an update to rebuild the menus */ static void brisk_apps_backend_changed(BriskAppsBackend *self, __brisk_unused__ gpointer v) { /* Not interested until we're loaded. */ if (!self->loaded) { return; } /* Push the change back until the very last event, wait 2 seconds and process it */ if (self->monitor_source_id > 0) { self->monitor_source_id = 0; g_source_remove(self->monitor_source_id); } self->monitor_source_id = g_timeout_add_full(G_PRIORITY_LOW, BRISK_RELOAD_TIME, (GSourceFunc)brisk_apps_backend_reload, self, NULL); } /** * Alphabetically sort the section list once it has been populated */ static gint brisk_apps_backend_sort_section(gconstpointer a, gconstpointer b) { return g_ascii_strcasecmp(brisk_section_get_name((BriskSection *)a), brisk_section_get_name((BriskSection *)b)); } /** * * brisk_apps_backend_init_menus: * * Handle menu loading, also a handy idle callback function. */ static gboolean brisk_apps_backend_init_menus(BriskAppsBackend *self) { brisk_apps_backend_reset_pending(self); /* Now load them again */ if (!brisk_apps_backend_build_from_tree(self, APPS_MENU_ID)) { g_warning("Failed to load required apps menu id: %s", APPS_MENU_ID); } if (!brisk_apps_backend_build_from_tree(self, SETTINGS_MENU_ID)) { g_warning("Failed to load settings menu id: %s", SETTINGS_MENU_ID); } /* Sort before display */ self->pending_sections = g_slist_sort(self->pending_sections, brisk_apps_backend_sort_section); for (GSList *elem = self->pending_sections; elem; elem = elem->next) { BriskSection *section = elem->data; brisk_backend_section_added(BRISK_BACKEND(self), section); } brisk_apps_backend_reset_pending(self); /* Prevent further runs */ return G_SOURCE_REMOVE; } /** * brisk_apps_backend_reload: * * Timeout callback initiated from a changed event, in which we reset our * backend controller and re-init the menus once more. */ static gboolean brisk_apps_backend_reload(BriskAppsBackend *self) { if (self->monitor_source_id < 1) { return G_SOURCE_REMOVE; } /* First things first, reset everything we own */ brisk_backend_reset(BRISK_BACKEND(self)); brisk_apps_backend_init_menus(self); /* Reset ourselves for the next time */ self->monitor_source_id = 0; brisk_apps_backend_reset_monitor(); return G_SOURCE_REMOVE; } /** * brisk_apps_backend_launch_action: * * Launch a GDesktopAppInfo action. */ static void brisk_apps_backend_launch_action(GSimpleAction *action, __brisk_unused__ GVariant *parameter, BriskBackend *backend) { autofree(GDesktopAppInfo) *app_info = g_object_get_data(G_OBJECT(action), "__appinfo"); const gchar *action_name = g_object_get_data(G_OBJECT(action), "__aname"); g_assert(app_info != NULL); brisk_backend_hide_menu(backend); g_desktop_app_info_launch_action(app_info, action_name, NULL); } /** * brisk_apps_backend_load: * * Begin loading menu structures and fire off the first scheduled adds to the * menu. */ static gboolean brisk_apps_backend_load(BriskBackend *backend) { BriskAppsBackend *self = NULL; self = BRISK_APPS_BACKEND(backend); /* Unblock monitor */ self->loaded = TRUE; /* Load ourselves a bit later */ g_idle_add_full(G_PRIORITY_LOW, (GSourceFunc)brisk_apps_backend_init_menus, self, NULL); /* Allow the monitor to now work */ brisk_apps_backend_reset_monitor(); return TRUE; } /** * brisk_apps_backend_build_from_tree: * * Begin building content using the given tree ID, cleaning up once it's done. */ static gboolean brisk_apps_backend_build_from_tree(BriskAppsBackend *self, const gchar *menu_id) { autofree(MateMenuTree) *tree = NULL; autofree(MateMenuTreeDirectory) *dir = NULL; autofree(GError) *error = NULL; tree = matemenu_tree_new(menu_id, MATEMENU_TREE_FLAGS_NONE); if (!tree) { return FALSE; } if (!matemenu_tree_load_sync(tree, &error)) { g_message("Failed to load tree: %s", error->message); return FALSE; } dir = matemenu_tree_get_root_directory(tree); if (!dir) { return FALSE; } brisk_apps_backend_recurse_root(self, dir, dir); return TRUE; } /** * Return a section ID to help with matching. * * In all cases we only use the root level section name, as we forbid * nested sections */ static gchar *brisk_apps_backend_get_entry_section(MateMenuTreeDirectory *parent, MateMenuTreeEntry *entry) { autofree(gchar) *root_id = matemenu_tree_directory_make_path(parent, entry); gchar **split = g_strsplit(root_id, "/", 5); gchar *ret = g_strdup_printf("%s.mate-directory", split[1]); g_strfreev(split); return ret; } /** * brisk_apps_backend_recurse_root: * * Walk the directory and construct sections/items for every directory/entry * that we encounter. */ static void brisk_apps_backend_recurse_root(BriskAppsBackend *self, MateMenuTreeDirectory *directory, MateMenuTreeDirectory *root) { autofree(MateMenuTreeIter) *iter = NULL; MateMenuTreeItemType type; iter = matemenu_tree_directory_iter(directory); /* Iterate the root tree */ while ((type = matemenu_tree_iter_next(iter)) != MATEMENU_TREE_ITEM_INVALID) { switch (type) { case MATEMENU_TREE_ITEM_DIRECTORY: { autofree(MateMenuTreeDirectory) *dir = matemenu_tree_iter_get_directory(iter); autofree(MateMenuTreeDirectory) *parent = NULL; autofree(MateMenuTreeIter) *children = NULL; BriskSection *section = NULL; parent = matemenu_tree_directory_get_parent(dir); /* Nested menus basically only happen in mate-settings.menu */ if (parent != root) { goto recurse_root; } children = matemenu_tree_directory_iter(dir); /* Skip empty sections entirely */ if (matemenu_tree_iter_next(children) == MATEMENU_TREE_ITEM_INVALID) { continue; } /* If signal subscribers wish to keep it, they can ref it * We won't emit this until we're done building the section * list */ section = brisk_apps_section_new(dir); self->pending_sections = g_slist_append(self->pending_sections, section); recurse_root: /* Descend into the section */ brisk_apps_backend_recurse_root(self, dir, root); } break; case MATEMENU_TREE_ITEM_ENTRY: { autofree(MateMenuTreeEntry) *entry = matemenu_tree_iter_get_entry(iter); autofree(GDesktopAppInfo) *info = NULL; const gchar *desktop_file = NULL; BriskItem *app_item = NULL; autofree(gchar) *section_id = NULL; desktop_file = matemenu_tree_entry_get_desktop_file_path(entry); /* idk */ if (!desktop_file) { break; } section_id = brisk_apps_backend_get_entry_section(directory, entry); /* Must have a desktop file */ info = g_desktop_app_info_new_from_filename(desktop_file); if (!info) { break; } /* If signal subscribers wish to keep it, they can ref it */ app_item = brisk_apps_item_new(info, section_id); brisk_backend_item_added(BRISK_BACKEND(self), app_item); } break; default: break; } } } /** * brisk_apps_backend_new: * * Return a newly created BriskAppsBackend */ BriskBackend *brisk_apps_backend_new(void) { return g_object_new(BRISK_TYPE_APPS_BACKEND, NULL); } /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 8 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=8 tabstop=8 expandtab: * :indentSize=8:tabSize=8:noTabs=true: */ brisk-menu-0.6.0/src/backend/apps/apps-backend.h000066400000000000000000000032631352323743400214250ustar00rootroot00000000000000/* * This file is part of brisk-menu. * * Copyright © 2017-2019 Brisk Menu Developers * * 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 2 of the License, or * (at your option) any later version. */ #pragma once #include "../backend.h" #include G_BEGIN_DECLS typedef struct _BriskAppsBackend BriskAppsBackend; typedef struct _BriskAppsBackendClass BriskAppsBackendClass; #define BRISK_TYPE_APPS_BACKEND brisk_apps_backend_get_type() #define BRISK_APPS_BACKEND(o) \ (G_TYPE_CHECK_INSTANCE_CAST((o), BRISK_TYPE_APPS_BACKEND, BriskAppsBackend)) #define BRISK_IS_APPS_BACKEND(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), BRISK_TYPE_APPS_BACKEND)) #define BRISK_APPS_BACKEND_CLASS(o) \ (G_TYPE_CHECK_CLASS_CAST((o), BRISK_TYPE_APPS_BACKEND, BriskAppsBackendClass)) #define BRISK_IS_APPS_BACKEND_CLASS(o) (G_TYPE_CHECK_CLASS_TYPE((o), BRISK_TYPE_APPS_BACKEND)) #define BRISK_APPS_BACKEND_GET_CLASS(o) \ (G_TYPE_INSTANCE_GET_CLASS((o), BRISK_TYPE_APPS_BACKEND, BriskAppsBackendClass)) GType brisk_apps_backend_get_type(void); BriskBackend *brisk_apps_backend_new(void); G_END_DECLS /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 8 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=8 tabstop=8 expandtab: * :indentSize=8:tabSize=8:noTabs=true: */ brisk-menu-0.6.0/src/backend/apps/apps-item.c000066400000000000000000000227401352323743400207700ustar00rootroot00000000000000/* * This file is part of brisk-menu. * * Copyright © 2017-2019 Brisk Menu Developers * * 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 2 of the License, or * (at your option) any later version. */ #define _GNU_SOURCE #include "util.h" #include BRISK_BEGIN_PEDANTIC #include "apps-item.h" BRISK_END_PEDANTIC enum { PROP_INFO = 1, PROP_SECTION_ID, N_PROPS }; DEF_AUTOFREE(gchar, g_free) static GParamSpec *obj_properties[N_PROPS] = { NULL, }; struct _BriskAppsItemClass { BriskItemClass parent_class; }; /** * BriskAppsItem is a type of item for the Brisk menu which is backed by * a .desktop file */ struct _BriskAppsItem { BriskItem parent; GDesktopAppInfo *info; gchar *section_id; }; G_DEFINE_TYPE(BriskAppsItem, brisk_apps_item, BRISK_TYPE_ITEM) /** * Basic subclassing */ static const gchar *brisk_apps_item_get_id(BriskItem *item); static const gchar *brisk_apps_item_get_name(BriskItem *item); static const gchar *brisk_apps_item_get_display_name(BriskItem *item); static const gchar *brisk_apps_item_get_summary(BriskItem *item); static const GIcon *brisk_apps_item_get_icon(BriskItem *item); static const char *brisk_apps_item_get_backend_id(BriskItem *item); static gboolean brisk_apps_item_matches_search(BriskItem *item, gchar *term); static gboolean brisk_apps_item_launch(BriskItem *item, GAppLaunchContext *context); static gchar *brisk_apps_item_get_uri(BriskItem *item); static void brisk_apps_item_set_property(GObject *object, guint id, const GValue *value, GParamSpec *spec) { BriskAppsItem *self = BRISK_APPS_ITEM(object); switch (id) { case PROP_INFO: self->info = g_value_dup_object(value); break; case PROP_SECTION_ID: g_clear_pointer(&self->section_id, g_free); self->section_id = g_value_dup_string(value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, id, spec); break; } } static void brisk_apps_item_get_property(GObject *object, guint id, GValue *value, GParamSpec *spec) { BriskAppsItem *self = BRISK_APPS_ITEM(object); switch (id) { case PROP_INFO: g_value_set_pointer(value, self->info); break; case PROP_SECTION_ID: g_value_set_string(value, self->section_id); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, id, spec); break; } } /** * brisk_apps_item_dispose: * * Clean up a BriskAppsItem instance */ static void brisk_apps_item_dispose(GObject *obj) { BriskAppsItem *self = BRISK_APPS_ITEM(obj); g_clear_object(&self->info); g_clear_pointer(&self->section_id, g_free); G_OBJECT_CLASS(brisk_apps_item_parent_class)->dispose(obj); } /** * brisk_apps_item_class_init: * * Handle class initialisation */ static void brisk_apps_item_class_init(BriskAppsItemClass *klazz) { GObjectClass *obj_class = G_OBJECT_CLASS(klazz); BriskItemClass *i_class = BRISK_ITEM_CLASS(klazz); /* item vtable hookup */ i_class->get_id = brisk_apps_item_get_id; i_class->get_name = brisk_apps_item_get_name; i_class->get_display_name = brisk_apps_item_get_display_name; i_class->get_summary = brisk_apps_item_get_summary; i_class->get_icon = brisk_apps_item_get_icon; i_class->get_backend_id = brisk_apps_item_get_backend_id; i_class->matches_search = brisk_apps_item_matches_search; i_class->launch = brisk_apps_item_launch; i_class->get_uri = brisk_apps_item_get_uri; /* gobject vtable hookup */ obj_class->dispose = brisk_apps_item_dispose; obj_class->set_property = brisk_apps_item_set_property; obj_class->get_property = brisk_apps_item_get_property; obj_properties[PROP_INFO] = g_param_spec_object("info", "The GDesktopAppInfo", "Corresponding .desktop file", G_TYPE_DESKTOP_APP_INFO, G_PARAM_CONSTRUCT | G_PARAM_READWRITE); obj_properties[PROP_SECTION_ID] = g_param_spec_string("section-id", "The section ID", "Parent section ID", NULL, G_PARAM_CONSTRUCT | G_PARAM_READWRITE); g_object_class_install_properties(obj_class, N_PROPS, obj_properties); } /** * brisk_apps_item_init: * * Handle construction of the BriskAppsItem */ static void brisk_apps_item_init(__brisk_unused__ BriskAppsItem *self) { } static const gchar *brisk_apps_item_get_id(BriskItem *item) { BriskAppsItem *self = BRISK_APPS_ITEM(item); return g_app_info_get_id(G_APP_INFO(self->info)); } static const gchar *brisk_apps_item_get_name(BriskItem *item) { BriskAppsItem *self = BRISK_APPS_ITEM(item); return g_app_info_get_name(G_APP_INFO(self->info)); } static const gchar *brisk_apps_item_get_display_name(BriskItem *item) { BriskAppsItem *self = BRISK_APPS_ITEM(item); return g_app_info_get_display_name(G_APP_INFO(self->info)); } static const gchar *brisk_apps_item_get_summary(BriskItem *item) { BriskAppsItem *self = BRISK_APPS_ITEM(item); return g_app_info_get_description(G_APP_INFO(self->info)); } static const GIcon *brisk_apps_item_get_icon(BriskItem *item) { BriskAppsItem *self = BRISK_APPS_ITEM(item); return g_app_info_get_icon(G_APP_INFO(self->info)); } static const char *brisk_apps_item_get_backend_id(__brisk_unused__ BriskItem *item) { return "apps"; } __brisk_pure__ static gboolean brisk_apps_array_contains(const gchar **fields, size_t n_fields, const gchar *term) { for (size_t i = 0; i < n_fields; i++) { if (!fields[i]) { continue; } autofree(gchar) *contents = g_strstrip(g_ascii_strdown(fields[i], -1)); if (g_str_match_string(term, contents, TRUE)) { return TRUE; } if (strstr(contents, term)) { return TRUE; } } return FALSE; } /** * brisk_apps_item_matches_search: * * This function will handle filtering the selection based on the active search * term. It looks for the string within a number of the entry's fields, and will * hide them if they don't turn up. * * Note: This function uses g_str_match_string so that ASCII alternatives are * searched. This allows searching for text containing accents, etc, so that * the menu can be more useful in more locales. * * This could probably be improved in future to generate internal state to allow * the search itself to be sorted based on the results, with the "most similar" * appearing near the top. */ __brisk_pure__ static gboolean brisk_apps_item_matches_search(BriskItem *item, gchar *term) { BriskAppsItem *self = BRISK_APPS_ITEM(item); const gchar *fields[] = { g_app_info_get_display_name(G_APP_INFO(self->info)), g_app_info_get_description(G_APP_INFO(self->info)), g_app_info_get_name(G_APP_INFO(self->info)), g_app_info_get_executable(G_APP_INFO(self->info)), }; const gchar *const *keywords = g_desktop_app_info_get_keywords(self->info); if (brisk_apps_array_contains(fields, G_N_ELEMENTS(fields), term)) { return TRUE; } if (!keywords) { return FALSE; } return brisk_apps_array_contains((const gchar **)keywords, g_strv_length((gchar **)keywords), term); } /** * Not yet implemented */ static gboolean brisk_apps_item_launch(BriskItem *item, GAppLaunchContext *context) { BriskAppsItem *self = BRISK_APPS_ITEM(item); return g_app_info_launch(G_APP_INFO(self->info), NULL, context, NULL); } /** * Simply return the full URL for our .desktop file. */ static gchar *brisk_apps_item_get_uri(BriskItem *item) { BriskAppsItem *self = BRISK_APPS_ITEM(item); const gchar *desktop_fpath = NULL; desktop_fpath = g_desktop_app_info_get_filename(self->info); return g_filename_to_uri(desktop_fpath, NULL, NULL); } /** * brisk_apps_item_new: * * Return a new BriskAppsItem for the given desktop file */ BriskItem *brisk_apps_item_new(GDesktopAppInfo *info, gchar *section_id) { return g_object_new(BRISK_TYPE_APPS_ITEM, "info", info, "section-id", section_id, NULL); } /** * brisk_apps_item_get_section_id: * * Private API for the AppsSection to determine if a child belongs to * it or not. */ const gchar *brisk_apps_item_get_section_id(BriskAppsItem *self) { return (const gchar *)self->section_id; } /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 8 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=8 tabstop=8 expandtab: * :indentSize=8:tabSize=8:noTabs=true: */ brisk-menu-0.6.0/src/backend/apps/apps-item.h000066400000000000000000000033031352323743400207670ustar00rootroot00000000000000/* * This file is part of brisk-menu. * * Copyright © 2017-2019 Brisk Menu Developers * * 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 2 of the License, or * (at your option) any later version. */ #pragma once #include #include #include #include "../item.h" G_BEGIN_DECLS typedef struct _BriskAppsItem BriskAppsItem; typedef struct _BriskAppsItemClass BriskAppsItemClass; #define BRISK_TYPE_APPS_ITEM brisk_apps_item_get_type() #define BRISK_APPS_ITEM(o) (G_TYPE_CHECK_INSTANCE_CAST((o), BRISK_TYPE_APPS_ITEM, BriskAppsItem)) #define BRISK_IS_APPS_ITEM(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), BRISK_TYPE_APPS_ITEM)) #define BRISK_APPS_ITEM_CLASS(o) \ (G_TYPE_CHECK_CLASS_CAST((o), BRISK_TYPE_APPS_ITEM, BriskAppsItemClass)) #define BRISK_IS_APPS_ITEM_CLASS(o) (G_TYPE_CHECK_CLASS_TYPE((o), BRISK_TYPE_APPS_ITEM)) #define BRISK_APPS_ITEM_GET_CLASS(o) \ (G_TYPE_INSTANCE_GET_CLASS((o), BRISK_TYPE_APPS_ITEM, BriskAppsItemClass)) GType brisk_apps_item_get_type(void); BriskItem *brisk_apps_item_new(GDesktopAppInfo *info, gchar *section_id); const gchar *brisk_apps_item_get_section_id(BriskAppsItem *item); G_END_DECLS /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 8 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=8 tabstop=8 expandtab: * :indentSize=8:tabSize=8:noTabs=true: */ brisk-menu-0.6.0/src/backend/apps/apps-section.c000066400000000000000000000174231352323743400215000ustar00rootroot00000000000000/* * This file is part of brisk-menu. * * Copyright © 2017-2019 Brisk Menu Developers * * 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 2 of the License, or * (at your option) any later version. */ #define _GNU_SOURCE #include "util.h" BRISK_BEGIN_PEDANTIC #include "apps-item.h" #include "apps-section.h" #include BRISK_END_PEDANTIC enum { PROP_DIRECTORY = 1, N_PROPS }; static GParamSpec *obj_properties[N_PROPS] = { NULL, }; struct _BriskAppsSectionClass { BriskSectionClass parent_class; }; /** * BriskAppsSection is a type of item for the Brisk menu which is backed by * a .desktop file */ struct _BriskAppsSection { BriskSection parent; gchar *id; gchar *name; GIcon *icon; }; G_DEFINE_TYPE(BriskAppsSection, brisk_apps_section, BRISK_TYPE_SECTION) DEF_AUTOFREE(GFile, g_object_unref) DEF_AUTOFREE(GKeyFile, g_key_file_free) /** * Basic subclassing */ static const gchar *brisk_apps_section_get_id(BriskSection *item); static const gchar *brisk_apps_section_get_name(BriskSection *item); static const GIcon *brisk_apps_section_get_icon(BriskSection *item); static const gchar *brisk_apps_section_get_backend_id(BriskSection *item); static gboolean brisk_apps_section_can_show_item(BriskSection *section, BriskItem *item); /** * Create a GIcon for the given path */ static GIcon *brisk_apps_section_create_path_icon(const gchar *path) { autofree(GFile) *file = NULL; file = g_file_new_for_path(path); if (!file) { return NULL; } return g_file_icon_new(file); } static void brisk_apps_section_update_directory(BriskAppsSection *self, MateMenuTreeDirectory *directory) { g_clear_object(&self->icon); g_clear_pointer(&self->id, g_free); g_clear_pointer(&self->name, g_free); const gchar *icon = NULL; const gchar *path = NULL; autofree(GKeyFile) *key_file = NULL; if (!directory) { return; } /* Set our ID, name, and icon */ self->id = g_strdup_printf("%s.mate-directory", matemenu_tree_directory_get_menu_id(directory)); self->name = g_strdup(matemenu_tree_directory_get_name(directory)); path = matemenu_tree_directory_get_desktop_file_path(directory); if (!path) { return; } key_file = g_key_file_new(); if (!g_key_file_load_from_file(key_file, path, 0, NULL)) { return; } icon = g_key_file_get_locale_string(key_file, "Desktop Entry", "Icon", NULL, NULL); if (!icon) { return; } /* Set an appropriate icon based on the string */ if (icon[0] == '/') { self->icon = brisk_apps_section_create_path_icon(icon); } else { self->icon = g_themed_icon_new_with_default_fallbacks(icon); } } static void brisk_apps_section_set_property(GObject *object, guint id, const GValue *value, GParamSpec *spec) { BriskAppsSection *self = BRISK_APPS_SECTION(object); MateMenuTreeDirectory *directory = NULL; switch (id) { case PROP_DIRECTORY: directory = g_value_get_pointer(value); brisk_apps_section_update_directory(self, directory); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, id, spec); break; } } static void brisk_apps_section_get_property(GObject *object, guint id, GValue *value, GParamSpec *spec) { switch (id) { case PROP_DIRECTORY: /* We don't maintain the reference, we only want to use it in construction */ g_value_set_pointer(value, NULL); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, id, spec); break; } } /** * brisk_apps_section_dispose: * * Clean up a BriskAppsSection instance */ static void brisk_apps_section_dispose(GObject *obj) { BriskAppsSection *self = BRISK_APPS_SECTION(obj); g_clear_object(&self->icon); g_clear_pointer(&self->id, g_free); g_clear_pointer(&self->name, g_free); G_OBJECT_CLASS(brisk_apps_section_parent_class)->dispose(obj); } /** * brisk_apps_section_class_init: * * Handle class initialisation */ static void brisk_apps_section_class_init(BriskAppsSectionClass *klazz) { GObjectClass *obj_class = G_OBJECT_CLASS(klazz); BriskSectionClass *s_class = BRISK_SECTION_CLASS(klazz); /* item vtable hookup */ s_class->get_id = brisk_apps_section_get_id; s_class->get_name = brisk_apps_section_get_name; s_class->get_icon = brisk_apps_section_get_icon; s_class->get_backend_id = brisk_apps_section_get_backend_id; s_class->can_show_item = brisk_apps_section_can_show_item; /* gobject vtable hookup */ obj_class->dispose = brisk_apps_section_dispose; obj_class->set_property = brisk_apps_section_set_property; obj_class->get_property = brisk_apps_section_get_property; obj_properties[PROP_DIRECTORY] = g_param_spec_pointer("directory", "The MateMenuTreeDirectory", "Corresponding menu directory", G_PARAM_CONSTRUCT | G_PARAM_READWRITE); g_object_class_install_properties(obj_class, N_PROPS, obj_properties); } /** * brisk_apps_section_init: * * Handle construction of the BriskAppsSection */ static void brisk_apps_section_init(__brisk_unused__ BriskAppsSection *self) { } static const gchar *brisk_apps_section_get_id(BriskSection *section) { BriskAppsSection *self = BRISK_APPS_SECTION(section); return (const gchar *)self->id; } static const gchar *brisk_apps_section_get_name(BriskSection *section) { BriskAppsSection *self = BRISK_APPS_SECTION(section); return (const gchar *)self->name; } static const GIcon *brisk_apps_section_get_icon(BriskSection *section) { BriskAppsSection *self = BRISK_APPS_SECTION(section); return (const GIcon *)self->icon; } static const gchar *brisk_apps_section_get_backend_id(__brisk_unused__ BriskSection *item) { return "apps"; } /** * Long story short, if the section ID matches, we can show it. */ static gboolean brisk_apps_section_can_show_item(BriskSection *section, BriskItem *item) { /* We only know how to handle our items */ BriskAppsItem *apps_item = NULL; const gchar *section_id = NULL; BriskAppsSection *self = BRISK_APPS_SECTION(section); if (G_UNLIKELY(item == NULL) || G_UNLIKELY(!BRISK_IS_APPS_ITEM(item))) { return FALSE; } apps_item = BRISK_APPS_ITEM(item); section_id = brisk_apps_item_get_section_id(apps_item); if (section_id && g_str_equal(section_id, self->id)) { return TRUE; } return FALSE; } /** * brisk_apps_section_new: * * Return a new BriskAppsSection for the given menu directory. * @note: The directory will not be stored, it is used only to seed the * section. */ BriskSection *brisk_apps_section_new(MateMenuTreeDirectory *dir) { return g_object_new(BRISK_TYPE_APPS_SECTION, "directory", dir, NULL); } /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 8 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=8 tabstop=8 expandtab: * :indentSize=8:tabSize=8:noTabs=true: */ brisk-menu-0.6.0/src/backend/apps/apps-section.h000066400000000000000000000034441352323743400215030ustar00rootroot00000000000000/* * This file is part of brisk-menu. * * Copyright © 2017-2019 Brisk Menu Developers * * 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 2 of the License, or * (at your option) any later version. */ #pragma once #include #include #define MATEMENU_I_KNOW_THIS_IS_UNSTABLE #include #include "../section.h" G_BEGIN_DECLS typedef struct _BriskAppsSection BriskAppsSection; typedef struct _BriskAppsSectionClass BriskAppsSectionClass; #define BRISK_TYPE_APPS_SECTION brisk_apps_section_get_type() #define BRISK_APPS_SECTION(o) \ (G_TYPE_CHECK_INSTANCE_CAST((o), BRISK_TYPE_APPS_SECTION, BriskAppsSection)) #define BRISK_IS_APPS_SECTION(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), BRISK_TYPE_APPS_SECTION)) #define BRISK_APPS_SECTION_CLASS(o) \ (G_TYPE_CHECK_CLASS_CAST((o), BRISK_TYPE_APPS_SECTION, BriskAppsSectionClass)) #define BRISK_IS_APPS_SECTION_CLASS(o) (G_TYPE_CHECK_CLASS_TYPE((o), BRISK_TYPE_APPS_SECTION)) #define BRISK_APPS_SECTION_GET_CLASS(o) \ (G_TYPE_INSTANCE_GET_CLASS((o), BRISK_TYPE_APPS_SECTION, BriskAppsSectionClass)) GType brisk_apps_section_get_type(void); BriskSection *brisk_apps_section_new(MateMenuTreeDirectory *dir); G_END_DECLS /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 8 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=8 tabstop=8 expandtab: * :indentSize=8:tabSize=8:noTabs=true: */ brisk-menu-0.6.0/src/backend/backend.c000066400000000000000000000245121352323743400175140ustar00rootroot00000000000000/* * This file is part of brisk-menu. * * Copyright © 2017-2019 Brisk Menu Developers * * 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 2 of the License, or * (at your option) any later version. */ #define _GNU_SOURCE #include "util.h" BRISK_BEGIN_PEDANTIC #include "backend.h" BRISK_END_PEDANTIC /** * IDs for our signals */ enum { BACKEND_SIGNAL_ITEM_ADDED = 0, BACKEND_SIGNAL_ITEM_REMOVED, BACKEND_SIGNAL_SECTION_ADDED, BACKEND_SIGNAL_SECTION_REMOVED, BACKEND_SIGNAL_INVALIDATE_FILTER, BACKEND_SIGNAL_HIDE_MENU, BACKEND_SIGNAL_RESET, N_SIGNALS }; static guint backend_signals[N_SIGNALS] = { 0 }; G_DEFINE_TYPE(BriskBackend, brisk_backend, G_TYPE_OBJECT) /** * brisk_backend_dispose: * * Clean up a BriskBackend instance */ static void brisk_backend_dispose(GObject *obj) { G_OBJECT_CLASS(brisk_backend_parent_class)->dispose(obj); } /** * brisk_backend_class_init: * * Handle class initialisation */ static void brisk_backend_class_init(BriskBackendClass *klazz) { GObjectClass *obj_class = G_OBJECT_CLASS(klazz); /* gobject vtable hookup */ obj_class->dispose = brisk_backend_dispose; /** * BriskBackend::item-added * @backend: The backend that created the item * @item: The newly available item * * Used to notify the frontend that a new item is available for consumption */ backend_signals[BACKEND_SIGNAL_ITEM_ADDED] = g_signal_new("item-added", BRISK_TYPE_BACKEND, G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET(BriskBackendClass, item_added), NULL, NULL, NULL, G_TYPE_NONE, 1, BRISK_TYPE_ITEM); /** * BriskBackend::item-removed * @backend: The backend that removed the item * @id: The item's ID that is being removed * * Used to notify the frontend that an item is being removed */ backend_signals[BACKEND_SIGNAL_ITEM_REMOVED] = g_signal_new("item-removed", BRISK_TYPE_BACKEND, G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET(BriskBackendClass, item_removed), NULL, NULL, NULL, G_TYPE_NONE, 1, G_TYPE_STRING); /** * BriskBackend::section-added * @backend: The backend that created the section * @item: The newly available section * * Used to notify the frontend that a new section is available for consumption */ backend_signals[BACKEND_SIGNAL_SECTION_ADDED] = g_signal_new("section-added", BRISK_TYPE_BACKEND, G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET(BriskBackendClass, section_added), NULL, NULL, NULL, G_TYPE_NONE, 1, BRISK_TYPE_SECTION); /** * BriskBackend::section-removed * @backend: The backend that removed the section * @id: The section's ID that is being removed * * Used to notify the frontend that an section is being removed */ backend_signals[BACKEND_SIGNAL_SECTION_REMOVED] = g_signal_new("section-removed", BRISK_TYPE_BACKEND, G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET(BriskBackendClass, section_removed), NULL, NULL, NULL, G_TYPE_NONE, 1, G_TYPE_STRING); /** * BriskBackend::invalidate-filter * @backend: The backend that requested the invalidation * * Used to notify the frontend that the app list filter should be invalidated */ backend_signals[BACKEND_SIGNAL_INVALIDATE_FILTER] = g_signal_new("invalidate-filter", BRISK_TYPE_BACKEND, G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET(BriskBackendClass, invalidate_filter), NULL, NULL, NULL, G_TYPE_NONE, 0); /** * BriskBackend::hide-menu * @backend: The backend that requested the hiding * * Used to notify the frontend that the menu window should be hidden */ backend_signals[BACKEND_SIGNAL_HIDE_MENU] = g_signal_new("hide-menu", BRISK_TYPE_BACKEND, G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET(BriskBackendClass, invalidate_filter), NULL, NULL, NULL, G_TYPE_NONE, 0); /** * BriskBackend::reset * @backend: The backend that was reset * * Used to notify the frontend that all Item's should be destroyed */ backend_signals[BACKEND_SIGNAL_RESET] = g_signal_new("reset", BRISK_TYPE_BACKEND, G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET(BriskBackendClass, reset), NULL, NULL, NULL, G_TYPE_NONE, 0); } /** * brisk_backend_init: * * Handle construction of the BriskBackend */ static void brisk_backend_init(__brisk_unused__ BriskBackend *self) { } /** * brisk_backend_item_added: * * Implementations may use this method to emit the signal item-added */ void brisk_backend_item_added(BriskBackend *self, BriskItem *item) { g_assert(self != NULL); g_signal_emit(self, backend_signals[BACKEND_SIGNAL_ITEM_ADDED], 0, item); } /** * brisk_backend_item_removed: * * Implementations may use this method to emit the signal item-removed */ void brisk_backend_item_removed(BriskBackend *self, const gchar *id) { g_assert(self != NULL); g_signal_emit(self, backend_signals[BACKEND_SIGNAL_ITEM_REMOVED], 0, id); } /** * brisk_backend_section_added: * * Implementations may use this method to emit the signal section-added */ void brisk_backend_section_added(BriskBackend *self, BriskSection *section) { g_assert(self != NULL); g_signal_emit(self, backend_signals[BACKEND_SIGNAL_SECTION_ADDED], 0, section); } /** * brisk_backend_section_removed: * * Implementations may use this method to emit the signal section-removed */ void brisk_backend_section_removed(BriskBackend *self, const gchar *id) { g_assert(self != NULL); g_signal_emit(self, backend_signals[BACKEND_SIGNAL_SECTION_REMOVED], 0, id); } /** * brisk_backend_invalidate_filter: * * Implementations may use this method to emit the signal invalidate-filter */ void brisk_backend_invalidate_filter(BriskBackend *self) { g_assert(self != NULL); g_signal_emit(self, backend_signals[BACKEND_SIGNAL_INVALIDATE_FILTER], 0); } /** * brisk_backend_hide_menu: * * Implementations may use this method to emit the signal hide-menu */ void brisk_backend_hide_menu(BriskBackend *self) { g_assert(self != NULL); g_signal_emit(self, backend_signals[BACKEND_SIGNAL_HIDE_MENU], 0); } /** * brisk_backend_reset: * * Implementations may use this method to emit the signal reset */ void brisk_backend_reset(BriskBackend *self) { g_assert(self != NULL); g_signal_emit(self, backend_signals[BACKEND_SIGNAL_RESET], 0); } /** * brisk_backend_get_flags: * * Return the supported flags for the backend */ unsigned int brisk_backend_get_flags(BriskBackend *backend) { g_assert(backend != NULL); BriskBackendClass *klazz = BRISK_BACKEND_GET_CLASS(backend); g_assert(klazz->get_flags != NULL); return klazz->get_flags(backend); } /** * brisk_backend_get_id: * * Return the unique ID for the backend * @note This string is owned by the backend and must not be freed */ const gchar *brisk_backend_get_id(BriskBackend *backend) { g_assert(backend != NULL); BriskBackendClass *klazz = BRISK_BACKEND_GET_CLASS(backend); g_assert(klazz->get_id != NULL); return klazz->get_id(backend); } /** * brisk_backend_get_display_name: * * Return the display name for the backend * @note This string is owned by the backend and must not be freed */ const gchar *brisk_backend_get_display_name(BriskBackend *backend) { g_assert(backend != NULL); BriskBackendClass *klazz = BRISK_BACKEND_GET_CLASS(backend); g_assert(klazz->get_display_name != NULL); return klazz->get_display_name(backend); } GMenu *brisk_backend_get_item_actions(BriskBackend *backend, BriskItem *item, GActionGroup *group) { g_assert(backend != NULL); g_assert(item != NULL); BriskBackendClass *klazz = BRISK_BACKEND_GET_CLASS(backend); if (!klazz->get_item_actions) { return NULL; } return klazz->get_item_actions(backend, item, group); } /** * brisk_backend_load: * * Attempt to load the backend for the first time */ gboolean brisk_backend_load(BriskBackend *backend) { g_assert(backend != NULL); BriskBackendClass *klazz = BRISK_BACKEND_GET_CLASS(backend); g_return_val_if_fail(klazz->load != NULL, FALSE); return klazz->load(backend); } /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 8 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=8 tabstop=8 expandtab: * :indentSize=8:tabSize=8:noTabs=true: */ brisk-menu-0.6.0/src/backend/backend.h000066400000000000000000000074771352323743400175340ustar00rootroot00000000000000/* * This file is part of brisk-menu. * * Copyright © 2017-2019 Brisk Menu Developers * * 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 2 of the License, or * (at your option) any later version. */ #pragma once #include "item.h" #include "section.h" #include G_BEGIN_DECLS typedef struct _BriskBackend BriskBackend; typedef struct _BriskBackendClass BriskBackendClass; /** * Flags to indicate the support level of a given backend */ typedef enum { BRISK_BACKEND_KEYBOARD = 1 << 0, /** BRISK_END_PEDANTIC G_DEFINE_TYPE(BriskFavouritesBackend, brisk_favourites_backend, BRISK_TYPE_BACKEND) /* Helper for gsettings */ typedef gchar *gstrv; DEF_AUTOFREE(gstrv, g_strfreev) static inline void _g_array_clean(GArray *array) { g_array_free(array, TRUE); } DEF_AUTOFREE(GArray, _g_array_clean) static gboolean brisk_favourites_backend_load(BriskBackend *backend); static void brisk_favourites_backend_pin_item(GSimpleAction *action, GVariant *parameter, BriskFavouritesBackend *self); static void brisk_favourites_backend_unpin_item(GSimpleAction *action, GVariant *parameter, BriskFavouritesBackend *self); /** * Tell the frontends what we are */ static unsigned int brisk_favourites_backend_get_flags(__brisk_unused__ BriskBackend *backend) { return BRISK_BACKEND_SOURCE; } static const gchar *brisk_favourites_backend_get_id(__brisk_unused__ BriskBackend *backend) { return "favourites"; } static const gchar *brisk_favourites_backend_get_display_name( __brisk_unused__ BriskBackend *backend) { return _("Favourites"); } static GMenu *brisk_favourites_backend_get_item_actions(BriskBackend *backend, BriskItem *item, GActionGroup *group) { GMenu *ret = NULL; BriskFavouritesBackend *self = BRISK_FAVOURITES_BACKEND(backend); g_action_map_add_action(G_ACTION_MAP(group), G_ACTION(self->action_add)); g_action_map_add_action(G_ACTION_MAP(group), G_ACTION(self->action_remove)); self->active_item = item; ret = g_menu_new(); if (brisk_favourites_backend_is_pinned(self, item)) { g_menu_append(ret, _("Unpin from favourites menu"), "brisk-context-items.favourites.unpin"); } else { g_menu_append(ret, _("Pin to favourites menu"), "brisk-context-items.favourites.pin"); } brisk_favourites_backend_menu_desktop(self, ret, group); return ret; } /** * brisk_favourites_backend_dispose: * * Clean up a BriskFavouritesBackend instance */ static void brisk_favourites_backend_dispose(GObject *obj) { BriskFavouritesBackend *self = BRISK_FAVOURITES_BACKEND(obj); g_clear_object(&self->action_add); g_clear_object(&self->action_remove); g_clear_object(&self->action_add_desktop); g_clear_object(&self->action_remove_desktop); g_clear_object(&self->settings); g_clear_pointer(&self->favourites, g_hash_table_unref); G_OBJECT_CLASS(brisk_favourites_backend_parent_class)->dispose(obj); } /** * brisk_favourites_backend_class_init: * * Handle class initialisation */ static void brisk_favourites_backend_class_init(BriskFavouritesBackendClass *klazz) { GObjectClass *obj_class = G_OBJECT_CLASS(klazz); BriskBackendClass *b_class = BRISK_BACKEND_CLASS(klazz); /* Backend vtable hookup */ b_class->get_flags = brisk_favourites_backend_get_flags; b_class->get_id = brisk_favourites_backend_get_id; b_class->get_display_name = brisk_favourites_backend_get_display_name; b_class->load = brisk_favourites_backend_load; b_class->get_item_actions = brisk_favourites_backend_get_item_actions; /* gobject vtable hookup */ obj_class->dispose = brisk_favourites_backend_dispose; } /** * Handle changes to the favourites schema. We'll reset our table and restore the * entries and retain the order within the list, which will come in useful in * future when we want to enable reordering of entries. */ static void brisk_favourites_backend_changed(GSettings *settings, const gchar *key, BriskFavouritesBackend *self) { autofree(gstrv) *favs = g_settings_get_strv(settings, key); g_hash_table_remove_all(self->favourites); if (!favs) { return; } for (guint i = 0; i < g_strv_length(favs); i++) { g_hash_table_insert(self->favourites, g_strdup(favs[i]), GUINT_TO_POINTER(i)); } } /** * brisk_favourites_backend_init: * * Handle construction of the BriskFavouritesBackend */ static void brisk_favourites_backend_init(BriskFavouritesBackend *self) { self->settings = g_settings_new("com.solus-project.brisk-menu"); g_signal_connect(self->settings, "changed::favourites", G_CALLBACK(brisk_favourites_backend_changed), self); self->action_add = g_simple_action_new("favourites.pin", NULL); g_signal_connect(self->action_add, "activate", G_CALLBACK(brisk_favourites_backend_pin_item), self); self->action_remove = g_simple_action_new("favourites.unpin", NULL); g_signal_connect(self->action_remove, "activate", G_CALLBACK(brisk_favourites_backend_unpin_item), self); brisk_favourites_backend_init_desktop(self); /* Allow O(1) lookup for the "is pinned" logic */ self->favourites = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); /* Force load of the backend pinned items */ brisk_favourites_backend_changed(self->settings, "favourites", self); } /** * brisk_favourites_backend_is_pinned: * * Determine whether the BriskItem is registered as pinned */ gboolean brisk_favourites_backend_is_pinned(BriskFavouritesBackend *self, BriskItem *item) { if (!item || !self) { return FALSE; } const gchar *id = brisk_item_get_id(item); return g_hash_table_contains(self->favourites, id); } /** * brisk_favourites_backend_load: * * On load we just emit a new stock section item */ static gboolean brisk_favourites_backend_load(BriskBackend *backend) { BriskFavouritesBackend *self = BRISK_FAVOURITES_BACKEND(backend); brisk_backend_section_added(backend, brisk_favourites_section_new(self)); return TRUE; } static void brisk_favourites_backend_pin_item(__brisk_unused__ GSimpleAction *action, __brisk_unused__ GVariant *parameter, BriskFavouritesBackend *self) { autofree(gstrv) *old = NULL; autofree(GArray) *array = NULL; if (!self->active_item) { return; } const gchar *item_id = brisk_item_get_id(self->active_item); self->active_item = NULL; /* prevent duping.. */ if (g_hash_table_contains(self->favourites, item_id)) { return; } old = g_settings_get_strv(self->settings, "favourites"); array = g_array_new(TRUE, TRUE, sizeof(gchar *)); for (guint i = 0; i < g_strv_length(old); i++) { if (!old[i] || g_str_equal(old[i], "")) { continue; } array = g_array_append_val(array, old[i]); } array = g_array_append_val(array, item_id); g_settings_set_strv(self->settings, "favourites", (const gchar **)array->data); } static void brisk_favourites_backend_unpin_item(__brisk_unused__ GSimpleAction *action, __brisk_unused__ GVariant *parameter, BriskFavouritesBackend *self) { autofree(gstrv) *old = NULL; autofree(GArray) *array = NULL; if (!self->active_item) { return; } const gchar *item_id = brisk_item_get_id(self->active_item); self->active_item = NULL; old = g_settings_get_strv(self->settings, "favourites"); array = g_array_new(TRUE, TRUE, sizeof(gchar *)); for (guint i = 0; i < g_strv_length(old); i++) { if (!old[i] || g_str_equal(old[i], "")) { continue; } if (!g_str_equal(old[i], item_id)) { array = g_array_append_val(array, old[i]); } } g_settings_set_strv(self->settings, "favourites", (const gchar **)array->data); brisk_backend_invalidate_filter(BRISK_BACKEND(self)); } /** * brisk_favourites_backend_get_item_order: * * Return the pin priority for any given item, if its known as pinned. * We may be storing `0` as a value for a pin priority, which when using glibc, * is equivalent to NULL, so we add checks that there is really something stored. */ gint brisk_favourites_backend_get_item_order(BriskFavouritesBackend *self, BriskItem *item) { const gchar *item_id = brisk_item_get_id(item); __brisk_unused__ void *key = NULL; void *val = NULL; if (!g_hash_table_lookup_extended(self->favourites, item_id, &key, &val)) { return -1; } return GPOINTER_TO_INT(val); } /** * brisk_favourites_backend_new: * * Return a newly created BriskFavouritesBackend */ BriskBackend *brisk_favourites_backend_new(void) { return g_object_new(BRISK_TYPE_FAVOURITES_BACKEND, NULL); } /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 8 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=8 tabstop=8 expandtab: * :indentSize=8:tabSize=8:noTabs=true: */ brisk-menu-0.6.0/src/backend/favourites/favourites-backend.h000066400000000000000000000055071352323743400241000ustar00rootroot00000000000000/* * This file is part of brisk-menu. * * Copyright © 2017-2019 Brisk Menu Developers * * 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 2 of the License, or * (at your option) any later version. */ #pragma once #include "../backend.h" #include G_BEGIN_DECLS typedef struct _BriskFavouritesBackend BriskFavouritesBackend; typedef struct _BriskFavouritesBackendClass BriskFavouritesBackendClass; struct _BriskFavouritesBackendClass { BriskBackendClass parent_class; }; /** * BriskFavouritesBackend implements support for favourites in Brisk */ struct _BriskFavouritesBackend { BriskBackend parent; GSettings *settings; GHashTable *favourites; /* Action management */ BriskItem *active_item; GSimpleAction *action_remove; GSimpleAction *action_add; GSimpleAction *action_add_desktop; GSimpleAction *action_remove_desktop; }; #define BRISK_TYPE_FAVOURITES_BACKEND brisk_favourites_backend_get_type() #define BRISK_FAVOURITES_BACKEND(o) \ (G_TYPE_CHECK_INSTANCE_CAST((o), BRISK_TYPE_FAVOURITES_BACKEND, BriskFavouritesBackend)) #define BRISK_IS_FAVOURITES_BACKEND(o) \ (G_TYPE_CHECK_INSTANCE_TYPE((o), BRISK_TYPE_FAVOURITES_BACKEND)) #define BRISK_FAVOURITES_BACKEND_CLASS(o) \ (G_TYPE_CHECK_CLASS_CAST((o), BRISK_TYPE_FAVOURITES_BACKEND, BriskFavouritesBackendClass)) #define BRISK_IS_FAVOURITES_BACKEND_CLASS(o) \ (G_TYPE_CHECK_CLASS_TYPE((o), BRISK_TYPE_FAVOURITES_BACKEND)) #define BRISK_FAVOURITES_BACKEND_GET_CLASS(o) \ (G_TYPE_INSTANCE_GET_CLASS((o), BRISK_TYPE_FAVOURITES_BACKEND, BriskFavouritesBackendClass)) GType brisk_favourites_backend_get_type(void); BriskBackend *brisk_favourites_backend_new(void); gboolean brisk_favourites_backend_is_pinned(BriskFavouritesBackend *self, BriskItem *item); gint brisk_favourites_backend_get_item_order(BriskFavouritesBackend *self, BriskItem *item); void brisk_favourites_backend_init_desktop(BriskFavouritesBackend *backend); void brisk_favourites_backend_menu_desktop(BriskFavouritesBackend *backend, GMenu *menu, GActionGroup *group); G_END_DECLS /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 8 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=8 tabstop=8 expandtab: * :indentSize=8:tabSize=8:noTabs=true: */ brisk-menu-0.6.0/src/backend/favourites/favourites-desktop.c000066400000000000000000000164551352323743400241610ustar00rootroot00000000000000/* * This file is part of brisk-menu. * * Copyright © 2017-2019 Brisk Menu Developers * * 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 2 of the License, or * (at your option) any later version. */ #define _GNU_SOURCE #include "util.h" BRISK_BEGIN_PEDANTIC #include "favourites-backend.h" #include #include BRISK_END_PEDANTIC #include #include DEF_AUTOFREE(GFile, g_object_unref) DEF_AUTOFREE(gchar, g_free) DEF_AUTOFREE(GError, g_error_free) typedef enum { PIN_STATUS_UNPINNABLE = 0, PIN_STATUS_PINNED = 1, PIN_STATUS_UNPINNED = 2, } DesktopPinStatus; /** * get_desktop_item_source: * * Get a GFile for the BriskItem's source */ static GFile *get_desktop_item_source(BriskItem *item) { autofree(gchar) *uri = NULL; if (!item) { return NULL; } uri = brisk_item_get_uri(item); if (!uri) { return NULL; } return g_file_new_for_uri(uri); } /** * get_item_path will return the path that would be pinned on the desktop */ static gchar *get_desktop_item_target_path(GFile *file) { if (!g_file_query_exists(file, NULL)) { return NULL; } autofree(gchar) *basename = g_file_get_basename(file); return g_build_path(G_DIR_SEPARATOR_S, g_get_user_special_dir(G_USER_DIRECTORY_DESKTOP), basename, NULL); } /** * get_desktop_item_target: * * Get the target GFile on the desktop */ static GFile *get_desktop_item_target(GFile *file) { autofree(gchar) *path = NULL; path = get_desktop_item_target_path(file); return g_file_new_for_path(path); } /** * brisk_favourites_backend_action_desktop_pin will pin the item to the desktop * by copying the source file to the target */ static void brisk_favourites_backend_action_desktop_pin(__brisk_unused__ GSimpleAction *action, __brisk_unused__ GVariant *parameter, BriskFavouritesBackend *self) { autofree(GFile) *source = NULL; autofree(GFile) *dest = NULL; autofree(GError) *error = NULL; autofree(gchar) *path = NULL; source = get_desktop_item_source(self->active_item); if (!source) { return; } dest = get_desktop_item_target(source); if (!dest) { return; } path = g_file_get_path(dest); if (!path) { return; } /* Consider making async. */ if (!g_file_copy(source, dest, G_FILE_COPY_ALL_METADATA | G_FILE_COPY_OVERWRITE, NULL, NULL, NULL, &error)) { /* Consider using libnotify */ g_message("Failed to pin desktop item: %s", error->message); } /* MATE will sanitize .desktop files that are chmod +x */ int r = g_chmod(path, 00755); if (r != 0) { g_message("Failed to chmod desktop item: %s", strerror(errno)); } } /** * brisk_favourites_backend_action_desktop_unpin will attempt to unpin the item * from the desktop by removing the .desktop file */ static void brisk_favourites_backend_action_desktop_unpin(__brisk_unused__ GSimpleAction *action, __brisk_unused__ GVariant *parameter, BriskFavouritesBackend *self) { autofree(GFile) *source = NULL; autofree(GFile) *dest = NULL; autofree(GError) *error = NULL; source = get_desktop_item_source(self->active_item); if (!source) { return; } dest = get_desktop_item_target(source); if (!dest || !g_file_query_exists(dest, NULL)) { return; } if (!g_file_delete(dest, NULL, &error)) { /* Consider using libnotify */ g_message("Unable to unpin desktop item: %s", error->message); } } /** * brisk_favourites_backend_is_desktop_pinned: * * Determine if the source file is actually pinned to the desktop or not */ static DesktopPinStatus brisk_favourites_backend_get_desktop_pin_status(BriskItem *item) { autofree(GFile) *source = NULL; autofree(GFile) *dest = NULL; autofree(gchar) *base = NULL; source = get_desktop_item_source(item); if (!source) { return PIN_STATUS_UNPINNABLE; } /* .desktop .. */ base = g_file_get_basename(source); if (!g_str_has_suffix(base, ".desktop")) { return PIN_STATUS_UNPINNABLE; } dest = get_desktop_item_target(source); if (!dest || !g_file_query_exists(dest, NULL)) { return PIN_STATUS_UNPINNED; } return PIN_STATUS_PINNED; } /** * brisk_favourites_backend_init_desktop: * * Initialise actions for the favourite backend's .desktop functionality */ void brisk_favourites_backend_init_desktop(BriskFavouritesBackend *self) { self->action_add_desktop = g_simple_action_new("favourites.pin-desktop", NULL); g_signal_connect(self->action_add_desktop, "activate", G_CALLBACK(brisk_favourites_backend_action_desktop_pin), self); self->action_remove_desktop = g_simple_action_new("favourites.unpin-desktop", NULL); g_signal_connect(self->action_remove_desktop, "activate", G_CALLBACK(brisk_favourites_backend_action_desktop_unpin), self); } /** * brisk_favourites_backend_menu_desktop: * * Add relevant entries to the context menu pertaining to .desktop handling */ void brisk_favourites_backend_menu_desktop(BriskFavouritesBackend *self, GMenu *menu, GActionGroup *group) { g_action_map_add_action(G_ACTION_MAP(group), G_ACTION(self->action_add_desktop)); g_action_map_add_action(G_ACTION_MAP(group), G_ACTION(self->action_remove_desktop)); DesktopPinStatus t = brisk_favourites_backend_get_desktop_pin_status(self->active_item); switch (t) { case PIN_STATUS_PINNED: g_menu_append(menu, _("Unpin from desktop"), "brisk-context-items.favourites.unpin-desktop"); break; case PIN_STATUS_UNPINNED: g_menu_append(menu, _("Pin to desktop"), "brisk-context-items.favourites.pin-desktop"); break; case PIN_STATUS_UNPINNABLE: default: return; } } /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 8 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=8 tabstop=8 expandtab: * :indentSize=8:tabSize=8:noTabs=true: */ brisk-menu-0.6.0/src/backend/favourites/favourites-section.c000066400000000000000000000143461352323743400241510ustar00rootroot00000000000000/* * This file is part of brisk-menu. * * Copyright © 2017-2019 Brisk Menu Developers * * 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 2 of the License, or * (at your option) any later version. */ #define _GNU_SOURCE #include "util.h" BRISK_BEGIN_PEDANTIC #include "favourites-backend.h" #include "favourites-section.h" #include #include BRISK_END_PEDANTIC struct _BriskFavouritesSectionClass { BriskSectionClass parent_class; }; struct _BriskFavouritesSection { BriskSection parent; GIcon *icon; /**backend = g_value_get_pointer(value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, id, spec); break; } } static void brisk_favourites_section_get_property(GObject *object, guint id, GValue *value, GParamSpec *spec) { BriskFavouritesSection *self = BRISK_FAVOURITES_SECTION(object); switch (id) { case PROP_BACKEND: g_value_set_pointer(value, self->backend); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, id, spec); break; } } /** * Basic subclassing */ static const gchar *brisk_favourites_section_get_id(BriskSection *section); static const gchar *brisk_favourites_section_get_name(BriskSection *section); static const GIcon *brisk_favourites_section_get_icon(BriskSection *section); static const gchar *brisk_favourites_section_get_backend_id(BriskSection *section); static gint brisk_favourites_section_get_sort_order(BriskSection *section, BriskItem *item); static gboolean brisk_favourites_section_can_show_item(BriskSection *section, BriskItem *item); /** * brisk_favourites_section_dispose: * * Clean up a BriskFavouritesSection instance */ static void brisk_favourites_section_dispose(GObject *obj) { BriskFavouritesSection *self = BRISK_FAVOURITES_SECTION(obj); g_clear_object(&self->icon); G_OBJECT_CLASS(brisk_favourites_section_parent_class)->dispose(obj); } /** * brisk_favourites_section_class_init: * * Handle class initialisation */ static void brisk_favourites_section_class_init(BriskFavouritesSectionClass *klazz) { BriskSectionClass *s_class = BRISK_SECTION_CLASS(klazz); GObjectClass *obj_class = G_OBJECT_CLASS(klazz); /* item vtable hookup */ s_class->get_id = brisk_favourites_section_get_id; s_class->get_name = brisk_favourites_section_get_name; s_class->get_icon = brisk_favourites_section_get_icon; s_class->get_backend_id = brisk_favourites_section_get_backend_id; s_class->can_show_item = brisk_favourites_section_can_show_item; s_class->get_sort_order = brisk_favourites_section_get_sort_order; obj_class->dispose = brisk_favourites_section_dispose; obj_class->set_property = brisk_favourites_section_set_property; obj_class->get_property = brisk_favourites_section_get_property; obj_properties[PROP_BACKEND] = g_param_spec_pointer("backend", "The BriskBackend", "Owning backend for this section", G_PARAM_CONSTRUCT | G_PARAM_READWRITE); g_object_class_install_properties(obj_class, N_PROPS, obj_properties); } /** * brisk_favourites_section_init: * * Handle construction of the BriskFavouritesSection. Does absolutely nothing * special outside of creating our icon. */ static void brisk_favourites_section_init(BriskFavouritesSection *self) { self->icon = g_themed_icon_new_with_default_fallbacks("emblem-favorite"); } static gboolean brisk_favourites_section_get_item_is_pinned(BriskSection *section, BriskItem *item) { BriskFavouritesSection *self = BRISK_FAVOURITES_SECTION(section); return brisk_favourites_backend_is_pinned(self->backend, item); } static const gchar *brisk_favourites_section_get_id(__brisk_unused__ BriskSection *section) { return "favourites"; } static const gchar *brisk_favourites_section_get_name(__brisk_unused__ BriskSection *section) { return _("Favourites"); } static const GIcon *brisk_favourites_section_get_icon(BriskSection *section) { BriskFavouritesSection *self = BRISK_FAVOURITES_SECTION(section); return (const GIcon *)self->icon; } static const gchar *brisk_favourites_section_get_backend_id(__brisk_unused__ BriskSection *item) { return "favourites"; } static gboolean brisk_favourites_section_can_show_item(__brisk_unused__ BriskSection *section, __brisk_unused__ BriskItem *item) { return brisk_favourites_section_get_item_is_pinned(section, item); } static gint brisk_favourites_section_get_sort_order(BriskSection *section, BriskItem *item) { BriskFavouritesSection *self = BRISK_FAVOURITES_SECTION(section); return brisk_favourites_backend_get_item_order(self->backend, item); } /** * brisk_favourites_section_new: * * Return a new BriskFavouritesSection */ BriskSection *brisk_favourites_section_new(BriskFavouritesBackend *backend) { return g_object_new(BRISK_TYPE_FAVOURITES_SECTION, "backend", backend, NULL); } /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 8 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=8 tabstop=8 expandtab: * :indentSize=8:tabSize=8:noTabs=true: */ brisk-menu-0.6.0/src/backend/favourites/favourites-section.h000066400000000000000000000037661352323743400241620ustar00rootroot00000000000000/* * This file is part of brisk-menu. * * Copyright © 2017-2019 Brisk Menu Developers * * 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 2 of the License, or * (at your option) any later version. */ #pragma once #include #include #include "../section.h" #include "favourites-backend.h" G_BEGIN_DECLS typedef struct _BriskFavouritesSection BriskFavouritesSection; typedef struct _BriskFavouritesSectionClass BriskFavouritesSectionClass; #define BRISK_TYPE_FAVOURITES_SECTION brisk_favourites_section_get_type() #define BRISK_FAVOURITES_SECTION(o) \ (G_TYPE_CHECK_INSTANCE_CAST((o), BRISK_TYPE_FAVOURITES_SECTION, BriskFavouritesSection)) #define BRISK_IS_FAVOURITES_SECTION(o) \ (G_TYPE_CHECK_INSTANCE_TYPE((o), BRISK_TYPE_FAVOURITES_SECTION)) #define BRISK_FAVOURITES_SECTION_CLASS(o) \ (G_TYPE_CHECK_CLASS_CAST((o), BRISK_TYPE_FAVOURITES_SECTION, BriskFavouritesSectionClass)) #define BRISK_IS_FAVOURITES_SECTION_CLASS(o) \ (G_TYPE_CHECK_CLASS_TYPE((o), BRISK_TYPE_FAVOURITES_SECTION)) #define BRISK_FAVOURITES_SECTION_GET_CLASS(o) \ (G_TYPE_INSTANCE_GET_CLASS((o), BRISK_TYPE_FAVOURITES_SECTION, BriskFavouritesSectionClass)) GType brisk_favourites_section_get_type(void); BriskSection *brisk_favourites_section_new(BriskFavouritesBackend *backend); G_END_DECLS /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 8 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=8 tabstop=8 expandtab: * :indentSize=8:tabSize=8:noTabs=true: */ brisk-menu-0.6.0/src/backend/item.c000066400000000000000000000112671352323743400170660ustar00rootroot00000000000000/* * This file is part of brisk-menu. * * Copyright © 2017-2019 Brisk Menu Developers * * 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 2 of the License, or * (at your option) any later version. */ #define _GNU_SOURCE #include "util.h" BRISK_BEGIN_PEDANTIC #include "item.h" BRISK_END_PEDANTIC G_DEFINE_TYPE(BriskItem, brisk_item, G_TYPE_INITIALLY_UNOWNED) /** * brisk_item_dispose: * * Clean up a BriskItem instance */ static void brisk_item_dispose(GObject *obj) { G_OBJECT_CLASS(brisk_item_parent_class)->dispose(obj); } /** * brisk_item_class_init: * * Handle class initialisation */ static void brisk_item_class_init(BriskItemClass *klazz) { GObjectClass *obj_class = G_OBJECT_CLASS(klazz); /* gobject vtable hookup */ obj_class->dispose = brisk_item_dispose; } /** * brisk_item_init: * * Handle construction of the BriskItem */ static void brisk_item_init(__brisk_unused__ BriskItem *self) { } /** * brisk_item_get_id: * * Returns the unique ID for this item within the backend * @note This string belongs to the backend, and must not be freed by the caller */ const gchar *brisk_item_get_id(BriskItem *item) { g_assert(item != NULL); BriskItemClass *klazz = BRISK_ITEM_GET_CLASS(item); g_assert(klazz->get_id != NULL); return klazz->get_id(item); } /** * brisk_item_get_name: * * Returns the item name used when display the item in the menu * @note This string belongs to the item, and must not be freed by the caller */ const gchar *brisk_item_get_name(BriskItem *item) { g_assert(item != NULL); BriskItemClass *klazz = BRISK_ITEM_GET_CLASS(item); g_assert(klazz->get_name != NULL); return klazz->get_name(item); } /** * brisk_item_get_display_name: * * Returns the so-called "display name" (alternative name) for the entry * @note This string belongs to the item, and must not be freed by the caller */ const gchar *brisk_item_get_display_name(BriskItem *item) { g_assert(item != NULL); BriskItemClass *klazz = BRISK_ITEM_GET_CLASS(item); g_assert(klazz->get_display_name != NULL); return klazz->get_display_name(item); } /** * brisk_item_get_summary: * * Returns the summary used when display the item in the menu * @note This string belongs to the item, and must not be freed by the caller */ const gchar *brisk_item_get_summary(BriskItem *item) { g_assert(item != NULL); BriskItemClass *klazz = BRISK_ITEM_GET_CLASS(item); g_assert(klazz->get_summary != NULL); return klazz->get_summary(item); } /** * brisk_item_get_icon: * * Returns the icon used to display this item in the menu */ const GIcon *brisk_item_get_icon(BriskItem *item) { g_assert(item != NULL); BriskItemClass *klazz = BRISK_ITEM_GET_CLASS(item); if (!klazz->get_icon) { return NULL; } return klazz->get_icon(item); } /** * brisk_item_get_backend_id: * * Return the ID of the owning backend */ const gchar *brisk_item_get_backend_id(BriskItem *item) { g_assert(item != NULL); BriskItemClass *klazz = BRISK_ITEM_GET_CLASS(item); g_assert(klazz->get_backend_id != NULL); return klazz->get_backend_id(item); } /** * brisk_item_matches_search: * * Returns true if the item matches the given search term */ gboolean brisk_item_matches_search(BriskItem *item, gchar *term) { g_assert(item != NULL); BriskItemClass *klazz = BRISK_ITEM_GET_CLASS(item); g_return_val_if_fail(klazz->matches_search != NULL, FALSE); return klazz->matches_search(item, term); } /** * brisk_item_launch: * * Attempt to launch the item */ gboolean brisk_item_launch(BriskItem *item, GAppLaunchContext *context) { g_assert(item != NULL); BriskItemClass *klazz = BRISK_ITEM_GET_CLASS(item); g_return_val_if_fail(klazz->launch != NULL, FALSE); return klazz->launch(item, context); } /** * brisk_item_get_uri: * * Return the URI for this item, useful for dnd operations * * @note This returns newly allocated memory */ gchar *brisk_item_get_uri(BriskItem *item) { g_assert(item != NULL); BriskItemClass *klazz = BRISK_ITEM_GET_CLASS(item); g_return_val_if_fail(klazz->launch != NULL, NULL); return klazz->get_uri(item); } /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 8 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=8 tabstop=8 expandtab: * :indentSize=8:tabSize=8:noTabs=true: */ brisk-menu-0.6.0/src/backend/item.h000066400000000000000000000054271352323743400170740ustar00rootroot00000000000000/* * This file is part of brisk-menu. * * Copyright © 2017-2019 Brisk Menu Developers * * 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 2 of the License, or * (at your option) any later version. */ #pragma once #include #include G_BEGIN_DECLS typedef struct _BriskItem BriskItem; typedef struct _BriskItemClass BriskItemClass; struct _BriskItemClass { GInitiallyUnownedClass parent_class; /* These must be implemented by subclasses */ const gchar *(*get_id)(BriskItem *); const gchar *(*get_display_name)(BriskItem *); const gchar *(*get_name)(BriskItem *); const gchar *(*get_summary)(BriskItem *); const GIcon *(*get_icon)(BriskItem *); const gchar *(*get_backend_id)(BriskItem *); /* If the subclass supports searching, override this */ gboolean (*matches_search)(BriskItem *, gchar *); /* Support launching through primary click action */ gboolean (*launch)(BriskItem *, GAppLaunchContext *); /* For drag & drop */ gchar *(*get_uri)(BriskItem *); gpointer padding[12]; }; /** * BriskItem represents a single "thing" within Brisk, such as an application * launcher or file. */ struct _BriskItem { GInitiallyUnowned parent; }; #define BRISK_TYPE_ITEM brisk_item_get_type() #define BRISK_ITEM(o) (G_TYPE_CHECK_INSTANCE_CAST((o), BRISK_TYPE_ITEM, BriskItem)) #define BRISK_IS_ITEM(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), BRISK_TYPE_ITEM)) #define BRISK_ITEM_CLASS(o) (G_TYPE_CHECK_CLASS_CAST((o), BRISK_TYPE_ITEM, BriskItemClass)) #define BRISK_IS_ITEM_CLASS(o) (G_TYPE_CHECK_CLASS_TYPE((o), BRISK_TYPE_ITEM)) #define BRISK_ITEM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), BRISK_TYPE_ITEM, BriskItemClass)) GType brisk_item_get_type(void); /* API Methods Follow */ /* Core vfuncs required by everyone */ const gchar *brisk_item_get_id(BriskItem *item); const gchar *brisk_item_get_name(BriskItem *item); const gchar *brisk_item_get_display_name(BriskItem *item); const gchar *brisk_item_get_summary(BriskItem *item); const GIcon *brisk_item_get_icon(BriskItem *item); const gchar *brisk_item_get_backend_id(BriskItem *item); gboolean brisk_item_matches_search(BriskItem *item, gchar *term); /* Attempt to launch this item */ gboolean brisk_item_launch(BriskItem *item, GAppLaunchContext *context); gchar *brisk_item_get_uri(BriskItem *item); G_END_DECLS /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 8 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=8 tabstop=8 expandtab: * :indentSize=8:tabSize=8:noTabs=true: */ brisk-menu-0.6.0/src/backend/meson.build000066400000000000000000000015741352323743400201260ustar00rootroot00000000000000libbackend_sources = [ 'backend.c', 'item.c', 'section.c', 'all-items/all-backend.c', 'all-items/all-section.c', 'apps/apps-backend.c', 'apps/apps-item.c', 'apps/apps-section.c', 'favourites/favourites-backend.c', 'favourites/favourites-desktop.c', 'favourites/favourites-section.c', ] libbackend_dependencies = [ dep_mate_menu, dep_gio_unix, ] libbackend_includes = [ lib_h_dir, include_directories('.'), tree_include, ] # Contains the bulk of the internal Brisk Menu code libbackend = static_library( 'brisk-backend', sources: libbackend_sources, dependencies: libbackend_dependencies, include_directories: libbackend_includes, install: false, ) link_libbackend = declare_dependency( link_with: libbackend, dependencies: libbackend_dependencies, include_directories: libbackend_includes, ) brisk-menu-0.6.0/src/backend/section.c000066400000000000000000000102721352323743400175670ustar00rootroot00000000000000/* * This file is part of brisk-menu. * * Copyright © 2017-2019 Brisk Menu Developers * * 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 2 of the License, or * (at your option) any later version. */ #define _GNU_SOURCE #include "util.h" BRISK_BEGIN_PEDANTIC #include "section.h" BRISK_END_PEDANTIC G_DEFINE_TYPE(BriskSection, brisk_section, G_TYPE_INITIALLY_UNOWNED) /** * brisk_section_dispose: * * Clean up a BriskSection instance */ static void brisk_section_dispose(GObject *obj) { G_OBJECT_CLASS(brisk_section_parent_class)->dispose(obj); } /** * brisk_section_class_init: * * Handle class initialisation */ static void brisk_section_class_init(BriskSectionClass *klazz) { GObjectClass *obj_class = G_OBJECT_CLASS(klazz); /* gobject vtable hookup */ obj_class->dispose = brisk_section_dispose; } /** * brisk_section_init: * * Handle construction of the BriskSection */ static void brisk_section_init(__brisk_unused__ BriskSection *self) { } /** * brisk_section_get_id: * * Returns the unique ID for this section within the backend * @note This string belongs to the section, and must not be freed by the caller */ const gchar *brisk_section_get_id(BriskSection *section) { g_assert(section != NULL); BriskSectionClass *klazz = BRISK_SECTION_GET_CLASS(section); g_assert(klazz->get_id != NULL); return klazz->get_id(section); } /** * brisk_section_get_name: * * Returns the name used when displaying the section in the menu * @note This string belongs to the section, and must not be freed by the caller */ const gchar *brisk_section_get_name(BriskSection *section) { g_assert(section != NULL); BriskSectionClass *klazz = BRISK_SECTION_GET_CLASS(section); g_assert(klazz->get_name != NULL); return klazz->get_name(section); } /** * brisk_section_get_icon: * * Returns the Icon for this menu in the display. */ const GIcon *brisk_section_get_icon(BriskSection *section) { g_assert(section != NULL); BriskSectionClass *klazz = BRISK_SECTION_GET_CLASS(section); if (!klazz->get_icon) { return NULL; } return klazz->get_icon(section); } /** * brisk_section_get_backend_id: * * Return the ID for the backend that owns this section */ const gchar *brisk_section_get_backend_id(BriskSection *section) { g_assert(section != NULL); BriskSectionClass *klazz = BRISK_SECTION_GET_CLASS(section); g_assert(klazz->get_backend_id != NULL); return klazz->get_backend_id(section); } /** * brisk_section_can_show_item: * * Returns true if the items can be shown under this section */ gboolean brisk_section_can_show_item(BriskSection *section, BriskItem *item) { g_assert(section != NULL); BriskSectionClass *klazz = BRISK_SECTION_GET_CLASS(section); if (!klazz->can_show_item) { return FALSE; } return klazz->can_show_item(section, item); } /** * brisk_section_get_sort_order: * * Return a custom (override) sort order for a display item when not in * search mode. This is primarily only useful for backends that own * filter sections to show a specific order for another backends items. * * By default this function returns -1, meaning "do not custom sort", which * will force the frontend to use the built-in sorting. * * Backend implementations should take care to only sort items that they * care about or have some reference to, i.e. by type checking or ID checking. */ gint brisk_section_get_sort_order(BriskSection *section, BriskItem *item) { g_assert(section != NULL); BriskSectionClass *klazz = BRISK_SECTION_GET_CLASS(section); if (!klazz->get_sort_order) { return -1; } return klazz->get_sort_order(section, item); } /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 8 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=8 tabstop=8 expandtab: * :indentSize=8:tabSize=8:noTabs=true: */ brisk-menu-0.6.0/src/backend/section.h000066400000000000000000000050011352323743400175660ustar00rootroot00000000000000/* * This file is part of brisk-menu. * * Copyright © 2017-2019 Brisk Menu Developers * * 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 2 of the License, or * (at your option) any later version. */ #pragma once #include "item.h" #include #include G_BEGIN_DECLS typedef struct _BriskSection BriskSection; typedef struct _BriskSectionClass BriskSectionClass; struct _BriskSectionClass { GInitiallyUnownedClass parent_class; /* These must be implemented by subclasses */ const gchar *(*get_id)(BriskSection *); const gchar *(*get_name)(BriskSection *); const GIcon *(*get_icon)(BriskSection *); const gchar *(*get_backend_id)(BriskSection *); gboolean (*can_show_item)(BriskSection *, BriskItem *); gint (*get_sort_order)(BriskSection *, BriskItem *); gpointer padding[12]; }; /** * BriskSection provides the Section concept for sidebar entries within * the Brisk Menu */ struct _BriskSection { GInitiallyUnowned parent; }; #define BRISK_TYPE_SECTION brisk_section_get_type() #define BRISK_SECTION(o) (G_TYPE_CHECK_INSTANCE_CAST((o), BRISK_TYPE_SECTION, BriskSection)) #define BRISK_IS_SECTION(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), BRISK_TYPE_SECTION)) #define BRISK_SECTION_CLASS(o) (G_TYPE_CHECK_CLASS_CAST((o), BRISK_TYPE_SECTION, BriskSectionClass)) #define BRISK_IS_SECTION_CLASS(o) (G_TYPE_CHECK_CLASS_TYPE((o), BRISK_TYPE_SECTION)) #define BRISK_SECTION_GET_CLASS(o) \ (G_TYPE_INSTANCE_GET_CLASS((o), BRISK_TYPE_SECTION, BriskSectionClass)) GType brisk_section_get_type(void); /* API Methods Follow */ /* Core vfuncs required by everyone */ const gchar *brisk_section_get_id(BriskSection *section); const gchar *brisk_section_get_name(BriskSection *section); const GIcon *brisk_section_get_icon(BriskSection *section); const gchar *brisk_section_get_backend_id(BriskSection *section); gboolean brisk_section_can_show_item(BriskSection *section, BriskItem *item); gint brisk_section_get_sort_order(BriskSection *section, BriskItem *item); G_END_DECLS /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 8 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=8 tabstop=8 expandtab: * :indentSize=8:tabSize=8:noTabs=true: */ brisk-menu-0.6.0/src/frontend/000077500000000000000000000000001352323743400162055ustar00rootroot00000000000000brisk-menu-0.6.0/src/frontend/classic/000077500000000000000000000000001352323743400176265ustar00rootroot00000000000000brisk-menu-0.6.0/src/frontend/classic/category-button.c000066400000000000000000000147421352323743400231300ustar00rootroot00000000000000/* * This file is part of brisk-menu. * * Copyright © 2016-2019 Brisk Menu Developers * * 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 2 of the License, or * (at your option) any later version. */ #define _GNU_SOURCE #include "util.h" BRISK_BEGIN_PEDANTIC #include "category-button.h" #include "menu-private.h" #include #include BRISK_END_PEDANTIC struct _BriskClassicCategoryButtonClass { GtkRadioButtonClass parent_class; }; /** * BriskClassicCategoryButton is the toplevel window type used within the applet. */ struct _BriskClassicCategoryButton { GtkRadioButton parent; BriskSection *section; GtkWidget *label; GtkWidget *image; }; G_DEFINE_TYPE(BriskClassicCategoryButton, brisk_classic_category_button, GTK_TYPE_RADIO_BUTTON) enum { PROP_SECTION = 1, N_PROPS }; static GParamSpec *obj_properties[N_PROPS] = { NULL, }; static void brisk_classic_category_button_set_property(GObject *object, guint id, const GValue *value, GParamSpec *spec) { BriskClassicCategoryButton *self = BRISK_CLASSIC_CATEGORY_BUTTON(object); switch (id) { case PROP_SECTION: self->section = g_value_get_pointer(value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, id, spec); break; } } static void brisk_classic_category_button_get_property(GObject *object, guint id, GValue *value, GParamSpec *spec) { BriskClassicCategoryButton *self = BRISK_CLASSIC_CATEGORY_BUTTON(object); switch (id) { case PROP_SECTION: g_value_set_pointer(value, self->section); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, id, spec); break; } } /** * brisk_classic_category_button_new: * * Construct a new BriskClassicCategoryButton object */ GtkWidget *brisk_classic_category_button_new(BriskSection *section) { return g_object_new(BRISK_TYPE_CLASSIC_CATEGORY_BUTTON, "section", section, NULL); } /** * brisk_classic_category_button_dispose: * * Clean up a BriskClassicCategoryButton instance */ static void brisk_classic_category_button_dispose(GObject *obj) { BriskClassicCategoryButton *self = BRISK_CLASSIC_CATEGORY_BUTTON(obj); g_clear_object(&self->section); G_OBJECT_CLASS(brisk_classic_category_button_parent_class)->dispose(obj); } /** * Handle constructor specifics for our button */ static void brisk_classic_category_button_constructed(GObject *obj) { BriskClassicCategoryButton *self = NULL; self = BRISK_CLASSIC_CATEGORY_BUTTON(obj); /* If we have a section, use it, otherwise we're a special "All" button */ if (self->section) { gtk_label_set_label(GTK_LABEL(self->label), brisk_section_get_name(self->section)); gtk_image_set_from_gicon(GTK_IMAGE(self->image), (GIcon *)brisk_section_get_icon(self->section), GTK_ICON_SIZE_BUTTON); } else { gtk_label_set_label(GTK_LABEL(self->label), _("All")); gtk_image_set_from_icon_name(GTK_IMAGE(self->image), "starred", GTK_ICON_SIZE_BUTTON); } gtk_image_set_pixel_size(GTK_IMAGE(self->image), 16); G_OBJECT_CLASS(brisk_classic_category_button_parent_class)->constructed(obj); } /** * brisk_classic_category_button_class_init: * * Handle class initialisation */ static void brisk_classic_category_button_class_init(BriskClassicCategoryButtonClass *klazz) { GObjectClass *obj_class = G_OBJECT_CLASS(klazz); /* gobject vtable hookup */ obj_class->dispose = brisk_classic_category_button_dispose; obj_class->set_property = brisk_classic_category_button_set_property; obj_class->get_property = brisk_classic_category_button_get_property; obj_class->constructed = brisk_classic_category_button_constructed; obj_properties[PROP_SECTION] = g_param_spec_pointer("section", "The BriskSection", "Section that this category represents", G_PARAM_CONSTRUCT | G_PARAM_READWRITE); g_object_class_install_properties(obj_class, N_PROPS, obj_properties); } /** * brisk_classic_category_button_init: * * Handle construction of the BriskClassicCategoryButton */ static void brisk_classic_category_button_init(BriskClassicCategoryButton *self) { GtkStyleContext *style = NULL; GtkWidget *label = NULL; GtkWidget *image = NULL; GtkWidget *layout = NULL; /* Main layout */ layout = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); gtk_container_add(GTK_CONTAINER(self), layout); /* Image on the left */ image = gtk_image_new(); self->image = image; gtk_widget_set_margin_end(image, 7); gtk_box_pack_start(GTK_BOX(layout), image, FALSE, FALSE, 0); /* Display label */ label = gtk_label_new(""); self->label = label; g_object_set(self->label, "halign", GTK_ALIGN_START, "valign", GTK_ALIGN_CENTER, "margin-end", 15, NULL); gtk_box_pack_start(GTK_BOX(layout), label, TRUE, TRUE, 0); /* Button specific fixes */ gtk_widget_set_can_focus(GTK_WIDGET(self), FALSE); /* Look like a button */ g_object_set(G_OBJECT(self), "draw-indicator", FALSE, NULL); gtk_widget_set_can_focus(GTK_WIDGET(self), FALSE); /* Flatten the button */ style = gtk_widget_get_style_context(GTK_WIDGET(self)); gtk_style_context_add_class(style, GTK_STYLE_CLASS_FLAT); } /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 8 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=8 tabstop=8 expandtab: * :indentSize=8:tabSize=8:noTabs=true: */ brisk-menu-0.6.0/src/frontend/classic/category-button.h000066400000000000000000000051041352323743400231250ustar00rootroot00000000000000/* * This file is part of brisk-menu. * * Copyright © 2016-2019 Brisk Menu Developers * * 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 2 of the License, or * (at your option) any later version. */ #pragma once #include "backend/section.h" #include #include G_BEGIN_DECLS typedef struct _BriskClassicCategoryButton BriskClassicCategoryButton; typedef struct _BriskClassicCategoryButtonClass BriskClassicCategoryButtonClass; #define BRISK_TYPE_CLASSIC_CATEGORY_BUTTON brisk_classic_category_button_get_type() #define BRISK_CLASSIC_CATEGORY_BUTTON(o) \ (G_TYPE_CHECK_INSTANCE_CAST((o), \ BRISK_TYPE_CLASSIC_CATEGORY_BUTTON, \ BriskClassicCategoryButton)) #define BRISK_IS_CLASSIC_CATEGORY_BUTTON(o) \ (G_TYPE_CHECK_INSTANCE_TYPE((o), BRISK_TYPE_CLASSIC_CATEGORY_BUTTON)) #define BRISK_CLASSIC_CATEGORY_BUTTON_CLASS(o) \ (G_TYPE_CHECK_CLASS_CAST((o), \ BRISK_TYPE_CLASSIC_CATEGORY_BUTTON, \ BriskClassicCategoryButtonClass)) #define BRISK_IS_CLASSIC_CATEGORY_BUTTON_CLASS(o) \ (G_TYPE_CHECK_CLASS_TYPE((o), BRISK_TYPE_CLASSIC_CATEGORY_BUTTON)) #define BRISK_CLASSIC_CATEGORY_BUTTON_GET_CLASS(o) \ (G_TYPE_INSTANCE_GET_CLASS((o), \ BRISK_TYPE_CLASSIC_CATEGORY_BUTTON, \ BriskClassicCategoryButtonClass)) /** * Construct a new BriskClassicCategoryButton from the given group */ GtkWidget *brisk_classic_category_button_new(BriskSection *section); GType brisk_classic_category_button_get_type(void); G_END_DECLS /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 8 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=8 tabstop=8 expandtab: * :indentSize=8:tabSize=8:noTabs=true: */ brisk-menu-0.6.0/src/frontend/classic/classic-entry-button.c000066400000000000000000000112101352323743400240560ustar00rootroot00000000000000/* * This file is part of brisk-menu. * * Copyright © 2017-2019 Brisk Menu Developers * * 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 2 of the License, or * (at your option) any later version. */ #define _GNU_SOURCE #include "styles.h" #include "util.h" BRISK_BEGIN_PEDANTIC #include "classic-entry-button.h" #include BRISK_END_PEDANTIC G_DEFINE_TYPE(BriskClassicEntryButton, brisk_classic_entry_button, BRISK_TYPE_MENU_ENTRY_BUTTON) /** * Handle constructor specifics for our button */ static void brisk_classic_entry_button_constructed(GObject *obj) { BriskClassicEntryButton *self = NULL; const GIcon *icon = NULL; self = BRISK_CLASSIC_ENTRY_BUTTON(obj); icon = brisk_item_get_icon(BRISK_MENU_ENTRY_BUTTON(self)->item); if (icon) { gtk_image_set_from_gicon(GTK_IMAGE(self->image), (GIcon *)icon, GTK_ICON_SIZE_LARGE_TOOLBAR); } else { gtk_image_set_from_icon_name(GTK_IMAGE(self->image), "image-missing", GTK_ICON_SIZE_LARGE_TOOLBAR); } gtk_image_set_pixel_size(GTK_IMAGE(self->image), 24); /* Determine our label based on the app */ gtk_label_set_label(GTK_LABEL(self->label), brisk_item_get_name(BRISK_MENU_ENTRY_BUTTON(self)->item)); gtk_widget_set_tooltip_text(GTK_WIDGET(self), brisk_item_get_summary(BRISK_MENU_ENTRY_BUTTON(self)->item)); G_OBJECT_CLASS(brisk_classic_entry_button_parent_class)->constructed(obj); } static void brisk_classic_entry_button_dispose(GObject *obj) { G_OBJECT_CLASS(brisk_classic_entry_button_parent_class)->dispose(obj); } /** * brisk_classic_entry_button_class_init: * * Handle class initialisation */ static void brisk_classic_entry_button_class_init(BriskClassicEntryButtonClass *klazz) { GObjectClass *obj_class = G_OBJECT_CLASS(klazz); /* gobject vtable hookup */ obj_class->constructed = brisk_classic_entry_button_constructed; obj_class->dispose = brisk_classic_entry_button_dispose; } /** * brisk_classic_entry_button_init: * * Handle construction of the BriskClassicEntryButton */ static void brisk_classic_entry_button_init(BriskClassicEntryButton *self) { GtkStyleContext *style = NULL; GtkWidget *label = NULL; GtkWidget *image = NULL; GtkWidget *layout = NULL; /* Main layout */ layout = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); gtk_container_add(GTK_CONTAINER(self), layout); /* Image on the left */ image = gtk_image_new(); self->image = image; gtk_widget_set_margin_end(image, 7); gtk_box_pack_start(GTK_BOX(layout), image, FALSE, FALSE, 0); /* Display label */ label = gtk_label_new(""); gtk_label_set_ellipsize(GTK_LABEL(label), PANGO_ELLIPSIZE_END); gtk_label_set_max_width_chars(GTK_LABEL(label), 25); gtk_label_set_width_chars(GTK_LABEL(label), 25); self->label = label; g_object_set(self->label, "halign", GTK_ALIGN_START, "valign", GTK_ALIGN_CENTER, NULL); gtk_box_pack_start(GTK_BOX(layout), label, TRUE, TRUE, 0); G_GNUC_BEGIN_IGNORE_DEPRECATIONS gtk_misc_set_alignment(GTK_MISC(self->label), 0.0, 0.5); G_GNUC_END_IGNORE_DEPRECATIONS /* Button specific fixes */ gtk_button_set_relief(GTK_BUTTON(self), GTK_RELIEF_NONE); gtk_widget_set_can_focus(GTK_WIDGET(self), FALSE); /* Flatten the button */ style = gtk_widget_get_style_context(GTK_WIDGET(self)); gtk_style_context_add_class(style, GTK_STYLE_CLASS_FLAT); gtk_widget_show_all(layout); } /** * brisk_classic_entry_button_new: * * Return a newly created BriskClassicEntryButton */ GtkWidget *brisk_classic_entry_button_new(BriskMenuLauncher *launcher, BriskItem *item) { return g_object_new(BRISK_TYPE_CLASSIC_ENTRY_BUTTON, "launcher", launcher, "item", item, NULL); } /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 8 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=8 tabstop=8 expandtab: * :indentSize=8:tabSize=8:noTabs=true: */ brisk-menu-0.6.0/src/frontend/classic/classic-entry-button.h000066400000000000000000000052201352323743400240670ustar00rootroot00000000000000/* * This file is part of brisk-menu. * * Copyright © 2017-2019 Brisk Menu Developers * * 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 2 of the License, or * (at your option) any later version. */ #pragma once #include "../entry-button.h" #include #include G_BEGIN_DECLS typedef struct _BriskClassicEntryButton BriskClassicEntryButton; typedef struct _BriskClassicEntryButtonClass BriskClassicEntryButtonClass; struct _BriskClassicEntryButtonClass { BriskMenuEntryButtonClass parent_class; }; /** * BriskClassicEntryButton implements support for favourites in Brisk */ struct _BriskClassicEntryButton { BriskMenuEntryButton parent; /* Basic button layout */ GtkWidget *label; GtkWidget *image; }; #define BRISK_TYPE_CLASSIC_ENTRY_BUTTON brisk_classic_entry_button_get_type() #define BRISK_CLASSIC_ENTRY_BUTTON(o) \ (G_TYPE_CHECK_INSTANCE_CAST((o), BRISK_TYPE_CLASSIC_ENTRY_BUTTON, BriskClassicEntryButton)) #define BRISK_IS_CLASSIC_ENTRY_BUTTON(o) \ (G_TYPE_CHECK_INSTANCE_TYPE((o), BRISK_TYPE_CLASSIC_ENTRY_BUTTON)) #define BRISK_CLASSIC_ENTRY_BUTTON_CLASS(o) \ (G_TYPE_CHECK_CLASS_CAST((o), \ BRISK_TYPE_CLASSIC_ENTRY_BUTTON, \ BriskClassicEntryButtonClass)) #define BRISK_IS_CLASSIC_ENTRY_BUTTON_CLASS(o) \ (G_TYPE_CHECK_CLASS_TYPE((o), BRISK_TYPE_CLASSIC_ENTRY_BUTTON)) #define BRISK_CLASSIC_ENTRY_BUTTON_GET_CLASS(o) \ (G_TYPE_INSTANCE_GET_CLASS((o), \ BRISK_TYPE_CLASSIC_ENTRY_BUTTON, \ BriskClassicEntryButtonClass)) GType brisk_classic_entry_button_get_type(void); GtkWidget *brisk_classic_entry_button_new(BriskMenuLauncher *launcher, BriskItem *item); G_END_DECLS /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 8 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=8 tabstop=8 expandtab: * :indentSize=8:tabSize=8:noTabs=true: */ brisk-menu-0.6.0/src/frontend/classic/classic-window.c000066400000000000000000000740671352323743400227360ustar00rootroot00000000000000/* * This file is part of brisk-menu. * * Copyright © 2017-2019 Brisk Menu Developers * * 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 2 of the License, or * (at your option) any later version. */ #define _GNU_SOURCE #include "styles.h" #include "util.h" BRISK_BEGIN_PEDANTIC #include "../menu-private.h" #include "category-button.h" #include "classic-entry-button.h" #include "classic-window.h" #include "desktop-button.h" #include "sidebar-scroller.h" #include #include BRISK_END_PEDANTIC G_DEFINE_TYPE(BriskClassicWindow, brisk_classic_window, BRISK_TYPE_MENU_WINDOW) static void brisk_classic_window_associate_category(BriskMenuWindow *self, GtkWidget *button); static void brisk_classic_window_on_toggled(BriskMenuWindow *self, GtkWidget *button); static gboolean brisk_classic_window_on_enter(BriskMenuWindow *self, GdkEventCrossing *event, GtkWidget *button); static void brisk_classic_window_load_css(BriskClassicWindow *self); static void brisk_classic_window_key_activate(BriskClassicWindow *self, gpointer v); static void brisk_classic_window_activated(BriskMenuWindow *self, GtkListBoxRow *row, gpointer v); static void brisk_classic_window_setup_session_controls(BriskClassicWindow *self); static void brisk_classic_window_build_sidebar(BriskMenuWindow *self); static void brisk_classic_window_add_shortcut(BriskMenuWindow *self, const gchar *id); static void brisk_classic_window_set_filters_enabled(BriskClassicWindow *self, gboolean enabled); static gboolean brisk_classic_window_filter_apps(GtkListBoxRow *row, gpointer v); static gint brisk_classic_window_sort(GtkListBoxRow *row1, GtkListBoxRow *row2, gpointer v); /** * brisk_classic_window_dispose: * * Clean up a BriskClassicWindow instance */ static void brisk_classic_window_dispose(GObject *obj) { BriskClassicWindow *self = BRISK_CLASSIC_WINDOW(obj); GdkScreen *screen = NULL; if (self->css) { screen = gtk_widget_get_screen(GTK_WIDGET(self)); gtk_style_context_remove_provider_for_screen(screen, GTK_STYLE_PROVIDER(self->css)); g_clear_object(&self->css); } G_OBJECT_CLASS(brisk_classic_window_parent_class)->dispose(obj); } static const gchar *brisk_classic_window_get_id(__brisk_unused__ BriskMenuWindow *window) { return "classic"; } static const gchar *brisk_classic_window_get_display_name(__brisk_unused__ BriskMenuWindow *window) { return _("Classic"); } static void brisk_classic_window_update_screen_position(BriskMenuWindow *self) { GdkScreen *screen = NULL; GtkAllocation relative_alloc = { 0 }; GdkWindow *window = NULL; GdkRectangle geom = { 0 }; gint relative_x, relative_y = 0; /* Real X, Y of the applet, on screen */ gint window_width, window_height = 0; /* Window width & height */ gint mon = 0; /* Monitor to display on */ gint window_x, window_y = 0; /* Target X, Y */ if (!self->relative_to) { g_warning("Cannot set relative location without relative widget!"); return; } /* Forcibly realize the applet window */ if (!gtk_widget_get_realized(self->relative_to)) { gtk_widget_realize(self->relative_to); } /* Forcibly realize ourselves */ if (!gtk_widget_get_realized(GTK_WIDGET(self))) { gtk_widget_realize(GTK_WIDGET(self)); } gtk_widget_get_allocation(self->relative_to, &relative_alloc); /* Find out where we are on screen */ window = gtk_widget_get_window(self->relative_to); gdk_window_get_origin(window, &relative_x, &relative_y); /* Find out the window size */ gtk_window_get_size(GTK_WINDOW(self), &window_width, &window_height); /* Grab the geometry for the monitor we're currently on */ screen = gtk_widget_get_screen(self->relative_to); mon = gdk_screen_get_monitor_at_point(screen, relative_x, relative_y); gdk_screen_get_monitor_geometry(screen, mon, &geom); switch (self->position) { case GTK_POS_LEFT: /* Left vertical panel, appear to the RHS of it */ window_x = relative_x + relative_alloc.width; window_y = relative_y; break; case GTK_POS_RIGHT: /* Right vertical panel, appear to the LHS of it */ window_x = relative_x - window_width; window_y = relative_y; break; case GTK_POS_TOP: /* Top panel, appear below it */ window_x = relative_x; window_y = relative_y + relative_alloc.height; break; case GTK_POS_BOTTOM: default: /* Bottom panel, appear above it */ window_x = relative_x; window_y = relative_y - window_height; break; } /* Bound the right side */ if (window_x + window_width > (geom.x + geom.width)) { window_x = (geom.x + geom.width) - window_width; if (self->position == GTK_POS_RIGHT) { window_x -= relative_alloc.width; } } /* Bound the left side */ if (window_x < geom.x) { window_x = geom.x; if (self->position == GTK_POS_LEFT) { window_x -= relative_alloc.width; } } gtk_window_move(GTK_WINDOW(self), window_x, window_y); } /** * Update the position of the search bar in accordance with settings */ static void brisk_classic_window_update_search(BriskMenuWindow *self) { SearchPosition search_position = self->search_position; GtkWidget *layout = NULL; gint n_pos = 0; layout = gtk_bin_get_child(GTK_BIN(self)); if (search_position < SEARCH_POS_MIN || search_position >= SEARCH_POS_MAX) { search_position = SEARCH_POS_AUTOMATIC; } switch (search_position) { case SEARCH_POS_AUTOMATIC: /* Top panel, bottom search. Bottom panel, top search */ n_pos = self->position == GTK_POS_TOP ? 1 : 0; break; case SEARCH_POS_TOP: n_pos = 0; break; case SEARCH_POS_BOTTOM: default: n_pos = 1; break; } gtk_container_child_set(GTK_CONTAINER(layout), self->search, "position", n_pos, NULL); } /** * Backend has new items for us, add to the global store */ static void brisk_classic_window_add_item(BriskMenuWindow *self, BriskItem *item, __brisk_unused__ BriskBackend *backend) { GtkWidget *button = NULL; const gchar *item_id = brisk_item_get_id(item); button = brisk_classic_entry_button_new(self->launcher, item); g_signal_connect_swapped(button, "show-context-menu", G_CALLBACK(brisk_menu_window_show_context), self); gtk_container_add(GTK_CONTAINER(BRISK_CLASSIC_WINDOW(self)->apps), button); gtk_widget_show_all(button); g_hash_table_insert(self->item_store, g_strdup(item_id), button); } /** * Backend has a new sidebar section for us */ static void brisk_classic_window_add_section(BriskMenuWindow *self, BriskSection *section, __brisk_unused__ BriskBackend *backend) { GtkWidget *button = NULL; const gchar *section_id = brisk_section_get_id(section); GtkWidget *box_target = NULL; /* Skip dupes. Sections are uniquely namespaced */ if (g_hash_table_lookup(self->item_store, section_id) != NULL) { return; } box_target = brisk_menu_window_get_section_box(self, backend); button = brisk_classic_category_button_new(section); gtk_radio_button_join_group(GTK_RADIO_BUTTON(button), GTK_RADIO_BUTTON(self->section_box_leader)); gtk_box_pack_start(GTK_BOX(box_target), button, FALSE, FALSE, 0); brisk_classic_window_associate_category(self, button); gtk_widget_show_all(button); /* Avoid new dupes */ g_hash_table_insert(self->item_store, g_strdup(section_id), button); brisk_menu_window_select_sections(self); } /** * A backend needs us to invalidate the filters */ static void brisk_classic_window_invalidate_filter(BriskMenuWindow *self, __brisk_unused__ BriskBackend *backend) { gtk_list_box_invalidate_filter(GTK_LIST_BOX(BRISK_CLASSIC_WINDOW(self)->apps)); gtk_list_box_invalidate_sort(GTK_LIST_BOX(BRISK_CLASSIC_WINDOW(self)->apps)); } /** * A backend needs us to purge any data we have for it */ static void brisk_classic_window_reset(BriskMenuWindow *self, BriskBackend *backend) { GtkWidget *box_target = NULL; GList *kids = NULL, *elem = NULL; const gchar *backend_id = NULL; backend_id = brisk_backend_get_id(backend); box_target = brisk_menu_window_get_section_box(self, backend); gtk_container_foreach(GTK_CONTAINER(box_target), (GtkCallback)brisk_menu_window_remove_category, self); /* Manual work for the items */ kids = gtk_container_get_children(GTK_CONTAINER(BRISK_CLASSIC_WINDOW(self)->apps)); for (elem = kids; elem; elem = elem->next) { GtkWidget *row = elem->data; GtkWidget *child = NULL; BriskItem *item = NULL; const gchar *local_backend_id = NULL; const gchar *local_id = NULL; if (!GTK_IS_BIN(GTK_BIN(row))) { continue; } child = gtk_bin_get_child(GTK_BIN(row)); if (!BRISK_IS_MENU_ENTRY_BUTTON(child)) { continue; } g_object_get(child, "item", &item, NULL); if (!item) { g_warning("missing item for entry in backend '%s'", backend_id); continue; } local_backend_id = brisk_item_get_backend_id(item); if (!g_str_equal(backend_id, local_backend_id)) { continue; } local_id = brisk_item_get_id(item); g_hash_table_remove(self->item_store, local_id); gtk_widget_destroy(row); } g_list_free(kids); } /** * Override hiding so that we can invalidate all filters */ static void brisk_classic_window_hide(GtkWidget *widget) { BriskClassicWindow *self = NULL; GtkAdjustment *adjustment = NULL; /* Have parent deal with it first */ GTK_WIDGET_CLASS(brisk_classic_window_parent_class)->hide(widget); self = BRISK_CLASSIC_WINDOW(widget); /* Remove search filter */ gtk_entry_set_text(GTK_ENTRY(BRISK_MENU_WINDOW(self)->search), ""); brisk_menu_window_select_sections(BRISK_MENU_WINDOW(self)); /* Reset scrollbars */ adjustment = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(self->apps_scroll)); gtk_adjustment_set_value(adjustment, 0); adjustment = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(self->sidebar_scroll)); gtk_adjustment_set_value(adjustment, 0); /* Unselect any current "apps" */ gtk_list_box_select_row(GTK_LIST_BOX(self->apps), NULL); } /** * brisk_classic_window_class_init: * * Handle class initialisation */ static void brisk_classic_window_class_init(BriskClassicWindowClass *klazz) { GObjectClass *obj_class = G_OBJECT_CLASS(klazz); BriskMenuWindowClass *b_class = BRISK_MENU_WINDOW_CLASS(klazz); GtkWidgetClass *wid_class = GTK_WIDGET_CLASS(klazz); /* gobject vtable hookup */ obj_class->dispose = brisk_classic_window_dispose; /* Window vtable hookup */ b_class->get_id = brisk_classic_window_get_id; b_class->get_display_name = brisk_classic_window_get_display_name; b_class->update_screen_position = brisk_classic_window_update_screen_position; b_class->update_search = brisk_classic_window_update_search; b_class->add_item = brisk_classic_window_add_item; b_class->add_section = brisk_classic_window_add_section; b_class->invalidate_filter = brisk_classic_window_invalidate_filter; b_class->reset = brisk_classic_window_reset; /* widget vtable */ wid_class->hide = brisk_classic_window_hide; } /** * brisk_classic_window_init: * * Handle construction of the BriskClassicWindow */ static void brisk_classic_window_init(BriskClassicWindow *self) { GtkWidget *layout = NULL; GtkWidget *widget = NULL; GtkWidget *content = NULL; GtkWidget *scroll = NULL; GtkStyleContext *style = NULL; BriskMenuWindow *base; autofree(gchar) *txt_holder = NULL; autofree(gchar) *place_holder = NULL; brisk_classic_window_load_css(self); base = BRISK_MENU_WINDOW(self); style = gtk_widget_get_style_context(GTK_WIDGET(self)); gtk_style_context_add_class(style, BRISK_STYLE_MAIN); brisk_menu_window_configure_grabs(base); layout = gtk_box_new(GTK_ORIENTATION_VERTICAL, 2); gtk_container_add(GTK_CONTAINER(self), layout); /* Create search entry - but not GtkSearchEntry to avoid rounding in themes */ widget = gtk_entry_new(); gtk_entry_set_icon_from_icon_name(GTK_ENTRY(widget), GTK_ENTRY_ICON_PRIMARY, "edit-find-symbolic"); gtk_entry_set_icon_from_icon_name(GTK_ENTRY(widget), GTK_ENTRY_ICON_SECONDARY, "edit-clear-symbolic"); gtk_box_pack_start(GTK_BOX(layout), widget, FALSE, FALSE, 0); /* Translators: This is the text shown in the "search box" with no content */ txt_holder = g_strdup_printf("%s\u2026", _("Type to search")); gtk_entry_set_placeholder_text(GTK_ENTRY(widget), txt_holder); base->search = widget; g_signal_connect_swapped(widget, "changed", G_CALLBACK(brisk_menu_window_search), self); g_signal_connect_swapped(widget, "activate", G_CALLBACK(brisk_classic_window_key_activate), self); g_signal_connect(widget, "icon-press", G_CALLBACK(brisk_menu_window_clear_search), self); /* Content layout */ content = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 2); gtk_box_pack_start(GTK_BOX(layout), content, TRUE, TRUE, 0); /* Sidebar for categories */ widget = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); scroll = brisk_menu_sidebar_scroller_new(); base->section_box_holder = widget; style = gtk_widget_get_style_context(base->section_box_holder); gtk_style_context_add_class(style, BRISK_STYLE_SIDEBAR); self->sidebar_scroll = scroll; gtk_container_add(GTK_CONTAINER(scroll), widget); /* Create a wrapper for the categories */ widget = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); gtk_box_pack_start(GTK_BOX(widget), scroll, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(content), widget, TRUE, TRUE, 0); self->sidebar_wrap = widget; /* Scrollbar for apps */ scroll = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scroll), GTK_SHADOW_IN); gtk_box_pack_start(GTK_BOX(content), scroll, TRUE, TRUE, 0); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); gtk_scrolled_window_set_overlay_scrolling(GTK_SCROLLED_WINDOW(scroll), FALSE); self->apps_scroll = scroll; /* Application launcher display */ widget = gtk_list_box_new(); gtk_container_add(GTK_CONTAINER(scroll), widget); self->apps = widget; gtk_list_box_set_activate_on_single_click(GTK_LIST_BOX(self->apps), TRUE); gtk_list_box_set_selection_mode(GTK_LIST_BOX(self->apps), GTK_SELECTION_SINGLE); g_signal_connect_swapped(self->apps, "row-activated", G_CALLBACK(brisk_classic_window_activated), self); /* Style up the app box */ style = gtk_widget_get_style_context(widget); gtk_style_context_add_class(style, BRISK_STYLE_APPS_LIST); gtk_style_context_add_class(style, "view"); gtk_style_context_add_class(style, "content-view"); gtk_style_context_remove_class(style, "background"); /* Translators: This message is shown when the search results are empty */ place_holder = g_strdup_printf("%s", _("Sorry, no items found")); widget = gtk_label_new(place_holder); /* Add a placeholder when there are no apps for current search term */ gtk_label_set_use_markup(GTK_LABEL(widget), TRUE); g_object_set(widget, "halign", GTK_ALIGN_CENTER, "valign", GTK_ALIGN_START, "margin", 6, NULL); style = gtk_widget_get_style_context(widget); gtk_style_context_add_class(style, "dim-label"); gtk_list_box_set_placeholder(GTK_LIST_BOX(self->apps), widget); gtk_widget_show_all(widget); brisk_classic_window_setup_session_controls(self); gtk_window_set_default_size(GTK_WINDOW(self), 300, 510); /* Hook up keyboard events */ g_signal_connect(self, "key-release-event", G_CALLBACK(brisk_menu_window_key_release), NULL); g_signal_connect(self, "key-press-event", G_CALLBACK(brisk_menu_window_key_press), NULL); brisk_classic_window_build_sidebar(base); brisk_menu_window_init_backends(base); /* Hook up dbus later on */ g_idle_add((GSourceFunc)brisk_menu_window_setup_session, self); gtk_widget_show_all(layout); } /* * brisk_classic_window_new: * * Return a newly created BriskClassicWindow */ BriskMenuWindow *brisk_classic_window_new(GtkWidget *relative_to) { return g_object_new(BRISK_TYPE_CLASSIC_WINDOW, "type", GTK_WINDOW_POPUP, "relative-to", relative_to, NULL); } /** * brisk_classic_window_associate_category: * * This will hook up the category button for events to enable us to filter the * list based on the active category. */ static void brisk_classic_window_associate_category(BriskMenuWindow *self, GtkWidget *button) { g_signal_connect_swapped(button, "toggled", G_CALLBACK(brisk_classic_window_on_toggled), self); g_signal_connect_swapped(button, "enter-notify-event", G_CALLBACK(brisk_classic_window_on_enter), self); } /** * Fired by clicking a category button */ static void brisk_classic_window_on_toggled(BriskMenuWindow *self, GtkWidget *button) { BriskClassicCategoryButton *cat = NULL; /* Skip a double signal due to using a group */ if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button))) { return; } cat = BRISK_CLASSIC_CATEGORY_BUTTON(button); g_object_get(cat, "section", &self->active_section, NULL); /* Start the filter. */ brisk_classic_window_invalidate_filter(self, NULL); } /** * Fired by entering into the category button with a roll over */ static gboolean brisk_classic_window_on_enter(BriskMenuWindow *self, __brisk_unused__ GdkEventCrossing *event, GtkWidget *button) { GtkToggleButton *but = GTK_TOGGLE_BUTTON(button); /* Whether we're in rollover mode */ if (!self->rollover) { return GDK_EVENT_PROPAGATE; } if (gtk_toggle_button_get_active(but) || !gtk_widget_get_visible(button)) { return GDK_EVENT_PROPAGATE; } /* Force activation through rollover */ gtk_toggle_button_set_active(but, TRUE); return GDK_EVENT_PROPAGATE; } /** * Load up the CSS assets */ static void brisk_classic_window_load_css(BriskClassicWindow *self) { GtkCssProvider *css = NULL; autofree(GFile) *file = NULL; autofree(GError) *err = NULL; GdkScreen *screen = NULL; file = g_file_new_for_uri("resource://com/solus-project/brisk/menu/classic/styling.css"); if (!file) { return; } css = gtk_css_provider_new(); self->css = css; screen = gtk_widget_get_screen(GTK_WIDGET(self)); gtk_style_context_add_provider_for_screen(screen, GTK_STYLE_PROVIDER(css), GTK_STYLE_PROVIDER_PRIORITY_FALLBACK); if (!gtk_css_provider_load_from_file(css, file, &err)) { g_warning("Failed to load CSS: %s\n", err->message); return; } } static void brisk_classic_window_key_activate(BriskClassicWindow *self, __brisk_unused__ gpointer v) { autofree(GList) *kids = NULL; GList *elem = NULL; BriskMenuEntryButton *button = NULL; kids = gtk_container_get_children(GTK_CONTAINER(self->apps)); for (elem = kids; elem; elem = elem->next) { GtkWidget *widget = elem->data; if (!gtk_widget_get_visible(widget) || !gtk_widget_get_child_visible(widget)) { continue; } button = BRISK_MENU_ENTRY_BUTTON(gtk_bin_get_child(GTK_BIN(widget))); break; } if (!button) { return; } brisk_menu_entry_button_launch(button); } static void brisk_classic_window_activated(__brisk_unused__ BriskMenuWindow *self, GtkListBoxRow *row, __brisk_unused__ gpointer v) { BriskMenuEntryButton *button = NULL; GtkWidget *child = NULL; child = gtk_bin_get_child(GTK_BIN(row)); if (!child) { return; } if (!BRISK_IS_MENU_ENTRY_BUTTON(child)) { return; } button = BRISK_MENU_ENTRY_BUTTON(child); brisk_menu_entry_button_launch(button); } /** * Create the graphical buttons for session control */ static void brisk_classic_window_setup_session_controls(BriskClassicWindow *self) { GtkWidget *widget = NULL; GtkWidget *box = NULL; GtkStyleContext *style = NULL; box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); gtk_widget_set_margin_bottom(box, 4); gtk_box_pack_end(GTK_BOX(self->sidebar_wrap), box, FALSE, FALSE, 0); gtk_widget_set_halign(box, GTK_ALIGN_CENTER); /* Add a separator for visual consistency */ widget = gtk_separator_new(GTK_ORIENTATION_HORIZONTAL); gtk_box_pack_end(GTK_BOX(self->sidebar_wrap), widget, FALSE, FALSE, 3); /* Logout */ widget = gtk_button_new_from_icon_name("brisk_system-log-out-symbolic", GTK_ICON_SIZE_MENU); self->button_logout = widget; g_signal_connect_swapped(widget, "clicked", G_CALLBACK(brisk_menu_window_logout), self); gtk_widget_set_tooltip_text(widget, _("End the current session")); gtk_widget_set_can_focus(widget, FALSE); gtk_container_add(GTK_CONTAINER(box), widget); style = gtk_widget_get_style_context(widget); gtk_style_context_add_class(style, GTK_STYLE_CLASS_FLAT); gtk_style_context_add_class(style, "session-button"); /* Lock */ widget = gtk_button_new_from_icon_name("system-lock-screen-symbolic", GTK_ICON_SIZE_SMALL_TOOLBAR); self->button_lock = widget; g_signal_connect_swapped(widget, "clicked", G_CALLBACK(brisk_menu_window_lock), self); gtk_widget_set_tooltip_text(widget, _("Lock the screen")); gtk_widget_set_can_focus(widget, FALSE); gtk_container_add(GTK_CONTAINER(box), widget); style = gtk_widget_get_style_context(widget); gtk_style_context_add_class(style, GTK_STYLE_CLASS_FLAT); gtk_style_context_add_class(style, "session-button"); /* Shutdown */ widget = gtk_button_new_from_icon_name("system-shutdown-symbolic", GTK_ICON_SIZE_SMALL_TOOLBAR); self->button_shutdown = widget; g_signal_connect_swapped(widget, "clicked", G_CALLBACK(brisk_menu_window_shutdown), self); gtk_widget_set_tooltip_text(widget, _("Turn off the device")); gtk_widget_set_can_focus(widget, FALSE); gtk_container_add(GTK_CONTAINER(box), widget); style = gtk_widget_get_style_context(widget); gtk_style_context_add_class(style, GTK_STYLE_CLASS_FLAT); gtk_style_context_add_class(style, "session-button"); } /** * Begin a build of the menu structure */ static void brisk_classic_window_build_sidebar(BriskMenuWindow *self) { GtkWidget *sep = NULL; autofree(gstrv) *shortcuts = NULL; brisk_classic_window_set_filters_enabled(BRISK_CLASSIC_WINDOW(self), FALSE); /* Special leader to control group association, hidden from view */ self->section_box_leader = gtk_radio_button_new(NULL); gtk_box_pack_start(GTK_BOX(self->section_box_holder), self->section_box_leader, FALSE, FALSE, 0); gtk_widget_set_no_show_all(self->section_box_leader, TRUE); gtk_widget_hide(self->section_box_leader); /* Separate the things */ sep = gtk_separator_new(GTK_ORIENTATION_HORIZONTAL); gtk_box_pack_start(GTK_BOX(self->section_box_holder), sep, FALSE, FALSE, 5); gtk_widget_show_all(sep); /* Load the shortcuts up */ shortcuts = g_settings_get_strv(self->settings, "pinned-shortcuts"); if (!shortcuts) { return; } /* Add from gsettings */ for (guint i = 0; i < g_strv_length(shortcuts); i++) { brisk_classic_window_add_shortcut(self, shortcuts[i]); } brisk_classic_window_set_filters_enabled(BRISK_CLASSIC_WINDOW(self), TRUE); } /** * brisk_classic_window_add_shortcut * * If we can create a .desktop launcher for the given name, add a new button to * the sidebar as a quick launch facility. */ static void brisk_classic_window_add_shortcut(BriskMenuWindow *self, const gchar *id) { GDesktopAppInfo *info = NULL; GtkWidget *button = NULL; info = g_desktop_app_info_new(id); if (!info) { g_message("Not adding missing %s to BriskMenu", id); return; } button = brisk_menu_desktop_button_new(self->launcher, G_APP_INFO(info)); gtk_widget_show_all(button); gtk_box_pack_start(GTK_BOX(self->section_box_holder), button, FALSE, FALSE, 1); } /** * Enable or disable the filters between building of the menus */ static void brisk_classic_window_set_filters_enabled(BriskClassicWindow *self, gboolean enabled) { BRISK_MENU_WINDOW(self)->filtering = enabled; if (enabled) { gtk_list_box_set_filter_func(GTK_LIST_BOX(self->apps), brisk_classic_window_filter_apps, self, NULL); gtk_list_box_set_sort_func(GTK_LIST_BOX(self->apps), brisk_classic_window_sort, self, NULL); return; } gtk_list_box_set_filter_func(GTK_LIST_BOX(self->apps), NULL, NULL, NULL); gtk_list_box_set_sort_func(GTK_LIST_BOX(self->apps), NULL, NULL, NULL); } /** * brisk_classic_window_filter_apps: * * Responsible for filtering the selection based on active group or search * term. */ __brisk_pure__ static gboolean brisk_classic_window_filter_apps(GtkListBoxRow *row, gpointer v) { BriskMenuWindow *self = NULL; GtkWidget *child = NULL; self = BRISK_MENU_WINDOW(v); if (!self->filtering) { return FALSE; } /* Grab our Entry widget */ child = gtk_bin_get_child(GTK_BIN(row)); return brisk_menu_window_filter_apps(self, child); } static gint brisk_classic_window_sort(GtkListBoxRow *row1, GtkListBoxRow *row2, gpointer v) { GtkWidget *child1, *child2 = NULL; BriskItem *itemA, *itemB = NULL; autofree(gchar) *nameA = NULL; autofree(gchar) *nameB = NULL; BriskMenuWindow *self = NULL; self = BRISK_MENU_WINDOW(v); child1 = gtk_bin_get_child(GTK_BIN(row1)); child2 = gtk_bin_get_child(GTK_BIN(row2)); g_object_get(child1, "item", &itemA, NULL); g_object_get(child2, "item", &itemB, NULL); return brisk_menu_window_sort(self, itemA, itemB); } /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 8 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=8 tabstop=8 expandtab: * :indentSize=8:tabSize=8:noTabs=true: */ brisk-menu-0.6.0/src/frontend/classic/classic-window.h000066400000000000000000000046631352323743400227360ustar00rootroot00000000000000/* * This file is part of brisk-menu. * * Copyright © 2017-2019 Brisk Menu Developers * * 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 2 of the License, or * (at your option) any later version. */ #pragma once #include "../menu-private.h" #include #include G_BEGIN_DECLS typedef struct _BriskClassicWindow BriskClassicWindow; typedef struct _BriskClassicWindowClass BriskClassicWindowClass; struct _BriskClassicWindowClass { BriskMenuWindowClass parent_class; }; /** * BriskClassicWindow implements support for favourites in Brisk */ struct _BriskClassicWindow { BriskMenuWindow parent; GtkWidget *relative_to; /* Categories */ GtkWidget *sidebar_scroll; /* VBox for the sidebar container */ GtkWidget *sidebar_wrap; /* Actual applications */ GtkWidget *apps; GtkWidget *apps_scroll; /* CSS Provider */ GtkCssProvider *css; /* Session management buttons */ GtkWidget *button_lock; GtkWidget *button_logout; GtkWidget *button_shutdown; }; #define BRISK_TYPE_CLASSIC_WINDOW brisk_classic_window_get_type() #define BRISK_CLASSIC_WINDOW(o) \ (G_TYPE_CHECK_INSTANCE_CAST((o), BRISK_TYPE_CLASSIC_WINDOW, BriskClassicWindow)) #define BRISK_IS_CLASSIC_WINDOW(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), BRISK_TYPE_CLASSIC_WINDOW)) #define BRISK_CLASSIC_WINDOW_CLASS(o) \ (G_TYPE_CHECK_CLASS_CAST((o), BRISK_TYPE_CLASSIC_WINDOW, BriskClassicWindowClass)) #define BRISK_IS_CLASSIC_WINDOW_CLASS(o) (G_TYPE_CHECK_CLASS_TYPE((o), BRISK_TYPE_CLASSIC_WINDOW)) #define BRISK_CLASSIC_WINDOW_GET_CLASS(o) \ (G_TYPE_INSTANCE_GET_CLASS((o), BRISK_TYPE_CLASSIC_WINDOW, BriskClassicWindowClass)) GType brisk_classic_window_get_type(void); BriskMenuWindow *brisk_classic_window_new(GtkWidget *relative_to); G_END_DECLS /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 8 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=8 tabstop=8 expandtab: * :indentSize=8:tabSize=8:noTabs=true: */ brisk-menu-0.6.0/src/frontend/classic/desktop-button.c000066400000000000000000000160611352323743400227600ustar00rootroot00000000000000/* * This file is part of brisk-menu. * * Copyright © 2016-2019 Brisk Menu Developers * * 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 2 of the License, or * (at your option) any later version. */ #define _GNU_SOURCE #include "util.h" BRISK_BEGIN_PEDANTIC #include "desktop-button.h" #include "menu-private.h" #include BRISK_END_PEDANTIC struct _BriskMenuDesktopButtonClass { GtkButtonClass parent_class; }; /** * BriskMenuDesktopButton is the toplevel window type used within the applet. */ struct _BriskMenuDesktopButton { GtkButton parent; GAppInfo *desktop; GtkWidget *label; GtkWidget *image; BriskMenuLauncher *launcher; }; G_DEFINE_TYPE(BriskMenuDesktopButton, brisk_menu_desktop_button, GTK_TYPE_BUTTON) static void brisk_menu_desktop_button_clicked(GtkButton *button); enum { PROP_DESKTOP = 1, PROP_LAUNCHER, N_PROPS }; static GParamSpec *obj_properties[N_PROPS] = { NULL, }; static void brisk_menu_desktop_button_set_property(GObject *object, guint id, const GValue *value, GParamSpec *spec) { BriskMenuDesktopButton *self = BRISK_MENU_DESKTOP_BUTTON(object); switch (id) { case PROP_DESKTOP: self->desktop = g_value_get_pointer(value); break; case PROP_LAUNCHER: self->launcher = g_value_get_pointer(value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, id, spec); break; } } static void brisk_menu_desktop_button_get_property(GObject *object, guint id, GValue *value, GParamSpec *spec) { BriskMenuDesktopButton *self = BRISK_MENU_DESKTOP_BUTTON(object); switch (id) { case PROP_DESKTOP: g_value_set_pointer(value, self->desktop); break; case PROP_LAUNCHER: g_value_set_pointer(value, self->launcher); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, id, spec); break; } } /** * brisk_menu_desktop_button_new: * * Construct a new BriskMenuDesktopButton object */ GtkWidget *brisk_menu_desktop_button_new(BriskMenuLauncher *launcher, GAppInfo *desktop) { return g_object_new(BRISK_TYPE_MENU_DESKTOP_BUTTON, "launcher", launcher, "desktop", desktop, NULL); } /** * brisk_menu_desktop_button_dispose: * * Clean up a BriskMenuDesktopButton instance */ static void brisk_menu_desktop_button_dispose(GObject *obj) { BriskMenuDesktopButton *self = NULL; self = BRISK_MENU_DESKTOP_BUTTON(obj); g_clear_object(&self->desktop); G_OBJECT_CLASS(brisk_menu_desktop_button_parent_class)->dispose(obj); } /** * Handle constructor specifics for our button */ static void brisk_menu_desktop_button_constructed(GObject *obj) { const gchar *label = NULL; BriskMenuDesktopButton *self = NULL; self = BRISK_MENU_DESKTOP_BUTTON(obj); gtk_image_set_from_gicon(GTK_IMAGE(self->image), g_app_info_get_icon(self->desktop), GTK_ICON_SIZE_BUTTON); gtk_image_set_pixel_size(GTK_IMAGE(self->image), 16); /* Determine our label based on the app */ label = g_app_info_get_display_name(self->desktop); gtk_label_set_label(GTK_LABEL(self->label), label); gtk_widget_set_tooltip_text(GTK_WIDGET(self), g_app_info_get_description(self->desktop)); G_OBJECT_CLASS(brisk_menu_desktop_button_parent_class)->constructed(obj); } /** * brisk_menu_desktop_button_class_init: * * Handle class initialisation */ static void brisk_menu_desktop_button_class_init(BriskMenuDesktopButtonClass *klazz) { GObjectClass *obj_class = G_OBJECT_CLASS(klazz); GtkButtonClass *but_class = GTK_BUTTON_CLASS(klazz); /* gobject vtable hookup */ obj_class->dispose = brisk_menu_desktop_button_dispose; obj_class->set_property = brisk_menu_desktop_button_set_property; obj_class->get_property = brisk_menu_desktop_button_get_property; obj_class->constructed = brisk_menu_desktop_button_constructed; /* button vtable hookup */ but_class->clicked = brisk_menu_desktop_button_clicked; obj_properties[PROP_DESKTOP] = g_param_spec_pointer("desktop", "The GAppInfo", "Desktop file", G_PARAM_CONSTRUCT | G_PARAM_READWRITE); obj_properties[PROP_LAUNCHER] = g_param_spec_pointer("launcher", "The Brisk Launcher", "Launcher used for starting apps", G_PARAM_CONSTRUCT | G_PARAM_READWRITE); g_object_class_install_properties(obj_class, N_PROPS, obj_properties); } /** * brisk_menu_desktop_button_init: * * Handle construction of the BriskMenuDesktopButton */ static void brisk_menu_desktop_button_init(BriskMenuDesktopButton *self) { GtkStyleContext *style = NULL; GtkWidget *label = NULL; GtkWidget *image = NULL; GtkWidget *layout = NULL; /* Main layout */ layout = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); gtk_container_add(GTK_CONTAINER(self), layout); /* Image on the left */ image = gtk_image_new(); self->image = image; gtk_widget_set_margin_end(image, 7); gtk_box_pack_start(GTK_BOX(layout), image, FALSE, FALSE, 0); /* Display label */ label = gtk_label_new(""); self->label = label; g_object_set(self->label, "halign", GTK_ALIGN_START, "valign", GTK_ALIGN_CENTER, NULL); gtk_box_pack_start(GTK_BOX(layout), label, TRUE, TRUE, 0); /* Button specific fixes */ gtk_widget_set_can_focus(GTK_WIDGET(self), FALSE); gtk_button_set_relief(GTK_BUTTON(self), GTK_RELIEF_NONE); /* Flatten the button */ style = gtk_widget_get_style_context(GTK_WIDGET(self)); gtk_style_context_add_class(style, GTK_STYLE_CLASS_FLAT); } static void brisk_menu_desktop_button_clicked(GtkButton *button) { BriskMenuDesktopButton *self = NULL; self = BRISK_MENU_DESKTOP_BUTTON(button); brisk_menu_launcher_start(self->launcher, GTK_WIDGET(self), self->desktop); } /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 8 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=8 tabstop=8 expandtab: * :indentSize=8:tabSize=8:noTabs=true: */ brisk-menu-0.6.0/src/frontend/classic/desktop-button.h000066400000000000000000000043351352323743400227660ustar00rootroot00000000000000/* * This file is part of brisk-menu. * * Copyright © 2016-2019 Brisk Menu Developers * * 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 2 of the License, or * (at your option) any later version. */ #pragma once #include #include #include "launcher.h" G_BEGIN_DECLS typedef struct _BriskMenuDesktopButton BriskMenuDesktopButton; typedef struct _BriskMenuDesktopButtonClass BriskMenuDesktopButtonClass; #define BRISK_TYPE_MENU_DESKTOP_BUTTON brisk_menu_desktop_button_get_type() #define BRISK_MENU_DESKTOP_BUTTON(o) \ (G_TYPE_CHECK_INSTANCE_CAST((o), BRISK_TYPE_MENU_DESKTOP_BUTTON, BriskMenuDesktopButton)) #define BRISK_IS_MENU_DESKTOP_BUTTON(o) \ (G_TYPE_CHECK_INSTANCE_TYPE((o), BRISK_TYPE_MENU_DESKTOP_BUTTON)) #define BRISK_MENU_DESKTOP_BUTTON_CLASS(o) \ (G_TYPE_CHECK_CLASS_CAST((o), BRISK_TYPE_MENU_DESKTOP_BUTTON, BriskMenuDesktopButtonClass)) #define BRISK_IS_MENU_DESKTOP_BUTTON_CLASS(o) \ (G_TYPE_CHECK_CLASS_TYPE((o), BRISK_TYPE_MENU_DESKTOP_BUTTON)) #define BRISK_MENU_DESKTOP_BUTTON_GET_CLASS(o) \ (G_TYPE_INSTANCE_GET_CLASS((o), \ BRISK_TYPE_MENU_DESKTOP_BUTTON, \ BriskMenuDesktopButtonClass)) /** * Construct a new BriskMenuDesktopButton from the given desktop entry */ GtkWidget *brisk_menu_desktop_button_new(BriskMenuLauncher *launcher, GAppInfo *desktop); GType brisk_menu_desktop_button_get_type(void); G_END_DECLS /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 8 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=8 tabstop=8 expandtab: * :indentSize=8:tabSize=8:noTabs=true: */ brisk-menu-0.6.0/src/frontend/classic/sidebar-scroller.c000066400000000000000000000102271352323743400232300ustar00rootroot00000000000000/* * This file is part of brisk-menu. * * Copyright © 2017-2019 Brisk Menu Developers * * 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 2 of the License, or * (at your option) any later version. */ #define _GNU_SOURCE #include "util.h" BRISK_BEGIN_PEDANTIC #include "sidebar-scroller.h" #include BRISK_END_PEDANTIC struct _BriskMenuSidebarScrollerClass { GtkScrolledWindowClass parent_class; }; struct _BriskMenuSidebarScroller { GtkScrolledWindow parent; }; G_DEFINE_TYPE(BriskMenuSidebarScroller, brisk_menu_sidebar_scroller, GTK_TYPE_SCROLLED_WINDOW) static void brisk_menu_sidebar_scroller_get_preferred_height(GtkWidget *widget, gint *min_height, gint *nat_height); /** * brisk_menu_sidebar_scroller_new: * * Construct a new BriskMenuSidebarScroller object */ GtkWidget *brisk_menu_sidebar_scroller_new() { return g_object_new(BRISK_TYPE_MENU_SIDEBAR_SCROLLER, "hadjustment", NULL, "vadjustment", NULL, NULL); } /** * brisk_menu_sidebar_scroller_class_init: * * Handle class initialisation */ static void brisk_menu_sidebar_scroller_class_init(BriskMenuSidebarScrollerClass *klazz) { GtkWidgetClass *wid_class = GTK_WIDGET_CLASS(klazz); wid_class->get_preferred_height = brisk_menu_sidebar_scroller_get_preferred_height; } /** * brisk_menu_sidebar_scroller_init: * * Handle construction of the BriskMenuEntryButton */ static void brisk_menu_sidebar_scroller_init(BriskMenuSidebarScroller *self) { gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(self), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); gtk_scrolled_window_set_overlay_scrolling(GTK_SCROLLED_WINDOW(self), FALSE); } static void brisk_menu_sidebar_scroller_get_preferred_height(GtkWidget *widget, gint *min_height, gint *nat_height) { GdkScreen *screen = NULL; GdkWindow *window = NULL; GtkStyleContext *style_context = NULL; GtkStateFlags state_flags; GtkBorder border; GtkBorder padding; GtkBorder margin; gint spacing; GdkRectangle geom = { 0 }; gint applet_x, applet_y = 0; gint mon = 0; /* Find out where we are on screen */ window = gtk_widget_get_window(widget); gdk_window_get_origin(window, &applet_x, &applet_y); /* Grab the geometry for the monitor we're currently on */ screen = gtk_widget_get_screen(widget); mon = gdk_screen_get_monitor_at_point(screen, applet_x, applet_y); gdk_screen_get_monitor_geometry(screen, mon, &geom); gint max_height = geom.height - 200; GtkBin *bin = NULL; GtkWidget *child = NULL; bin = GTK_BIN(widget); child = gtk_bin_get_child(bin); style_context = gtk_widget_get_style_context(widget); state_flags = gtk_widget_get_state_flags(widget); gtk_style_context_get_border(style_context, state_flags, &border); gtk_style_context_get_padding(style_context, state_flags, &padding); gtk_style_context_get_margin(style_context, state_flags, &margin); spacing = border.top + border.bottom + padding.top + padding.bottom + margin.top + margin.bottom; if (child) { gtk_widget_get_preferred_height(child, min_height, nat_height); *min_height = MIN(max_height, *min_height) + spacing; *nat_height = MIN(max_height, *nat_height) + spacing; } else { *min_height = *nat_height = 0; } } /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 8 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=8 tabstop=8 expandtab: * :indentSize=8:tabSize=8:noTabs=true: */ brisk-menu-0.6.0/src/frontend/classic/sidebar-scroller.h000066400000000000000000000047451352323743400232450ustar00rootroot00000000000000/* * This file is part of brisk-menu. * * Copyright © 2017-2019 Brisk Menu Developers * * 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 2 of the License, or * (at your option) any later version. */ #pragma once #include #include G_BEGIN_DECLS typedef struct _BriskMenuSidebarScroller BriskMenuSidebarScroller; typedef struct _BriskMenuSidebarScrollerClass BriskMenuSidebarScrollerClass; #define BRISK_TYPE_MENU_SIDEBAR_SCROLLER brisk_menu_sidebar_scroller_get_type() #define BRISK_MENU_SIDEBAR_SCROLLER(o) \ (G_TYPE_CHECK_INSTANCE_CAST((o), \ BRISK_TYPE_MENU_SIDEBAR_SCROLLER, \ BriskMenuSidebarScroller)) #define BRISK_IS_MENU_SIDEBAR_SCROLLER(o) \ (G_TYPE_CHECK_INSTANCE_TYPE((o), BRISK_TYPE_MENU_SIDEBAR_SCROLLER)) #define BRISK_MENU_SIDEBAR_SCROLLER_CLASS(o) \ (G_TYPE_CHECK_CLASS_CAST((o), \ BRISK_TYPE_MENU_SIDEBAR_SCROLLER, \ BriskMenuSidebarScrollerClass)) #define BRISK_IS_MENU_SIDEBAR_SCROLLER_CLASS(o) \ (G_TYPE_CHECK_CLASS_TYPE((o), BRISK_TYPE_MENU_SIDEBAR_SCROLLER)) #define BRISK_MENU_SIDEBAR_SCROLLER_GET_CLASS(o) \ (G_TYPE_INSTANCE_GET_CLASS((o), \ BRISK_TYPE_MENU_SIDEBAR_SCROLLER, \ BriskMenuSidebarScrollerClass)) /** * Construct a new BriskMenuSidebarScroller */ GtkWidget *brisk_menu_sidebar_scroller_new(void); GType brisk_menu_sidebar_scroller_get_type(void); G_END_DECLS /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 8 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=8 tabstop=8 expandtab: * :indentSize=8:tabSize=8:noTabs=true: */ brisk-menu-0.6.0/src/frontend/dash/000077500000000000000000000000001352323743400171245ustar00rootroot00000000000000brisk-menu-0.6.0/src/frontend/dash/category-button.c000066400000000000000000000130511352323743400224160ustar00rootroot00000000000000/* * This file is part of brisk-menu. * * Copyright © 2016-2019 Brisk Menu Developers * * 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 2 of the License, or * (at your option) any later version. */ #define _GNU_SOURCE #include "util.h" BRISK_BEGIN_PEDANTIC #include "category-button.h" #include "menu-private.h" #include #include BRISK_END_PEDANTIC struct _BriskDashCategoryButtonClass { GtkRadioButtonClass parent_class; }; /** * BriskDashCategoryButton is the toplevel window type used within the applet. */ struct _BriskDashCategoryButton { GtkRadioButton parent; BriskSection *section; GtkWidget *label; }; G_DEFINE_TYPE(BriskDashCategoryButton, brisk_dash_category_button, GTK_TYPE_RADIO_BUTTON) enum { PROP_SECTION = 1, N_PROPS }; static GParamSpec *obj_properties[N_PROPS] = { NULL, }; static void brisk_dash_category_button_set_property(GObject *object, guint id, const GValue *value, GParamSpec *spec) { BriskDashCategoryButton *self = BRISK_DASH_CATEGORY_BUTTON(object); switch (id) { case PROP_SECTION: self->section = g_value_get_pointer(value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, id, spec); break; } } static void brisk_dash_category_button_get_property(GObject *object, guint id, GValue *value, GParamSpec *spec) { BriskDashCategoryButton *self = BRISK_DASH_CATEGORY_BUTTON(object); switch (id) { case PROP_SECTION: g_value_set_pointer(value, self->section); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, id, spec); break; } } /** * brisk_dash_category_button_new: * * Construct a new BriskDashCategoryButton object */ GtkWidget *brisk_dash_category_button_new(BriskSection *section) { return g_object_new(BRISK_TYPE_DASH_CATEGORY_BUTTON, "section", section, NULL); } /** * brisk_dash_category_button_dispose: * * Clean up a BriskDashCategoryButton instance */ static void brisk_dash_category_button_dispose(GObject *obj) { BriskDashCategoryButton *self = BRISK_DASH_CATEGORY_BUTTON(obj); g_clear_object(&self->section); G_OBJECT_CLASS(brisk_dash_category_button_parent_class)->dispose(obj); } /** * Handle constructor specifics for our button */ static void brisk_dash_category_button_constructed(GObject *obj) { BriskDashCategoryButton *self = NULL; self = BRISK_DASH_CATEGORY_BUTTON(obj); /* If we have a section, use it, otherwise we're a special "All" button */ if (self->section) { gtk_label_set_label(GTK_LABEL(self->label), brisk_section_get_name(self->section)); } else { gtk_label_set_label(GTK_LABEL(self->label), _("All")); } G_OBJECT_CLASS(brisk_dash_category_button_parent_class)->constructed(obj); } /** * brisk_dash_category_button_class_init: * * Handle class initialisation */ static void brisk_dash_category_button_class_init(BriskDashCategoryButtonClass *klazz) { GObjectClass *obj_class = G_OBJECT_CLASS(klazz); /* gobject vtable hookup */ obj_class->dispose = brisk_dash_category_button_dispose; obj_class->set_property = brisk_dash_category_button_set_property; obj_class->get_property = brisk_dash_category_button_get_property; obj_class->constructed = brisk_dash_category_button_constructed; obj_properties[PROP_SECTION] = g_param_spec_pointer("section", "The BriskSection", "Section that this category represents", G_PARAM_CONSTRUCT | G_PARAM_READWRITE); g_object_class_install_properties(obj_class, N_PROPS, obj_properties); } /** * brisk_dash_category_button_init: * * Handle construction of the BriskDashCategoryButton */ static void brisk_dash_category_button_init(BriskDashCategoryButton *self) { GtkStyleContext *style = NULL; GtkWidget *label = NULL; GtkWidget *layout = NULL; /* Main layout */ layout = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); gtk_container_add(GTK_CONTAINER(self), layout); /* Display label */ label = gtk_label_new(""); self->label = label; g_object_set(self->label, "halign", GTK_ALIGN_START, "valign", GTK_ALIGN_CENTER, NULL); gtk_box_pack_start(GTK_BOX(layout), label, TRUE, TRUE, 0); /* Button specific fixes */ gtk_widget_set_can_focus(GTK_WIDGET(self), FALSE); /* Look like a button */ g_object_set(G_OBJECT(self), "draw-indicator", FALSE, NULL); gtk_widget_set_can_focus(GTK_WIDGET(self), FALSE); /* Flatten the button */ style = gtk_widget_get_style_context(GTK_WIDGET(self)); gtk_style_context_add_class(style, GTK_STYLE_CLASS_FLAT); gtk_style_context_add_class(style, "dash-category-button"); } /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 8 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=8 tabstop=8 expandtab: * :indentSize=8:tabSize=8:noTabs=true: */ brisk-menu-0.6.0/src/frontend/dash/category-button.h000066400000000000000000000045661352323743400224360ustar00rootroot00000000000000/* * This file is part of brisk-menu. * * Copyright © 2016-2019 Brisk Menu Developers * * 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 2 of the License, or * (at your option) any later version. */ #pragma once #include "backend/section.h" #include #include G_BEGIN_DECLS typedef struct _BriskDashCategoryButton BriskDashCategoryButton; typedef struct _BriskDashCategoryButtonClass BriskDashCategoryButtonClass; #define BRISK_TYPE_DASH_CATEGORY_BUTTON brisk_dash_category_button_get_type() #define BRISK_DASH_CATEGORY_BUTTON(o) \ (G_TYPE_CHECK_INSTANCE_CAST((o), BRISK_TYPE_DASH_CATEGORY_BUTTON, BriskDashCategoryButton)) #define BRISK_IS_DASH_CATEGORY_BUTTON(o) \ (G_TYPE_CHECK_INSTANCE_TYPE((o), BRISK_TYPE_DASH_CATEGORY_BUTTON)) #define BRISK_DASH_CATEGORY_BUTTON_CLASS(o) \ (G_TYPE_CHECK_CLASS_CAST((o), \ BRISK_TYPE_DASH_CATEGORY_BUTTON, \ BriskDashCategoryButtonClass)) #define BRISK_IS_DASH_CATEGORY_BUTTON_CLASS(o) \ (G_TYPE_CHECK_CLASS_TYPE((o), BRISK_TYPE_DASH_CATEGORY_BUTTON)) #define BRISK_DASH_CATEGORY_BUTTON_GET_CLASS(o) \ (G_TYPE_INSTANCE_GET_CLASS((o), \ BRISK_TYPE_DASH_CATEGORY_BUTTON, \ BriskDashCategoryButtonClass)) /** * Construct a new BriskDashCategoryButton from the given group */ GtkWidget *brisk_dash_category_button_new(BriskSection *section); GType brisk_dash_category_button_get_type(void); G_END_DECLS /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 8 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=8 tabstop=8 expandtab: * :indentSize=8:tabSize=8:noTabs=true: */ brisk-menu-0.6.0/src/frontend/dash/dash-entry-button.c000066400000000000000000000110301352323743400226520ustar00rootroot00000000000000/* * This file is part of brisk-menu. * * Copyright © 2017-2019 Brisk Menu Developers * * 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 2 of the License, or * (at your option) any later version. */ #define _GNU_SOURCE #include "styles.h" #include "util.h" BRISK_BEGIN_PEDANTIC #include "dash-entry-button.h" #include BRISK_END_PEDANTIC G_DEFINE_TYPE(BriskDashEntryButton, brisk_dash_entry_button, BRISK_TYPE_MENU_ENTRY_BUTTON) /** * Handle constructor specifics for our button */ static void brisk_dash_entry_button_constructed(GObject *obj) { BriskDashEntryButton *self = NULL; const GIcon *icon = NULL; self = BRISK_DASH_ENTRY_BUTTON(obj); icon = brisk_item_get_icon(BRISK_MENU_ENTRY_BUTTON(self)->item); if (icon) { gtk_image_set_from_gicon(GTK_IMAGE(self->image), (GIcon *)icon, GTK_ICON_SIZE_LARGE_TOOLBAR); } else { gtk_image_set_from_icon_name(GTK_IMAGE(self->image), "image-missing", GTK_ICON_SIZE_LARGE_TOOLBAR); } gtk_image_set_pixel_size(GTK_IMAGE(self->image), 64); /* Determine our label based on the app */ gtk_label_set_label(GTK_LABEL(self->label), brisk_item_get_name(BRISK_MENU_ENTRY_BUTTON(self)->item)); gtk_widget_set_tooltip_text(GTK_WIDGET(self), brisk_item_get_summary(BRISK_MENU_ENTRY_BUTTON(self)->item)); G_OBJECT_CLASS(brisk_dash_entry_button_parent_class)->constructed(obj); } static void brisk_dash_entry_button_dispose(GObject *obj) { G_OBJECT_CLASS(brisk_dash_entry_button_parent_class)->dispose(obj); } /** * brisk_dash_entry_button_class_init: * * Handle class initialisation */ static void brisk_dash_entry_button_class_init(BriskDashEntryButtonClass *klazz) { GObjectClass *obj_class = G_OBJECT_CLASS(klazz); /* gobject vtable hookup */ obj_class->constructed = brisk_dash_entry_button_constructed; obj_class->dispose = brisk_dash_entry_button_dispose; } /** * brisk_dash_entry_button_init: * * Handle construction of the BriskDashEntryButton */ static void brisk_dash_entry_button_init(BriskDashEntryButton *self) { GtkStyleContext *style = NULL; GtkWidget *label = NULL; GtkWidget *image = NULL; GtkWidget *layout = NULL; /* Main layout */ layout = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); gtk_container_add(GTK_CONTAINER(self), layout); /* Image on the left */ image = gtk_image_new(); self->image = image; gtk_widget_set_margin_bottom(image, 7); gtk_box_pack_start(GTK_BOX(layout), image, FALSE, FALSE, 0); /* Display label */ label = gtk_label_new(""); self->label = label; gtk_label_set_lines(GTK_LABEL(label), 2); gtk_label_set_ellipsize(GTK_LABEL(label), PANGO_ELLIPSIZE_END); gtk_label_set_max_width_chars(GTK_LABEL(label), 15); gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); g_object_set(self->label, "halign", GTK_ALIGN_CENTER, "valign", GTK_ALIGN_START, "justify", GTK_JUSTIFY_CENTER, NULL); gtk_box_pack_start(GTK_BOX(layout), label, TRUE, TRUE, 0); /* Button specific fixes */ gtk_button_set_relief(GTK_BUTTON(self), GTK_RELIEF_NONE); gtk_widget_set_can_focus(GTK_WIDGET(self), FALSE); /* Flatten the button */ style = gtk_widget_get_style_context(GTK_WIDGET(self)); gtk_style_context_add_class(style, GTK_STYLE_CLASS_FLAT); gtk_widget_show_all(layout); } /** * brisk_dash_entry_button_new: * * Return a newly created BriskDashEntryButton */ BriskMenuEntryButton *brisk_dash_entry_button_new(BriskMenuLauncher *launcher, BriskItem *item) { return g_object_new(BRISK_TYPE_DASH_ENTRY_BUTTON, "launcher", launcher, "item", item, NULL); } /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 8 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=8 tabstop=8 expandtab: * :indentSize=8:tabSize=8:noTabs=true: */ brisk-menu-0.6.0/src/frontend/dash/dash-entry-button.h000066400000000000000000000044331352323743400226700ustar00rootroot00000000000000/* * This file is part of brisk-menu. * * Copyright © 2017-2019 Brisk Menu Developers * * 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 2 of the License, or * (at your option) any later version. */ #pragma once #include "../entry-button.h" #include #include G_BEGIN_DECLS typedef struct _BriskDashEntryButton BriskDashEntryButton; typedef struct _BriskDashEntryButtonClass BriskDashEntryButtonClass; struct _BriskDashEntryButtonClass { BriskMenuEntryButtonClass parent_class; }; /** * BriskDashEntryButton implements support for favourites in Brisk */ struct _BriskDashEntryButton { BriskMenuEntryButton parent; /* Basic button layout */ GtkWidget *label; GtkWidget *image; }; #define BRISK_TYPE_DASH_ENTRY_BUTTON brisk_dash_entry_button_get_type() #define BRISK_DASH_ENTRY_BUTTON(o) \ (G_TYPE_CHECK_INSTANCE_CAST((o), BRISK_TYPE_DASH_ENTRY_BUTTON, BriskDashEntryButton)) #define BRISK_IS_DASH_ENTRY_BUTTON(o) \ (G_TYPE_CHECK_INSTANCE_TYPE((o), BRISK_TYPE_DASH_ENTRY_BUTTON)) #define BRISK_DASH_ENTRY_BUTTON_CLASS(o) \ (G_TYPE_CHECK_CLASS_CAST((o), BRISK_TYPE_DASH_ENTRY_BUTTON, BriskDashEntryButtonClass)) #define BRISK_IS_DASH_ENTRY_BUTTON_CLASS(o) \ (G_TYPE_CHECK_CLASS_TYPE((o), BRISK_TYPE_DASH_ENTRY_BUTTON)) #define BRISK_DASH_ENTRY_BUTTON_GET_CLASS(o) \ (G_TYPE_INSTANCE_GET_CLASS((o), BRISK_TYPE_DASH_ENTRY_BUTTON, BriskDashEntryButtonClass)) GType brisk_dash_entry_button_get_type(void); BriskMenuEntryButton *brisk_dash_entry_button_new(BriskMenuLauncher *launcher, BriskItem *item); G_END_DECLS /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 8 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=8 tabstop=8 expandtab: * :indentSize=8:tabSize=8:noTabs=true: */ brisk-menu-0.6.0/src/frontend/dash/dash-window.c000066400000000000000000000625121352323743400215220ustar00rootroot00000000000000/* * This file is part of brisk-menu. * * Copyright © 2017-2019 Brisk Menu Developers * * 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 2 of the License, or * (at your option) any later version. */ #define _GNU_SOURCE #include "styles.h" #include "util.h" BRISK_BEGIN_PEDANTIC #include "category-button.h" #include "dash-entry-button.h" #include "dash-window.h" #include BRISK_END_PEDANTIC G_DEFINE_TYPE(BriskDashWindow, brisk_dash_window, BRISK_TYPE_MENU_WINDOW) static void brisk_dash_window_associate_category(BriskMenuWindow *self, GtkWidget *button); static void brisk_dash_window_on_toggled(BriskMenuWindow *self, GtkWidget *button); static gboolean brisk_dash_window_on_enter(BriskMenuWindow *self, GdkEventCrossing *event, GtkWidget *button); static void brisk_dash_window_load_css(GtkSettings *settings, const gchar *key, BriskDashWindow *self); static void brisk_dash_window_key_activate(BriskDashWindow *self, gpointer v); static void brisk_dash_window_activated(BriskMenuWindow *self, GtkFlowBoxChild *row, gpointer v); static void brisk_dash_window_set_filters_enabled(BriskDashWindow *self, gboolean enabled); static gboolean brisk_dash_window_filter_apps(GtkFlowBoxChild *row, gpointer v); static gint brisk_dash_window_sort(GtkFlowBoxChild *row1, GtkFlowBoxChild *row2, gpointer v); /** * brisk_dash_window_dispose: * * Clean up a BriskDashWindow instance */ static void brisk_dash_window_dispose(GObject *obj) { BriskDashWindow *self = BRISK_DASH_WINDOW(obj); GdkScreen *screen = NULL; if (self->css) { screen = gtk_widget_get_screen(GTK_WIDGET(self)); gtk_style_context_remove_provider_for_screen(screen, GTK_STYLE_PROVIDER(self->css)); g_clear_object(&self->css); } G_OBJECT_CLASS(brisk_dash_window_parent_class)->dispose(obj); } static const gchar *brisk_dash_window_get_id(__brisk_unused__ BriskMenuWindow *window) { return "dash"; } static const gchar *brisk_dash_window_get_display_name(__brisk_unused__ BriskMenuWindow *window) { return _("Dash"); } static void brisk_dash_window_update_screen_position(BriskMenuWindow *self) { GdkScreen *screen = NULL; GtkAllocation relative_alloc = { 0 }; GdkWindow *window = NULL; GdkRectangle geom = { 0 }; gint relative_x, relative_y = 0; /* Real X, Y of the applet, on screen */ gint window_width, window_height = 0; /* Window width & height */ gint mon = 0; /* Monitor to display on */ gint window_x, window_y = 0; /* Target X, Y */ if (!self->relative_to) { g_warning("Cannot set relative location without relative widget!"); return; } /* Forcibly realize the applet window */ if (!gtk_widget_get_realized(self->relative_to)) { gtk_widget_realize(self->relative_to); } /* Forcibly realize ourselves */ if (!gtk_widget_get_realized(GTK_WIDGET(self))) { gtk_widget_realize(GTK_WIDGET(self)); } gtk_widget_get_allocation(self->relative_to, &relative_alloc); /* Find out where we are on screen */ window = gtk_widget_get_window(self->relative_to); gdk_window_get_origin(window, &relative_x, &relative_y); /* Grab the geometry for the monitor we're currently on */ screen = gtk_widget_get_screen(self->relative_to); mon = gdk_screen_get_monitor_at_point(screen, relative_x, relative_y); gdk_screen_get_monitor_geometry(screen, mon, &geom); switch (self->position) { case GTK_POS_LEFT: window_width = geom.width - relative_alloc.width; window_height = geom.height; window_x = geom.x + relative_alloc.width; window_y = geom.y; break; case GTK_POS_RIGHT: window_width = geom.width - relative_alloc.width; window_height = geom.height; window_x = geom.x; window_y = geom.y; break; case GTK_POS_TOP: /* Top panel, appear below it */ window_width = geom.width; window_height = geom.height - relative_alloc.height; window_x = geom.x; window_y = relative_y + relative_alloc.height; break; case GTK_POS_BOTTOM: default: /* Bottom panel, appear above it */ window_width = geom.width; window_height = geom.height - relative_alloc.height; window_x = geom.x; window_y = geom.y; break; } gtk_window_set_default_size(GTK_WINDOW(self), window_width, window_height); gtk_window_move(GTK_WINDOW(self), window_x, window_y); } /** * Backend has new items for us, add to the global store */ static void brisk_dash_window_add_item(BriskMenuWindow *self, BriskItem *item, __brisk_unused__ BriskBackend *backend) { BriskMenuEntryButton *button = NULL; const gchar *item_id = brisk_item_get_id(item); button = brisk_dash_entry_button_new(self->launcher, item); g_signal_connect_swapped(button, "show-context-menu", G_CALLBACK(brisk_menu_window_show_context), self); gtk_container_add(GTK_CONTAINER(BRISK_DASH_WINDOW(self)->apps), GTK_WIDGET(button)); gtk_widget_show_all(GTK_WIDGET(button)); g_hash_table_insert(self->item_store, g_strdup(item_id), GTK_WIDGET(button)); } /** * Backend has a new sidebar section for us */ static void brisk_dash_window_add_section(BriskMenuWindow *self, BriskSection *section, __brisk_unused__ BriskBackend *backend) { GtkWidget *button = NULL; const gchar *section_id = brisk_section_get_id(section); GtkWidget *box_target = NULL; /* Skip dupes. Sections are uniquely namespaced */ if (g_hash_table_lookup(self->item_store, section_id) != NULL) { return; } box_target = brisk_menu_window_get_section_box(self, backend); gtk_orientable_set_orientation(GTK_ORIENTABLE(box_target), GTK_ORIENTATION_HORIZONTAL); button = brisk_dash_category_button_new(section); gtk_radio_button_join_group(GTK_RADIO_BUTTON(button), GTK_RADIO_BUTTON(self->section_box_leader)); gtk_box_pack_start(GTK_BOX(box_target), button, FALSE, FALSE, 0); brisk_dash_window_associate_category(self, button); gtk_widget_show_all(button); /* Avoid new dupes */ g_hash_table_insert(self->item_store, g_strdup(section_id), button); brisk_menu_window_select_sections(self); } /** * A backend needs us to invalidate the filters */ static void brisk_dash_window_invalidate_filter(BriskMenuWindow *self, __brisk_unused__ BriskBackend *backend) { gtk_flow_box_invalidate_filter(GTK_FLOW_BOX(BRISK_DASH_WINDOW(self)->apps)); gtk_flow_box_invalidate_sort(GTK_FLOW_BOX(BRISK_DASH_WINDOW(self)->apps)); } /** * A backend needs us to purge any data we have for it */ static void brisk_dash_window_reset(BriskMenuWindow *self, BriskBackend *backend) { GtkWidget *box_target = NULL; GList *kids = NULL, *elem = NULL; const gchar *backend_id = NULL; backend_id = brisk_backend_get_id(backend); box_target = brisk_menu_window_get_section_box(self, backend); gtk_container_foreach(GTK_CONTAINER(box_target), (GtkCallback)brisk_menu_window_remove_category, self); /* Manual work for the items */ kids = gtk_container_get_children(GTK_CONTAINER(BRISK_DASH_WINDOW(self)->apps)); for (elem = kids; elem; elem = elem->next) { GtkWidget *row = elem->data; GtkWidget *child = NULL; BriskItem *item = NULL; const gchar *local_backend_id = NULL; const gchar *local_id = NULL; if (!GTK_IS_BIN(GTK_BIN(row))) { continue; } child = gtk_bin_get_child(GTK_BIN(row)); if (!BRISK_IS_MENU_ENTRY_BUTTON(child)) { continue; } g_object_get(child, "item", &item, NULL); if (!item) { g_warning("missing item for entry in backend '%s'", backend_id); continue; } local_backend_id = brisk_item_get_backend_id(item); if (!g_str_equal(backend_id, local_backend_id)) { continue; } local_id = brisk_item_get_id(item); g_hash_table_remove(self->item_store, local_id); gtk_widget_destroy(row); } g_list_free(kids); } /** * Override hiding so that we can invalidate all filters */ static void brisk_dash_window_hide(GtkWidget *widget) { BriskDashWindow *self = NULL; GtkAdjustment *adjustment = NULL; autofree(GList) *selected_children = NULL; GtkWidget *selected = NULL; /* Have parent deal with it first */ GTK_WIDGET_CLASS(brisk_dash_window_parent_class)->hide(widget); self = BRISK_DASH_WINDOW(widget); /* Remove search filter */ gtk_entry_set_text(GTK_ENTRY(BRISK_MENU_WINDOW(self)->search), ""); brisk_menu_window_select_sections(BRISK_MENU_WINDOW(self)); /* Reset scrollbars */ adjustment = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(self->apps_scroll)); gtk_adjustment_set_value(adjustment, 0); adjustment = gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(self->categories_scroll)); gtk_adjustment_set_value(adjustment, 0); /* Unselect any current "apps" */ selected_children = gtk_flow_box_get_selected_children(GTK_FLOW_BOX(self->apps)); selected = g_list_nth_data(selected_children, 0); if (selected) { gtk_flow_box_unselect_child(GTK_FLOW_BOX(self->apps), GTK_FLOW_BOX_CHILD(selected)); } } /** * brisk_dash_window_class_init: * * Handle class initialisation */ static void brisk_dash_window_class_init(BriskDashWindowClass *klazz) { GObjectClass *obj_class = G_OBJECT_CLASS(klazz); BriskMenuWindowClass *b_class = BRISK_MENU_WINDOW_CLASS(klazz); GtkWidgetClass *wid_class = GTK_WIDGET_CLASS(klazz); /* gobject vtable hookup */ obj_class->dispose = brisk_dash_window_dispose; /* Backend vtable hookup */ b_class->get_id = brisk_dash_window_get_id; b_class->get_display_name = brisk_dash_window_get_display_name; b_class->update_screen_position = brisk_dash_window_update_screen_position; b_class->add_item = brisk_dash_window_add_item; b_class->add_section = brisk_dash_window_add_section; b_class->invalidate_filter = brisk_dash_window_invalidate_filter; b_class->reset = brisk_dash_window_reset; wid_class->hide = brisk_dash_window_hide; } /** * brisk_dash_window_init: * * Handle construction of the BriskDashWindow */ static void brisk_dash_window_init(BriskDashWindow *self) { GtkWidget *layout = NULL; GtkWidget *widget = NULL; GtkWidget *scroll = NULL; GtkWidget *header = NULL; GtkWidget *content = NULL; GdkScreen *screen = NULL; GtkStyleContext *style = NULL; BriskMenuWindow *base = NULL; GtkSettings *gtk_settings = NULL; autofree(gchar) *txt_holder = NULL; base = BRISK_MENU_WINDOW(self); brisk_dash_window_load_css(gtk_settings, "gtk-theme-name", self); gtk_settings = gtk_settings_get_default(); g_signal_connect(gtk_settings, "notify::gtk-theme-name", G_CALLBACK(brisk_dash_window_load_css), self); style = gtk_widget_get_style_context(GTK_WIDGET(self)); gtk_style_context_add_class(style, BRISK_STYLE_MAIN); gtk_style_context_add_class(style, BRISK_STYLE_DASH); brisk_menu_window_configure_grabs(base); layout = gtk_box_new(GTK_ORIENTATION_VERTICAL, 2); gtk_container_add(GTK_CONTAINER(self), layout); header = gtk_box_new(GTK_ORIENTATION_VERTICAL, 2); style = gtk_widget_get_style_context(GTK_WIDGET(header)); gtk_style_context_add_class(style, "header"); gtk_box_pack_start(GTK_BOX(layout), header, FALSE, FALSE, 0); /* Create search entry */ widget = gtk_entry_new(); gtk_entry_set_icon_from_icon_name(GTK_ENTRY(widget), GTK_ENTRY_ICON_PRIMARY, "edit-find-symbolic"); gtk_entry_set_icon_from_icon_name(GTK_ENTRY(widget), GTK_ENTRY_ICON_SECONDARY, "edit-clear-symbolic"); gtk_box_pack_start(GTK_BOX(header), widget, FALSE, FALSE, 20); gtk_entry_set_width_chars(GTK_ENTRY(widget), 55); gtk_widget_set_valign(widget, GTK_ALIGN_CENTER); gtk_widget_set_halign(widget, GTK_ALIGN_CENTER); /* Translators: This is the text shown in the "search box" with no content */ txt_holder = g_strdup_printf("%s\u2026", _("Type to search")); gtk_entry_set_placeholder_text(GTK_ENTRY(widget), txt_holder); base->search = widget; g_signal_connect_swapped(widget, "changed", G_CALLBACK(brisk_menu_window_search), self); g_signal_connect_swapped(widget, "activate", G_CALLBACK(brisk_dash_window_key_activate), self); g_signal_connect(widget, "icon-press", G_CALLBACK(brisk_menu_window_clear_search), self); /* Scrollbar for categories */ scroll = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scroll), GTK_SHADOW_NONE); gtk_box_pack_start(GTK_BOX(header), scroll, FALSE, FALSE, 0); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll), GTK_POLICY_AUTOMATIC, GTK_POLICY_NEVER); gtk_widget_set_can_focus(scroll, FALSE); gtk_scrolled_window_set_overlay_scrolling(GTK_SCROLLED_WINDOW(scroll), TRUE); self->categories_scroll = scroll; /* Container for categories */ widget = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); gtk_container_add(GTK_CONTAINER(scroll), widget); base->section_box_holder = widget; style = gtk_widget_get_style_context(widget); gtk_style_context_add_class(style, "section-box-holder"); /* Content layout */ content = gtk_box_new(GTK_ORIENTATION_VERTICAL, 2); gtk_box_pack_start(GTK_BOX(layout), content, TRUE, TRUE, 0); /* Scrollbar for apps */ scroll = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scroll), GTK_SHADOW_NONE); gtk_box_pack_start(GTK_BOX(content), scroll, TRUE, TRUE, 0); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); gtk_scrolled_window_set_overlay_scrolling(GTK_SCROLLED_WINDOW(scroll), FALSE); self->apps_scroll = scroll; /* Application launcher display */ widget = gtk_flow_box_new(); gtk_widget_set_margin_top(widget, 50); gtk_widget_set_margin_bottom(widget, 50); gtk_widget_set_margin_start(widget, 150); gtk_widget_set_margin_end(widget, 150); gtk_container_add(GTK_CONTAINER(scroll), widget); self->apps = widget; g_object_set(self->apps, "halign", GTK_ALIGN_FILL, "valign", GTK_ALIGN_START, NULL); gtk_flow_box_set_column_spacing(GTK_FLOW_BOX(widget), 80); gtk_flow_box_set_max_children_per_line(GTK_FLOW_BOX(widget), 60); gtk_flow_box_set_homogeneous(GTK_FLOW_BOX(widget), TRUE); gtk_flow_box_set_activate_on_single_click(GTK_FLOW_BOX(self->apps), TRUE); gtk_flow_box_set_selection_mode(GTK_FLOW_BOX(self->apps), GTK_SELECTION_SINGLE); g_signal_connect_swapped(self->apps, "child-activated", G_CALLBACK(brisk_dash_window_activated), self); screen = gtk_widget_get_screen(widget); GdkVisual *vis = gdk_screen_get_rgba_visual(screen); if (vis) { gtk_widget_set_visual(GTK_WIDGET(self), vis); } brisk_dash_window_set_filters_enabled(self, FALSE); /* Special leader to control group association, hidden from view */ base->section_box_leader = gtk_radio_button_new(NULL); gtk_box_pack_start(GTK_BOX(base->section_box_holder), base->section_box_leader, FALSE, FALSE, 0); gtk_widget_set_no_show_all(base->section_box_leader, TRUE); gtk_widget_hide(base->section_box_leader); brisk_dash_window_set_filters_enabled(self, TRUE); /* Hook up keyboard events */ g_signal_connect(self, "key-release-event", G_CALLBACK(brisk_menu_window_key_release), NULL); g_signal_connect(self, "key-press-event", G_CALLBACK(brisk_menu_window_key_press), NULL); brisk_menu_window_init_backends(base); gtk_widget_show_all(layout); } /** * brisk_dash_window_new: * * Return a newly created BriskDashWindow */ BriskMenuWindow *brisk_dash_window_new(GtkWidget *relative_to) { return g_object_new(BRISK_TYPE_DASH_WINDOW, "type", GTK_WINDOW_POPUP, "relative-to", relative_to, NULL); } /** * brisk_dash_window_associate_category: * * This will hook up the category button for events to enable us to filter the * list based on the active category. */ static void brisk_dash_window_associate_category(BriskMenuWindow *self, GtkWidget *button) { g_signal_connect_swapped(button, "toggled", G_CALLBACK(brisk_dash_window_on_toggled), self); g_signal_connect_swapped(button, "enter-notify-event", G_CALLBACK(brisk_dash_window_on_enter), self); } /** * Fired by clicking a category button */ static void brisk_dash_window_on_toggled(BriskMenuWindow *self, GtkWidget *button) { BriskDashCategoryButton *cat = NULL; /* Skip a double signal due to using a group */ if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button))) { return; } cat = BRISK_DASH_CATEGORY_BUTTON(button); g_object_get(cat, "section", &self->active_section, NULL); /* Start the filter. */ brisk_dash_window_invalidate_filter(self, NULL); } /** * Fired by entering into the category button with a roll over */ static gboolean brisk_dash_window_on_enter(BriskMenuWindow *self, __brisk_unused__ GdkEventCrossing *event, GtkWidget *button) { GtkToggleButton *but = GTK_TOGGLE_BUTTON(button); /* Whether we're in rollover mode */ if (!self->rollover) { return GDK_EVENT_PROPAGATE; } if (gtk_toggle_button_get_active(but) || !gtk_widget_get_visible(button)) { return GDK_EVENT_PROPAGATE; } /* Force activation through rollover */ gtk_toggle_button_set_active(but, TRUE); return GDK_EVENT_PROPAGATE; } /** * Load up the CSS assets */ static void brisk_dash_window_load_css(GtkSettings *settings, const gchar *key, BriskDashWindow *self) { GtkCssProvider *css = NULL; GtkStyleContext *context = NULL; autofree(GFile) *file = NULL; autofree(GError) *err = NULL; GdkScreen *screen = NULL; GdkRGBA color; file = g_file_new_for_uri("resource://com/solus-project/brisk/menu/dash/styling.css"); context = gtk_widget_get_style_context(GTK_WIDGET(self)); if (gtk_style_context_lookup_color(context, "dark_bg_color", &color)) { file = g_file_new_for_uri( "resource://com/solus-project/brisk/menu/dash/styling-light.css"); } if (!file) { return; } screen = gtk_widget_get_screen(GTK_WIDGET(self)); if (self->css) { gtk_style_context_remove_provider_for_screen(screen, GTK_STYLE_PROVIDER(self->css)); g_clear_object(&self->css); } css = gtk_css_provider_new(); self->css = css; gtk_style_context_add_provider_for_screen(screen, GTK_STYLE_PROVIDER(css), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); if (!gtk_css_provider_load_from_file(css, file, &err)) { g_warning("Failed to load CSS: %s\n", err->message); return; } } static void brisk_dash_window_key_activate(BriskDashWindow *self, __brisk_unused__ gpointer v) { autofree(GList) *kids = NULL; GList *elem = NULL; BriskMenuEntryButton *button = NULL; kids = gtk_container_get_children(GTK_CONTAINER(self->apps)); for (elem = kids; elem; elem = elem->next) { GtkWidget *widget = elem->data; if (!gtk_widget_get_visible(widget) || !gtk_widget_get_child_visible(widget)) { continue; } button = BRISK_MENU_ENTRY_BUTTON(gtk_bin_get_child(GTK_BIN(widget))); break; } if (!button) { return; } brisk_menu_entry_button_launch(button); } static void brisk_dash_window_activated(__brisk_unused__ BriskMenuWindow *self, GtkFlowBoxChild *row, __brisk_unused__ gpointer v) { BriskMenuEntryButton *button = NULL; GtkWidget *child = NULL; child = gtk_bin_get_child(GTK_BIN(row)); if (!child) { return; } if (!BRISK_IS_MENU_ENTRY_BUTTON(child)) { return; } button = BRISK_MENU_ENTRY_BUTTON(child); brisk_menu_entry_button_launch(button); } /** * Enable or disable the filters between building of the menus */ static void brisk_dash_window_set_filters_enabled(BriskDashWindow *self, gboolean enabled) { BRISK_MENU_WINDOW(self)->filtering = enabled; if (enabled) { gtk_flow_box_set_filter_func(GTK_FLOW_BOX(self->apps), brisk_dash_window_filter_apps, self, NULL); gtk_flow_box_set_sort_func(GTK_FLOW_BOX(self->apps), brisk_dash_window_sort, self, NULL); return; } gtk_flow_box_set_filter_func(GTK_FLOW_BOX(self->apps), NULL, NULL, NULL); gtk_flow_box_set_sort_func(GTK_FLOW_BOX(self->apps), NULL, NULL, NULL); } /** * brisk_dash_window_filter_apps: * * Responsible for filtering the selection based on active group or search * term. */ __brisk_pure__ static gboolean brisk_dash_window_filter_apps(GtkFlowBoxChild *row, gpointer v) { BriskMenuWindow *self = NULL; GtkWidget *child = NULL; self = BRISK_MENU_WINDOW(v); if (!self->filtering) { return FALSE; } /* Grab our Entry widget */ child = gtk_bin_get_child(GTK_BIN(row)); return brisk_menu_window_filter_apps(self, child); } static gint brisk_dash_window_sort(GtkFlowBoxChild *row1, GtkFlowBoxChild *row2, gpointer v) { GtkWidget *child1, *child2 = NULL; BriskItem *itemA, *itemB = NULL; autofree(gchar) *nameA = NULL; autofree(gchar) *nameB = NULL; BriskMenuWindow *self = NULL; self = BRISK_MENU_WINDOW(v); child1 = gtk_bin_get_child(GTK_BIN(row1)); child2 = gtk_bin_get_child(GTK_BIN(row2)); g_object_get(child1, "item", &itemA, NULL); g_object_get(child2, "item", &itemB, NULL); return brisk_menu_window_sort(self, itemA, itemB); } /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 8 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=8 tabstop=8 expandtab: * :indentSize=8:tabSize=8:noTabs=true: */ brisk-menu-0.6.0/src/frontend/dash/dash-window.h000066400000000000000000000041031352323743400215170ustar00rootroot00000000000000/* * This file is part of brisk-menu. * * Copyright © 2017-2019 Brisk Menu Developers * * 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 2 of the License, or * (at your option) any later version. */ #pragma once #include "../menu-private.h" #include #include G_BEGIN_DECLS typedef struct _BriskDashWindow BriskDashWindow; typedef struct _BriskDashWindowClass BriskDashWindowClass; struct _BriskDashWindowClass { BriskMenuWindowClass parent_class; }; /** * BriskDashWindow implements support for favourites in Brisk */ struct _BriskDashWindow { BriskMenuWindow parent; /* Actual applications */ GtkWidget *apps; GtkWidget *apps_scroll; GtkWidget *categories_scroll; GtkCssProvider *css; }; #define BRISK_TYPE_DASH_WINDOW brisk_dash_window_get_type() #define BRISK_DASH_WINDOW(o) \ (G_TYPE_CHECK_INSTANCE_CAST((o), BRISK_TYPE_DASH_WINDOW, BriskDashWindow)) #define BRISK_IS_DASH_WINDOW(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), BRISK_TYPE_DASH_WINDOW)) #define BRISK_DASH_WINDOW_CLASS(o) \ (G_TYPE_CHECK_CLASS_CAST((o), BRISK_TYPE_DASH_WINDOW, BriskDashWindowClass)) #define BRISK_IS_DASH_WINDOW_CLASS(o) (G_TYPE_CHECK_CLASS_TYPE((o), BRISK_TYPE_DASH_WINDOW)) #define BRISK_DASH_WINDOW_GET_CLASS(o) \ (G_TYPE_INSTANCE_GET_CLASS((o), BRISK_TYPE_DASH_WINDOW, BriskDashWindowClass)) GType brisk_dash_window_get_type(void); BriskMenuWindow *brisk_dash_window_new(GtkWidget *relative_to); G_END_DECLS /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 8 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=8 tabstop=8 expandtab: * :indentSize=8:tabSize=8:noTabs=true: */ brisk-menu-0.6.0/src/frontend/entry-button.c000066400000000000000000000217621352323743400210330ustar00rootroot00000000000000/* * This file is part of brisk-menu. * * Copyright © 2016-2019 Brisk Menu Developers * * 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 2 of the License, or * (at your option) any later version. */ #define _GNU_SOURCE #include "util.h" BRISK_BEGIN_PEDANTIC #include "backend/item.h" #include "entry-button.h" #include "launcher.h" #include "menu-private.h" #include BRISK_END_PEDANTIC static void brisk_menu_entry_drag_begin(GtkWidget *widget, GdkDragContext *context); static void brisk_menu_entry_drag_end(GtkWidget *widget, GdkDragContext *context); static void brisk_menu_entry_drag_data(GtkWidget *widget, GdkDragContext *context, GtkSelectionData *data, guint info, guint time); static gboolean brisk_menu_entry_button_release_event(GtkWidget *wid, GdkEventButton *event); /** * IDs for our signals */ enum { ENTRY_BUTTON_SIGNAL_CONTEXT_MENU = 0, N_SIGNALS }; static guint entry_button_signals[N_SIGNALS] = { 0 }; G_DEFINE_TYPE(BriskMenuEntryButton, brisk_menu_entry_button, GTK_TYPE_BUTTON) enum { PROP_ITEM = 1, PROP_LAUNCHER, N_PROPS }; static GParamSpec *obj_properties[N_PROPS] = { NULL, }; /** * brisk_menu_entry_button_dispose: * * Clean up a BriskMenuEntryButton instance */ static void brisk_menu_entry_button_dispose(GObject *obj) { BriskMenuEntryButton *self = NULL; self = BRISK_MENU_ENTRY_BUTTON(obj); g_clear_object(&self->item); G_OBJECT_CLASS(brisk_menu_entry_button_parent_class)->dispose(obj); } static void brisk_menu_entry_button_set_property(GObject *object, guint id, const GValue *value, GParamSpec *spec) { BriskMenuEntryButton *self = BRISK_MENU_ENTRY_BUTTON(object); switch (id) { case PROP_ITEM: self->item = g_value_get_pointer(value); break; case PROP_LAUNCHER: self->launcher = g_value_get_pointer(value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, id, spec); break; } } static void brisk_menu_entry_button_get_property(GObject *object, guint id, GValue *value, GParamSpec *spec) { BriskMenuEntryButton *self = BRISK_MENU_ENTRY_BUTTON(object); switch (id) { case PROP_ITEM: g_value_set_pointer(value, self->item); break; case PROP_LAUNCHER: g_value_set_pointer(value, self->launcher); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, id, spec); break; } } /** * brisk_menu_entry_button_class_init: * * Handle class initialisation */ static void brisk_menu_entry_button_class_init(BriskMenuEntryButtonClass *klazz) { GObjectClass *obj_class = G_OBJECT_CLASS(klazz); GtkWidgetClass *wid_class = GTK_WIDGET_CLASS(klazz); /* gobject vtable hookup */ obj_class->dispose = brisk_menu_entry_button_dispose; obj_class->set_property = brisk_menu_entry_button_set_property; obj_class->get_property = brisk_menu_entry_button_get_property; /* widget vtable hookup */ wid_class->drag_data_get = brisk_menu_entry_drag_data; wid_class->drag_begin = brisk_menu_entry_drag_begin; wid_class->drag_end = brisk_menu_entry_drag_end; wid_class->button_release_event = brisk_menu_entry_button_release_event; /** * BriskEntryButton::show-context-menu * @button: The button that created the ievent * @item: The menu to show a menu for * * Used to notify the frontend that we need an action menu displayed */ entry_button_signals[ENTRY_BUTTON_SIGNAL_CONTEXT_MENU] = g_signal_new("show-context-menu", BRISK_TYPE_MENU_ENTRY_BUTTON, G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET(BriskMenuEntryButtonClass, show_context_menu), NULL, NULL, NULL, G_TYPE_NONE, 1, BRISK_TYPE_ITEM); obj_properties[PROP_ITEM] = g_param_spec_pointer("item", "The BriskItem", "Corresponding BriskItem", G_PARAM_CONSTRUCT | G_PARAM_READWRITE); obj_properties[PROP_LAUNCHER] = g_param_spec_pointer("launcher", "The Brisk Launcher", "Launcher used for starting apps", G_PARAM_CONSTRUCT | G_PARAM_READWRITE); g_object_class_install_properties(obj_class, N_PROPS, obj_properties); } /** * brisk_menu_entry_button_init: * * Handle construction of the BriskMenuEntryButton */ static void brisk_menu_entry_button_init(BriskMenuEntryButton *self) { static const GtkTargetEntry drag_targets[] = { { "text/uri-list", 0, 0 }, { "application/x-desktop", 0, 0 }, }; /* Hook up drag so users can drag .desktop from here elsewhere */ gtk_drag_source_set(GTK_WIDGET(self), GDK_BUTTON1_MASK, drag_targets, 2, GDK_ACTION_COPY); } /** * Handle setting the icon according to our desktop file * We ref the icon here so we can immediately hide the toplevel to get it out * of the way. */ static void brisk_menu_entry_drag_begin(GtkWidget *widget, GdkDragContext *context) { BriskMenuEntryButton *self = BRISK_MENU_ENTRY_BUTTON(widget); const GIcon *icon = NULL; GIcon *reffed_icon = NULL; /* If we have a .desktop icon, use it */ icon = brisk_item_get_icon(self->item); /* Fallback to the default */ if (!icon) { gtk_drag_set_icon_default(context); return; } reffed_icon = g_object_ref((GIcon *)icon); g_object_set_data_full(G_OBJECT(context), "_drag_icon_brisk", reffed_icon, g_object_unref); gtk_drag_set_icon_gicon(context, reffed_icon, 0, 0); } static gboolean hide_toplevel(GtkWidget *widget) { GtkWidget *toplevel = NULL; /* Hide toplevel to avoid grab problems */ toplevel = gtk_widget_get_toplevel(widget); gtk_widget_hide(toplevel); return FALSE; } /** * Clean up the ref'd icon */ static void brisk_menu_entry_drag_end(__brisk_unused__ GtkWidget *widget, GdkDragContext *context) { GIcon *icon = NULL; g_idle_add((GSourceFunc)hide_toplevel, widget); icon = g_object_get_data(G_OBJECT(context), "_drag_icon_brisk"); if (!icon) { return; } g_object_set_data(G_OBJECT(context), "_drag_icon_brisk", NULL); } static void brisk_menu_entry_drag_data(GtkWidget *widget, __brisk_unused__ GdkDragContext *context, GtkSelectionData *data, __brisk_unused__ guint info, __brisk_unused__ guint time) { BriskMenuEntryButton *self = BRISK_MENU_ENTRY_BUTTON(widget); const gchar *uris[2]; autofree(gchar) *uri = NULL; uri = brisk_item_get_uri(self->item); if (!uri) { return; } uris[0] = uri; uris[1] = NULL; gtk_selection_data_set_uris(data, (gchar **)uris); } static gboolean brisk_menu_entry_button_release_event(GtkWidget *widget, GdkEventButton *event_button) { BriskMenuEntryButton *self = BRISK_MENU_ENTRY_BUTTON(widget); switch (event_button->button) { case GDK_BUTTON_PRIMARY: /* Left click, primary launch action */ brisk_menu_entry_button_launch(self); break; case GDK_BUTTON_SECONDARY: /* Right click, ask for a context menu */ g_signal_emit(self, entry_button_signals[ENTRY_BUTTON_SIGNAL_CONTEXT_MENU], 0, self->item); break; default: break; } return GTK_WIDGET_CLASS(brisk_menu_entry_button_parent_class) ->button_press_event(widget, event_button); } void brisk_menu_entry_button_launch(BriskMenuEntryButton *self) { brisk_menu_launcher_start_item(self->launcher, GTK_WIDGET(self), self->item); } /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 8 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=8 tabstop=8 expandtab: * :indentSize=8:tabSize=8:noTabs=true: */ brisk-menu-0.6.0/src/frontend/entry-button.h000066400000000000000000000044741352323743400210410ustar00rootroot00000000000000/* * This file is part of brisk-menu. * * Copyright © 2016-2019 Brisk Menu Developers * * 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 2 of the License, or * (at your option) any later version. */ #pragma once #include #include #include "backend/item.h" #include "launcher.h" G_BEGIN_DECLS typedef struct _BriskMenuEntryButton BriskMenuEntryButton; typedef struct _BriskMenuEntryButtonClass BriskMenuEntryButtonClass; struct _BriskMenuEntryButtonClass { GtkButtonClass parent_class; void (*show_context_menu)(BriskMenuEntryButton *button, BriskItem *item); }; /** * BriskMenuEntryButton is the toplevel window type used within the applet. */ struct _BriskMenuEntryButton { GtkButton parent; BriskMenuLauncher *launcher; BriskItem *item; }; #define BRISK_TYPE_MENU_ENTRY_BUTTON brisk_menu_entry_button_get_type() #define BRISK_MENU_ENTRY_BUTTON(o) \ (G_TYPE_CHECK_INSTANCE_CAST((o), BRISK_TYPE_MENU_ENTRY_BUTTON, BriskMenuEntryButton)) #define BRISK_IS_MENU_ENTRY_BUTTON(o) \ (G_TYPE_CHECK_INSTANCE_TYPE((o), BRISK_TYPE_MENU_ENTRY_BUTTON)) #define BRISK_MENU_ENTRY_BUTTON_CLASS(o) \ (G_TYPE_CHECK_CLASS_CAST((o), BRISK_TYPE_MENU_ENTRY_BUTTON, BriskMenuEntryButtonClass)) #define BRISK_IS_MENU_ENTRY_BUTTON_CLASS(o) \ (G_TYPE_CHECK_CLASS_TYPE((o), BRISK_TYPE_MENU_ENTRY_BUTTON)) #define BRISK_MENU_ENTRY_BUTTON_GET_CLASS(o) \ (G_TYPE_INSTANCE_GET_CLASS((o), BRISK_TYPE_MENU_ENTRY_BUTTON, BriskMenuEntryButtonClass)) void brisk_menu_entry_button_launch(BriskMenuEntryButton *button); GType brisk_menu_entry_button_get_type(void); G_END_DECLS /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 8 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=8 tabstop=8 expandtab: * :indentSize=8:tabSize=8:noTabs=true: */ brisk-menu-0.6.0/src/frontend/launcher.c000066400000000000000000000144151352323743400201570ustar00rootroot00000000000000/* * This file is part of brisk-menu. * * Copyright © 2016-2019 Brisk Menu Developers * * 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 2 of the License, or * (at your option) any later version. */ #define _GNU_SOURCE #include "util.h" BRISK_BEGIN_PEDANTIC #include "launcher.h" #include "menu-private.h" #include BRISK_END_PEDANTIC struct _BriskMenuLauncherClass { GObjectClass parent_class; }; /** * BriskMenuLauncher is the toplevel window type used within the applet. */ struct _BriskMenuLauncher { GObject parent; GdkAppLaunchContext *context; GdkDisplay *display; }; G_DEFINE_TYPE(BriskMenuLauncher, brisk_menu_launcher, G_TYPE_OBJECT) static void brisk_menu_launcher_app_launched(BriskMenuLauncher *self, GAppInfo *info, GVariant *data, GAppLaunchContext *context); static void brisk_menu_launcher_app_failed(BriskMenuLauncher *self, gchar *startup_id, GAppLaunchContext *context); /** * brisk_menu_launcher_new: * * Construct a new BriskMenuLauncher object */ BriskMenuLauncher *brisk_menu_launcher_new() { return g_object_new(BRISK_TYPE_MENU_LAUNCHER, NULL); } /** * brisk_menu_launcher_dispose: * * Clean up a BriskMenuLauncher instance */ static void brisk_menu_launcher_dispose(GObject *obj) { BriskMenuLauncher *self = NULL; self = BRISK_MENU_LAUNCHER(obj); g_clear_object(&self->context); G_OBJECT_CLASS(brisk_menu_launcher_parent_class)->dispose(obj); } /** * brisk_menu_launcher_class_init: * * Handle class initialisation */ static void brisk_menu_launcher_class_init(BriskMenuLauncherClass *klazz) { GObjectClass *obj_class = G_OBJECT_CLASS(klazz); /* gobject vtable hookup */ obj_class->dispose = brisk_menu_launcher_dispose; } /** * brisk_menu_launcher_init: * * Handle construction of the BriskMenuLauncher */ static void brisk_menu_launcher_init(BriskMenuLauncher *self) { GdkDisplay *display = NULL; display = gdk_display_get_default(); self->context = gdk_display_get_app_launch_context(display); g_signal_connect_swapped(self->context, "launched", G_CALLBACK(brisk_menu_launcher_app_launched), self); g_signal_connect_swapped(self->context, "launch-failed", G_CALLBACK(brisk_menu_launcher_app_failed), self); } static void brisk_menu_launcher_init_context(BriskMenuLauncher *self, GtkWidget *parent, GIcon *icon) { GdkScreen *screen = NULL; GtkWidget *toplevel = NULL; if (parent) { screen = gtk_widget_get_screen(parent); } else { screen = gdk_screen_get_default(); } gdk_app_launch_context_set_screen(self->context, screen); if (icon) { gdk_app_launch_context_set_icon(self->context, icon); } self->display = gdk_screen_get_display(screen); /* Hide the menu before kicking off the launch */ toplevel = gtk_widget_get_toplevel(parent); if (BRISK_IS_MENU_WINDOW(toplevel)) { gtk_widget_hide(toplevel); } } void brisk_menu_launcher_start_item(BriskMenuLauncher *self, GtkWidget *parent, BriskItem *item) { brisk_menu_launcher_init_context(self, parent, (GIcon *)brisk_item_get_icon(item)); /* The item itself will basically do similar to g_app_info_launch using our * context now it's prepared. */ brisk_item_launch(item, G_APP_LAUNCH_CONTEXT(self->context)); } void brisk_menu_launcher_start(BriskMenuLauncher *self, GtkWidget *parent, GAppInfo *app_info) { brisk_menu_launcher_init_context(self, parent, g_app_info_get_icon(app_info)); /* We may support DnD URIs onto the icons at some point, not for now. */ g_app_info_launch(app_info, NULL, G_APP_LAUNCH_CONTEXT(self->context), NULL); } /** * Handle the launch of an application so that we can remove the startup notification * from the desktop environment. */ static void brisk_menu_launcher_app_launched(BriskMenuLauncher *self, __brisk_unused__ GAppInfo *info, GVariant *data, __brisk_unused__ GAppLaunchContext *context) { GVariantIter iter = { 0 }; GVariant *elem = NULL; gchar *startup_id = NULL; g_variant_iter_init(&iter, data); while ((elem = g_variant_iter_next_value(&iter)) != NULL) { GVariant *value = NULL; gchar *key = NULL; g_variant_get(elem, "{sv}", &key, &value); if (!g_variant_is_of_type(value, G_VARIANT_TYPE_STRING)) { continue; } if (g_str_equal(key, "startup-notification-id")) { g_variant_get(value, "s", &startup_id); } g_free(key); g_variant_unref(value); if (startup_id) { break; } } if (!startup_id) { return; } /* Remove the notify from the desktop */ gdk_display_notify_startup_complete(self->display, startup_id); g_free(startup_id); } /** * Handle the failure of an application to launch, so that we may remove the startup * notification from the desktop environment. */ static void brisk_menu_launcher_app_failed(BriskMenuLauncher *self, gchar *startup_id, __brisk_unused__ GAppLaunchContext *context) { g_message("Startup failure of %s", startup_id); gdk_display_notify_startup_complete(self->display, startup_id); } /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 8 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=8 tabstop=8 expandtab: * :indentSize=8:tabSize=8:noTabs=true: */ brisk-menu-0.6.0/src/frontend/launcher.h000066400000000000000000000043251352323743400201630ustar00rootroot00000000000000/* * This file is part of brisk-menu. * * Copyright © 2016-2019 Brisk Menu Developers * * 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 2 of the License, or * (at your option) any later version. */ #pragma once #include #include #include "backend/item.h" G_BEGIN_DECLS typedef struct _BriskMenuLauncher BriskMenuLauncher; typedef struct _BriskMenuLauncherClass BriskMenuLauncherClass; #define BRISK_TYPE_MENU_LAUNCHER brisk_menu_launcher_get_type() #define BRISK_MENU_LAUNCHER(o) \ (G_TYPE_CHECK_INSTANCE_CAST((o), BRISK_TYPE_MENU_LAUNCHER, BriskMenuLauncher)) #define BRISK_IS_MENU_LAUNCHER(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), BRISK_TYPE_MENU_LAUNCHER)) #define BRISK_MENU_LAUNCHER_CLASS(o) \ (G_TYPE_CHECK_CLASS_CAST((o), BRISK_TYPE_MENU_LAUNCHER, BriskMenuLauncherClass)) #define BRISK_IS_MENU_LAUNCHER_CLASS(o) (G_TYPE_CHECK_CLASS_TYPE((o), BRISK_TYPE_MENU_LAUNCHER)) #define BRISK_MENU_LAUNCHER_GET_CLASS(o) \ (G_TYPE_INSTANCE_GET_CLASS((o), BRISK_TYPE_MENU_LAUNCHER, BriskMenuLauncherClass)) /** * Construct a new BriskMenuLauncher to manage launching of apps */ BriskMenuLauncher *brisk_menu_launcher_new(void); GType brisk_menu_launcher_get_type(void); /** * Start up the given app_info with no URIs and handle startup notification * for it. */ void brisk_menu_launcher_start(BriskMenuLauncher *self, GtkWidget *parent, GAppInfo *app_info); /** * Start a given Brisk item in the same context as _start, but ask the item to * launch itself after our context is prepared. */ void brisk_menu_launcher_start_item(BriskMenuLauncher *self, GtkWidget *parent, BriskItem *item); G_END_DECLS /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 8 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=8 tabstop=8 expandtab: * :indentSize=8:tabSize=8:noTabs=true: */ brisk-menu-0.6.0/src/frontend/menu-context.c000066400000000000000000000074371352323743400210120ustar00rootroot00000000000000/* * This file is part of brisk-menu. * * Copyright © 2017-2019 Brisk Menu Developers * * 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 2 of the License, or * (at your option) any later version. */ #define _GNU_SOURCE #include "util.h" BRISK_BEGIN_PEDANTIC #include "menu-private.h" #include "menu-window.h" #include BRISK_END_PEDANTIC #define BRISK_ACTION_GROUP "brisk-context-items" DEF_AUTOFREE(GMenu, g_object_unref) /** * brisk_menu_window_context_hide: * * Existing menu has gone bye-bye, so clear it up. Typically this only happens * when the new menu is about to be inserted, and not when the menu is actually * closed. */ static void brisk_menu_window_context_hide(GtkWidget *attached, GtkMenu *menu) { BriskMenuWindow *self = BRISK_MENU_WINDOW(attached); /* Pop any existing action group */ gtk_widget_insert_action_group(attached, BRISK_ACTION_GROUP, NULL); gtk_widget_destroy(GTK_WIDGET(menu)); self->context_group = NULL; } /** * brisk_menu_window_show_context: * * Menu button has requested a context menu be shown for the given item * * WARNING: this is leaky right now and is a port of the original PR behaviour */ void brisk_menu_window_show_context(BriskMenuWindow *self, BriskItem *item, __brisk_unused__ BriskMenuEntryButton *button) { GHashTableIter iter = { 0 }; __brisk_unused__ gpointer key; BriskBackend *backend = NULL; GSimpleActionGroup *group = NULL; autofree(GMenu) *simple_menu = NULL; g_clear_pointer(&self->context_menu, gtk_widget_destroy); group = g_simple_action_group_new(); self->context_group = G_ACTION_GROUP(group); /* For now, iterate all the backends and stick the actions in */ g_hash_table_iter_init(&iter, self->backends); while (g_hash_table_iter_next(&iter, (void **)&key, (void **)&backend)) { autofree(GMenu) *section = NULL; section = brisk_backend_get_item_actions(backend, item, G_ACTION_GROUP(group)); if (!section) { continue; } if (!simple_menu) { simple_menu = g_menu_new(); } /* Automatically separated, no titles */ g_menu_append_section(simple_menu, NULL, G_MENU_MODEL(section)); } /* No sense displaying an empty menu */ if (!simple_menu) { return; } /* Push in the action group for invokables */ gtk_widget_insert_action_group(GTK_WIDGET(self), BRISK_ACTION_GROUP, G_ACTION_GROUP(group)); self->context_menu = gtk_menu_new_from_model(G_MENU_MODEL(simple_menu)); gtk_menu_attach_to_widget(GTK_MENU(self->context_menu), GTK_WIDGET(self), brisk_menu_window_context_hide); /* Show it now */ gtk_menu_popup(GTK_MENU(self->context_menu), NULL, NULL, NULL, NULL, GDK_BUTTON_SECONDARY, GDK_CURRENT_TIME); } /** * brisk_menu_window_configure_context: * * Set up the basics for handling context menus */ void brisk_menu_window_configure_context(__brisk_unused__ BriskMenuWindow *self) { /* TODO: Init bits */ } /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 8 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=8 tabstop=8 expandtab: * :indentSize=8:tabSize=8:noTabs=true: */ brisk-menu-0.6.0/src/frontend/menu-grabs.c000066400000000000000000000225331352323743400204160ustar00rootroot00000000000000/* * This file is part of brisk-menu. * * Copyright © 2016-2019 Brisk Menu Developers * * 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 2 of the License, or * (at your option) any later version. */ #define _GNU_SOURCE #include "util.h" BRISK_BEGIN_PEDANTIC #include "menu-private.h" #include BRISK_END_PEDANTIC static gboolean brisk_menu_window_map(GtkWidget *widget, gpointer udata); static gboolean brisk_menu_window_unmap(GtkWidget *widget, gpointer udata); static void brisk_menu_window_grab_notify(GtkWidget *widget, gboolean was_grabbed, gpointer udata); static gboolean brisk_menu_window_button_press(GtkWidget *widget, GdkEvent *event, gpointer udata); static gboolean brisk_menu_window_grab_broken(GtkWidget *widget, GdkEvent *event, gpointer udata); static void brisk_menu_window_grab(BriskMenuWindow *self); static void brisk_menu_window_ungrab(BriskMenuWindow *self); /** * Borrowed from gdkseatdefault.c */ #define KEYBOARD_EVENTS (GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_FOCUS_CHANGE_MASK) #define POINTER_EVENTS \ (GDK_POINTER_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | \ GDK_SCROLL_MASK | GDK_SMOOTH_SCROLL_MASK | GDK_ENTER_NOTIFY_MASK | \ GDK_LEAVE_NOTIFY_MASK | GDK_PROXIMITY_IN_MASK | GDK_PROXIMITY_OUT_MASK) /** * Set up grabbing support within the menu */ void brisk_menu_window_configure_grabs(BriskMenuWindow *self) { g_signal_connect(self, "map-event", G_CALLBACK(brisk_menu_window_map), NULL); g_signal_connect(self, "unmap-event", G_CALLBACK(brisk_menu_window_unmap), NULL); g_signal_connect(self, "grab-notify", G_CALLBACK(brisk_menu_window_grab_notify), NULL); g_signal_connect(self, "button-press-event", G_CALLBACK(brisk_menu_window_button_press), NULL); g_signal_connect(self, "grab-broken-event", G_CALLBACK(brisk_menu_window_grab_broken), NULL); } /** * Mapped on screen, attempt a grab */ static gboolean brisk_menu_window_map(GtkWidget *widget, __brisk_unused__ gpointer udata) { GdkWindow *window = NULL; BriskMenuWindow *self = NULL; self = BRISK_MENU_WINDOW(widget); /* Forcibly request focus */ window = gtk_widget_get_window(widget); gdk_window_set_accept_focus(window, TRUE); gdk_window_focus(window, GDK_CURRENT_TIME); gtk_window_present(GTK_WINDOW(widget)); gtk_widget_grab_focus(self->search); brisk_menu_window_grab(self); return GDK_EVENT_STOP; } /** * We've been made non-visible, so drop our grab if we have it */ static gboolean brisk_menu_window_unmap(GtkWidget *widget, __brisk_unused__ gpointer udata) { brisk_menu_window_ungrab(BRISK_MENU_WINDOW(widget)); return GDK_EVENT_STOP; } /** * Grab the input events using the GdkSeat */ #if GTK_MAJOR_VERSION == 3 && GTK_MINOR_VERSION < 20 /* Pre 3.20 grab behaviour */ static void brisk_menu_window_grab(BriskMenuWindow *self) { GdkDisplay *display = NULL; GdkWindow *window = NULL; GdkGrabStatus st; GdkDeviceManager *manager = NULL; GdkDevice *pointer, *keyboard = NULL; if (self->grabbed) { return; } window = gtk_widget_get_window(GTK_WIDGET(self)); if (!window) { g_warning("Attempting to grab BriskMenuWindow when not realized"); return; } display = gtk_widget_get_display(GTK_WIDGET(self)); manager = gdk_display_get_device_manager(display); pointer = gdk_device_manager_get_client_pointer(manager); keyboard = gdk_device_get_associated_device(pointer); st = gdk_device_grab(pointer, window, GDK_OWNERSHIP_NONE, TRUE, POINTER_EVENTS, NULL, GDK_CURRENT_TIME); if (st != GDK_GRAB_SUCCESS) { return; } if (keyboard) { st = gdk_device_grab(keyboard, window, GDK_OWNERSHIP_NONE, TRUE, KEYBOARD_EVENTS, NULL, GDK_CURRENT_TIME); if (st != GDK_GRAB_SUCCESS) { gdk_device_ungrab(keyboard, GDK_CURRENT_TIME); return; } } self->grabbed = TRUE; gtk_grab_add(GTK_WIDGET(self)); } #else G_GNUC_BEGIN_IGNORE_DEPRECATIONS static void brisk_menu_window_grab(BriskMenuWindow *self) { GdkDisplay *display = NULL; GdkSeat *seat = NULL; GdkWindow *window = NULL; GdkSeatCapabilities caps = 0; GdkGrabStatus st; if (self->grabbed) { return; } window = gtk_widget_get_window(GTK_WIDGET(self)); if (!window) { g_warning("Attempting to grab BriskMenuWindow when not realized"); return; } display = gtk_widget_get_display(GTK_WIDGET(self)); seat = gdk_display_get_default_seat(display); if (gdk_seat_get_pointer(seat) != NULL) { caps |= GDK_SEAT_CAPABILITY_ALL_POINTING; } if (gdk_seat_get_keyboard(seat) != NULL) { caps |= GDK_SEAT_CAPABILITY_KEYBOARD; } st = gdk_seat_grab(seat, window, caps, TRUE, NULL, NULL, NULL, NULL); if (st == GDK_GRAB_SUCCESS) { self->grabbed = TRUE; gtk_grab_add(GTK_WIDGET(self)); } } G_GNUC_END_IGNORE_DEPRECATIONS #endif /** * Ungrab a previous grab by this widget */ #if GTK_MAJOR_VERSION == 3 && GTK_MINOR_VERSION < 20 /* Pre 3.20 behaviour */ static void brisk_menu_window_ungrab(BriskMenuWindow *self) { GdkDisplay *display = NULL; GdkDeviceManager *manager = NULL; GdkDevice *pointer, *keyboard = NULL; if (!self->grabbed) { return; } display = gtk_widget_get_display(GTK_WIDGET(self)); manager = gdk_display_get_device_manager(display); pointer = gdk_device_manager_get_client_pointer(manager); keyboard = gdk_device_get_associated_device(pointer); gtk_grab_remove(GTK_WIDGET(self)); gdk_device_ungrab(pointer, GDK_CURRENT_TIME); if (keyboard) { gdk_device_ungrab(keyboard, GDK_CURRENT_TIME); } self->grabbed = FALSE; } #else G_GNUC_BEGIN_IGNORE_DEPRECATIONS static void brisk_menu_window_ungrab(BriskMenuWindow *self) { GdkDisplay *display = NULL; GdkSeat *seat = NULL; if (!self->grabbed) { return; } display = gtk_widget_get_display(GTK_WIDGET(self)); seat = gdk_display_get_default_seat(display); gtk_grab_remove(GTK_WIDGET(self)); gdk_seat_ungrab(seat); self->grabbed = FALSE; } G_GNUC_END_IGNORE_DEPRECATIONS #endif /** * Grab was broken, most likely due to a window within our application */ static gboolean brisk_menu_window_grab_broken(GtkWidget *widget, __brisk_unused__ GdkEvent *event, __brisk_unused__ gpointer udata) { BriskMenuWindow *self = NULL; self = BRISK_MENU_WINDOW(widget); self->grabbed = FALSE; return GDK_EVENT_PROPAGATE; } /** * Grab changed _within_ the application * * If our grab was broken, i.e. due to some popup menu, and we're still visible, * we'll now try and grab focus once more. */ static void brisk_menu_window_grab_notify(GtkWidget *widget, gboolean was_grabbed, __brisk_unused__ gpointer udata) { BriskMenuWindow *self = NULL; /* Only interested in unshadowed */ if (!was_grabbed) { return; } /* And being visible. ofc. */ if (!gtk_widget_get_visible(widget)) { return; } self = BRISK_MENU_WINDOW(widget); brisk_menu_window_grab(self); } /** * Check for clicks outside the window itself */ static gboolean brisk_menu_window_button_press(GtkWidget *widget, GdkEvent *event, __brisk_unused__ gpointer udata) { gint wx, wy = 0; gint ww, wh = 0; gtk_window_get_size(GTK_WINDOW(widget), &ww, &wh); gtk_window_get_position(GTK_WINDOW(widget), &wx, &wy); if ((event->button.x_root < wx || event->button.x_root > (wx + ww)) || (event->button.y_root < wy || event->button.y_root > (wy + wh))) { gtk_widget_hide(widget); return GDK_EVENT_STOP; } return GDK_EVENT_PROPAGATE; } /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 8 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=8 tabstop=8 expandtab: * :indentSize=8:tabSize=8:noTabs=true: */ brisk-menu-0.6.0/src/frontend/menu-keyboard.c000066400000000000000000000061661352323743400211240ustar00rootroot00000000000000/* * This file is part of brisk-menu. * * Copyright © 2016-2019 Brisk Menu Developers * * 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 2 of the License, or * (at your option) any later version. */ #include "util.h" BRISK_BEGIN_PEDANTIC #include "menu-private.h" BRISK_END_PEDANTIC /** * Handle hiding the menu when it comes to the shortcut key only. * i.e. the Super_L key. */ gboolean brisk_menu_window_key_press(BriskMenuWindow *self, GdkEvent *event, __brisk_unused__ gpointer v) { autofree(gchar) *accel_name = NULL; GdkModifierType lock_masks = GDK_MOD2_MASK | GDK_LOCK_MASK | GDK_MOD5_MASK; guint mods; if (!self->shortcut) { return GDK_EVENT_PROPAGATE; } /* Unset mask of the lock keys */ mods = event->key.state & ~(lock_masks); accel_name = gtk_accelerator_name(event->key.keyval, mods); if (!accel_name || g_ascii_strcasecmp(self->shortcut, accel_name) != 0) { return GDK_EVENT_PROPAGATE; } gtk_widget_hide(GTK_WIDGET(self)); return GDK_EVENT_STOP; } /** * Handle the escape key being hit so we can hide again */ gboolean brisk_menu_window_key_release(BriskMenuWindow *self, GdkEvent *event, __brisk_unused__ gpointer v) { if (event->key.keyval == GDK_KEY_Escape) { gtk_widget_hide(GTK_WIDGET(self)); return GDK_EVENT_STOP; } return GDK_EVENT_PROPAGATE; } /** * Called in idle once back out of the event */ static gboolean toggle_menu(BriskMenuWindow *self) { gboolean vis = !gtk_widget_get_visible(GTK_WIDGET(self)); if (vis) { /* Cheap trick to ensure we reset our active position */ brisk_menu_window_set_parent_position(self, self->position); /* Ensure we're in the appropriate place */ brisk_menu_window_update_screen_position(self); } gtk_widget_set_visible(GTK_WIDGET(self), vis); return FALSE; } /** * Handle global hotkey press */ static void hotkey_cb(__brisk_unused__ GdkEvent *event, gpointer v) { g_idle_add((GSourceFunc)toggle_menu, v); } /** * Update the applet hotkey in accordance with settings */ void brisk_menu_window_update_hotkey(BriskMenuWindow *self, gchar *key) { if (self->shortcut) { brisk_key_binder_unbind(self->binder, self->shortcut); g_clear_pointer(&self->shortcut, g_free); } if (!brisk_key_binder_bind(self->binder, key, hotkey_cb, self)) { g_message("Failed to bind keyboard shortcut"); return; } self->shortcut = g_strdup(key); } /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 8 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=8 tabstop=8 expandtab: * :indentSize=8:tabSize=8:noTabs=true: */ brisk-menu-0.6.0/src/frontend/menu-loader.c000066400000000000000000000123061352323743400205630ustar00rootroot00000000000000/* * This file is part of brisk-menu. * * Copyright © 2016-2019 Brisk Menu Developers * * 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 2 of the License, or * (at your option) any later version. */ #include "util.h" #include BRISK_BEGIN_PEDANTIC #include "backend/all-items/all-backend.h" #include "backend/apps/apps-backend.h" #include "backend/favourites/favourites-backend.h" #include "entry-button.h" #include "menu-private.h" #include BRISK_END_PEDANTIC /** * Return the section box for the given backend ID */ GtkWidget *brisk_menu_window_get_section_box(BriskMenuWindow *self, BriskBackend *backend) { return g_hash_table_lookup(self->section_boxes, brisk_backend_get_id(backend)); } /** * A backend needs us to hide the window */ static void brisk_menu_window_hide(BriskMenuWindow *self, __brisk_unused__ BriskBackend *backend) { gtk_widget_hide(GTK_WIDGET(self)); } /** * Load the menus and place them into the window regions */ gboolean brisk_menu_window_load_menus(BriskMenuWindow *self) { GHashTableIter iter; gchar *backend_id = NULL; BriskBackend *backend = NULL; /* We only call load() on backends exposing BRISK_BACKEND_SOURCE */ g_hash_table_iter_init(&iter, self->backends); while (g_hash_table_iter_next(&iter, (void **)&backend_id, (void **)&backend)) { guint flags = brisk_backend_get_flags(backend); if ((flags & BRISK_BACKEND_SOURCE) != BRISK_BACKEND_SOURCE) { continue; } if (!brisk_backend_load(backend)) { g_warning("Failed to load source backend: '%s'", backend_id); } } return G_SOURCE_REMOVE; } /** * Generic function allowing us to set up screen estate and signals for * a given backend */ static void brisk_menu_window_init_backend(BriskMenuWindow *self, BriskBackend *backend) { GtkWidget *box = NULL; const gchar *backend_id = brisk_backend_get_id(backend); if (g_hash_table_lookup(self->section_boxes, backend_id)) { g_message("debug: tried to load existing backend '%s'", backend_id); return; } /* Hook up the signals first */ g_signal_connect_swapped(backend, "item-added", G_CALLBACK(brisk_menu_window_add_item), self); g_signal_connect_swapped(backend, "section-added", G_CALLBACK(brisk_menu_window_add_section), self); g_signal_connect_swapped(backend, "invalidate-filter", G_CALLBACK(brisk_menu_window_invalidate_filter), self); g_signal_connect_swapped(backend, "hide-menu", G_CALLBACK(brisk_menu_window_hide), self); g_signal_connect_swapped(backend, "reset", G_CALLBACK(brisk_menu_window_reset), self); box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); gtk_box_pack_start(GTK_BOX(self->section_box_holder), box, FALSE, FALSE, 0); /* Always ensure that the box is placed after "All" but not after any * non-section boxes */ gtk_box_reorder_child(GTK_BOX(self->section_box_holder), box, (gint)g_hash_table_size(self->backends)); g_hash_table_insert(self->section_boxes, (gchar *)backend_id, box); } /** * Utility to insert a single backend */ static inline void brisk_menu_window_insert_backend(BriskMenuWindow *self, BriskBackend *backend) { const gchar *backend_id = brisk_backend_get_id(backend); g_hash_table_insert(self->backends, (gchar *)backend_id, backend); brisk_menu_window_init_backend(self, backend); } /** * Handle deletion for children in the sidebar */ void brisk_menu_window_remove_category(GtkWidget *widget, BriskMenuWindow *self) { BriskSection *section = NULL; const gchar *section_id = NULL; if (!GTK_IS_RADIO_BUTTON(widget)) { return; } g_object_get(widget, "section", §ion, NULL); if (!section) { g_warning("missing section for category button"); } section_id = brisk_section_get_id(section); g_hash_table_remove(self->item_store, section_id); gtk_widget_destroy(widget); } /** * Bring up the initial backends */ void brisk_menu_window_init_backends(BriskMenuWindow *self) { brisk_menu_window_insert_backend(self, brisk_favourites_backend_new()); brisk_menu_window_insert_backend(self, brisk_all_items_backend_new()); brisk_menu_window_insert_backend(self, brisk_apps_backend_new()); } /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 8 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=8 tabstop=8 expandtab: * :indentSize=8:tabSize=8:noTabs=true: */ brisk-menu-0.6.0/src/frontend/menu-private.h000066400000000000000000000137371352323743400210050ustar00rootroot00000000000000/* * This file is part of brisk-menu. * * Copyright © 2016-2019 Brisk Menu Developers * * 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 2 of the License, or * (at your option) any later version. */ #pragma once #include "backend/backend.h" #include "entry-button.h" #include "key-binder.h" #include "launcher.h" #include "libsaver-glue.h" #include "libsession-glue.h" #include "menu-window.h" #include "util.h" #include typedef enum { SEARCH_POS_MIN = 0, SEARCH_POS_BOTTOM = 1 << 0, SEARCH_POS_TOP = 1 << 1, SEARCH_POS_AUTOMATIC = 1 << 2, SEARCH_POS_MAX, } SearchPosition; struct _BriskMenuWindowClass { GtkWindowClass parent_class; const gchar *(*get_id)(BriskMenuWindow *); const gchar *(*get_display_name)(BriskMenuWindow *); void (*update_screen_position)(BriskMenuWindow *); void (*update_search)(BriskMenuWindow *); void (*add_item)(BriskMenuWindow *, BriskItem *, BriskBackend *); void (*add_section)(BriskMenuWindow *, BriskSection *, BriskBackend *); void (*invalidate_filter)(BriskMenuWindow *, BriskBackend *); void (*reset)(BriskMenuWindow *, BriskBackend *); gpointer padding[12]; }; /** * BriskMenuWindow is an abstract top-level class which is used as the base * of all other window implementations within Brisk. */ struct _BriskMenuWindow { GtkWindow parent; /* Current panel position */ GtkPositionType position; /* Current search position */ SearchPosition search_position; /* Top search entry */ GtkWidget *search; /* Whether we have a grab or not */ gboolean grabbed; /* Whether we're in rollover mode or not */ gboolean rollover; /* Global settings for all BriskMenu instances */ GSettings *settings; /* Control hotkeys */ BriskKeyBinder *binder; gchar *shortcut; GtkWidget *context_menu; GActionGroup *context_group; /* Each backend gets its own box in the sidebar */ GHashTable *section_boxes; /* Each backend is also plugged into one big map */ GHashTable *backends; /* Acknowledge a single ID "contains" map */ GHashTable *item_store; /* Control launches */ BriskMenuLauncher *launcher; /* Search term, may be null at any point. Used for filtering */ gchar *search_term; /* The current section used in filtering */ BriskSection *active_section; gboolean filtering; GtkWidget *relative_to; /* The widget that contains our backend section boxes */ GtkWidget *section_box_holder; GtkWidget *section_box_leader; /* Session management */ GnomeSessionManager *session; MateScreenSaver *saver; }; GtkWidget *brisk_menu_window_get_section_box(BriskMenuWindow *self, BriskBackend *backend); /** * Update internal notion of where the parent panel is on screen */ void brisk_menu_window_set_parent_position(BriskMenuWindow *window, GtkPositionType position); void brisk_menu_window_select_sections(BriskMenuWindow *self); GtkWidget *brisk_menu_window_find_first_visible_radio(BriskMenuWindow *self); /* Loader */ gboolean brisk_menu_window_load_menus(BriskMenuWindow *self); void brisk_menu_window_init_backends(BriskMenuWindow *self); void brisk_menu_window_remove_category(GtkWidget *widget, BriskMenuWindow *self); /* Sorting */ gint brisk_menu_window_sort(BriskMenuWindow *self, BriskItem *itemA, BriskItem *itemB); /* Keyboard */ gboolean brisk_menu_window_key_press(BriskMenuWindow *self, GdkEvent *event, gpointer v); gboolean brisk_menu_window_key_release(BriskMenuWindow *self, GdkEvent *event, gpointer v); void brisk_menu_window_update_hotkey(BriskMenuWindow *self, gchar *key); /* Global grabs */ void brisk_menu_window_configure_grabs(BriskMenuWindow *self); /* Session controls */ void brisk_menu_window_logout(BriskMenuWindow *self, gpointer v); void brisk_menu_window_shutdown(BriskMenuWindow *self, gpointer v); void brisk_menu_window_lock(BriskMenuWindow *self, gpointer v); gboolean brisk_menu_window_setup_session(BriskMenuWindow *self); /* Settings */ void brisk_menu_window_init_settings(BriskMenuWindow *self); void brisk_menu_window_pump_settings(BriskMenuWindow *self); /* Context menu */ void brisk_menu_window_show_context(BriskMenuWindow *self, BriskItem *item, BriskMenuEntryButton *button); void brisk_menu_window_configure_context(BriskMenuWindow *self); /* Search */ void brisk_menu_window_clear_search(GtkEntry *entry, GtkEntryIconPosition pos, GdkEvent *event, gpointer v); void brisk_menu_window_search(BriskMenuWindow *self, GtkEntry *entry); gboolean brisk_menu_window_filter_apps(BriskMenuWindow *self, GtkWidget *child); DEF_AUTOFREE(GtkWidget, gtk_widget_destroy) DEF_AUTOFREE(GSList, g_slist_free) DEF_AUTOFREE(GList, g_list_free) DEF_AUTOFREE(GFile, g_object_unref) DEF_AUTOFREE(GIcon, g_object_unref) DEF_AUTOFREE(gchar, g_free) DEF_AUTOFREE(GdkAppLaunchContext, g_object_unref) DEF_AUTOFREE(GError, g_error_free) DEF_AUTOFREE(GAppInfo, g_object_unref) /* Helper for gsettings */ typedef gchar *gstrv; DEF_AUTOFREE(gstrv, g_strfreev) /** * Convenience function to remove children from a container */ __attribute__((always_inline)) static inline void brisk_menu_kill_children(GtkContainer *container) { for (autofree(GList) *elem = gtk_container_get_children(container); elem; elem = elem->next) { gtk_widget_destroy(GTK_WIDGET(elem->data)); } } /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 8 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=8 tabstop=8 expandtab: * :indentSize=8:tabSize=8:noTabs=true: */ brisk-menu-0.6.0/src/frontend/menu-search.c000066400000000000000000000120371352323743400205630ustar00rootroot00000000000000/* * This file is part of brisk-menu. * * Copyright © 2016-2019 Brisk Menu Developers * * 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 2 of the License, or * (at your option) any later version. */ #include "util.h" #include BRISK_BEGIN_PEDANTIC #include "menu-private.h" #include #include #include BRISK_END_PEDANTIC /** * Update sensitivity - ignoring non checkboxes */ static void brisk_menu_set_checks_sensitive(GtkWidget *parent, gboolean sensitive) { autofree(GList) *kids = NULL; GList *elem = NULL; kids = gtk_container_get_children(GTK_CONTAINER(parent)); for (elem = kids; elem; elem = elem->next) { GtkWidget *kid = elem->data; if (!GTK_IS_CHECK_BUTTON(kid)) { continue; } gtk_widget_set_sensitive(kid, sensitive); } } /** * Ask all boxes to update their section children */ static void brisk_menu_set_categories_sensitive(BriskMenuWindow *self, gboolean sensitive) { brisk_menu_set_checks_sensitive(self->section_box_holder, sensitive); GHashTableIter iter; __attribute__((unused)) gchar *key = NULL; GtkWidget *box = NULL; /* Update all sideboxes for search */ g_hash_table_iter_init(&iter, self->section_boxes); while (g_hash_table_iter_next(&iter, (void **)&key, (void **)&box)) { brisk_menu_set_checks_sensitive(box, sensitive); } } /** * brisk_menu_window_filter_section: * * This function will handle filtering the selection based on the active * section, when no search term is applied. * * Returning TRUE means the item should be displayed */ __brisk_pure__ static gboolean brisk_menu_window_filter_section(BriskMenuWindow *self, BriskItem *item) { /* All visible */ if (!self->active_section) { return TRUE; } return brisk_section_can_show_item(self->active_section, item); } /** * brisk_menu_window_clear_search: * * Simply put, resets the active search term */ void brisk_menu_window_clear_search(GtkEntry *entry, GtkEntryIconPosition pos, __brisk_unused__ GdkEvent *event, __brisk_unused__ gpointer v) { if (pos != GTK_ENTRY_ICON_SECONDARY) { return; } gtk_entry_set_text(entry, ""); } /** * brisk_menu_window_search: * * Callback for the text entry changing. Set the search term and force * an invalidation of our filters. */ void brisk_menu_window_search(BriskMenuWindow *self, GtkEntry *entry) { const gchar *search_term = NULL; if (!self->filtering) { return; } /* Remove old search term */ search_term = gtk_entry_get_text(entry); g_clear_pointer(&self->search_term, g_free); /* New search term, always lower case for simplicity */ self->search_term = g_strstrip(g_ascii_strdown(search_term, -1)); /* Reset our search term if it's not valid anymore, or whitespace */ if (strlen(self->search_term) > 0) { brisk_menu_set_categories_sensitive(self, FALSE); } else { brisk_menu_set_categories_sensitive(self, TRUE); g_clear_pointer(&self->search_term, g_free); } /* Now filter again */ brisk_menu_window_invalidate_filter(self, NULL); } __brisk_pure__ gboolean brisk_menu_window_filter_apps(BriskMenuWindow *self, GtkWidget *child) { const gchar *item_id = NULL; BriskItem *item = NULL; GtkWidget *compare_child = NULL; g_object_get(child, "item", &item, NULL); if (!item) { return FALSE; } /* Item ID's are unique, so the last entry added for an ID is the * button we want to display. Basically, a button can be duplicated and * appear in multiple categories. By keeping a unique ID -> button mapping, * we ensure we only ever show it once in the search function. */ item_id = brisk_item_get_id(item); if (item_id) { compare_child = g_hash_table_lookup(self->item_store, item_id); if (compare_child && compare_child != child) { return FALSE; } } /* If we have no search term, filter on the section */ if (!self->search_term) { return brisk_menu_window_filter_section(self, item); } /* Have search term? Filter on that. */ return brisk_item_matches_search(item, self->search_term); } /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 8 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=8 tabstop=8 expandtab: * :indentSize=8:tabSize=8:noTabs=true: */ brisk-menu-0.6.0/src/frontend/menu-session.c000066400000000000000000000126221352323743400210010ustar00rootroot00000000000000/* * This file is part of brisk-menu. * * Copyright © 2016-2019 Brisk Menu Developers * * 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 2 of the License, or * (at your option) any later version. */ #define _GNU_SOURCE #include "util.h" BRISK_BEGIN_PEDANTIC #include "menu-private.h" #include #include BRISK_END_PEDANTIC static void brisk_menu_window_logout_cb(__brisk_unused__ GObject *obj, GAsyncResult *res, gpointer v) { autofree(GError) *error = NULL; BriskMenuWindow *self = v; gnome_session_manager_call_logout_finish(self->session, res, &error); if (error) { g_warning("Error logging out: %s", error->message); } } static gboolean brisk_menu_window_logout_real(BriskMenuWindow *self) { if (!self->session) { return FALSE; } gnome_session_manager_call_logout(self->session, 0, NULL, brisk_menu_window_logout_cb, self); return FALSE; } /** * Handle log out */ void brisk_menu_window_logout(BriskMenuWindow *self, __brisk_unused__ gpointer v) { gtk_widget_hide(GTK_WIDGET(self)); g_idle_add((GSourceFunc)brisk_menu_window_logout_real, self); } static void brisk_menu_window_shutdown_cb(__brisk_unused__ GObject *obj, GAsyncResult *res, gpointer v) { autofree(GError) *error = NULL; BriskMenuWindow *self = v; gnome_session_manager_call_shutdown_finish(self->session, res, &error); if (error) { g_warning("Error shutting down: %s", error->message); } } static inline gboolean brisk_menu_window_shutdown_real(BriskMenuWindow *self) { if (!self->session) { return FALSE; } gnome_session_manager_call_shutdown(self->session, NULL, brisk_menu_window_shutdown_cb, self); return FALSE; } /** * Handle shut down */ void brisk_menu_window_shutdown(BriskMenuWindow *self, __brisk_unused__ gpointer v) { gtk_widget_hide(GTK_WIDGET(self)); g_idle_add((GSourceFunc)brisk_menu_window_shutdown_real, self); } static void brisk_menu_window_lock_cb(__brisk_unused__ GObject *obj, GAsyncResult *res, gpointer v) { autofree(GError) *error = NULL; BriskMenuWindow *self = v; mate_screen_saver_call_lock_finish(self->saver, res, &error); if (error) { g_warning("Error locking screen: %s", error->message); } } static inline gboolean brisk_menu_window_lock_real(BriskMenuWindow *self) { if (!self->saver) { return FALSE; } mate_screen_saver_call_lock(self->saver, NULL, brisk_menu_window_lock_cb, self); return FALSE; } /** * Handle lock */ void brisk_menu_window_lock(BriskMenuWindow *self, __brisk_unused__ gpointer v) { gtk_widget_hide(GTK_WIDGET(self)); g_idle_add((GSourceFunc)brisk_menu_window_lock_real, self); } gboolean brisk_menu_window_setup_session(BriskMenuWindow *self) { autofree(GError) *error = NULL; gboolean can_shutdown = FALSE; __brisk_unused__ gboolean is_active = FALSE; /* Sort out gnome-session dbus */ self->session = gnome_session_manager_proxy_new_for_bus_sync( G_BUS_TYPE_SESSION, G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START | G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, "org.gnome.SessionManager", "/org/gnome/SessionManager", NULL, &error); if (error) { g_warning("Failed to contact org.gnome.SessionManager: %s\n", error->message); g_error_free(error); goto saver_init; } /* Set sensitive according to policy */ gnome_session_manager_call_can_shutdown_sync(self->session, &can_shutdown, NULL, NULL); saver_init: self->saver = mate_screen_saver_proxy_new_for_bus_sync(G_BUS_TYPE_SESSION, G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, "org.mate.ScreenSaver", "/org/mate/ScreenSaver", NULL, &error); if (error) { g_warning("Failed to contact org.mate.ScreenSaver: %s\n", error->message); return FALSE; } /* Check the screensaver is *really* running */ mate_screen_saver_call_get_active_sync(self->saver, &is_active, NULL, &error); if (error) { g_warning("org.mate.ScreenSaver not running: %s\n", error->message); } return FALSE; } /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 8 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=8 tabstop=8 expandtab: * :indentSize=8:tabSize=8:noTabs=true: */ brisk-menu-0.6.0/src/frontend/menu-settings.c000066400000000000000000000047671352323743400211710ustar00rootroot00000000000000/* * This file is part of brisk-menu. * * Copyright © 2016-2019 Brisk Menu Developers * * 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 2 of the License, or * (at your option) any later version. */ #include "util.h" #include BRISK_BEGIN_PEDANTIC #include "menu-private.h" BRISK_END_PEDANTIC static void brisk_menu_window_settings_changed(GSettings *settings, const gchar *key, gpointer v); void brisk_menu_window_init_settings(BriskMenuWindow *self) { GtkSettings *gtk_settings = NULL; self->settings = g_settings_new("com.solus-project.brisk-menu"); self->position = GTK_POS_TOP; gtk_settings = gtk_settings_get_default(); /* Make dark-theme key work */ g_settings_bind(self->settings, "dark-theme", gtk_settings, "gtk-application-prefer-dark-theme", G_SETTINGS_BIND_DEFAULT); g_signal_connect(self->settings, "changed", G_CALLBACK(brisk_menu_window_settings_changed), self); } void brisk_menu_window_pump_settings(BriskMenuWindow *self) { brisk_menu_window_settings_changed(self->settings, "search-position", self); brisk_menu_window_settings_changed(self->settings, "rollover-activate", self); brisk_menu_window_settings_changed(self->settings, "hot-key", self); } static void brisk_menu_window_settings_changed(GSettings *settings, const gchar *key, gpointer v) { BriskMenuWindow *self = v; autofree(gchar) *value = NULL; if (g_str_equal(key, "search-position")) { self->search_position = g_settings_get_enum(settings, key); brisk_menu_window_update_search(self); return; } else if (g_str_equal(key, "rollover-activate")) { self->rollover = g_settings_get_boolean(settings, key); } else if (g_str_equal(key, "hot-key")) { value = g_settings_get_string(settings, key); brisk_menu_window_update_hotkey(self, value); } } /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 8 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=8 tabstop=8 expandtab: * :indentSize=8:tabSize=8:noTabs=true: */ brisk-menu-0.6.0/src/frontend/menu-sort.c000066400000000000000000000051461352323743400203100ustar00rootroot00000000000000/* * This file is part of brisk-menu. * * Copyright © 2016-2019 Brisk Menu Developers * * 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 2 of the License, or * (at your option) any later version. */ #include "util.h" #include BRISK_BEGIN_PEDANTIC #include "entry-button.h" #include "menu-private.h" #include BRISK_END_PEDANTIC /** * Compute a score for the given entry based on the input term. */ __brisk_pure__ static gint brisk_get_entry_score(BriskItem *item, const gchar *term) { gint score = 0; autofree(gchar) *name = NULL; char *find = NULL; name = g_ascii_strdown(brisk_item_get_name(item), -1); if (g_str_equal(name, term)) { score += 100; } else if (g_str_has_prefix(name, term)) { score += 50; } find = strstr(name, term); if (find) { score += 20 + (int)strlen(find); } score += strcmp(name, term); return score; } __brisk_pure__ gint brisk_menu_window_sort(BriskMenuWindow *self, BriskItem *itemA, BriskItem *itemB) { autofree(gchar) *nameA = NULL; autofree(gchar) *nameB = NULL; gint sc1 = -1, sc2 = -1; /* Handle normal searching */ if (self->search_term) { sc1 = brisk_get_entry_score(itemA, self->search_term); sc2 = brisk_get_entry_score(itemB, self->search_term); return (sc1 > sc2) - (sc1 - sc2); } if (!self->active_section) { goto basic_sort; } sc1 = brisk_section_get_sort_order(self->active_section, itemB); sc2 = brisk_section_get_sort_order(self->active_section, itemA); /* Negative score means the section doesn't support custom ordering */ if (sc1 >= 0 || sc2 >= 0) { /* Sort based on the sections understanding */ return (sc1 > sc2) - (sc1 - sc2); } basic_sort: /* Ensure we compare lower case only */ nameA = g_ascii_strdown(brisk_item_get_display_name(itemA), -1); nameB = g_ascii_strdown(brisk_item_get_display_name(itemB), -1); return g_strcmp0(nameA, nameB); } /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 8 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=8 tabstop=8 expandtab: * :indentSize=8:tabSize=8:noTabs=true: */ brisk-menu-0.6.0/src/frontend/menu-window.c000066400000000000000000000213521352323743400206250ustar00rootroot00000000000000/* * This file is part of brisk-menu. * * Copyright © 2017-2019 Brisk Menu Developers * * 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 2 of the License, or * (at your option) any later version. */ #define _GNU_SOURCE #include "util.h" BRISK_BEGIN_PEDANTIC #include "menu-private.h" BRISK_END_PEDANTIC G_DEFINE_TYPE(BriskMenuWindow, brisk_menu_window, GTK_TYPE_WINDOW) static void brisk_menu_window_set_property(GObject *object, guint id, const GValue *value, GParamSpec *spec); static void brisk_menu_window_get_property(GObject *object, guint id, GValue *value, GParamSpec *spec); enum { PROP_RELATIVE_TO = 1, N_PROPS }; static GParamSpec *obj_properties[N_PROPS] = { NULL, }; /** * brisk_menu_window_dispose: * * Clean up a BriskMenuWindow instance */ static void brisk_menu_window_dispose(GObject *obj) { BriskMenuWindow *self = BRISK_MENU_WINDOW(obj); g_clear_object(&self->binder); g_clear_pointer(&self->shortcut, g_free); g_clear_pointer(&self->search_term, g_free); g_clear_object(&self->launcher); g_clear_object(&self->session); g_clear_object(&self->saver); g_clear_object(&self->settings); g_clear_pointer(&self->item_store, g_hash_table_unref); g_clear_pointer(&self->section_boxes, g_hash_table_unref); g_clear_pointer(&self->backends, g_hash_table_unref); g_clear_pointer(&self->context_menu, gtk_widget_destroy); g_clear_object(&self->context_group); G_OBJECT_CLASS(brisk_menu_window_parent_class)->dispose(obj); } /** * brisk_menu_window_class_init: * * Handle class initialisation */ static void brisk_menu_window_class_init(BriskMenuWindowClass *klazz) { GObjectClass *obj_class = G_OBJECT_CLASS(klazz); /* gobject vtable hookup */ obj_class->dispose = brisk_menu_window_dispose; obj_class->set_property = brisk_menu_window_set_property; obj_class->get_property = brisk_menu_window_get_property; /* Set up properties */ obj_properties[PROP_RELATIVE_TO] = g_param_spec_pointer("relative-to", "GtkWidget we appear near", "Owning GtkWidget for this BriskMenuWindow", G_PARAM_CONSTRUCT | G_PARAM_READWRITE); g_object_class_install_properties(obj_class, N_PROPS, obj_properties); } /** * brisk_menu_window_init: * * Handle construction of the BriskMenuWindow */ static void brisk_menu_window_init(BriskMenuWindow *self) { gtk_window_set_decorated(GTK_WINDOW(self), FALSE); gtk_window_set_type_hint(GTK_WINDOW(self), GDK_WINDOW_TYPE_HINT_POPUP_MENU); gtk_window_set_skip_pager_hint(GTK_WINDOW(self), TRUE); gtk_window_set_skip_taskbar_hint(GTK_WINDOW(self), TRUE); /* Initialise main tables */ self->item_store = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); self->section_boxes = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, NULL); self->backends = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_object_unref); self->binder = brisk_key_binder_new(); self->launcher = brisk_menu_launcher_new(); brisk_menu_window_init_settings(self); } static void brisk_menu_window_set_property(GObject *object, guint id, const GValue *value, GParamSpec *spec) { BriskMenuWindow *self = BRISK_MENU_WINDOW(object); switch (id) { case PROP_RELATIVE_TO: self->relative_to = g_value_get_pointer(value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, id, spec); break; } } static void brisk_menu_window_get_property(GObject *object, guint id, GValue *value, GParamSpec *spec) { BriskMenuWindow *self = BRISK_MENU_WINDOW(object); switch (id) { case PROP_RELATIVE_TO: g_value_set_pointer(value, self->relative_to); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, id, spec); break; } } void brisk_menu_window_set_parent_position(BriskMenuWindow *self, GtkPositionType position) { self->position = position; brisk_menu_window_update_screen_position(self); brisk_menu_window_update_search(self); } /** * brisk_menu_window_select_sidebar: * * Select the first child in the section box holder prior to any kind of display */ void brisk_menu_window_select_sections(BriskMenuWindow *self) { GtkWidget *next_child = NULL; /* Activate the first child in the group after the dummy widget */ next_child = brisk_menu_window_find_first_visible_radio(self); if (next_child) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(next_child), TRUE); } } GtkWidget *brisk_menu_window_find_first_visible_radio(BriskMenuWindow *self) { autofree(GList) *box_kids = NULL; autofree(GList) *box_kids2 = NULL; GtkWidget *main_box = NULL; GList *elem = NULL; box_kids = gtk_container_get_children(GTK_CONTAINER(self->section_box_holder)); for (elem = box_kids; elem; elem = elem->next) { if (!GTK_IS_BOX(elem->data)) { continue; } main_box = elem->data; break; } if (!main_box) { return NULL; } box_kids2 = gtk_container_get_children(GTK_CONTAINER(main_box)); return g_list_nth_data(box_kids2, 0); } /** * brisk_menu_window_get_id: * * Return the unique ID for the window * @note This string is owned by the window and must not be freed */ const gchar *brisk_menu_window_get_id(BriskMenuWindow *window) { g_assert(window != NULL); BriskMenuWindowClass *klazz = BRISK_MENU_WINDOW_GET_CLASS(window); g_assert(klazz->get_id != NULL); return klazz->get_id(window); } /** * brisk_menu_window_get_display_name: * * Return the display name for the window * @note This string is owned by the window and must not be freed */ const gchar *brisk_menu_window_get_display_name(BriskMenuWindow *window) { g_assert(window != NULL); BriskMenuWindowClass *klazz = BRISK_MENU_WINDOW_GET_CLASS(window); g_assert(klazz->get_display_name != NULL); return klazz->get_display_name(window); } /** * brisk_menu_window_update_screen_position: * * Ask that the menu window updates it's position on screen */ void brisk_menu_window_update_screen_position(BriskMenuWindow *window) { g_assert(window != NULL); BriskMenuWindowClass *klazz = BRISK_MENU_WINDOW_GET_CLASS(window); g_assert(klazz->add_item != NULL); klazz->update_screen_position(window); } void brisk_menu_window_update_search(BriskMenuWindow *window) { g_assert(window != NULL); BriskMenuWindowClass *klazz = BRISK_MENU_WINDOW_GET_CLASS(window); if (klazz->update_search) { klazz->update_search(window); } } void brisk_menu_window_add_item(BriskMenuWindow *window, BriskItem *item, BriskBackend *backend) { g_assert(window != NULL); BriskMenuWindowClass *klazz = BRISK_MENU_WINDOW_GET_CLASS(window); g_assert(klazz->add_item != NULL); klazz->add_item(window, item, backend); } void brisk_menu_window_add_section(BriskMenuWindow *window, BriskSection *section, BriskBackend *backend) { g_assert(window != NULL); BriskMenuWindowClass *klazz = BRISK_MENU_WINDOW_GET_CLASS(window); g_assert(klazz->add_section != NULL); klazz->add_section(window, section, backend); } void brisk_menu_window_invalidate_filter(BriskMenuWindow *window, BriskBackend *backend) { g_assert(window != NULL); BriskMenuWindowClass *klazz = BRISK_MENU_WINDOW_GET_CLASS(window); g_assert(klazz->invalidate_filter != NULL); klazz->invalidate_filter(window, backend); } void brisk_menu_window_reset(BriskMenuWindow *window, BriskBackend *backend) { g_assert(window != NULL); BriskMenuWindowClass *klazz = BRISK_MENU_WINDOW_GET_CLASS(window); g_assert(klazz->reset != NULL); klazz->reset(window, backend); } /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 8 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=8 tabstop=8 expandtab: * :indentSize=8:tabSize=8:noTabs=true: */ brisk-menu-0.6.0/src/frontend/menu-window.h000066400000000000000000000044321352323743400206320ustar00rootroot00000000000000/* * This file is part of brisk-menu. * * Copyright © 2017-2019 Brisk Menu Developers * * 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 2 of the License, or * (at your option) any later version. */ #pragma once #include #include G_BEGIN_DECLS typedef struct _BriskMenuWindow BriskMenuWindow; typedef struct _BriskMenuWindowClass BriskMenuWindowClass; #define BRISK_TYPE_MENU_WINDOW brisk_menu_window_get_type() #define BRISK_MENU_WINDOW(o) \ (G_TYPE_CHECK_INSTANCE_CAST((o), BRISK_TYPE_MENU_WINDOW, BriskMenuWindow)) #define BRISK_IS_MENU_WINDOW(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), BRISK_TYPE_MENU_WINDOW)) #define BRISK_MENU_WINDOW_CLASS(o) \ (G_TYPE_CHECK_CLASS_CAST((o), BRISK_TYPE_MENU_WINDOW, BriskMenuWindowClass)) #define BRISK_IS_MENU_WINDOW_CLASS(o) (G_TYPE_CHECK_CLASS_TYPE((o), BRISK_TYPE_MENU_WINDOW)) #define BRISK_MENU_WINDOW_GET_CLASS(o) \ (G_TYPE_INSTANCE_GET_CLASS((o), BRISK_TYPE_MENU_WINDOW, BriskMenuWindowClass)) GType brisk_menu_window_get_type(void); const gchar *brisk_menu_window_get_id(BriskMenuWindow *window); const gchar *brisk_menu_window_get_display_name(BriskMenuWindow *window); void brisk_menu_window_update_screen_position(BriskMenuWindow *window); void brisk_menu_window_update_search(BriskMenuWindow *window); void brisk_menu_window_invalidate_filter(BriskMenuWindow *self, BriskBackend *backend); void brisk_menu_window_add_item(BriskMenuWindow *window, BriskItem *item, BriskBackend *backend); void brisk_menu_window_add_section(BriskMenuWindow *window, BriskSection *section, BriskBackend *backend); void brisk_menu_window_reset(BriskMenuWindow *window, BriskBackend *backend); G_END_DECLS /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 8 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=8 tabstop=8 expandtab: * :indentSize=8:tabSize=8:noTabs=true: */ brisk-menu-0.6.0/src/frontend/meson.build000066400000000000000000000022261352323743400203510ustar00rootroot00000000000000libfrontend_sources = [ 'entry-button.c', 'launcher.c', 'menu-context.c', 'menu-grabs.c', 'menu-keyboard.c', 'menu-loader.c', 'menu-loader.c', 'menu-search.c', 'menu-session.c', 'menu-settings.c', 'menu-sort.c', 'menu-window.c', 'classic/category-button.c', 'classic/classic-entry-button.c', 'classic/classic-window.c', 'classic/desktop-button.c', 'classic/sidebar-scroller.c', 'dash/category-button.c', 'dash/dash-entry-button.c', 'dash/dash-window.c', ] libfrontend_dependencies = [ link_libbackend, link_libsession_stub, link_libutil, dep_gtk3, ] libfrontend_includes = [ include_directories('.'), include_directories('../../data'), ] # Contains the main Brisk UI (Windowed) libfrontend = static_library( 'brisk-frontend', sources: libfrontend_sources, dependencies: libfrontend_dependencies, include_directories: libfrontend_includes, install: false, ) # Allow linking the frontend link_libfrontend = declare_dependency( link_with: libfrontend, dependencies: libfrontend_dependencies, include_directories: libfrontend_includes, ) brisk-menu-0.6.0/src/lib/000077500000000000000000000000001352323743400151345ustar00rootroot00000000000000brisk-menu-0.6.0/src/lib/authors.h000066400000000000000000000017051352323743400167750ustar00rootroot00000000000000#pragma once #include /* Machine generated by gen_authors.sh */ static const char *brisk_developers[] = { "Adam Hobaugh ", "Daniel Greenwood ", "Eric Turgeon <4249848+ericbsd@users.noreply.github.com>", "Federico Damián Schonborn ", "gabrc52 ", "gabrielfin ", "Ikey Doherty ", "Joshua Strobl ", "Kim Malmo ", "Martin Wimpress ", "Mike Gabriel ", "Pierre-Yves ", "raveit65 ", "Staudey ", "Stefan Ric ", "Stefan Ric ", "Victor Kareh ", NULL, }; brisk-menu-0.6.0/src/lib/key-binder.c000066400000000000000000000315471352323743400173430ustar00rootroot00000000000000/* * This file is part of brisk-menu. * * Largely inspired by: https://esite.ch/2011/02/global-hotkeys-with-vala/ * * Copyright © 2016-2019 Brisk Menu Developers * * 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 2 of the License, or * (at your option) any later version. */ #define _GNU_SOURCE #include "util.h" BRISK_BEGIN_PEDANTIC #include "key-binder.h" #include #include #include #include #include #include BRISK_END_PEDANTIC struct _BriskKeyBinderClass { GObjectClass parent_class; }; /** * BriskKeyBinder is used to bind global x11 shortcuts */ struct _BriskKeyBinder { GObject parent; GdkWindow *root_window; GHashTable *bindings; gboolean wait_for_release; }; /** * A KeyBinding is used to map the input + function pointer into something * we can store and test. */ typedef struct KeyBinding { const gchar *accelerator; KeyCode keycode; GdkModifierType mods; BinderFunc func; gpointer udata; } KeyBinding; static GdkFilterReturn brisk_key_binder_filter(GdkXEvent *xevent, GdkEvent *event, gpointer v); static void free_keybinding(KeyBinding *binding); /** * When binding a shortcut, we bind all possible combinations of lock key modifiers * so that we'll get the event regardless (i.e. capslock/numlock) */ static GdkModifierType _modifiers[] = { 0, GDK_MOD2_MASK, GDK_LOCK_MASK, GDK_MOD5_MASK, GDK_MOD2_MASK | GDK_LOCK_MASK, GDK_MOD2_MASK | GDK_MOD5_MASK, GDK_LOCK_MASK | GDK_MOD5_MASK, GDK_MOD2_MASK | GDK_LOCK_MASK | GDK_MOD5_MASK }; G_DEFINE_TYPE(BriskKeyBinder, brisk_key_binder, G_TYPE_OBJECT) /** * brisk_key_binder_new: * * Construct a new BriskKeyBinder object */ BriskKeyBinder *brisk_key_binder_new() { return g_object_new(BRISK_TYPE_KEY_BINDER, NULL); } /** * brisk_key_binder_dispose: * * Clean up a BriskKeyBinder instance */ static void brisk_key_binder_dispose(GObject *obj) { BriskKeyBinder *self = NULL; /* Remove our filter again */ self = BRISK_KEY_BINDER(obj); if (self->root_window) { gdk_window_remove_filter(self->root_window, brisk_key_binder_filter, self); self->root_window = NULL; } /* Will automatically clean up all bindings too */ g_clear_pointer(&self->bindings, g_hash_table_unref); G_OBJECT_CLASS(brisk_key_binder_parent_class)->dispose(obj); } /** * brisk_key_binder_class_init: * * Handle class initialisation */ static void brisk_key_binder_class_init(BriskKeyBinderClass *klazz) { GObjectClass *obj_class = G_OBJECT_CLASS(klazz); /* gobject vtable hookup */ obj_class->dispose = brisk_key_binder_dispose; } /** * brisk_key_binder_init: * * Handle construction of the BriskKeyBinder */ static void brisk_key_binder_init(BriskKeyBinder *self) { GdkWindow *root = NULL; self->bindings = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, (GDestroyNotify)free_keybinding); root = gdk_get_default_root_window(); if (!root) { g_warning("No root window found, cannot bind events"); return; } self->root_window = root; gdk_window_add_filter(root, brisk_key_binder_filter, self); } static char* get_window_manager(void) { Window *xwindow; Window wm_window; Atom type; gint format; gulong nitems; gulong bytes_after; Atom wm_check = gdk_x11_get_xatom_by_name ("_NET_SUPPORTING_WM_CHECK"); XGetWindowProperty (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), GDK_ROOT_WINDOW (), wm_check, 0, G_MAXLONG, False, XA_WINDOW, &type, &format, &nitems, &bytes_after, (guchar **) &xwindow); if (type != XA_WINDOW) { return g_strdup ("Unknown"); } gdk_error_trap_push (); XSelectInput (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), *xwindow, StructureNotifyMask | PropertyChangeMask); XSync (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), False); if (gdk_error_trap_pop ()) { XFree (xwindow); return g_strdup ("Unknown"); } wm_window = *xwindow; XFree (xwindow); Atom utf8_string = gdk_x11_get_xatom_by_name ("UTF8_STRING"); Atom wm_name = gdk_x11_get_xatom_by_name ("_NET_WM_NAME"); gchar *val; gchar *wm; int result; val = NULL; gdk_error_trap_push (); result = XGetWindowProperty (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), wm_window, wm_name, 0, G_MAXLONG, False, utf8_string, &type, &format, &nitems, &bytes_after, (guchar **) &val); if (gdk_error_trap_pop () || result != Success || type != utf8_string || format != 8 || nitems == 0 || !g_utf8_validate (val, (gssize)nitems, NULL)) { wm = NULL; } else { wm = g_strndup (val, nitems); } if (val) XFree (val); return wm; } /** * Handle global events (eventually) */ static GdkFilterReturn brisk_key_binder_filter(GdkXEvent *xevent, GdkEvent *event, gpointer v) { BriskKeyBinder *self = NULL; XEvent *xev = xevent; GHashTableIter iter = { 0 }; const gchar *key = NULL; const KeyBinding *binding = NULL; guint mods; Display *display = NULL; KeySym keysym; self = BRISK_KEY_BINDER(v); display = GDK_WINDOW_XDISPLAY(self->root_window); if (xev->type != KeyRelease && xev->type != KeyPress && xev->type != ButtonPress) { return GDK_FILTER_CONTINUE; } /* unset mask of the lock keys */ mods = xev->xkey.state & ~(_modifiers[7]); /* unset mask of Mod4 if using Super_L key as hotkey */ keysym = XkbKeycodeToKeysym(display, (KeyCode)xev->xkey.keycode, 0, 0); if (keysym == GDK_KEY_Super_L) { mods = mods & ~((guint)GDK_MOD4_MASK); } g_hash_table_iter_init(&iter, self->bindings); /* Find a matching binding */ while (g_hash_table_iter_next(&iter, (void **)&key, (void **)&binding)) { if (xev->type == KeyPress && xev->xkey.keycode == binding->keycode && !self->wait_for_release) { /* capture initial key press */ if (mods == binding->mods) { self->wait_for_release = TRUE; } } else if (xev->type == KeyRelease && xev->xkey.keycode == binding->keycode && self->wait_for_release) { /* capture release within same shortcut sequence */ binding->func(event, binding->udata); self->wait_for_release = FALSE; } else if (xev->type == ButtonPress) { /* Modifiers are often used with mouse events. * Don't let the key-binder swallow those */ XAllowEvents(display, ReplayPointer, CurrentTime); /* Compiz would rather not have the event sent to it and just read it from * the replayed queue. All other window managers seem to expect an event. */ gchar *wm = get_window_manager (); if (g_strcmp0 (wm, "Compiz") != 0) { Window root_return, child_return; int root_x_return, root_y_return; int win_x_return, win_y_return; unsigned int mask_return; XUngrabKeyboard(display, CurrentTime); XUngrabPointer(display, CurrentTime); XQueryPointer(display, GDK_WINDOW_XID(self->root_window), &root_return, &child_return, &root_x_return, &root_y_return, &win_x_return, &win_y_return, &mask_return); XSendEvent(display, child_return, TRUE, ButtonPressMask, xev); } g_free (wm); self->wait_for_release = FALSE; } else { XUngrabKeyboard(display, xev->xkey.time); /* when breaking the shortcut sequence, send the event up the window * hierarchy in case it's part of a different shortcut sequence * (e.g. a) */ XSendEvent(display, xev->xkey.window, TRUE, KeyPressMask | KeyReleaseMask, xev); self->wait_for_release = FALSE; } } return GDK_FILTER_CONTINUE; } /** * Bind a shortcut with the appropriate callback */ gboolean brisk_key_binder_bind(BriskKeyBinder *self, const gchar *shortcut, BinderFunc func, gpointer v) { guint keysym; GdkModifierType mod; Display *display = NULL; Window id; KeyCode key; KeyBinding *bind = NULL; if (g_hash_table_contains(self->bindings, shortcut)) { return FALSE; } gtk_accelerator_parse(shortcut, &keysym, &mod); display = GDK_WINDOW_XDISPLAY(self->root_window); id = GDK_WINDOW_XID(self->root_window); key = XKeysymToKeycode(display, keysym); if (key == 0) { return FALSE; } bind = g_new0(KeyBinding, 1); *bind = (KeyBinding){ .accelerator = shortcut, .keycode = key, .mods = mod, .func = func, .udata = v }; g_hash_table_insert(self->bindings, g_strdup(shortcut), bind); gdk_error_trap_push(); for (size_t i = 0; i < G_N_ELEMENTS(_modifiers); i++) { GdkModifierType m = _modifiers[i]; XGrabKey(display, key, mod | m, id, TRUE, GrabModeAsync, GrabModeAsync); } gdk_flush(); if (!mod) { gdk_error_trap_push(); /* We grab Super+click so that we can forward it to the window manager and allow * Super+click bindings (window move, resize, etc.) */ XGrabButton(display, AnyButton, Mod4Mask, id, TRUE, ButtonPressMask, GrabModeSync, GrabModeAsync, None, None); gdk_flush(); } return TRUE; } /** * Unbind the shortcut once again, if previously registered */ gboolean brisk_key_binder_unbind(BriskKeyBinder *self, const gchar *shortcut) { return g_hash_table_remove(self->bindings, shortcut); } /** * Handle cleaning up of the keybinding */ static void free_keybinding(KeyBinding *binding) { Display *display = NULL; Window id; GdkWindow *window = NULL; window = gdk_get_default_root_window(); if (window) { display = GDK_WINDOW_XDISPLAY(window); id = GDK_WINDOW_XID(window); XUngrabKey(display, binding->keycode, binding->mods, id); } else { g_warning("Could not find root window to XUngrabKey"); } g_free(binding); } /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 8 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=8 tabstop=8 expandtab: * :indentSize=8:tabSize=8:noTabs=true: */ brisk-menu-0.6.0/src/lib/key-binder.h000066400000000000000000000036511352323743400173430ustar00rootroot00000000000000/* * This file is part of brisk-menu. * * Copyright © 2016-2019 Brisk Menu Developers * * 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 2 of the License, or * (at your option) any later version. */ #pragma once #include #include G_BEGIN_DECLS typedef struct _BriskKeyBinder BriskKeyBinder; typedef struct _BriskKeyBinderClass BriskKeyBinderClass; #define BRISK_TYPE_KEY_BINDER brisk_key_binder_get_type() #define BRISK_KEY_BINDER(o) (G_TYPE_CHECK_INSTANCE_CAST((o), BRISK_TYPE_KEY_BINDER, BriskKeyBinder)) #define BRISK_IS_KEY_BINDER(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), BRISK_TYPE_KEY_BINDER)) #define BRISK_KEY_BINDER_CLASS(o) \ (G_TYPE_CHECK_CLASS_CAST((o), BRISK_TYPE_KEY_BINDER, BriskKeyBinderClass)) #define BRISK_IS_KEY_BINDER_CLASS(o) (G_TYPE_CHECK_CLASS_TYPE((o), BRISK_TYPE_KEY_BINDER)) #define BRISK_KEY_BINDER_GET_CLASS(o) \ (G_TYPE_INSTANCE_GET_CLASS((o), BRISK_TYPE_KEY_BINDER, BriskKeyBinderClass)) /** * Construct a new BriskKeyBinder */ BriskKeyBinder *brisk_key_binder_new(void); GType brisk_key_binder_get_type(void); /** * A callback for the binder functions */ typedef void (*BinderFunc)(GdkEvent *event, gpointer v); gboolean brisk_key_binder_bind(BriskKeyBinder *self, const gchar *shortcut, BinderFunc func, gpointer v); gboolean brisk_key_binder_unbind(BriskKeyBinder *self, const gchar *shortcut); G_END_DECLS /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 8 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=8 tabstop=8 expandtab: * :indentSize=8:tabSize=8:noTabs=true: */ brisk-menu-0.6.0/src/lib/meson.build000066400000000000000000000010301352323743400172700ustar00rootroot00000000000000libutil_sources = [ 'key-binder.c', ] libutil_dependencies = [ dep_x11, dep_gdkx11, dep_gtk3, ] # Util library handles keybinder libutil = static_library( 'brisk-util', sources: libutil_sources, dependencies: libutil_dependencies, ) link_libutil = declare_dependency( link_with: libutil, include_directories: [ include_directories('.'), ], dependencies: libutil_dependencies, ) # Ensure others can access this directory without having to link lib_h_dir = include_directories('.') brisk-menu-0.6.0/src/lib/styles.h000066400000000000000000000021261352323743400166310ustar00rootroot00000000000000/* * This file is part of brisk-menu. * * Copyright © 2016-2019 Brisk Menu Developers * * 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 2 of the License, or * (at your option) any later version. */ /** * Style for the main window itself */ #define BRISK_STYLE_MAIN "brisk-menu" /** * Right hand side application list */ #define BRISK_STYLE_APPS_LIST "apps-list" /** * Left hand side category list */ #define BRISK_STYLE_SIDEBAR "categories-list" /** * Main toggle button */ #define BRISK_STYLE_BUTTON "brisk-button" /** * We're in a vertical layout */ #define BRISK_STYLE_BUTTON_VERTICAL "brisk-button-vertical" /** * This is a dash window */ #define BRISK_STYLE_DASH "brisk-dash" /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 8 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=8 tabstop=8 expandtab: * :indentSize=8:tabSize=8:noTabs=true: */ brisk-menu-0.6.0/src/lib/util.h000066400000000000000000000064001352323743400162620ustar00rootroot00000000000000/* * This file is part of brisk-menu. * * Copyright © 2016-2019 Brisk Menu Developers * * 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 2 of the License, or * (at your option) any later version. */ #pragma once #define _STRINGIFY(x) #x #if defined(__GNUC__) /** * With newer GCC versions, we see compiler warnings simply from including any glib/gtk header. * Many of these make it very hard to debug genuine compiler warnings for the project itself, which * ideally should be completely clear. * * This provides a quick useful macro to wrap around the inclusion of GTK/GLib header files */ #define _BRISK_BEGIN_PEDANTIC(COMP) \ _Pragma(_STRINGIFY(COMP diagnostic push)) \ _Pragma(_STRINGIFY(COMP diagnostic ignored "-Wpedantic")) /** * End the includes block, i.e. by popping the diagnostic once more */ #define _BRISK_END_PEDANTIC(COMP) _Pragma(_STRINGIFY(COMP diagnostic pop)) /** * Clang unfortunately also defines __GNUC__ meaning a second level of tests */ #if defined(__clang__) /** * Specifically use clang in pragma for older versions of Clang that don't understand * pragma GCC */ #define BRISK_BEGIN_PEDANTIC _BRISK_BEGIN_PEDANTIC(clang) #define BRISK_END_PEDANTIC _BRISK_END_PEDANTIC(clang) #else /* __clang__ */ /** * Specifically use GCC pragma for GCC */ #define BRISK_BEGIN_PEDANTIC _BRISK_BEGIN_PEDANTIC(GCC) #define BRISK_END_PEDANTIC _BRISK_END_PEDANTIC(GCC) #endif #else /* __GNUC__ */ /** * Unknown compiler, don't expose the functionality */ #define BRISK_BEGIN_PEDANTIC #define BRISK_END_PEDANTIC #endif /* Useful macros */ /** * Useful during development to silence compiler warnings */ #define __brisk_unused__ __attribute__((unused)) /** * All symbols are hidden by default so must be explicitly be made public * to define the ABI */ #define __brisk_public__ __attribute__((visibility("default"))) /** * Mark the function as a pure function to the compiler */ #define __brisk_pure__ __attribute__((pure)) /** * Taken out of libnica */ #define DEF_AUTOFREE(N, C) \ static inline void _autofree_func_##N(void *p) \ { \ if (p && *(N **)p) { \ C(*(N **)p); \ (*(void **)p) = NULL; \ } \ } #define autofree(N) __attribute__((cleanup(_autofree_func_##N))) N /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 8 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=8 tabstop=8 expandtab: * :indentSize=8:tabSize=8:noTabs=true: */ brisk-menu-0.6.0/src/mate-applet/000077500000000000000000000000001352323743400165775ustar00rootroot00000000000000brisk-menu-0.6.0/src/mate-applet/applet.c000066400000000000000000000372071352323743400202410ustar00rootroot00000000000000/* * This file is part of brisk-menu. * * Copyright © 2016-2019 Brisk Menu Developers * * 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 2 of the License, or * (at your option) any later version. */ #define _GNU_SOURCE #include "config.h" #include "util.h" BRISK_BEGIN_PEDANTIC #include "applet.h" #include "frontend/classic/classic-window.h" #include "frontend/dash/dash-window.h" #include "lib/authors.h" #include "lib/styles.h" #include #include #include #include BRISK_END_PEDANTIC G_DEFINE_TYPE(BriskMenuApplet, brisk_menu_applet, PANEL_TYPE_APPLET) static gint icon_sizes[] = { 16, 24, 32, 48, 64, 96, 128, 256 }; DEF_AUTOFREE(NotifyNotification, g_object_unref) /** * Handle showing of the menu */ static gboolean button_press_cb(BriskMenuApplet *self, GdkEvent *event, gpointer v); static void brisk_menu_applet_change_orient(MatePanelApplet *applet, MatePanelAppletOrient orient); static void brisk_menu_applet_change_size(MatePanelApplet *applet, guint size); static void brisk_menu_applet_change_menu_orient(BriskMenuApplet *self); static gboolean brisk_menu_applet_startup(BriskMenuApplet *self); static void brisk_menu_applet_create_window(BriskMenuApplet *self); /* Handle applet settings */ void brisk_menu_applet_init_settings(BriskMenuApplet *self); static void brisk_menu_applet_settings_changed(GSettings *settings, const gchar *key, gpointer v); static void brisk_menu_applet_notify_fail(const gchar *title, const gchar *body); /* Helpers */ static GtkPositionType convert_mate_position(MatePanelAppletOrient orient); static void brisk_menu_applet_adapt_layout(BriskMenuApplet *self); static GtkWidget *brisk_menu_applet_automatic_window_type(BriskMenuApplet *self); /** * brisk_menu_applet_dispose: * * Clean up a BriskMenuApplet instance */ static void brisk_menu_applet_dispose(GObject *obj) { BriskMenuApplet *self = NULL; self = BRISK_MENU_APPLET(obj); /* Tear down the menu */ if (self->menu) { gtk_widget_hide(self->menu); g_clear_pointer(&self->menu, gtk_widget_destroy); } g_clear_object(&self->settings); G_OBJECT_CLASS(brisk_menu_applet_parent_class)->dispose(obj); } /** * brisk_menu_applet_class_init: * * Handle class initialisation */ static void brisk_menu_applet_class_init(BriskMenuAppletClass *klazz) { GObjectClass *obj_class = G_OBJECT_CLASS(klazz); MatePanelAppletClass *mate_class = MATE_PANEL_APPLET_CLASS(klazz); /* gobject vtable hookup */ obj_class->dispose = brisk_menu_applet_dispose; /* mate vtable hookup */ mate_class->change_orient = brisk_menu_applet_change_orient; mate_class->change_size = brisk_menu_applet_change_size; } void brisk_menu_applet_init_settings(BriskMenuApplet *self) { self->settings = g_settings_new("com.solus-project.brisk-menu"); /* capture changes in settings that affect the menu applet */ g_signal_connect(self->settings, "changed::label-text", G_CALLBACK(brisk_menu_applet_settings_changed), self); } /** * brisk_menu_applet_init: * * Handle construction of the BriskMenuApplet */ static void brisk_menu_applet_init(BriskMenuApplet *self) { GtkWidget *toggle, *layout, *image, *label = NULL; GtkStyleContext *style = NULL; brisk_menu_applet_init_settings(self); /* Create the toggle button */ toggle = gtk_toggle_button_new(); self->toggle = toggle; gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), FALSE); gtk_container_add(GTK_CONTAINER(self), toggle); g_signal_connect_swapped(toggle, "button-press-event", G_CALLBACK(button_press_cb), self); gtk_button_set_relief(GTK_BUTTON(toggle), GTK_RELIEF_NONE); style = gtk_widget_get_style_context(toggle); gtk_style_context_add_class(style, BRISK_STYLE_BUTTON); /* Layout will contain icon + label */ layout = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); gtk_widget_set_halign(layout, GTK_ALIGN_CENTER); gtk_container_add(GTK_CONTAINER(toggle), layout); /* Image appears first always */ image = gtk_image_new_from_icon_name("start-here-symbolic", GTK_ICON_SIZE_MENU); self->image = image; gtk_box_pack_start(GTK_BOX(layout), image, FALSE, FALSE, 0); gtk_widget_set_margin_end(image, 4); gtk_widget_set_halign(image, GTK_ALIGN_START); /* Now add the label */ label = gtk_label_new(NULL); self->label = label; gtk_box_pack_start(GTK_BOX(layout), label, TRUE, TRUE, 0); gtk_widget_set_margin_end(label, 4); /* Set it up for visibility toggling */ gtk_widget_show_all(label); gtk_widget_set_no_show_all(label, TRUE); gtk_widget_hide(label); /* Update label visibility dependent on config */ g_settings_bind(self->settings, "label-visible", label, "visible", G_SETTINGS_BIND_GET); /* Pump the label setting */ brisk_menu_applet_settings_changed(self->settings, "label-text", self); /* Fix label alignment */ gtk_widget_set_halign(label, GTK_ALIGN_START); G_GNUC_BEGIN_IGNORE_DEPRECATIONS gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); G_GNUC_END_IGNORE_DEPRECATIONS /* Applet hookup */ mate_panel_applet_set_flags(MATE_PANEL_APPLET(self), MATE_PANEL_APPLET_EXPAND_MINOR); mate_panel_applet_set_background_widget(MATE_PANEL_APPLET(self), GTK_WIDGET(self)); /* Wait for mate-panel to do its thing and tell us the orientation */ g_idle_add((GSourceFunc)brisk_menu_applet_startup, self); } static gboolean brisk_menu_applet_startup(BriskMenuApplet *self) { /* Ensure we fire off the initial layout adaptation code */ brisk_menu_applet_change_orient(MATE_PANEL_APPLET(self), mate_panel_applet_get_orient(MATE_PANEL_APPLET(self))); return G_SOURCE_REMOVE; } static void brisk_menu_applet_create_window(BriskMenuApplet *self) { GtkWidget *menu = NULL; /* Now show all content */ gtk_widget_show_all(self->toggle); /* Construct our menu */ WindowType window_type = g_settings_get_enum(self->settings, "window-type"); switch (window_type) { case WINDOW_TYPE_DASH: menu = GTK_WIDGET(brisk_dash_window_new(GTK_WIDGET(self))); break; case WINDOW_TYPE_AUTOMATIC: menu = brisk_menu_applet_automatic_window_type(self); break; case WINDOW_TYPE_CLASSIC: default: menu = GTK_WIDGET(brisk_classic_window_new(GTK_WIDGET(self))); break; } self->menu = menu; /* Render "active" toggle only when the window is open, automatically. */ g_object_bind_property(menu, "visible", self->toggle, "active", G_BINDING_DEFAULT); /* Load our menus */ brisk_menu_window_load_menus(BRISK_MENU_WINDOW(self->menu)); /* Pump the settings */ brisk_menu_window_pump_settings(BRISK_MENU_WINDOW(self->menu)); /* Now that the menu is initialised, we can tell it to update to our current * orientation, so that automatic position is correct on first start */ brisk_menu_applet_change_menu_orient(self); } /** * Toggle the menu visibility on a button press */ static gboolean button_press_cb(BriskMenuApplet *self, GdkEvent *event, __brisk_unused__ gpointer v) { if (event->button.button != 1) { return GDK_EVENT_PROPAGATE; } gboolean vis = !gtk_widget_get_visible(self->menu); if (vis) { brisk_menu_window_update_screen_position(BRISK_MENU_WINDOW(self->menu)); } gtk_widget_set_visible(self->menu, vis); return GDK_EVENT_STOP; } /** * Callback for changing applet settings */ static void brisk_menu_applet_settings_changed(GSettings *settings, const gchar *key, gpointer v) { BriskMenuApplet *self = v; autofree(gchar) *value = NULL; value = g_settings_get_string(settings, key); if (g_str_equal(value, "")) { gtk_label_set_text(GTK_LABEL(self->label), _("Menu")); } else { gtk_label_set_text(GTK_LABEL(self->label), value); } } /** * Internal helper to ensure the orient is correct for the menu */ static void brisk_menu_applet_change_menu_orient(BriskMenuApplet *self) { GtkPositionType position; position = convert_mate_position(self->orient); /* Let the main menu window know about our orientation */ brisk_menu_window_set_parent_position(BRISK_MENU_WINDOW(self->menu), position); } /** * Panel orientation changed, tell the menu */ static void brisk_menu_applet_change_orient(MatePanelApplet *applet, MatePanelAppletOrient orient) { BriskMenuApplet *self = BRISK_MENU_APPLET(applet); self->orient = orient; /* Now adjust our own display to deal with the orientation */ brisk_menu_applet_adapt_layout(BRISK_MENU_APPLET(applet)); if (!self->menu) { brisk_menu_applet_create_window(self); return; } brisk_menu_applet_change_menu_orient(self); } static void brisk_menu_applet_change_size(MatePanelApplet *applet, guint size) { BriskMenuApplet *self = BRISK_MENU_APPLET(applet); gint final_size = icon_sizes[0]; for (guint i = 0; i < G_N_ELEMENTS(icon_sizes); i++) { if (icon_sizes[i] > (gint)size - 2) { break; } final_size = icon_sizes[i]; } gtk_image_set_pixel_size(GTK_IMAGE(self->image), final_size); } void brisk_menu_applet_edit_menus(__brisk_unused__ GtkAction *action, BriskMenuApplet *self) { static const char *editors[] = { "menulibre.desktop", "mozo.desktop", }; static const char *binaries[] = { "menulibre", "mozo", }; for (size_t i = 0; i < G_N_ELEMENTS(editors); i++) { autofree(gchar) *p = NULL; autofree(GAppInfo) *app = NULL; BriskMenuLauncher *launcher = ((BRISK_MENU_WINDOW(self->menu))->launcher); GDesktopAppInfo *info = NULL; p = g_find_program_in_path(binaries[i]); if (!p) { continue; } info = g_desktop_app_info_new(editors[i]); if (!info) { app = g_app_info_create_from_commandline(p, NULL, G_APP_INFO_CREATE_NONE, NULL); } else { app = G_APP_INFO(info); } if (!app) { continue; } brisk_menu_launcher_start(launcher, GTK_WIDGET(self), app); return; } brisk_menu_applet_notify_fail(_("Failed to launch menu editor"), _("Please install 'menulibre' or 'mozo' to edit menus")); } /** * brisk_menu_applet_notify_fail: * * Notify the user that an action has failed via a passive notification */ static void brisk_menu_applet_notify_fail(const gchar *title, const gchar *body) { autofree(NotifyNotification) *notif = NULL; autofree(GError) *error = NULL; notif = notify_notification_new(title, body, "dialog-error-symbolic"); notify_notification_set_timeout(notif, 4000); if (!notify_notification_show(notif, &error)) { g_message("Failed to send notification: %s", error->message); fprintf(stderr, "\tTitle: %s\n\tBody: %s\n", title, body); } } void brisk_menu_applet_show_about(__brisk_unused__ GtkAction *action, __brisk_unused__ BriskMenuApplet *applet) { static const gchar *copyright_string = "Copyright © 2016-2019 Brisk Menu Developers"; gtk_show_about_dialog(NULL, "authors", brisk_developers, "copyright", copyright_string, "license-type", GTK_LICENSE_GPL_2_0, "logo-icon-name", "start-here", "version", PACKAGE_VERSION, "website", PACKAGE_URL, "website-label", "Solus Project", NULL); } /** * Convert the MatePanelAppletOrient into a more logical GtkPositionType. * * This converts the "orient", i.e. "where is my panel looking", to an actual * position that Brisk can use. Additionally it removes the need to have the * frontend library depend on mate-panel-applet. */ static GtkPositionType convert_mate_position(MatePanelAppletOrient orient) { switch (orient) { case MATE_PANEL_APPLET_ORIENT_LEFT: return GTK_POS_RIGHT; case MATE_PANEL_APPLET_ORIENT_RIGHT: return GTK_POS_LEFT; case MATE_PANEL_APPLET_ORIENT_DOWN: return GTK_POS_TOP; case MATE_PANEL_APPLET_ORIENT_UP: default: return GTK_POS_BOTTOM; } } /** * brisk_menu_applet_adapt_layout: * * Update our layout in response to an orientation change. * Primarily we're hiding our label automatically here and maximizing the space * available to the icon. */ static void brisk_menu_applet_adapt_layout(BriskMenuApplet *self) { GtkStyleContext *style = NULL; style = gtk_widget_get_style_context(self->toggle); switch (self->orient) { case MATE_PANEL_APPLET_ORIENT_LEFT: case MATE_PANEL_APPLET_ORIENT_RIGHT: /* Handle vertical panel layout */ gtk_widget_hide(self->label); gtk_widget_set_halign(self->image, GTK_ALIGN_CENTER); gtk_style_context_add_class(style, BRISK_STYLE_BUTTON_VERTICAL); gtk_widget_set_margin_end(self->image, 0); break; default: /* We're a horizontal panel */ gtk_widget_set_visible(self->label, g_settings_get_boolean(self->settings, "label-visible")); gtk_widget_set_halign(self->image, GTK_ALIGN_START); gtk_style_context_remove_class(style, BRISK_STYLE_BUTTON_VERTICAL); gtk_widget_set_margin_end(self->image, 4); break; } } static GtkWidget *brisk_menu_applet_automatic_window_type(BriskMenuApplet *self) { switch (self->orient) { case MATE_PANEL_APPLET_ORIENT_LEFT: case MATE_PANEL_APPLET_ORIENT_RIGHT: return GTK_WIDGET(brisk_dash_window_new(GTK_WIDGET(self))); default: return GTK_WIDGET(brisk_classic_window_new(GTK_WIDGET(self))); } } /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 8 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=8 tabstop=8 expandtab: * :indentSize=8:tabSize=8:noTabs=true: */ brisk-menu-0.6.0/src/mate-applet/applet.h000066400000000000000000000053121352323743400202360ustar00rootroot00000000000000/* * This file is part of brisk-menu. * * Copyright © 2016-2019 Brisk Menu Developers * * 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 2 of the License, or * (at your option) any later version. */ #pragma once #include #include #include G_BEGIN_DECLS typedef struct _BriskMenuApplet BriskMenuApplet; typedef struct _BriskMenuAppletClass BriskMenuAppletClass; typedef enum { WINDOW_TYPE_MIN = 0, WINDOW_TYPE_CLASSIC = 1 << 0, WINDOW_TYPE_DASH = 1 << 1, WINDOW_TYPE_AUTOMATIC = 1 << 2, WINDOW_TYPE_MAX, } WindowType; struct _BriskMenuAppletClass { MatePanelAppletClass parent_class; }; /** * BriskMenuApplet is the passive portion of the Brisk Menu, in that it * provides merely an access path to the main Brisk Menu Window itself. */ struct _BriskMenuApplet { MatePanelApplet parent; GtkWidget *toggle; /**
#include #include BRISK_END_PEDANTIC DEF_AUTOFREE(GtkActionGroup, g_object_unref) static gboolean notify_had_init = FALSE; /** * We have no .ctor in the .a file - so it doesn't link */ __attribute__((constructor)) static void brisk_resource_init(void) { brisk_resources_register_resource(); } /** * Again, no .dtor due to link issues, so we do it here */ __attribute__((destructor)) static void brisk_resource_deinit(void) { brisk_resources_unregister_resource(); } /** * Menu actions for right click on the button */ G_GNUC_BEGIN_IGNORE_DEPRECATIONS static const GtkActionEntry brisk_actions[] = { { "EditMenus", GTK_STOCK_EDIT, N_("_Edit Menus"), NULL, NULL, G_CALLBACK(brisk_menu_applet_edit_menus), }, { "ShowAbout", GTK_STOCK_ABOUT, N_("_About"), NULL, NULL, G_CALLBACK(brisk_menu_applet_show_about), } }; G_GNUC_END_IGNORE_DEPRECATIONS /** * UI definition for our right click menu */ #define BRISK_MENU_XML \ "" \ "" static gboolean brisk_menu_applet_factory(MatePanelApplet *applet, const gchar *id, __brisk_unused__ gpointer v) { if (!g_str_has_prefix(id, "BriskMenu")) { return FALSE; } const char *home = NULL; __attribute__((unused)) int ret = 0; autofree(GtkActionGroup) *group = NULL; home = g_get_home_dir(); if (home) { ret = chdir(home); } if (!notify_had_init) { notify_init(_("Brisk Menu Launcher")); notify_had_init = TRUE; } /* Setup the action group and hand it to the mate panel */ G_GNUC_BEGIN_IGNORE_DEPRECATIONS group = gtk_action_group_new("Brisk Menu Actions"); gtk_action_group_set_translation_domain(group, GETTEXT_PACKAGE); gtk_action_group_add_actions(group, brisk_actions, G_N_ELEMENTS(brisk_actions), applet); mate_panel_applet_setup_menu(applet, BRISK_MENU_XML, group); G_GNUC_END_IGNORE_DEPRECATIONS g_set_application_name(_("Brisk Menu Launcher")); gtk_widget_show(GTK_WIDGET(applet)); return TRUE; } MATE_PANEL_APPLET_OUT_PROCESS_FACTORY("BriskMenuFactory", BRISK_TYPE_MENU_APPLET, "BriskMenu", brisk_menu_applet_factory, NULL) /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 8 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=8 tabstop=8 expandtab: * :indentSize=8:tabSize=8:noTabs=true: */ brisk-menu-0.6.0/src/mate-applet/meson.build000066400000000000000000000006511352323743400207430ustar00rootroot00000000000000mate_applet_sources = [ 'applet.c', 'main.c', ] mate_applet_dependencies = [ link_libbackend, link_libfrontend, link_libresources, dep_mate_applet, dep_notify, ] mate_applet = executable( 'brisk-menu', sources: mate_applet_sources, dependencies: mate_applet_dependencies, include_directories: [ config_h_dir, ], install_dir: path_libexecdir, install: true, ) brisk-menu-0.6.0/src/meson.build000066400000000000000000000024061352323743400165320ustar00rootroot00000000000000# Allow inclusion of "backend/item.h" etc. tree_include = include_directories('.') # Build the resources separately so we can control our compiler warnings to # remove a whole bunch of noise. libresources = static_library( 'brisk-resources', sources: brisk_resources, dependencies: [ dep_gio_unix, ], ) link_libresources = declare_dependency( link_with: libresources, include_directories: [ data_include, ], ) # Build the Cs into a simple static library and control compiler noise libsession_stub = static_library( 'brisk-glue', sources: [ libsaver_glue, libsession_glue, ], c_args: [ '-Wno-unused-parameter', ], dependencies: dep_gio_unix, install: false, include_directories: [ include_directories('..'), ], ) # Allow linking to the stub link_libsession_stub = declare_dependency( link_with: libsession_stub, dependencies: [ dep_gio_unix, ], include_directories: [ include_directories('.'), ], ) # Build common library (currently just keybinder really.) subdir('lib') # Build the backend component subdir('backend') # Now build our main UI subdir('frontend') # Finally, we can build the MATE Applet itself subdir('mate-applet') brisk-menu-0.6.0/src/test/000077500000000000000000000000001352323743400153455ustar00rootroot00000000000000brisk-menu-0.6.0/src/test/brisk-test-backends.c000066400000000000000000000057071352323743400213610ustar00rootroot00000000000000/* * This file is part of brisk-menu. * * Copyright © 2017-2019 Brisk Menu Developers * * 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 2 of the License, or * (at your option) any later version. */ #define _GNU_SOURCE #include #include #include #include #include #include "util.h" BRISK_BEGIN_PEDANTIC #include "backend/apps/apps-backend.h" BRISK_END_PEDANTIC DEF_AUTOFREE(BriskBackend, g_object_unref) DEF_AUTOFREE(char, free) /** * Mimic functionality from check library */ static inline void fail_if(bool b, const char *fmt, ...) { va_list va; autofree(char) *out = NULL; if (!b) { return; } va_start(va, fmt); if (vasprintf(&out, fmt, va) < 0) { fputs("Out of memory\n", stderr); exit(1); } fprintf(stderr, " => error: %s\n", out); va_end(va); exit(1); } static void test_item_added(__brisk_unused__ BriskBackend *backend, BriskItem *item, __brisk_unused__ gpointer v) { g_message("Got a new item: %s \"%s\"", brisk_item_get_id(item), brisk_item_get_name(item)); } static void test_section_added(__brisk_unused__ BriskBackend *backend, BriskSection *section, __brisk_unused__ gpointer v) { fputs("\n", stdout); g_message("Got a new section: %s \"%s\"\n", brisk_section_get_id(section), brisk_section_get_name(section)); } /** * Test the applications backend */ static void run_apps_backend_test(BriskBackend *backend, GMainLoop *loop) { fail_if((brisk_backend_get_flags(backend) & BRISK_BACKEND_SOURCE) != BRISK_BACKEND_SOURCE, "Invalid flags for backend"); g_signal_connect(backend, "item-added", G_CALLBACK(test_item_added), NULL); g_signal_connect(backend, "section-added", G_CALLBACK(test_section_added), NULL); fail_if(!brisk_backend_load(backend), "Failed to load the apps backend"); /* Stop processing after 5 seconds */ g_timeout_add_seconds(5, (GSourceFunc)g_main_loop_quit, loop); } int main(__brisk_unused__ int argc, __brisk_unused__ char **argv) { GMainLoop *loop = NULL; autofree(BriskBackend) *backend = NULL; backend = brisk_apps_backend_new(); fail_if(backend == NULL, "Failed to construct apps backend"); loop = g_main_loop_new(NULL, FALSE); run_apps_backend_test(backend, loop); g_main_loop_run(loop); g_main_loop_unref(loop); } /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * * Local variables: * c-basic-offset: 8 * tab-width: 8 * indent-tabs-mode: nil * End: * * vi: set shiftwidth=8 tabstop=8 expandtab: * :indentSize=8:tabSize=8:noTabs=true: */