Browse Source

It'd be nice if type errors caused the compiler to issue a type error

master
John ShaggyTwoDope Jenkins 4 years ago
parent
commit
9bf0a1b827
100 changed files with 6614 additions and 0 deletions
  1. 31
    0
      mate-menu-git/PKGBUILD
  2. BIN
      mate-menu-git/mate-menu-git-r453.3de5f14-1-any.pkg.tar.xz
  3. BIN
      mate-menu-git/mate-menu-git-r453.3de5f14-1.src.tar.gz
  4. 12
    0
      mate-menu-git/mate-menu/FETCH_HEAD
  5. 1
    0
      mate-menu-git/mate-menu/HEAD
  6. 8
    0
      mate-menu-git/mate-menu/config
  7. 1
    0
      mate-menu-git/mate-menu/description
  8. 15
    0
      mate-menu-git/mate-menu/hooks/applypatch-msg.sample
  9. 24
    0
      mate-menu-git/mate-menu/hooks/commit-msg.sample
  10. 8
    0
      mate-menu-git/mate-menu/hooks/post-update.sample
  11. 14
    0
      mate-menu-git/mate-menu/hooks/pre-applypatch.sample
  12. 49
    0
      mate-menu-git/mate-menu/hooks/pre-commit.sample
  13. 53
    0
      mate-menu-git/mate-menu/hooks/pre-push.sample
  14. 169
    0
      mate-menu-git/mate-menu/hooks/pre-rebase.sample
  15. 36
    0
      mate-menu-git/mate-menu/hooks/prepare-commit-msg.sample
  16. 128
    0
      mate-menu-git/mate-menu/hooks/update.sample
  17. 6
    0
      mate-menu-git/mate-menu/info/exclude
  18. BIN
      mate-menu-git/mate-menu/objects/pack/pack-8235bdd5c561445d451bcced46877f0bd638d4c2.idx
  19. BIN
      mate-menu-git/mate-menu/objects/pack/pack-8235bdd5c561445d451bcced46877f0bd638d4c2.pack
  20. 23
    0
      mate-menu-git/mate-menu/packed-refs
  21. BIN
      mate-menu-git/pkg/mate-menu-git/.MTREE
  22. 27
    0
      mate-menu-git/pkg/mate-menu-git/.PKGINFO
  23. 39
    0
      mate-menu-git/pkg/mate-menu-git/usr/bin/mate-menu
  24. 545
    0
      mate-menu-git/pkg/mate-menu-git/usr/lib/mate-menu/mate-menu-config.py
  25. 820
    0
      mate-menu-git/pkg/mate-menu-git/usr/lib/mate-menu/mate-menu.py
  26. 10
    0
      mate-menu-git/pkg/mate-menu-git/usr/lib/python2.7/site-packages/mate_menu-5.6.5a0-py2.7.egg-info/PKG-INFO
  27. 21
    0
      mate-menu-git/pkg/mate-menu-git/usr/lib/python2.7/site-packages/mate_menu-5.6.5a0-py2.7.egg-info/SOURCES.txt
  28. 1
    0
      mate-menu-git/pkg/mate-menu-git/usr/lib/python2.7/site-packages/mate_menu-5.6.5a0-py2.7.egg-info/dependency_links.txt
  29. 1
    0
      mate-menu-git/pkg/mate-menu-git/usr/lib/python2.7/site-packages/mate_menu-5.6.5a0-py2.7.egg-info/requires.txt
  30. 1
    0
      mate-menu-git/pkg/mate-menu-git/usr/lib/python2.7/site-packages/mate_menu-5.6.5a0-py2.7.egg-info/top_level.txt
  31. 0
    0
      mate-menu-git/pkg/mate-menu-git/usr/lib/python2.7/site-packages/mate_menu/__init__.py
  32. BIN
      mate-menu-git/pkg/mate-menu-git/usr/lib/python2.7/site-packages/mate_menu/__init__.pyc
  33. BIN
      mate-menu-git/pkg/mate-menu-git/usr/lib/python2.7/site-packages/mate_menu/__init__.pyo
  34. 52
    0
      mate-menu-git/pkg/mate-menu-git/usr/lib/python2.7/site-packages/mate_menu/capi.py
  35. BIN
      mate-menu-git/pkg/mate-menu-git/usr/lib/python2.7/site-packages/mate_menu/capi.pyc
  36. BIN
      mate-menu-git/pkg/mate-menu-git/usr/lib/python2.7/site-packages/mate_menu/capi.pyo
  37. 586
    0
      mate-menu-git/pkg/mate-menu-git/usr/lib/python2.7/site-packages/mate_menu/easybuttons.py
  38. BIN
      mate-menu-git/pkg/mate-menu-git/usr/lib/python2.7/site-packages/mate_menu/easybuttons.pyc
  39. BIN
      mate-menu-git/pkg/mate-menu-git/usr/lib/python2.7/site-packages/mate_menu/easybuttons.pyo
  40. 142
    0
      mate-menu-git/pkg/mate-menu-git/usr/lib/python2.7/site-packages/mate_menu/easyfiles.py
  41. BIN
      mate-menu-git/pkg/mate-menu-git/usr/lib/python2.7/site-packages/mate_menu/easyfiles.pyc
  42. BIN
      mate-menu-git/pkg/mate-menu-git/usr/lib/python2.7/site-packages/mate_menu/easyfiles.pyo
  43. 111
    0
      mate-menu-git/pkg/mate-menu-git/usr/lib/python2.7/site-packages/mate_menu/easygsettings.py
  44. BIN
      mate-menu-git/pkg/mate-menu-git/usr/lib/python2.7/site-packages/mate_menu/easygsettings.pyc
  45. BIN
      mate-menu-git/pkg/mate-menu-git/usr/lib/python2.7/site-packages/mate_menu/easygsettings.pyo
  46. 65
    0
      mate-menu-git/pkg/mate-menu-git/usr/lib/python2.7/site-packages/mate_menu/execute.py
  47. BIN
      mate-menu-git/pkg/mate-menu-git/usr/lib/python2.7/site-packages/mate_menu/execute.pyc
  48. BIN
      mate-menu-git/pkg/mate-menu-git/usr/lib/python2.7/site-packages/mate_menu/execute.pyo
  49. 142
    0
      mate-menu-git/pkg/mate-menu-git/usr/lib/python2.7/site-packages/mate_menu/filemonitor.py
  50. BIN
      mate-menu-git/pkg/mate-menu-git/usr/lib/python2.7/site-packages/mate_menu/filemonitor.pyc
  51. BIN
      mate-menu-git/pkg/mate-menu-git/usr/lib/python2.7/site-packages/mate_menu/filemonitor.pyo
  52. 266
    0
      mate-menu-git/pkg/mate-menu-git/usr/lib/python2.7/site-packages/mate_menu/keybinding.py
  53. BIN
      mate-menu-git/pkg/mate-menu-git/usr/lib/python2.7/site-packages/mate_menu/keybinding.pyc
  54. BIN
      mate-menu-git/pkg/mate-menu-git/usr/lib/python2.7/site-packages/mate_menu/keybinding.pyo
  55. 0
    0
      mate-menu-git/pkg/mate-menu-git/usr/lib/python2.7/site-packages/mate_menu/plugins/__init__.py
  56. BIN
      mate-menu-git/pkg/mate-menu-git/usr/lib/python2.7/site-packages/mate_menu/plugins/__init__.pyc
  57. BIN
      mate-menu-git/pkg/mate-menu-git/usr/lib/python2.7/site-packages/mate_menu/plugins/__init__.pyo
  58. 1577
    0
      mate-menu-git/pkg/mate-menu-git/usr/lib/python2.7/site-packages/mate_menu/plugins/applications.py
  59. BIN
      mate-menu-git/pkg/mate-menu-git/usr/lib/python2.7/site-packages/mate_menu/plugins/applications.pyc
  60. BIN
      mate-menu-git/pkg/mate-menu-git/usr/lib/python2.7/site-packages/mate_menu/plugins/applications.pyo
  61. 302
    0
      mate-menu-git/pkg/mate-menu-git/usr/lib/python2.7/site-packages/mate_menu/plugins/places.py
  62. BIN
      mate-menu-git/pkg/mate-menu-git/usr/lib/python2.7/site-packages/mate_menu/plugins/places.pyc
  63. BIN
      mate-menu-git/pkg/mate-menu-git/usr/lib/python2.7/site-packages/mate_menu/plugins/places.pyo
  64. 241
    0
      mate-menu-git/pkg/mate-menu-git/usr/lib/python2.7/site-packages/mate_menu/plugins/recent.py
  65. BIN
      mate-menu-git/pkg/mate-menu-git/usr/lib/python2.7/site-packages/mate_menu/plugins/recent.pyc
  66. BIN
      mate-menu-git/pkg/mate-menu-git/usr/lib/python2.7/site-packages/mate_menu/plugins/recent.pyo
  67. 204
    0
      mate-menu-git/pkg/mate-menu-git/usr/lib/python2.7/site-packages/mate_menu/plugins/system_management.py
  68. BIN
      mate-menu-git/pkg/mate-menu-git/usr/lib/python2.7/site-packages/mate_menu/plugins/system_management.pyc
  69. BIN
      mate-menu-git/pkg/mate-menu-git/usr/lib/python2.7/site-packages/mate_menu/plugins/system_management.pyo
  70. 92
    0
      mate-menu-git/pkg/mate-menu-git/usr/lib/python2.7/site-packages/mate_menu/pointerMonitor.py
  71. BIN
      mate-menu-git/pkg/mate-menu-git/usr/lib/python2.7/site-packages/mate_menu/pointerMonitor.pyc
  72. BIN
      mate-menu-git/pkg/mate-menu-git/usr/lib/python2.7/site-packages/mate_menu/pointerMonitor.pyo
  73. 3
    0
      mate-menu-git/pkg/mate-menu-git/usr/share/dbus-1/services/org.mate.panel.applet.MateMenuAppletFactory.service
  74. 103
    0
      mate-menu-git/pkg/mate-menu-git/usr/share/glib-2.0/schemas/org.mate.mate-menu.gschema.xml
  75. 115
    0
      mate-menu-git/pkg/mate-menu-git/usr/share/glib-2.0/schemas/org.mate.mate-menu.plugins.applications.gschema.xml
  76. 97
    0
      mate-menu-git/pkg/mate-menu-git/usr/share/glib-2.0/schemas/org.mate.mate-menu.plugins.places.gschema.xml
  77. 49
    0
      mate-menu-git/pkg/mate-menu-git/usr/share/glib-2.0/schemas/org.mate.mate-menu.plugins.recent.gschema.xml
  78. 85
    0
      mate-menu-git/pkg/mate-menu-git/usr/share/glib-2.0/schemas/org.mate.mate-menu.plugins.system_management.gschema.xml
  79. 339
    0
      mate-menu-git/pkg/mate-menu-git/usr/share/licenses/mate-menu-git/COPYING
  80. BIN
      mate-menu-git/pkg/mate-menu-git/usr/share/locale/af/LC_MESSAGES/mate-menu.mo
  81. BIN
      mate-menu-git/pkg/mate-menu-git/usr/share/locale/am/LC_MESSAGES/mate-menu.mo
  82. BIN
      mate-menu-git/pkg/mate-menu-git/usr/share/locale/an/LC_MESSAGES/mate-menu.mo
  83. BIN
      mate-menu-git/pkg/mate-menu-git/usr/share/locale/ar/LC_MESSAGES/mate-menu.mo
  84. BIN
      mate-menu-git/pkg/mate-menu-git/usr/share/locale/as/LC_MESSAGES/mate-menu.mo
  85. BIN
      mate-menu-git/pkg/mate-menu-git/usr/share/locale/ast/LC_MESSAGES/mate-menu.mo
  86. BIN
      mate-menu-git/pkg/mate-menu-git/usr/share/locale/az/LC_MESSAGES/mate-menu.mo
  87. BIN
      mate-menu-git/pkg/mate-menu-git/usr/share/locale/be/LC_MESSAGES/mate-menu.mo
  88. BIN
      mate-menu-git/pkg/mate-menu-git/usr/share/locale/ber/LC_MESSAGES/mate-menu.mo
  89. BIN
      mate-menu-git/pkg/mate-menu-git/usr/share/locale/bg/LC_MESSAGES/mate-menu.mo
  90. BIN
      mate-menu-git/pkg/mate-menu-git/usr/share/locale/bn/LC_MESSAGES/mate-menu.mo
  91. BIN
      mate-menu-git/pkg/mate-menu-git/usr/share/locale/bn_IN/LC_MESSAGES/mate-menu.mo
  92. BIN
      mate-menu-git/pkg/mate-menu-git/usr/share/locale/br/LC_MESSAGES/mate-menu.mo
  93. BIN
      mate-menu-git/pkg/mate-menu-git/usr/share/locale/bs/LC_MESSAGES/mate-menu.mo
  94. BIN
      mate-menu-git/pkg/mate-menu-git/usr/share/locale/ca/LC_MESSAGES/mate-menu.mo
  95. BIN
      mate-menu-git/pkg/mate-menu-git/usr/share/locale/ca@valencia/LC_MESSAGES/mate-menu.mo
  96. BIN
      mate-menu-git/pkg/mate-menu-git/usr/share/locale/ckb/LC_MESSAGES/mate-menu.mo
  97. BIN
      mate-menu-git/pkg/mate-menu-git/usr/share/locale/cmn/LC_MESSAGES/mate-menu.mo
  98. BIN
      mate-menu-git/pkg/mate-menu-git/usr/share/locale/crh/LC_MESSAGES/mate-menu.mo
  99. BIN
      mate-menu-git/pkg/mate-menu-git/usr/share/locale/cs/LC_MESSAGES/mate-menu.mo
  100. 0
    0
      mate-menu-git/pkg/mate-menu-git/usr/share/locale/csb/LC_MESSAGES/mate-menu.mo

+ 31
- 0
mate-menu-git/PKGBUILD View File

@@ -0,0 +1,31 @@
# Maintainer: John Jenkins twodopeshaggy@gmail.com

pkgname=mate-menu-git
pkgver=r453.3de5f14
pkgrel=1
pkgdesc="Mate Menu fork of MintMenu"
arch=('any')
url="https://bitbucket.org/ubuntu-mate/mate-menu/"
license=('GPL2')
makedepends=('git')
depends=('python2' 'python2-xlib' 'mate-applets' 'python2-distutils-extra' 'python2-setuptools')
source=('git+https://bitbucket.org/ubuntu-mate/mate-menu.git')
sha256sums=('SKIP')

pkgver() {
cd "$srcdir/mate-menu"
printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

prepare() {
cd "$srcdir/mate-menu"
sed 's/python/python2/g' -i lib/mate-menu.py
sed 's/python/python2/g' -i lib/mate-menu-config.py
}

package() {
cd "$srcdir/mate-menu"
python2 setup.py install --root="$pkgdir/" --optimize=1
mkdir -p $pkgdir/usr/share/licenses/$pkgname
install -m 0644 COPYING $pkgdir/usr/share/licenses/$pkgname/COPYING
}

BIN
mate-menu-git/mate-menu-git-r453.3de5f14-1-any.pkg.tar.xz View File


BIN
mate-menu-git/mate-menu-git-r453.3de5f14-1.src.tar.gz View File


+ 12
- 0
mate-menu-git/mate-menu/FETCH_HEAD View File

@@ -0,0 +1,12 @@
3de5f1498b79814a6d973b98afc9a9b3e095c5cf not-for-merge branch 'master' of https://bitbucket.org/ubuntu-mate/mate-menu
f106406eb382f16d10be49771b14eb643230faa2 not-for-merge tag '4.8.0' of https://bitbucket.org/ubuntu-mate/mate-menu
b8c5584b4d9af61a7dfdd074a15917bc53c6c82b not-for-merge tag '4.8.1' of https://bitbucket.org/ubuntu-mate/mate-menu
0c251c20eeb82a58f8d1c2aa0ba9ccb8da00b34c not-for-merge tag '4.8.2' of https://bitbucket.org/ubuntu-mate/mate-menu
8c2ef69ca93710ca09eeba14895c2452ab9e718b not-for-merge tag '5.5.2' of https://bitbucket.org/ubuntu-mate/mate-menu
cbb1262c15aea3531fbb8796f0ca8b9e8e22caf8 not-for-merge tag '5.6.0' of https://bitbucket.org/ubuntu-mate/mate-menu
5029abacef4035615a3b080c8f1f8f0cd0356586 not-for-merge tag '5.6.1' of https://bitbucket.org/ubuntu-mate/mate-menu
1801f5708b14b5acdb9bc27d066a6d05581895be not-for-merge tag '5.6.2' of https://bitbucket.org/ubuntu-mate/mate-menu
a7a7853020f43316613706e38770f3b8595615e4 not-for-merge tag '5.6.3' of https://bitbucket.org/ubuntu-mate/mate-menu
f98350a81530d67054b998076c7fa4a7cbfaa67d not-for-merge tag '5.6.4' of https://bitbucket.org/ubuntu-mate/mate-menu
fd2c08964784dc4e0332bf313e13a71d335c87c9 not-for-merge tag '5.6.5' of https://bitbucket.org/ubuntu-mate/mate-menu
f03edc5332953775ca3b42b2951a285515e90231 not-for-merge tag '5.6.5a' of https://bitbucket.org/ubuntu-mate/mate-menu

+ 1
- 0
mate-menu-git/mate-menu/HEAD View File

@@ -0,0 +1 @@
ref: refs/heads/master

+ 8
- 0
mate-menu-git/mate-menu/config View File

@@ -0,0 +1,8 @@
[core]
repositoryformatversion = 0
filemode = true
bare = true
[remote "origin"]
url = https://bitbucket.org/ubuntu-mate/mate-menu.git
fetch = +refs/*:refs/*
mirror = true

+ 1
- 0
mate-menu-git/mate-menu/description View File

@@ -0,0 +1 @@
Unnamed repository; edit this file 'description' to name the repository.

+ 15
- 0
mate-menu-git/mate-menu/hooks/applypatch-msg.sample View File

@@ -0,0 +1,15 @@
#!/bin/sh
#
# An example hook script to check the commit log message taken by
# applypatch from an e-mail message.
#
# The hook should exit with non-zero status after issuing an
# appropriate message if it wants to stop the commit. The hook is
# allowed to edit the commit message file.
#
# To enable this hook, rename this file to "applypatch-msg".

. git-sh-setup
test -x "$GIT_DIR/hooks/commit-msg" &&
exec "$GIT_DIR/hooks/commit-msg" ${1+"$@"}
:

+ 24
- 0
mate-menu-git/mate-menu/hooks/commit-msg.sample View File

@@ -0,0 +1,24 @@
#!/bin/sh
#
# An example hook script to check the commit log message.
# Called by "git commit" with one argument, the name of the file
# that has the commit message. The hook should exit with non-zero
# status after issuing an appropriate message if it wants to stop the
# commit. The hook is allowed to edit the commit message file.
#
# To enable this hook, rename this file to "commit-msg".

# Uncomment the below to add a Signed-off-by line to the message.
# Doing this in a hook is a bad idea in general, but the prepare-commit-msg
# hook is more suited to it.
#
# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"

# This example catches duplicate Signed-off-by lines.

test "" = "$(grep '^Signed-off-by: ' "$1" |
sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || {
echo >&2 Duplicate Signed-off-by lines.
exit 1
}

+ 8
- 0
mate-menu-git/mate-menu/hooks/post-update.sample View File

@@ -0,0 +1,8 @@
#!/bin/sh
#
# An example hook script to prepare a packed repository for use over
# dumb transports.
#
# To enable this hook, rename this file to "post-update".

exec git update-server-info

+ 14
- 0
mate-menu-git/mate-menu/hooks/pre-applypatch.sample View File

@@ -0,0 +1,14 @@
#!/bin/sh
#
# An example hook script to verify what is about to be committed
# by applypatch from an e-mail message.
#
# The hook should exit with non-zero status after issuing an
# appropriate message if it wants to stop the commit.
#
# To enable this hook, rename this file to "pre-applypatch".

. git-sh-setup
test -x "$GIT_DIR/hooks/pre-commit" &&
exec "$GIT_DIR/hooks/pre-commit" ${1+"$@"}
:

+ 49
- 0
mate-menu-git/mate-menu/hooks/pre-commit.sample View File

@@ -0,0 +1,49 @@
#!/bin/sh
#
# An example hook script to verify what is about to be committed.
# Called by "git commit" with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message if
# it wants to stop the commit.
#
# To enable this hook, rename this file to "pre-commit".

if git rev-parse --verify HEAD >/dev/null 2>&1
then
against=HEAD
else
# Initial commit: diff against an empty tree object
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
fi

# If you want to allow non-ASCII filenames set this variable to true.
allownonascii=$(git config --bool hooks.allownonascii)

# Redirect output to stderr.
exec 1>&2

# Cross platform projects tend to avoid non-ASCII filenames; prevent
# them from being added to the repository. We exploit the fact that the
# printable range starts at the space character and ends with tilde.
if [ "$allownonascii" != "true" ] &&
# Note that the use of brackets around a tr range is ok here, (it's
# even required, for portability to Solaris 10's /usr/bin/tr), since
# the square bracket bytes happen to fall in the designated range.
test $(git diff --cached --name-only --diff-filter=A -z $against |
LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0
then
cat <<\EOF
Error: Attempt to add a non-ASCII file name.

This can cause problems if you want to work with people on other platforms.

To be portable it is advisable to rename the file.

If you know what you are doing you can disable this check using:

git config hooks.allownonascii true
EOF
exit 1
fi

# If there are whitespace errors, print the offending file names and fail.
exec git diff-index --check --cached $against --

+ 53
- 0
mate-menu-git/mate-menu/hooks/pre-push.sample View File

@@ -0,0 +1,53 @@
#!/bin/sh

# An example hook script to verify what is about to be pushed. Called by "git
# push" after it has checked the remote status, but before anything has been
# pushed. If this script exits with a non-zero status nothing will be pushed.
#
# This hook is called with the following parameters:
#
# $1 -- Name of the remote to which the push is being done
# $2 -- URL to which the push is being done
#
# If pushing without using a named remote those arguments will be equal.
#
# Information about the commits which are being pushed is supplied as lines to
# the standard input in the form:
#
# <local ref> <local sha1> <remote ref> <remote sha1>
#
# This sample shows how to prevent push of commits where the log message starts
# with "WIP" (work in progress).

remote="$1"
url="$2"

z40=0000000000000000000000000000000000000000

while read local_ref local_sha remote_ref remote_sha
do
if [ "$local_sha" = $z40 ]
then
# Handle delete
:
else
if [ "$remote_sha" = $z40 ]
then
# New branch, examine all commits
range="$local_sha"
else
# Update to existing branch, examine new commits
range="$remote_sha..$local_sha"
fi

# Check for WIP commit
commit=`git rev-list -n 1 --grep '^WIP' "$range"`
if [ -n "$commit" ]
then
echo >&2 "Found WIP commit in $local_ref, not pushing"
exit 1
fi
fi
done

exit 0

+ 169
- 0
mate-menu-git/mate-menu/hooks/pre-rebase.sample View File

@@ -0,0 +1,169 @@
#!/bin/sh
#
# Copyright (c) 2006, 2008 Junio C Hamano
#
# The "pre-rebase" hook is run just before "git rebase" starts doing
# its job, and can prevent the command from running by exiting with
# non-zero status.
#
# The hook is called with the following parameters:
#
# $1 -- the upstream the series was forked from.
# $2 -- the branch being rebased (or empty when rebasing the current branch).
#
# This sample shows how to prevent topic branches that are already
# merged to 'next' branch from getting rebased, because allowing it
# would result in rebasing already published history.

publish=next
basebranch="$1"
if test "$#" = 2
then
topic="refs/heads/$2"
else
topic=`git symbolic-ref HEAD` ||
exit 0 ;# we do not interrupt rebasing detached HEAD
fi

case "$topic" in
refs/heads/??/*)
;;
*)
exit 0 ;# we do not interrupt others.
;;
esac

# Now we are dealing with a topic branch being rebased
# on top of master. Is it OK to rebase it?

# Does the topic really exist?
git show-ref -q "$topic" || {
echo >&2 "No such branch $topic"
exit 1
}

# Is topic fully merged to master?
not_in_master=`git rev-list --pretty=oneline ^master "$topic"`
if test -z "$not_in_master"
then
echo >&2 "$topic is fully merged to master; better remove it."
exit 1 ;# we could allow it, but there is no point.
fi

# Is topic ever merged to next? If so you should not be rebasing it.
only_next_1=`git rev-list ^master "^$topic" ${publish} | sort`
only_next_2=`git rev-list ^master ${publish} | sort`
if test "$only_next_1" = "$only_next_2"
then
not_in_topic=`git rev-list "^$topic" master`
if test -z "$not_in_topic"
then
echo >&2 "$topic is already up-to-date with master"
exit 1 ;# we could allow it, but there is no point.
else
exit 0
fi
else
not_in_next=`git rev-list --pretty=oneline ^${publish} "$topic"`
/usr/bin/perl -e '
my $topic = $ARGV[0];
my $msg = "* $topic has commits already merged to public branch:\n";
my (%not_in_next) = map {
/^([0-9a-f]+) /;
($1 => 1);
} split(/\n/, $ARGV[1]);
for my $elem (map {
/^([0-9a-f]+) (.*)$/;
[$1 => $2];
} split(/\n/, $ARGV[2])) {
if (!exists $not_in_next{$elem->[0]}) {
if ($msg) {
print STDERR $msg;
undef $msg;
}
print STDERR " $elem->[1]\n";
}
}
' "$topic" "$not_in_next" "$not_in_master"
exit 1
fi

exit 0

################################################################

This sample hook safeguards topic branches that have been
published from being rewound.

The workflow assumed here is:

* Once a topic branch forks from "master", "master" is never
merged into it again (either directly or indirectly).

* Once a topic branch is fully cooked and merged into "master",
it is deleted. If you need to build on top of it to correct
earlier mistakes, a new topic branch is created by forking at
the tip of the "master". This is not strictly necessary, but
it makes it easier to keep your history simple.

* Whenever you need to test or publish your changes to topic
branches, merge them into "next" branch.

The script, being an example, hardcodes the publish branch name
to be "next", but it is trivial to make it configurable via
$GIT_DIR/config mechanism.

With this workflow, you would want to know:

(1) ... if a topic branch has ever been merged to "next". Young
topic branches can have stupid mistakes you would rather
clean up before publishing, and things that have not been
merged into other branches can be easily rebased without
affecting other people. But once it is published, you would
not want to rewind it.

(2) ... if a topic branch has been fully merged to "master".
Then you can delete it. More importantly, you should not
build on top of it -- other people may already want to
change things related to the topic as patches against your
"master", so if you need further changes, it is better to
fork the topic (perhaps with the same name) afresh from the
tip of "master".

Let's look at this example:

o---o---o---o---o---o---o---o---o---o "next"
/ / / /
/ a---a---b A / /
/ / / /
/ / c---c---c---c B /
/ / / \ /
/ / / b---b C \ /
/ / / / \ /
---o---o---o---o---o---o---o---o---o---o---o "master"


A, B and C are topic branches.

* A has one fix since it was merged up to "next".

* B has finished. It has been fully merged up to "master" and "next",
and is ready to be deleted.

* C has not merged to "next" at all.

We would want to allow C to be rebased, refuse A, and encourage
B to be deleted.

To compute (1):

git rev-list ^master ^topic next
git rev-list ^master next

if these match, topic has not merged in next at all.

To compute (2):

git rev-list master..topic

if this is empty, it is fully merged to "master".

+ 36
- 0
mate-menu-git/mate-menu/hooks/prepare-commit-msg.sample View File

@@ -0,0 +1,36 @@
#!/bin/sh
#
# An example hook script to prepare the commit log message.
# Called by "git commit" with the name of the file that has the
# commit message, followed by the description of the commit
# message's source. The hook's purpose is to edit the commit
# message file. If the hook fails with a non-zero status,
# the commit is aborted.
#
# To enable this hook, rename this file to "prepare-commit-msg".

# This hook includes three examples. The first comments out the
# "Conflicts:" part of a merge commit.
#
# The second includes the output of "git diff --name-status -r"
# into the message, just before the "git status" output. It is
# commented because it doesn't cope with --amend or with squashed
# commits.
#
# The third example adds a Signed-off-by line to the message, that can
# still be edited. This is rarely a good idea.

case "$2,$3" in
merge,)
/usr/bin/perl -i.bak -ne 's/^/# /, s/^# #/#/ if /^Conflicts/ .. /#/; print' "$1" ;;

# ,|template,)
# /usr/bin/perl -i.bak -pe '
# print "\n" . `git diff --cached --name-status -r`
# if /^#/ && $first++ == 0' "$1" ;;

*) ;;
esac

# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"

+ 128
- 0
mate-menu-git/mate-menu/hooks/update.sample View File

@@ -0,0 +1,128 @@
#!/bin/sh
#
# An example hook script to blocks unannotated tags from entering.
# Called by "git receive-pack" with arguments: refname sha1-old sha1-new
#
# To enable this hook, rename this file to "update".
#
# Config
# ------
# hooks.allowunannotated
# This boolean sets whether unannotated tags will be allowed into the
# repository. By default they won't be.
# hooks.allowdeletetag
# This boolean sets whether deleting tags will be allowed in the
# repository. By default they won't be.
# hooks.allowmodifytag
# This boolean sets whether a tag may be modified after creation. By default
# it won't be.
# hooks.allowdeletebranch
# This boolean sets whether deleting branches will be allowed in the
# repository. By default they won't be.
# hooks.denycreatebranch
# This boolean sets whether remotely creating branches will be denied
# in the repository. By default this is allowed.
#

# --- Command line
refname="$1"
oldrev="$2"
newrev="$3"

# --- Safety check
if [ -z "$GIT_DIR" ]; then
echo "Don't run this script from the command line." >&2
echo " (if you want, you could supply GIT_DIR then run" >&2
echo " $0 <ref> <oldrev> <newrev>)" >&2
exit 1
fi

if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then
echo "usage: $0 <ref> <oldrev> <newrev>" >&2
exit 1
fi

# --- Config
allowunannotated=$(git config --bool hooks.allowunannotated)
allowdeletebranch=$(git config --bool hooks.allowdeletebranch)
denycreatebranch=$(git config --bool hooks.denycreatebranch)
allowdeletetag=$(git config --bool hooks.allowdeletetag)
allowmodifytag=$(git config --bool hooks.allowmodifytag)

# check for no description
projectdesc=$(sed -e '1q' "$GIT_DIR/description")
case "$projectdesc" in
"Unnamed repository"* | "")
echo "*** Project description file hasn't been set" >&2
exit 1
;;
esac

# --- Check types
# if $newrev is 0000...0000, it's a commit to delete a ref.
zero="0000000000000000000000000000000000000000"
if [ "$newrev" = "$zero" ]; then
newrev_type=delete
else
newrev_type=$(git cat-file -t $newrev)
fi

case "$refname","$newrev_type" in
refs/tags/*,commit)
# un-annotated tag
short_refname=${refname##refs/tags/}
if [ "$allowunannotated" != "true" ]; then
echo "*** The un-annotated tag, $short_refname, is not allowed in this repository" >&2
echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2
exit 1
fi
;;
refs/tags/*,delete)
# delete tag
if [ "$allowdeletetag" != "true" ]; then
echo "*** Deleting a tag is not allowed in this repository" >&2
exit 1
fi
;;
refs/tags/*,tag)
# annotated tag
if [ "$allowmodifytag" != "true" ] && git rev-parse $refname > /dev/null 2>&1
then
echo "*** Tag '$refname' already exists." >&2
echo "*** Modifying a tag is not allowed in this repository." >&2
exit 1
fi
;;
refs/heads/*,commit)
# branch
if [ "$oldrev" = "$zero" -a "$denycreatebranch" = "true" ]; then
echo "*** Creating a branch is not allowed in this repository" >&2
exit 1
fi
;;
refs/heads/*,delete)
# delete branch
if [ "$allowdeletebranch" != "true" ]; then
echo "*** Deleting a branch is not allowed in this repository" >&2
exit 1
fi
;;
refs/remotes/*,commit)
# tracking branch
;;
refs/remotes/*,delete)
# delete tracking branch
if [ "$allowdeletebranch" != "true" ]; then
echo "*** Deleting a tracking branch is not allowed in this repository" >&2
exit 1
fi
;;
*)
# Anything else (is there anything else?)
echo "*** Update hook: unknown type of update to ref $refname of type $newrev_type" >&2
exit 1
;;
esac

# --- Finished
exit 0

+ 6
- 0
mate-menu-git/mate-menu/info/exclude View File

@@ -0,0 +1,6 @@
# git ls-files --others --exclude-from=.git/info/exclude
# Lines that start with '#' are comments.
# For a project mostly in C, the following would be a good set of
# exclude patterns (uncomment them if you want to use them):
# *.[oa]
# *~

BIN
mate-menu-git/mate-menu/objects/pack/pack-8235bdd5c561445d451bcced46877f0bd638d4c2.idx View File


BIN
mate-menu-git/mate-menu/objects/pack/pack-8235bdd5c561445d451bcced46877f0bd638d4c2.pack View File


+ 23
- 0
mate-menu-git/mate-menu/packed-refs View File

@@ -0,0 +1,23 @@
# pack-refs with: peeled fully-peeled
3de5f1498b79814a6d973b98afc9a9b3e095c5cf refs/heads/master
f106406eb382f16d10be49771b14eb643230faa2 refs/tags/4.8.0
^2257fe4a0558e2a2d9764438ee0105dc9a326656
b8c5584b4d9af61a7dfdd074a15917bc53c6c82b refs/tags/4.8.1
^91bedba29d302f902484793825c093a7c9bef068
0c251c20eeb82a58f8d1c2aa0ba9ccb8da00b34c refs/tags/4.8.2
^b122139c5a5c1b1b03d3200f7d3991c8f84a1069
8c2ef69ca93710ca09eeba14895c2452ab9e718b refs/tags/5.5.2
cbb1262c15aea3531fbb8796f0ca8b9e8e22caf8 refs/tags/5.6.0
^2a20aa7c85eed0324eb86f8113a722a731199cd7
5029abacef4035615a3b080c8f1f8f0cd0356586 refs/tags/5.6.1
^b12c03e0c2fcc67a08c1e8003269c6767375cd7e
1801f5708b14b5acdb9bc27d066a6d05581895be refs/tags/5.6.2
^4efe8d0a3d40badd40b104c20cb09c3be516d076
a7a7853020f43316613706e38770f3b8595615e4 refs/tags/5.6.3
^d5a2e09a518914fb286075a053187ab147ca3839
f98350a81530d67054b998076c7fa4a7cbfaa67d refs/tags/5.6.4
^021e3401c43386d1981e19921fc248f2870d8e7f
fd2c08964784dc4e0332bf313e13a71d335c87c9 refs/tags/5.6.5
^76fc5b45626203cc772a9af939ac972ff0d1a1ef
f03edc5332953775ca3b42b2951a285515e90231 refs/tags/5.6.5a
^b130be3ff9ad2fa8bad0360078a683c37528c04d

BIN
mate-menu-git/pkg/mate-menu-git/.MTREE View File


+ 27
- 0
mate-menu-git/pkg/mate-menu-git/.PKGINFO View File

@@ -0,0 +1,27 @@
# Generated by makepkg 4.2.1
# using fakeroot version 1.20.2
# Mon Jun 1 19:07:34 UTC 2015
pkgname = mate-menu-git
pkgver = r453.3de5f14-1
pkgdesc = Mate Menu fork of MintMenu
url = https://bitbucket.org/ubuntu-mate/mate-menu/
builddate = 1433185654
packager = Unknown Packager
size = 2785280
arch = any
license = GPL2
depend = python2
depend = python2-xlib
depend = mate-applets
depend = python2-distutils-extra
depend = python2-setuptools
makedepend = git
makepkgopt = strip
makepkgopt = docs
makepkgopt = !libtool
makepkgopt = !staticlibs
makepkgopt = emptydirs
makepkgopt = zipman
makepkgopt = purge
makepkgopt = !upx
makepkgopt = !debug

+ 39
- 0
mate-menu-git/pkg/mate-menu-git/usr/bin/mate-menu View File

@@ -0,0 +1,39 @@
#!/bin/python2

# Copyright (C) 2007-2014 Clement Lefebvre <root@linuxmint.com>
# Copyright (C) 2015 Martin Wimpress <code@ubuntu-mate.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 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 St, Fifth Floor, Boston, MA 02110-1301, USA.

import os
import sys

if len(sys.argv) > 1:
if (sys.argv[1] in ["help", "h", "-?", "--help", "-h", "?"]):
print "MATE Menu - Advanced MATE Menu\n"
print "options:"
print " [--]help, [-]h Display this help."
print " [--]clean, [--]clear, [--]reset Restore settings to default.\n"
elif (sys.argv[1] in ["clean", "clear", "reset", "--clean", "--clear", "--reset"]):
os.system("gsettings reset-recursively org.mate.mate-menu")
os.system("gsettings reset-recursively org.mate.mate-menu.plugins.places")
os.system("gsettings reset-recursively org.mate.mate-menu.plugins.applications")
os.system("gsettings reset-recursively org.mate.mate-menu.plugins.recent")
os.system("gsettings reset-recursively org.mate.mate-menu.plugins.system_management")
os.system("rm -rf ~/.config/mate-menu")
print "All MATE Menu settings are now restored to default"
else:
os.system("/usr/lib/mate-menu/mate-menu.py")

+ 545
- 0
mate-menu-git/pkg/mate-menu-git/usr/lib/mate-menu/mate-menu-config.py View File

@@ -0,0 +1,545 @@
#!/usr/bin/env python2
# -*- coding: utf-8 -*-

# Copyright (C) 2007-2014 Clement Lefebvre <root@linuxmint.com>
# Copyright (C) 2015 Martin Wimpress <code@ubuntu-mate.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 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 St, Fifth Floor, Boston, MA 02110-1301, USA.

import gettext
import gi
import os
import subprocess

gi.require_version("Gtk", "2.0")

from gi.repository import Gtk, Gdk
import mate_menu.keybinding as keybinding

# i18n
gettext.install("mate-menu", "/usr/share/locale")

from mate_menu.easygsettings import EasyGSettings

class mateMenuConfig( object ):

def __init__( self ):

self.data_path = os.path.join('/', 'usr', 'share', 'mate-menu' )

# Load glade file and extract widgets
self.builder = Gtk.Builder()

self.builder.add_from_file (os.path.join(self.data_path, "mate-menu-config.glade" ))
self.mainWindow=self.builder.get_object("mainWindow")

#i18n
self.mainWindow.set_title(_("Menu preferences"))
self.mainWindow.set_icon_from_file("/usr/share/mate-menu/icons/mate-logo.svg")

self.builder.get_object("startWithFavorites").set_label(_("Always start with favorites pane"))
self.builder.get_object("showButtonIcon").set_label(_("Show button icon"))
self.builder.get_object("useCustomColors").set_label(_("Use custom colors"))
self.builder.get_object("showRecentPlugin").set_label(_("Show recent documents plugin"))
self.builder.get_object("showApplicationsPlugin").set_label(_("Show applications plugin"))
self.builder.get_object("showSystemPlugin").set_label(_("Show system plugin"))
self.builder.get_object("showPlacesPlugin").set_label(_("Show places plugin"))

self.builder.get_object("showAppComments").set_label(_("Show application comments"))
self.builder.get_object("showCategoryIcons").set_label(_("Show category icons"))
self.builder.get_object("hover").set_label(_("Hover"))
self.builder.get_object("remember_filter").set_label(_("Remember the last category or search"))
self.builder.get_object("swapGeneric").set_label(_("Swap name and generic name"))

self.builder.get_object("label11").set_text(_("Border width:"))
self.builder.get_object("label25").set_text(_("pixels"))

self.builder.get_object("label8").set_text(_("Opacity:"))
self.builder.get_object("label9").set_text("%")

self.builder.get_object("buttonTextLabel").set_text(_("Button text:"))
self.builder.get_object("label1").set_text(_("Options"))
self.builder.get_object("label23").set_text(_("Applications"))

self.builder.get_object("colorsLabel").set_text(_("Theme"))
self.builder.get_object("favLabel").set_text(_("Favorites"))
self.builder.get_object("mainbuttonLabel").set_text(_("Main button"))
self.builder.get_object("pluginsLabel").set_text(_("Plugins"))

self.builder.get_object("backgroundColorLabel").set_text(_("Background:"))
self.builder.get_object("headingColorLabel").set_text(_("Headings:"))
self.builder.get_object("borderColorLabel").set_text(_("Borders:"))
self.builder.get_object("themeLabel").set_text(_("Theme:"))

#self.builder.get_object("applicationsLabel").set_text(_("Applications"))
#self.builder.get_object("favoritesLabel").set_text(_("Favorites"))
self.builder.get_object("numberColumnsLabel").set_text(_("Number of columns:"))
self.builder.get_object("iconSizeLabel").set_text(_("Icon size:"))
self.builder.get_object("iconSizeLabel2").set_text(_("Icon size:"))
self.builder.get_object("placesIconSizeLabel").set_text(_("Icon size:"))
self.builder.get_object("systemIconSizeLabel").set_text(_("Icon size:"))
self.builder.get_object("hoverLabel").set_text(_("Hover delay (ms):"))
self.builder.get_object("label4").set_text(_("Button icon:"))
self.builder.get_object("label5").set_text(_("Search command:"))

self.builder.get_object("placesLabel").set_text(_("Places"))
self.builder.get_object("allowscrollbarcheckbutton").set_label(_("Allow Scrollbar"))
self.builder.get_object("showgtkbookmarkscheckbutton").set_label(_("Show GTK Bookmarks"))
self.builder.get_object("placesHeightEntryLabel").set_text(_("Height:"))
self.builder.get_object("defaultPlacesFrameLabel").set_text(_("Toggle Default Places:"))
self.builder.get_object("computercheckbutton").set_label(_("Computer"))
self.builder.get_object("homecheckbutton").set_label(_("Home Folder"))
self.builder.get_object("networkcheckbutton").set_label(_("Network"))
self.builder.get_object("desktopcheckbutton").set_label(_("Desktop"))
self.builder.get_object("trashcheckbutton").set_label(_("Trash"))
self.builder.get_object("customPlacesFrameLabel").set_text(_("Custom Places:"))

self.builder.get_object("systemLabel").set_text(_("System"))
self.builder.get_object("allowscrollbarcheckbutton1").set_label(_("Allow Scrollbar"))
self.builder.get_object("systemHeightEntryLabel").set_text(_("Height:"))
self.builder.get_object("defaultItemsFrameLabel").set_text(_("Toggle Default Items:"))
self.builder.get_object("packagemanagercheckbutton").set_label(_("Package Manager"))
self.builder.get_object("controlcentercheckbutton").set_label(_("Control Center"))
self.builder.get_object("terminalcheckbutton").set_label(_("Terminal"))
self.builder.get_object("lockcheckbutton").set_label(_("Lock Screen"))
self.builder.get_object("logoutcheckbutton").set_label(_("Log Out"))
self.builder.get_object("quitcheckbutton").set_label(_("Quit"))

self.editPlaceDialogTitle = (_("Edit Place"))
self.newPlaceDialogTitle = (_("New Place"))
self.folderChooserDialogTitle = (_("Select a folder"))

self.startWithFavorites = self.builder.get_object( "startWithFavorites" )
self.showAppComments = self.builder.get_object( "showAppComments" )
self.showCategoryIcons = self.builder.get_object( "showCategoryIcons" )
self.showRecentPlugin = self.builder.get_object( "showRecentPlugin" )
self.showApplicationsPlugin = self.builder.get_object( "showApplicationsPlugin" )
self.showSystemPlugin = self.builder.get_object( "showSystemPlugin" )
self.showPlacesPlugin = self.builder.get_object( "showPlacesPlugin" )
self.swapGeneric = self.builder.get_object("swapGeneric")
self.hover = self.builder.get_object( "hover" )
self.hoverDelay = self.builder.get_object( "hoverDelay" )
self.rememberFilter = self.builder.get_object( "remember_filter" )
self.iconSize = self.builder.get_object( "iconSize" )
self.favIconSize = self.builder.get_object( "favIconSize" )
self.placesIconSize = self.builder.get_object( "placesIconSize" )
self.systemIconSize = self.builder.get_object( "systemIconSize" )
self.favCols = self.builder.get_object( "numFavCols" )
self.borderWidth = self.builder.get_object( "borderWidth" )
self.opacity = self.builder.get_object( "opacity" )
self.useCustomColors = self.builder.get_object( "useCustomColors" )
self.backgroundColor = self.builder.get_object( "backgroundColor" )
self.borderColor = self.builder.get_object( "borderColor" )
self.headingColor = self.builder.get_object( "headingColor" )
self.backgroundColorLabel = self.builder.get_object( "backgroundColorLabel" )
self.borderColorLabel = self.builder.get_object( "borderColorLabel" )
self.headingColorLabel = self.builder.get_object( "headingColorLabel" )
self.showButtonIcon = self.builder.get_object( "showButtonIcon" )
self.buttonText = self.builder.get_object( "buttonText" )
self.hotkeyWidget = keybinding.KeybindingWidget(_("Keyboard shortcut:") )
table = self.builder.get_object( "main_table" )
table.attach(self.hotkeyWidget, 0, 2, 2, 3, Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL, 0, 0)
self.buttonIcon = self.builder.get_object( "buttonIcon" )
self.buttonIconChooser = self.builder.get_object( "button_icon_chooser" )
self.image_filter = Gtk.FileFilter()
self.image_filter.set_name(_("Images"))
self.image_filter.add_pattern("*.png")
self.image_filter.add_pattern("*.jpg")
self.image_filter.add_pattern("*.jpeg")
self.image_filter.add_pattern("*.bmp")
self.image_filter.add_pattern("*.ico")
self.image_filter.add_pattern("*.xpm")
self.image_filter.add_pattern("*.svg")
self.buttonIconChooser.add_filter(self.image_filter)
self.buttonIconChooser.set_filter(self.image_filter)
self.buttonIconImage = self.builder.get_object("image_button_icon")
self.searchCommand = self.builder.get_object( "search_command" )
self.computertoggle = self.builder.get_object( "computercheckbutton" )
self.homefoldertoggle = self.builder.get_object( "homecheckbutton" )
self.networktoggle = self.builder.get_object( "networkcheckbutton" )
self.desktoptoggle = self.builder.get_object( "desktopcheckbutton" )
self.trashtoggle = self.builder.get_object( "trashcheckbutton" )
self.customplacestree = self.builder.get_object( "customplacestree" )
self.allowPlacesScrollbarToggle = self.builder.get_object( "allowscrollbarcheckbutton" )
self.showgtkbookmarksToggle = self.builder.get_object( "showgtkbookmarkscheckbutton" )
self.placesHeightButton = self.builder.get_object( "placesHeightSpinButton" )
if (self.allowPlacesScrollbarToggle.get_active() == False):
self.placesHeightButton.set_sensitive(False)
self.allowPlacesScrollbarToggle.connect("toggled", self.togglePlacesHeightEnabled )
self.packageManagerToggle = self.builder.get_object( "packagemanagercheckbutton" )
self.controlCenterToggle = self.builder.get_object( "controlcentercheckbutton" )
self.terminalToggle = self.builder.get_object( "terminalcheckbutton" )
self.lockToggle = self.builder.get_object( "lockcheckbutton" )
self.logoutToggle = self.builder.get_object( "logoutcheckbutton" )
self.quitToggle = self.builder.get_object( "quitcheckbutton" )
self.allowSystemScrollbarToggle = self.builder.get_object( "allowscrollbarcheckbutton1" )
self.systemHeightButton = self.builder.get_object( "systemHeightSpinButton" )
if (self.allowSystemScrollbarToggle.get_active() == False): self.systemHeightButton.set_sensitive(False)
self.allowSystemScrollbarToggle.connect("toggled", self.toggleSystemHeightEnabled )
self.builder.get_object( "closeButton" ).connect("clicked", Gtk.main_quit )


self.settings = EasyGSettings( "org.mate.mate-menu" )
self.settingsApplications = EasyGSettings( "org.mate.mate-menu.plugins.applications" )
self.settingsPlaces = EasyGSettings( "org.mate.mate-menu.plugins.places" )
self.settingsSystem = EasyGSettings( "org.mate.mate-menu.plugins.system_management" )

self.useCustomColors.connect( "toggled", self.toggleUseCustomColors )

self.bindGSettingsValueToWidget( self.settings, "bool", "start-with-favorites", self.startWithFavorites, "toggled", self.startWithFavorites.set_active, self.startWithFavorites.get_active )
self.bindGSettingsValueToWidget( self.settingsApplications, "bool", "show-application-comments", self.showAppComments, "toggled", self.showAppComments.set_active, self.showAppComments.get_active )
self.bindGSettingsValueToWidget( self.settingsApplications, "bool", "show-category-icons", self.showCategoryIcons, "toggled", self.showCategoryIcons.set_active, self.showCategoryIcons.get_active )
self.bindGSettingsValueToWidget( self.settingsApplications, "bool", "categories-mouse-over", self.hover, "toggled", self.hover.set_active, self.hover.get_active )
self.bindGSettingsValueToWidget( self.settingsApplications, "bool", "swap-generic-name", self.swapGeneric, "toggled", self.swapGeneric.set_active, self.swapGeneric.get_active )

self.bindGSettingsValueToWidget( self.settingsApplications, "int", "category-hover-delay", self.hoverDelay, "value-changed", self.hoverDelay.set_value, self.hoverDelay.get_value )
self.bindGSettingsValueToWidget( self.settingsApplications, "int", "icon-size", self.iconSize, "value-changed", self.iconSize.set_value, self.iconSize.get_value )
self.bindGSettingsValueToWidget( self.settingsApplications, "int", "favicon-size", self.favIconSize, "value-changed", self.favIconSize.set_value, self.favIconSize.get_value )
self.bindGSettingsValueToWidget( self.settingsApplications, "int", "fav-cols", self.favCols, "value-changed", self.favCols.set_value, self.favCols.get_value )
self.bindGSettingsValueToWidget( self.settingsApplications, "bool", "remember-filter", self.rememberFilter, "toggled", self.rememberFilter.set_active, self.rememberFilter.get_active)

self.bindGSettingsValueToWidget( self.settingsPlaces, "int", "icon-size", self.placesIconSize, "value-changed", self.placesIconSize.set_value, self.placesIconSize.get_value )
self.bindGSettingsValueToWidget( self.settingsSystem, "int", "icon-size", self.systemIconSize, "value-changed", self.systemIconSize.set_value, self.systemIconSize.get_value )

self.bindGSettingsValueToWidget( self.settings, "int", "border-width", self.borderWidth, "value-changed", self.borderWidth.set_value, self.borderWidth.get_value_as_int )
self.bindGSettingsValueToWidget( self.settings, "int", "opacity", self.opacity, "value-changed", self.opacity.set_value, self.opacity.get_value_as_int )
self.bindGSettingsValueToWidget( self.settings, "bool", "use-custom-color", self.useCustomColors, "toggled", self.useCustomColors.set_active, self.useCustomColors.get_active )
self.bindGSettingsValueToWidget( self.settings, "color", "custom-color", self.backgroundColor, "color-set", self.backgroundColor.set_color, self.getBackgroundColor )
self.bindGSettingsValueToWidget( self.settings, "color", "custom-heading-color", self.headingColor, "color-set", self.headingColor.set_color, self.getHeadingColor )
self.bindGSettingsValueToWidget( self.settings, "color", "custom-border-color", self.borderColor, "color-set", self.borderColor.set_color, self.getBorderColor )
self.bindGSettingsValueToWidget( self.settings, "bool", "hide-applet-icon", self.showButtonIcon, "toggled", self.setShowButtonIcon, self.getShowButtonIcon )
self.bindGSettingsValueToWidget( self.settings, "string", "applet-text", self.buttonText, "changed", self.buttonText.set_text, self.buttonText.get_text )
self.bindGSettingsValueToWidget( self.settings, "string", "hot-key", self.hotkeyWidget, "accel-edited", self.hotkeyWidget.set_val, self.hotkeyWidget.get_val )
self.bindGSettingsValueToWidget( self.settings, "string", "applet-icon", self.buttonIconChooser, "file-set", self.setButtonIcon, self.buttonIconChooser.get_filename )
self.bindGSettingsValueToWidget( self.settingsApplications, "string", "search-command", self.searchCommand, "changed", self.searchCommand.set_text, self.searchCommand.get_text )

self.getPluginsToggle()
self.showRecentPlugin.connect("toggled", self.setPluginsLayout )
self.showApplicationsPlugin.connect("toggled", self.setPluginsLayout )
self.showSystemPlugin.connect("toggled", self.setPluginsLayout )
self.showPlacesPlugin.connect("toggled", self.setPluginsLayout )


self.bindGSettingsValueToWidget( self.settingsPlaces, "bool", "show-computer", self.computertoggle, "toggled", self.computertoggle.set_active, self.computertoggle.get_active )
self.bindGSettingsValueToWidget( self.settingsPlaces, "bool", "show-home-folder", self.homefoldertoggle, "toggled", self.homefoldertoggle.set_active, self.homefoldertoggle.get_active )
self.bindGSettingsValueToWidget( self.settingsPlaces, "bool", "show-network", self.networktoggle, "toggled", self.networktoggle.set_active, self.networktoggle.get_active )
self.bindGSettingsValueToWidget( self.settingsPlaces, "bool", "show-desktop", self.desktoptoggle, "toggled", self.desktoptoggle.set_active, self.desktoptoggle.get_active )
self.bindGSettingsValueToWidget( self.settingsPlaces, "bool", "show-trash", self.trashtoggle, "toggled", self.trashtoggle.set_active, self.trashtoggle.get_active )
self.bindGSettingsValueToWidget( self.settingsPlaces, "int", "height", self.placesHeightButton, "value-changed", self.placesHeightButton.set_value, self.placesHeightButton.get_value_as_int )
self.bindGSettingsValueToWidget( self.settingsPlaces, "bool", "allow-scrollbar", self.allowPlacesScrollbarToggle, "toggled", self.allowPlacesScrollbarToggle.set_active, self.allowPlacesScrollbarToggle.get_active )
self.bindGSettingsValueToWidget( self.settingsPlaces, "bool", "show-gtk-bookmarks", self.showgtkbookmarksToggle, "toggled", self.showgtkbookmarksToggle.set_active, self.showgtkbookmarksToggle.get_active )
self.bindGSettingsValueToWidget( self.settingsSystem, "bool", "show-package-manager", self.packageManagerToggle, "toggled", self.packageManagerToggle.set_active, self.packageManagerToggle.get_active )
self.bindGSettingsValueToWidget( self.settingsSystem, "bool", "show-control-center", self.controlCenterToggle, "toggled", self.controlCenterToggle.set_active, self.controlCenterToggle.get_active )
self.bindGSettingsValueToWidget( self.settingsSystem, "bool", "show-terminal", self.terminalToggle, "toggled", self.terminalToggle.set_active, self.terminalToggle.get_active )
self.bindGSettingsValueToWidget( self.settingsSystem, "bool", "show-lock-screen", self.lockToggle, "toggled", self.lockToggle.set_active, self.lockToggle.get_active )
self.bindGSettingsValueToWidget( self.settingsSystem, "bool", "show-logout", self.logoutToggle, "toggled", self.logoutToggle.set_active, self.logoutToggle.get_active )
self.bindGSettingsValueToWidget( self.settingsSystem, "bool", "show-quit", self.quitToggle, "toggled", self.quitToggle.set_active, self.quitToggle.get_active )
self.bindGSettingsValueToWidget( self.settingsSystem, "int", "height", self.systemHeightButton, "value-changed", self.systemHeightButton.set_value, self.systemHeightButton.get_value_as_int )
self.bindGSettingsValueToWidget( self.settingsSystem, "bool", "allow-scrollbar", self.allowSystemScrollbarToggle, "toggled", self.allowSystemScrollbarToggle.set_active, self.allowSystemScrollbarToggle.get_active )

self.customplacepaths = self.settingsPlaces.get( "list-string", "custom-paths" )
self.customplacenames = self.settingsPlaces.get( "list-string", "custom-names" )

self.customplacestreemodel = Gtk.ListStore( str, str)
self.cell = Gtk.CellRendererText()

for count in range( len(self.customplacepaths) ):
self.customplacestreemodel.append( [ self.customplacenames[count], self.customplacepaths[count] ] )

self.customplacestreemodel.connect("row-inserted", self.updatePlacesGSettings)
self.customplacestreemodel.connect("row-deleted", self.updatePlacesGSettings)
self.customplacestreemodel.connect("rows-reordered", self.updatePlacesGSettings)
self.customplacestreemodel.connect("row-changed", self.updatePlacesGSettings)
self.customplacestree.set_model( self.customplacestreemodel )
self.namescolumn = Gtk.TreeViewColumn( _("Name"), self.cell, text = 0 )
self.placescolumn = Gtk.TreeViewColumn( _("Path"), self.cell, text = 1 )
self.customplacestree.append_column( self.namescolumn )
self.customplacestree.append_column( self.placescolumn )
self.builder.get_object("newButton").connect("clicked", self.newPlace)
self.builder.get_object("editButton").connect("clicked", self.editPlace)
self.builder.get_object("upButton").connect("clicked", self.moveUp)
self.builder.get_object("downButton").connect("clicked", self.moveDown)
self.builder.get_object("removeButton").connect("clicked", self.removePlace)

#Detect themes and show theme here
theme_name = self.settings.get ("string", "theme-name")
process = subprocess.Popen(['find', '/usr/share/themes', '-name', 'gtkrc'], stdout=subprocess.PIPE)
out, err = process.communicate()
themes = out.split("\n")
model = Gtk.ListStore(str, str)
self.builder.get_object("themesCombo").set_model(model)
selected_theme = model.append([_("Desktop theme"), "default"])
for theme in themes:
if theme.startswith("/usr/share/themes") and theme.endswith("/gtk-2.0/gtkrc"):
theme = theme.replace("/usr/share/themes/", "")
theme = theme.replace("gtk-2.0", "")
theme = theme.replace("gtkrc", "")
theme = theme.replace("/", "")
theme = theme.strip()
iter = model.append([theme, theme])
if theme == theme_name:
selected_theme = iter
self.builder.get_object("themesCombo").set_active_iter(selected_theme)
self.builder.get_object("themesCombo").connect("changed", self.set_theme)

self.toggleUseCustomColors(self.useCustomColors)
self.mainWindow.present()
self.getBackgroundColor()

def set_theme(self, widget):
model = widget.get_model()
iter = widget.get_active_iter()
theme_name = model.get_value(iter, 1)
self.settings.set( "string", "theme-name", theme_name)

def getPluginsToggle(self):
array = self.settings.get ("list-string", "plugins-list")
if "recent" in array:
self.showRecentPlugin.set_active(True)
else:
self.showRecentPlugin.set_active(False)
if "applications" in array:
self.showApplicationsPlugin.set_active(True)
else:
self.showApplicationsPlugin.set_active(False)
if "system_management" in array:
self.showSystemPlugin.set_active(True)
else:
self.showSystemPlugin.set_active(False)
if "places" in array:
self.showPlacesPlugin.set_active(True)
else:
self.showPlacesPlugin.set_active(False)

def setPluginsLayout (self, widget):
visiblePlugins = []
if self.showPlacesPlugin.get_active():
visiblePlugins.append("places")
if self.showSystemPlugin.get_active():
visiblePlugins.append("system_management")
if self.showApplicationsPlugin.get_active():
if self.showPlacesPlugin.get_active() or self.showSystemPlugin.get_active():
visiblePlugins.append("newpane")
visiblePlugins.append("applications")
if self.showRecentPlugin.get_active():
if self.showApplicationsPlugin.get_active() or self.showPlacesPlugin.get_active() or self.showSystemPlugin.get_active():
visiblePlugins.append("newpane")
visiblePlugins.append("recent")
self.settings.set ("list-string", "plugins-list", visiblePlugins)

def setShowButtonIcon( self, value ):
self.showButtonIcon.set_active(not value )

def setButtonIcon( self, value ):
self.buttonIconChooser.set_filename(value)
self.buttonIconImage.set_from_file(value)

def getShowButtonIcon( self ):
return not self.showButtonIcon.get_active()

def bindGSettingsValueToWidget( self, settings, setting_type, key, widget, changeEvent, setter, getter ):
settings.notifyAdd( key, self.callSetter, args = [ setting_type, setter ] )
if setting_type == "color":
setter( Gdk.color_parse( settings.get( setting_type, key ) ) )
else:
setter( settings.get( setting_type, key ) )
widget.connect( changeEvent, lambda *args: self.callGetter( settings, setting_type, key, getter ) )

def callSetter( self, settings, key, args ):
if args[0] == "bool":
args[1]( settings.get_boolean(key) )
elif args[0] == "string":
args[1]( settings.get_string(key) )
elif args[0] == "int":
args[1]( settings.get_int(key) )
elif args[0] == "color":
args[1]( Gdk.color_parse( settings.get_string(key) ) )

def callGetter( self, settings, setting_type, key, getter ):
if (setting_type == "int"):
settings.set( setting_type, key, int(getter()))
else:
settings.set( setting_type, key, getter())

def toggleUseCustomColors( self, widget ):
self.backgroundColor.set_sensitive( widget.get_active() )
self.borderColor.set_sensitive( widget.get_active() )
self.headingColor.set_sensitive( widget.get_active() )
self.backgroundColorLabel.set_sensitive( widget.get_active() )
self.borderColorLabel.set_sensitive( widget.get_active() )
self.headingColorLabel.set_sensitive( widget.get_active() )

def getBackgroundColor( self ):
color = Gdk.Color(0,0,0)
self.backgroundColor.get_color(color)
return self.gdkColorToString( color )

def getBorderColor( self ):
color = Gdk.Color(0,0,0)
self.borderColor.get_color(color)
return self.gdkColorToString( color )

def getHeadingColor( self ):
color = Gdk.Color(0,0,0)
self.headingColor.get_color(color)
return self.gdkColorToString( color )

def gdkColorToString( self, gdkColor ):
return "#%.2X%.2X%.2X" % ( gdkColor.red / 256, gdkColor.green / 256, gdkColor.blue / 256 )

def moveUp( self, upButton ):

treeselection = self.customplacestree.get_selection()
currentiter = (treeselection.get_selected())[1]

if ( treeselection != None ):

lagiter = self.customplacestreemodel.get_iter_first()
nextiter = self.customplacestreemodel.get_iter_first()

while ( (self.customplacestreemodel.get_path(nextiter) != self.customplacestreemodel.get_path(currentiter)) & (nextiter != None)):
lagiter = nextiter
nextiter = self.customplacestreemodel.iter_next(nextiter)

if (nextiter != None):
self.customplacestreemodel.swap(currentiter, lagiter)

return

def newPlace(self, newButton):
self.builder.get_object("label2").set_text(_("Name:"))
self.builder.get_object("label1").set_text(_("Path:"))
newPlaceDialog = self.builder.get_object( "editPlaceDialog" )
folderChooserDialog = self.builder.get_object( "fileChooserDialog" )
newPlaceDialog.set_transient_for(self.mainWindow)
newPlaceDialog.set_icon_from_file("/usr/share/mate-menu/icons/mate-logo.svg")
newPlaceDialog.set_title(self.newPlaceDialogTitle)
folderChooserDialog.set_title(self.folderChooserDialogTitle)
newPlaceDialog.set_default_response(Gtk.ResponseType.OK)
newPlaceName = self.builder.get_object( "nameEntryBox" )
newPlacePath = self.builder.get_object( "pathEntryBox" )
folderButton = self.builder.get_object( "folderButton" )
def chooseFolder(folderButton):
currentPath = newPlacePath.get_text()
if (currentPath!=""):
folderChooserDialog.select_filename(currentPath)
response = folderChooserDialog.run()
folderChooserDialog.hide()
if (response == Gtk.ResponseType.OK):
newPlacePath.set_text( folderChooserDialog.get_filenames()[0] )
folderButton.connect("clicked", chooseFolder)

response = newPlaceDialog.run()
newPlaceDialog.hide()
if (response == Gtk.ResponseType.OK ):
name = newPlaceName.get_text()
path = newPlacePath.get_text()
if (name != "" and path !=""):
self.customplacestreemodel.append( (name, path) )

def editPlace(self, editButton):
self.builder.get_object("label2").set_text(_("Name:"))
self.builder.get_object("label1").set_text(_("Path:"))
editPlaceDialog = self.builder.get_object( "editPlaceDialog" )
folderChooserDialog = self.builder.get_object( "fileChooserDialog" )
editPlaceDialog.set_transient_for(self.mainWindow)
editPlaceDialog.set_icon_from_file("/usr/share/mate-menu/icons/mate-logo.svg")
editPlaceDialog.set_title(self.editPlaceDialogTitle)
folderChooserDialog.set_title(self.folderChooserDialogTitle)
editPlaceDialog.set_default_response(Gtk.ResponseType.OK)
editPlaceName = self.builder.get_object( "nameEntryBox" )
editPlacePath = self.builder.get_object( "pathEntryBox" )
folderButton = self.builder.get_object( "folderButton" )
treeselection = self.customplacestree.get_selection()
currentiter = (treeselection.get_selected())[1]

if (currentiter != None):

initName = self.customplacestreemodel.get_value(currentiter, 0)
initPath = self.customplacestreemodel.get_value(currentiter, 1)

editPlaceName.set_text(initName)
editPlacePath.set_text(initPath)
def chooseFolder(folderButton):
currentPath = editPlacePath.get_text()
if (currentPath!=""):
folderChooserDialog.select_filename(currentPath)
response = folderChooserDialog.run()
folderChooserDialog.hide()
if (response == Gtk.ResponseType.OK):
editPlacePath.set_text( folderChooserDialog.get_filenames()[0] )
folderButton.connect("clicked", chooseFolder)
response = editPlaceDialog.run()
editPlaceDialog.hide()
if (response == Gtk.ResponseType.OK):
name = editPlaceName.get_text()
path = editPlacePath.get_text()
if (name != "" and path != ""):
self.customplacestreemodel.set_value(currentiter, 0, name)
self.customplacestreemodel.set_value(currentiter, 1, path)

def moveDown(self, downButton):

treeselection = self.customplacestree.get_selection()
currentiter = (treeselection.get_selected())[1]

nextiter = self.customplacestreemodel.iter_next(currentiter)

if (nextiter != None):
self.customplacestreemodel.swap(currentiter, nextiter)

return


def removePlace(self, removeButton):

treeselection = self.customplacestree.get_selection()
currentiter = (treeselection.get_selected())[1]

if (currentiter != None):
self.customplacestreemodel.remove(currentiter)

return

def togglePlacesHeightEnabled(self, toggle):
if (toggle.get_active() == True):
self.placesHeightButton.set_sensitive(True)
else:
self.placesHeightButton.set_sensitive(False)

def toggleSystemHeightEnabled(self, toggle):
if (toggle.get_active() == True):
self.systemHeightButton.set_sensitive(True)
else:
self.systemHeightButton.set_sensitive(False)

def updatePlacesGSettings(self, treemodel, path, iter = None, new_order = None):

# Do only if not partway though an append operation; Append = insert+change+change and each creates a signal
if ((iter == None) or (self.customplacestreemodel.get_value(iter, 1) != None)):
treeiter = self.customplacestreemodel.get_iter_first()
customplacenames = [ ]
customplacepaths = [ ]
while( treeiter != None ):
customplacenames = customplacenames + [ self.customplacestreemodel.get_value(treeiter, 0 ) ]
customplacepaths = customplacepaths + [ self.customplacestreemodel.get_value(treeiter, 1 ) ]
treeiter = self.customplacestreemodel.iter_next(treeiter)
self.settingsPlaces.set( "list-string", "custom-paths", customplacepaths)
self.settingsPlaces.set( "list-string", "custom-names", customplacenames)


window = mateMenuConfig()
Gtk.main()

+ 820
- 0
mate-menu-git/pkg/mate-menu-git/usr/lib/mate-menu/mate-menu.py View File

@@ -0,0 +1,820 @@
#!/usr/bin/env python2
# -*- coding: utf-8 -*-

# Copyright (C) 2007-2014 Clement Lefebvre <root@linuxmint.com>
# Copyright (C) 2015 Martin Wimpress <code@ubuntu-mate.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 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 St, Fifth Floor, Boston, MA 02110-1301, USA.

__VERSION__='5.6.5a'

import ctypes
import gc
import gi
import gettext
import os
import platform
import subprocess
import sys
import traceback

gi.require_version("Gtk", "2.0")

from ctypes import *
from gi.repository import Gtk, GdkPixbuf, Gdk, GObject
from gi.repository import MatePanelApplet
from gi.repository import Gio

try:
import xdg.Config
import mate_menu.keybinding as keybinding
import mate_menu.pointerMonitor as pointerMonitor
except Exception, e:
print e
sys.exit( 1 )

GObject.threads_init()

gdk = CDLL("libgdk-x11-2.0.so.0")

# Rename the process
architecture = platform.uname()[4]
if architecture in 'x86_64':
libc = CDLL('libc.so.6')
libc.prctl(15, 'mate-menu', 0, 0, 0)
else:
import dl
if os.path.exists('/lib/libc.so.6'):
libc = dl.open('/lib/libc.so.6')
libc.call('prctl', 15, 'mate-menu', 0, 0, 0)
elif os.path.exists('/lib/i386-linux-gnu/libc.so.6'):
libc = dl.open('/lib/i386-linux-gnu/libc.so.6')
libc.call('prctl', 15, 'mate-menu', 0, 0, 0)

# i18n
gettext.install("mate-menu", "/usr/share/locale")

NAME = _("Menu")

xdg.Config.setWindowManager('MATE')

from mate_menu.execute import *

class MainWindow( object ):
"""This is the main class for the application"""

def __init__( self, toggleButton, settings, keybinder ):

self.settings = settings
self.keybinder = keybinder
self.data_path = os.path.join( '/', 'usr', 'share', 'mate-menu' )
self.icon = "/usr/share/mate-menu/icons/mate-logo.svg"

self.toggle = toggleButton
# Load UI file and extract widgets
builder = Gtk.Builder()
builder.add_from_file(os.path.join( self.data_path, "mate-menu.glade" ))
self.window = builder.get_object( "mainWindow" )
self.paneholder = builder.get_object( "paneholder" )
self.border = builder.get_object( "border" )

builder.connect_signals(self)

self.panesToColor = [ ]
self.headingsToColor = [ ]

self.window.connect( "key-press-event", self.onKeyPress )
self.window.connect( "focus-in-event", self.onFocusIn )
self.loseFocusId = self.window.connect( "focus-out-event", self.onFocusOut )
self.loseFocusBlocked = False

self.window.stick()

plugindir = os.path.join( os.path.expanduser( "~" ), ".config/mate-menu/plugins" )
sys.path.append( plugindir )

self.panelSettings = Gio.Settings.new("org.mate.panel")
self.panelSettings.connect( "changed::tooltips-enabled", self.toggleTooltipsEnabled )

self.settings.connect( "changed::plugins-list", self.RegenPlugins )
self.settings.connect( "changed::start-with-favorites", self.toggleStartWithFavorites )
self.settings.connect( "changed::tooltips-enabled", self.toggleTooltipsEnabled )
self.settings.connect( "changed::use-custom-color", self.toggleUseCustomColor )
self.settings.connect( "changed::custom-border-color", self.toggleCustomBorderColor )
self.settings.connect( "changed::custom-heading-color", self.toggleCustomHeadingColor )
self.settings.connect( "changed::custom-color", self.toggleCustomBackgroundColor )
self.settings.connect( "changed::border-width", self.toggleBorderWidth )
self.settings.connect( "changed::opacity", self.toggleOpacity )

self.getSetGSettingEntries()

self.tooltips = Gtk.Tooltips()
if self.globalEnableTooltips and self.enableTooltips:
self.tooltips.enable()
else:
self.tooltips.disable()

self.PopulatePlugins();
self.firstTime = True;

def on_window1_destroy (self, widget, data=None):
Gtk.main_quit()
sys.exit(0)

def wakePlugins( self ):
# Call each plugin and let them know we're showing up
for plugin in self.plugins.values():
if hasattr( plugin, "wake" ):
plugin.wake()

def toggleTooltipsEnabled( self, settings, key, args = None):
if key == "tooltips-enabled":
self.globalEnableTooltips = settings.get_boolean(key)
else:
self.enableTooltips = settings.get_boolean(key)

if self.globalEnableTooltips and self.enableTooltips:
self.tooltips.enable()
else:
self.tooltips.disable()

def toggleStartWithFavorites( self, settings, key, args = None ):
self.startWithFavorites = settings.get_boolean(key)

def toggleBorderWidth( self, settings, key, args = None ):
self.borderwidth = settings.get_int(key)
self.SetupMateMenuBorder()

def toggleOpacity( self, settings, key, args = None ):
self.opacity = settings.get_int(key)
self.SetupMateMenuOpacity()

def toggleUseCustomColor( self, settings, key, args = None ):
self.usecustomcolor = settings.get_boolean(key)
self.loadTheme()

def toggleCustomBorderColor( self, settings, key, args = None ):
self.custombordercolor = settings.get_string(key)
self.SetupMateMenuBorder()

def toggleCustomBackgroundColor( self, settings, key, args = None):
self.customcolor = settings.get_string(key)
self.SetPaneColors( self.panesToColor )

def toggleCustomHeadingColor( self, settings, key, args = None ):
self.customheadingcolor = settings.get_string(key)
self.SetHeadingStyle( self.headingsToColor )

def getSetGSettingEntries( self ):
self.pluginlist = self.settings.get_strv( "plugins-list" )
self.usecustomcolor = self.settings.get_boolean( "use-custom-color" )
self.customcolor = self.settings.get_string( "custom-color" )
self.customheadingcolor = self.settings.get_string( "custom-heading-color" )
self.custombordercolor = self.settings.get_string( "custom-border-color" )
self.borderwidth = self.settings.get_int( "border-width" )
self.opacity = self.settings.get_int( "opacity" )
self.offset = self.settings.get_int( "offset" )
self.enableTooltips = self.settings.get_boolean( "tooltips-enabled" )
self.startWithFavorites = self.settings.get_boolean( "start-with-favorites" )

self.globalEnableTooltips = self.panelSettings.get_boolean( "tooltips-enabled" )

def SetupMateMenuBorder( self, defaultStyle = None ):
if self.usecustomcolor:
self.window.modify_bg( Gtk.StateType.NORMAL, Gdk.color_parse( self.custombordercolor ) )
elif defaultStyle is not None:
self.window.modify_bg( Gtk.StateType.NORMAL, defaultStyle.lookup_color('bg_color')[1] )
self.border.set_padding( self.borderwidth, self.borderwidth, self.borderwidth, self.borderwidth )

def SetupMateMenuOpacity( self ):
print "Opacity is: " + str(self.opacity)
opacity = float(self.opacity) / float(100)
print "Setting opacity to: " + str(opacity)
if opacity is not 1:
self.window.set_opacity(opacity)

def PopulatePlugins( self ):
self.panesToColor = [ ]
self.headingsToColor = [ ]
PluginPane = Gtk.EventBox()
PluginPane.show()
PaneLadder = Gtk.VBox( False, 0 )
PluginPane.add( PaneLadder )
ImageBox = Gtk.EventBox()
ImageBox.show()
self.panesToColor.extend( [ PluginPane, ImageBox ] )

self.plugins = {}

for plugin in self.pluginlist:
if plugin in self.plugins:
print u"Duplicate plugin in list: ", plugin
continue

if plugin != "newpane":
try:
plugin_module = 'mate_menu.plugins.{plugin}'.format(plugin=plugin)
exec("from {plugin_module} import pluginclass".format(plugin_module=plugin_module))
# If no parameter passed to plugin it is autonomous
if pluginclass.__init__.func_code.co_argcount == 1:
MyPlugin = pluginclass()
else:
# pass mateMenu and togglebutton instance so that the plugin can use it
MyPlugin = pluginclass(self, self.toggle)

if not MyPlugin.icon:
MyPlugin.icon = "mate-logo-icon.png"

#if hasattr( MyPlugin, "hideseparator" ) and not MyPlugin.hideseparator:
# Image1 = Gtk.Image()
# Image1.set_from_pixbuf( seperatorImage )
# if not ImageBox.get_child():
# ImageBox.add( Image1 )
# Image1.show()

#print u"Loading plugin '" + plugin + "' : sucessful"
except Exception, e:
MyPlugin = Gtk.EventBox() #Fake class for MyPlugin
MyPlugin.heading = _("Couldn't load plugin:") + " " + plugin
MyPlugin.content_holder = Gtk.EventBox()

# create traceback
info = sys.exc_info()

errorLabel = Gtk.Label( "\n".join(traceback.format_exception( info[0], info[1], info[2] )).replace("\\n", "\n") )
errorLabel.set_selectable( True )
errorLabel.set_line_wrap( True )
errorLabel.set_alignment( 0.0, 0.0 )
errorLabel.set_padding( 5, 5 )
errorLabel.show()

MyPlugin.content_holder.add( errorLabel )
MyPlugin.add( MyPlugin.content_holder )
MyPlugin.width = 270
MyPlugin.icon = 'mate-logo-icon.png'
print u"Unable to load " + plugin + " plugin :-("


self.panesToColor.append( MyPlugin.content_holder )
MyPlugin.content_holder.show()

VBox1 = Gtk.VBox( False, 0 )
if MyPlugin.heading != "":
Label1 = Gtk.Label(label= MyPlugin.heading )
Align1 = Gtk.Alignment.new( 0, 0, 0, 0 )
Align1.set_padding( 10, 5, 10, 0 )
Align1.add( Label1 )
self.headingsToColor.append( Label1 )
Align1.show()
Label1.show()

if not hasattr( MyPlugin, 'sticky' ) or MyPlugin.sticky == True:
heading = Gtk.EventBox()
Align1.set_padding( 0, 0, 10, 0 )
heading.set_visible_window( False )
heading.set_size_request( MyPlugin.width, 30 )
else:
heading = Gtk.HBox()
#heading.set_relief( Gtk.ReliefStyle.NONE )
heading.set_size_request( MyPlugin.width, -1 )
#heading.set_sensitive(False)
#heading.connect( "button_press_event", self.TogglePluginView, VBox1, MyPlugin.icon, MyPlugin.heading, MyPlugin )

heading.add( Align1 )
heading.show()
VBox1.pack_start( heading, False, False, 0 )
VBox1.show()
#Add plugin to Plugin Box under heading button
MyPlugin.content_holder.reparent( VBox1 )

#Add plugin to main window
PaneLadder.pack_start( VBox1 , True, True, 0)
PaneLadder.show()

if MyPlugin.window:
MyPlugin.window.destroy()

try:
if hasattr( MyPlugin, 'do_plugin' ):
MyPlugin.do_plugin()
if hasattr( MyPlugin, 'height' ):
MyPlugin.content_holder.set_size_request( -1, MyPlugin.height )
if hasattr( MyPlugin, 'itemstocolor' ):
self.panesToColor.extend( MyPlugin.itemstocolor )
if hasattr( MyPlugin, 'headingstocolor' ):
self.headingsToColor.extend( MyPlugin.headingstocolor )
except:
# create traceback
info = sys.exc_info()

error = _("Couldn't initialize plugin") + " " + plugin + " : " + "\n".join(traceback.format_exception( info[0], info[1], info[2] )).replace("\\n", "\n")
msgDlg = Gtk.MessageDialog( None, Gtk.DialogFlags.MODAL, Gtk.MessageType.ERROR, Gtk.ButtonsType.OK, error )
msgDlg.run();
msgDlg.destroy();

self.plugins[plugin] = MyPlugin

else:
self.paneholder.pack_start( ImageBox, False, False, 0 )
self.paneholder.pack_start( PluginPane, False, False, 0 )
PluginPane = Gtk.EventBox()
PaneLadder = Gtk.VBox( False, 0 )
PluginPane.add( PaneLadder )
ImageBox = Gtk.EventBox()
self.panesToColor.extend( [ PluginPane, ImageBox ] )
ImageBox.show()
PluginPane.show_all()

if self.plugins and hasattr( MyPlugin, 'hideseparator' ) and not MyPlugin.hideseparator:
Image1 = Gtk.Image()
Image1.set_from_pixbuf( seperatorImage )
Image1.show()
#ImageBox.add( Image1 )

Align1 = Gtk.Alignment.new(0, 0, 0, 0)
Align1.set_padding( 0, 0, 6, 6 )
Align1.add(Image1)
ImageBox.add(Align1)
ImageBox.show_all()


self.paneholder.pack_start( ImageBox, False, False, 0 )
self.paneholder.pack_start( PluginPane, False, False, 0 )
self.tooltips.disable()

# A little hacky but works
def getDefaultStyle( self ):
widget = Gtk.EventBox()
widget.show()
return Gtk.rc_get_style(widget)

def loadTheme( self ):
defaultStyle = self.getDefaultStyle()
self.SetPaneColors( self.panesToColor, defaultStyle )
self.SetupMateMenuBorder( defaultStyle )
self.SetHeadingStyle( self.headingsToColor )

def SetPaneColors( self, items, defaultStyle = None ):
if self.usecustomcolor:
for item in items:
item.modify_bg( Gtk.StateType.NORMAL, Gdk.color_parse( self.customcolor ) )
# TODO: Changing background color isn't working for pixmaps! The following does not work:
item.get_style().bg_pixmap[Gtk.StateType.NORMAL] = None
elif defaultStyle is not None:
for item in items:
item.modify_bg( Gtk.StateType.NORMAL, defaultStyle.lookup_color('bg_color')[1] )
item.get_style().bg_pixmap[Gtk.StateType.NORMAL] = defaultStyle.bg_pixmap[Gtk.StateType.NORMAL]

def SetHeadingStyle( self, items ):
if self.usecustomcolor:
color = self.customheadingcolor
else:
color = None

for item in items:
item.set_use_markup(True)
text = item.get_text()
if color == None:
markup = '<span size="12000" weight="bold">%s</span>' % (text)
else:
markup = '<span size="12000" weight="bold" color="%s">%s</span>' % (color, text)
item.set_markup( markup )

def setTooltip( self, widget, tip, tipPrivate = None ):
self.tooltips.set_tip( widget, tip, tipPrivate )

def RegenPlugins( self, *args, **kargs ):
#print
#print u"Reloading Plugins..."
for item in self.paneholder:
item.destroy()

for plugin in self.plugins.values():
if hasattr( plugin, "destroy" ):
plugin.destroy()

try:
del plugin
except:
pass

try:
del self.plugins
except:
pass

gc.collect()

self.getSetGSettingEntries()
self.PopulatePlugins()
self.loadTheme()

#print NAME+u" reloaded"

def onKeyPress( self, widget, event ):
if event.keyval == Gdk.KEY_Escape:
self.hide()
return True
return False

def show( self ):
self.window.present()

# Hack for opacity not showing on first composited draw
if self.firstTime:
self.firstTime = False
self.SetupMateMenuOpacity()

self.window.window.focus( Gdk.CURRENT_TIME )

for plugin in self.plugins.values():
if hasattr( plugin, "onShowMenu" ):
plugin.onShowMenu()

if ( "applications" in self.plugins ) and ( hasattr( self.plugins["applications"], "focusSearchEntry" ) ):
if (self.startWithFavorites):
self.plugins["applications"].changeTab(0)
self.plugins["applications"].focusSearchEntry()

def hide( self ):
for plugin in self.plugins.values():
if hasattr( plugin, "onHideMenu" ):
plugin.onHideMenu()

self.window.hide()

def onFocusIn( self, *args ):
if self.loseFocusBlocked:
self.window.handler_unblock( self.loseFocusId )
self.loseFocusBlocked = False

return False

def onFocusOut( self, *args):
if self.window.get_visible():
self.hide()
return False

def stopHiding( self ):
if not self.loseFocusBlocked:
self.window.handler_block( self.loseFocusId )
self.loseFocusBlocked = True

class MenuWin( object ):
def __init__( self, applet, iid ):
self.data_path = os.path.join('/','usr','share','mate-menu')
self.applet = applet
self.settings = Gio.Settings.new("org.mate.mate-menu")
self.keybinder = keybinding.GlobalKeyBinding()
self.settings.connect( "changed::applet-text", self.reloadSettings )
self.settings.connect( "changed::theme-name", self.changeTheme )
self.settings.connect( "changed::hot-key", self.reloadSettings )
self.settings.connect( "changed::applet-icon", self.reloadSettings )
self.settings.connect( "changed::hide-applet-icon", self.reloadSettings )
self.settings.connect( "changed::applet-icon-size", self.reloadSettings )
self.settings.connect( "changed::hot-key", self.hotkeyChanged )
self.loadSettings()

self.mate_settings = Gio.Settings.new("org.mate.interface")
self.mate_settings.connect( "changed::gtk-theme", self.changeTheme )

self.createPanelButton()

self.applet.set_flags( MatePanelApplet.AppletFlags.EXPAND_MINOR )
self.applet.connect( "button-press-event", self.showMenu )
self.applet.connect( "change-orient", self.changeOrientation )
self.applet.connect("enter-notify-event", self.enter_notify)
self.applet.connect("leave-notify-event", self.leave_notify)
self.mainwin = MainWindow( self.button_box, self.settings, self.keybinder )
self.mainwin.window.connect( "map-event", self.onWindowMap )
self.mainwin.window.connect( "unmap-event", self.onWindowUnmap )
self.mainwin.window.connect( "realize", self.onRealize )
self.mainwin.window.connect( "size-allocate", lambda *args: self.positionMenu() )

self.mainwin.window.set_name("mate-menu") # Name used in Gtk RC files
self.applyTheme()
self.mainwin.loadTheme()

if self.mainwin.icon:
Gtk.Window.set_default_icon_name( self.mainwin.icon )

self.bind_hot_key()
self.applet.set_can_focus(False)

self.pointerMonitor = pointerMonitor.PointerMonitor()
self.pointerMonitor.connect("activate", self.onPointerOutside)

def onWindowMap( self, *args ):
self.applet.set_state( Gtk.StateType.SELECTED )
self.keybinder.set_focus_window( self.mainwin.window.window )
self.pointerMonitor.grabPointer()
return False

def onWindowUnmap( self, *args ):
self.applet.set_state( Gtk.StateType.NORMAL )
self.keybinder.set_focus_window()
self.pointerMonitor.ungrabPointer()
return False

def onRealize( self, *args):
self.pointerMonitor.addWindowToMonitor( self.mainwin.window.window )
self.pointerMonitor.addWindowToMonitor( self.applet.window )
self.pointerMonitor.start()
return False

def onPointerOutside(self, *args):
self.mainwin.hide()
return True

def onBindingPress(self, binder):
self.toggleMenu()
return True

def enter_notify(self, applet, event):
self.do_image(self.buttonIcon, True)

def leave_notify(self, applet, event):
# Hack for mate-panel-test-applets focus issue (this can be commented)
if event.state & Gdk.ModifierType.BUTTON1_MASK and applet.state & Gtk.StateType.SELECTED:
if event.x >= 0 and event.y >= 0 and event.x < applet.window.get_width() and event.y < applet.window.get_height():
self.mainwin.stopHiding()

self.do_image(self.buttonIcon, False)

def do_image(self, image_file, saturate):
pixbuf = GdkPixbuf.Pixbuf.new_from_file(image_file)
if saturate:
GdkPixbuf.Pixbuf.saturate_and_pixelate(pixbuf, pixbuf, 1.5, False)
self.button_icon.set_from_pixbuf(pixbuf)

def createPanelButton( self ):
self.button_icon = Gtk.Image.new_from_file( self.buttonIcon )
self.systemlabel = Gtk.Label(label= self.buttonText )
process = subprocess.Popen(['lsb_release', '-d'], stdout=subprocess.PIPE)
out, err = process.communicate()
tooltip = out.replace('Description:', '').strip()
self.systemlabel.set_tooltip_text(tooltip)
self.button_icon.set_tooltip_text(tooltip)
if self.applet.get_orient() == MatePanelApplet.AppletOrient.UP or self.applet.get_orient() == MatePanelApplet.AppletOrient.DOWN:
self.button_box = Gtk.HBox()
self.button_box.pack_start( self.button_icon, False, False, 0 )
self.button_box.pack_start( self.systemlabel, False, False, 0 )
self.button_icon.set_padding( 5, 0 )
# if we have a vertical panel
elif self.applet.get_orient() == MatePanelApplet.AppletOrient.LEFT:
self.button_box = Gtk.VBox()
self.systemlabel.set_angle( 270 )
self.button_box.pack_start( self.button_icon , False, False, 0)
self.button_box.pack_start( self.systemlabel , False, False, 0)
self.button_icon.set_padding( 0, 5 )
elif self.applet.get_orient() == MatePanelApplet.AppletOrient.RIGHT:
self.button_box = Gtk.VBox()
self.systemlabel.set_angle( 90 )
self.button_box.pack_start( self.systemlabel , False, False, 0)
self.button_box.pack_start( self.button_icon , False, False, 0)
self.button_icon.set_padding( 0, 5 )

self.button_box.set_homogeneous( False )
self.button_box.show_all()
self.sizeButton()

self.applet.add( self.button_box )
self.applet.set_background_widget( self.applet )


def loadSettings( self, *args, **kargs ):
self.hideIcon = self.settings.get_boolean( "hide-applet-icon" )
self.buttonText = self.settings.get_string( "applet-text" )
self.theme_name = self.settings.get_string( "theme-name" )
self.hotkeyText = self.settings.get_string( "hot-key" )
self.buttonIcon = self.settings.get_string( "applet-icon" )
self.iconSize = self.settings.get_int( "applet-icon-size" )

def changeTheme(self, *args):
self.reloadSettings()
self.applyTheme()
self.mainwin.loadTheme()

def applyTheme(self):
style_settings = Gtk.Settings.get_default()
desktop_theme = self.mate_settings.get_string('gtk-theme')
if self.theme_name == "default":
style_settings.set_property("gtk-theme-name", desktop_theme)
else:
try:
style_settings.set_property("gtk-theme-name", self.theme_name)
except:
style_settings.set_property("gtk-theme-name", desktop_theme)

def changeOrientation( self, *args, **kargs ):

if self.applet.get_orient() == MatePanelApplet.AppletOrient.UP or self.applet.get_orient() == MatePanelApplet.AppletOrient.DOWN:
tmpbox = Gtk.HBox()
self.systemlabel.set_angle( 0 )
self.button_box.reorder_child( self.button_icon, 0 )
self.button_icon.set_padding( 5, 0 )
elif self.applet.get_orient() == MatePanelApplet.AppletOrient.LEFT:
tmpbox = Gtk.VBox()
self.systemlabel.set_angle( 270 )
self.button_box.reorder_child( self.button_icon, 0 )
self.button_icon.set_padding( 0, 5 )
elif self.applet.get_orient() == MatePanelApplet.AppletOrient.RIGHT:
tmpbox = Gtk.VBox()
self.systemlabel.set_angle( 90 )
self.button_box.reorder_child( self.button_icon, 1 )
self.button_icon.set_padding( 0, 5 )

tmpbox.set_homogeneous( False )

# reparent all the hboxes to the new tmpbox
for i in self.button_box:
i.reparent( tmpbox )

self.button_box.destroy()

self.button_box = tmpbox
self.button_box.show()

# this call makes sure width stays intact
self.updateButton()
self.applet.add( self.button_box )


def updateButton( self ):
self.systemlabel.set_text( self.buttonText )
self.button_icon.clear()
self.button_icon.set_from_file( self.buttonIcon )
self.sizeButton()

def bind_hot_key (self):
try:
if self.hotkeyText != "":
self.keybinder.grab( self.hotkeyText )
self.keybinder.connect("activate", self.onBindingPress)
self.keybinder.start()
# Binding menu to hotkey
print "Binding to Hot Key: " + self.hotkeyText

except Exception, cause:
print "** WARNING ** - Menu Hotkey Binding Error"
print "Error Report :\n", str(cause)
pass

def hotkeyChanged (self, schema, key):
self.hotkeyText = self.settings.get_string( "hot-key" )
self.keybinder.rebind(self.hotkeyText)

def sizeButton( self ):
if self.hideIcon:
self.button_icon.hide()
else:
self.button_icon.show()
# This code calculates width and height for the button_box
# and takes the orientation in account
sl_req = Gtk.Requisition()
bi_req = Gtk.Requisition()
self.button_icon.size_request(bi_req)
self.systemlabel.size_request(sl_req)
if self.applet.get_orient() == MatePanelApplet.AppletOrient.UP or self.applet.get_orient() == MatePanelApplet.AppletOrient.DOWN:
if self.hideIcon:
self.applet.set_size_request( sl_req.width + 2, bi_req.height )
else:
self.applet.set_size_request( sl_req.width + bi_req.width + 5, bi_req.height )
else:
if self.hideIcon:
self.applet.set_size_request( bi_req.width, sl_req.height + 2 )
else:
self.applet.set_size_request( bi_req.width, sl_req.height + bi_req.height + 5 )

def reloadSettings( self, *args ):
self.loadSettings()
self.updateButton()

def showAboutDialog( self, action, userdata = None ):
about = Gtk.AboutDialog()
about.set_name("MATE Menu")
about.set_version(__VERSION__)
about.set_comments( _("Advanced MATE Menu") )
about.set_logo( GdkPixbuf.Pixbuf.new_from_file("/usr/share/mate-menu/icons/mate-logo.svg") )
about.connect( "response", lambda dialog, r: dialog.destroy() )
about.show()

def showPreferences( self, action, userdata = None ):
Execute( os.path.join( "/", "usr", "lib", "mate-menu", "mate-menu-config.py" ) )

def showMenuEditor( self, action, userdata = None ):
Execute( "mozo" )

def showMenu( self, widget=None, event=None ):
if event == None or event.button == 1:
self.toggleMenu()
# show right click menu
elif event.button == 3:
self.create_menu()
# allow middle click and drag
elif event.button == 2:
self.mainwin.hide()

def toggleMenu( self ):
if self.applet.state & Gtk.StateType.SELECTED:
self.mainwin.hide()
else:
self.positionMenu()
self.mainwin.show()
self.wakePlugins()

def wakePlugins( self ):
self.mainwin.wakePlugins()

def positionMenu( self ):
# Get our own dimensions & position
ourWidth = self.mainwin.window.get_size()[0]
ourHeight = self.mainwin.window.get_size()[1] + self.mainwin.offset

x = c_int()
y = c_int()
# Get the dimensions/position of the widgetToAlignWith
gdk.gdk_window_get_origin(hash(self.applet.window), byref(x), byref(y))
entryX = x.value
entryY = y.value

entryWidth, entryHeight = self.applet.get_allocation().width, self.applet.get_allocation().height
entryHeight = entryHeight + self.mainwin.offset

# Get the screen dimensions
screenHeight = Gdk.Screen.height()
screenWidth = Gdk.Screen.width()
if self.applet.get_orient() == MatePanelApplet.AppletOrient.UP or self.applet.get_orient() == MatePanelApplet.AppletOrient.DOWN:
if entryX + ourWidth < screenWidth or entryX + entryWidth / 2 < screenWidth / 2:
# Align to the left of the entry
newX = entryX
else:
# Align to the right of the entry
newX = entryX + entryWidth - ourWidth

if entryY + entryHeight / 2 < screenHeight / 2:
# Align to the bottom of the entry
newY = entryY + entryHeight
else:
newY = entryY - ourHeight
else:
if entryX + entryWidth / 2 < screenWidth / 2:
# Align to the left of the entry
newX = entryX + entryWidth
else:
# Align to the right of the entry
newX = entryX - ourWidth

if entryY + ourHeight < screenHeight or entryY + entryHeight / 2 < screenHeight / 2:
# Align to the bottom of the entry
newY = entryY
else:
newY = entryY - ourHeight + entryHeight
# -"Move window"
self.mainwin.window.move( newX, newY )

# this callback is to create a context menu
def create_menu(self):
action_group = Gtk.ActionGroup("context-menu")
action = Gtk.Action("MateMenuPrefs", _("Preferences"), None, "gtk-preference