Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge 0.7-devel to trunk

I had to do a foreign merge because it has less query to 
googlecode. apearently googlecode is crashing with 502 gateway
errors.
  • Loading branch information...
commit 0fc20a73ec27f26bf1fd1f28c7aa1cb9d894fd81 1 parent e404436
Yu Feng rainwoodman authored
Showing with 7,303 additions and 12,740 deletions.
  1. +2 −2 AUTHORS
  2. +484 −3,087 ClassMap.dia
  3. +339 −0 GPLv2
  4. +2 −347 applet/GPL.vala → GPLv3
  5. +36 −10 Makefile.am
  6. +10 −0 Makefile.config
  7. +65 −0 Makefile.configmake
  8. +57 −0 Makefile.decl
  9. +16 −0 Makefile.licenses
  10. +5 −5 applet/{GlobalMenu_PanelApplet.server.in → GlobalMenu_PanelApplet.server.in.in}
  11. +0 −34 applet/GnomeMenuHelper.vala
  12. +64 −57 applet/Makefile.am
  13. +328 −151 applet/applet.vala
  14. 0  {vapi-compat → applet}/gconfcompat.vapi
  15. BIN  applet/globalmenu.png
  16. +0 −54 applet/gnome-globalmenu-applet.schemas
  17. +35 −0 applet/gnomemenuhelper.vala
  18. +90 −63 applet/gtkextra-gconfdialog.vala
  19. +3 −0  applet/libpanelapplet-2.0.deps
  20. +77 −0 applet/libpanelapplet-2.0.vapi
  21. +54 −0 applet/main.vala
  22. +0 −29 applet/panelextra-menubar.vala
  23. +0 −193 applet/panelextra-switcher.vala
  24. +7 −0 applet/patch.sh
  25. +201 −0 applet/switcher.vala
  26. 0  {vapi-compat → applet}/wnckcompat.vapi
  27. +0 −158 autogen.sh
  28. +91 −121 configure.ac
  29. +0 −4 doc/Makefile.am
  30. +0 −1  doc/reference/Makefile.am
  31. +0 −87 doc/reference/libgnomenu/Makefile.am
  32. +0 −41 doc/reference/libgnomenu/libgnomenu-docs.sgml
  33. 0  doc/reference/libgnomenu/libgnomenu.types
  34. +0 −87 doc/reference/libgtkhotkey/Makefile.am
  35. +0 −27 doc/reference/libgtkhotkey/libgtkhotkey-docs.sgml
  36. 0  doc/reference/libgtkhotkey/libgtkhotkey.types
  37. +66 −0 gnome-globalmenu.schemas.in
  38. +122 −0 gnome-globalmenu.spec
  39. +0 −1  gnome-globalmenu.spec.tmpl
  40. +0 −177 gtk-aqd/0001-Global-Menu-Patch.patch
  41. +0 −9 gtk-aqd/Makefile.am
  42. +1 −1  gtk-modules/Makefile.am
  43. +64 −0 gtk-modules/globalmenu/Makefile.am
  44. +6 −0 gtk-modules/globalmenu/bindings.vapi
  45. +147 −0 gtk-modules/globalmenu/dyn-patch-menubar.c
  46. +54 −0 gtk-modules/globalmenu/dyn-patch-menushell.c
  47. +47 −0 gtk-modules/globalmenu/dyn-patch-widget.c
  48. +249 −0 gtk-modules/globalmenu/dyn-patch.c
  49. +55 −0 gtk-modules/globalmenu/dyn-patch.h
  50. +81 −0 gtk-modules/globalmenu/globalmenu-helper.c
  51. +37 −0 gtk-modules/globalmenu/globalmenu-locator.vala
  52. +153 −0 gtk-modules/globalmenu/globalmenu-serializer.vala
  53. +190 −0 gtk-modules/globalmenu/globalmenu.vala
  54. +164 −0 gtk-modules/globalmenu/module-main.vala
  55. +5 −0 gtk-modules/globalmenu/patch.sh
  56. +25 −0 gtk-modules/globalmenu/tests/Makefile.am
  57. +52 −0 gtk-modules/globalmenu/tests/test-serializer.vala
  58. +254 −0 gtk-modules/globalmenu/tests/test-unload.glade
  59. +63 −0 gtk-modules/globalmenu/tests/test-unload.vala
  60. +0 −62 gtk-modules/libgnomenugtk/Makefile.am
  61. +0 −55 gtk-modules/libgnomenugtk/gnomenugtk-client.vala
  62. +0 −238 gtk-modules/libgnomenugtk/gnomenugtk-document.vala
  63. +0 −226 gtk-modules/libgnomenugtk/gnomenugtk.vala
  64. +0 −89 gtk-modules/libgnomenugtk/gtkaqd.vapi
  65. +0 −240 gtk-modules/libgnomenugtk/utils.c
  66. +0 −131 libgmarkupdoc/Makefile.am
  67. +0 −123 libgmarkupdoc/gmarkupdoc-dbusview.vala
  68. +0 −19 libgmarkupdoc/gmarkupdoc-document.vala
  69. +0 −75 libgmarkupdoc/gmarkupdoc-documentmodel.vala
  70. +0 −115 libgmarkupdoc/gmarkupdoc-documenttreeadapter.vala
  71. +0 −205 libgmarkupdoc/gmarkupdoc-listview.vala
  72. +0 −212 libgmarkupdoc/gmarkupdoc-node.vala
  73. +0 −178 libgmarkupdoc/gmarkupdoc-parser.vala
  74. +0 −163 libgmarkupdoc/gmarkupdoc-remotedocument.vala
  75. +0 −85 libgmarkupdoc/gmarkupdoc-section.vala
  76. +0 −10 libgmarkupdoc/gmarkupdoc-view.vala
  77. +0 −7 libgmarkupdoc/gmarkupdoc.vala
  78. +34 −72 libgnomenu/Makefile.am
  79. +52 −0 libgnomenu/bindings.vapi
  80. +140 −0 libgnomenu/box.vala
  81. +0 −37 libgnomenu/example.c
  82. +0 −153 libgnomenu/gnomenu-client.vala
  83. +0 −159 libgnomenu/gnomenu-menubar.vala
  84. +0 −388 libgnomenu/gnomenu-menuview.vala
  85. +0 −85 libgnomenu/gnomenu-server.vala
  86. +93 −0 libgnomenu/gnomenu.vala
  87. +81 −0 libgnomenu/helper.vala
  88. +72 −0 libgnomenu/keygrab-ccode.c
  89. +16 −0 libgnomenu/keygrab.vala
  90. +302 −0 libgnomenu/label.vala
  91. +30 −0 libgnomenu/menu.vala
  92. +576 −0 libgnomenu/menubar.vala
  93. +239 −0 libgnomenu/menubarbox.vala
  94. +494 −0 libgnomenu/menuitem.vala
  95. +156 −0 libgnomenu/parser.vala
  96. +14 −0 libgnomenu/patch.sh
  97. +115 −0 libgnomenu/serializer.vala
  98. +23 −0 libgnomenu/tests/Makefile.am
  99. +1 −0  libgnomenu/tests/evo-nolabel.xml
  100. +1 −0  libgnomenu/tests/evo.xml
  101. +7 −0 libgnomenu/tests/patch.sh
  102. +65 −0 libgnomenu/tests/test-box.vala
  103. +32 −0 libgnomenu/tests/test-grab.vala
  104. +36 −0 libgnomenu/tests/test-label.vala
  105. +61 −0 libgnomenu/tests/test-leak.vala
  106. +123 −0 libgnomenu/tests/test-menubar.vala
  107. +62 −0 libgnomenu/tests/test-menushell.vala
  108. +85 −0 libgnomenu/tests/test-parser.vala
  109. +46 −0 libgnomenu/tests/test-window.vala
  110. +223 −0 libgnomenu/window.vala
  111. +0 −66 libgtkhotkey/Makefile.am
  112. +0 −31 libgtkhotkey/gtk-hotkey-error.c
  113. +0 −96 libgtkhotkey/gtk-hotkey-error.h
  114. +0 −658 libgtkhotkey/gtk-hotkey-info.c
  115. +0 −85 libgtkhotkey/gtk-hotkey-info.h
  116. +0 −719 libgtkhotkey/gtk-hotkey-key-file-registry.c
  117. +0 −55 libgtkhotkey/gtk-hotkey-key-file-registry.h
  118. +0 −218 libgtkhotkey/gtk-hotkey-listener.c
  119. +0 −73 libgtkhotkey/gtk-hotkey-listener.h
  120. +0 −86 libgtkhotkey/gtk-hotkey-marshal.c
  121. +0 −20 libgtkhotkey/gtk-hotkey-marshal.h
  122. +0 −34 libgtkhotkey/gtk-hotkey-private.h
  123. +0 −341 libgtkhotkey/gtk-hotkey-registry.c
  124. +0 −110 libgtkhotkey/gtk-hotkey-registry.h
  125. +0 −48 libgtkhotkey/gtk-hotkey-utils.c
  126. +0 −33 libgtkhotkey/gtk-hotkey-utils.h
  127. +0 −241 libgtkhotkey/gtk-hotkey-x11-listener.c
  128. +0 −53 libgtkhotkey/gtk-hotkey-x11-listener.h
  129. +0 −12 libgtkhotkey/gtkhotkey.h
  130. +0 −657 libgtkhotkey/x11/eggaccelerators.c
  131. +0 −87 libgtkhotkey/x11/eggaccelerators.h
  132. +0 −328 libgtkhotkey/x11/tomboykeybinder.c
  133. +0 −27 libgtkhotkey/x11/tomboykeybinder.h
  134. +0 −49 navigator/Makefile.am
  135. +0 −64 navigator/navigator.vala
  136. +23 −0 patch.sh.in
  137. +2 −0  po/LINGUAS
  138. +0 −217 po/Makefile.in.in
  139. +2 −0  po/Makevars
  140. +7 −0 po/POTFILES.in
  141. +87 −49 po/fr_FR.po
  142. +155 −71 po/zh_CN.po
  143. +0 −19 reference/Makefile.am
  144. +0 −28 rpm
  145. +0 −65 server/Makefile.am
  146. +0 −3  server/org.gnome.GlobalMenu.Server.service.in
  147. +0 −52 server/org.gnome.GlobalMenu.Server.vala
  148. +0 −5 server/utils.c
  149. +15 −18 tests/Makefile.am
  150. +0 −27 tests/lowercname.c
  151. +5 −0 tests/patch.sh
  152. +0 −4 tests/test.c
  153. +27 −0 tests/testman.vala
  154. +0 −1  vapi-compat/Makefile.am
  155. +0 −46 vapi-compat/gtkcompat.vapi
  156. +0 −21 vapi-compat/panelappletcompat.vapi
  157. +0 −50 vapi-compat/valacompat.vapi
4 AUTHORS
View
@@ -1,4 +1,4 @@
-Programming:
+Coding:
Yu Feng <rainwoodman@gmail.com>
Mingxi Wu <fengshenx@gmail.com>
bis0n.lives <bis0n.lives@gmail.com>
@@ -9,5 +9,5 @@ sstasyuk <sstasyuk@gmail.com>
David Watson <dwatson031@gmail.com>
Valiant Wing <Valiant.Wing@gmail.com>
-Translatation/Documentation:
+Documentation:
Pierre Slamich <pierre.slamich@gmail.com>
3,571 ClassMap.dia
View
484 additions, 3,087 deletions not shown
339 GPLv2
View
@@ -0,0 +1,339 @@
+ GNU 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.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 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.
349 applet/GPL.vala → GPLv3
View
@@ -1,7 +1,4 @@
-namespace GPL {
- public static class Licenses {
-
- public static const string V3 = """ GNU GENERAL PUBLIC LICENSE
+ GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
@@ -674,346 +671,4 @@ into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
-<http://www.gnu.org/philosophy/why-not-lgpl.html>.""";
-
- public static const string V2 = """ GNU 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.
-
- <one line to give the program's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 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.""";
- }
-}
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
46 Makefile.am
View
@@ -1,28 +1,54 @@
NULL =
-SUBDIRS = vapi-compat libgmarkupdoc libgnomenu server navigator gtk-modules applet po
+SUBDIRS = tests libgnomenu applet gtk-modules po
+DISTCHECK_CONFIGURE_FLAGS = --disable-schemas-install --disable-static
AM_CPPFLAGS = \
- -include $(CONFIG_HEADER) \
$(NULL)
EXTRA_DIST = \
intltool-extract.in \
- intltool-update.in \
intltool-merge.in \
+ intltool-update.in \
+ gnome-globalmenu.schemas.in \
+ patch.sh \
$(NULL)
DISTCLEANFILES = \
intltool-extract \
- intltool-update \
intltool-merge \
- po/.intltool-merge-cache \
+ intltool-update \
$(NULL)
+BUILT_SOURCES =
+
+CLEANFILES =
+
+include $(top_srcdir)/Makefile.configmake
+include $(top_srcdir)/Makefile.config
+include $(top_srcdir)/Makefile.licenses
+
schemadir = @GCONF_SCHEMA_FILE_DIR@
-schema_DATA = applet/gnome-globalmenu-applet.schemas
+schema_in_files = gnome-globalmenu.schemas.in
+schema_DATA = $(schema_in_files:.in=)
+@INTLTOOL_SCHEMAS_RULE@
+if GCONF_SCHEMAS_INSTALL
+
+install-data-local:
+ GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) gconftool-2 --makefile-install-rule $(schema_DATA)
+else
install-data-local:
- GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) gconftool-2 --makefile-install-rule $(srcdir)/$(schema_DATA)
-
-any:
- echo $(VALAC) $(GNOMENU_SERVICE_VALA_PKGS)
+endif
+
+
+
+rpm:
+ touch `find . -name '*.vala'`
+ make dist
+ vim *.spec
+ cp *.tar.gz ~/rpmbuild/SOURCES
+ rpmbuild -bb *.spec
+
+rpm-fast:
+ cp *.tar.gz ~/rpmbuild/SOURCES
+ rpmbuild -bb *.spec
10 Makefile.config
View
@@ -0,0 +1,10 @@
+config.vapi: config.h
+ rm -f $@
+ { \
+ echo 'namespace Config {'; \
+ sed -e '/#define.*"$$/s/#define \([A-Z_]*\) .*/[CCode (cname = "\1")]\npublic static const string \1;/;/#define.*[0-9]$$/s/#define \([A-Z_]*\) .*/[CCode (cname = "\1")]\npublic static const int \1;/' $< ; \
+ echo '}' ; \
+ } > $@
+
+BUILT_SOURCES += config.vapi
+CLEANFILES += config.vapi
65 Makefile.configmake
View
@@ -0,0 +1,65 @@
+# LGPLv2+
+
+# Retrieve values of the variables through 'configure' followed by
+# 'make', not directly through 'configure', so that a user who
+# sets some of these variables consistently on the 'make' command
+# line gets correct results.
+#
+# One advantage of this approach, compared to the classical
+# approach of adding -DLIBDIR=\"$(libdir)\" etc. to AM_CPPFLAGS,
+# is that it protects against the use of undefined variables.
+# If, say, $(libdir) is not set in the Makefile, LIBDIR is not
+# defined by this module, and code using LIBDIR gives a
+# compilation error.
+#
+# Another advantage is that 'make' output is shorter.
+#
+# Listed in the same order as the GNU makefile conventions.
+# The Automake-defined pkg* macros are appended, in the order
+# listed in the Automake 1.10a+ documentation.
+configmake.vapi: configmake.h
+ rm -f $@
+ { \
+ echo '[CCode (cheader_filename = "configmake.h")]'; \
+ echo 'namespace Config {'; \
+ sed -e 's/#define \([A-Z_]*\) .*/[CCode (cname = "\1")]\npublic static const string \1;/' $< ; \
+ echo '}' ; \
+ } > $@
+
+configmake.h: Makefile.configmake Makefile
+ rm -f $@-t $@
+ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+ echo '#define PREFIX "$(prefix)"'; \
+ echo '#define EXEC_PREFIX "$(exec_prefix)"'; \
+ echo '#define BINDIR "$(bindir)"'; \
+ echo '#define SBINDIR "$(sbindir)"'; \
+ echo '#define LIBEXECDIR "$(libexecdir)"'; \
+ echo '#define DATAROOTDIR "$(datarootdir)"'; \
+ echo '#define DATADIR "$(datadir)"'; \
+ echo '#define SYSCONFDIR "$(sysconfdir)"'; \
+ echo '#define SHAREDSTATEDIR "$(sharedstatedir)"'; \
+ echo '#define LOCALSTATEDIR "$(localstatedir)"'; \
+ echo '#define INCLUDEDIR "$(includedir)"'; \
+ echo '#define OLDINCLUDEDIR "$(oldincludedir)"'; \
+ echo '#define DOCDIR "$(docdir)"'; \
+ echo '#define INFODIR "$(infodir)"'; \
+ echo '#define HTMLDIR "$(htmldir)"'; \
+ echo '#define DVIDIR "$(dvidir)"'; \
+ echo '#define PDFDIR "$(pdfdir)"'; \
+ echo '#define PSDIR "$(psdir)"'; \
+ echo '#define LIBDIR "$(libdir)"'; \
+ echo '#define LISPDIR "$(lispdir)"'; \
+ echo '#define LOCALEDIR "$(localedir)"'; \
+ echo '#define MANDIR "$(mandir)"'; \
+ echo '#define MANEXT "$(manext)"'; \
+ echo '#define PKGDATADIR "$(pkgdatadir)"'; \
+ echo '#define PKGINCLUDEDIR "$(pkgincludedir)"'; \
+ echo '#define PKGLIBDIR "$(pkglibdir)"'; \
+ echo '#define PKGLIBEXECDIR "$(pkglibexecdir)"'; \
+ echo '#define ABSTOPSRCDIR "$(abs_top_srcdir)"'; \
+ } | sed '/""/d' > $@-t
+ mv $@-t $@
+BUILT_SOURCES += configmake.h configmake.vapi
+CLEANFILES += configmake.h configmake.h-t configmake.vapi
+
+
57 Makefile.decl
View
@@ -0,0 +1,57 @@
+# GLIB - Library of useful C routines
+
+GTESTER = gtester
+GTESTER_REPORT = gtester-report
+
+# initialize variables for unconditional += appending
+EXTRA_DIST =
+TEST_PROGS =
+
+### testing rules
+
+# test: run all tests in cwd and subdirs
+test: ${TEST_PROGS}
+ @test -z "${TEST_PROGS}" || ${GTESTER} --verbose ${TEST_PROGS}
+ @ for subdir in $(SUBDIRS) . ; do \
+ test "$$subdir" = "." -o "$$subdir" = "po" || \
+ ( cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $? ; \
+ done
+# test-report: run tests in subdirs and generate report
+# perf-report: run tests in subdirs with -m perf and generate report
+# full-report: like test-report: with -m perf and -m slow
+test-report perf-report full-report: ${TEST_PROGS}
+ @test -z "${TEST_PROGS}" || { \
+ case $@ in \
+ test-report) test_options="-k";; \
+ perf-report) test_options="-k -m=perf";; \
+ full-report) test_options="-k -m=perf -m=slow";; \
+ esac ; \
+ if test -z "$$GTESTER_LOGDIR" ; then \
+ ${GTESTER} --verbose $$test_options -o test-report.xml ${TEST_PROGS} ; \
+ elif test -n "${TEST_PROGS}" ; then \
+ ${GTESTER} --verbose $$test_options -o `mktemp "$$GTESTER_LOGDIR/log-XXXXXX"` ${TEST_PROGS} ; \
+ fi ; \
+ }
+ @ ignore_logdir=true ; \
+ if test -z "$$GTESTER_LOGDIR" ; then \
+ GTESTER_LOGDIR=`mktemp -d "\`pwd\`/.testlogs-XXXXXX"`; export GTESTER_LOGDIR ; \
+ ignore_logdir=false ; \
+ fi ; \
+ for subdir in $(SUBDIRS) . ; do \
+ test "$$subdir" = "." -o "$$subdir" = "po" || \
+ ( cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $? ; \
+ done ; \
+ $$ignore_logdir || { \
+ echo '<?xml version="1.0"?>' > $@.xml ; \
+ echo '<report-collection>' >> $@.xml ; \
+ for lf in `ls -L "$$GTESTER_LOGDIR"/.` ; do \
+ sed '1,1s/^<?xml\b[^>?]*?>//' <"$$GTESTER_LOGDIR"/"$$lf" >> $@.xml ; \
+ done ; \
+ echo >> $@.xml ; \
+ echo '</report-collection>' >> $@.xml ; \
+ rm -rf "$$GTESTER_LOGDIR"/ ; \
+ ${GTESTER_REPORT} --version 2>/dev/null 1>&2 ; test "$$?" != 0 || ${GTESTER_REPORT} $@.xml >$@.html ; \
+ }
+.PHONY: test test-report perf-report full-report
+# run make test as part of make check
+check-local: test
16 Makefile.licenses
View
@@ -0,0 +1,16 @@
+LICENSES = GPLv2 GPLv3 AUTHORS
+licenses.vapi: $(LICENSES)
+ echo 'namespace Licenses {' > licenses.vala
+ for i in $(LICENSES); do \
+ echo -n 'public static const string '$$i'="""'; >> licenses.vala \
+ cat $$i; \
+ echo '""";'; \
+ done >> licenses.vala ;
+ echo '}' >> licenses.vala
+ $(VALAC_BIN) -C --basedir=$(top_srcdir) --library=licenses licenses.vala
+ rm licenses.vala
+ rm licenses.c
+ rm licenses.gir
+
+BUILT_SOURCES += licenses.vapi licenses.h
+EXTRA_DIST += $(LICENSES) licenses.vapi licenses.h
10 applet/GlobalMenu_PanelApplet.server.in → applet/GlobalMenu_PanelApplet.server.in.in
View
@@ -5,8 +5,8 @@
<item value="IDL:Bonobo/GenericFactory:1.0"/>
<item value="IDL:Bonobo/Unknown:1.0"/>
</oaf_attribute>
- <oaf_attribute name="name" type="string" value="GlobalMenu.PanelApplet Factory"/>
- <oaf_attribute name="description" type="string" value="The factory to build GlobalMenu.PanelApplet objects"/>
+ <oaf_attribute name="name" type="string" _value="GlobalMenu.PanelApplet Factory"/>
+ <oaf_attribute name="description" type="string" _value="The factory to build GlobalMenu.PanelApplet objects"/>
</oaf_server>
<oaf_server iid="OAFIID:GlobalMenu_PanelApplet" type="factory"
location="OAFIID:GlobalMenu_PanelApplet_Factory">
@@ -15,8 +15,8 @@
<item value="IDL:Bonobo/Control:1.0"/>
<item value="IDL:Bonobo/Unknown:1.0"/>
</oaf_attribute>
- <oaf_attribute name="name" type="string" value="Global Menu Panel Applet"/>
- <oaf_attribute name="description" type="string" value="Global Menu Panel Applet"/>
- <oaf_attribute name="panel:icon" type="string" value="gnome-fs-home"/>
+ <oaf_attribute name="name" type="string" _value="Global Menu Panel Applet"/>
+ <oaf_attribute name="description" type="string" _value="Global Menu Panel Applet"/>
+ <oaf_attribute name="panel:icon" type="string" value="globalmenu"/>
</oaf_server>
</oaf_info>
34 applet/GnomeMenuHelper.vala
View
@@ -1,34 +0,0 @@
-using GLib;
-
-namespace GnomeMenuHelper {
- public static GLib.HashTable<string,string> get_flat_list() {
- GnomeVFS.init ();
- GMenu.TreeDirectory node = GMenu.Tree.lookup ("applications.menu", GMenu.TreeFlags.INCLUDE_EXCLUDED).get_root_directory();
- return __get_flat_list(node);
- }
- private static GLib.HashTable<string,string> __get_flat_list(GMenu.TreeDirectory root) {
- GMenu.TreeDirectory node = root;
- GLib.HashTable<string,string> ret = new HashTable<string, string>.full(str_hash, str_equal, g_free, g_free);
- foreach (GMenu.TreeItem item in node.get_contents()) {
- if (item.get_type() == GMenu.TreeItemType.ENTRY) {
- string txt = ((GMenu.TreeEntry)item).get_exec();
- txt = txt.split(" ")[0];
- long co = txt.length-1;
- while ((co>=0) && (txt.substring(co, 1)!="/")) {
- co--;
- }
- txt = txt.substring(co+1,(txt.length-co-1));
- if (ret.lookup(txt)==null) ret.insert(txt, ((GMenu.TreeEntry)item).get_name());
- }
- }
-
- foreach (GMenu.TreeItem item in node.get_contents()) {
- if (item.get_type() == GMenu.TreeItemType.DIRECTORY) {
- GLib.HashTable<string,string> children = __get_flat_list((GMenu.TreeDirectory)item);
- foreach(string k in children.get_keys())
- ret.insert(k, (string)children.lookup(k));
- }
- }
- return ret;
- }
-}
121 applet/Makefile.am
View
@@ -1,81 +1,88 @@
NULL =
-AM_CPPFLAGS = \
- -g \
- $(GLOBALMENU_PANELAPPLET_CFLAGS) \
- -include $(CONFIG_HEADER) \
- -I$(top_srcdir)/libgmarkupdoc \
- -I$(top_srcdir)/libgnomenu \
- -DPREFIX=\"$(prefix)\" \
- -DSYSCONFDIR=\"$(sysconfdir)\" \
- -DDATADIR=\"$(datadir)\" \
- -DLIBDIR=\"$(libdir)\" \
- -DGMENU_I_KNOW_THIS_IS_UNSTABLE \
- "-DWNCK_I_KNOW_THIS_IS_UNSTABLE"
- $(NULL)
-
-AM_VALAC_FLAGS = \
- $(GLOBALMENU_PANELAPPLET_VALA_PKGS) \
- --vapidir=$(top_srcdir)/libgmarkupdoc \
- --vapidir=$(top_srcdir)/libgnomenu \
- --vapidir=$(top_srcdir)/applet \
- --pkg gnomenu \
- --pkg gtkcompat \
- --pkg gmarkupdoc \
- --pkg wnckcompat \
- --pkg panelappletcompat \
- --pkg gnome-desktop-2.0 \
- --pkg libgnome-menu \
- --pkg gconf-2.0 \
- --pkg gdk-2.0 \
- --pkg gconfcompat \
- $(NULL)
-
-BUILT_SOURCES = \
- .vala.stamp \
- $(GlobalMenu_PanelApplet_VALASOURCES:.vala=.c) \
- $(GlobalMenu_PanelApplet_VALASOURCES:.vala=.h) \
- $(NULL)
+STAMP = vala-stamp
-GlobalMenu_PanelApplet_VALASOURCES = \
- panelextra-menubar.vala \
- panelextra-switcher.vala \
- gtkextra-gconfdialog.vala \
- GPL.vala \
- GnomeMenuHelper.vala \
+BUILT_SOURCES = $(STAMP) $(server_in_files)
+VALASOURCES = \
applet.vala \
+ main.vala \
+ gtkextra-gconfdialog.vala \
+ switcher.vala \
+ gnomemenuhelper.vala \
$(NULL)
-libexec_PROGRAMS = \
- GlobalMenu.PanelApplet \
- $(NULL)
+libexec_PROGRAMS = GlobalMenu.PanelApplet
serverdir = $(BONOBO_SERVER_DIR)
+server_in_in_files = GlobalMenu_PanelApplet.server.in.in
server_in_files = GlobalMenu_PanelApplet.server.in
server_DATA = $(server_in_files:.server.in=.server)
+@INTLTOOL_SERVER_RULE@
-$(server_DATA): $(server_in_files) Makefile
+$(server_in_files): $(server_in_in_files) Makefile
sed -e "s|@LOCATION@|$(libexecdir)|" $< > $@
GlobalMenu_PanelApplet_SOURCES = \
- $(GlobalMenu_PanelApplet_VALASOURCES:.vala=.c) \
- $(GlobalMenu_PanelApplet_VALASOURCES:.vala=.h) \
+ $(VALASOURCES:.vala=.c) \
+ $(VALASOURCES:.vala=.h) \
task-utils-c.c \
$(NULL)
-.vala.stamp: $(GlobalMenu_PanelApplet_VALASOURCES)
- $(VALAC) -C $^
+
+$(STAMP): $(VALASOURCES) patch.sh libpanelapplet-2.0.vapi libpanelapplet-2.0.deps
+ $(VALAC) -C --vapidir=. \
+ --vapidir=$(top_srcdir)/libgnomenu \
+ --pkg=gtk+-2.0 \
+ --pkg=libwnck-1.0 \
+ --pkg=libpanelapplet-2.0 \
+ --pkg=gnomenu-private \
+ --pkg=gnome-desktop-2.0 \
+ --pkg=libgnome-menu \
+ --pkg=gconf-2.0 \
+ --pkg=gconfcompat \
+ --pkg=wnckcompat \
+ $(VALASOURCES)
+ bash patch.sh
touch $@
+GlobalMenu_PanelApplet_LDFLAGS = \
+ -g \
+ $(NULL)
+
GlobalMenu_PanelApplet_LDADD = \
- $(GLOBALMENU_PANELAPPLET_LIBS) \
- $(top_builddir)/libgnomenu/libgnomenu.la \
- $(top_builddir)/libgmarkupdoc/libgmarkupdoc.la \
+ $(GLIB_LIBS) \
+ $(GTK_LIBS) \
+ $(WNCK_LIBS) \
+ $(PANEL_LIBS) \
+ $(GMENU_LIBS) \
+ ../libgnomenu/libgnomenu.la \
$(NULL)
+GlobalMenu_PanelApplet_CPPFLAGS = \
+ $(GLIB_CFLAGS) \
+ $(GTK_CFLAGS) \
+ $(WNCK_CFLAGS) \
+ $(PANEL_CFLAGS) \
+ $(GMENU_CFLAGS) \
+ -I$(top_srcdir) \
+ -include $(CONFIG_HEADER) \
+ -DGMENU_I_KNOW_THIS_IS_UNSTABLE \
+ -DWNCK_I_KNOW_THIS_IS_UNSTABLE \
+ -g \
+ $(NULL)
+
+iconsdir = $(prefix)/share/pixmaps
+icons_DATA = globalmenu.png
+
EXTRA_DIST = \
- $(BUILT_SOURCES) \
- $(GlobalMenu_PanelApplet_VALASOURCES) \
- $(server_in_files) \
+ $(STAMP) \
+ patch.sh \
+ libpanelapplet-2.0.vapi \
+ libpanelapplet-2.0.deps \
+ $(VALASOURCES) \
+ $(server_in_in_files) \
+ $(icons_DATA) \
$(NULL)
-DISTCLEANFILES = $(server_DATA)
+
+DISTCLEANFILES = $(server_DATA) $(server_in_files)
+
479 applet/applet.vala
View
@@ -1,14 +1,241 @@
using GLib;
-using Panel;
-using PanelCompat;
using Gtk;
+using Gnomenu;
+using Wnck;
+using Panel;
+using GConf;
public extern int system(string? cmd);
-public class GlobalMenuApplet : PanelCompat.Applet {
- static GlobalMenuApplet the_applet;
- static const string APPLET_NAME = "globalmenu-panel-applet";
- static const string APPLET_VERSION = "0.6";
- static const string APPLET_ICON = "gnome-fs-home";
+public class Applet : Panel.Applet {
+ public static const string IID = "OAFIID:GlobalMenu_PanelApplet";
+
+ public Applet() {
+ }
+ public override void dispose() {
+ if(!disposed) {
+ disposed = true;
+ set_background_widget(null);
+ if(current_window != null) {
+ current_window.destroy();
+ current_window = null;
+ }
+ }
+ base.dispose();
+ }
+ ~Applet() {
+ int keyval;
+ Gdk.ModifierType mods;
+ get_accel_key(out keyval, out mods);
+ root_window.ungrab_key(keyval, mods);
+ }
+ static construct {
+ screen = Wnck.Screen.get_default();
+ root_window = Gnomenu.Window.new_from_gdk_window(Gdk.get_default_root_window());
+ }
+
+ construct {
+ disposed = false;
+ set_name("GlobalMenuPanelApplet");
+ add_events(Gdk.EventMask.KEY_PRESS_MASK);
+
+ menubars = new MenuBarBox();
+ menubars.visible = true;
+ add(menubars);
+
+ selector = new Switcher();
+ selector.visible = true;
+ menubars.add(selector);
+
+ main_menubar = new Gnomenu.MenuBar();
+ main_menubar.min_length = 0; /*Then it will have a overflown item*/
+ main_menubar.activate += (menubar, item) => {
+ if(current_window != null) {
+ current_window.emit_menu_event(item.path);
+ }
+ };
+ menubars.add(main_menubar);
+ menubars.child_set(main_menubar, "expand", true, null); /*Let the main_menubar use the remaining space in the applet.*/
+
+
+ /*init panel */
+ flags = (Panel.AppletFlags.EXPAND_MINOR | Panel.AppletFlags.HAS_HANDLE | Panel.AppletFlags.EXPAND_MAJOR );
+ set_background_widget(this);
+
+ Gdk.Color color;
+ Gdk.Pixmap pixmap;
+ AppletBackgroundType bgtype;
+ bgtype = get_background(out color, out pixmap);
+ (this as Panel.Applet).change_background(bgtype, color, pixmap);
+ }
+
+ private static Wnck.Screen screen;
+ private Gnomenu.Window current_window;
+ private static Gnomenu.Window root_window;
+
+ private MenuBarBox menubars;
+ private bool disposed;
+ private Gnomenu.MenuBar main_menubar;
+ private Switcher selector;
+
+ /* to be removed */
+ public static void message(string msg) {
+ Gtk.MessageDialog m = new Gtk.MessageDialog(null,
+ Gtk.DialogFlags.MODAL,
+ Gtk.MessageType.INFO,
+ Gtk.ButtonsType.OK,
+ msg);
+ m.run();
+ m.destroy();
+ }
+
+ private void init_wnck() {
+ screen.window_closed += (screen, window) => {
+ ulong xid = window.get_xid();
+ if(current_window != null && xid == current_window.xid) {
+ /* if the closed window is current window,
+ * fallback to the desktop and
+ * wait for the next active_window_changed event
+ *
+ * To solve the haunting menu bar of closed window
+ * problem.
+ * */
+ switch_to(find_desktop(screen));
+ }
+ };
+ screen.active_window_changed += (screen, previous_window) => {
+ weak Wnck.Window window = screen.get_active_window();
+ if((window != previous_window) && (window is Wnck.Window)) {
+ weak Wnck.Window transient_for = window.get_transient();
+ if(transient_for != null) window = transient_for;
+ switch(window.get_window_type()) {
+ case Wnck.WindowType.NORMAL:
+ case Wnck.WindowType.DESKTOP:
+ switch_to(window);
+ break;
+ default:
+ /*Do nothing if it is a toolbox or so*/
+ break;
+ }
+ }
+ };
+ screen.window_closed += (window) => {
+ selector.current_window = screen.get_active_window();
+ };
+ }
+ private void switch_to(Wnck.Window? window) {
+ if(current_window != null) {
+ /* This is a weird way to free a window:
+ * We have two reference counts for current_window
+ * Destroy will release the one held by GTK( including
+ * all circular references),
+ * and the assignment line below will release the one
+ * held by us.
+ * */
+ current_window.destroy();
+ assert(current_window.ref_count == 1);
+ current_window = null;
+ }
+ if(window != null) {
+ current_window = Gnomenu.Window.new_from_native(window.get_xid());
+ selector.current_window = window;
+ }
+ if(current_window != null) {
+ current_window.menu_context_changed += (current_window) => {
+ update_menubar();
+ };
+ }
+ update_menubar();
+ }
+ private Wnck.Window? find_desktop(Wnck.Screen screen) {
+ weak List<weak Wnck.Window> windows = screen.get_windows();
+ foreach(weak Wnck.Window window in windows) {
+ if(window.get_window_type() == Wnck.WindowType.DESKTOP) {
+ /*Vala should ref it*/
+ return window;
+ }
+ }
+ return null;
+ }
+ private void grab_gtk_menu_bar_key() {
+ /*FIXME: listen to changes in GTK_SETTINGS.*/
+ int keyval;
+ Gdk.ModifierType mods;
+ get_accel_key(out keyval, out mods);
+ root_window.grab_key(keyval, mods);
+ root_window.key_press_event += (root_window, event) => {
+ uint keyval;
+ Gdk.ModifierType mods;
+ get_accel_key(out keyval, out mods);
+ if(event.keyval == keyval &&
+ (event.state & Gtk.accelerator_get_default_mod_mask())
+ == (mods & Gtk.accelerator_get_default_mod_mask())) {
+ /* We chain up to the toplevel key_press_event,
+ * which is listened by all the menubars within
+ * the applet*/
+ Gtk.Widget toplevel = get_toplevel();
+ if(toplevel != null)
+ toplevel.key_press_event(event);
+ return false;
+ }
+ return true;
+ };
+ }
+ private void update_menubar() {
+ if(current_window != null) {
+ string context = current_window.menu_context;
+ if(context != null) {
+ Parser.parse(main_menubar, context);
+ main_menubar.show();
+ return;
+ }
+ }
+ /* elseever */
+ main_menubar.hide();
+ }
+ private override void change_background(AppletBackgroundType type, Gdk.Color? color, Gdk.Pixmap? pixmap) {
+ Background bg = new Background();
+ switch(type){
+ case Panel.AppletBackgroundType.NO_BACKGROUND:
+ bg.pixmap = this.style.bg_pixmap[(int)StateType.NORMAL];
+ bg.color = this.style.bg[(int)StateType.NORMAL];
+ if (bg.pixmap==null)
+ bg.type = BackgroundType.COLOR; else
+ bg.type = BackgroundType.PIXMAP;
+ break;
+ case Panel.AppletBackgroundType.COLOR_BACKGROUND:
+ bg.type = BackgroundType.COLOR;
+ bg.color = color;
+ break;
+ case Panel.AppletBackgroundType.PIXMAP_BACKGROUND:
+ bg.type = BackgroundType.PIXMAP;
+ bg.pixmap = pixmap;
+ break;
+ }
+ menubars.background = bg;
+ }
+ private override void change_orient(AppletOrient orient) {
+ switch(orient) {
+ case AppletOrient.UP:
+ menubars.gravity = Gravity.DOWN;
+ menubars.pack_direction = PackDirection.LTR;
+ break;
+ case AppletOrient.DOWN:
+ menubars.gravity = Gravity.DOWN;
+ menubars.pack_direction = PackDirection.LTR;
+ break;
+ case AppletOrient.LEFT:
+ menubars.gravity = Gravity.LEFT;
+ menubars.pack_direction = PackDirection.TTB;
+ break;
+ case AppletOrient.RIGHT:
+ menubars.gravity = Gravity.RIGHT;
+ menubars.pack_direction = PackDirection.BTT;
+ break;
+ }
+ }
+
+ static const string APPLET_NAME = _("globalmenu-panel-applet");
+ static const string APPLET_ICON = "globalmenu";
static const string GCONF_SCHEMA_DIR = "/schemas/apps/globalmenu-panel-applet/prefs";
static const string[] APPLET_AUTHORS = {"Coding:",
"Yu Feng <rainwoodman@gmail.com>",
@@ -22,176 +249,126 @@ public class GlobalMenuApplet : PanelCompat.Applet {
"Valiant Wing <Valiant.Wing@gmail.com>"};
static const string[] APPLET_ADOCUMENTERS = {"Pierre Slamich <pierre.slamich@gmail.com>"};
- private Wnck.Screen screen;
- private Gnomenu.MenuBar menubar;
- private Gtk.Box box;
- private PanelExtra.Switcher switcher;
-
- public static bool factory (Panel.Applet applet, string iid) {
- ((GlobalMenuApplet) applet).create ();
- return true;
- }
- public static void message(string msg) {
- Gtk.MessageDialog m = new Gtk.MessageDialog(null,
- Gtk.DialogFlags.MODAL,
- Gtk.MessageType.INFO,
- Gtk.ButtonsType.OK,
- msg);
- m.run();
- m.destroy();
+
+ private override void realize() {
+ base.realize();
+
+ /* Connect to gconf */
+ this.add_preferences(GCONF_SCHEMA_DIR);
+ GConf.Client.get_default().value_changed += (key, value) => {
+ this.get_prefs();
+ };
+
+ string applet_menu_xml = _("""
+<popup name="button3">
+ <menuitem debuname="Preferences"
+ verb="Preferences"
+ _label="_Preferences"
+ pixtype="stock"
+ pixname="gtk-preferences"/>
+ <menuitem debuname="Help"
+ verb="Help"
+ _label="_Help"
+ pixtype="stock"
+ pixname="gtk-help"/>
+ <menuitem debuname="About"
+ verb="About" _label="_About..."
+ pixtype="stock"
+ pixname="gtk-about"/>
+</popup>
+ """);
+
+ var verbPreferences = BonoboUI.Verb ();
+ verbPreferences.cname = "Preferences";
+ verbPreferences.cb = on_preferences_clicked;
+
+ var verbAbout = BonoboUI.Verb ();
+ verbAbout.cname = "About";
+ verbAbout.cb = on_about_clicked;
+
+ var verbHelp = BonoboUI.Verb ();
+ verbHelp.cname = "Help";
+ verbHelp.cb = on_help_clicked;
+
+ var verbs = new BonoboUI.Verb[] { verbAbout, verbHelp, verbPreferences };
+ setup_menu (applet_menu_xml, verbs, this);
+
+ get_prefs();
+
+ /*init wnck*/
+ init_wnck();
+
+ /* Key grab F10 (gtk-menu-bar-key)*/
+ grab_gtk_menu_bar_key();
+ }
+ private void get_prefs() {
+ selector.max_size = gconf_get_int("title_max_width");
+ selector.show_icon = gconf_get_bool("show_icon");
+ selector.show_label = gconf_get_bool("show_name");
+ selector.show_window_actions = gconf_get_bool("show_window_actions");
+ selector.show_window_list = gconf_get_bool("show_window_list");
}
- private static void on_about_clicked (BonoboUI.Component component,
+ private static void on_about_clicked (BonoboUI.Component component,
void* user_data, string cname) {
+ Applet _this = (Applet) user_data;
+
var dialog = new Gtk.AboutDialog();
dialog.program_name = APPLET_NAME;
- dialog.version = APPLET_VERSION;
+ dialog.version = Config.VERSION;
dialog.website = "http://code.google.com/p/gnome2-globalmenu";
- dialog.website_label = "Project Home";
+ dialog.website_label = _("Project Home");
dialog.wrap_license = false;
- dialog.license = GPL.Licenses.V2;
+ dialog.license = Licenses.GPLv2;
dialog.logo_icon_name = APPLET_ICON;
dialog.authors = APPLET_AUTHORS;
dialog.documenters = APPLET_ADOCUMENTERS;
+ dialog.set_icon_name("gtk-about");
dialog.run();
dialog.destroy();
}
private static void on_help_clicked (BonoboUI.Component component,
void* user_data, string cname) {
+ Applet _this = (Applet) user_data;
var dialog = new Gtk.AboutDialog();
dialog.program_name = APPLET_NAME;
- dialog.version = APPLET_VERSION;
+ dialog.version = Config.VERSION;
dialog.website = "http://code.google.com/p/gnome2-globalmenu/w/list";
- dialog.website_label = "On-line help";
+ dialog.website_label = _("On-line help");
dialog.logo_icon_name = "gtk-help";
+ dialog.set_icon_name("gtk-help");
dialog.run();
dialog.destroy();
}
private static void on_preferences_clicked (BonoboUI.Component component,
void* user_data, string cname) {
- //system("gconf-editor " + the_applet.get_preferences_key() + " &");
- GtkExtra.GConfDialog gcd = new GtkExtra.GConfDialog(the_applet.get_preferences_key(), "Applet preferences");
+
+ Applet _this = (Applet) user_data;
+ //system("gconf-editor " + _this.get_preferences_key() + " &");
+ GConfDialog gcd = new GConfDialog.with_subkeys(_this.get_preferences_key(),
+ "Applet preferences",
+ new string[]{
+ "show_icon",
+ "show_name",
+ "title_max_width",
+ "show_window_actions",
+ "show_window_list"});
gcd.run();
gcd.destroy();
}
- private void on_active_window_changed (WnckCompat.Screen screen, Wnck.Window? previous_window){
- weak Wnck.Window window = (screen as Wnck.Screen).get_active_window();
- if((window != previous_window) && (window is Wnck.Window)) {
- weak Wnck.Window transient_for = window.get_transient();
- if(transient_for != null) window = transient_for;
- string xid = window.get_xid().to_string();
- menubar.switch(xid);
- }
+ /**
+ * return the accelerator key combination for invoking menu bars
+ * in GTK Settings. It is usually F10.
+ */
+ private static void get_accel_key(out uint keyval, out Gdk.ModifierType mods) {
+ Settings settings = Settings.get_default();
+ string accel = null;
+ settings.get("gtk_menu_bar_accel", &accel, null);
+ if(accel != null)
+ Gtk.accelerator_parse(accel, out keyval, out mods);
}
- /*private override void size_allocate(Gdk.Rectangle a) {
- //message("test");
- }*/
- private void on_change_background (GlobalMenuApplet applet, Panel.AppletBackgroundType bgtype,
- Gdk.Color? color, Gdk.Pixmap? pixmap) {
- Gtk.Style style = (Gtk.rc_get_style(this.menubar) as GtkCompat.Style).copy();
- switch(bgtype){
- case Panel.AppletBackgroundType.NO_BACKGROUND:
- Gtk.Style def_style = Gtk.rc_get_style(this);
- this.menubar.set_style(def_style);
- this.menubar.queue_draw();
-
- this.switcher.set_style(def_style);
- this.switcher.queue_draw();
-
- return;
- break;
- case Panel.AppletBackgroundType.COLOR_BACKGROUND:
- style.bg_pixmap[(int)StateType.NORMAL] = null;
- style.bg[(int)StateType.NORMAL] = color;
- break;
- case Panel.AppletBackgroundType.PIXMAP_BACKGROUND:
- style.bg_pixmap[(int)StateType.NORMAL] = pixmap;
- break;
- }
- this.menubar.set_style(style);
- this.menubar.queue_draw();
-
- this.switcher.set_style(style);
- this.switcher.queue_draw();
- }
- private void get_prefs() {
- switcher.show_label = this.gconf_get_bool("show_name");
- switcher.show_icon = this.gconf_get_bool("show_icon");
- switcher.max_size = this.gconf_get_int("title_max_width");
- switcher.show_window_actions = this.gconf_get_bool("show_window_actions");
- switcher.show_window_list = this.gconf_get_bool("show_window_list");
- switcher.refresh();
- }
- private void create () {
- the_applet = this;
- this.add_preferences(GCONF_SCHEMA_DIR);
- GConf.Client.get_default().value_changed += (key, value) => {
- this.get_prefs();
- };
-
- this.set_flags(Panel.AppletFlags.EXPAND_MINOR | Panel.AppletFlags.HAS_HANDLE | Panel.AppletFlags.EXPAND_MAJOR );
- change_background += on_change_background;
-
- menubar = new Gnomenu.MenuBar();
- menubar.set_name("PanelMenuBar");
- box = new Gtk.HBox(false, 0);
- menubar.show_tabs = false;
-
- string menu_definition =
- "<popup name=\"button3\">" +
- "<menuitem debuname=\"Preferences\" verb=\"Preferences\" _label=\"_Preferences\" pixtype=\"stock\" pixname=\"gtk-preferences\"/>" +
- "<menuitem debuname=\"Help\" verb=\"Help\" _label=\"_Help\" pixtype=\"stock\" pixname=\"gtk-help\"/>" +
- "<menuitem debuname=\"About\" verb=\"About\" _label=\"_About...\" pixtype=\"stock\" pixname=\"gtk-about\"/>" +
- "</popup>";
-
- var verbPreferences = BonoboUI.Verb ();
- verbPreferences.cname = "Preferences";
- verbPreferences.cb = on_preferences_clicked;
-
- var verbAbout = BonoboUI.Verb ();
- verbAbout.cname = "About";
- verbAbout.cb = on_about_clicked;
-
- var verbHelp = BonoboUI.Verb ();
- verbHelp.cname = "Help";
- verbHelp.cb = on_help_clicked;
-
- var verbs = new BonoboUI.Verb[] { verbAbout, verbHelp, verbPreferences };
- setup_menu (menu_definition, verbs, null);
-
- switcher = new PanelExtra.Switcher();
- box.pack_start(switcher, false, true, 0);
-
- box.pack_start(menubar, true, true, 0);
- this.add(box);
- screen = Wnck.Screen.get_default();
- (screen as WnckCompat.Screen).active_window_changed += on_active_window_changed;
-
- show_all();
-
- get_prefs();
- }
+}
- public static int main (string[] args) {
- var program = Gnome.Program.init ("GlobalMenuApplet", "0.6", Gnome.libgnomeui_module,
- args, "sm-connect", false);
-
- Gtk.rc_parse_string("""
- style "globalmenu_event_box_style"
- {
- GtkWidget::focus-line-width=0
- GtkWidget::focus-padding=0
- }
- style "globalmenu_menu_bar_style"
- {
- ythickness = 0
- GtkMenuBar::shadow-type = none
- GtkMenuBar::internal-padding = 0
- }
- class "GtkEventBox" style "globalmenu_event_box_style"
- class "GnomenuMenuBar" style:highest "globalmenu_menu_bar_style"
-""");
- return Panel.Applet.factory_main ("OAFIID:GlobalMenu_PanelApplet_Factory",
- typeof (GlobalMenuApplet), factory);
- }
-}
+/**
+ * :vim:ts=4:sw=4:
+ */
0  vapi-compat/gconfcompat.vapi → applet/gconfcompat.vapi
View
File renamed without changes
BIN  applet/globalmenu.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
54 applet/gnome-globalmenu-applet.schemas
View
@@ -1,54 +0,0 @@
-<gconfschemafile>
- <schemalist>
- <schema>
- <key>/schemas/apps/globalmenu-panel-applet/prefs/show_icon</key>
- <owner>globalmenu-panel-applet</owner>
- <type>bool</type>
- <default>FALSE</default>
- <locale name="C">
- <short>Icon</short>
- <long>Show/Hide the icon of the active window</long>
- </locale>
- </schema>
- <schema>
- <key>/schemas/apps/globalmenu-panel-applet/prefs/show_name</key>
- <owner>globalmenu-panel-applet</owner>
- <type>bool</type>
- <default>TRUE</default>
- <locale name="C">
- <short>Label</short>
- <long>Show/Hide the name of the active application</long>
- </locale>
- </schema>
- <schema>
- <key>/schemas/apps/globalmenu-panel-applet/prefs/show_window_list</key>
- <owner>globalmenu-panel-applet</owner>
- <type>bool</type>
- <default>TRUE</default>
- <locale name="C">
- <short>Window List</short>
- <long>Uses active application lablel as application switcher</long>
- </locale>
- </schema>
- <schema>
- <key>/schemas/apps/globalmenu-panel-applet/prefs/show_window_actions</key>
- <owner>globalmenu-panel-applet</owner>
- <type>bool</type>
- <default>TRUE</default>
- <locale name="C">
- <short>Window Actions</short>
- <long>Add window action menu entries to active application name menu</long>
- </locale>
- </schema>
- <schema>
- <key>/schemas/apps/globalmenu-panel-applet/prefs/title_max_width</key>
- <owner>globalmenu-panel-applet</owner>
- <type>int</type>
- <default>30</default>
- <locale name="C">
- <short>Max title length</short>
- <long>The Maximum length of name of the active application</long>
- </locale>
- </schema>
- </schemalist>
-</gconfschemafile>
35 applet/gnomemenuhelper.vala
View
@@ -0,0 +1,35 @@
+using GLib;
+using GMenu;
+
+namespace GnomeMenuHelper {
+ public static HashTable<string,string> get_flat_list() {
+ GnomeVFS.init ();
+ TreeDirectory node = GMenu.Tree.lookup ("applications.menu", TreeFlags.INCLUDE_EXCLUDED).get_root_directory();
+ return __get_flat_list(node);
+ }
+ private static HashTable<string,string> __get_flat_list(TreeDirectory root) {
+ TreeDirectory node = root;
+ HashTable<string,string> ret = new HashTable<string, string>.full(str_hash, str_equal, g_free, g_free);
+ foreach (TreeItem item in node.get_contents()) {
+ if (item.get_type() == TreeItemType.ENTRY) {
+ string txt = ((TreeEntry)item).get_exec();
+ txt = txt.split(" ")[0];
+ long co = txt.length-1;
+ while ((co>=0) && (txt.substring(co, 1)!="/")) {
+ co--;
+ }
+ txt = txt.substring(co+1,(txt.length-co-1));
+ if (ret.lookup(txt)==null) ret.insert(txt, ((TreeEntry)item).get_name());
+ }
+ }
+
+ foreach (TreeItem item in node.get_contents()) {
+ if (item.get_type() == TreeItemType.DIRECTORY) {
+ HashTable<string,string> children = __get_flat_list((TreeDirectory)item);
+ foreach(string k in children.get_keys())
+ ret.insert(k, (string)children.lookup(k));
+ }
+ }
+ return ret;
+ }
+}
153 applet/gtkextra-gconfdialog.vala
View
@@ -1,99 +1,127 @@
-/* GtkExtra.GConfDialog
+/*******************************
+ * GConfDialog
* Author: Luca Viggiani
* Version: 0.1
* Date: 2009-12-07
* License: GPL
- * Description: creates a gconf settings back end dialog automatically from a settings key root.
- * Usage: new GtkExtra.GConfDialog(string key, string dialog_title)
- * Params:
- * string key: the gconf key to connect to (i.e /apps/panel/applets/applet_46/prefs)
- * string dislog_title: text to be shown on window title bar
- *
+ * Description: creates a gconf settings back end dialog
+ * automatically from a settings key root.
+ * Usage: new GConfDialog (string key, string dialog_title)
+ * Params:
+ * string key: the gconf key to connect to (i.e /apps/panel/applets/applet_46/prefs)
+ * string dislog_title: text to be shown on window title bar
+ * string[] subkeys: used to choose the subkeys to hadle (comprising display order).
+ * if null all subkeys will be retieved.
+ *
* TODO: Only BOOL and INT data types are implemented. STRING is implemented only partially (read)
- */
+ *******************************/
using GLib;
using Gtk;
using GConf;
-namespace GtkExtra {
public class GConfDialog : Gtk.Dialog {
- private string root_key;
+ public string root_key {get; construct;}
+
+ private GConf.Client _default_client;
+
public GConfDialog(string key, string dialog_title) {
root_key = key;
- this.title = dialog_title;
- this.set_icon_name("gtk-preferences");
-
+ title = dialog_title;
+ icon_name = "gtk-preferences";
+ }
+ public GConfDialog.with_subkeys(string key, string dialog_title, string[] subkeys) {
+ root_key = key;
+ title = dialog_title;
+ icon_name = "gtk-preferences";
+ if (subkeys==null) {
+ add_all_subkeys();
+ } else {
+ foreach(weak string subkey in subkeys) {
+ add_subkey(subkey);
+ }
+ }
+ }
+ construct {
+ _default_client = GConf.Client.get_default();
vbox.width_request = 320;
-
- weak GLib.SList<GConf.Entry> prefs = GConf.Engine.get_default().all_entries(key);
-
- foreach(weak GConf.Entry entry in prefs) {
- Gtk.Box row = new Gtk.HBox(false, 0);
-
- string schema_name = entry.get_schema_name();
- weak GConfCompat.Schema schema = (GConfCompat.Schema)Engine.get_default().get_schema(schema_name);
+ }
+ public void add_all_subkeys() {
+ weak GLib.SList<GConf.Entry> prefs = _default_client.all_entries(root_key);
+ foreach(weak GConf.Entry entry in prefs)
+ addEntry(entry);
+ }
+ public void add_subkey(string subkey) {
+ weak GLib.SList<GConf.Entry> prefs = _default_client.all_entries(root_key);
+ foreach(weak GConf.Entry entry in prefs)
+ if (entry.key == (root_key + "/" + subkey))
+ addEntry(entry);
+ }
+ private void addEntry(GConf.Entry entry) {
+ Gtk.Box row = new Gtk.HBox(false, 0);
+ string schema_name = entry.get_schema_name();
+ weak GConfCompat.Schema schema = (GConfCompat.Schema)_default_client.get_schema(schema_name);
- Gtk.Image info = new Gtk.Image.from_stock("gtk-dialog-info", Gtk.IconSize.BUTTON);
- info.tooltip_text = schema.get_long_desc();
- row.pack_start(info, false, false, 2);
+ Gtk.Image info = new Gtk.Image.from_stock("gtk-dialog-info", Gtk.IconSize.BUTTON);
+ info.tooltip_text = schema.get_long_desc();
+ row.pack_start(info, false, false, 2);
- Gtk.Label label = new Gtk.Label(schema.get_short_desc());
- label.justify = Gtk.Justification.LEFT;
- row.pack_start(label, false, false, 2);
+ Gtk.Label label = new Gtk.Label(schema.get_short_desc());
+ label.justify = Gtk.Justification.LEFT;
+ row.pack_start(label, false, false, 2);
- Gtk.Widget widget;
- switch(schema.get_type()) {
- case ValueType.BOOL:
- widget = new Gtk.CheckButton();
- (widget as Gtk.CheckButton).active = Engine.get_default().get_bool(entry.key);
- (widget as Gtk.CheckButton).clicked += onCheckButtonActivated;
- break;
- case ValueType.STRING:
- widget = new Gtk.Entry();
- (widget as Gtk.Entry).text = Engine.get_default().get_string(entry.key);
- /* TODO: connect changed signal to eventhandler */
- break;
- case ValueType.INT:
- widget = new Gtk.SpinButton.with_range(-100, 100, 1);
- (widget as Gtk.SpinButton).value = Engine.get_default().get_int(entry.key);
- (widget as Gtk.SpinButton).value_changed += onSpinButtonValueChanged;
- break;
- }
- widget.user_data = entry;
+ Gtk.Widget widget;
+ switch(schema.get_type()) {
+ case ValueType.BOOL:
+ widget = new Gtk.CheckButton();
+ (widget as Gtk.CheckButton).active = _default_client.get_bool(entry.key);
+ (widget as Gtk.CheckButton).clicked += onCheckButtonActivated;
+ break;
+ case ValueType.STRING:
+ widget = new Gtk.Entry();
+ (widget as Gtk.Entry).text = _default_client.get_string(entry.key);
+ /* TODO: connect changed signal to eventhandler */
+ break;
+ case ValueType.INT:
+ widget = new Gtk.SpinButton.with_range(-100, 100, 1);
+ (widget as Gtk.SpinButton).value = _default_client.get_int(entry.key);
+ (widget as Gtk.SpinButton).value_changed += onSpinButtonValueChanged;
+ break;
+ default:
+ return;
+ break;
+ }
+ widget.user_data = entry;
- row.pack_start(new Gtk.EventBox(), true, true, 2);
- row.pack_start(widget, false, false, 2);
+ row.pack_start(new Gtk.EventBox(), true, true, 2);
+ row.pack_start(widget, false, false, 2);
- Gtk.Button button = new Gtk.Button();
- button.tooltip_text = "Resets to default value";
- button.set_image(new Gtk.Image.from_stock("gtk-clear", Gtk.IconSize.BUTTON));
- button.user_data = widget;
- button.clicked += onResetButtonPressed;
+ Gtk.Button button = new Gtk.Button();
+ button.tooltip_text = "Resets to default value";
+ button.set_image(new Gtk.Image.from_stock("gtk-clear", Gtk.IconSize.BUTTON));
+ button.user_data = widget;
+ button.clicked += onResetButtonPressed;
- row.pack_start(button, false, false, 2);
+ row.pack_start(button, false, false, 2);
- vbox.pack_start(row, true, true, 2);
- }
-
- vbox.show_all();
+ row.show_all();
+ vbox.pack_start(row, true, true, 2);
}
-
private void onCheckButtonActivated(Gtk.CheckButton widget) {
weak GConf.Entry entry = (GConf.Entry)widget.user_data;
- Engine.get_default().set_bool(entry.key, widget.active);
+ _default_client.set_bool(entry.key, widget.active);
}
private void onSpinButtonValueChanged(Gtk.SpinButton widget) {
weak GConf.Entry entry = (GConf.Entry)widget.user_data;
- Engine.get_default().set_int(entry.key, (int)widget.value);
+ _default_client.set_int(entry.key, (int)widget.value);
}
private void onResetButtonPressed(Gtk.Button widget) {
Gtk.Widget target = (Gtk.Widget)widget.user_data;
weak GConf.Entry entry = (GConf.Entry)target.user_data;
string schema_name = entry.get_schema_name();
- weak GConfCompat.Schema schema = (GConfCompat.Schema)Engine.get_default().get_schema(schema_name);
+ weak GConfCompat.Schema schema = (GConfCompat.Schema)_default_client.get_schema(schema_name);
switch(schema.get_type()) {
case ValueType.BOOL:
(target as Gtk.CheckButton).active = schema.get_default_value().get_bool();
@@ -107,4 +135,3 @@ namespace GtkExtra {
}
}
}
-}
3  applet/libpanelapplet-2.0.deps
View
@@ -0,0 +1,3 @@
+gtk+-2.0
+libgnomeui-2.0
+libbonoboui-2.0
77 applet/libpanelapplet-2.0.vapi
View
@@ -0,0 +1,77 @@
+/* libpanelapplet-2.0.vala
+ *
+ * Copyright (C) 2007 Jürg Billeter
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library 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
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Author:
+ * Jürg Billeter <j@bitron.ch>
+ */
+
+[CCode (cheader_filename = "panel-applet.h")]
+namespace Panel {
+ public class Applet : Gtk.EventBox {
+ [CCode (has_construct_function = false)]
+ public Applet ();
+ public string get_preferences_key ();
+ public void add_preferences(string schema_dir) throws GLib.Error;
+ public static int factory_main (string iid, GLib.Type applet_type, AppletFactoryCallback callback);
+ public void set_background_widget (Gtk.Widget widget);
+ public AppletBackgroundType get_background (out Gdk.Color color, out Gdk.Pixmap pixmap);
+ [NoArrayLength]
+ public void setup_menu (string xml, BonoboUI.Verb[] verb_list, void* data);
+
+ public virtual signal void change_background (AppletBackgroundType type, Gdk.Color? color, Gdk.Pixmap? pixmap);
+ public virtual signal void change_orient (AppletOrient orient);
+ public virtual signal void change_size (uint size_hint);
+
+ public AppletOrient orient {get;}
+ public AppletFlags flags {get; set;}
+ public uint size {get;}
+ public bool locked_down {get;}
+ public void request_focus(uint32 timestamp);
+
+ public bool gconf_get_bool(string key) throws GLib.Error;
+ public void gconf_set_bool(string key, bool value) throws GLib.Error;
+ public weak string gconf_get_string(string key) throws GLib.Error;
+ public void gconf_set_string(string key, string value) throws GLib.Error;
+ public int gconf_get_int(string key) throws GLib.Error;
+ public void gconf_set_int(string key) throws GLib.Error;
+ }
+ [CCode (cprefix = "PANEL_APPLET_ORIENT_")]
+ public enum AppletOrient {
+ UP,
+ DOWN,
+ LEFT,
+ RIGHT
+ }
+ [CCode (cprefix = "PANEL_")]
+ public enum AppletBackgroundType {
+ NO_BACKGROUND,
+ COLOR_BACKGROUND,
+ PIXMAP_BACKGROUND
+ }
+
+ [CCode (cprefix = "PANEL_APPLET_")]
+ public enum AppletFlags {
+ FLAGS_NONE,
+ EXPAND_MAJOR,
+ EXPAND_MINOR,
+ HAS_HANDLE
+ }
+
+ public delegate bool AppletFactoryCallback (Applet applet, string iid);
+}
+
54 applet/main.vala
View
@@ -0,0 +1,54 @@
+using Gtk;
+using Config;
+const string APPLET_STANDARD_PROPERTIES = ""; /* then replaced by patch.sh to GNOME_STANDARD_PROPERTies*/
+const string FACTORY_IID = "OAFIID:GlobalMenu_PanelApplet_Factory";
+
+public bool verbose = false;
+const OptionEntry[] options = {
+ {"verbose", 'v',0, OptionArg.NONE, ref verbose, N_("Show debug messages from GMarkupDoc and Gnomenu"), null},
+ {null}
+};
+
+public int main(string[] args) {
+ GLib.OptionContext context = new GLib.OptionContext("- GlobalMenu.PanelApplet");
+ context.set_help_enabled (true);
+ context.add_main_entries(options, null);
+ Gnome.Program program = Gnome.Program.init (
+ "GlobalMenu.PanelApplet", Config.VERSION,
+ Gnome.libgnomeui_module,
+ args,
+ Gnome.PARAM_GOPTION_CONTEXT, context,
+ Gnome.CLIENT_PARAM_SM_CONNECT, false,
+ APPLET_STANDARD_PROPERTIES,
+ null);
+
+ if(!verbose) {
+ LogFunc handler = (domain, level, message) => { };
+ Log.set_handler ("Gnomenu", LogLevelFlags.LEVEL_DEBUG, handler);
+ }
+
+ Gtk.rc_parse_string("""
+ style "globalmenu_event_box_style"
+ {
+ GtkWidget::focus-line-width=0
+ GtkWidget::focus-padding=0
+ }
+ style "globalmenu_menu_bar_style"
+ {
+ ythickness = 0
+ GtkMenuBar::shadow-type = none
+ GtkMenuBar::internal-padding = 0
+ }
+ class "GtkEventBox" style "globalmenu_event_box_style"
+ class "GnomenuMenuBar" style:highest "globalmenu_menu_bar_style"
+""");
+
+ int retval = Panel.Applet.factory_main(FACTORY_IID, typeof(Applet),
+ (applet, iid) => {
+ if(iid == Applet.IID) {
+ applet.show();
+ return true;
+ } else return false;
+ }) ;
+ return retval;
+}
29 applet/panelextra-menubar.vala
View
@@ -1,29 +0,0 @@
-using GLib;
-using Gtk;
-using GMarkup;
-
-namespace PanelExtra {
- public class MenuBar : Gtk.MenuBar {
- private Gdk.EventExpose __tmp__event;
- private void expose_child(Gtk.Widget widget) {
- this.propagate_expose(widget, __tmp__event);
- }
-
- public MenuBar() { }
- construct {
- this.expose_event += (widget, event)=> {
- if(0 != (widget.get_flags() & (Gtk.WidgetFlags.MAPPED | Gtk.WidgetFlags.VISIBLE))) {
- Gtk.paint_flat_box(widget.style,
- widget.window, (Gtk.StateType) widget.state,
- Gtk.ShadowType.NONE,
- event.area,
- widget, null, 0, 0, -1, -1);
-
- __tmp__event = event;
- (widget as GtkCompat.Container).forall_children (expose_child);
- }
- return true;
- };
- }
- }
-}
193 applet/panelextra-switcher.vala
View
@@ -1,193 +0,0 @@
-using GLib;
-using Gtk;
-using GMarkup;
-public extern string* __get_task_name_by_pid(int pid);
-namespace PanelExtra {
- public class Switcher : PanelExtra.MenuBar {
- private Gtk.ImageMenuItem mi_application;
- private Wnck.Screen screen;
- public int max_size = 45;
- public bool show_label = true;
- public bool show_icon = true;
- public bool show_window_list = true;
- public bool show_window_actions = true;
-
- private string label_text;
- private Gtk.Widget label_icon;
-
- private GLib.HashTable<string,string> switcher_dictionary;
-
- private string remove_path(string txt, string separator) {
- long co = txt.length-1;
- while ((co>=0) && (txt.substring(co, 1)!=separator)) {
- co--;
- }
- string ret = txt.substring(co+1,(txt.length-co-1));
- return ret;
- }
- private string get_application_name(Wnck.Window window) {
- string txt = __get_task_name_by_pid(window.get_application().get_pid());
- if ((txt==null) || (txt=="")) return window.get_application().get_name();
- string ret = txt.chomp();
- if (ret.substring(ret.length-4,4)==".exe") return remove_path(ret, "\\"); // is a wine program
-
- ret = remove_path(ret.split(" ")[0], "/");
-
- switch(ret) {
- case "mono":
- case "python":
- case "python2.5":
- case "vmplayer":
- return remove_path(txt.chomp().split(" ")[1], "/");
- break;
- case "wine":
- return window.get_application().get_name();
- break;
- }
- return ret;
- }
-
- private void app_selected(Gtk.ImageMenuItem? item) {
- if (((item.user_data as Wnck.Window).is_active()) && ((item.user_data as Wnck.Window).is_visible_on_workspace((item.user_data as Wnck.Window).get_workspace()))) {
- (item.user_data as Wnck.Window).minimize();
- return;
- }
-
- // Ensure viewport visibility
- int current_workspace_x = (item.user_data as Wnck.Window).get_workspace().get_viewport_x();
- int current_workspace_y = (item.user_data as Wnck.Window).get_workspace().get_viewport_y();
- int x,y,w,h;
- (item.user_data as WnckCompat.Window).get_geometry(out x, out y, out w, out h);
- (item.user_data as Wnck.Window).get_screen().move_viewport(current_workspace_x + x, current_workspace_y + y);
-
- (item.user_data as Wnck.Window).activate(Gtk.get_current_event_time());
- (item.user_data as Wnck.Window).get_workspace().activate(Gtk.get_current_event_time());
- (item.user_data as Wnck.Window).unminimize(Gtk.get_current_event_time());
-
- // ensure is on top
- (item.user_data as Wnck.Window).make_above();
- (item.user_data as Wnck.Window).unmake_above();
-
- //TOFIX: if the window is on another workspace and it is minimized, it doesn't unminimize automatically.
- }
-
- public static void message(string msg) {
- Gtk.MessageDialog m = new Gtk.MessageDialog(null,
- Gtk.DialogFlags.MODAL,
- Gtk.MessageType.INFO,
- Gtk.ButtonsType.OK,
- msg);
- m.run();
- m.destroy();
- }
-
- private void refresh_name(Wnck.Window window) {
- string aname = "Desktop";
- if (window.get_window_type() != Wnck.WindowType.DESKTOP) {
- aname = get_application_name(window);
- if (switcher_dictionary.lookup(aname)!=null)
- aname = switcher_dictionary.lookup(aname); else
- aname = window.get_name();
- this.set_icon(new Gtk.Image.from_pixbuf(window.get_mini_icon()));
- } else {
- this.set_icon(new Gtk.Image.from_icon_name("desktop", Gtk.IconSize.MENU));
- }
- this.set_label(aname);
- }
-
- private void refresh_applications_list(Gtk.MenuItem? mi_parent) {
- Wnck.Window window = Wnck.Screen.get_default().get_active_window();
- Gtk.Menu menu;
-
- if ((window.get_window_type()!=Wnck.WindowType.DESKTOP) && (show_window_actions))
- menu = new Wnck.ActionMenu(window); else
- menu = new Gtk.Menu();
-
- if (show_window_list) {
- menu.insert(new Gtk.SeparatorMenuItem(), 0);
- weak GLib.List<Wnck.Window> windows = screen.get_windows();
- foreach(weak Wnck.Window window in windows) {
- if (!window.is_skip_pager()) {
- Gtk.ImageMenuItem mi;
- string txt = window.get_name();
- if ((txt.length>max_size) && (max_size>3)) txt = txt.substring(0, (max_size-3)) + "...";
- mi = new Gtk.ImageMenuItem.with_label(txt);
- if (window.is_active()) set_menu_item_label_bold(mi, "");
- mi.set_image(new Gtk.Image.from_pixbuf(window.get_mini_icon()));
- mi.user_data = window;
- mi.activate += app_selected;
- menu.insert(mi, 0);
- }
- }
- }
-
- menu.show_all();
- mi_parent.submenu = menu;
- }
- private void set_menu_item_label_bold(Gtk.MenuItem? mi, string text) {
- if (text == "")
- (mi.child as Gtk.Label).set_markup_with_mnemonic("<b>" + (mi.child as