Import Upstream version 1.24.0

This commit is contained in:
openKylinBot 2022-05-14 03:39:27 +08:00
commit 20f9b56f78
245 changed files with 204718 additions and 0 deletions

9
.github/FUNDING.yml vendored Normal file
View File

@ -0,0 +1,9 @@
# These are supported funding model platforms
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
custom: https://mate-desktop.org/donate/

19
.github/issue_template.md vendored Normal file
View File

@ -0,0 +1,19 @@
#### Expected behaviour
#### Actual behaviour
#### Steps to reproduce the behaviour
#### MATE general version
#### Package version
#### Linux Distribution
#### Link to downstream report of your Distribution

204
.travis.yml Normal file
View File

@ -0,0 +1,204 @@
# vim: set ts=2 sts=2 sw=2 expandtab :
dist: xenial
sudo: required
language: bash
services:
- docker
branches:
except:
- gh-pages
before_install:
- curl -Ls -o docker-build https://github.com/mate-desktop/mate-dev-scripts/raw/master/travis/docker-build
- curl -Ls -o gen-index https://github.com/mate-desktop/mate-dev-scripts/raw/master/travis/gen-index.sh
- chmod +x docker-build gen-index
install:
- sudo apt-get install -y python3-pip python3-setuptools
- sudo pip3 install --upgrade pip
- sudo pip install PyGithub
- ./docker-build --name ${DISTRO} --config .travis.yml --install
script:
- ./docker-build --name ${DISTRO} --verbose --config .travis.yml --build scripts --build meson
deploy:
- provider: pages
github-token: $GITHUB_TOKEN
#keep-history: true
skip_cleanup: true
committer-from-gh: true
target-branch: gh-pages
local-dir: html-report
on:
all_branches: true
condition: ${DISTRO} =~ ^fedora.*$
- provider: script
script: ./docker-build --verbose --config .travis.yml --release github
skip_cleanup: true
on:
tags: true
condition: "${TRAVIS_TAG} =~ ^v.*$ && ${DISTRO} =~ ^fedora.*$"
after_success:
- 'if [[ "$TRAVIS_SECURE_ENV_VARS" == "true" && "$TRAVIS_PULL_REQUEST" != "false" && ${DISTRO} =~ ^fedora.*$ ]]; then
REPO_SLUG_ARRAY=(${TRAVIS_REPO_SLUG//\// });
REPO_NAME=${REPO_SLUG_ARRAY[1]};
URL="https://${REPO_NAME}.mate-desktop.dev";
COMMENT="Code analysis completed";
curl -H "Authorization: token $GITHUB_TOKEN" -X POST
-d "{\"state\": \"success\", \"description\": \"$COMMENT\", \"context\":\"scan-build\", \"target_url\": \"$URL\"}"
https://api.github.com/repos/${TRAVIS_REPO_SLUG}/statuses/${TRAVIS_PULL_REQUEST_SHA};
fi'
env:
- DISTRO="archlinux/base"
- DISTRO="debian:testing"
- DISTRO="fedora:latest"
- DISTRO="ubuntu:19.10"
##########################################################
# THE FOLLOWING LINES IS USED BY docker-build
##########################################################
requires:
archlinux:
# Useful URL: https://git.archlinux.org/svntogit/community.git/tree/trunk?h=packages/mate-desktop
- clang
- gcc
- git
- gobject-introspection
- gtk3
- intltool
- iso-codes
- meson
- make
- mate-common
- startup-notification
- which
debian:
# Useful URL: https://github.com/mate-desktop/debian-packages
# Useful URL: https://salsa.debian.org/debian-mate-team/mate-desktop
- autopoint
- clang
- clang-tools
- cppcheck
- git
- gobject-introspection
- gtk-doc-tools
- intltool
- iso-codes
- libdconf-dev
- libgirepository1.0-dev
- libglib2.0-dev
- libglib2.0-doc
- libgtk-3-dev
- libgtk-3-doc
- libstartup-notification0-dev
- libx11-dev
- libxml2-dev
- libxrandr-dev
- mate-common
- meson
fedora:
# Useful URL: https://src.fedoraproject.org/cgit/rpms/mate-desktop.git
- cairo-gobject-devel
- clang-analyzer
- clang
- cppcheck-htmlreport
- dconf-devel
- desktop-file-utils
- gcc
- git
- gobject-introspection-devel
- gtk3-devel
- iso-codes-devel
- itstool
- make
- mate-common
- meson
- redhat-rpm-config
- startup-notification-devel
ubuntu:
- autopoint
- clang
- clang-tools
- git
- gobject-introspection
- gtk-doc-tools
- intltool
- iso-codes
- libdconf-dev
- libgirepository1.0-dev
- libglib2.0-dev
- libglib2.0-doc
- libgtk-3-dev
- libgtk-3-doc
- libstartup-notification0-dev
- libx11-dev
- libxml2-dev
- libxrandr-dev
- mate-common
- meson
variables:
- CFLAGS="-Wall -Werror=format-security -Wredundant-decls"
- 'CHECKERS="
-enable-checker deadcode.DeadStores
-enable-checker alpha.deadcode.UnreachableCode
-enable-checker alpha.core.CastSize
-enable-checker alpha.core.CastToStruct
-enable-checker alpha.core.IdenticalExpr
-enable-checker alpha.core.SizeofPtr
-enable-checker alpha.security.ArrayBoundV2
-enable-checker alpha.security.MallocOverflow
-enable-checker alpha.security.ReturnPtrRange
-enable-checker alpha.unix.SimpleStream
-enable-checker alpha.unix.cstring.BufferOverlap
-enable-checker alpha.unix.cstring.NotNullTerminated
-enable-checker alpha.unix.cstring.OutOfBounds
-enable-checker alpha.core.FixedAddr
-enable-checker security.insecureAPI.strcpy"'
build_scripts:
# build failed with f30 und using clang patch, fixed in f30?
# - if [ ${DISTRO_NAME} == "fedora" ];then
# - curl -Ls -o fedora.sh https://github.com/mate-desktop/mate-dev-scripts/raw/master/travis/fedora.sh
# - bash ./fedora.sh
# - fi
- ./autogen.sh
- scan-build $CHECKERS ./configure --prefix=/usr --enable-gtk-doc
- if [ $CPU_COUNT -gt 1 ]; then
- scan-build $CHECKERS --keep-cc -o html-report make -j $CPU_COUNT
- else
- scan-build $CHECKERS --keep-cc -o html-report make
- fi
- if [ ${DISTRO_NAME} == "debian" ];then
- cppcheck --enable=warning,style,performance,portability,information,missingInclude .
- fi
after_scripts:
- if [ ${BUILD_TYPE} == "scripts" ];then
- if [ ${DISTRO_NAME} == "fedora" ];then
- cppcheck --xml --output-file=cppcheck.xml --enable=warning,style,performance,portability,information,missingInclude .
- cppcheck-htmlreport --title=${REPO_NAME} --file=cppcheck.xml --report-dir=cppcheck-htmlreport
- ./gen-index -l 20 -i https://github.com/${OWNER_NAME}/${REPO_NAME}/raw/master/icons/16x16/apps/mate-desktop.png
- fi
- make distcheck
- fi
releases:
draft: false
prerelease: false
checksum: true
file_glob: true
files: mate-desktop-*.tar.xz
github_release:
tags: true
overwrite: true
base_version: 1.20.0
notify_servers:
- https://release.mate-desktop.org/release

9
.tx/config Normal file
View File

@ -0,0 +1,9 @@
[main]
host = https://www.transifex.com
[MATE.master--mate-desktop]
file_filter = po/<lang>.po
source_file = po/mate-desktop.pot
source_lang = en
type = PO
minimum_perc = 2

26
AUTHORS Normal file
View File

@ -0,0 +1,26 @@
mate-desktop authors
--------------------
Perberos <perberos@gmail.com>
Steve Zesch <stevezesch2@gmail.com>
Stefano Karapetsas <stefano@karapetsas.com>
libgnome-desktop authors
------------------------
Elliot Lee <sopwith@redhat.com>
George Lebl <jirka@5z.com>
John Ellis <johne@bellatlantic.net>
Havoc Pennington <hp@redhat.com>
Vincent Untz <vuntz@gnome.org>
Federico Mena Quintero <federico@novell.com>
new gnome-about authors
-----------------------
Guillaume Seguin <guillaume@segu.in>
Vincent Untz <vuntz@gnome.org>
original gnome-about authors
----------------------------
Anders Carlsson <andersca@gnu.org>

339
COPYING Normal file
View File

@ -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.

355
COPYING-DOCS Normal file
View File

@ -0,0 +1,355 @@
GNU Free Documentation License
Version 1.1, March 2000
Copyright (C) 2000 Free Software Foundation, Inc.
51 Franklin St, 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.
0. PREAMBLE
The purpose of this License is to make a manual, textbook, or other
written document "free" in the sense of freedom: to assure everyone
the effective freedom to copy and redistribute it, with or without
modifying it, either commercially or noncommercially. Secondarily,
this License preserves for the author and publisher a way to get
credit for their work, while not being considered responsible for
modifications made by others.
This License is a kind of "copyleft", which means that derivative
works of the document must themselves be free in the same sense. It
complements the GNU General Public License, which is a copyleft
license designed for free software.
We have designed this License in order to use it for manuals for free
software, because free software needs free documentation: a free
program should come with manuals providing the same freedoms that the
software does. But this License is not limited to software manuals;
it can be used for any textual work, regardless of subject matter or
whether it is published as a printed book. We recommend this License
principally for works whose purpose is instruction or reference.
1. APPLICABILITY AND DEFINITIONS
This License applies to any manual or other work that contains a
notice placed by the copyright holder saying it can be distributed
under the terms of this License. The "Document", below, refers to any
such manual or work. Any member of the public is a licensee, and is
addressed as "you".
A "Modified Version" of the Document means any work containing the
Document or a portion of it, either copied verbatim, or with
modifications and/or translated into another language.
A "Secondary Section" is a named appendix or a front-matter section of
the Document that deals exclusively with the relationship of the
publishers or authors of the Document to the Document's overall subject
(or to related matters) and contains nothing that could fall directly
within that overall subject. (For example, if the Document is in part a
textbook of mathematics, a Secondary Section may not explain any
mathematics.) The relationship could be a matter of historical
connection with the subject or with related matters, or of legal,
commercial, philosophical, ethical or political position regarding
them.
The "Invariant Sections" are certain Secondary Sections whose titles
are designated, as being those of Invariant Sections, in the notice
that says that the Document is released under this License.
The "Cover Texts" are certain short passages of text that are listed,
as Front-Cover Texts or Back-Cover Texts, in the notice that says that
the Document is released under this License.
A "Transparent" copy of the Document means a machine-readable copy,
represented in a format whose specification is available to the
general public, whose contents can be viewed and edited directly and
straightforwardly with generic text editors or (for images composed of
pixels) generic paint programs or (for drawings) some widely available
drawing editor, and that is suitable for input to text formatters or
for automatic translation to a variety of formats suitable for input
to text formatters. A copy made in an otherwise Transparent file
format whose markup has been designed to thwart or discourage
subsequent modification by readers is not Transparent. A copy that is
not "Transparent" is called "Opaque".
Examples of suitable formats for Transparent copies include plain
ASCII without markup, Texinfo input format, LaTeX input format, SGML
or XML using a publicly available DTD, and standard-conforming simple
HTML designed for human modification. Opaque formats include
PostScript, PDF, proprietary formats that can be read and edited only
by proprietary word processors, SGML or XML for which the DTD and/or
processing tools are not generally available, and the
machine-generated HTML produced by some word processors for output
purposes only.
The "Title Page" means, for a printed book, the title page itself,
plus such following pages as are needed to hold, legibly, the material
this License requires to appear in the title page. For works in
formats which do not have any title page as such, "Title Page" means
the text near the most prominent appearance of the work's title,
preceding the beginning of the body of the text.
2. VERBATIM COPYING
You may copy and distribute the Document in any medium, either
commercially or noncommercially, provided that this License, the
copyright notices, and the license notice saying this License applies
to the Document are reproduced in all copies, and that you add no other
conditions whatsoever to those of this License. You may not use
technical measures to obstruct or control the reading or further
copying of the copies you make or distribute. However, you may accept
compensation in exchange for copies. If you distribute a large enough
number of copies you must also follow the conditions in section 3.
You may also lend copies, under the same conditions stated above, and
you may publicly display copies.
3. COPYING IN QUANTITY
If you publish printed copies of the Document numbering more than 100,
and the Document's license notice requires Cover Texts, you must enclose
the copies in covers that carry, clearly and legibly, all these Cover
Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
the back cover. Both covers must also clearly and legibly identify
you as the publisher of these copies. The front cover must present
the full title with all words of the title equally prominent and
visible. You may add other material on the covers in addition.
Copying with changes limited to the covers, as long as they preserve
the title of the Document and satisfy these conditions, can be treated
as verbatim copying in other respects.
If the required texts for either cover are too voluminous to fit
legibly, you should put the first ones listed (as many as fit
reasonably) on the actual cover, and continue the rest onto adjacent
pages.
If you publish or distribute Opaque copies of the Document numbering
more than 100, you must either include a machine-readable Transparent
copy along with each Opaque copy, or state in or with each Opaque copy
a publicly-accessible computer-network location containing a complete
Transparent copy of the Document, free of added material, which the
general network-using public has access to download anonymously at no
charge using public-standard network protocols. If you use the latter
option, you must take reasonably prudent steps, when you begin
distribution of Opaque copies in quantity, to ensure that this
Transparent copy will remain thus accessible at the stated location
until at least one year after the last time you distribute an Opaque
copy (directly or through your agents or retailers) of that edition to
the public.
It is requested, but not required, that you contact the authors of the
Document well before redistributing any large number of copies, to give
them a chance to provide you with an updated version of the Document.
4. MODIFICATIONS
You may copy and distribute a Modified Version of the Document under
the conditions of sections 2 and 3 above, provided that you release
the Modified Version under precisely this License, with the Modified
Version filling the role of the Document, thus licensing distribution
and modification of the Modified Version to whoever possesses a copy
of it. In addition, you must do these things in the Modified Version:
A. Use in the Title Page (and on the covers, if any) a title distinct
from that of the Document, and from those of previous versions
(which should, if there were any, be listed in the History section
of the Document). You may use the same title as a previous version
if the original publisher of that version gives permission.
B. List on the Title Page, as authors, one or more persons or entities
responsible for authorship of the modifications in the Modified
Version, together with at least five of the principal authors of the
Document (all of its principal authors, if it has less than five).
C. State on the Title page the name of the publisher of the
Modified Version, as the publisher.
D. Preserve all the copyright notices of the Document.
E. Add an appropriate copyright notice for your modifications
adjacent to the other copyright notices.
F. Include, immediately after the copyright notices, a license notice
giving the public permission to use the Modified Version under the
terms of this License, in the form shown in the Addendum below.
G. Preserve in that license notice the full lists of Invariant Sections
and required Cover Texts given in the Document's license notice.
H. Include an unaltered copy of this License.
I. Preserve the section entitled "History", and its title, and add to
it an item stating at least the title, year, new authors, and
publisher of the Modified Version as given on the Title Page. If
there is no section entitled "History" in the Document, create one
stating the title, year, authors, and publisher of the Document as
given on its Title Page, then add an item describing the Modified
Version as stated in the previous sentence.
J. Preserve the network location, if any, given in the Document for
public access to a Transparent copy of the Document, and likewise
the network locations given in the Document for previous versions
it was based on. These may be placed in the "History" section.
You may omit a network location for a work that was published at
least four years before the Document itself, or if the original
publisher of the version it refers to gives permission.
K. In any section entitled "Acknowledgements" or "Dedications",
preserve the section's title, and preserve in the section all the
substance and tone of each of the contributor acknowledgements
and/or dedications given therein.
L. Preserve all the Invariant Sections of the Document,
unaltered in their text and in their titles. Section numbers
or the equivalent are not considered part of the section titles.
M. Delete any section entitled "Endorsements". Such a section
may not be included in the Modified Version.
N. Do not retitle any existing section as "Endorsements"
or to conflict in title with any Invariant Section.
If the Modified Version includes new front-matter sections or
appendices that qualify as Secondary Sections and contain no material
copied from the Document, you may at your option designate some or all
of these sections as invariant. To do this, add their titles to the
list of Invariant Sections in the Modified Version's license notice.
These titles must be distinct from any other section titles.
You may add a section entitled "Endorsements", provided it contains
nothing but endorsements of your Modified Version by various
parties--for example, statements of peer review or that the text has
been approved by an organization as the authoritative definition of a
standard.
You may add a passage of up to five words as a Front-Cover Text, and a
passage of up to 25 words as a Back-Cover Text, to the end of the list
of Cover Texts in the Modified Version. Only one passage of
Front-Cover Text and one of Back-Cover Text may be added by (or
through arrangements made by) any one entity. If the Document already
includes a cover text for the same cover, previously added by you or
by arrangement made by the same entity you are acting on behalf of,
you may not add another; but you may replace the old one, on explicit
permission from the previous publisher that added the old one.
The author(s) and publisher(s) of the Document do not by this License
give permission to use their names for publicity for or to assert or
imply endorsement of any Modified Version.
5. COMBINING DOCUMENTS
You may combine the Document with other documents released under this
License, under the terms defined in section 4 above for modified
versions, provided that you include in the combination all of the
Invariant Sections of all of the original documents, unmodified, and
list them all as Invariant Sections of your combined work in its
license notice.
The combined work need only contain one copy of this License, and
multiple identical Invariant Sections may be replaced with a single
copy. If there are multiple Invariant Sections with the same name but
different contents, make the title of each such section unique by
adding at the end of it, in parentheses, the name of the original
author or publisher of that section if known, or else a unique number.
Make the same adjustment to the section titles in the list of
Invariant Sections in the license notice of the combined work.
In the combination, you must combine any sections entitled "History"
in the various original documents, forming one section entitled
"History"; likewise combine any sections entitled "Acknowledgements",
and any sections entitled "Dedications". You must delete all sections
entitled "Endorsements."
6. COLLECTIONS OF DOCUMENTS
You may make a collection consisting of the Document and other documents
released under this License, and replace the individual copies of this
License in the various documents with a single copy that is included in
the collection, provided that you follow the rules of this License for
verbatim copying of each of the documents in all other respects.
You may extract a single document from such a collection, and distribute
it individually under this License, provided you insert a copy of this
License into the extracted document, and follow this License in all
other respects regarding verbatim copying of that document.
7. AGGREGATION WITH INDEPENDENT WORKS
A compilation of the Document or its derivatives with other separate
and independent documents or works, in or on a volume of a storage or
distribution medium, does not as a whole count as a Modified Version
of the Document, provided no compilation copyright is claimed for the
compilation. Such a compilation is called an "aggregate", and this
License does not apply to the other self-contained works thus compiled
with the Document, on account of their being thus compiled, if they
are not themselves derivative works of the Document.
If the Cover Text requirement of section 3 is applicable to these
copies of the Document, then if the Document is less than one quarter
of the entire aggregate, the Document's Cover Texts may be placed on
covers that surround only the Document within the aggregate.
Otherwise they must appear on covers around the whole aggregate.
8. TRANSLATION
Translation is considered a kind of modification, so you may
distribute translations of the Document under the terms of section 4.
Replacing Invariant Sections with translations requires special
permission from their copyright holders, but you may include
translations of some or all Invariant Sections in addition to the
original versions of these Invariant Sections. You may include a
translation of this License provided that you also include the
original English version of this License. In case of a disagreement
between the translation and the original English version of this
License, the original English version will prevail.
9. TERMINATION
You may not copy, modify, sublicense, or distribute the Document except
as expressly provided for under this License. Any other attempt to
copy, modify, sublicense or distribute the Document 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.
10. FUTURE REVISIONS OF THIS LICENSE
The Free Software Foundation may publish new, revised versions
of the GNU Free Documentation 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. See
http://www.gnu.org/copyleft/.
Each version of the License is given a distinguishing version number.
If the Document specifies that a particular numbered version of this
License "or any later version" applies to it, you have the option of
following the terms and conditions either of that specified version or
of any later version that has been published (not as a draft) by the
Free Software Foundation. If the Document does not specify a version
number of this License, you may choose any version ever published (not
as a draft) by the Free Software Foundation.
ADDENDUM: How to use this License for your documents
To use this License in a document you have written, include a copy of
the License in the document and put the following copyright and
license notices just after the title page:
Copyright (c) YEAR YOUR NAME.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.1
or any later version published by the Free Software Foundation;
with the Invariant Sections being LIST THEIR TITLES, with the
Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST.
A copy of the license is included in the section entitled "GNU
Free Documentation License".
If you have no Invariant Sections, write "with no Invariant Sections"
instead of saying which ones are invariant. If you have no
Front-Cover Texts, write "no Front-Cover Texts" instead of
"Front-Cover Texts being LIST"; likewise for Back-Cover Texts.
If your document contains nontrivial examples of program code, we
recommend releasing these examples in parallel under your choice of
free software license, such as the GNU General Public License,
to permit their use in free software.

481
COPYING.LIB Normal file
View File

@ -0,0 +1,481 @@
GNU LIBRARY GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 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.
[This is the first released version of the library GPL. It is
numbered 2 because it goes with version 2 of the ordinary GPL.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Library General Public License, applies to some
specially designated Free Software Foundation software, and to any
other libraries whose authors decide to use it. You can use it for
your libraries, 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 library, or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link a program with the library, you must provide
complete object files to the recipients so that they can relink them
with the library, after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
Our method of protecting your rights has two steps: (1) copyright
the library, and (2) offer you this license which gives you legal
permission to copy, distribute and/or modify the library.
Also, for each distributor's protection, we want to make certain
that everyone understands that there is no warranty for this free
library. If the library is modified by someone else and passed on, we
want its recipients to know that what they have is not the original
version, 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 companies distributing free
software will individually obtain patent licenses, thus in effect
transforming the program into proprietary software. To prevent this,
we have made it clear that any patent must be licensed for everyone's
free use or not licensed at all.
Most GNU software, including some libraries, is covered by the ordinary
GNU General Public License, which was designed for utility programs. This
license, the GNU Library General Public License, applies to certain
designated libraries. This license is quite different from the ordinary
one; be sure to read it in full, and don't assume that anything in it is
the same as in the ordinary license.
The reason we have a separate public license for some libraries is that
they blur the distinction we usually make between modifying or adding to a
program and simply using it. Linking a program with a library, without
changing the library, is in some sense simply using the library, and is
analogous to running a utility program or application program. However, in
a textual and legal sense, the linked executable is a combined work, a
derivative of the original library, and the ordinary General Public License
treats it as such.
Because of this blurred distinction, using the ordinary General
Public License for libraries did not effectively promote software
sharing, because most developers did not use the libraries. We
concluded that weaker conditions might promote sharing better.
However, unrestricted linking of non-free programs would deprive the
users of those programs of all benefit from the free status of the
libraries themselves. This Library General Public License is intended to
permit developers of non-free programs to use free libraries, while
preserving your freedom as a user of such programs to change the free
libraries that are incorporated in them. (We have not seen how to achieve
this as regards changes in header files, but we have achieved it as regards
changes in the actual functions of the Library.) The hope is that this
will lead to faster development of free libraries.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, while the latter only
works together with the library.
Note that it is possible for a library to be covered by the ordinary
General Public License rather than by this special one.
GNU LIBRARY GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library which
contains a notice placed by the copyright holder or other authorized
party saying it may be distributed under the terms of this Library
General Public License (also called "this License"). Each licensee is
addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, 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 library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete 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 distribute a copy of this License along with the
Library.
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 Library or any portion
of it, thus forming a work based on the Library, 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) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
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 Library, 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 Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you 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.
If distribution of 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 satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also compile or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
c) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
d) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. 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.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library 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.
9. 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 Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
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.
11. 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 Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library 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 Library.
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.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library 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.
13. The Free Software Foundation may publish revised and/or new
versions of the Library 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 Library
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 Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
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
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "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
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. 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 LIBRARY 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
LIBRARY (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 LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), 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 Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
To apply these terms, attach the following notices to the library. 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 library's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 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
Library General Public License for more details.
You should have received a copy of the GNU Library 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
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
<signature of Ty Coon>, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!

2
ChangeLog Normal file
View File

@ -0,0 +1,2 @@
The ChangeLog is auto-generated when releasing. If you are seeing this, use
'git log' for a detailed list of changes.

50
Makefile.am Normal file
View File

@ -0,0 +1,50 @@
SUBDIRS = libmate-desktop man docs schemas tools icons po
if MATE_ABOUT_ENABLED
SUBDIRS += mate-about
endif
ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
DISTCHECK_CONFIGURE_FLAGS = \
--enable-gtk-doc \
CFLAGS='-Wno-deprecated-declarations'
EXTRA_DIST = \
autogen.sh \
COPYING-DOCS
CLEANFILES =
MAINTAINERCLEANFILES = \
$(srcdir)/aclocal.m4 \
$(srcdir)/build-aux/config.guess \
$(srcdir)/build-aux/config.sub \
$(srcdir)/build-aux/depcomp \
$(srcdir)/build-aux/install-sh \
$(srcdir)/build-aux/ltmain.sh \
$(srcdir)/build-aux/missing \
$(srcdir)/config.h.in \
$(srcdir)/configure \
$(srcdir)/gtk-doc.make \
$(srcdir)/m4/gtk-doc.m4 \
$(srcdir)/m4/intltool.m4 \
$(srcdir)/m4/libtool.m4 \
$(srcdir)/m4/lt~obsolete.m4 \
$(srcdir)/m4/ltoptions.m4 \
$(srcdir)/m4/ltsugar.m4 \
$(srcdir)/m4/ltversion.m4 \
$(srcdir)/mkinstalldirs \
`find "$(srcdir)" -type f -name Makefile.in -print`
# Build ChangeLog from GIT history
ChangeLog:
$(AM_V_GEN) if test -d $(top_srcdir)/.git; then \
GIT_DIR="$(top_srcdir)/.git" git log --stat > $@; \
fi
dist: ChangeLog
.PHONY: ChangeLog
-include $(top_srcdir)/git.mk

290
NEWS Normal file
View File

@ -0,0 +1,290 @@
### mate-desktop 1.24.0
* Translations update
* build: show warning flags on configure summary
* build: use warning flags
* autoconf: AC_PROG_CC was called before AX_CHECK_ENABLE_DEBUG
### mate-desktop 1.23.3
* Translations update
* thumbnail: Remove obsolete mate_desktop_thumbnail_md5()
* thumbnail: Remove obsolete pixbuf helper
* thumbnail: Use an array to store the thumbnailer's cmdline
* thumbnail: Use g_strcmp0() and remove a NULL check
* thumbnail: Simplify system includes
* thumbnail: Fix typo in optional
* thumbnail: Remove unused constant SECONDS_BETWEEN_STATS
* thumbnail: Remove unused #define GDK_PIXBUF_ENABLE_BACKEND
* thumbnail: Remove reference to MateIconFactory
* thumbnail: Simplify init_thumbnailers_dirs()
* thumbnail: some code-styling fixes
* Deprecate mate_desktop_thumbnail_scale_down_pixbuf()
* thumbnailer: Always prefer the backend provided preview
* thumbnail: Always use external gdk-pixbuf thumbnailer
* thumbnail: Demote a log message from WARNING to DEBUG
* thumbnail factory: Disconnect signal handlers in finalize
* thumbnail: Move thumbnail generation/saving to a few helper functions
* thumbnail: Clean up path generation code
* thumbnailer: Try harder to create a failed thumbnail
* Add missing cases to switch statement
* lib: Add thumbnail test application
* Increase the size of thumbnails to 256
* avoid redundant redeclarations
* desktop file: add missing hints for translators
* Treat time_t as gint64 to convert from/to string
* build: introduce RELEASE_YEAR variable for mate-about dialog
### mate-desktop 1.23.2
* Translations update
* Move remaining peripheral schemas to mate-settings-daemon
* schema: Move mouse schemas to mate-settings-daemon
* Replace deprecated gtk_css_provider_get_default
* mate-bg-crossfade: replace tabs with spaces
* make 'rsvg-convert' optional
* mate-colorsel: avoid deprecated 'gtk_hscale_new'
* gettext needs .gmo files to install .mo locale
* Remove trailing whitespaces
* CI: fix make distcheck to remove .gmo files
* CI: use autotoools for creating the tarball again
* CI: fix meson distcheck
### mate-desktop 1.23.1
* Translations update
* schemas: Define schema for a default messenger
* check both {$prefix,/usr}/share/locale dirs for translation
* Add test code for mate-languages.
* Change url project's website
* configure: drop check for itstool
* Create FUNDING.yml
* build: use localedir instead of DATADIRNAME
* add abi check
* treewide: add meson build
### mate-desktop 1.23.0
* Translations update
* [ci] run after_script when use autotools
* enable meson build on travis
* Use mate-desktop icon instead of mate for mate-about
* Simplify icons/Makefile.am
* Use radial gradient (Blur 13.9%, Opacity 73.4%) for MATE logo shadow
* i18n: port from intltool to gettext
* mate-about: subdir mate-version.xml.in.in
* configure.ac: subdir some of the build cruft
* mate-desktop-thumbnail: avoid 'NULL' parameter
* mate-thumbnail-pixbuf-utils: Fix division by zero
* mate-bg: Fix memory leak
* Make translatable the program name in mate about dialog
* Make translatable the copyright info in mate about dialog
* GEN png icons from hicolor_apps_scalable_mate.svg
* [Security] Use 'g_strlcpy' instead of 'strcpy'
* [Security] test-ditem: Use 'g_strlcat' instead of 'strcat'
* mate-hsv: avoid duplicate initialization in variable
* [ci] Enable Clang Static Analyzer
* mate-hsv: avoid deprecated 'gdk_device_grab/ungrab'
* mate-colorsel: avoid deprecated 'GtkHSV', use 'MateHSV' instead
* MateHSV implementation (GtkHSV fork)
### mate-desktop 1.22.0
* Translations update
* Fixed make distcheck fail on debian.
* mate-colorsel: avoid deprecated 'gtk_widget_modify_bg'
* Initialize travis support
* [mate-rr] Avoid deprecated g_type_class_add_private
* Avoid deprecated g_type_class_add_private
* [mate-colorsel] Avoid deprecated g_type_class_add_private
* mate-bg: avoid deprecated 'g_settings_list_keys'
* update copyright to 2019
* disable deprecation warnings for distcheck
* mate-bg: Corrected some comments
* schemas: Define schema for a default calculator
### mate-desktop 1.21.2
* Translations update
* Add new setting to control XKB modifier latching
### mate-desktop 1.21.1
* Translations update
* interface: add key to enable/disable primary paste from middlemouse
* mate-desktop-item: replace deprecated gdk_error_trap_push/pop
* mate-rr-config: replace deprecated gdk_flush
* mate-rr: replace deprecated Gdk functions
* mate-bg-crossfade: replace deprecated gdk_error_trap_push/pop
* mate-bg: replace deprecated gdk_error_trap_push/pop
* fix distcheck
* add mate-language apis
### mate-desktop 1.21.0
* Translations update
* drop ancient and unused acinclude.m4
* Add toggle for synchronizing QT_SCALE_FACTOR to GDK_SCALE_FACTOR
* Change default cursor-size to 24px
* Support background fallback on HiDPI
* mate-rr-labeler: fix font-color for dark themes
### mate-desktop 1.20.0
* Add gsettings for window scaling factor
* drop additional checks for min GLib version
* building: bump required glib version to 2.50.0
* remove < gtk+-3.22 bits and bump required gtk+ version
### mate-desktop 1.19.3
* Translations update
* update copyright year to 2018
* schema: drop can-change-accels key, won't work with GTK+3
### mate-desktop 1.19.2
* Translations update
* WidthOfScreen and HeightOfScreen implementation
### mate-desktop 1.19.1
* Translations update
* drop MateAboutDialog
* mate-about: remove remains of libunique references
* mate-about: switch to GtkAboutDialog
* gtk 3.22: avoid deprecated gdk_screen_get_monitor... functions:
### mate-desktop 1.19.0
* Translations update
* avoid deprecated gdk_screen_get_width/height
* mate-desktop-item: mate-about: avoid deprecated gtk_show_uri
* mate-about: avoid deprecated gtk_show_uri
* avoid deprecated gdk_screen_get_n_monitors
* avoid deprecated gdk_screen_make_display_name
* avoid deprecated gdk_screen_get_number
* Correct little imprecision in man mate-about
* Restore Polish translation credits from GNOME
* Fix broken fallback cursor in mate-colorsel.c
* mate-colorsel: don't use deprecated GTK_STOCK_COLOR_PICKER
* Add Global Menu support
### mate-desktop 1.18.0
* NEWS: use consistent, project wide, markdown-like formatting to make
generating release announcements easier
* Move to GTK+3 (require GTK+ >= 3.14), drop GTK+2 code and --with-gtk
build option
* Drop mpaste tool (won't work without the website anyway)
* Background: fix crossfade issues with recent GTK+ versions
* Background: fix more graphics issues to allow Caja to use background
for directory windows
* Background: fix memleaks and other misc issues
* Color select: fix some GTK+ deprecations
* Schemas: some fixes and cleanups
* mate-about: update copyright year
* mate-about: fix URL centering
* Translations update
### mate-desktop 1.16.1
* mate-bg: fix regression that caused font color in Caja to be
always black (even on dark backgrounds)
* Translations update
### mate-desktop 1.16.0
* mate-bg: remove unneeded ignore-pending-change property
(not needed anymore since font color fix in Caja 1.14)
* GTK+3: fix various deprecations
* distcheck: explicitly use currently selected GTK+ version
* Some minor cleanups
* Translations update
### mate-desktop 1.14.1
* Translations update
* Backgrounds: Take EXIF rotation tags into consideration
* enable installation of mate.svg
### mate-desktop 1.14.0
* Drop MateConf migration script and ancient mate-conf-import tool
* Fix deprecated usage of GtkHBox and GtkVBox in GTK+3 build
* Translations update
* Fix Changelog generation
### mate-desktop 1.12.1
* RR: fix crash
* Fix color select in GTK+3
* Translations update
### mate-desktop 1.12.0
* Require dconf 0.13.4
* Require xrandr 1.3
* Add gsettings key to toggle overlay scrolling in GTK+3
* Add some icons to fix missing icons in GTK+3 with custom icon theme
* Mouse schema: enable middle-click emulation by default
* RR: implement missing mate_rr_output_get_possible_crtcs function
* RR: fix laptop identification by output name
* RR: show output name in addition to display name
* Retrieve strings directly from gschema (requires intltool 0.50.1)
* Moved docbook user guide to a separate project
* Dropped dependency on yelp (not needed after moving user guide)
* Several fixes
### mate-desktop 1.10.2
* Check for NULL pointers in slideshow
* Fix crash when system date is earlier than start date
* Fix crash when XRRSetCrtcConfig fails
* Drop non-existent mate_rr_screen_create_clone_modes from headers
* Embedded Display Port outputs are considered a laptop built-in
display
* Add annotations and fix documentation syntax warnings
* Update translations
### mate-desktop 1.10.1
* Restore docbook user-guide
### mate-desktop 1.10.0
* Turn MateRRScreen, GnomeRRConfig and GnomeOutputInfo into a GObject.
Thanks to monsta for helping to test this.
* Add gobject introspection
* Many RANDR fixes
* interface: add automatic-mnemonics key for Gtk xsetting
* use GDK_WINDOW_XID for inter-GTK compatibility
* Updated mpaste for website change
* Added org.mate.debug GSettings schema
* Added MateColorButton class to have traditional color selection
dialog with GTK3
* Removed desktop-docs
* Removed user guide
* Removed libunique optional dependency
* Added MateAboutDialog class to have traditional about dialog with
GTK3 too
### mate-desktop 1.8.0
* Added helpers for dconf and GSettings
* Fix build with GTK3
* Added MATE user guide
* Added MATE_DESKTOP_CHECK_VERSION function
* Added mpaste tool
* Added replacement for gdk_spawn_command_line_on_screen in GTK3
### mate-desktop 1.6.1
* Tarball built with 'make dist'
* Added tool to migrate 1.4 settings (mate-conf-import)
### mate-desktop 1.6.0
* Port to new thumbnail spec (code from gnome-desktop 3.x)
* Added gsettings schemas from now deprecated libmate

34
README Normal file
View File

@ -0,0 +1,34 @@
mate-desktop
=============
mate-desktop contains the libmate-desktop library, the mate-about
program as well as some desktop-wide documents.
The libmate-desktop library provides API shared by several applications
on the desktop, but that cannot live in the platform for various
reasons. There is no API or ABI guarantee, although we are doing our
best to provide stability. Documentation for the API is available with
gtk-doc.
The mate-about program helps find which version of MATE is installed.
You may download updates to the package from:
http://pub.mate-desktop.org/releases/
Installation
============
If you are not using a released version of mate-desktop (for example,
if you checked out the code from git), you first need to run
'./autogen.sh'.
How to report bugs
==================
Bugs should be reported to the MATE bug tracking system:
https://github.com/mate-desktop/mate-desktop/issues

45
abi-check Executable file
View File

@ -0,0 +1,45 @@
#!/bin/bash
set -eu
RET=0
if ! [[ -f "${LIB}" ]]; then
echo "Test library \"${LIB}\" does not exist"
exit 99;
fi
if ! [[ -n "${NM}" ]]; then
echo "NM environment variable not set"
exit 99;
fi
AVAIL_FUNCS="$(${NM} -D --format=bsd --defined-only ${LIB} | awk '{print $3}')"
REQ_FUNCS="$(cat ${ABI})"
NEW_ABI=$(echo "$AVAIL_FUNCS" | while read func; do
echo "$func" | grep -q "^_" && continue
echo "${REQ_FUNCS}" | grep -q "^${func}$" && continue
echo "$func"
done)
if [[ -n ${NEW_ABI} ]]; then
echo "New ABI detected - If intentional, update ${ABI}."
echo "${NEW_ABI}"
RET=1;
fi
REMOVED_ABI=$(echo "${REQ_FUNCS}" | while read func; do
echo "${AVAIL_FUNCS}" | grep -q "^${func}$" && continue
echo "${func}"
done)
if [[ -n ${REMOVED_ABI} ]]; then
echo "ABI break detected - required symbols no longer exported!"
echo "${REMOVED_ABI}"
RET=1
fi
exit ${RET}

25
autogen.sh Executable file
View File

@ -0,0 +1,25 @@
#!/bin/sh
# Run this to generate all the initial makefiles, etc.
srcdir=`dirname $0`
test -z "$srcdir" && srcdir=.
PKG_NAME="mate-desktop"
(test -f $srcdir/configure.ac) || {
echo -n "**Error**: Directory "\`$srcdir\'" does not look like the"
echo " top-level $PKG_NAME directory"
exit 1
}
which mate-autogen || {
echo "You need to install mate-common"
exit 1
}
REQUIRED_AUTOMAKE_VERSION=1.9
USE_MATE2_MACROS=1
USE_COMMON_DOC_BUILD=yes
. mate-autogen

50
config.meson.h Normal file
View File

@ -0,0 +1,50 @@
/* always defined to indicate that i18n is enabled */
#mesondefine ENABLE_NLS
/* The gettext translation domain */
#mesondefine GETTEXT_PACKAGE
/* Define if the xrandr-$XRANDR_REQUIRED library is present */
#mesondefine HAVE_RANDR
/* Building with startup notification support */
#mesondefine HAVE_STARTUP_NOTIFICATION
/* Enable additional debugging at the expense of performance and size */
#mesondefine MATE_ENABLE_DEBUG
/* Define to the major version */
#mesondefine MATE_MAJOR
/* Define to the minor version */
#mesondefine MATE_MINOR
/* Define to the micro version */
#mesondefine MATE_MICRO
/* Name of package */
#mesondefine PACKAGE
/* Define to the address where bug reports for this package should be sent. */
#mesondefine PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#mesondefine PACKAGE_NAME
/* Define to the full name and version of this package. */
#mesondefine PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#mesondefine PACKAGE_TARNAME
/* Define to the home page for this package. */
#mesondefine PACKAGE_URL
/* Define to the version of this package. */
#mesondefine PACKAGE_VERSION
/* Version number of package */
#mesondefine VERSION
/* Define to 1 if the X Window System is missing or not being used. */
#mesondefine X_DISPLAY_MISSING

288
configure.ac Normal file
View File

@ -0,0 +1,288 @@
m4_define([mate_platform], [1])
m4_define([mate_minor], [24])
m4_define([mate_micro], [0])
m4_define(mate_version, [mate_platform.mate_minor.mate_micro]),
AC_INIT([mate-desktop], mate_version, [https://github.com/mate-desktop/mate-desktop/])
AC_CONFIG_SRCDIR([libmate-desktop])
AC_CONFIG_AUX_DIR([build-aux])
AM_INIT_AUTOMAKE([1.9 foreign no-dist-gzip dist-xz tar-ustar check-news])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])
dnl make sure we keep ACLOCAL_FLAGS around for maintainer builds to work
AC_SUBST(ACLOCAL_AMFLAGS, "\${ACLOCAL_FLAGS}")
# Before making a release, the LT_VERSION string should be modified.
# The string is of the form C:R:A.
# - If interfaces have been changed or added, but binary compatibility has
# been preserved, change to C+1:0:A+1
# - If binary compatibility has been broken (eg removed or changed interfaces)
# change to C+1:0:0
# - If the interface is the same as the previous version, change to C:R+1:A
LT_VERSION=18:4:1
AC_SUBST(LT_VERSION)
AM_MAINTAINER_MODE
MATE_COMMON_INIT
MATE_DEBUG_CHECK
MATE_COMPILE_WARNINGS([maximum])
MATE_MAINTAINER_MODE_DEFINES
AC_PROG_CC
AC_STDC_HEADERS
AC_PROG_LIBTOOL
PKG_PROG_PKG_CONFIG
MATE_PLATFORM=mate_platform
MATE_MINOR=mate_minor
MATE_MICRO=mate_micro
MATE_DATE=`date +"%Y-%m-%d"`
MATE_DATE=
MATE_DATE_COMMENT_START="<!--"
MATE_DATE_COMMENT_END="-->"
AC_SUBST(MATE_PLATFORM)
AC_SUBST(MATE_MINOR)
AC_SUBST(MATE_MICRO)
AC_SUBST(MATE_DATE)
AC_SUBST(MATE_DATE_COMMENT_START)
AC_SUBST(MATE_DATE_COMMENT_END)
AC_DEFINE(MATE_MAJOR, [mate_platform], [Define to the major version])
AC_DEFINE(MATE_MINOR, [mate_minor], [Define to the minor version])
AC_DEFINE(MATE_MICRO, [mate_micro], [Define to the micro version])
RELEASE_YEAR=`date +%Y`
AC_SUBST([RELEASE_YEAR])
AC_ARG_ENABLE(deprecation_flags,
[AC_HELP_STRING([--enable-deprecation-flags],
[use *_DISABLE_DEPRECATED flags @<:@default=no@:>@])],,
[enable_deprecation_flags=no])
if test "x$enable_deprecation_flags" = "xyes"; then
DISABLE_DEPRECATED_CFLAGS=$DISABLE_DEPRECATED
AC_SUBST(DISABLE_DEPRECATED_CFLAGS)
fi
# Whether to build mate-about
AC_ARG_ENABLE([mate-about],
[AS_HELP_STRING([--disable-mate-about],[do not build mate-about])],,
[enable_mate_about=yes])
AM_CONDITIONAL(MATE_ABOUT_ENABLED, test "x$enable_mate_about" = "xyes")
# Path to the pnp.ids file -- to know if we use one shipped with another
# package, or an internal file
AC_ARG_WITH(pnp-ids-path,
[AC_HELP_STRING([--with-pnp-ids-path],
[Specify the path to pnp.ids @<:@default=(internal)@:>@])],,
[with_pnp_ids_path="\${pnpdatadir}/pnp.ids"])
AM_CONDITIONAL(USE_INTERNAL_PNP_IDS, test "x$with_pnp_ids_path" = "x\${pnpdatadir}/pnp.ids")
PNP_IDS=$with_pnp_ids_path
AC_SUBST(PNP_IDS)
if test "x$with_pnp_ids_path" = "x\${pnpdatadir}/pnp.ids"; then
EXTERNAL_PNP_IDS="no (internal)"
else
EXTERNAL_PNP_IDS="$with_pnp_ids_path"
fi
GDK_PIXBUF_REQUIRED=2.36.5
GLIB_REQUIRED=2.50.0
GIO_REQUIRED=2.26.0
GTK_REQUIRED=3.22.0
XRANDR_REQUIRED=1.3
dnl ----------------------------------------------------------------------------
dnl DCONF
dnl ----------------------------------------------------------------------------
DCONF_REQUIRED=0.13.4
PKG_CHECK_MODULES(DCONF, dconf >= $DCONF_REQUIRED)
AC_SUBST(DCONF_CFLAGS)
AC_SUBST(DCONF_LIBS)
dnl ----------------------------------------------------------------------------
dnl startup notification
dnl ----------------------------------------------------------------------------
STARTUP_NOTIFICATION_VERSION=0.5
STARTUP_NOTIFICATION_PACKAGE=
AC_ARG_ENABLE(startup-notification,
AC_HELP_STRING([--disable-startup-notification], [disable startup notification support]),, enable_startup_notification=auto)
AC_MSG_CHECKING([Startup notification library >= $STARTUP_NOTIFICATION_VERSION])
if $PKG_CONFIG --atleast-version $STARTUP_NOTIFICATION_VERSION libstartup-notification-1.0; then
have_startup_notification=yes
else
have_startup_notification=no
fi
AC_MSG_RESULT($have_startup_notification)
if test x$enable_startup_notification = xyes; then
have_startup_notification=yes
echo "startup-notification support forced on"
elif test x$enable_startup_notification = xauto; then
true
else
have_startup_notification=no
fi
if test x$have_startup_notification = xyes; then
echo "Building with libstartup-notification"
STARTUP_NOTIFICATION_PACKAGE=libstartup-notification-1.0
AC_DEFINE(HAVE_STARTUP_NOTIFICATION,, [Building with startup notification support])
else
echo "Building without libstartup-notification"
fi
AC_SUBST(STARTUP_NOTIFICATION_PACKAGE)
GOBJECT_INTROSPECTION_CHECK([0.9.7])
dnl we need x11 for MateBG
PKG_CHECK_MODULES(XLIB, x11,
X11_PACKAGE=x11,
[X11_PACKAGE=
AC_PATH_XTRA
if test "x$no_x" = xyes; then
AC_MSG_ERROR("no (requires X development libraries)")
else
XLIB_LIBS="$X_PRE_LIBS $X_LIBS -lX11 $X_EXTRA_LIBS"
XLIB_CFLAGS=$X_CFLAGS
fi])
AC_SUBST(X11_PACKAGE)
AC_SUBST(XLIB_CFLAGS)
AC_SUBST(XLIB_LIBS)
dnl Checks for X is RANDR extension
AC_MSG_CHECKING(for xrandr)
if $PKG_CONFIG --atleast-version $XRANDR_REQUIRED xrandr; then
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_RANDR, 1,
[Define if the xrandr-$XRANDR_REQUIRED library is present])
have_randr=yes
RANDR_PACKAGE=xrandr
else
AC_MSG_RESULT(no)
have_randr=no
RANDR_PACKAGE=
fi
AC_SUBST(RANDR_PACKAGE)
dnl pkg-config dependency checks
PKG_CHECK_MODULES(MATE_DESKTOP, gdk-pixbuf-2.0 >= $GDK_PIXBUF_REQUIRED gtk+-3.0 >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED gio-2.0 >= $GIO_REQUIRED $STARTUP_NOTIFICATION_PACKAGE $RANDR_PACKAGE iso-codes)
ISO_CODES_PREFIX=$($PKG_CONFIG --variable prefix iso-codes)
AC_SUBST(ISO_CODES_PREFIX)
PKG_CHECK_MODULES(MATE_ABOUT, gtk+-3.0 >= $GTK_REQUIRED)
AC_SUBST(MATE_ABOUT_CFLAGS)
AC_SUBST(MATE_ABOUT_LIBS)
dnl Language Support
AM_GNU_GETTEXT([external])
AM_GNU_GETTEXT_VERSION([0.19.8])
GETTEXT_PACKAGE=mate-desktop
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE",
[The gettext translation domain])
AC_SUBST(GETTEXT_PACKAGE)
GLIB_GSETTINGS
dnl Do not use AC_PROG_AWK since we need the full pathname.
AC_PATH_PROGS(AWK, mawk gawk nawk awk, )
AC_PATH_PROGS(PERL, perl5 perl)
dnl define a MAINT-like variable REBUILD which is set if Perl
dnl and awk are found, so autogenerated sources can be rebuilt
AC_ARG_ENABLE(rebuilds, [ --disable-rebuilds disable all source autogeneration rules],,enable_rebuilds=yes)
REBUILD=\#
if test "x$enable_rebuilds" = "xyes" && \
test -n "$PERL" && \
$PERL -e 'exit !($] >= 5.002)' > /dev/null 2>&1 && \
test -n "$AWK" ; then
REBUILD=
fi
AC_SUBST(REBUILD)
AC_SEARCH_LIBS([sqrt], [m])
# check for gtk-doc
GTK_DOC_CHECK([1.4])
dnl ICONS: convert svg to png
AC_PATH_PROG(RSVG_CONVERT, rsvg-convert)
AM_CONDITIONAL([HAVE_RSVG_CONVERT], [test "x$RSVG_CONVERT" != x])
AC_CONFIG_FILES([
Makefile
mate-about/Makefile
mate-about/mate-about.h
mate-about/mate-version.xml
libmate-desktop/Makefile
libmate-desktop/mate-desktop-2.0.pc
libmate-desktop/mate-desktop-2.0-uninstalled.pc
docs/Makefile
docs/reference/Makefile
docs/reference/mate-desktop/Makefile
po/Makefile.in
schemas/Makefile
schemas/org.mate.background.gschema.xml
man/Makefile
tools/Makefile
icons/Makefile
])
AC_OUTPUT
dnl ---------------------------------------------------------------------------
dnl - Show summary
dnl ---------------------------------------------------------------------------
echo "
mate-desktop $VERSION
`echo mate-desktop $VERSION | sed "s/./=/g"`
prefix: ${prefix}
exec_prefix: ${exec_prefix}
libdir: ${libdir}
bindir: ${bindir}
sbindir: ${sbindir}
sysconfdir: ${sysconfdir}
localstatedir: ${localstatedir}
datadir: ${datadir}
source code location: ${srcdir}
compiler: ${CC}
cflags: ${CFLAGS}
warning flags: ${WARN_CFLAGS}
Maintainer mode: ${USE_MAINTAINER_MODE}
Use *_DISABLE_DEPRECATED: ${enable_deprecation_flags}
Build mate-about: ${enable_mate_about}
Use external pnp.ids: ${EXTERNAL_PNP_IDS}
Startup notification support: ${have_startup_notification}
XRandr support: ${have_randr}
Build introspection support: ${found_introspection}
Build gtk-doc documentation: ${enable_gtk_doc}
"

3
docs/Makefile.am Normal file
View File

@ -0,0 +1,3 @@
SUBDIRS = reference
-include $(top_srcdir)/git.mk

View File

@ -0,0 +1,3 @@
SUBDIRS = mate-desktop
-include $(top_srcdir)/git.mk

View File

@ -0,0 +1,80 @@
## Process this file with automake to produce Makefile.in
# We require automake 1.6 at least.
AUTOMAKE_OPTIONS = 1.6
# This is a blank Makefile.am for using gtk-doc.
# Copy this to your project's API docs directory and modify the variables to
# suit your project. See the GTK+ Makefiles in gtk+/docs/reference for examples
# of using the various options.
# The name of the module, e.g. 'glib'.
DOC_MODULE=mate-desktop
# The top-level SGML file. You can change this if you want to.
DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.sgml
# The directory containing the source code. Relative to $(srcdir).
# gtk-doc will search all .c & .h files beneath here for inline comments
# documenting the functions and macros.
# e.g. DOC_SOURCE_DIR=../../../gtk
DOC_SOURCE_DIR=../../../libmate-desktop
# Extra options to pass to gtkdoc-scangobj. Not normally needed.
SCANGOBJ_OPTIONS=
# Extra options to supply to gtkdoc-scan.
# e.g. SCAN_OPTIONS=--deprecated-guards="GTK_DISABLE_DEPRECATED"
SCAN_OPTIONS=--deprecated-guards="MATE_DISABLE_DEPRECATED"
# Extra options to supply to gtkdoc-mkdb.
# e.g. MKDB_OPTIONS=--sgml-mode --output-format=xml
MKDB_OPTIONS=--sgml-mode --output-format=xml
# Extra options to supply to gtkdoc-mktmpl
# e.g. MKTMPL_OPTIONS=--only-section-tmpl
MKTMPL_OPTIONS=
# Extra options to supply to gtkdoc-fixref. Not normally needed.
# e.g. FIXXREF_OPTIONS=--extra-dir=../gdk-pixbuf/html --extra-dir=../gdk/html
FIXXREF_OPTIONS=
# Used for dependencies. The docs will be rebuilt if any of these change.
# e.g. HFILE_GLOB=$(top_srcdir)/gtk/*.h
# e.g. CFILE_GLOB=$(top_srcdir)/gtk/*.c
HFILE_GLOB=$(top_srcdir)/libmate-desktop/*.h
CFILE_GLOB=$(top_srcdir)/libmate-desktop/*.c
# Header files to ignore when scanning.
# e.g. IGNORE_HFILES=gtkdebug.h gtkintl.h
IGNORE_HFILES=
# Images to copy into HTML directory.
# e.g. HTML_IMAGES=$(top_srcdir)/gtk/stock-icons/stock_about_24.png
HTML_IMAGES=
# Extra SGML files that are included by $(DOC_MAIN_SGML_FILE).
# e.g. content_files=running.sgml building.sgml changes-2.0.sgml
content_files=
# SGML files where gtk-doc abbreviations (#GtkWidget) are expanded
# These files must be listed here *and* in content_files
# e.g. expand_content_files=running.sgml
expand_content_files=
# CFLAGS and LDFLAGS for compiling gtkdoc-scangobj with your library.
# Only needed if you are using gtkdoc-scangobj to dynamically query widget
# signals and properties.
# e.g. AM_CPPFLAGS=-I$(top_srcdir) -I$(top_builddir) $(GTK_DEBUG_FLAGS)
# e.g. GTKDOC_LIBS=$(top_builddir)/gtk/$(gtktargetlib)
AM_CPPFLAGS=$(MATE_DESKTOP_CFLAGS) -I$(top_srcdir)/libmate-desktop -DMATE_DESKTOP_USE_UNSTABLE_API
GTKDOC_LIBS=$(MATE_DESKTOP_LIBS) $(top_builddir)/libmate-desktop/libmate-desktop-2.la
# This includes the standard gtk-doc make rules, copied by gtkdocize.
include $(top_srcdir)/gtk-doc.make
# Other files to distribute
# e.g. EXTRA_DIST += version.xml.in
EXTRA_DIST +=
-include $(top_srcdir)/git.mk

View File

@ -0,0 +1,50 @@
<?xml version="1.0"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
<book id="index" xmlns:xi="http://www.w3.org/2003/XInclude">
<bookinfo>
<title>MATE Desktop Library Reference Manual</title>
</bookinfo>
<part id="intro">
<title>MATE Desktop Library Overview</title>
<partintro>
<para>
The libmate-desktop library contains APIs that can be useful for a few applications, but which do not belong to GTK+ because of the limited use case. There is no guarantee of API or ABI stability, so it's recommended to not depend on it if you do not follow the same development cycle as MATE. Use at your own risk.
</para>
</partintro>
</part>
<part id="background">
<title>Desktop Background</title>
<xi:include href="xml/mate-bg.xml"/>
</part>
<part id="randr">
<title>Monitor Configuration</title>
<xi:include href="xml/mate-rr-screen.xml"/>
<xi:include href="xml/mate-rr-output.xml"/>
<xi:include href="xml/mate-rr-crtc.xml"/>
<xi:include href="xml/mate-rr-mode.xml"/>
<xi:include href="xml/mate-rr-config.xml"/>
<xi:include href="xml/mate-rr-labeler.xml"/>
</part>
<part id="thumbnail">
<title>Thumbnails</title>
<xi:include href="xml/mate-desktop-thumbnail-factory.xml"/>
<xi:include href="xml/mate-desktop-thumbnail.xml"/>
</part>
<part id="languages">
<title>Language Utilities</title>
<xi:include href="xml/mate-languages.xml"/>
</part>
<part id="libmate">
<title>Miscellaneous</title>
<xi:include href="xml/mate-desktop-item.xml"/>
<xi:include href="xml/mate-desktop-utils.xml"/>
</part>
</book>

View File

@ -0,0 +1,310 @@
<SECTION>
<INCLUDE>mate-bg.h</INCLUDE>
<FILE>mate-bg</FILE>
<TITLE>MateBG</TITLE>
MateBG
MateBGColorType
MateBGPlacement
MATE_BG_KEY_DIR
mate_bg_new
mate_bg_load_from_preferences
mate_bg_save_to_preferences
mate_bg_set_filename
mate_bg_set_placement
mate_bg_set_color
mate_bg_get_filename
mate_bg_get_placement
mate_bg_get_color
mate_bg_draw
mate_bg_create_pixmap
mate_bg_get_image_size
mate_bg_create_thumbnail
mate_bg_is_dark
mate_bg_changes_with_size
mate_bg_set_pixmap_as_root
<SUBSECTION Private>
mate_bg_get_type
<SUBSECTION Standard>
MATE_BG
MATE_IS_BG
MATE_TYPE_BG
MATE_BG_CLASS
MATE_IS_BG_CLASS
MATE_BG_GET_CLASS
MateBGClass
</SECTION>
<SECTION>
<INCLUDE>mate-rr.h</INCLUDE>
<FILE>mate-rr-screen</FILE>
<TITLE></TITLE>
MateRRScreen
MateRRScreenChanged
mate_rr_screen_new
mate_rr_screen_destroy
mate_rr_screen_refresh
mate_rr_screen_list_outputs
mate_rr_screen_list_crtcs
mate_rr_screen_list_modes
mate_rr_screen_list_clone_modes
mate_rr_screen_set_size
mate_rr_screen_get_output_by_id
mate_rr_screen_get_output_by_name
mate_rr_screen_get_crtc_by_id
mate_rr_screen_get_ranges
</SECTION>
<SECTION>
<INCLUDE>mate-rr.h</INCLUDE>
<FILE>mate-rr-output</FILE>
<TITLE></TITLE>
MateRROutput
mate_rr_output_get_id
mate_rr_output_get_name
mate_rr_output_is_connected
mate_rr_output_get_size_inches
mate_rr_output_get_width_mm
mate_rr_output_get_height_mm
mate_rr_output_get_edid_data
mate_rr_output_get_possible_crtcs
mate_rr_output_list_modes
mate_rr_output_get_current_mode
mate_rr_output_get_preferred_mode
mate_rr_output_supports_mode
mate_rr_output_get_crtc
mate_rr_output_get_position
mate_rr_output_can_clone
</SECTION>
<SECTION>
<INCLUDE>mate-rr.h</INCLUDE>
<FILE>mate-rr-crtc</FILE>
<TITLE></TITLE>
MateRRCrtc
MateRRRotation
mate_rr_crtc_get_id
mate_rr_crtc_set_config
mate_rr_crtc_can_drive_output
mate_rr_crtc_get_current_mode
mate_rr_crtc_get_position
mate_rr_crtc_supports_rotation
mate_rr_crtc_get_current_rotation
mate_rr_crtc_get_rotations
</SECTION>
<SECTION>
<INCLUDE>mate-rr.h</INCLUDE>
<FILE>mate-rr-mode</FILE>
<TITLE></TITLE>
MateRRMode
mate_rr_mode_get_id
mate_rr_mode_get_width
mate_rr_mode_get_height
mate_rr_mode_get_freq
</SECTION>
<SECTION>
<INCLUDE>mate-rr-config.h</INCLUDE>
<FILE>mate-rr-config</FILE>
<TITLE></TITLE>
MateOutputInfo
MateRRConfig
mate_rr_config_new_current
mate_rr_config_new_stored
mate_rr_config_free
mate_rr_config_match
mate_rr_config_equal
mate_rr_config_save
mate_rr_config_sanitize
mate_rr_config_apply
mate_rr_config_apply_stored
mate_rr_config_applicable
</SECTION>
<SECTION>
<INCLUDE>mate-rr-labeler.h</INCLUDE>
<FILE>mate-rr-labeler</FILE>
<TITLE>MateRRLabeler</TITLE>
MateRRLabeler
mate_rr_labeler_new
mate_rr_labeler_hide
mate_rr_labeler_get_color_for_output
<SUBSECTION Private>
mate_rr_labeler_get_type
<SUBSECTION Standard>
MATE_RR_LABELER
MATE_IS_RR_LABELER
MATE_TYPE_RR_LABELER
MATE_RR_LABELER_CLASS
MATE_IS_RR_LABELER_CLASS
MATE_RR_LABELER_GET_CLASS
MateRRLabelerClass
</SECTION>
<SECTION>
<INCLUDE>mate-desktop-item.h</INCLUDE>
<FILE>mate-desktop-item</FILE>
<TITLE>MateDesktopItem</TITLE>
MateDesktopItemType
MateDesktopItemStatus
MateDesktopItem
MATE_DESKTOP_ITEM_ENCODING
MATE_DESKTOP_ITEM_VERSION
MATE_DESKTOP_ITEM_NAME
MATE_DESKTOP_ITEM_GENERIC_NAME
MATE_DESKTOP_ITEM_TYPE
MATE_DESKTOP_ITEM_FILE_PATTERN
MATE_DESKTOP_ITEM_TRY_EXEC
MATE_DESKTOP_ITEM_NO_DISPLAY
MATE_DESKTOP_ITEM_COMMENT
MATE_DESKTOP_ITEM_EXEC
MATE_DESKTOP_ITEM_ACTIONS
MATE_DESKTOP_ITEM_ICON
MATE_DESKTOP_ITEM_MINI_ICON
MATE_DESKTOP_ITEM_HIDDEN
MATE_DESKTOP_ITEM_PATH
MATE_DESKTOP_ITEM_TERMINAL
MATE_DESKTOP_ITEM_TERMINAL_OPTIONS
MATE_DESKTOP_ITEM_SWALLOW_TITLE
MATE_DESKTOP_ITEM_SWALLOW_EXEC
MATE_DESKTOP_ITEM_MIME_TYPE
MATE_DESKTOP_ITEM_PATTERNS
MATE_DESKTOP_ITEM_DEFAULT_APP
MATE_DESKTOP_ITEM_DEV
MATE_DESKTOP_ITEM_FS_TYPE
MATE_DESKTOP_ITEM_MOUNT_POINT
MATE_DESKTOP_ITEM_READ_ONLY
MATE_DESKTOP_ITEM_UNMOUNT_ICON
MATE_DESKTOP_ITEM_SORT_ORDER
MATE_DESKTOP_ITEM_URL
MATE_DESKTOP_ITEM_DOC_PATH
MATE_DESKTOP_ITEM_CATEGORIES
MATE_DESKTOP_ITEM_ONLY_SHOW_IN
MateDesktopItemLoadFlags
MateDesktopItemLaunchFlags
MateDesktopItemIconFlags
MateDesktopItemError
MATE_DESKTOP_ITEM_ERROR
mate_desktop_item_new
mate_desktop_item_new_from_file
mate_desktop_item_new_from_uri
mate_desktop_item_new_from_string
mate_desktop_item_new_from_basename
mate_desktop_item_copy
mate_desktop_item_save
mate_desktop_item_ref
mate_desktop_item_unref
mate_desktop_item_launch
mate_desktop_item_launch_with_env
mate_desktop_item_launch_on_screen
mate_desktop_item_drop_uri_list
mate_desktop_item_drop_uri_list_with_env
mate_desktop_item_exists
mate_desktop_item_get_entry_type
mate_desktop_item_set_entry_type
mate_desktop_item_get_location
mate_desktop_item_set_location
mate_desktop_item_set_location_file
mate_desktop_item_get_file_status
mate_desktop_item_get_icon
mate_desktop_item_find_icon
mate_desktop_item_attr_exists
mate_desktop_item_get_string
mate_desktop_item_set_string
mate_desktop_item_get_attr_locale
mate_desktop_item_get_localestring
mate_desktop_item_get_localestring_lang
mate_desktop_item_get_languages
mate_desktop_item_set_localestring
mate_desktop_item_set_localestring_lang
mate_desktop_item_clear_localestring
mate_desktop_item_get_strings
mate_desktop_item_set_strings
mate_desktop_item_get_boolean
mate_desktop_item_set_boolean
mate_desktop_item_set_launch_time
mate_desktop_item_clear_attr
mate_desktop_item_clear_section
<SUBSECTION Standard>
MATE_TYPE_DESKTOP_ITEM
mate_desktop_item_get_type
<SUBSECTION Private>
mate_desktop_item_error_quark
</SECTION>
<SECTION>
<INCLUDE>mate-thumbnail.h</INCLUDE>
<FILE>mate-desktop-thumbnail</FILE>
<TITLE>Miscellaneous Thumbnail Functions</TITLE>
mate_desktop_thumbnail_has_uri
mate_desktop_thumbnail_is_valid
mate_desktop_thumbnail_path_for_uri
</SECTION>
<SECTION>
<INCLUDE>mate-thumbnail.h</INCLUDE>
<FILE>mate-desktop-thumbnail-factory</FILE>
<TITLE>MateDesktopThumbnailFactory</TITLE>
MateDesktopThumbnailFactory
MateDesktopThumbnailSize
mate_desktop_thumbnail_factory_new
mate_desktop_thumbnail_factory_lookup
mate_desktop_thumbnail_factory_has_valid_failed_thumbnail
mate_desktop_thumbnail_factory_can_thumbnail
mate_desktop_thumbnail_factory_generate_thumbnail
mate_desktop_thumbnail_factory_save_thumbnail
mate_desktop_thumbnail_factory_create_failed_thumbnail
<SUBSECTION Private>
MateDesktopThumbnailFactoryPrivate
mate_desktop_thumbnail_factory_get_type
<SUBSECTION Standard>
MATE_DESKTOP_THUMBNAIL_FACTORY
MATE_DESKTOP_IS_THUMBNAIL_FACTORY
MATE_DESKTOP_TYPE_THUMBNAIL_FACTORY
MATE_DESKTOP_THUMBNAIL_FACTORY_CLASS
MATE_DESKTOP_IS_THUMBNAIL_FACTORY_CLASS
MateDesktopThumbnailFactoryClass
</SECTION>
<SECTION>
<FILE>mate-languages</FILE>
<TITLE>Language Utilities</TITLE>
mate_get_all_locales
mate_get_country_from_code
mate_get_country_from_locale
mate_get_language_from_code
mate_get_language_from_locale
mate_normalize_locale
mate_parse_locale
mate_language_has_translations
</SECTION>
<SECTION>
<INCLUDE>mate-desktop-utils.h</INCLUDE>
<FILE>mate-desktop-utils</FILE>
<TITLE>Miscellaneous Functions</TITLE>
mate_desktop_prepend_terminal_to_vector
</SECTION>
<SECTION>
<FILE>mate-hsv</FILE>
<TITLE>MateHSV</TITLE>
MateHSV
mate_hsv_new
mate_hsv_set_color
mate_hsv_get_color
mate_hsv_set_metrics
mate_hsv_get_metrics
mate_hsv_is_adjusting
<SUBSECTION Standard>
MATE_TYPE_HSV
MATE_HSV
MATE_HSV_CLASS
MATE_IS_HSV
MATE_IS_HSV_CLASS
MATE_HSV_GET_CLASS
<SUBSECTION Private>
MateHSVPrivate
mate_hsv_get_type
</SECTION>

View File

@ -0,0 +1,9 @@
#include <mate-desktop-item.h>
#include <mate-bg.h>
#include <mate-desktop-thumbnail.h>
#include <mate-rr-labeler.h>
mate_desktop_item_get_type
mate_bg_get_type
mate_desktop_thumbnail_factory_get_type
mate_rr_labeler_get_type

View File

@ -0,0 +1,7 @@
gnome.gtkdoc(
'mate-desktop',
src_dir: 'libmate-desktop',
main_sgml: 'mate-desktop-docs.sgml',
scan_args: '--deprecated-guards="MATE_DISABLE_DEPRECATED"',
mkdb_args: ['--sgml-mode', '--output-format=xml'],
)

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 896 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

43
icons/Makefile.am Normal file
View File

@ -0,0 +1,43 @@
iconsdir = $(datadir)/icons/hicolor
png_icons = \
16x16/apps/mate-desktop.png \
22x22/apps/mate-desktop.png \
24x24/apps/mate-desktop.png \
32x32/apps/mate-desktop.png \
48x48/apps/mate-desktop.png \
128x128/apps/mate-desktop.png
nobase_dist_icons_DATA = \
$(png_icons) \
scalable/apps/mate-desktop.svg \
scalable/apps/mate-desktop-symbolic.svg
gtk_update_icon_cache = gtk-update-icon-cache -f -t $(datadir)/icons/hicolor
.PHONY: build-png-icons clean-png-icons
install-data-hook: update-icon-cache
uninstall-hook: update-icon-cache
update-icon-cache:
@-if test -z "$(DESTDIR)"; then \
echo "Updating Gtk icon cache."; \
$(gtk_update_icon_cache); \
else \
echo "*** Icon cache not updated. After (un)install, run this:"; \
echo "*** $(gtk_update_icon_cache)"; \
fi
if HAVE_RSVG_CONVERT
build-png-icons:
$(RSVG_CONVERT) -w 16 -h 16 scalable/apps/mate-desktop.svg -o 16x16/apps/mate-desktop.png
$(RSVG_CONVERT) -w 22 -h 22 scalable/apps/mate-desktop.svg -o 22x22/apps/mate-desktop.png
$(RSVG_CONVERT) -w 24 -h 24 scalable/apps/mate-desktop.svg -o 24x24/apps/mate-desktop.png
$(RSVG_CONVERT) -w 32 -h 32 scalable/apps/mate-desktop.svg -o 32x32/apps/mate-desktop.png
$(RSVG_CONVERT) -w 48 -h 48 scalable/apps/mate-desktop.svg -o 48x48/apps/mate-desktop.png
$(RSVG_CONVERT) -w 128 -h 128 scalable/apps/mate-desktop.svg -o 128x128/apps/mate-desktop.png
endif
clean-png-icons:
rm -f $(png_icons)

17
icons/meson.build Normal file
View File

@ -0,0 +1,17 @@
icons = [
'16x16/apps/mate-desktop.png',
'22x22/apps/mate-desktop.png',
'24x24/apps/mate-desktop.png',
'32x32/apps/mate-desktop.png',
'48x48/apps/mate-desktop.png',
'128x128/apps/mate-desktop.png',
'scalable/apps/mate-desktop.svg',
'scalable/apps/mate-desktop-symbolic.svg',
]
foreach i : icons
dir = i.split('/')
install_data(i,
install_dir: join_paths('share/icons/hicolor', dir[0], dir[1]),
)
endforeach

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg id="svg2" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.w3.org/2000/svg" height="16" width="16" version="1.0" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/">
<metadata id="metadata7">
<rdf:RDF>
<cc:Work rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
<dc:title/>
</cc:Work>
</rdf:RDF>
</metadata>
<g id="layer2" display="none" transform="translate(0,-6)">
<rect id="rect4898" fill-rule="nonzero" height="22" width="22" y="0" x="0" fill="#333"/>
</g>
<g id="layer3" display="none" transform="translate(0,-6)">
<rect id="rect4126" fill-rule="nonzero" height="22" width="22" y="0" x="0" fill="#efebe7"/>
</g>
<g id="layer1" transform="matrix(1.0319689,0,0,1.0563566,-0.69397664,-6.778957)" stroke-miterlimit="4" stroke-width="0" fill="#bebebe">
<path id="path5070" fill-rule="evenodd" d="m1.6415,10.204,6.7832,3.7866-6.7832,3.7866z"/>
<path id="path5067" d="m15.208,13.991c0-3.658-3.131-6.6271-6.7834-6.6271-2.109,0-4.1361,1.0094-5.348,2.5503l0.85177,0.47616c1.034-1.2658,2.7359-2.0798,4.4963-2.0798,3.1115-1E-7,5.8141,2.5683,5.8141,5.6799,0,3.1115-2.7025,5.6799-5.8141,5.6799-1.7553,0-3.5475-0.92376-4.5815-2.183l-0.84886,0.47427c1.2122,1.5345,3.3264,2.6554,5.4304,2.6554,3.6524,0,6.7832-2.9686,6.7832-6.6266z"/>
<path id="path5648" d="m12.301,13.99c0-2.2361-1.64-3.7866-3.8761-3.7866-1.1905,0-2.0368,0.32699-2.7782,1.1454l0.8789,0.49036c0.55229-0.54547,1.065-0.68916,1.8993-0.68916,1.6896,0,2.9071,1.1392,2.9071,2.84s-1.2175,2.84-2.9071,2.84c-0.84982,0-1.4491-0.21841-2.0039-0.78193l-0.86824,0.48468c0.74137,0.81851,1.6817,1.2439,2.8722,1.2439,2.2361,0,3.8761-1.5505,3.8761-3.7866z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -0,0 +1,213 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="48"
height="48"
id="svg4908"
sodipodi:version="0.32"
inkscape:version="0.92.4 (unknown)"
version="1.0"
sodipodi:docname="hicolor_apps_scalable_mate-desktop.svg"
inkscape:output_extension="org.inkscape.output.svg.inkscape"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90">
<defs
id="defs4910">
<linearGradient
inkscape:collect="always"
id="linearGradient843">
<stop
style="stop-color:#000000;stop-opacity:1;"
offset="0"
id="stop839" />
<stop
style="stop-color:#000000;stop-opacity:0;"
offset="1"
id="stop841" />
</linearGradient>
<linearGradient
inkscape:collect="always"
id="linearGradient5671">
<stop
style="stop-color:#729fcf;stop-opacity:1;"
offset="0"
id="stop5673" />
<stop
style="stop-color:#3465a4;stop-opacity:1"
offset="1"
id="stop5675" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient5671"
id="linearGradient5677"
x1="10.915961"
y1="14.010388"
x2="10.915961"
y2="18.908218"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(2.3340955,0,0,2.0797356,-1.8209963,2.8226078)" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient5671"
id="linearGradient3022"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(2.3340955,0,0,2.0797356,-1.8209963,2.8226078)"
x1="10.915961"
y1="14.010388"
x2="10.915961"
y2="18.908218" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient843"
id="radialGradient845"
cx="11.290492"
cy="27.580482"
fx="11.290492"
fy="27.580482"
r="8.0507952"
gradientTransform="matrix(1,-5.1281785e-8,1.3609903e-8,0.75173751,-3.7536768e-7,1.6938011)"
gradientUnits="userSpaceOnUse" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient843"
id="radialGradient844"
cx="11.290492"
cy="30.204"
fx="11.290492"
fy="30.204"
r="10.938261"
gradientTransform="matrix(1,-3.2076224e-8,2.4031881e-8,0.55329498,-5.7256253e-7,5.7153623)"
gradientUnits="userSpaceOnUse" />
<filter
inkscape:collect="always"
style="color-interpolation-filters:sRGB"
id="filter998"
x="-0.12009572"
width="1.2401914"
y="-0.64533364"
height="2.2906673">
<feGaussianBlur
inkscape:collect="always"
stdDeviation="0.69743089"
id="feGaussianBlur1000" />
</filter>
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="8"
inkscape:cx="-15.875"
inkscape:cy="32.975858"
inkscape:current-layer="layer1"
showgrid="true"
inkscape:grid-bbox="true"
inkscape:document-units="px"
width="48px"
height="48px"
inkscape:window-width="1680"
inkscape:window-height="975"
inkscape:window-x="0"
inkscape:window-y="25"
inkscape:window-maximized="1">
<inkscape:grid
type="xygrid"
id="grid5068" />
</sodipodi:namedview>
<metadata
id="metadata4913">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<g
id="layer1"
inkscape:label="Layer 1"
inkscape:groupmode="layer">
<rect
style="opacity:0.734;fill:url(#radialGradient844);fill-opacity:1;stroke:url(#radialGradient845);stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;filter:url(#filter998)"
id="rect5679"
width="13.9375"
height="2.59375"
x="4.03125"
y="18.96875"
rx="0.4498865"
ry="0.63501096"
transform="matrix(1.9466154,0,0,1.1566261,3.0217545,21.060249)" />
<path
inkscape:connector-curvature="0"
style="opacity:0.19444442;fill:none;stroke:#ffffff;stroke-width:1px;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1"
d="m 37.756513,11.747296 c 0,0 5.140615,5.035338 5.157002,12.720854 0.01653,7.751769 -5.355349,12.985871 -5.355349,12.985871"
id="path5667"
sodipodi:nodetypes="czc" />
<path
inkscape:connector-curvature="0"
style="opacity:0.18981479;fill:none;stroke:#ffffff;stroke-width:1px;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1"
d="m 30.616047,16.915142 c 0,0 3.686577,2.501111 3.636349,7.685516 -0.04959,5.118158 -3.636349,7.28799 -3.636349,7.28799"
id="path5669"
sodipodi:nodetypes="czc" />
<path
inkscape:connector-curvature="0"
style="fill:#87a556;fill-opacity:1;fill-rule:evenodd;stroke:#5a6943;stroke-width:0.99999987999999995px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 3.033391,11.648109 24.671136,24.418378 3.016816,37.198431 3.033391,11.648109 z"
id="path5070" />
<path
inkscape:connector-curvature="0"
style="opacity:0.18055558;fill:none;stroke:#eeeeec;stroke-width:0.99999988px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 4.04192,13.453223 22.5645,24.420891 4.027734,35.311401 4.04192,13.453223 z"
id="path5665"
sodipodi:nodetypes="cccc" />
<path
inkscape:connector-curvature="0"
style="opacity:0.32407406;fill:none;stroke:#ffffff;stroke-width:1px;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1"
d="m 38.153525,11.23664 c 0,0 5.427094,5.46394 5.427094,13.24865 0,7.850944 -5.427094,13.182407 -5.427094,13.182407"
id="path5689"
sodipodi:nodetypes="czc" />
<path
inkscape:connector-curvature="0"
style="opacity:0.32407406;fill:none;stroke:#ffffff;stroke-width:1px;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1"
d="m 33.305222,17.049165 c 0,0 2.779731,2.878431 2.779731,7.220514 0,4.27587 -2.514994,7.220514 -2.514994,7.220514"
id="path5691"
sodipodi:nodetypes="czc" />
<path
inkscape:connector-curvature="0"
style="fill:#87a556;fill-opacity:1;stroke:#5a6943;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
d="m 44.983184,24.545684 c 0,-11.316001 -9.170001,-20.5 -20.46875,-20.5 -6.524212,0 -12.313471,3.0771446 -16.0625,7.84375 l 2.5625,1.625 c 3.198502,-3.9147617 8.085497,-6.40625 13.53125,-6.40625 9.625499,-10e-8 17.4375,7.812 17.4375,17.4375 0,9.6255 -7.812,17.4375 -17.4375,17.4375 -5.430049,0 -10.301145,-2.47967 -13.5,-6.375 l -2.5625,1.625 c 3.749919,4.746873 9.522794,7.8125 16.03125,7.8125 11.29875,0 20.46875,-9.183999 20.46875,-20.5 z"
id="path5067" />
<path
inkscape:connector-curvature="0"
style="fill:#87a556;fill-opacity:1;stroke:#5a6943;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
d="m 37.045684,24.576934 c 0,-6.91725 -5.614001,-12.53125 -12.53125,-12.53125 -3.682751,0 -6.987847,1.592947 -9.28125,4.125 l 2.65625,1.65625 c 1.708502,-1.687387 4.044211,-2.71875 6.625,-2.71875 5.226749,0 9.46875,4.27 9.46875,9.53125 0,5.261251 -4.242001,9.53125 -9.46875,9.53125 -2.628895,10e-7 -5.002549,-1.069255 -6.71875,-2.8125 l -2.5625,1.625 c 2.293403,2.532054 5.598499,4.125001 9.28125,4.125 6.91725,0 12.53125,-5.614 12.53125,-12.53125 z"
id="path5648" />
<path
inkscape:connector-curvature="0"
style="opacity:0.33333333;fill:none;stroke:#eeeeec;stroke-width:1.00000012;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
d="m 10.045238,37.420684 c 3.560547,4.071766 8.326523,6.5625 14.45318,6.5625 10.721091,0 19.422266,-8.721999 19.422266,-19.46875 0,-10.74675 -8.701175,-19.46875 -19.422266,-19.46875 -6.157926,0 -10.831105,2.5141711 -14.452732,6.6875"
id="path5664"
sodipodi:nodetypes="cscsc" />
<path
inkscape:connector-curvature="0"
style="opacity:0.33333333;fill:none;stroke:#eeeeec;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
d="m 16.826934,33.201934 c 2.164413,1.898506 4.331161,2.843749 7.625,2.84375 6.36525,0 11.53125,-5.152 11.53125,-11.5 0,-6.348 -5.166,-11.5 -11.53125,-11.5 -3.309727,0 -5.552652,1.207783 -7.65625,3.125"
id="path5677"
sodipodi:nodetypes="cscsc" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 9.3 KiB

147
libmate-desktop/Makefile.am Normal file
View File

@ -0,0 +1,147 @@
libmate_desktopdir = $(includedir)/mate-desktop-2.0/libmate-desktop
libmate_desktop_HEADERS = \
mate-desktop.h \
mate-desktop-utils.h \
mate-desktop-item.h \
mate-dconf.h \
mate-gsettings.h \
mate-bg.h \
mate-bg-crossfade.h \
mate-desktop-thumbnail.h \
mate-rr.h \
mate-languages.h \
mate-rr-config.h \
mate-rr-labeler.h \
mate-colorbutton.h \
mate-colorsel.h \
mate-hsv.h \
mate-colorseldialog.h
lib_LTLIBRARIES = libmate-desktop-2.la
AM_CPPFLAGS = \
$(MATE_DESKTOP_CFLAGS) \
$(XLIB_CFLAGS) \
$(DCONF_CFLAGS) \
-DG_LOG_DOMAIN=\"MateDesktop\" \
-DMATELOCALEDIR=\""$(localedir)\"" \
-DPNP_IDS=\""$(PNP_IDS)"\" \
-DISO_CODES_PREFIX=\""$(ISO_CODES_PREFIX)"\" \
$(DISABLE_DEPRECATED_CFLAGS)
AM_CFLAGS = $(WARN_CFLAGS)
noinst_PROGRAMS = test-desktop-thumbnail test-ditem test test-languages
CLEANFILES =
introspection_sources = \
mate-desktop-utils.c \
mate-desktop-thumbnail.c \
mate-dconf.c \
mate-gsettings.c \
mate-bg.c \
mate-bg-crossfade.c \
display-name.c \
mate-rr.c \
mate-languages.c \
mate-rr-config.c \
mate-rr-output-info.c \
mate-rr-labeler.c \
mate-colorbutton.c \
mate-colorsel.c \
mate-hsv.c \
mate-colorseldialog.c \
edid-parse.c
libmate_desktop_2_la_SOURCES = \
$(introspection_sources) \
mate-desktop-item.c \
mate-rr-private.h \
edid.h \
private.h
libmate_desktop_2_la_LIBADD = \
$(XLIB_LIBS) \
$(MATE_DESKTOP_LIBS) \
$(DCONF_LIBS)
libmate_desktop_2_la_LDFLAGS = \
-version-info $(LT_VERSION) \
-export-symbols-regex "^mate_.*" \
-no-undefined
test_SOURCES = \
test.c
test_LDADD = \
libmate-desktop-2.la \
$(MATE_DESKTOP_LIBS)
test_desktop_thumbnail_LDADD = \
$(lib_LTLIBRARIES) \
$(MATE_DESKTOP_LIBS) \
$(XLIB_LIBS)
test_ditem_SOURCES = \
test-ditem.c
test_ditem_LDADD = \
libmate-desktop-2.la \
$(XLIB_LIBS) \
$(MATE_DESKTOP_LIBS)
test_languages_SOURCES = test-languages.c
test_languages_LDADD = \
libmate-desktop-2.la \
$(MATE_DESKTOP_LIBS)
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = mate-desktop-2.0.pc
if USE_INTERNAL_PNP_IDS
pnpdatadir = $(datadir)/libmate-desktop
pnpdata_DATA = pnp.ids
endif
pnpdata_DATA_dist = pnp.ids
check:
test -s $(top_srcdir)/libmate-desktop/pnp.ids
-include $(INTROSPECTION_MAKEFILE)
INTROSPECTION_GIRS =
INTROSPECTION_SCANNER_ARGS = --add-include-path=$(srcdir) --warn-all
INTROSPECTION_COMPILER_ARGS = --includedir=$(srcdir)
if HAVE_INTROSPECTION
MateDesktop-2.0.gir: libmate-desktop-2.la
MateDesktop_2_0_gir_INCLUDES = GObject-2.0 Gtk-3.0
MateDesktop_2_0_gir_PACKAGES = gdk-pixbuf-2.0 glib-2.0 gobject-2.0 gio-2.0 gtk+-3.0
MateDesktop_2_0_gir_CFLAGS = -DMATE_DESKTOP_USE_UNSTABLE_API -I$(top_srcdir)
MateDesktop_2_0_gir_LIBS = libmate-desktop-2.la
MateDesktop_2_0_gir_FILES = $(introspection_sources) $(libmate_desktop_HEADERS)
MateDesktop_2_0_gir_SCANNERFLAGS = --identifier-prefix=Mate --symbol-prefix=mate_
INTROSPECTION_SCANNER_ARGS += $(patsubst %,--c-include='libmate-desktop/%',$(libmate_desktop_HEADERS))
INTROSPECTION_GIRS += MateDesktop-2.0.gir
girdir = $(datadir)/gir-1.0
gir_DATA = $(INTROSPECTION_GIRS)
typelibdir = $(libdir)/girepository-1.0
typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib)
CLEANFILES += $(gir_DATA) $(typelib_DATA)
endif
EXTRA_DIST = \
mate-desktop-2.0.pc.in \
mate-desktop-2.0-uninstalled.pc.in \
$(pnpdata_DATA_dist)
MAINTAINERCLEANFILES = \
pnp.ids
-include $(top_srcdir)/git.mk

View File

@ -0,0 +1,302 @@
/*
* Copyright 2007 Red Hat, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* on the rights to use, copy, modify, merge, publish, distribute, sub
* license, and/or sell copies of the Software, and to permit persons to whom
* the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/* Author: Soren Sandmann <sandmann@redhat.com> */
#include <config.h>
#include <glib/gi18n-lib.h>
#include <stdlib.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <glib.h>
#include "edid.h"
typedef struct Vendor Vendor;
struct Vendor {
const char vendor_id[4];
const char vendor_name[28];
};
/* This list of vendor codes derived from lshw
*
* http://ezix.org/project/wiki/HardwareLiSter
*
* Note: we now prefer to use data coming from hwdata (and shipped with
* mate-desktop). See
* http://git.fedorahosted.org/git/?p=hwdata.git;a=blob_plain;f=pnp.ids;hb=HEAD
* All contributions to the list of vendors should go there.
*/
static const struct Vendor vendors[] = {
{"AIC", "AG Neovo"},
{"ACR", "Acer"},
{"DEL", "DELL"},
{"SAM", "SAMSUNG"},
{"SNY", "SONY"},
{"SEC", "Epson"},
{"WAC", "Wacom"},
{"NEC", "NEC"},
{"CMO", "CMO"}, /* Chi Mei */
{"BNQ", "BenQ"},
{"ABP", "Advansys"},
{"ACC", "Accton"},
{"ACE", "Accton"},
{"ADP", "Adaptec"},
{"ADV", "AMD"},
{"AIR", "AIR"},
{"AMI", "AMI"},
{"ASU", "ASUS"},
{"ATI", "ATI"},
{"ATK", "Allied Telesyn"},
{"AZT", "Aztech"},
{"BAN", "Banya"},
{"BRI", "Boca Research"},
{"BUS", "Buslogic"},
{"CCI", "Cache Computers Inc."},
{"CHA", "Chase"},
{"CMD", "CMD Technology, Inc."},
{"COG", "Cogent"},
{"CPQ", "Compaq"},
{"CRS", "Crescendo"},
{"CSC", "Crystal"},
{"CSI", "CSI"},
{"CTL", "Creative Labs"},
{"DBI", "Digi"},
{"DEC", "Digital Equipment"},
{"DBK", "Databook"},
{"EGL", "Eagle Technology"},
{"ELS", "ELSA"},
{"ESS", "ESS"},
{"FAR", "Farallon"},
{"FDC", "Future Domain"},
{"HWP", "Hewlett-Packard"},
{"IBM", "IBM"},
{"INT", "Intel"},
{"ISA", "Iomega"},
{"LEN", "Lenovo"},
{"MDG", "Madge"},
{"MDY", "Microdyne"},
{"MET", "Metheus"},
{"MIC", "Micronics"},
{"MLX", "Mylex"},
{"NVL", "Novell"},
{"OLC", "Olicom"},
{"PRO", "Proteon"},
{"RII", "Racal"},
{"RTL", "Realtek"},
{"SCM", "SCM"},
{"SKD", "SysKonnect"},
{"SGI", "SGI"},
{"SMC", "SMC"},
{"SNI", "Siemens Nixdorf"},
{"STL", "Stallion Technologies"},
{"SUN", "Sun"},
{"SUP", "SupraExpress"},
{"SVE", "SVEC"},
{"TCC", "Thomas-Conrad"},
{"TCI", "Tulip"},
{"TCM", "3Com"},
{"TCO", "Thomas-Conrad"},
{"TEC", "Tecmar"},
{"TRU", "Truevision"},
{"TOS", "Toshiba"},
{"TYN", "Tyan"},
{"UBI", "Ungermann-Bass"},
{"USC", "UltraStor"},
{"VDM", "Vadem"},
{"VMI", "Vermont"},
{"WDC", "Western Digital"},
{"ZDS", "Zeos"},
/* From http://faydoc.tripod.com/structures/01/0136.htm */
{"ACT", "Targa"},
{"ADI", "ADI"},
{"AOC", "AOC Intl"},
{"API", "Acer America"},
{"APP", "Apple Computer"},
{"ART", "ArtMedia"},
{"AST", "AST Research"},
{"CPL", "Compal"},
{"CTX", "Chuntex Electronic Co."},
{"DPC", "Delta Electronics"},
{"DWE", "Daewoo"},
{"ECS", "ELITEGROUP"},
{"EIZ", "EIZO"},
{"FCM", "Funai"},
{"GSM", "LG Electronics"},
{"GWY", "Gateway 2000"},
{"HEI", "Hyundai"},
{"HIT", "Hitachi"},
{"HSL", "Hansol"},
{"HTC", "Hitachi"},
{"ICL", "Fujitsu ICL"},
{"IVM", "Idek Iiyama"},
{"KFC", "KFC Computek"},
{"LKM", "ADLAS"},
{"LNK", "LINK Tech"},
{"LTN", "Lite-On"},
{"MAG", "MAG InnoVision"},
{"MAX", "Maxdata"},
{"MEI", "Panasonic"},
{"MEL", "Mitsubishi"},
{"MIR", "miro"},
{"MTC", "MITAC"},
{"NAN", "NANAO"},
{"NEC", "NEC Tech"},
{"NOK", "Nokia"},
{"OQI", "OPTIQUEST"},
{"PBN", "Packard Bell"},
{"PGS", "Princeton"},
{"PHL", "Philips"},
{"REL", "Relisys"},
{"SDI", "Samtron"},
{"SMI", "Smile"},
{"SPT", "Sceptre"},
{"SRC", "Shamrock Technology"},
{"STP", "Sceptre"},
{"TAT", "Tatung"},
{"TRL", "Royal Information Company"},
{"TSB", "Toshiba, Inc."},
{"UNM", "Unisys"},
{"VSC", "ViewSonic"},
{"WTC", "Wen Tech"},
{"ZCM", "Zenith Data Systems"},
{"???", "Unknown"},
};
static GHashTable* pnp_ids = NULL;
static void read_pnp_ids(void)
{
gchar* contents;
gchar** lines;
gchar* line;
gchar* code, *name;
gint i;
if (pnp_ids)
return;
pnp_ids = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL);
if (g_file_get_contents(PNP_IDS, &contents, NULL, NULL))
{
lines = g_strsplit(contents, "\n", -1);
for (i = 0; lines[i]; i++)
{
line = lines[i];
if (line[0] && line[1] && line[2] && line[3] == '\t' && line[4])
{
code = line;
line[3] = '\0';
name = line + 4;
g_hash_table_insert(pnp_ids, code, name);
}
}
g_free(lines);
g_free(contents);
}
}
static const char* find_vendor(const char* code)
{
const char* vendor_name;
int i;
read_pnp_ids();
vendor_name = g_hash_table_lookup(pnp_ids, code);
if (vendor_name)
return vendor_name;
for (i = 0; i < sizeof(vendors) / sizeof(vendors[0]); ++i)
{
const Vendor* v = &(vendors[i]);
if (strcmp(v->vendor_id, code) == 0)
return v->vendor_name;
}
return code;
}
char* make_display_name(const MonitorInfo* info)
{
const char* vendor;
int width_mm, height_mm, inches;
if (info)
{
vendor = find_vendor(info->manufacturer_code);
}
else
{
/* Translators: "Unknown" here is used to identify a monitor for which
* we don't know the vendor. When a vendor is known, the name of the
* vendor is used. */
vendor = C_("Monitor vendor", "Unknown");
}
if (info && info->width_mm != -1 && info->height_mm)
{
width_mm = info->width_mm;
height_mm = info->height_mm;
}
else if (info && info->n_detailed_timings)
{
width_mm = info->detailed_timings[0].width_mm;
height_mm = info->detailed_timings[0].height_mm;
}
else
{
width_mm = -1;
height_mm = -1;
}
if (width_mm != -1 && height_mm != -1)
{
double d = sqrt (width_mm * width_mm + height_mm * height_mm);
inches = (int) (d / 25.4 + 0.5);
}
else
{
inches = -1;
}
if (inches > 0)
{
return g_strdup_printf("%s %d\"", vendor, inches);
}
else
{
return g_strdup(vendor);
}
}

View File

@ -0,0 +1,536 @@
/*
* Copyright 2007 Red Hat, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* on the rights to use, copy, modify, merge, publish, distribute, sub
* license, and/or sell copies of the Software, and to permit persons to whom
* the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/* Author: Soren Sandmann <sandmann@redhat.com> */
#include "edid.h"
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <glib.h>
static int get_bit(int in, int bit)
{
return (in & (1 << bit)) >> bit;
}
static int get_bits(int in, int begin, int end)
{
int mask = (1 << (end - begin + 1)) - 1;
return (in >> begin) & mask;
}
static int decode_header(const uchar* edid)
{
if (memcmp(edid, "\x00\xff\xff\xff\xff\xff\xff\x00", 8) == 0)
{
return TRUE;
}
return FALSE;
}
static int decode_vendor_and_product_identification(const uchar* edid, MonitorInfo* info)
{
int is_model_year;
/* Manufacturer Code */
info->manufacturer_code[0] = get_bits(edid[0x08], 2, 6);
info->manufacturer_code[1] = get_bits(edid[0x08], 0, 1) << 3;
info->manufacturer_code[1] |= get_bits(edid[0x09], 5, 7);
info->manufacturer_code[2] = get_bits(edid[0x09], 0, 4);
info->manufacturer_code[3] = '\0';
info->manufacturer_code[0] += 'A' - 1;
info->manufacturer_code[1] += 'A' - 1;
info->manufacturer_code[2] += 'A' - 1;
/* Product Code */
info->product_code = edid[0x0b] << 8 | edid[0x0a];
/* Serial Number */
info->serial_number = edid[0x0c] | edid[0x0d] << 8 | edid[0x0e] << 16 | edid[0x0f] << 24;
/* Week and Year */
is_model_year = FALSE;
switch (edid[0x10])
{
case 0x00:
info->production_week = -1;
break;
case 0xff:
info->production_week = -1;
is_model_year = TRUE;
break;
default:
info->production_week = edid[0x10];
break;
}
if (is_model_year)
{
info->production_year = -1;
info->model_year = 1990 + edid[0x11];
}
else
{
info->production_year = 1990 + edid[0x11];
info->model_year = -1;
}
return TRUE;
}
static int decode_edid_version(const uchar* edid, MonitorInfo* info)
{
info->major_version = edid[0x12];
info->minor_version = edid[0x13];
return TRUE;
}
static int decode_display_parameters(const uchar* edid, MonitorInfo* info)
{
/* Digital vs Analog */
info->is_digital = get_bit(edid[0x14], 7);
if (info->is_digital)
{
int bits;
static const int bit_depth[8] = {
-1, 6, 8, 10, 12, 14, 16, -1
};
static const Interface interfaces[6] = {
UNDEFINED, DVI, HDMI_A, HDMI_B, MDDI, DISPLAY_PORT
};
bits = get_bits(edid[0x14], 4, 6);
info->connector.digital.bits_per_primary = bit_depth[bits];
bits = get_bits(edid[0x14], 0, 3);
if (bits <= 5)
{
info->connector.digital.interface = interfaces[bits];
}
else
{
info->connector.digital.interface = UNDEFINED;
}
}
else
{
int bits = get_bits (edid[0x14], 5, 6);
static const double levels[][3] = {
{ 0.7, 0.3, 1.0 },
{ 0.714, 0.286, 1.0 },
{ 1.0, 0.4, 1.4 },
{ 0.7, 0.0, 0.7 },
};
info->connector.analog.video_signal_level = levels[bits][0];
info->connector.analog.sync_signal_level = levels[bits][1];
info->connector.analog.total_signal_level = levels[bits][2];
info->connector.analog.blank_to_black = get_bit (edid[0x14], 4);
info->connector.analog.separate_hv_sync = get_bit (edid[0x14], 3);
info->connector.analog.composite_sync_on_h = get_bit (edid[0x14], 2);
info->connector.analog.composite_sync_on_green = get_bit (edid[0x14], 1);
info->connector.analog.serration_on_vsync = get_bit (edid[0x14], 0);
}
/* Screen Size / Aspect Ratio */
if (edid[0x15] == 0 && edid[0x16] == 0)
{
info->width_mm = -1;
info->height_mm = -1;
info->aspect_ratio = -1.0;
}
else if (edid[0x16] == 0)
{
info->width_mm = -1;
info->height_mm = -1;
info->aspect_ratio = 100.0 / (edid[0x15] + 99);
}
else if (edid[0x15] == 0)
{
info->width_mm = -1;
info->height_mm = -1;
info->aspect_ratio = 100.0 / (edid[0x16] + 99);
info->aspect_ratio = 1/info->aspect_ratio; /* portrait */
}
else
{
info->width_mm = 10 * edid[0x15];
info->height_mm = 10 * edid[0x16];
}
/* Gamma */
if (edid[0x17] == 0xFF)
info->gamma = -1.0;
else
info->gamma = (edid[0x17] + 100.0) / 100.0;
/* Features */
info->standby = get_bit(edid[0x18], 7);
info->suspend = get_bit(edid[0x18], 6);
info->active_off = get_bit(edid[0x18], 5);
if (info->is_digital)
{
info->connector.digital.rgb444 = TRUE;
if (get_bit(edid[0x18], 3))
info->connector.digital.ycrcb444 = 1;
if (get_bit(edid[0x18], 4))
info->connector.digital.ycrcb422 = 1;
}
else
{
int bits = get_bits(edid[0x18], 3, 4);
ColorType color_type[4] = {
MONOCHROME, RGB, OTHER_COLOR, UNDEFINED_COLOR
};
info->connector.analog.color_type = color_type[bits];
}
info->srgb_is_standard = get_bit(edid[0x18], 2);
/* In 1.3 this is called "has preferred timing" */
info->preferred_timing_includes_native = get_bit(edid[0x18], 1);
/* FIXME: In 1.3 this indicates whether the monitor accepts GTF */
info->continuous_frequency = get_bit(edid[0x18], 0);
return TRUE;
}
static double decode_fraction(int high, int low)
{
double result = 0.0;
int i;
high = (high << 2) | low;
for (i = 0; i < 10; ++i)
{
result += get_bit (high, i) * pow (2, i - 10);
}
return result;
}
static int decode_color_characteristics(const uchar* edid, MonitorInfo* info)
{
info->red_x = decode_fraction(edid[0x1b], get_bits(edid[0x19], 6, 7));
info->red_y = decode_fraction(edid[0x1c], get_bits(edid[0x19], 5, 4));
info->green_x = decode_fraction(edid[0x1d], get_bits(edid[0x19], 2, 3));
info->green_y = decode_fraction(edid[0x1e], get_bits(edid[0x19], 0, 1));
info->blue_x = decode_fraction(edid[0x1f], get_bits(edid[0x1a], 6, 7));
info->blue_y = decode_fraction(edid[0x20], get_bits(edid[0x1a], 4, 5));
info->white_x = decode_fraction(edid[0x21], get_bits(edid[0x1a], 2, 3));
info->white_y = decode_fraction(edid[0x22], get_bits(edid[0x1a], 0, 1));
return TRUE;
}
static int decode_established_timings(const uchar* edid, MonitorInfo* info)
{
static const Timing established[][8] = {
{
{800, 600, 60},
{800, 600, 56},
{640, 480, 75},
{640, 480, 72},
{640, 480, 67},
{640, 480, 60},
{720, 400, 88},
{720, 400, 70}
},
{
{1280, 1024, 75},
{1024, 768, 75},
{1024, 768, 70},
{1024, 768, 60},
{1024, 768, 87},
{832, 624, 75},
{800, 600, 75},
{800, 600, 72}
},
{
{0, 0, 0},
{0, 0, 0},
{0, 0, 0},
{0, 0, 0},
{0, 0, 0},
{0, 0, 0},
{0, 0, 0},
{1152, 870, 75}
},
};
int i, j, idx;
idx = 0;
for (i = 0; i < 3; ++i)
{
for (j = 0; j < 8; ++j)
{
int byte = edid[0x23 + i];
if (get_bit (byte, j) && established[i][j].frequency != 0)
{
info->established[idx++] = established[i][j];
}
}
}
return TRUE;
}
static int decode_standard_timings(const uchar* edid, MonitorInfo* info)
{
int i;
for (i = 0; i < 8; i++)
{
int first = edid[0x26 + 2 * i];
int second = edid[0x27 + 2 * i];
if (first != 0x01 && second != 0x01)
{
int w = 8 * (first + 31);
int h = 0;
switch (get_bits(second, 6, 7))
{
case 0x00:
h = (w / 16) * 10;
break;
case 0x01:
h = (w / 4) * 3;
break;
case 0x02:
h = (w / 5) * 4;
break;
case 0x03:
h = (w / 16) * 9;
break;
}
info->standard[i].width = w;
info->standard[i].height = h;
info->standard[i].frequency = get_bits(second, 0, 5) + 60;
}
}
return TRUE;
}
static void decode_lf_string(const uchar* s, int n_chars, char* result)
{
int i;
for (i = 0; i < n_chars; ++i)
{
if (s[i] == 0x0a)
{
*result++ = '\0';
break;
}
else if (s[i] == 0x00)
{
/* Convert embedded 0's to spaces */
*result++ = ' ';
}
else
{
*result++ = s[i];
}
}
}
static void decode_display_descriptor(const uchar* desc, MonitorInfo* info)
{
switch (desc[0x03])
{
case 0xFC:
decode_lf_string (desc + 5, 13, info->dsc_product_name);
break;
case 0xFF:
decode_lf_string (desc + 5, 13, info->dsc_serial_number);
break;
case 0xFE:
decode_lf_string (desc + 5, 13, info->dsc_string);
break;
case 0xFD:
/* Range Limits */
break;
case 0xFB:
/* Color Point */
break;
case 0xFA:
/* Timing Identifications */
break;
case 0xF9:
/* Color Management */
break;
case 0xF8:
/* Timing Codes */
break;
case 0xF7:
/* Established Timings */
break;
case 0x10:
break;
}
}
static void decode_detailed_timing(const uchar* timing, DetailedTiming* detailed)
{
int bits;
StereoType stereo[] = {
NO_STEREO, NO_STEREO, FIELD_RIGHT, FIELD_LEFT,
TWO_WAY_RIGHT_ON_EVEN, TWO_WAY_LEFT_ON_EVEN,
FOUR_WAY_INTERLEAVED, SIDE_BY_SIDE
};
detailed->pixel_clock = (timing[0x00] | timing[0x01] << 8) * 10000;
detailed->h_addr = timing[0x02] | ((timing[0x04] & 0xf0) << 4);
detailed->h_blank = timing[0x03] | ((timing[0x04] & 0x0f) << 8);
detailed->v_addr = timing[0x05] | ((timing[0x07] & 0xf0) << 4);
detailed->v_blank = timing[0x06] | ((timing[0x07] & 0x0f) << 8);
detailed->h_front_porch = timing[0x08] | get_bits(timing[0x0b], 6, 7) << 8;
detailed->h_sync = timing[0x09] | get_bits(timing[0x0b], 4, 5) << 8;
detailed->v_front_porch =
get_bits (timing[0x0a], 4, 7) | get_bits(timing[0x0b], 2, 3) << 4;
detailed->v_sync =
get_bits (timing[0x0a], 0, 3) | get_bits(timing[0x0b], 0, 1) << 4;
detailed->width_mm = timing[0x0c] | get_bits(timing[0x0e], 4, 7) << 8;
detailed->height_mm = timing[0x0d] | get_bits(timing[0x0e], 0, 3) << 8;
detailed->right_border = timing[0x0f];
detailed->top_border = timing[0x10];
detailed->interlaced = get_bit(timing[0x11], 7);
/* Stereo */
bits = get_bits (timing[0x11], 5, 6) << 1 | get_bit(timing[0x11], 0);
detailed->stereo = stereo[bits];
/* Sync */
bits = timing[0x11];
detailed->digital_sync = get_bit(bits, 4);
if (detailed->digital_sync)
{
detailed->connector.digital.composite = !get_bit(bits, 3);
if (detailed->connector.digital.composite)
{
detailed->connector.digital.serrations = get_bit(bits, 2);
detailed->connector.digital.negative_vsync = FALSE;
}
else
{
detailed->connector.digital.serrations = FALSE;
detailed->connector.digital.negative_vsync = !get_bit(bits, 2);
}
detailed->connector.digital.negative_hsync = !get_bit(bits, 0);
}
else
{
detailed->connector.analog.bipolar = get_bit(bits, 3);
detailed->connector.analog.serrations = get_bit(bits, 2);
detailed->connector.analog.sync_on_green = !get_bit(bits, 1);
}
}
static int decode_descriptors(const uchar* edid, MonitorInfo* info)
{
int i;
int timing_idx;
timing_idx = 0;
for (i = 0; i < 4; ++i)
{
int index = 0x36 + i * 18;
if (edid[index + 0] == 0x00 && edid[index + 1] == 0x00)
{
decode_display_descriptor(edid + index, info);
}
else
{
decode_detailed_timing(edid + index, &(info->detailed_timings[timing_idx++]));
}
}
info->n_detailed_timings = timing_idx;
return TRUE;
}
static void decode_check_sum(const uchar* edid, MonitorInfo* info)
{
int i;
uchar check = 0;
for (i = 0; i < 128; ++i)
{
check += edid[i];
}
info->checksum = check;
}
MonitorInfo* decode_edid(const uchar* edid)
{
MonitorInfo* info = g_new0(MonitorInfo, 1);
decode_check_sum(edid, info);
if (decode_header(edid) && decode_vendor_and_product_identification(edid, info) && decode_edid_version(edid, info) && decode_display_parameters(edid, info) && decode_color_characteristics(edid, info) && decode_established_timings(edid, info) && decode_standard_timings(edid, info) && decode_descriptors(edid, info))
{
return info;
}
else
{
g_free(info);
return NULL;
}
}

184
libmate-desktop/edid.h Normal file
View File

@ -0,0 +1,184 @@
/* edid.h
*
* Copyright 2007, 2008, Red Hat, Inc.
*
* This file is part of the Mate Library.
*
* The Mate Library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* The Mate 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with the Mate Library; see the file COPYING.LIB. If not,
* write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
* Author: Soren Sandmann <sandmann@redhat.com>
*/
#ifndef EDID_H
#define EDID_H
typedef unsigned char uchar;
typedef struct MonitorInfo MonitorInfo;
typedef struct Timing Timing;
typedef struct DetailedTiming DetailedTiming;
typedef enum {
UNDEFINED,
DVI,
HDMI_A,
HDMI_B,
MDDI,
DISPLAY_PORT
} Interface;
typedef enum {
UNDEFINED_COLOR,
MONOCHROME,
RGB,
OTHER_COLOR
} ColorType;
typedef enum {
NO_STEREO,
FIELD_RIGHT,
FIELD_LEFT,
TWO_WAY_RIGHT_ON_EVEN,
TWO_WAY_LEFT_ON_EVEN,
FOUR_WAY_INTERLEAVED,
SIDE_BY_SIDE
} StereoType;
struct Timing {
int width;
int height;
int frequency;
};
struct DetailedTiming {
int pixel_clock;
int h_addr;
int h_blank;
int h_sync;
int h_front_porch;
int v_addr;
int v_blank;
int v_sync;
int v_front_porch;
int width_mm;
int height_mm;
int right_border;
int top_border;
int interlaced;
StereoType stereo;
int digital_sync;
union {
struct {
int bipolar;
int serrations;
int sync_on_green;
} analog;
struct {
int composite;
int serrations;
int negative_vsync;
int negative_hsync;
} digital;
} connector;
};
struct MonitorInfo {
int checksum;
char manufacturer_code[4];
int product_code;
unsigned int serial_number;
int production_week; /* -1 if not specified */
int production_year; /* -1 if not specified */
int model_year; /* -1 if not specified */
int major_version;
int minor_version;
int is_digital;
union {
struct {
int bits_per_primary;
Interface interface;
int rgb444;
int ycrcb444;
int ycrcb422;
} digital;
struct {
double video_signal_level;
double sync_signal_level;
double total_signal_level;
int blank_to_black;
int separate_hv_sync;
int composite_sync_on_h;
int composite_sync_on_green;
int serration_on_vsync;
ColorType color_type;
} analog;
} connector;
int width_mm; /* -1 if not specified */
int height_mm; /* -1 if not specified */
double aspect_ratio; /* -1.0 if not specififed */
double gamma; /* -1.0 if not specified */
int standby;
int suspend;
int active_off;
int srgb_is_standard;
int preferred_timing_includes_native;
int continuous_frequency;
double red_x;
double red_y;
double green_x;
double green_y;
double blue_x;
double blue_y;
double white_x;
double white_y;
Timing established[24]; /* Terminated by 0x0x0 */
Timing standard[8];
int n_detailed_timings;
DetailedTiming detailed_timings[4];
/* If monitor has a preferred
* mode, it is the first one
* (whether it has, is
* determined by the
* preferred_timing_includes
* bit.
*/
/* Optional product description */
char dsc_serial_number[14];
char dsc_product_name[14];
char dsc_string[14]; /* Unspecified ASCII data */
};
MonitorInfo* decode_edid(const uchar* data);
char* make_display_name(const MonitorInfo* info);
#endif /* !EDID_H */

View File

@ -0,0 +1,753 @@
/* mate-bg-crossfade.h - fade window background between two surfaces
*
* Copyright (C) 2008 Red Hat, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library 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.
*
* Author: Ray Strode <rstrode@redhat.com>
*/
#include <string.h>
#include <math.h>
#include <stdarg.h>
#include <gio/gio.h>
#include <gdk/gdk.h>
#include <gdk/gdkx.h>
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#include <gtk/gtk.h>
#include <cairo.h>
#include <cairo-xlib.h>
#define MATE_DESKTOP_USE_UNSTABLE_API
#include <mate-bg.h>
#include "mate-bg-crossfade.h"
struct _MateBGCrossfadePrivate
{
GdkWindow *window;
GtkWidget *widget;
int width;
int height;
cairo_surface_t *fading_surface;
cairo_surface_t *start_surface;
cairo_surface_t *end_surface;
gdouble start_time;
gdouble total_duration;
guint timeout_id;
guint is_first_frame : 1;
};
enum {
PROP_0,
PROP_WIDTH,
PROP_HEIGHT,
};
enum {
FINISHED,
NUMBER_OF_SIGNALS
};
static guint signals[NUMBER_OF_SIGNALS] = { 0 };
G_DEFINE_TYPE_WITH_PRIVATE (MateBGCrossfade, mate_bg_crossfade, G_TYPE_OBJECT)
static void
mate_bg_crossfade_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec)
{
MateBGCrossfade *fade;
g_assert (MATE_IS_BG_CROSSFADE (object));
fade = MATE_BG_CROSSFADE (object);
switch (property_id)
{
case PROP_WIDTH:
fade->priv->width = g_value_get_int (value);
break;
case PROP_HEIGHT:
fade->priv->height = g_value_get_int (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
static void
mate_bg_crossfade_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec)
{
MateBGCrossfade *fade;
g_assert (MATE_IS_BG_CROSSFADE (object));
fade = MATE_BG_CROSSFADE (object);
switch (property_id)
{
case PROP_WIDTH:
g_value_set_int (value, fade->priv->width);
break;
case PROP_HEIGHT:
g_value_set_int (value, fade->priv->height);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
static void
mate_bg_crossfade_finalize (GObject *object)
{
MateBGCrossfade *fade;
fade = MATE_BG_CROSSFADE (object);
mate_bg_crossfade_stop (fade);
if (fade->priv->fading_surface != NULL) {
cairo_surface_destroy (fade->priv->fading_surface);
fade->priv->fading_surface = NULL;
}
if (fade->priv->start_surface != NULL) {
cairo_surface_destroy (fade->priv->start_surface);
fade->priv->start_surface = NULL;
}
if (fade->priv->end_surface != NULL) {
cairo_surface_destroy (fade->priv->end_surface);
fade->priv->end_surface = NULL;
}
}
static void
mate_bg_crossfade_class_init (MateBGCrossfadeClass *fade_class)
{
GObjectClass *gobject_class;
gobject_class = G_OBJECT_CLASS (fade_class);
gobject_class->get_property = mate_bg_crossfade_get_property;
gobject_class->set_property = mate_bg_crossfade_set_property;
gobject_class->finalize = mate_bg_crossfade_finalize;
/**
* MateBGCrossfade:width:
*
* When a crossfade is running, this is width of the fading
* surface.
*/
g_object_class_install_property (gobject_class,
PROP_WIDTH,
g_param_spec_int ("width",
"Window Width",
"Width of window to fade",
0, G_MAXINT, 0,
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
/**
* MateBGCrossfade:height:
*
* When a crossfade is running, this is height of the fading
* surface.
*/
g_object_class_install_property (gobject_class,
PROP_HEIGHT,
g_param_spec_int ("height", "Window Height",
"Height of window to fade on",
0, G_MAXINT, 0,
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
/**
* MateBGCrossfade::finished:
* @fade: the #MateBGCrossfade that received the signal
* @window: the #GdkWindow the crossfade happend on.
*
* When a crossfade finishes, @window will have a copy
* of the end surface as its background, and this signal will
* get emitted.
*/
signals[FINISHED] = g_signal_new ("finished",
G_OBJECT_CLASS_TYPE (gobject_class),
G_SIGNAL_RUN_LAST, 0, NULL, NULL,
g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE, 1, G_TYPE_OBJECT);
}
static void
mate_bg_crossfade_init (MateBGCrossfade *fade)
{
fade->priv = mate_bg_crossfade_get_instance_private (fade);
fade->priv->window = NULL;
fade->priv->widget = NULL;
fade->priv->fading_surface = NULL;
fade->priv->start_surface = NULL;
fade->priv->end_surface = NULL;
fade->priv->timeout_id = 0;
}
/**
* mate_bg_crossfade_new:
* @width: The width of the crossfading window
* @height: The height of the crossfading window
*
* Creates a new object to manage crossfading a
* window background between two #cairo_surface_ts.
*
* Return value: the new #MateBGCrossfade
**/
MateBGCrossfade* mate_bg_crossfade_new (int width, int height)
{
GObject* object;
object = g_object_new(MATE_TYPE_BG_CROSSFADE,
"width", width,
"height", height,
NULL);
return (MateBGCrossfade*) object;
}
static cairo_surface_t *
tile_surface (cairo_surface_t *surface,
int width,
int height)
{
cairo_surface_t *copy;
cairo_t *cr;
if (surface == NULL)
{
copy = gdk_window_create_similar_surface (gdk_get_default_root_window (),
CAIRO_CONTENT_COLOR,
width, height);
}
else
{
copy = cairo_surface_create_similar (surface,
cairo_surface_get_content (surface),
width, height);
}
cr = cairo_create (copy);
if (surface != NULL)
{
cairo_pattern_t *pattern;
cairo_set_source_surface (cr, surface, 0.0, 0.0);
pattern = cairo_get_source (cr);
cairo_pattern_set_extend (pattern, CAIRO_EXTEND_REPEAT);
}
else
{
static GtkCssProvider *provider = NULL;
GtkStyleContext *context;
GdkRGBA bg;
if (provider == NULL)
provider = gtk_css_provider_new ();
context = gtk_style_context_new ();
gtk_style_context_add_provider (context,
GTK_STYLE_PROVIDER (provider),
GTK_STYLE_PROVIDER_PRIORITY_THEME);
gtk_style_context_get_background_color (context, GTK_STATE_FLAG_NORMAL, &bg);
gdk_cairo_set_source_rgba(cr, &bg);
g_object_unref (G_OBJECT (context));
}
cairo_paint (cr);
if (cairo_status (cr) != CAIRO_STATUS_SUCCESS)
{
cairo_surface_destroy (copy);
copy = NULL;
}
cairo_destroy(cr);
return copy;
}
/**
* mate_bg_crossfade_set_start_surface:
* @fade: a #MateBGCrossfade
* @surface: The cairo surface to fade from
*
* Before initiating a crossfade with mate_bg_crossfade_start()
* a start and end surface have to be set. This function sets
* the surface shown at the beginning of the crossfade effect.
*
* Return value: %TRUE if successful, or %FALSE if the surface
* could not be copied.
**/
gboolean
mate_bg_crossfade_set_start_surface (MateBGCrossfade* fade, cairo_surface_t *surface)
{
g_return_val_if_fail (MATE_IS_BG_CROSSFADE (fade), FALSE);
if (fade->priv->start_surface != NULL)
{
cairo_surface_destroy (fade->priv->start_surface);
fade->priv->start_surface = NULL;
}
fade->priv->start_surface = tile_surface (surface,
fade->priv->width,
fade->priv->height);
return fade->priv->start_surface != NULL;
}
static gdouble
get_current_time (void)
{
const double microseconds_per_second = (double) G_USEC_PER_SEC;
double timestamp;
GTimeVal now;
g_get_current_time (&now);
timestamp = ((microseconds_per_second * now.tv_sec) + now.tv_usec) /
microseconds_per_second;
return timestamp;
}
/**
* mate_bg_crossfade_set_end_surface:
* @fade: a #MateBGCrossfade
* @surface: The cairo surface to fade to
*
* Before initiating a crossfade with mate_bg_crossfade_start()
* a start and end surface have to be set. This function sets
* the surface shown at the end of the crossfade effect.
*
* Return value: %TRUE if successful, or %FALSE if the surface
* could not be copied.
**/
gboolean
mate_bg_crossfade_set_end_surface (MateBGCrossfade* fade, cairo_surface_t *surface)
{
g_return_val_if_fail (MATE_IS_BG_CROSSFADE (fade), FALSE);
if (fade->priv->end_surface != NULL) {
cairo_surface_destroy (fade->priv->end_surface);
fade->priv->end_surface = NULL;
}
fade->priv->end_surface = tile_surface (surface,
fade->priv->width,
fade->priv->height);
/* Reset timer in case we're called while animating
*/
fade->priv->start_time = get_current_time ();
return fade->priv->end_surface != NULL;
}
static gboolean
animations_are_disabled (MateBGCrossfade *fade)
{
GtkSettings *settings;
GdkScreen *screen;
gboolean are_enabled;
g_assert (fade->priv->window != NULL);
screen = gdk_window_get_screen(fade->priv->window);
settings = gtk_settings_get_for_screen (screen);
g_object_get (settings, "gtk-enable-animations", &are_enabled, NULL);
return !are_enabled;
}
static void
send_root_property_change_notification (MateBGCrossfade *fade)
{
long zero_length_pixmap = 0;
/* We do a zero length append to force a change notification,
* without changing the value */
XChangeProperty (GDK_WINDOW_XDISPLAY (fade->priv->window),
GDK_WINDOW_XID (fade->priv->window),
gdk_x11_get_xatom_by_name ("_XROOTPMAP_ID"),
XA_PIXMAP, 32, PropModeAppend,
(unsigned char *) &zero_length_pixmap, 0);
}
static void
draw_background (MateBGCrossfade *fade)
{
if (fade->priv->widget != NULL) {
gtk_widget_queue_draw (fade->priv->widget);
} else if (gdk_window_get_window_type (fade->priv->window) != GDK_WINDOW_ROOT) {
cairo_t *cr;
cairo_region_t *region;
GdkDrawingContext *draw_context;
region = gdk_window_get_visible_region (fade->priv->window);
draw_context = gdk_window_begin_draw_frame (fade->priv->window,
region);
cr = gdk_drawing_context_get_cairo_context (draw_context);
cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
cairo_set_source_surface (cr, fade->priv->fading_surface, 0, 0);
cairo_paint (cr);
gdk_window_end_draw_frame (fade->priv->window, draw_context);
cairo_region_destroy (region);
} else {
Display *xdisplay = GDK_WINDOW_XDISPLAY (fade->priv->window);
GdkDisplay *display;
display = gdk_display_get_default ();
gdk_x11_display_error_trap_push (display);
XGrabServer (xdisplay);
XClearWindow (xdisplay, GDK_WINDOW_XID (fade->priv->window));
send_root_property_change_notification (fade);
XFlush (xdisplay);
XUngrabServer (xdisplay);
gdk_x11_display_error_trap_pop_ignored (display);
}
}
static gboolean
on_widget_draw (GtkWidget *widget,
cairo_t *cr,
MateBGCrossfade *fade)
{
g_assert (fade->priv->fading_surface != NULL);
cairo_set_source_surface (cr, fade->priv->fading_surface, 0, 0);
cairo_pattern_set_extend (cairo_get_source (cr), CAIRO_EXTEND_REPEAT);
cairo_paint (cr);
return FALSE;
}
static gboolean
on_tick (MateBGCrossfade *fade)
{
gdouble now, percent_done;
cairo_t *cr;
cairo_status_t status;
g_return_val_if_fail (MATE_IS_BG_CROSSFADE (fade), FALSE);
now = get_current_time ();
percent_done = (now - fade->priv->start_time) / fade->priv->total_duration;
percent_done = CLAMP (percent_done, 0.0, 1.0);
/* If it's taking a long time to get to the first frame,
* then lengthen the duration, so the user will get to see
* the effect.
*/
if (fade->priv->is_first_frame && percent_done > .33) {
fade->priv->is_first_frame = FALSE;
fade->priv->total_duration *= 1.5;
return on_tick (fade);
}
if (fade->priv->fading_surface == NULL ||
fade->priv->end_surface == NULL) {
return FALSE;
}
if (animations_are_disabled (fade)) {
return FALSE;
}
/* We accumulate the results in place for performance reasons.
*
* This means 1) The fade is exponential, not linear (looks good!)
* 2) The rate of fade is not independent of frame rate. Slower machines
* will get a slower fade (but never longer than .75 seconds), and
* even the fastest machines will get *some* fade because the framerate
* is capped.
*/
cr = cairo_create (fade->priv->fading_surface);
cairo_set_source_surface (cr, fade->priv->end_surface,
0.0, 0.0);
cairo_paint_with_alpha (cr, percent_done);
status = cairo_status (cr);
cairo_destroy (cr);
if (status == CAIRO_STATUS_SUCCESS) {
draw_background (fade);
}
return percent_done <= .99;
}
static void
on_finished (MateBGCrossfade *fade)
{
cairo_t *cr;
if (fade->priv->timeout_id == 0)
return;
g_assert (fade->priv->fading_surface != NULL);
g_assert (fade->priv->end_surface != NULL);
cr = cairo_create (fade->priv->fading_surface);
cairo_set_source_surface (cr, fade->priv->end_surface, 0, 0);
cairo_paint (cr);
cairo_destroy (cr);
draw_background (fade);
cairo_surface_destroy (fade->priv->fading_surface);
fade->priv->fading_surface = NULL;
cairo_surface_destroy (fade->priv->end_surface);
fade->priv->end_surface = NULL;
g_assert (fade->priv->start_surface != NULL);
cairo_surface_destroy (fade->priv->start_surface);
fade->priv->start_surface = NULL;
if (fade->priv->widget != NULL) {
g_signal_handlers_disconnect_by_func (fade->priv->widget,
(GCallback) on_widget_draw,
fade);
}
fade->priv->widget = NULL;
fade->priv->timeout_id = 0;
g_signal_emit (fade, signals[FINISHED], 0, fade->priv->window);
}
/* This function queries the _XROOTPMAP_ID property from the root window
* to determine the current root window background pixmap and returns a
* surface to draw directly to it.
* If _XROOTPMAP_ID is not set, then NULL returned.
*/
static cairo_surface_t *
get_root_pixmap_id_surface (GdkDisplay *display)
{
GdkScreen *screen;
Display *xdisplay;
Visual *xvisual;
Window xroot;
Atom type;
int format, result;
unsigned long nitems, bytes_after;
unsigned char *data;
cairo_surface_t *surface = NULL;
g_return_val_if_fail (display != NULL, NULL);
screen = gdk_display_get_default_screen (display);
xdisplay = GDK_DISPLAY_XDISPLAY (display);
xvisual = GDK_VISUAL_XVISUAL (gdk_screen_get_system_visual (screen));
xroot = RootWindow (xdisplay, GDK_SCREEN_XNUMBER (screen));
result = XGetWindowProperty (xdisplay, xroot,
gdk_x11_get_xatom_by_name ("_XROOTPMAP_ID"),
0L, 1L, False, XA_PIXMAP,
&type, &format, &nitems, &bytes_after,
&data);
if (result != Success || type != XA_PIXMAP ||
format != 32 || nitems != 1) {
XFree (data);
data = NULL;
}
if (data != NULL) {
Pixmap pixmap = *(Pixmap *) data;
Window root_ret;
int x_ret, y_ret;
unsigned int w_ret, h_ret, bw_ret, depth_ret;
gdk_x11_display_error_trap_push (display);
if (XGetGeometry (xdisplay, pixmap, &root_ret,
&x_ret, &y_ret, &w_ret, &h_ret,
&bw_ret, &depth_ret))
{
surface = cairo_xlib_surface_create (xdisplay,
pixmap, xvisual,
w_ret, h_ret);
}
gdk_x11_display_error_trap_pop_ignored (display);
XFree (data);
}
gdk_display_flush (display);
return surface;
}
/**
* mate_bg_crossfade_start:
* @fade: a #MateBGCrossfade
* @window: The #GdkWindow to draw crossfade on
*
* This function initiates a quick crossfade between two surfaces on
* the background of @window. Before initiating the crossfade both
* mate_bg_crossfade_set_start_surface() and
* mate_bg_crossfade_set_end_surface() need to be called. If animations
* are disabled, the crossfade is skipped, and the window background is
* set immediately to the end surface.
**/
void
mate_bg_crossfade_start (MateBGCrossfade *fade,
GdkWindow *window)
{
GSource *source;
GMainContext *context;
g_return_if_fail (MATE_IS_BG_CROSSFADE (fade));
g_return_if_fail (window != NULL);
g_return_if_fail (fade->priv->start_surface != NULL);
g_return_if_fail (fade->priv->end_surface != NULL);
g_return_if_fail (!mate_bg_crossfade_is_started (fade));
g_return_if_fail (gdk_window_get_window_type (window) != GDK_WINDOW_FOREIGN);
/* If drawing is done on the root window,
* it is essential to have the root pixmap.
*/
if (gdk_window_get_window_type (window) == GDK_WINDOW_ROOT) {
GdkDisplay *display = gdk_window_get_display (window);
cairo_surface_t *surface = get_root_pixmap_id_surface (display);
g_return_if_fail (surface != NULL);
cairo_surface_destroy (surface);
}
if (fade->priv->fading_surface != NULL) {
cairo_surface_destroy (fade->priv->fading_surface);
fade->priv->fading_surface = NULL;
}
fade->priv->window = window;
if (gdk_window_get_window_type (fade->priv->window) != GDK_WINDOW_ROOT) {
fade->priv->fading_surface = tile_surface (fade->priv->start_surface,
fade->priv->width,
fade->priv->height);
if (fade->priv->widget != NULL) {
g_signal_connect (fade->priv->widget, "draw",
(GCallback) on_widget_draw, fade);
}
} else {
cairo_t *cr;
GdkDisplay *display = gdk_window_get_display (fade->priv->window);
fade->priv->fading_surface = get_root_pixmap_id_surface (display);
cr = cairo_create (fade->priv->fading_surface);
cairo_set_source_surface (cr, fade->priv->start_surface, 0, 0);
cairo_paint (cr);
cairo_destroy (cr);
}
draw_background (fade);
source = g_timeout_source_new (1000 / 60.0);
g_source_set_callback (source,
(GSourceFunc) on_tick,
fade,
(GDestroyNotify) on_finished);
context = g_main_context_default ();
fade->priv->timeout_id = g_source_attach (source, context);
g_source_unref (source);
fade->priv->is_first_frame = TRUE;
fade->priv->total_duration = .75;
fade->priv->start_time = get_current_time ();
}
/**
* mate_bg_crossfade_start_widget:
* @fade: a #MateBGCrossfade
* @widget: The #GtkWidget to draw crossfade on
*
* This function initiates a quick crossfade between two surfaces on
* the background of @widget. Before initiating the crossfade both
* mate_bg_crossfade_set_start_surface() and
* mate_bg_crossfade_set_end_surface() need to be called. If animations
* are disabled, the crossfade is skipped, and the window background is
* set immediately to the end surface.
**/
void
mate_bg_crossfade_start_widget (MateBGCrossfade *fade,
GtkWidget *widget)
{
GdkWindow *window;
g_return_if_fail (MATE_IS_BG_CROSSFADE (fade));
g_return_if_fail (widget != NULL);
fade->priv->widget = widget;
gtk_widget_realize (fade->priv->widget);
window = gtk_widget_get_window (fade->priv->widget);
mate_bg_crossfade_start (fade, window);
}
/**
* mate_bg_crossfade_is_started:
* @fade: a #MateBGCrossfade
*
* This function reveals whether or not @fade is currently
* running on a window. See mate_bg_crossfade_start() for
* information on how to initiate a crossfade.
*
* Return value: %TRUE if fading, or %FALSE if not fading
**/
gboolean
mate_bg_crossfade_is_started (MateBGCrossfade *fade)
{
g_return_val_if_fail (MATE_IS_BG_CROSSFADE (fade), FALSE);
return fade->priv->timeout_id != 0;
}
/**
* mate_bg_crossfade_stop:
* @fade: a #MateBGCrossfade
*
* This function stops any in progress crossfades that may be
* happening. It's harmless to call this function if @fade is
* already stopped.
**/
void
mate_bg_crossfade_stop (MateBGCrossfade *fade)
{
g_return_if_fail (MATE_IS_BG_CROSSFADE (fade));
if (!mate_bg_crossfade_is_started (fade))
return;
g_assert (fade->priv->timeout_id != 0);
g_source_remove (fade->priv->timeout_id);
fade->priv->timeout_id = 0;
}

View File

@ -0,0 +1,80 @@
/* mate-bg-crossfade.h - fade window background between two pixmaps
Copyright 2008, Red Hat, Inc.
This file is part of the Mate Library.
The Mate Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The Mate 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the Mate Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
Floor, Boston, MA 02110-1301 US.
Author: Ray Strode <rstrode@redhat.com>
*/
#ifndef __MATE_BG_CROSSFADE_H__
#define __MATE_BG_CROSSFADE_H__
#ifndef MATE_DESKTOP_USE_UNSTABLE_API
#error MateBGCrossfade is unstable API. You must define MATE_DESKTOP_USE_UNSTABLE_API before including mate-bg-crossfade.h
#endif
#include <glib.h>
#include <gdk/gdk.h>
#include <gtk/gtk.h>
G_BEGIN_DECLS
#define MATE_TYPE_BG_CROSSFADE (mate_bg_crossfade_get_type ())
#define MATE_BG_CROSSFADE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MATE_TYPE_BG_CROSSFADE, MateBGCrossfade))
#define MATE_BG_CROSSFADE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MATE_TYPE_BG_CROSSFADE, MateBGCrossfadeClass))
#define MATE_IS_BG_CROSSFADE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MATE_TYPE_BG_CROSSFADE))
#define MATE_IS_BG_CROSSFADE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MATE_TYPE_BG_CROSSFADE))
#define MATE_BG_CROSSFADE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MATE_TYPE_BG_CROSSFADE, MateBGCrossfadeClass))
typedef struct _MateBGCrossfadePrivate MateBGCrossfadePrivate;
typedef struct _MateBGCrossfade MateBGCrossfade;
typedef struct _MateBGCrossfadeClass MateBGCrossfadeClass;
struct _MateBGCrossfade
{
GObject parent_object;
MateBGCrossfadePrivate *priv;
};
struct _MateBGCrossfadeClass
{
GObjectClass parent_class;
void (* finished) (MateBGCrossfade *fade, GdkWindow *window);
};
GType mate_bg_crossfade_get_type (void);
MateBGCrossfade *mate_bg_crossfade_new (int width, int height);
gboolean mate_bg_crossfade_set_start_surface (MateBGCrossfade *fade,
cairo_surface_t *surface);
gboolean mate_bg_crossfade_set_end_surface (MateBGCrossfade *fade,
cairo_surface_t *surface);
void mate_bg_crossfade_start (MateBGCrossfade *fade,
GdkWindow *window);
void mate_bg_crossfade_start_widget (MateBGCrossfade *fade,
GtkWidget *widget);
gboolean mate_bg_crossfade_is_started (MateBGCrossfade *fade);
void mate_bg_crossfade_stop (MateBGCrossfade *fade);
G_END_DECLS
#endif

3271
libmate-desktop/mate-bg.c Normal file

File diff suppressed because it is too large Load Diff

172
libmate-desktop/mate-bg.h Normal file
View File

@ -0,0 +1,172 @@
/* mate-bg.h -
Copyright (C) 2007 Red Hat, Inc.
Copyright (C) 2012 Jasmine Hassan <jasmine.aura@gmail.com>
This file is part of the Mate Library.
The Mate Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The Mate 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the Mate Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
Boston, MA 02110-1301, USA.
Authors: Soren Sandmann <sandmann@redhat.com>
Jasmine Hassan <jasmine.aura@gmail.com>
*/
#ifndef __MATE_BG_H__
#define __MATE_BG_H__
#ifndef MATE_DESKTOP_USE_UNSTABLE_API
#error MateBG is unstable API. You must define MATE_DESKTOP_USE_UNSTABLE_API before including mate-bg.h
#endif
#include <glib.h>
#include <gdk/gdk.h>
#include <gio/gio.h>
#include "mate-desktop-thumbnail.h"
#include "mate-bg-crossfade.h"
G_BEGIN_DECLS
#define MATE_TYPE_BG (mate_bg_get_type ())
#define MATE_BG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MATE_TYPE_BG, MateBG))
#define MATE_BG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MATE_TYPE_BG, MateBGClass))
#define MATE_IS_BG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MATE_TYPE_BG))
#define MATE_IS_BG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MATE_TYPE_BG))
#define MATE_BG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MATE_TYPE_BG, MateBGClass))
#define MATE_BG_SCHEMA "org.mate.background"
/* whether to draw the desktop bg */
#define MATE_BG_KEY_DRAW_BACKGROUND "draw-background"
/* whether Caja or mate-settings-daemon draw the desktop */
#define MATE_BG_KEY_SHOW_DESKTOP "show-desktop-icons"
/* whether to fade when changing background (By Caja/m-s-d) */
#define MATE_BG_KEY_BACKGROUND_FADE "background-fade"
#define MATE_BG_KEY_PRIMARY_COLOR "primary-color"
#define MATE_BG_KEY_SECONDARY_COLOR "secondary-color"
#define MATE_BG_KEY_COLOR_TYPE "color-shading-type"
#define MATE_BG_KEY_PICTURE_PLACEMENT "picture-options"
#define MATE_BG_KEY_PICTURE_OPACITY "picture-opacity"
#define MATE_BG_KEY_PICTURE_FILENAME "picture-filename"
typedef struct _MateBG MateBG;
typedef struct _MateBGClass MateBGClass;
typedef enum {
MATE_BG_COLOR_SOLID,
MATE_BG_COLOR_H_GRADIENT,
MATE_BG_COLOR_V_GRADIENT
} MateBGColorType;
typedef enum {
MATE_BG_PLACEMENT_TILED,
MATE_BG_PLACEMENT_ZOOMED,
MATE_BG_PLACEMENT_CENTERED,
MATE_BG_PLACEMENT_SCALED,
MATE_BG_PLACEMENT_FILL_SCREEN,
MATE_BG_PLACEMENT_SPANNED
} MateBGPlacement;
GType mate_bg_get_type (void);
MateBG * mate_bg_new (void);
void mate_bg_load_from_preferences (MateBG *bg);
void mate_bg_load_from_system_preferences (MateBG *bg);
void mate_bg_load_from_system_gsettings (MateBG *bg,
GSettings *settings,
gboolean reset_apply);
void mate_bg_load_from_gsettings (MateBG *bg,
GSettings *settings);
void mate_bg_save_to_preferences (MateBG *bg);
void mate_bg_save_to_gsettings (MateBG *bg,
GSettings *settings);
/* Setters */
void mate_bg_set_filename (MateBG *bg,
const char *filename);
void mate_bg_set_placement (MateBG *bg,
MateBGPlacement placement);
void mate_bg_set_color (MateBG *bg,
MateBGColorType type,
GdkRGBA *primary,
GdkRGBA *secondary);
void mate_bg_set_draw_background (MateBG *bg,
gboolean draw_background);
/* Getters */
gboolean mate_bg_get_draw_background (MateBG *bg);
MateBGPlacement mate_bg_get_placement (MateBG *bg);
void mate_bg_get_color (MateBG *bg,
MateBGColorType *type,
GdkRGBA *primary,
GdkRGBA *secondary);
const gchar * mate_bg_get_filename (MateBG *bg);
/* Drawing and thumbnailing */
void mate_bg_draw (MateBG *bg,
GdkPixbuf *dest,
GdkScreen *screen,
gboolean is_root);
cairo_surface_t *mate_bg_create_surface (MateBG *bg,
GdkWindow *window,
int width,
int height,
gboolean root);
cairo_surface_t *mate_bg_create_surface_scale (MateBG *bg,
GdkWindow *window,
int width,
int height,
int scale,
gboolean root);
gboolean mate_bg_get_image_size (MateBG *bg,
MateDesktopThumbnailFactory *factory,
int best_width,
int best_height,
int *width,
int *height);
GdkPixbuf * mate_bg_create_thumbnail (MateBG *bg,
MateDesktopThumbnailFactory *factory,
GdkScreen *screen,
int dest_width,
int dest_height);
gboolean mate_bg_is_dark (MateBG *bg,
int dest_width,
int dest_height);
gboolean mate_bg_has_multiple_sizes (MateBG *bg);
gboolean mate_bg_changes_with_time (MateBG *bg);
GdkPixbuf * mate_bg_create_frame_thumbnail (MateBG *bg,
MateDesktopThumbnailFactory *factory,
GdkScreen *screen,
int dest_width,
int dest_height,
int frame_num);
/* Set a surface as root - not a MateBG method. At some point
* if we decide to stabilize the API then we may want to make
* these object methods, drop mate_bg_create_surface, etc.
*/
void mate_bg_set_surface_as_root (GdkScreen *screen,
cairo_surface_t *surface);
MateBGCrossfade *mate_bg_set_surface_as_root_with_crossfade (GdkScreen *screen,
cairo_surface_t *surface);
cairo_surface_t *mate_bg_get_surface_from_root (GdkScreen *screen);
G_END_DECLS
#endif

View File

@ -0,0 +1,895 @@
/*
* GTK - The GIMP Toolkit
* Copyright (C) 1998, 1999 Red Hat, Inc.
* All rights reserved.
*
* This Library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with the Gnome Library; see the file COPYING.LIB. If not,
* write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/* Color picker button for GNOME
*
* Author: Federico Mena <federico@nuclecu.unam.mx>
*
* Modified by the GTK+ Team and others 2003. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#include "config.h"
#include "private.h"
#include "mate-colorbutton.h"
#include "mate-colorsel.h"
#include "mate-colorseldialog.h"
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <glib/gi18n-lib.h>
/* Size of checks and gray levels for alpha compositing checkerboard */
#define CHECK_SIZE 4
#define CHECK_DARK (1.0 / 3.0)
#define CHECK_LIGHT (2.0 / 3.0)
struct _MateColorButtonPrivate
{
GtkWidget *draw_area; /* Widget where we draw the color sample */
GtkWidget *cs_dialog; /* Color selection dialog */
gchar *title; /* Title for the color selection window */
GdkColor color;
guint16 alpha;
guint use_alpha : 1; /* Use alpha or not */
};
/* Properties */
enum
{
PROP_0,
PROP_USE_ALPHA,
PROP_TITLE,
PROP_COLOR,
PROP_ALPHA
};
/* Signals */
enum
{
COLOR_SET,
LAST_SIGNAL
};
/* gobject signals */
static void mate_color_button_finalize (GObject *object);
static void mate_color_button_set_property (GObject *object,
guint param_id,
const GValue *value,
GParamSpec *pspec);
static void mate_color_button_get_property (GObject *object,
guint param_id,
GValue *value,
GParamSpec *pspec);
/* gtkwidget signals */
static void mate_color_button_state_changed (GtkWidget *widget,
GtkStateType previous_state);
/* gtkbutton signals */
static void mate_color_button_clicked (GtkButton *button);
/* source side drag signals */
static void mate_color_button_drag_begin (GtkWidget *widget,
GdkDragContext *context,
gpointer data);
static void mate_color_button_drag_data_get (GtkWidget *widget,
GdkDragContext *context,
GtkSelectionData *selection_data,
guint info,
guint time,
MateColorButton *color_button);
/* target side drag signals */
static void mate_color_button_drag_data_received (GtkWidget *widget,
GdkDragContext *context,
gint x,
gint y,
GtkSelectionData *selection_data,
guint info,
guint32 time,
MateColorButton *color_button);
static guint color_button_signals[LAST_SIGNAL] = { 0 };
static const GtkTargetEntry drop_types[] = { { "application/x-color", 0, 0 } };
G_DEFINE_TYPE_WITH_PRIVATE (MateColorButton, mate_color_button, GTK_TYPE_BUTTON)
static void
mate_color_button_class_init (MateColorButtonClass *klass)
{
GObjectClass *gobject_class;
GtkWidgetClass *widget_class;
GtkButtonClass *button_class;
gobject_class = G_OBJECT_CLASS (klass);
widget_class = GTK_WIDGET_CLASS (klass);
button_class = GTK_BUTTON_CLASS (klass);
gobject_class->get_property = mate_color_button_get_property;
gobject_class->set_property = mate_color_button_set_property;
gobject_class->finalize = mate_color_button_finalize;
widget_class->state_changed = mate_color_button_state_changed;
button_class->clicked = mate_color_button_clicked;
klass->color_set = NULL;
/**
* MateColorButton:use-alpha:
*
* If this property is set to %TRUE, the color swatch on the button is rendered against a
* checkerboard background to show its opacity and the opacity slider is displayed in the
* color selection dialog.
*
* Since: 1.9.1
*/
g_object_class_install_property (gobject_class,
PROP_USE_ALPHA,
g_param_spec_boolean ("use-alpha", _("Use alpha"),
_("Whether or not to give the color an alpha value"),
FALSE,
G_PARAM_READWRITE));
/**
* MateColorButton:title:
*
* The title of the color selection dialog
*
* Since: 1.9.1
*/
g_object_class_install_property (gobject_class,
PROP_TITLE,
g_param_spec_string ("title",
_("Title"),
_("The title of the color selection dialog"),
_("Pick a Color"),
G_PARAM_READWRITE));
/**
* MateColorButton:color:
*
* The selected color.
*
* Since: 1.9.1
*/
g_object_class_install_property (gobject_class,
PROP_COLOR,
g_param_spec_boxed ("color",
_("Current Color"),
_("The selected color"),
GDK_TYPE_COLOR,
G_PARAM_READWRITE));
/**
* MateColorButton:alpha:
*
* The selected opacity value (0 fully transparent, 65535 fully opaque).
*
* Since: 1.9.1
*/
g_object_class_install_property (gobject_class,
PROP_ALPHA,
g_param_spec_uint ("alpha",
_("Current Alpha"),
_("The selected opacity value (0 fully transparent, 65535 fully opaque)"),
0, 65535, 65535,
G_PARAM_READWRITE));
/**
* MateColorButton::color-set:
* @widget: the object which received the signal.
*
* The ::color-set signal is emitted when the user selects a color.
* When handling this signal, use mate_color_button_get_color() and
* mate_color_button_get_alpha() to find out which color was just selected.
*
* Note that this signal is only emitted when the <emphasis>user</emphasis>
* changes the color. If you need to react to programmatic color changes
* as well, use the notify::color signal.
*
* Since: 1.9.1
*/
color_button_signals[COLOR_SET] = g_signal_new ("color-set",
G_TYPE_FROM_CLASS (gobject_class),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (MateColorButtonClass, color_set),
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
}
static gboolean
mate_color_button_has_alpha (MateColorButton *color_button)
{
return color_button->priv->use_alpha &&
color_button->priv->alpha < 65535;
}
static cairo_pattern_t *
mate_color_button_get_checkered (void)
{
/* need to respect pixman's stride being a multiple of 4 */
static unsigned char data[8] = { 0xFF, 0x00, 0x00, 0x00,
0x00, 0xFF, 0x00, 0x00 };
static cairo_surface_t *checkered = NULL;
cairo_pattern_t *pattern;
if (checkered == NULL)
{
checkered = cairo_image_surface_create_for_data (data,
CAIRO_FORMAT_A8,
2, 2, 4);
}
pattern = cairo_pattern_create_for_surface (checkered);
cairo_pattern_set_extend (pattern, CAIRO_EXTEND_REPEAT);
cairo_pattern_set_filter (pattern, CAIRO_FILTER_NEAREST);
return pattern;
}
/* Handle exposure events for the color picker's drawing area */
static gboolean
draw (GtkWidget *widget,
cairo_t *cr,
gpointer data)
{
MateColorButton *color_button = MATE_COLOR_BUTTON (data);
cairo_pattern_t *checkered;
if (mate_color_button_has_alpha (color_button))
{
cairo_save (cr);
cairo_set_source_rgb (cr, CHECK_DARK, CHECK_DARK, CHECK_DARK);
cairo_paint (cr);
cairo_set_source_rgb (cr, CHECK_LIGHT, CHECK_LIGHT, CHECK_LIGHT);
cairo_scale (cr, CHECK_SIZE, CHECK_SIZE);
checkered = mate_color_button_get_checkered ();
cairo_mask (cr, checkered);
cairo_pattern_destroy (checkered);
cairo_restore (cr);
cairo_set_source_rgba (cr,
color_button->priv->color.red / 65535.,
color_button->priv->color.green / 65535.,
color_button->priv->color.blue / 65535.,
color_button->priv->alpha / 65535.);
}
else
{
gdk_cairo_set_source_color (cr, &color_button->priv->color);
}
cairo_paint (cr);
if (!gtk_widget_is_sensitive (GTK_WIDGET (color_button)))
{
gdk_cairo_set_source_color (cr, &gtk_widget_get_style (GTK_WIDGET(color_button))->bg[GTK_STATE_INSENSITIVE]);
checkered = mate_color_button_get_checkered ();
cairo_mask (cr, checkered);
cairo_pattern_destroy (checkered);
}
return FALSE;
}
static void
mate_color_button_state_changed (GtkWidget *widget,
GtkStateType previous_state)
{
gtk_widget_queue_draw (widget);
}
static void
mate_color_button_drag_data_received (GtkWidget *widget,
GdkDragContext *context,
gint x,
gint y,
GtkSelectionData *selection_data,
guint info,
guint32 time,
MateColorButton *color_button)
{
guint16 *dropped;
if (gtk_selection_data_get_length (selection_data) < 0)
return;
/* We accept drops with the wrong format, since the KDE color
* chooser incorrectly drops application/x-color with format 8.
*/
if (gtk_selection_data_get_length (selection_data) != 8)
{
g_warning (_("Received invalid color data\n"));
return;
}
dropped = (guint16 *)gtk_selection_data_get_data (selection_data);
color_button->priv->color.red = dropped[0];
color_button->priv->color.green = dropped[1];
color_button->priv->color.blue = dropped[2];
color_button->priv->alpha = dropped[3];
gtk_widget_queue_draw (color_button->priv->draw_area);
g_signal_emit (color_button, color_button_signals[COLOR_SET], 0);
g_object_freeze_notify (G_OBJECT (color_button));
g_object_notify (G_OBJECT (color_button), "color");
g_object_notify (G_OBJECT (color_button), "alpha");
g_object_thaw_notify (G_OBJECT (color_button));
}
static void
set_color_icon (GdkDragContext *context,
GdkColor *color)
{
GdkPixbuf *pixbuf;
guint32 pixel;
pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE,
8, 48, 32);
pixel = ((color->red & 0xff00) << 16) |
((color->green & 0xff00) << 8) |
(color->blue & 0xff00);
gdk_pixbuf_fill (pixbuf, pixel);
gtk_drag_set_icon_pixbuf (context, pixbuf, -2, -2);
g_object_unref (pixbuf);
}
static void
mate_color_button_drag_begin (GtkWidget *widget,
GdkDragContext *context,
gpointer data)
{
MateColorButton *color_button = data;
set_color_icon (context, &color_button->priv->color);
}
static void
mate_color_button_drag_data_get (GtkWidget *widget,
GdkDragContext *context,
GtkSelectionData *selection_data,
guint info,
guint time,
MateColorButton *color_button)
{
guint16 dropped[4];
dropped[0] = color_button->priv->color.red;
dropped[1] = color_button->priv->color.green;
dropped[2] = color_button->priv->color.blue;
dropped[3] = color_button->priv->alpha;
gtk_selection_data_set (selection_data, gtk_selection_data_get_target (selection_data),
16, (guchar *)dropped, 8);
}
static void
mate_color_button_init (MateColorButton *color_button)
{
GtkWidget *alignment;
GtkWidget *frame;
PangoLayout *layout;
PangoRectangle rect;
_mate_desktop_init_i18n ();
/* Create the widgets */
color_button->priv = mate_color_button_get_instance_private (color_button);
alignment = gtk_alignment_new (0.5, 0.5, 0.5, 1.0);
gtk_container_set_border_width (GTK_CONTAINER (alignment), 1);
gtk_container_add (GTK_CONTAINER (color_button), alignment);
gtk_widget_show (alignment);
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_OUT);
gtk_container_add (GTK_CONTAINER (alignment), frame);
gtk_widget_show (frame);
/* Just some widget we can hook to expose-event on */
color_button->priv->draw_area = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
layout = gtk_widget_create_pango_layout (GTK_WIDGET (color_button), "Black");
pango_layout_get_pixel_extents (layout, NULL, &rect);
g_object_unref (layout);
gtk_widget_set_size_request (color_button->priv->draw_area, rect.width - 2, rect.height - 2);
g_signal_connect (color_button->priv->draw_area, "draw",
G_CALLBACK (draw), color_button);
gtk_container_add (GTK_CONTAINER (frame), color_button->priv->draw_area);
gtk_widget_show (color_button->priv->draw_area);
color_button->priv->title = g_strdup (_("Pick a Color")); /* default title */
/* Start with opaque black, alpha disabled */
color_button->priv->color.red = 0;
color_button->priv->color.green = 0;
color_button->priv->color.blue = 0;
color_button->priv->alpha = 65535;
color_button->priv->use_alpha = FALSE;
gtk_drag_dest_set (GTK_WIDGET (color_button),
GTK_DEST_DEFAULT_MOTION |
GTK_DEST_DEFAULT_HIGHLIGHT |
GTK_DEST_DEFAULT_DROP,
drop_types, 1, GDK_ACTION_COPY);
gtk_drag_source_set (GTK_WIDGET(color_button),
GDK_BUTTON1_MASK|GDK_BUTTON3_MASK,
drop_types, 1,
GDK_ACTION_COPY);
g_signal_connect (color_button, "drag-begin",
G_CALLBACK (mate_color_button_drag_begin), color_button);
g_signal_connect (color_button, "drag-data-received",
G_CALLBACK (mate_color_button_drag_data_received), color_button);
g_signal_connect (color_button, "drag-data-get",
G_CALLBACK (mate_color_button_drag_data_get), color_button);
}
static void
mate_color_button_finalize (GObject *object)
{
MateColorButton *color_button = MATE_COLOR_BUTTON (object);
if (color_button->priv->cs_dialog != NULL)
gtk_widget_destroy (color_button->priv->cs_dialog);
color_button->priv->cs_dialog = NULL;
g_free (color_button->priv->title);
color_button->priv->title = NULL;
G_OBJECT_CLASS (mate_color_button_parent_class)->finalize (object);
}
/**
* mate_color_button_new:
*
* Creates a new color button. This returns a widget in the form of
* a small button containing a swatch representing the current selected
* color. When the button is clicked, a color-selection dialog will open,
* allowing the user to select a color. The swatch will be updated to reflect
* the new color when the user finishes.
*
* Returns: a new color button.
*
* Since: 1.9.1
*/
GtkWidget *
mate_color_button_new (void)
{
return g_object_new (MATE_TYPE_COLOR_BUTTON, NULL);
}
/**
* mate_color_button_new_with_color:
* @color: A #GdkColor to set the current color with.
*
* Creates a new color button.
*
* Returns: a new color button.
*
* Since: 1.9.1
*/
GtkWidget *
mate_color_button_new_with_color (const GdkColor *color)
{
return g_object_new (MATE_TYPE_COLOR_BUTTON, "color", color, NULL);
}
static void
dialog_ok_clicked (GtkWidget *widget,
gpointer data)
{
MateColorButton *color_button = MATE_COLOR_BUTTON (data);
MateColorSelection *color_selection;
color_selection = MATE_COLOR_SELECTION (MATE_COLOR_SELECTION_DIALOG (color_button->priv->cs_dialog)->colorsel);
mate_color_selection_get_current_color (color_selection, &color_button->priv->color);
color_button->priv->alpha = mate_color_selection_get_current_alpha (color_selection);
gtk_widget_hide (color_button->priv->cs_dialog);
gtk_widget_queue_draw (color_button->priv->draw_area);
g_signal_emit (color_button, color_button_signals[COLOR_SET], 0);
g_object_freeze_notify (G_OBJECT (color_button));
g_object_notify (G_OBJECT (color_button), "color");
g_object_notify (G_OBJECT (color_button), "alpha");
g_object_thaw_notify (G_OBJECT (color_button));
}
static gboolean
dialog_destroy (GtkWidget *widget,
gpointer data)
{
MateColorButton *color_button = MATE_COLOR_BUTTON (data);
color_button->priv->cs_dialog = NULL;
return FALSE;
}
static void
dialog_cancel_clicked (GtkWidget *widget,
gpointer data)
{
MateColorButton *color_button = MATE_COLOR_BUTTON (data);
gtk_widget_hide (color_button->priv->cs_dialog);
}
static void
mate_color_button_clicked (GtkButton *button)
{
MateColorButton *color_button = MATE_COLOR_BUTTON (button);
MateColorSelectionDialog *color_dialog;
/* if dialog already exists, make sure it's shown and raised */
if (!color_button->priv->cs_dialog)
{
/* Create the dialog and connects its buttons */
GtkWidget *parent;
parent = gtk_widget_get_toplevel (GTK_WIDGET (color_button));
color_button->priv->cs_dialog = mate_color_selection_dialog_new (color_button->priv->title);
color_dialog = MATE_COLOR_SELECTION_DIALOG (color_button->priv->cs_dialog);
if (gtk_widget_is_toplevel (parent) && GTK_IS_WINDOW (parent))
{
if (GTK_WINDOW (parent) != gtk_window_get_transient_for (GTK_WINDOW (color_dialog)))
gtk_window_set_transient_for (GTK_WINDOW (color_dialog), GTK_WINDOW (parent));
gtk_window_set_modal (GTK_WINDOW (color_dialog),
gtk_window_get_modal (GTK_WINDOW (parent)));
}
g_signal_connect (color_dialog->ok_button, "clicked",
G_CALLBACK (dialog_ok_clicked), color_button);
g_signal_connect (color_dialog->cancel_button, "clicked",
G_CALLBACK (dialog_cancel_clicked), color_button);
g_signal_connect (color_dialog, "destroy",
G_CALLBACK (dialog_destroy), color_button);
}
color_dialog = MATE_COLOR_SELECTION_DIALOG (color_button->priv->cs_dialog);
mate_color_selection_set_has_opacity_control (MATE_COLOR_SELECTION (color_dialog->colorsel),
color_button->priv->use_alpha);
mate_color_selection_set_has_palette (MATE_COLOR_SELECTION (color_dialog->colorsel), TRUE);
mate_color_selection_set_previous_color (MATE_COLOR_SELECTION (color_dialog->colorsel),
&color_button->priv->color);
mate_color_selection_set_previous_alpha (MATE_COLOR_SELECTION (color_dialog->colorsel),
color_button->priv->alpha);
mate_color_selection_set_current_color (MATE_COLOR_SELECTION (color_dialog->colorsel),
&color_button->priv->color);
mate_color_selection_set_current_alpha (MATE_COLOR_SELECTION (color_dialog->colorsel),
color_button->priv->alpha);
gtk_window_present (GTK_WINDOW (color_button->priv->cs_dialog));
}
/**
* mate_color_button_set_color:
* @color_button: a #MateColorButton.
* @color: A #GdkColor to set the current color with.
*
* Sets the current color to be @color.
*
* Since: 1.9.1
**/
void
mate_color_button_set_color (MateColorButton *color_button,
const GdkColor *color)
{
g_return_if_fail (MATE_IS_COLOR_BUTTON (color_button));
g_return_if_fail (color != NULL);
color_button->priv->color.red = color->red;
color_button->priv->color.green = color->green;
color_button->priv->color.blue = color->blue;
gtk_widget_queue_draw (color_button->priv->draw_area);
g_object_notify (G_OBJECT (color_button), "color");
}
/**
* mate_color_button_set_rgba:
* @color_button: a #MateColorButton.
* @color: A #GdkRGBA to set the current color with.
*
* Sets the current color to be @color.
*
* Since: 1.9.1
**/
void
mate_color_button_set_rgba (MateColorButton *color_button,
const GdkRGBA *color)
{
g_return_if_fail (MATE_IS_COLOR_BUTTON (color_button));
g_return_if_fail (color != NULL);
color_button->priv->color.red = color->red * 65535;
color_button->priv->color.green = color->green * 65535;
color_button->priv->color.blue = color->blue * 65535;
color_button->priv->alpha = color->alpha * 65535;
gtk_widget_queue_draw (color_button->priv->draw_area);
g_object_notify (G_OBJECT (color_button), "color");
}
/**
* mate_color_button_set_alpha:
* @color_button: a #MateColorButton.
* @alpha: an integer between 0 and 65535.
*
* Sets the current opacity to be @alpha.
*
* Since: 1.9.1
**/
void
mate_color_button_set_alpha (MateColorButton *color_button,
guint16 alpha)
{
g_return_if_fail (MATE_IS_COLOR_BUTTON (color_button));
color_button->priv->alpha = alpha;
gtk_widget_queue_draw (color_button->priv->draw_area);
g_object_notify (G_OBJECT (color_button), "alpha");
}
/**
* mate_color_button_get_color:
* @color_button: a #MateColorButton.
* @color: a #GdkColor to fill in with the current color.
*
* Sets @color to be the current color in the #MateColorButton widget.
*
* Since: 1.9.1
**/
void
mate_color_button_get_color (MateColorButton *color_button,
GdkColor *color)
{
g_return_if_fail (MATE_IS_COLOR_BUTTON (color_button));
color->red = color_button->priv->color.red;
color->green = color_button->priv->color.green;
color->blue = color_button->priv->color.blue;
}
/**
* mate_color_button_get_rgba:
* @color_button: a #MateColorButton.
* @color: a #GdkRGBA to fill in with the current color.
*
* Sets @color to be the current color in the #MateColorButton widget.
*
* Since: 1.9.1
**/
void
mate_color_button_get_rgba (MateColorButton *color_button,
GdkRGBA *color)
{
g_return_if_fail (MATE_IS_COLOR_BUTTON (color_button));
color->red = color_button->priv->color.red / 65535.;
color->green = color_button->priv->color.green / 65535.;
color->blue = color_button->priv->color.blue / 65535.;
color->alpha = color_button->priv->alpha / 65535.;
}
/**
* mate_color_button_get_alpha:
* @color_button: a #MateColorButton.
*
* Returns the current alpha value.
*
* Return value: an integer between 0 and 65535.
*
* Since: 1.9.1
**/
guint16
mate_color_button_get_alpha (MateColorButton *color_button)
{
g_return_val_if_fail (MATE_IS_COLOR_BUTTON (color_button), 0);
return color_button->priv->alpha;
}
/**
* mate_color_button_set_use_alpha:
* @color_button: a #MateColorButton.
* @use_alpha: %TRUE if color button should use alpha channel, %FALSE if not.
*
* Sets whether or not the color button should use the alpha channel.
*
* Since: 1.9.1
*/
void
mate_color_button_set_use_alpha (MateColorButton *color_button,
gboolean use_alpha)
{
g_return_if_fail (MATE_IS_COLOR_BUTTON (color_button));
use_alpha = (use_alpha != FALSE);
if (color_button->priv->use_alpha != use_alpha)
{
color_button->priv->use_alpha = use_alpha;
gtk_widget_queue_draw (color_button->priv->draw_area);
g_object_notify (G_OBJECT (color_button), "use-alpha");
}
}
/**
* mate_color_button_get_use_alpha:
* @color_button: a #MateColorButton.
*
* Does the color selection dialog use the alpha channel?
*
* Returns: %TRUE if the color sample uses alpha channel, %FALSE if not.
*
* Since: 1.9.1
*/
gboolean
mate_color_button_get_use_alpha (MateColorButton *color_button)
{
g_return_val_if_fail (MATE_IS_COLOR_BUTTON (color_button), FALSE);
return color_button->priv->use_alpha;
}
/**
* mate_color_button_set_title:
* @color_button: a #MateColorButton
* @title: String containing new window title.
*
* Sets the title for the color selection dialog.
*
* Since: 1.9.1
*/
void
mate_color_button_set_title (MateColorButton *color_button,
const gchar *title)
{
gchar *old_title;
g_return_if_fail (MATE_IS_COLOR_BUTTON (color_button));
old_title = color_button->priv->title;
color_button->priv->title = g_strdup (title);
g_free (old_title);
if (color_button->priv->cs_dialog)
gtk_window_set_title (GTK_WINDOW (color_button->priv->cs_dialog),
color_button->priv->title);
g_object_notify (G_OBJECT (color_button), "title");
}
/**
* mate_color_button_get_title:
* @color_button: a #MateColorButton
*
* Gets the title of the color selection dialog.
*
* Returns: An internal string, do not free the return value
*
* Since: 1.9.1
*/
const gchar *
mate_color_button_get_title (MateColorButton *color_button)
{
g_return_val_if_fail (MATE_IS_COLOR_BUTTON (color_button), NULL);
return color_button->priv->title;
}
static void
mate_color_button_set_property (GObject *object,
guint param_id,
const GValue *value,
GParamSpec *pspec)
{
MateColorButton *color_button = MATE_COLOR_BUTTON (object);
switch (param_id)
{
case PROP_USE_ALPHA:
mate_color_button_set_use_alpha (color_button, g_value_get_boolean (value));
break;
case PROP_TITLE:
mate_color_button_set_title (color_button, g_value_get_string (value));
break;
case PROP_COLOR:
mate_color_button_set_color (color_button, g_value_get_boxed (value));
break;
case PROP_ALPHA:
mate_color_button_set_alpha (color_button, g_value_get_uint (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
break;
}
}
static void
mate_color_button_get_property (GObject *object,
guint param_id,
GValue *value,
GParamSpec *pspec)
{
MateColorButton *color_button = MATE_COLOR_BUTTON (object);
GdkColor color;
switch (param_id)
{
case PROP_USE_ALPHA:
g_value_set_boolean (value, mate_color_button_get_use_alpha (color_button));
break;
case PROP_TITLE:
g_value_set_string (value, mate_color_button_get_title (color_button));
break;
case PROP_COLOR:
mate_color_button_get_color (color_button, &color);
g_value_set_boxed (value, &color);
break;
case PROP_ALPHA:
g_value_set_uint (value, mate_color_button_get_alpha (color_button));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
break;
}
}

View File

@ -0,0 +1,103 @@
/*
* GTK - The GIMP Toolkit
* Copyright (C) 1998, 1999 Red Hat, Inc.
* All rights reserved.
*
* This Library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with the Mate Library; see the file COPYING.LIB. If not,
* write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
/* Color picker button for GNOME
*
* Author: Federico Mena <federico@nuclecu.unam.mx>
*
* Modified by the GTK+ Team and others 2003. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#ifndef __MATE_COLOR_BUTTON_H__
#define __MATE_COLOR_BUTTON_H__
#include <glib.h>
#include <gtk/gtk.h>
G_BEGIN_DECLS
/* The MateColorButton widget is a simple color picker in a button.
* The button displays a sample of the currently selected color. When
* the user clicks on the button, a color selection dialog pops up.
* The color picker emits the "color_set" signal when the color is set.
*/
#define MATE_TYPE_COLOR_BUTTON (mate_color_button_get_type ())
#define MATE_COLOR_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MATE_TYPE_COLOR_BUTTON, MateColorButton))
#define MATE_COLOR_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MATE_TYPE_COLOR_BUTTON, MateColorButtonClass))
#define MATE_IS_COLOR_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MATE_TYPE_COLOR_BUTTON))
#define MATE_IS_COLOR_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MATE_TYPE_COLOR_BUTTON))
#define MATE_COLOR_BUTTON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MATE_TYPE_COLOR_BUTTON, MateColorButtonClass))
typedef struct _MateColorButton MateColorButton;
typedef struct _MateColorButtonClass MateColorButtonClass;
typedef struct _MateColorButtonPrivate MateColorButtonPrivate;
struct _MateColorButton {
GtkButton button;
/*< private >*/
MateColorButtonPrivate *priv;
};
struct _MateColorButtonClass {
GtkButtonClass parent_class;
void (* color_set) (MateColorButton *cp);
/* Padding for future expansion */
void (*_gtk_reserved1) (void);
void (*_gtk_reserved2) (void);
void (*_gtk_reserved3) (void);
void (*_gtk_reserved4) (void);
};
GType mate_color_button_get_type (void) G_GNUC_CONST;
GtkWidget *mate_color_button_new (void);
GtkWidget *mate_color_button_new_with_color (const GdkColor *color);
void mate_color_button_set_color (MateColorButton *color_button,
const GdkColor *color);
void mate_color_button_set_rgba (MateColorButton *color_button,
const GdkRGBA *color);
void mate_color_button_set_alpha (MateColorButton *color_button,
guint16 alpha);
void mate_color_button_get_color (MateColorButton *color_button,
GdkColor *color);
void mate_color_button_get_rgba (MateColorButton *color_button,
GdkRGBA *color);
guint16 mate_color_button_get_alpha (MateColorButton *color_button);
void mate_color_button_set_use_alpha (MateColorButton *color_button,
gboolean use_alpha);
gboolean mate_color_button_get_use_alpha (MateColorButton *color_button);
void mate_color_button_set_title (MateColorButton *color_button,
const gchar *title);
const gchar *mate_color_button_get_title (MateColorButton *color_button);
G_END_DECLS
#endif /* __MATE_COLOR_BUTTON_H__ */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,130 @@
/* GTK - The GIMP Toolkit
* Copyright (C) 2000 Red Hat, Inc.
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* 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 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., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#ifndef __MATE_COLOR_SELECTION_H__
#define __MATE_COLOR_SELECTION_H__
#include <glib.h>
#include <gtk/gtk.h>
G_BEGIN_DECLS
#define MATE_TYPE_COLOR_SELECTION (mate_color_selection_get_type ())
#define MATE_COLOR_SELECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MATE_TYPE_COLOR_SELECTION, MateColorSelection))
#define MATE_COLOR_SELECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MATE_TYPE_COLOR_SELECTION, MateColorSelectionClass))
#define MATE_IS_COLOR_SELECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MATE_TYPE_COLOR_SELECTION))
#define MATE_IS_COLOR_SELECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MATE_TYPE_COLOR_SELECTION))
#define MATE_COLOR_SELECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MATE_TYPE_COLOR_SELECTION, MateColorSelectionClass))
typedef struct _MateColorSelection MateColorSelection;
typedef struct _MateColorSelectionClass MateColorSelectionClass;
typedef struct _MateColorSelectionPrivate MateColorSelectionPrivate;
typedef void (* MateColorSelectionChangePaletteFunc) (const GdkColor *colors,
gint n_colors);
typedef void (* MateColorSelectionChangePaletteWithScreenFunc) (GdkScreen *screen,
const GdkColor *colors,
gint n_colors);
struct _MateColorSelection
{
GtkBox parent_instance;
/* < private_data > */
MateColorSelectionPrivate *private_data;
};
struct _MateColorSelectionClass
{
GtkBoxClass parent_class;
void (*color_changed) (MateColorSelection *color_selection);
/* Padding for future expansion */
void (*_gtk_reserved1) (void);
void (*_gtk_reserved2) (void);
void (*_gtk_reserved3) (void);
void (*_gtk_reserved4) (void);
};
/* ColorSelection */
GType mate_color_selection_get_type (void) G_GNUC_CONST;
GtkWidget *mate_color_selection_new (void);
gboolean mate_color_selection_get_has_opacity_control (MateColorSelection *colorsel);
void mate_color_selection_set_has_opacity_control (MateColorSelection *colorsel,
gboolean has_opacity);
gboolean mate_color_selection_get_has_palette (MateColorSelection *colorsel);
void mate_color_selection_set_has_palette (MateColorSelection *colorsel,
gboolean has_palette);
void mate_color_selection_set_current_color (MateColorSelection *colorsel,
const GdkColor *color);
void mate_color_selection_set_current_alpha (MateColorSelection *colorsel,
guint16 alpha);
void mate_color_selection_get_current_color (MateColorSelection *colorsel,
GdkColor *color);
guint16 mate_color_selection_get_current_alpha (MateColorSelection *colorsel);
void mate_color_selection_set_previous_color (MateColorSelection *colorsel,
const GdkColor *color);
void mate_color_selection_set_previous_alpha (MateColorSelection *colorsel,
guint16 alpha);
void mate_color_selection_get_previous_color (MateColorSelection *colorsel,
GdkColor *color);
guint16 mate_color_selection_get_previous_alpha (MateColorSelection *colorsel);
gboolean mate_color_selection_is_adjusting (MateColorSelection *colorsel);
gboolean mate_color_selection_palette_from_string (const gchar *str,
GdkColor **colors,
gint *n_colors);
gchar* mate_color_selection_palette_to_string (const GdkColor *colors,
gint n_colors);
#ifndef GTK_DISABLE_DEPRECATED
#ifndef GDK_MULTIHEAD_SAFE
MateColorSelectionChangePaletteFunc mate_color_selection_set_change_palette_hook (MateColorSelectionChangePaletteFunc func);
#endif
#endif
MateColorSelectionChangePaletteWithScreenFunc mate_color_selection_set_change_palette_with_screen_hook (MateColorSelectionChangePaletteWithScreenFunc func);
#ifndef GTK_DISABLE_DEPRECATED
/* Deprecated calls: */
void mate_color_selection_set_color (MateColorSelection *colorsel,
gdouble *color);
void mate_color_selection_get_color (MateColorSelection *colorsel,
gdouble *color);
#endif /* GTK_DISABLE_DEPRECATED */
G_END_DECLS
#endif /* __MATE_COLOR_SELECTION_H__ */

View File

@ -0,0 +1,222 @@
/* GTK - The GIMP Toolkit
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* 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 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., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#include "config.h"
#include "private.h"
#include <string.h>
#include <glib.h>
#include <gtk/gtk.h>
#include <glib/gi18n-lib.h>
#include "mate-colorsel.h"
#include "mate-colorseldialog.h"
enum {
PROP_0,
PROP_COLOR_SELECTION,
PROP_OK_BUTTON,
PROP_CANCEL_BUTTON,
PROP_HELP_BUTTON
};
/***************************/
/* MateColorSelectionDialog */
/***************************/
static void mate_color_selection_dialog_buildable_interface_init (GtkBuildableIface *iface);
static GObject * mate_color_selection_dialog_buildable_get_internal_child (GtkBuildable *buildable,
GtkBuilder *builder,
const gchar *childname);
G_DEFINE_TYPE_WITH_CODE (MateColorSelectionDialog, mate_color_selection_dialog,
GTK_TYPE_DIALOG,
G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE,
mate_color_selection_dialog_buildable_interface_init))
static GtkBuildableIface *parent_buildable_iface;
static void
mate_color_selection_dialog_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
MateColorSelectionDialog *colorsel;
colorsel = MATE_COLOR_SELECTION_DIALOG (object);
switch (prop_id)
{
case PROP_COLOR_SELECTION:
g_value_set_object (value, colorsel->colorsel);
break;
case PROP_OK_BUTTON:
g_value_set_object (value, colorsel->ok_button);
break;
case PROP_CANCEL_BUTTON:
g_value_set_object (value, colorsel->cancel_button);
break;
case PROP_HELP_BUTTON:
g_value_set_object (value, colorsel->help_button);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
mate_color_selection_dialog_class_init (MateColorSelectionDialogClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
gobject_class->get_property = mate_color_selection_dialog_get_property;
g_object_class_install_property (gobject_class,
PROP_COLOR_SELECTION,
g_param_spec_object ("color-selection",
_("Color Selection"),
_("The color selection embedded in the dialog."),
GTK_TYPE_WIDGET,
G_PARAM_READABLE));
g_object_class_install_property (gobject_class,
PROP_OK_BUTTON,
g_param_spec_object ("ok-button",
_("OK Button"),
_("The OK button of the dialog."),
GTK_TYPE_WIDGET,
G_PARAM_READABLE));
g_object_class_install_property (gobject_class,
PROP_CANCEL_BUTTON,
g_param_spec_object ("cancel-button",
_("Cancel Button"),
_("The cancel button of the dialog."),
GTK_TYPE_WIDGET,
G_PARAM_READABLE));
g_object_class_install_property (gobject_class,
PROP_HELP_BUTTON,
g_param_spec_object ("help-button",
_("Help Button"),
_("The help button of the dialog."),
GTK_TYPE_WIDGET,
G_PARAM_READABLE));
}
static void
mate_color_selection_dialog_init (MateColorSelectionDialog *colorseldiag)
{
GtkDialog *dialog = GTK_DIALOG (colorseldiag);
_mate_desktop_init_i18n ();
gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (dialog)), 2); /* 2 * 5 + 2 = 12 */
gtk_container_set_border_width (GTK_CONTAINER (gtk_dialog_get_action_area (dialog)), 5);
gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_action_area (dialog)), 6);
colorseldiag->colorsel = mate_color_selection_new ();
gtk_container_set_border_width (GTK_CONTAINER (colorseldiag->colorsel), 5);
mate_color_selection_set_has_palette (MATE_COLOR_SELECTION(colorseldiag->colorsel), FALSE);
mate_color_selection_set_has_opacity_control (MATE_COLOR_SELECTION(colorseldiag->colorsel), FALSE);
gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (colorseldiag))), colorseldiag->colorsel);
gtk_widget_show (colorseldiag->colorsel);
colorseldiag->cancel_button = gtk_dialog_add_button (GTK_DIALOG (colorseldiag),
GTK_STOCK_CANCEL,
GTK_RESPONSE_CANCEL);
colorseldiag->ok_button = gtk_dialog_add_button (GTK_DIALOG (colorseldiag),
GTK_STOCK_OK,
GTK_RESPONSE_OK);
gtk_widget_grab_default (colorseldiag->ok_button);
colorseldiag->help_button = gtk_dialog_add_button (GTK_DIALOG (colorseldiag),
GTK_STOCK_HELP,
GTK_RESPONSE_HELP);
gtk_widget_hide (colorseldiag->help_button);
gtk_window_set_title (GTK_WINDOW (colorseldiag),
_("Color Selection"));
//_gtk_dialog_set_ignore_separator (dialog, TRUE);
}
GtkWidget*
mate_color_selection_dialog_new (const gchar *title)
{
MateColorSelectionDialog *colorseldiag;
colorseldiag = g_object_new (MATE_TYPE_COLOR_SELECTION_DIALOG, NULL);
if (title)
gtk_window_set_title (GTK_WINDOW (colorseldiag), title);
gtk_window_set_resizable (GTK_WINDOW (colorseldiag), FALSE);
return GTK_WIDGET (colorseldiag);
}
/**
* mate_color_selection_dialog_get_color_selection:
* @colorsel: a #MateColorSelectionDialog
*
* Retrieves the #MateColorSelection widget embedded in the dialog.
*
* Returns: (transfer none): the embedded #MateColorSelection
*
* Since: 1.9.1
**/
GtkWidget*
mate_color_selection_dialog_get_color_selection (MateColorSelectionDialog *colorsel)
{
g_return_val_if_fail (MATE_IS_COLOR_SELECTION_DIALOG (colorsel), NULL);
return colorsel->colorsel;
}
static void
mate_color_selection_dialog_buildable_interface_init (GtkBuildableIface *iface)
{
parent_buildable_iface = g_type_interface_peek_parent (iface);
iface->get_internal_child = mate_color_selection_dialog_buildable_get_internal_child;
}
static GObject *
mate_color_selection_dialog_buildable_get_internal_child (GtkBuildable *buildable,
GtkBuilder *builder,
const gchar *childname)
{
if (strcmp(childname, "ok_button") == 0)
return G_OBJECT (MATE_COLOR_SELECTION_DIALOG (buildable)->ok_button);
else if (strcmp(childname, "cancel_button") == 0)
return G_OBJECT (MATE_COLOR_SELECTION_DIALOG (buildable)->cancel_button);
else if (strcmp(childname, "help_button") == 0)
return G_OBJECT (MATE_COLOR_SELECTION_DIALOG(buildable)->help_button);
else if (strcmp(childname, "color_selection") == 0)
return G_OBJECT (MATE_COLOR_SELECTION_DIALOG(buildable)->colorsel);
return parent_buildable_iface->get_internal_child (buildable, builder, childname);
}

View File

@ -0,0 +1,77 @@
/* GTK - The GIMP Toolkit
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* 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 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., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#ifndef __MATE_COLOR_SELECTION_DIALOG_H__
#define __MATE_COLOR_SELECTION_DIALOG_H__
#include <glib.h>
#include <gtk/gtk.h>
G_BEGIN_DECLS
#define MATE_TYPE_COLOR_SELECTION_DIALOG (mate_color_selection_dialog_get_type ())
#define MATE_COLOR_SELECTION_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MATE_TYPE_COLOR_SELECTION_DIALOG, MateColorSelectionDialog))
#define MATE_COLOR_SELECTION_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MATE_TYPE_COLOR_SELECTION_DIALOG, MateColorSelectionDialogClass))
#define MATE_IS_COLOR_SELECTION_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MATE_TYPE_COLOR_SELECTION_DIALOG))
#define MATE_IS_COLOR_SELECTION_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MATE_TYPE_COLOR_SELECTION_DIALOG))
#define MATE_COLOR_SELECTION_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MATE_TYPE_COLOR_SELECTION_DIALOG, MateColorSelectionDialogClass))
typedef struct _MateColorSelectionDialog MateColorSelectionDialog;
typedef struct _MateColorSelectionDialogClass MateColorSelectionDialogClass;
struct _MateColorSelectionDialog
{
GtkDialog parent_instance;
GtkWidget *colorsel;
GtkWidget *ok_button;
GtkWidget *cancel_button;
GtkWidget *help_button;
};
struct _MateColorSelectionDialogClass
{
GtkDialogClass parent_class;
/* Padding for future expansion */
void (*_gtk_reserved1) (void);
void (*_gtk_reserved2) (void);
void (*_gtk_reserved3) (void);
void (*_gtk_reserved4) (void);
};
/* ColorSelectionDialog */
GType mate_color_selection_dialog_get_type (void) G_GNUC_CONST;
GtkWidget* mate_color_selection_dialog_new (const gchar *title);
GtkWidget* mate_color_selection_dialog_get_color_selection (MateColorSelectionDialog *colorsel);
G_END_DECLS
#endif /* __MATE_COLOR_SELECTION_DIALOG_H__ */

View File

@ -0,0 +1,147 @@
/*
* mate-dconf.c: helper API for dconf
*
* Copyright (C) 2011 Novell, Inc.
* Copyright (C) 2013 Stefano Karapetsas
*
* 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.
*
* Authors:
* Vincent Untz <vuntz@gnome.org>
* Stefano Karapetsas <stefano@karapetsas.com>
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <string.h>
#include <dconf.h>
#include "mate-dconf.h"
static DConfClient *
mate_dconf_client_get (void)
{
return dconf_client_new ();
}
/**
* mate_dconf_write_sync:
* @key: the key to write.
* @value: the value to write.
* @error: a variable to store the error, or NULL.
*
* Allow to write a value to dconf.
*
* Since: 1.7.1
*/
gboolean
mate_dconf_write_sync (const gchar *key,
GVariant *value,
GError **error)
{
gboolean ret;
DConfClient *client = mate_dconf_client_get ();
ret = dconf_client_write_sync (client, key, value, NULL, NULL, error);
g_object_unref (client);
return ret;
}
/**
* mate_dconf_recursive_reset:
* @dir: the dconf directory to reset.
* @error: a variable to store the error, or NULL.
*
* Allow to reset a dconf path.
*
* Since: 1.7.1
*/
gboolean
mate_dconf_recursive_reset (const gchar *dir,
GError **error)
{
gboolean ret;
DConfClient *client = mate_dconf_client_get ();
ret = dconf_client_write_sync (client, dir, NULL, NULL, NULL, error);
g_object_unref (client);
return ret;
}
/**
* mate_dconf_list_subdirs:
* @dir: the dconf directory.
* @remove_trailing_slash: whether to remove the trailing slash from
* paths.
*
* Returns the list of subdirectories of the given dconf directory.
*
* Return value: the list of subdirectories.
*
* Since: 1.7.1
*/
gchar **
mate_dconf_list_subdirs (const gchar *dir,
gboolean remove_trailing_slash)
{
GArray *array;
gchar **children;
int len;
int i;
DConfClient *client = mate_dconf_client_get ();
array = g_array_new (TRUE, TRUE, sizeof (gchar *));
children = dconf_client_list (client, dir, &len);
g_object_unref (client);
for (i = 0; children[i] != NULL; i++) {
if (dconf_is_rel_dir (children[i], NULL)) {
char *val = g_strdup (children[i]);
if (remove_trailing_slash)
val[strlen (val) - 1] = '\0';
array = g_array_append_val (array, val);
}
}
g_strfreev (children);
return (gchar **) g_array_free (array, FALSE);
}
/**
* mate_dconf_sync:
*
* Ensure dconf daemon syncs the written values.
*
* Since: 1.7.1
*/
void mate_dconf_sync (void)
{
DConfClient *client = mate_dconf_client_get ();
dconf_client_sync (client);
g_object_unref (client);
}

View File

@ -0,0 +1,48 @@
/*
* mate-dconf.h: helper API for dconf
*
* Copyright (C) 2011 Novell, Inc.
* Copyright (C) 2013 Stefano Karapetsas
*
* 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.
*
* Authors:
* Vincent Untz <vuntz@gnome.org>
* Stefano Karapetsas <stefano@karapetsas.com>
*/
#ifndef __MATE_DCONF_H__
#define __MATE_DCONF_H__
#include <glib.h>
G_BEGIN_DECLS
gboolean mate_dconf_write_sync (const gchar *key,
GVariant *value,
GError **error);
gboolean mate_dconf_recursive_reset (const gchar *dir,
GError **error);
gchar **mate_dconf_list_subdirs (const gchar *dir,
gboolean remove_trailing_slash);
void mate_dconf_sync (void);
G_END_DECLS
#endif /* __MATE_DCONF_H__ */

View File

@ -0,0 +1,11 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: mate-desktop-2.0
Description: Utility library for loading .desktop files
Requires: gtk+-3.0 @STARTUP_NOTIFICATION_PACKAGE@
Version: @VERSION@
Libs: ${pc_top_builddir}/${pcfiledir}/libmate-desktop-2.la
Cflags: -I${pc_top_builddir}/${pcfiledir}

View File

@ -0,0 +1,12 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: mate-desktop-2.0
Description: Utility library for loading .desktop files
Requires: gtk+-3.0 @STARTUP_NOTIFICATION_PACKAGE@
Requires.private: dconf
Version: @VERSION@
Libs: -L${libdir} -lmate-desktop-2
Cflags: -I${includedir}/mate-desktop-2.0

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,308 @@
/* -*- Mode: C; c-set-style: linux indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* mate-ditem.h - MATE Desktop File Representation
Copyright (C) 1999, 2000 Red Hat Inc.
Copyright (C) 2001 Sid Vicious
All rights reserved.
This file is part of the Mate Library.
The Mate Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The Mate 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the Mate Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
Boston, MA 02110-1301, USA. */
/*
@NOTATION@
*/
#ifndef MATE_DITEM_H
#define MATE_DITEM_H
#include <glib.h>
#include <glib-object.h>
#include <gdk/gdk.h>
#include <gtk/gtk.h>
G_BEGIN_DECLS
typedef enum {
MATE_DESKTOP_ITEM_TYPE_NULL = 0 /* This means its NULL, that is, not
* set */,
MATE_DESKTOP_ITEM_TYPE_OTHER /* This means it's not one of the below
strings types, and you must get the
Type attribute. */,
/* These are the standard compliant types: */
MATE_DESKTOP_ITEM_TYPE_APPLICATION,
MATE_DESKTOP_ITEM_TYPE_LINK,
MATE_DESKTOP_ITEM_TYPE_FSDEVICE,
MATE_DESKTOP_ITEM_TYPE_MIME_TYPE,
MATE_DESKTOP_ITEM_TYPE_DIRECTORY,
MATE_DESKTOP_ITEM_TYPE_SERVICE,
MATE_DESKTOP_ITEM_TYPE_SERVICE_TYPE
} MateDesktopItemType;
typedef enum {
MATE_DESKTOP_ITEM_UNCHANGED = 0,
MATE_DESKTOP_ITEM_CHANGED = 1,
MATE_DESKTOP_ITEM_DISAPPEARED = 2
} MateDesktopItemStatus;
#define MATE_TYPE_DESKTOP_ITEM (mate_desktop_item_get_type ())
GType mate_desktop_item_get_type (void);
typedef struct _MateDesktopItem MateDesktopItem;
/* standard */
#define MATE_DESKTOP_ITEM_ENCODING "Encoding" /* string */
#define MATE_DESKTOP_ITEM_VERSION "Version" /* numeric */
#define MATE_DESKTOP_ITEM_NAME "Name" /* localestring */
#define MATE_DESKTOP_ITEM_GENERIC_NAME "GenericName" /* localestring */
#define MATE_DESKTOP_ITEM_TYPE "Type" /* string */
#define MATE_DESKTOP_ITEM_FILE_PATTERN "FilePattern" /* regexp(s) */
#define MATE_DESKTOP_ITEM_TRY_EXEC "TryExec" /* string */
#define MATE_DESKTOP_ITEM_NO_DISPLAY "NoDisplay" /* boolean */
#define MATE_DESKTOP_ITEM_COMMENT "Comment" /* localestring */
#define MATE_DESKTOP_ITEM_EXEC "Exec" /* string */
#define MATE_DESKTOP_ITEM_ACTIONS "Actions" /* strings */
#define MATE_DESKTOP_ITEM_ICON "Icon" /* string */
#define MATE_DESKTOP_ITEM_MINI_ICON "MiniIcon" /* string */
#define MATE_DESKTOP_ITEM_HIDDEN "Hidden" /* boolean */
#define MATE_DESKTOP_ITEM_PATH "Path" /* string */
#define MATE_DESKTOP_ITEM_TERMINAL "Terminal" /* boolean */
#define MATE_DESKTOP_ITEM_TERMINAL_OPTIONS "TerminalOptions" /* string */
#define MATE_DESKTOP_ITEM_SWALLOW_TITLE "SwallowTitle" /* string */
#define MATE_DESKTOP_ITEM_SWALLOW_EXEC "SwallowExec" /* string */
#define MATE_DESKTOP_ITEM_MIME_TYPE "MimeType" /* regexp(s) */
#define MATE_DESKTOP_ITEM_PATTERNS "Patterns" /* regexp(s) */
#define MATE_DESKTOP_ITEM_DEFAULT_APP "DefaultApp" /* string */
#define MATE_DESKTOP_ITEM_DEV "Dev" /* string */
#define MATE_DESKTOP_ITEM_FS_TYPE "FSType" /* string */
#define MATE_DESKTOP_ITEM_MOUNT_POINT "MountPoint" /* string */
#define MATE_DESKTOP_ITEM_READ_ONLY "ReadOnly" /* boolean */
#define MATE_DESKTOP_ITEM_UNMOUNT_ICON "UnmountIcon" /* string */
#define MATE_DESKTOP_ITEM_SORT_ORDER "SortOrder" /* strings */
#define MATE_DESKTOP_ITEM_URL "URL" /* string */
#define MATE_DESKTOP_ITEM_DOC_PATH "X-MATE-DocPath" /* string */
/* The vfolder proposal */
#define MATE_DESKTOP_ITEM_CATEGORIES "Categories" /* string */
#define MATE_DESKTOP_ITEM_ONLY_SHOW_IN "OnlyShowIn" /* string */
typedef enum {
/* Use the TryExec field to determine if this should be loaded */
MATE_DESKTOP_ITEM_LOAD_ONLY_IF_EXISTS = 1<<0,
MATE_DESKTOP_ITEM_LOAD_NO_TRANSLATIONS = 1<<1
} MateDesktopItemLoadFlags;
typedef enum {
/* Never launch more instances even if the app can only
* handle one file and we have passed many */
MATE_DESKTOP_ITEM_LAUNCH_ONLY_ONE = 1<<0,
/* Use current directory instead of home directory */
MATE_DESKTOP_ITEM_LAUNCH_USE_CURRENT_DIR = 1<<1,
/* Append the list of URIs to the command if no Exec
* parameter is specified, instead of launching the
* app without parameters. */
MATE_DESKTOP_ITEM_LAUNCH_APPEND_URIS = 1<<2,
/* Same as above but instead append local paths */
MATE_DESKTOP_ITEM_LAUNCH_APPEND_PATHS = 1<<3,
/* Don't automatically reap child process. */
MATE_DESKTOP_ITEM_LAUNCH_DO_NOT_REAP_CHILD = 1<<4
} MateDesktopItemLaunchFlags;
typedef enum {
/* Don't check the kde directories */
MATE_DESKTOP_ITEM_ICON_NO_KDE = 1<<0
} MateDesktopItemIconFlags;
typedef enum {
MATE_DESKTOP_ITEM_ERROR_NO_FILENAME /* No filename set or given on save */,
MATE_DESKTOP_ITEM_ERROR_UNKNOWN_ENCODING /* Unknown encoding of the file */,
MATE_DESKTOP_ITEM_ERROR_CANNOT_OPEN /* Cannot open file */,
MATE_DESKTOP_ITEM_ERROR_NO_EXEC_STRING /* Cannot launch due to no execute string */,
MATE_DESKTOP_ITEM_ERROR_BAD_EXEC_STRING /* Cannot launch due to bad execute string */,
MATE_DESKTOP_ITEM_ERROR_NO_URL /* No URL on a url entry*/,
MATE_DESKTOP_ITEM_ERROR_NOT_LAUNCHABLE /* Not a launchable type of item */,
MATE_DESKTOP_ITEM_ERROR_INVALID_TYPE /* Not of type application/x-mate-app-info */
} MateDesktopItemError;
/* Note that functions can also return the G_FILE_ERROR_* errors */
#define MATE_DESKTOP_ITEM_ERROR mate_desktop_item_error_quark ()
GQuark mate_desktop_item_error_quark (void);
/* Returned item from new*() and copy() methods have a refcount of 1 */
MateDesktopItem * mate_desktop_item_new (void);
MateDesktopItem * mate_desktop_item_new_from_file (const char *file,
MateDesktopItemLoadFlags flags,
GError **error);
MateDesktopItem * mate_desktop_item_new_from_uri (const char *uri,
MateDesktopItemLoadFlags flags,
GError **error);
MateDesktopItem * mate_desktop_item_new_from_string (const char *uri,
const char *string,
gssize length,
MateDesktopItemLoadFlags flags,
GError **error);
MateDesktopItem * mate_desktop_item_new_from_basename (const char *basename,
MateDesktopItemLoadFlags flags,
GError **error);
MateDesktopItem * mate_desktop_item_copy (const MateDesktopItem *item);
/* if under is NULL save in original location */
gboolean mate_desktop_item_save (MateDesktopItem *item,
const char *under,
gboolean force,
GError **error);
MateDesktopItem * mate_desktop_item_ref (MateDesktopItem *item);
void mate_desktop_item_unref (MateDesktopItem *item);
int mate_desktop_item_launch (const MateDesktopItem *item,
GList *file_list,
MateDesktopItemLaunchFlags flags,
GError **error);
int mate_desktop_item_launch_with_env (const MateDesktopItem *item,
GList *file_list,
MateDesktopItemLaunchFlags flags,
char **envp,
GError **error);
int mate_desktop_item_launch_on_screen (const MateDesktopItem *item,
GList *file_list,
MateDesktopItemLaunchFlags flags,
GdkScreen *screen,
int workspace,
GError **error);
/* A list of files or urls dropped onto an icon */
int mate_desktop_item_drop_uri_list (const MateDesktopItem *item,
const char *uri_list,
MateDesktopItemLaunchFlags flags,
GError **error);
int mate_desktop_item_drop_uri_list_with_env (const MateDesktopItem *item,
const char *uri_list,
MateDesktopItemLaunchFlags flags,
char **envp,
GError **error);
gboolean mate_desktop_item_exists (const MateDesktopItem *item);
MateDesktopItemType mate_desktop_item_get_entry_type (const MateDesktopItem *item);
/* You could also just use the set_string on the TYPE argument */
void mate_desktop_item_set_entry_type (MateDesktopItem *item,
MateDesktopItemType type);
/* Get current location on disk */
const char * mate_desktop_item_get_location (const MateDesktopItem *item);
void mate_desktop_item_set_location (MateDesktopItem *item,
const char *location);
void mate_desktop_item_set_location_file (MateDesktopItem *item,
const char *file);
MateDesktopItemStatus mate_desktop_item_get_file_status (const MateDesktopItem *item);
/*
* Get the icon, this is not as simple as getting the Icon attr as it actually tries to find
* it and returns %NULL if it can't
*/
char * mate_desktop_item_get_icon (const MateDesktopItem *item,
GtkIconTheme *icon_theme);
char * mate_desktop_item_find_icon (GtkIconTheme *icon_theme,
const char *icon,
/* size is only a suggestion */
int desired_size,
int flags);
/*
* Reading/Writing different sections, NULL is the standard section
*/
gboolean mate_desktop_item_attr_exists (const MateDesktopItem *item,
const char *attr);
/*
* String type
*/
const char * mate_desktop_item_get_string (const MateDesktopItem *item,
const char *attr);
void mate_desktop_item_set_string (MateDesktopItem *item,
const char *attr,
const char *value);
const char * mate_desktop_item_get_attr_locale (const MateDesktopItem *item,
const char *attr);
/*
* LocaleString type
*/
const char * mate_desktop_item_get_localestring (const MateDesktopItem *item,
const char *attr);
const char * mate_desktop_item_get_localestring_lang (const MateDesktopItem *item,
const char *attr,
const char *language);
/* use g_list_free only */
GList * mate_desktop_item_get_languages (const MateDesktopItem *item,
const char *attr);
void mate_desktop_item_set_localestring (MateDesktopItem *item,
const char *attr,
const char *value);
void mate_desktop_item_set_localestring_lang (MateDesktopItem *item,
const char *attr,
const char *language,
const char *value);
void mate_desktop_item_clear_localestring(MateDesktopItem *item,
const char *attr);
/*
* Strings, Regexps types
*/
/* use mate_desktop_item_free_string_list */
char ** mate_desktop_item_get_strings (const MateDesktopItem *item,
const char *attr);
void mate_desktop_item_set_strings (MateDesktopItem *item,
const char *attr,
char **strings);
/*
* Boolean type
*/
gboolean mate_desktop_item_get_boolean (const MateDesktopItem *item,
const char *attr);
void mate_desktop_item_set_boolean (MateDesktopItem *item,
const char *attr,
gboolean value);
/*
* Xserver time of user action that caused the application launch to start.
*/
void mate_desktop_item_set_launch_time (MateDesktopItem *item,
guint32 timestamp);
/*
* Clearing attributes
*/
#define mate_desktop_item_clear_attr(item,attr) \
mate_desktop_item_set_string(item,attr,NULL)
void mate_desktop_item_clear_section (MateDesktopItem *item,
const char *section);
G_END_DECLS
#endif /* MATE_DITEM_H */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,102 @@
/*
* mate-thumbnail.h: Utilities for handling thumbnails
*
* Copyright (C) 2002 Red Hat, Inc.
*
* This file is part of the Mate Library.
*
* The Mate Library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* The Mate 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with the Mate Library; see the file COPYING.LIB. If not,
* write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
* Author: Alexander Larsson <alexl@redhat.com>
*/
#ifndef MATE_DESKTOP_THUMBNAIL_H
#define MATE_DESKTOP_THUMBNAIL_H
#ifndef MATE_DESKTOP_USE_UNSTABLE_API
#error MateDesktopThumbnail is unstable API. You must define MATE_DESKTOP_USE_UNSTABLE_API before including mate-desktop-thumbnail.h
#endif
#include <glib.h>
#include <glib-object.h>
#include <time.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
G_BEGIN_DECLS
typedef enum {
MATE_DESKTOP_THUMBNAIL_SIZE_NORMAL,
MATE_DESKTOP_THUMBNAIL_SIZE_LARGE
} MateDesktopThumbnailSize;
#define MATE_DESKTOP_TYPE_THUMBNAIL_FACTORY (mate_desktop_thumbnail_factory_get_type ())
#define MATE_DESKTOP_THUMBNAIL_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MATE_DESKTOP_TYPE_THUMBNAIL_FACTORY, MateDesktopThumbnailFactory))
#define MATE_DESKTOP_THUMBNAIL_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MATE_DESKTOP_TYPE_THUMBNAIL_FACTORY, MateDesktopThumbnailFactoryClass))
#define MATE_DESKTOP_IS_THUMBNAIL_FACTORY(obj) (G_TYPE_INSTANCE_CHECK_TYPE ((obj), MATE_DESKTOP_TYPE_THUMBNAIL_FACTORY))
#define MATE_DESKTOP_IS_THUMBNAIL_FACTORY_CLASS(klass) (G_TYPE_CLASS_CHECK_CLASS_TYPE ((klass), MATE_DESKTOP_TYPE_THUMBNAIL_FACTORY))
typedef struct _MateDesktopThumbnailFactory MateDesktopThumbnailFactory;
typedef struct _MateDesktopThumbnailFactoryClass MateDesktopThumbnailFactoryClass;
typedef struct _MateDesktopThumbnailFactoryPrivate MateDesktopThumbnailFactoryPrivate;
struct _MateDesktopThumbnailFactory {
GObject parent;
MateDesktopThumbnailFactoryPrivate *priv;
};
struct _MateDesktopThumbnailFactoryClass {
GObjectClass parent;
};
GType mate_desktop_thumbnail_factory_get_type (void);
MateDesktopThumbnailFactory *mate_desktop_thumbnail_factory_new (MateDesktopThumbnailSize size);
char * mate_desktop_thumbnail_factory_lookup (MateDesktopThumbnailFactory *factory,
const char *uri,
time_t mtime);
gboolean mate_desktop_thumbnail_factory_has_valid_failed_thumbnail (MateDesktopThumbnailFactory *factory,
const char *uri,
time_t mtime);
gboolean mate_desktop_thumbnail_factory_can_thumbnail (MateDesktopThumbnailFactory *factory,
const char *uri,
const char *mime_type,
time_t mtime);
GdkPixbuf * mate_desktop_thumbnail_factory_generate_thumbnail (MateDesktopThumbnailFactory *factory,
const char *uri,
const char *mime_type);
void mate_desktop_thumbnail_factory_save_thumbnail (MateDesktopThumbnailFactory *factory,
GdkPixbuf *thumbnail,
const char *uri,
time_t original_mtime);
void mate_desktop_thumbnail_factory_create_failed_thumbnail (MateDesktopThumbnailFactory *factory,
const char *uri,
time_t mtime);
/* Thumbnailing utils: */
gboolean mate_desktop_thumbnail_has_uri (GdkPixbuf *pixbuf,
const char *uri);
gboolean mate_desktop_thumbnail_is_valid (GdkPixbuf *pixbuf,
const char *uri,
time_t mtime);
char * mate_desktop_thumbnail_path_for_uri (const char *uri,
MateDesktopThumbnailSize size);
G_END_DECLS
#endif /* MATE_DESKTOP_THUMBNAIL_H */

View File

@ -0,0 +1,460 @@
/* -*- Mode: C; c-set-style: linux indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* mate-desktop-utils.c - Utilities for the MATE Desktop
Copyright (C) 1998 Tom Tromey
All rights reserved.
This file is part of the Mate Library.
The Mate Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The Mate 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the Mate Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
Boston, MA 02110-1301, USA. */
/*
@NOTATION@
*/
#include <config.h>
#include <glib.h>
#include <gio/gio.h>
#include <glib/gi18n-lib.h>
#include <gdk/gdk.h>
#include <gtk/gtk.h>
#define MATE_DESKTOP_USE_UNSTABLE_API
#include <mate-desktop-utils.h>
#include "private.h"
static void
gtk_style_shade (GdkRGBA *a,
GdkRGBA *b,
gdouble k);
static void
rgb_to_hls (gdouble *r,
gdouble *g,
gdouble *b);
static void
hls_to_rgb (gdouble *h,
gdouble *l,
gdouble *s);
/**
* mate_desktop_prepend_terminal_to_vector:
* @argc: a pointer to the vector size
* @argv: a pointer to the vector
*
* Prepends a terminal (either the one configured as default in the user's
* MATE setup, or one of the common xterm emulators) to the passed in vector,
* modifying it in the process. The vector should be allocated with #g_malloc,
* as this will #g_free the original vector. Also all elements must have been
* allocated separately. That is the standard glib/MATE way of doing vectors
* however. If the integer that @argc points to is negative, the size will
* first be computed. Also note that passing in pointers to a vector that is
* empty, will just create a new vector for you.
**/
void
mate_desktop_prepend_terminal_to_vector (int *argc, char ***argv)
{
char **real_argv;
int real_argc;
int i, j;
char **term_argv = NULL;
int term_argc = 0;
GSettings *settings;
gchar *terminal = NULL;
char **the_argv;
g_return_if_fail (argc != NULL);
g_return_if_fail (argv != NULL);
_mate_desktop_init_i18n ();
/* sanity */
if(*argv == NULL)
*argc = 0;
the_argv = *argv;
/* compute size if not given */
if (*argc < 0) {
for (i = 0; the_argv[i] != NULL; i++)
;
*argc = i;
}
settings = g_settings_new ("org.mate.applications-terminal");
terminal = g_settings_get_string (settings, "exec");
if (terminal) {
gchar *command_line;
gchar *exec_flag;
exec_flag = g_settings_get_string (settings, "exec-arg");
if (exec_flag == NULL)
command_line = g_strdup (terminal);
else
command_line = g_strdup_printf ("%s %s", terminal,
exec_flag);
g_shell_parse_argv (command_line,
&term_argc,
&term_argv,
NULL /* error */);
g_free (command_line);
g_free (exec_flag);
g_free (terminal);
}
g_object_unref (settings);
if (term_argv == NULL) {
char *check;
term_argc = 2;
term_argv = g_new0 (char *, 3);
check = g_find_program_in_path ("mate-terminal");
if (check != NULL) {
term_argv[0] = check;
/* Note that mate-terminal takes -x and
* as -e in mate-terminal is broken we use that. */
term_argv[1] = g_strdup ("-x");
} else {
if (check == NULL)
check = g_find_program_in_path ("nxterm");
if (check == NULL)
check = g_find_program_in_path ("color-xterm");
if (check == NULL)
check = g_find_program_in_path ("rxvt");
if (check == NULL)
check = g_find_program_in_path ("xterm");
if (check == NULL)
check = g_find_program_in_path ("dtterm");
if (check == NULL) {
g_warning (_("Cannot find a terminal, using "
"xterm, even if it may not work"));
check = g_strdup ("xterm");
}
term_argv[0] = check;
term_argv[1] = g_strdup ("-e");
}
}
real_argc = term_argc + *argc;
real_argv = g_new (char *, real_argc + 1);
for (i = 0; i < term_argc; i++)
real_argv[i] = term_argv[i];
for (j = 0; j < *argc; j++, i++)
real_argv[i] = (char *)the_argv[j];
real_argv[i] = NULL;
g_free (*argv);
*argv = real_argv;
*argc = real_argc;
/* we use g_free here as we sucked all the inner strings
* out from it into real_argv */
g_free (term_argv);
}
/**
* mate_gdk_spawn_command_line_on_screen:
* @screen: a GdkScreen
* @command: a command line
* @error: return location for errors
*
* This is a replacement for gdk_spawn_command_line_on_screen, deprecated
* in GDK 2.24 and removed in GDK 3.0.
*
* gdk_spawn_command_line_on_screen is like g_spawn_command_line_async(),
* except the child process is spawned in such an environment that on
* calling gdk_display_open() it would be returned a GdkDisplay with
* screen as the default screen.
*
* This is useful for applications which wish to launch an application
* on a specific screen.
*
* Returns: TRUE on success, FALSE if error is set.
*
* Since: 1.7.1
**/
gboolean
mate_gdk_spawn_command_line_on_screen (GdkScreen *screen, const gchar *command, GError **error)
{
GAppInfo *appinfo = NULL;
GdkAppLaunchContext *context = NULL;
gboolean res = FALSE;
appinfo = g_app_info_create_from_commandline (command, NULL, G_APP_INFO_CREATE_NONE, error);
if (appinfo) {
context = gdk_display_get_app_launch_context (gdk_screen_get_display (screen));
res = g_app_info_launch (appinfo, NULL, G_APP_LAUNCH_CONTEXT (context), error);
g_object_unref (context);
g_object_unref (appinfo);
}
return res;
}
void
_mate_desktop_init_i18n (void) {
static gboolean initialized = FALSE;
if (!initialized) {
bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR);
#ifdef HAVE_BIND_TEXTDOMAIN_CODESET
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
#endif
initialized = TRUE;
}
}
/**
* gtk_style_shade:
* @a: the starting colour
* @b: [out] the resulting colour
* @k: amount to scale lightness and saturation by
*
* Takes a colour "a", scales the lightness and saturation by a certain amount,
* and sets "b" to the resulting colour.
* gtkstyle.c cut-and-pastage.
*/
static void
gtk_style_shade (GdkRGBA *a,
GdkRGBA *b,
gdouble k)
{
gdouble red;
gdouble green;
gdouble blue;
red = a->red;
green = a->green;
blue = a->blue;
rgb_to_hls (&red, &green, &blue);
green *= k;
if (green > 1.0)
green = 1.0;
else if (green < 0.0)
green = 0.0;
blue *= k;
if (blue > 1.0)
blue = 1.0;
else if (blue < 0.0)
blue = 0.0;
hls_to_rgb (&red, &green, &blue);
b->red = red;
b->green = green;
b->blue = blue;
}
/**
* rgb_to_hls:
* @r: on input, red; on output, hue
* @g: on input, green; on output, lightness
* @b: on input, blue; on output, saturation
*
* Converts a red/green/blue triplet to a hue/lightness/saturation triplet.
*/
static void
rgb_to_hls (gdouble *r,
gdouble *g,
gdouble *b)
{
gdouble min;
gdouble max;
gdouble red;
gdouble green;
gdouble blue;
gdouble h, l, s;
gdouble delta;
red = *r;
green = *g;
blue = *b;
if (red > green)
{
if (red > blue)
max = red;
else
max = blue;
if (green < blue)
min = green;
else
min = blue;
}
else
{
if (green > blue)
max = green;
else
max = blue;
if (red < blue)
min = red;
else
min = blue;
}
l = (max + min) / 2;
s = 0;
h = 0;
if (max != min)
{
if (l <= 0.5)
s = (max - min) / (max + min);
else
s = (max - min) / (2 - max - min);
delta = max -min;
if (red == max)
h = (green - blue) / delta;
else if (green == max)
h = 2 + (blue - red) / delta;
else if (blue == max)
h = 4 + (red - green) / delta;
h *= 60;
if (h < 0.0)
h += 360;
}
*r = h;
*g = l;
*b = s;
}
/**
* hls_to_rgb:
* @h: on input, hue; on output, red
* @l: on input, lightness; on output, green
* @s on input, saturation; on output, blue
*
* Converts a hue/lightness/saturation triplet to a red/green/blue triplet.
*/
static void
hls_to_rgb (gdouble *h,
gdouble *l,
gdouble *s)
{
gdouble hue;
gdouble lightness;
gdouble saturation;
gdouble m1, m2;
gdouble r, g, b;
lightness = *l;
saturation = *s;
if (lightness <= 0.5)
m2 = lightness * (1 + saturation);
else
m2 = lightness + saturation - lightness * saturation;
m1 = 2 * lightness - m2;
if (saturation == 0)
{
*h = lightness;
*l = lightness;
*s = lightness;
}
else
{
hue = *h + 120;
while (hue > 360)
hue -= 360;
while (hue < 0)
hue += 360;
if (hue < 60)
r = m1 + (m2 - m1) * hue / 60;
else if (hue < 180)
r = m2;
else if (hue < 240)
r = m1 + (m2 - m1) * (240 - hue) / 60;
else
r = m1;
hue = *h;
while (hue > 360)
hue -= 360;
while (hue < 0)
hue += 360;
if (hue < 60)
g = m1 + (m2 - m1) * hue / 60;
else if (hue < 180)
g = m2;
else if (hue < 240)
g = m1 + (m2 - m1) * (240 - hue) / 60;
else
g = m1;
hue = *h - 120;
while (hue > 360)
hue -= 360;
while (hue < 0)
hue += 360;
if (hue < 60)
b = m1 + (m2 - m1) * hue / 60;
else if (hue < 180)
b = m2;
else if (hue < 240)
b = m1 + (m2 - m1) * (240 - hue) / 60;
else
b = m1;
*h = r;
*l = g;
*s = b;
}
}
/* Based on set_color() in gtkstyle.c */
#define LIGHTNESS_MULT 1.3
#define DARKNESS_MULT 0.7
void
mate_desktop_gtk_style_get_light_color (GtkStyleContext *style,
GtkStateFlags state,
GdkRGBA *color)
{
gtk_style_context_get_background_color (style, state, color);
gtk_style_shade (color, color, LIGHTNESS_MULT);
}
void
mate_desktop_gtk_style_get_dark_color (GtkStyleContext *style,
GtkStateFlags state,
GdkRGBA *color)
{
gtk_style_context_get_background_color (style, state, color);
gtk_style_shade (color, color, DARKNESS_MULT);
}

View File

@ -0,0 +1,58 @@
/* -*- Mode: C; c-set-style: linux indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* mate-ditem.h - Utilities for the MATE Desktop
Copyright (C) 1998 Tom Tromey
All rights reserved.
This file is part of the Mate Library.
The Mate Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The Mate 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the Mate Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
Boston, MA 02110-1301, USA. */
/*
@NOTATION@
*/
#ifndef MATE_DESKTOP_UTILS_H
#define MATE_DESKTOP_UTILS_H
#ifndef MATE_DESKTOP_USE_UNSTABLE_API
#error mate-desktop-utils is unstable API. You must define MATE_DESKTOP_USE_UNSTABLE_API before including mate-desktop-utils.h
#endif
#include <glib.h>
#include <gdk/gdk.h>
#include <gtk/gtk.h>
G_BEGIN_DECLS
/* prepend the terminal command to a vector */
void mate_desktop_prepend_terminal_to_vector (int *argc, char ***argv);
/* replace gdk_spawn_command_line_on_screen, not available in GTK3 */
gboolean mate_gdk_spawn_command_line_on_screen (GdkScreen *screen, const gchar *command, GError **error);
void
mate_desktop_gtk_style_get_light_color (GtkStyleContext *style,
GtkStateFlags state,
GdkRGBA *color);
void
mate_desktop_gtk_style_get_dark_color (GtkStyleContext *style,
GtkStateFlags state,
GdkRGBA *color);
G_END_DECLS
#endif /* MATE_DESKTOP_UTILS_H */

View File

@ -0,0 +1,245 @@
mate_bg_changes_with_time
mate_bg_create_frame_thumbnail
mate_bg_create_surface
mate_bg_create_surface_scale
mate_bg_create_thumbnail
mate_bg_crossfade_get_type
mate_bg_crossfade_is_started
mate_bg_crossfade_new
mate_bg_crossfade_set_end_surface
mate_bg_crossfade_set_start_surface
mate_bg_crossfade_start
mate_bg_crossfade_start_widget
mate_bg_crossfade_stop
mate_bg_draw
mate_bg_get_color
mate_bg_get_draw_background
mate_bg_get_filename
mate_bg_get_image_size
mate_bg_get_placement
mate_bg_get_surface_from_root
mate_bg_get_type
mate_bg_has_multiple_sizes
mate_bg_is_dark
mate_bg_load_from_gsettings
mate_bg_load_from_preferences
mate_bg_load_from_system_gsettings
mate_bg_load_from_system_preferences
mate_bg_new
mate_bg_save_to_gsettings
mate_bg_save_to_preferences
mate_bg_set_color
mate_bg_set_draw_background
mate_bg_set_filename
mate_bg_set_placement
mate_bg_set_surface_as_root
mate_bg_set_surface_as_root_with_crossfade
mate_color_button_get_alpha
mate_color_button_get_color
mate_color_button_get_rgba
mate_color_button_get_title
mate_color_button_get_type
mate_color_button_get_use_alpha
mate_color_button_new
mate_color_button_new_with_color
mate_color_button_set_alpha
mate_color_button_set_color
mate_color_button_set_rgba
mate_color_button_set_title
mate_color_button_set_use_alpha
mate_color_selection_dialog_get_color_selection
mate_color_selection_dialog_get_type
mate_color_selection_dialog_new
mate_color_selection_get_color
mate_color_selection_get_current_alpha
mate_color_selection_get_current_color
mate_color_selection_get_has_opacity_control
mate_color_selection_get_has_palette
mate_color_selection_get_previous_alpha
mate_color_selection_get_previous_color
mate_color_selection_get_type
mate_color_selection_is_adjusting
mate_color_selection_new
mate_color_selection_palette_from_string
mate_color_selection_palette_to_string
mate_color_selection_set_change_palette_hook
mate_color_selection_set_change_palette_with_screen_hook
mate_color_selection_set_color
mate_color_selection_set_current_alpha
mate_color_selection_set_current_color
mate_color_selection_set_has_opacity_control
mate_color_selection_set_has_palette
mate_color_selection_set_previous_alpha
mate_color_selection_set_previous_color
mate_dconf_list_subdirs
mate_dconf_recursive_reset
mate_dconf_sync
mate_dconf_write_sync
mate_desktop_gtk_style_get_dark_color
mate_desktop_gtk_style_get_light_color
mate_desktop_item_attr_exists
mate_desktop_item_clear_localestring
mate_desktop_item_clear_section
mate_desktop_item_copy
mate_desktop_item_drop_uri_list
mate_desktop_item_drop_uri_list_with_env
mate_desktop_item_error_quark
mate_desktop_item_exists
mate_desktop_item_find_icon
mate_desktop_item_get_attr_locale
mate_desktop_item_get_boolean
mate_desktop_item_get_entry_type
mate_desktop_item_get_file_status
mate_desktop_item_get_icon
mate_desktop_item_get_languages
mate_desktop_item_get_localestring
mate_desktop_item_get_localestring_lang
mate_desktop_item_get_location
mate_desktop_item_get_string
mate_desktop_item_get_strings
mate_desktop_item_get_type
mate_desktop_item_launch
mate_desktop_item_launch_on_screen
mate_desktop_item_launch_with_env
mate_desktop_item_new
mate_desktop_item_new_from_basename
mate_desktop_item_new_from_file
mate_desktop_item_new_from_string
mate_desktop_item_new_from_uri
mate_desktop_item_ref
mate_desktop_item_save
mate_desktop_item_set_boolean
mate_desktop_item_set_entry_type
mate_desktop_item_set_launch_time
mate_desktop_item_set_localestring
mate_desktop_item_set_localestring_lang
mate_desktop_item_set_location
mate_desktop_item_set_location_file
mate_desktop_item_set_string
mate_desktop_item_set_strings
mate_desktop_item_unref
mate_desktop_prepend_terminal_to_vector
mate_desktop_thumbnail_factory_can_thumbnail
mate_desktop_thumbnail_factory_create_failed_thumbnail
mate_desktop_thumbnail_factory_generate_thumbnail
mate_desktop_thumbnail_factory_get_type
mate_desktop_thumbnail_factory_has_valid_failed_thumbnail
mate_desktop_thumbnail_factory_lookup
mate_desktop_thumbnail_factory_new
mate_desktop_thumbnail_factory_save_thumbnail
mate_desktop_thumbnail_has_uri
mate_desktop_thumbnail_is_valid
mate_desktop_thumbnail_path_for_uri
mate_gdk_spawn_command_line_on_screen
mate_get_all_locales
mate_get_country_from_code
mate_get_country_from_locale
mate_get_language_from_code
mate_get_language_from_locale
mate_gsettings_append_strv
mate_gsettings_is_valid_keyname
mate_gsettings_remove_all_from_strv
mate_gsettings_schema_exists
mate_gsettings_strv_to_gslist
mate_hsv_get_color
mate_hsv_get_metrics
mate_hsv_get_type
mate_hsv_is_adjusting
mate_hsv_new
mate_hsv_set_color
mate_hsv_set_metrics
mate_language_has_translations
mate_normalize_locale
mate_parse_locale
mate_rr_config_applicable
mate_rr_config_apply_from_filename_with_time
mate_rr_config_apply_with_time
mate_rr_config_ensure_primary
mate_rr_config_equal
mate_rr_config_get_backup_filename
mate_rr_config_get_clone
mate_rr_config_get_intended_filename
mate_rr_config_get_outputs
mate_rr_config_get_type
mate_rr_config_load_current
mate_rr_config_load_filename
mate_rr_config_match
mate_rr_config_new_current
mate_rr_config_new_stored
mate_rr_config_sanitize
mate_rr_config_save
mate_rr_config_set_clone
mate_rr_crtc_can_drive_output
mate_rr_crtc_get_current_mode
mate_rr_crtc_get_current_rotation
mate_rr_crtc_get_gamma
mate_rr_crtc_get_id
mate_rr_crtc_get_position
mate_rr_crtc_get_rotations
mate_rr_crtc_get_type
mate_rr_crtc_set_config
mate_rr_crtc_set_config_with_time
mate_rr_crtc_set_gamma
mate_rr_crtc_supports_rotation
mate_rr_error_quark
mate_rr_labeler_get_rgba_for_output
mate_rr_labeler_get_type
mate_rr_labeler_hide
mate_rr_labeler_new
mate_rr_mode_get_freq
mate_rr_mode_get_height
mate_rr_mode_get_id
mate_rr_mode_get_type
mate_rr_mode_get_width
mate_rr_output_can_clone
mate_rr_output_get_connector_type
mate_rr_output_get_crtc
mate_rr_output_get_current_mode
mate_rr_output_get_edid_data
mate_rr_output_get_height_mm
mate_rr_output_get_id
mate_rr_output_get_is_primary
mate_rr_output_get_name
mate_rr_output_get_position
mate_rr_output_get_possible_crtcs
mate_rr_output_get_preferred_mode
mate_rr_output_get_type
mate_rr_output_get_width_mm
mate_rr_output_info_get_aspect_ratio
mate_rr_output_info_get_display_name
mate_rr_output_info_get_geometry
mate_rr_output_info_get_name
mate_rr_output_info_get_preferred_height
mate_rr_output_info_get_preferred_width
mate_rr_output_info_get_primary
mate_rr_output_info_get_product
mate_rr_output_info_get_refresh_rate
mate_rr_output_info_get_rotation
mate_rr_output_info_get_serial
mate_rr_output_info_get_type
mate_rr_output_info_get_vendor
mate_rr_output_info_is_active
mate_rr_output_info_is_connected
mate_rr_output_info_set_active
mate_rr_output_info_set_geometry
mate_rr_output_info_set_primary
mate_rr_output_info_set_refresh_rate
mate_rr_output_info_set_rotation
mate_rr_output_is_connected
mate_rr_output_is_laptop
mate_rr_output_list_modes
mate_rr_output_supports_mode
mate_rr_screen_get_crtc_by_id
mate_rr_screen_get_output_by_id
mate_rr_screen_get_output_by_name
mate_rr_screen_get_ranges
mate_rr_screen_get_timestamps
mate_rr_screen_get_type
mate_rr_screen_list_clone_modes
mate_rr_screen_list_crtcs
mate_rr_screen_list_modes
mate_rr_screen_list_outputs
mate_rr_screen_new
mate_rr_screen_refresh
mate_rr_screen_set_primary_output
mate_rr_screen_set_size

View File

@ -0,0 +1,44 @@
/*
* mate-desktop.h: general functions for libmate-desktop
*
* Copyright (C) 2013 Stefano Karapetsas
*
* 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.
*
* Authors:
* Stefano Karapetsas <stefano@karapetsas.com>
*/
#ifndef __MATE_DESKTOP_H__
#define __MATE_DESKTOP_H__
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <glib.h>
G_BEGIN_DECLS
#define MATE_DESKTOP_CHECK_VERSION(major,minor,micro) \
(MATE_MAJOR > (major) || \
(MATE_MAJOR == (major) && MATE_MINOR > (minor)) || \
(MATE_MAJOR == (major) && MATE_MINOR == (minor) && \
MATE_MICRO >= (micro)))
G_END_DECLS
#endif /* __MATE_DESKTOP_H__ */

View File

@ -0,0 +1,6 @@
{
global:
mate_*;
local:
*;
};

View File

@ -0,0 +1,188 @@
/*
* mate-gsettings.c: helper API for GSettings
*
* Copyright (C) 2013 Stefano Karapetsas
*
* 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.
*
* Authors:
* Stefano Karapetsas <stefano@karapetsas.com>
*/
#include "mate-gsettings.h"
/**
* mate_gsettings_schema_exists:
* @schema: schema to check.
*
* Check if a given schema is installed in GSettings.
*
* Return value: TRUE if schema exists, FALSE if not.
*
* Since: 1.7.1
*/
gboolean
mate_gsettings_schema_exists (const gchar* schema)
{
GSettingsSchemaSource *schema_source;
GSettingsSchema *schema_schema;
gboolean schema_exists;
schema_source = g_settings_schema_source_get_default();
schema_schema = g_settings_schema_source_lookup (schema_source, schema, FALSE);
schema_exists = (schema_schema != NULL);
if (schema_schema)
g_settings_schema_unref (schema_schema);
return schema_exists;
}
/* (copied from gnome-panel)
* Adapted from is_valid_keyname() in glib (gio/glib-compile-schemas.c)
* Differences:
* - gettext support removed (we don't need translations here)
* - remove support for allow_any_name
*/
gboolean
mate_gsettings_is_valid_keyname (const gchar *key,
GError **error)
{
gint i;
if (key[0] == '\0')
{
g_set_error_literal (error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
"empty names are not permitted");
return FALSE;
}
if (!g_ascii_islower (key[0]))
{
g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
"invalid name '%s': names must begin "
"with a lowercase letter", key);
return FALSE;
}
for (i = 1; key[i]; i++)
{
if (key[i] != '-' &&
!g_ascii_islower (key[i]) &&
!g_ascii_isdigit (key[i]))
{
g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
"invalid name '%s': invalid character '%c'; "
"only lowercase letters, numbers and dash ('-') "
"are permitted.", key, key[i]);
return FALSE;
}
if (key[i] == '-' && key[i + 1] == '-')
{
g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
"invalid name '%s': two successive dashes ('--') "
"are not permitted.", key);
return FALSE;
}
}
if (key[i - 1] == '-')
{
g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
"invalid name '%s': the last character may not be a "
"dash ('-').", key);
return FALSE;
}
if (i > 32)
{
g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
"invalid name '%s': maximum length is 32", key);
return FALSE;
}
return TRUE;
}
gboolean
mate_gsettings_append_strv (GSettings *settings,
const gchar *key,
const gchar *value)
{
gchar **old;
gchar **new;
gint size;
gboolean retval;
old = g_settings_get_strv (settings, key);
for (size = 0; old[size] != NULL; size++);
size += 1; /* appended value */
size += 1; /* NULL */
new = g_realloc_n (old, size, sizeof (gchar *));
new[size - 2] = g_strdup (value);
new[size - 1] = NULL;
retval = g_settings_set_strv (settings, key,
(const gchar **) new);
g_strfreev (new);
return retval;
}
gboolean
mate_gsettings_remove_all_from_strv (GSettings *settings,
const gchar *key,
const gchar *value)
{
GArray *array;
gchar **old;
gint i;
gboolean retval;
old = g_settings_get_strv (settings, key);
array = g_array_new (TRUE, TRUE, sizeof (gchar *));
for (i = 0; old[i] != NULL; i++) {
if (g_strcmp0 (old[i], value) != 0)
array = g_array_append_val (array, old[i]);
}
retval = g_settings_set_strv (settings, key,
(const gchar **) array->data);
g_strfreev (old);
g_array_free (array, TRUE);
return retval;
}
GSList*
mate_gsettings_strv_to_gslist (const gchar *const *array)
{
GSList *list = NULL;
gint i;
if (array != NULL) {
for (i = 0; array[i]; i++) {
list = g_slist_append (list, g_strdup (array[i]));
}
}
return list;
}

View File

@ -0,0 +1,50 @@
/*
* mate-gsettings.h: helper API for GSettings
*
* Copyright (C) 2013 Stefano Karapetsas
*
* 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.
*
* Authors:
* Stefano Karapetsas <stefano@karapetsas.com>
*/
#ifndef __MATE_GSETTINGS_H__
#define __MATE_GSETTINGS_H__
#include <glib.h>
#include <gio/gio.h>
G_BEGIN_DECLS
gboolean mate_gsettings_schema_exists (const gchar* schema);
gboolean mate_gsettings_is_valid_keyname (const gchar *key,
GError **error);
gboolean mate_gsettings_append_strv (GSettings *settings,
const gchar *key,
const gchar *value);
gboolean mate_gsettings_remove_all_from_strv (GSettings *settings,
const gchar *key,
const gchar *value);
GSList* mate_gsettings_strv_to_gslist (const gchar *const *array);
G_END_DECLS
#endif /* __MATE_GSETTINGS_H__ */

1439
libmate-desktop/mate-hsv.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,99 @@
/* HSV color selector for GTK+
*
* Copyright (C) 1999 The Free Software Foundation
*
* Authors: Simon Budig <Simon.Budig@unix-ag.org> (original code)
* Federico Mena-Quintero <federico@gimp.org> (cleanup for GTK+)
* Jonathan Blandford <jrb@redhat.com> (cleanup for GTK+)
*
* 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 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, see <http://www.gnu.org/licenses/>.
*/
/*
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*
* Modified to work internally in mate-desktop by Pablo Barciela 2019
*/
#ifndef __MATE_HSV_H__
#define __MATE_HSV_H__
#include <gtk/gtk.h>
G_BEGIN_DECLS
#define MATE_TYPE_HSV (mate_hsv_get_type ())
#define MATE_HSV(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MATE_TYPE_HSV, MateHSV))
#define MATE_HSV_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MATE_TYPE_HSV, MateHSVClass))
#define MATE_IS_HSV(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MATE_TYPE_HSV))
#define MATE_IS_HSV_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MATE_TYPE_HSV))
#define MATE_HSV_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MATE_TYPE_HSV, MateHSVClass))
typedef struct _MateHSV MateHSV;
typedef struct _MateHSVPrivate MateHSVPrivate;
typedef struct _MateHSVClass MateHSVClass;
struct _MateHSV
{
GtkWidget parent_instance;
/*< private >*/
MateHSVPrivate *priv;
};
struct _MateHSVClass
{
GtkWidgetClass parent_class;
/* Notification signals */
void (* changed) (MateHSV *hsv);
/* Keybindings */
void (* move) (MateHSV *hsv,
GtkDirectionType type);
/* Padding for future expansion */
void (*_gtk_reserved1) (void);
void (*_gtk_reserved2) (void);
void (*_gtk_reserved3) (void);
void (*_gtk_reserved4) (void);
};
GType mate_hsv_get_type (void) G_GNUC_CONST;
GtkWidget* mate_hsv_new (void);
void mate_hsv_set_color (MateHSV *hsv,
double h,
double s,
double v);
void mate_hsv_get_color (MateHSV *hsv,
gdouble *h,
gdouble *s,
gdouble *v);
void mate_hsv_set_metrics (MateHSV *hsv,
gint size,
gint ring_width);
void mate_hsv_get_metrics (MateHSV *hsv,
gint *size,
gint *ring_width);
gboolean mate_hsv_is_adjusting (MateHSV *hsv);
G_END_DECLS
#endif /* __MATE_HSV_H__ */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,53 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
* Copyright 2008 Red Hat, Inc.
* Copyright 2007 William Jon McCann <mccann@jhu.edu>
*
* 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, see <http://www.gnu.org/licenses/>.
*
* Written by: Ray Strode
* William Jon McCann
*/
#ifndef __MATE_LANGUAGES_H
#define __MATE_LANGUAGES_H
#ifndef MATE_DESKTOP_USE_UNSTABLE_API
#error This is unstable API. You must define MATE_DESKTOP_USE_UNSTABLE_API before including mate-languages.h
#endif
#include <glib.h>
G_BEGIN_DECLS
char * mate_get_language_from_locale (const char *locale,
const char *translation);
char * mate_get_country_from_locale (const char *locale,
const char *translation);
char ** mate_get_all_locales (void);
gboolean mate_parse_locale (const char *locale,
char **language_codep,
char **country_codep,
char **codesetp,
char **modifierp);
char * mate_normalize_locale (const char *locale);
gboolean mate_language_has_translations (const char *code);
char * mate_get_language_from_code (const char *code,
const char *translation);
char * mate_get_country_from_code (const char *code,
const char *translation);
G_END_DECLS
#endif /* __MATE_LANGUAGES_H */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,151 @@
/* mate-rr-config.h
* -*- c-basic-offset: 4 -*-
*
* Copyright 2007, 2008, Red Hat, Inc.
* Copyright 2010 Giovanni Campagna
*
* This file is part of the Mate Library.
*
* The Mate Library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* The Mate 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with the Mate Library; see the file COPYING.LIB. If not,
* write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
* Author: Soren Sandmann <sandmann@redhat.com>
*/
#ifndef MATE_RR_CONFIG_H
#define MATE_RR_CONFIG_H
#ifndef MATE_DESKTOP_USE_UNSTABLE_API
#error mate-rr-config.h is unstable API. You must define MATE_DESKTOP_USE_UNSTABLE_API before including mate-rr-config.h
#endif
#include "mate-rr.h"
#include <glib.h>
#include <glib-object.h>
typedef struct MateRROutputInfoPrivate MateRROutputInfoPrivate;
typedef struct MateRRConfigPrivate MateRRConfigPrivate;
typedef struct
{
GObject parent;
/*< private >*/
MateRROutputInfoPrivate *priv;
} MateRROutputInfo;
typedef struct
{
GObjectClass parent_class;
} MateRROutputInfoClass;
#define MATE_TYPE_RR_OUTPUT_INFO (mate_rr_output_info_get_type())
#define MATE_RR_OUTPUT_INFO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MATE_TYPE_RR_OUTPUT_INFO, MateRROutputInfo))
#define MATE_IS_RR_OUTPUT_INFO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MATE_TYPE_RR_OUTPUT_INFO))
#define MATE_RR_OUTPUT_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MATE_TYPE_RR_OUTPUT_INFO, MateRROutputInfoClass))
#define MATE_IS_RR_OUTPUT_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MATE_TYPE_RR_OUTPUT_INFO))
#define MATE_RR_OUTPUT_INFO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MATE_TYPE_RR_OUTPUT_INFO, MateRROutputInfoClass))
GType mate_rr_output_info_get_type (void);
char *mate_rr_output_info_get_name (MateRROutputInfo *self);
gboolean mate_rr_output_info_is_active (MateRROutputInfo *self);
void mate_rr_output_info_set_active (MateRROutputInfo *self, gboolean active);
void mate_rr_output_info_get_geometry (MateRROutputInfo *self, int *x, int *y, int *width, int *height);
void mate_rr_output_info_set_geometry (MateRROutputInfo *self, int x, int y, int width, int height);
int mate_rr_output_info_get_refresh_rate (MateRROutputInfo *self);
void mate_rr_output_info_set_refresh_rate (MateRROutputInfo *self, int rate);
MateRRRotation mate_rr_output_info_get_rotation (MateRROutputInfo *self);
void mate_rr_output_info_set_rotation (MateRROutputInfo *self, MateRRRotation rotation);
gboolean mate_rr_output_info_is_connected (MateRROutputInfo *self);
void mate_rr_output_info_get_vendor (MateRROutputInfo *self, gchar* vendor);
guint mate_rr_output_info_get_product (MateRROutputInfo *self);
guint mate_rr_output_info_get_serial (MateRROutputInfo *self);
double mate_rr_output_info_get_aspect_ratio (MateRROutputInfo *self);
char *mate_rr_output_info_get_display_name (MateRROutputInfo *self);
gboolean mate_rr_output_info_get_primary (MateRROutputInfo *self);
void mate_rr_output_info_set_primary (MateRROutputInfo *self, gboolean primary);
int mate_rr_output_info_get_preferred_width (MateRROutputInfo *self);
int mate_rr_output_info_get_preferred_height (MateRROutputInfo *self);
typedef struct
{
GObject parent;
/*< private >*/
MateRRConfigPrivate *priv;
} MateRRConfig;
typedef struct
{
GObjectClass parent_class;
} MateRRConfigClass;
#define MATE_TYPE_RR_CONFIG (mate_rr_config_get_type())
#define MATE_RR_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MATE_TYPE_RR_CONFIG, MateRRConfig))
#define MATE_IS_RR_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MATE_TYPE_RR_CONFIG))
#define MATE_RR_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MATE_TYPE_RR_CONFIG, MateRRConfigClass))
#define MATE_IS_RR_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MATE_TYPE_RR_CONFIG))
#define MATE_RR_CONFIG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MATE_TYPE_RR_CONFIG, MateRRConfigClass))
GType mate_rr_config_get_type (void);
MateRRConfig *mate_rr_config_new_current (MateRRScreen *screen,
GError **error);
MateRRConfig *mate_rr_config_new_stored (MateRRScreen *screen,
GError **error);
gboolean mate_rr_config_load_current (MateRRConfig *self,
GError **error);
gboolean mate_rr_config_load_filename (MateRRConfig *self,
const gchar *filename,
GError **error);
gboolean mate_rr_config_match (MateRRConfig *config1,
MateRRConfig *config2);
gboolean mate_rr_config_equal (MateRRConfig *config1,
MateRRConfig *config2);
gboolean mate_rr_config_save (MateRRConfig *configuration,
GError **error);
void mate_rr_config_sanitize (MateRRConfig *configuration);
gboolean mate_rr_config_ensure_primary (MateRRConfig *configuration);
gboolean mate_rr_config_apply_with_time (MateRRConfig *configuration,
MateRRScreen *screen,
guint32 timestamp,
GError **error);
gboolean mate_rr_config_apply_from_filename_with_time (MateRRScreen *screen,
const char *filename,
guint32 timestamp,
GError **error);
gboolean mate_rr_config_applicable (MateRRConfig *configuration,
MateRRScreen *screen,
GError **error);
gboolean mate_rr_config_get_clone (MateRRConfig *configuration);
void mate_rr_config_set_clone (MateRRConfig *configuration, gboolean clone);
MateRROutputInfo **mate_rr_config_get_outputs (MateRRConfig *configuration);
char *mate_rr_config_get_backup_filename (void);
char *mate_rr_config_get_intended_filename (void);
#endif

View File

@ -0,0 +1,548 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
*
* mate-rr-labeler.c - Utility to label monitors to identify them
* while they are being configured.
*
* Copyright 2008, Novell, Inc.
*
* This file is part of the Mate Library.
*
* The Mate Library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* The Mate 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with the Mate Library; see the file COPYING.LIB. If not,
* write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
* Author: Federico Mena-Quintero <federico@novell.com>
*/
#define MATE_DESKTOP_USE_UNSTABLE_API
#include <config.h>
#include <glib/gi18n-lib.h>
#include <gtk/gtk.h>
#include <X11/Xproto.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>
#include <gdk/gdkx.h>
#include "mate-rr-labeler.h"
struct _MateRRLabelerPrivate {
MateRRConfig *config;
int num_outputs;
GdkRGBA *palette;
GtkWidget **windows;
GdkScreen *screen;
Atom workarea_atom;
};
enum {
PROP_0,
PROP_CONFIG,
PROP_LAST
};
G_DEFINE_TYPE_WITH_PRIVATE (MateRRLabeler, mate_rr_labeler, G_TYPE_OBJECT);
static void mate_rr_labeler_finalize (GObject *object);
static void create_label_windows (MateRRLabeler *labeler);
static void setup_from_config (MateRRLabeler *labeler);
static int
get_current_desktop (GdkScreen *screen)
{
Display *display;
Window win;
Atom current_desktop, type;
int format;
unsigned long n_items, bytes_after;
unsigned char *data_return = NULL;
int workspace = 0;
display = GDK_DISPLAY_XDISPLAY (gdk_screen_get_display (screen));
win = XRootWindow (display, GDK_SCREEN_XNUMBER (screen));
current_desktop = XInternAtom (display, "_NET_CURRENT_DESKTOP", True);
XGetWindowProperty (display,
win,
current_desktop,
0, G_MAXLONG,
False, XA_CARDINAL,
&type, &format, &n_items, &bytes_after,
&data_return);
if (type == XA_CARDINAL && format == 32 && n_items > 0)
workspace = (int) data_return[0];
if (data_return)
XFree (data_return);
return workspace;
}
static gboolean
get_work_area (MateRRLabeler *labeler,
GdkRectangle *rect)
{
Atom workarea;
Atom type;
Window win;
int format;
gulong num;
gulong leftovers;
gulong max_len = 4 * 32;
guchar *ret_workarea;
long *workareas;
int result;
int disp_screen;
int desktop;
Display *display;
display = GDK_DISPLAY_XDISPLAY (gdk_screen_get_display (labeler->priv->screen));
workarea = XInternAtom (display, "_NET_WORKAREA", True);
disp_screen = GDK_SCREEN_XNUMBER (labeler->priv->screen);
/* Defaults in case of error */
rect->x = 0;
rect->y = 0;
rect->width = WidthOfScreen (gdk_x11_screen_get_xscreen (labeler->priv->screen));
rect->height = HeightOfScreen (gdk_x11_screen_get_xscreen (labeler->priv->screen));
if (workarea == None)
return FALSE;
win = XRootWindow (display, disp_screen);
result = XGetWindowProperty (display,
win,
workarea,
0,
max_len,
False,
AnyPropertyType,
&type,
&format,
&num,
&leftovers,
&ret_workarea);
if (result != Success
|| type == None
|| format == 0
|| leftovers
|| num % 4) {
return FALSE;
}
desktop = get_current_desktop (labeler->priv->screen);
workareas = (long *) ret_workarea;
rect->x = workareas[desktop * 4];
rect->y = workareas[desktop * 4 + 1];
rect->width = workareas[desktop * 4 + 2];
rect->height = workareas[desktop * 4 + 3];
XFree (ret_workarea);
return TRUE;
}
static GdkFilterReturn
screen_xevent_filter (GdkXEvent *xevent,
GdkEvent *event,
MateRRLabeler *labeler)
{
XEvent *xev;
xev = (XEvent *) xevent;
if (xev->type == PropertyNotify &&
xev->xproperty.atom == labeler->priv->workarea_atom) {
/* update label positions */
mate_rr_labeler_hide (labeler);
create_label_windows (labeler);
}
return GDK_FILTER_CONTINUE;
}
static void
mate_rr_labeler_init (MateRRLabeler *labeler)
{
GdkWindow *gdkwindow;
labeler->priv = mate_rr_labeler_get_instance_private (labeler);
labeler->priv->workarea_atom = XInternAtom (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()),
"_NET_WORKAREA",
True);
labeler->priv->screen = gdk_screen_get_default ();
/* code is not really designed to handle multiple screens so *shrug* */
gdkwindow = gdk_screen_get_root_window (labeler->priv->screen);
gdk_window_add_filter (gdkwindow, (GdkFilterFunc) screen_xevent_filter, labeler);
gdk_window_set_events (gdkwindow, gdk_window_get_events (gdkwindow) | GDK_PROPERTY_CHANGE_MASK);
}
static void
mate_rr_labeler_set_property (GObject *gobject, guint property_id, const GValue *value, GParamSpec *param_spec)
{
MateRRLabeler *self = MATE_RR_LABELER (gobject);
switch (property_id) {
case PROP_CONFIG:
self->priv->config = MATE_RR_CONFIG (g_value_dup_object (value));
return;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, property_id, param_spec);
}
}
static GObject *
mate_rr_labeler_constructor (GType type, guint n_construct_properties, GObjectConstructParam *construct_properties)
{
MateRRLabeler *self = (MateRRLabeler*) G_OBJECT_CLASS (mate_rr_labeler_parent_class)->constructor (type, n_construct_properties, construct_properties);
setup_from_config (self);
return (GObject*) self;
}
static void
mate_rr_labeler_class_init (MateRRLabelerClass *klass)
{
GObjectClass *object_class;
object_class = (GObjectClass *) klass;
object_class->set_property = mate_rr_labeler_set_property;
object_class->finalize = mate_rr_labeler_finalize;
object_class->constructor = mate_rr_labeler_constructor;
g_object_class_install_property (object_class, PROP_CONFIG, g_param_spec_object ("config",
"Configuration",
"RandR configuration to label",
MATE_TYPE_RR_CONFIG,
G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
}
static void
mate_rr_labeler_finalize (GObject *object)
{
MateRRLabeler *labeler;
GdkWindow *gdkwindow;
labeler = MATE_RR_LABELER (object);
gdkwindow = gdk_screen_get_root_window (labeler->priv->screen);
gdk_window_remove_filter (gdkwindow, (GdkFilterFunc) screen_xevent_filter, labeler);
if (labeler->priv->config != NULL) {
g_object_unref (labeler->priv->config);
}
if (labeler->priv->windows != NULL) {
mate_rr_labeler_hide (labeler);
g_free (labeler->priv->windows);
}
g_free (labeler->priv->palette);
G_OBJECT_CLASS (mate_rr_labeler_parent_class)->finalize (object);
}
static int
count_outputs (MateRRConfig *config)
{
int i;
MateRROutputInfo **outputs = mate_rr_config_get_outputs (config);
for (i = 0; outputs[i] != NULL; i++)
;
return i;
}
static void
make_palette (MateRRLabeler *labeler)
{
/* The idea is that we go around an hue color wheel. We want to start
* at red, go around to green/etc. and stop at blue --- because magenta
* is evil. Eeeeek, no magenta, please!
*
* Purple would be nice, though. Remember that we are watered down
* (i.e. low saturation), so that would be like Like berries with cream.
* Mmmmm, berries.
*/
double start_hue;
double end_hue;
int i;
g_assert (labeler->priv->num_outputs > 0);
labeler->priv->palette = g_new (GdkRGBA, labeler->priv->num_outputs);
start_hue = 0.0; /* red */
end_hue = 2.0/3; /* blue */
for (i = 0; i < labeler->priv->num_outputs; i++) {
double h, s, v;
double r, g, b;
h = start_hue + (end_hue - start_hue) / labeler->priv->num_outputs * i;
s = 1.0 / 3;
v = 1.0;
gtk_hsv_to_rgb (h, s, v, &r, &g, &b);
labeler->priv->palette[i].red = r;
labeler->priv->palette[i].green = g;
labeler->priv->palette[i].blue = b;
labeler->priv->palette[i].alpha = 1.0;
}
}
#define LABEL_WINDOW_EDGE_THICKNESS 2
#define LABEL_WINDOW_PADDING 12
static gboolean
label_window_draw_event_cb (GtkWidget *widget, cairo_t *cr, gpointer data)
{
GdkRGBA *color;
GtkAllocation allocation;
color = g_object_get_data (G_OBJECT (widget), "color");
gtk_widget_get_allocation (widget, &allocation);
/* edge outline */
cairo_set_source_rgb (cr, 0, 0, 0);
cairo_rectangle (cr,
LABEL_WINDOW_EDGE_THICKNESS / 2.0,
LABEL_WINDOW_EDGE_THICKNESS / 2.0,
allocation.width - LABEL_WINDOW_EDGE_THICKNESS,
allocation.height - LABEL_WINDOW_EDGE_THICKNESS);
cairo_set_line_width (cr, LABEL_WINDOW_EDGE_THICKNESS);
cairo_stroke (cr);
/* fill */
gdk_cairo_set_source_rgba (cr, color);
cairo_rectangle (cr,
LABEL_WINDOW_EDGE_THICKNESS,
LABEL_WINDOW_EDGE_THICKNESS,
allocation.width - LABEL_WINDOW_EDGE_THICKNESS * 2,
allocation.height - LABEL_WINDOW_EDGE_THICKNESS * 2);
cairo_fill (cr);
return FALSE;
}
static void
position_window (MateRRLabeler *labeler,
GtkWidget *window,
int x,
int y)
{
GdkRectangle workarea;
GdkRectangle monitor;
GdkMonitor *monitor_num;
get_work_area (labeler, &workarea);
monitor_num = gdk_display_get_monitor_at_point (gdk_screen_get_display (labeler->priv->screen), x, y);
gdk_monitor_get_geometry (monitor_num, &monitor);
gdk_rectangle_intersect (&monitor, &workarea, &workarea);
gtk_window_move (GTK_WINDOW (window), workarea.x, workarea.y);
}
static GtkWidget *
create_label_window (MateRRLabeler *labeler, MateRROutputInfo *output, GdkRGBA *color)
{
GtkWidget *window;
GtkWidget *widget;
char *str;
char *display_name;
GdkRGBA black = { 0, 0, 0, 1.0 };
int x,y;
window = gtk_window_new (GTK_WINDOW_POPUP);
gtk_widget_set_app_paintable (window, TRUE);
gtk_container_set_border_width (GTK_CONTAINER (window), LABEL_WINDOW_PADDING + LABEL_WINDOW_EDGE_THICKNESS);
/* This is semi-dangerous. The color is part of the labeler->palette
* array. Note that in mate_rr_labeler_finalize(), we are careful to
* free the palette only after we free the windows.
*/
g_object_set_data (G_OBJECT (window), "color", color);
g_signal_connect (window, "draw",
G_CALLBACK (label_window_draw_event_cb), labeler);
if (mate_rr_config_get_clone (labeler->priv->config)) {
/* Keep this string in sync with mate-control-center/capplets/display/xrandr-capplet.c:get_display_name() */
/* Translators: this is the feature where what you see on your laptop's
* screen is the same as your external monitor. Here, "Mirror" is being
* used as an adjective, not as a verb. For example, the Spanish
* translation could be "Pantallas en Espejo", *not* "Espejar Pantallas".
*/
display_name = g_strdup_printf (_("Mirror Screens"));
str = g_strdup_printf ("<b>%s</b>", display_name);
} else {
display_name = g_strdup_printf ("<b>%s</b>\n<small>%s</small>", mate_rr_output_info_get_display_name (output), mate_rr_output_info_get_name (output));
str = g_strdup_printf ("%s", display_name);
}
g_free (display_name);
widget = gtk_label_new (NULL);
gtk_label_set_markup (GTK_LABEL (widget), str);
g_free (str);
/* Make the label explicitly black. We don't want it to follow the
* theme's colors, since the label is always shown against a light
* pastel background. See bgo#556050
*/
gtk_widget_override_color (widget, gtk_widget_get_state_flags (widget), &black);
gtk_container_add (GTK_CONTAINER (window), widget);
/* Should we center this at the top edge of the monitor, instead of using the upper-left corner? */
mate_rr_output_info_get_geometry (output, &x, &y, NULL, NULL);
position_window (labeler, window, x, y);
gtk_widget_show_all (window);
return window;
}
static void
create_label_windows (MateRRLabeler *labeler)
{
int i;
gboolean created_window_for_clone;
MateRROutputInfo **outputs;
labeler->priv->windows = g_new (GtkWidget *, labeler->priv->num_outputs);
created_window_for_clone = FALSE;
outputs = mate_rr_config_get_outputs (labeler->priv->config);
for (i = 0; i < labeler->priv->num_outputs; i++) {
if (!created_window_for_clone && mate_rr_output_info_is_active (outputs[i])) {
labeler->priv->windows[i] = create_label_window (labeler, outputs[i], labeler->priv->palette + i);
if (mate_rr_config_get_clone (labeler->priv->config))
created_window_for_clone = TRUE;
} else
labeler->priv->windows[i] = NULL;
}
}
static void
setup_from_config (MateRRLabeler *labeler)
{
labeler->priv->num_outputs = count_outputs (labeler->priv->config);
make_palette (labeler);
create_label_windows (labeler);
}
/**
* mate_rr_labeler_new:
* @config: Configuration of the screens to label
*
* Create a GUI element that will display colored labels on each connected monitor.
* This is useful when users are required to identify which monitor is which, e.g. for
* for configuring multiple monitors.
* The labels will be shown by default, use mate_rr_labeler_hide to hide them.
*
* Returns: A new #MateRRLabeler
*/
MateRRLabeler *
mate_rr_labeler_new (MateRRConfig *config)
{
g_return_val_if_fail (MATE_IS_RR_CONFIG (config), NULL);
return g_object_new (MATE_TYPE_RR_LABELER, "config", config, NULL);
}
/**
* mate_rr_labeler_hide:
* @labeler: A #MateRRLabeler
*
* Hide ouput labels.
*/
void
mate_rr_labeler_hide (MateRRLabeler *labeler)
{
int i;
MateRRLabelerPrivate *priv;
g_return_if_fail (MATE_IS_RR_LABELER (labeler));
priv = labeler->priv;
if (priv->windows == NULL)
return;
for (i = 0; i < priv->num_outputs; i++)
if (priv->windows[i] != NULL) {
gtk_widget_destroy (priv->windows[i]);
priv->windows[i] = NULL;
}
g_free (priv->windows);
priv->windows = NULL;
}
/**
* mate_rr_labeler_get_rgba_for_output:
* @labeler: A #MateRRLabeler
* @output: Output device (i.e. monitor) to query
* @color_out: (out): Color of selected monitor.
*
* Get the color used for the label on a given output (monitor).
*/
void
mate_rr_labeler_get_rgba_for_output (MateRRLabeler *labeler, MateRROutputInfo *output, GdkRGBA *color_out)
{
int i;
MateRROutputInfo **outputs;
g_return_if_fail (MATE_IS_RR_LABELER (labeler));
g_return_if_fail (MATE_IS_RR_OUTPUT_INFO (output));
g_return_if_fail (color_out != NULL);
outputs = mate_rr_config_get_outputs (labeler->priv->config);
for (i = 0; i < labeler->priv->num_outputs; i++)
if (outputs[i] == output) {
*color_out = labeler->priv->palette[i];
return;
}
g_warning ("trying to get the color for unknown MateOutputInfo %p; returning magenta!", output);
color_out->red = 1.0;
color_out->green = 0.0;
color_out->blue = 1.0;
color_out->alpha = 1.0;
}

View File

@ -0,0 +1,65 @@
/* mate-rr-labeler.h - Utility to label monitors to identify them
* while they are being configured.
*
* Copyright 2008, Novell, Inc.
*
* This file is part of the Mate Library.
*
* The Mate Library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* The Mate 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with the Mate Library; see the file COPYING.LIB. If not,
* write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
* Author: Federico Mena-Quintero <federico@novell.com>
*/
#ifndef MATE_RR_LABELER_H
#define MATE_RR_LABELER_H
#ifndef MATE_DESKTOP_USE_UNSTABLE_API
#error MateRR is unstable API. You must define MATE_DESKTOP_USE_UNSTABLE_API before including materr.h
#endif
#include "mate-rr-config.h"
#define MATE_TYPE_RR_LABELER (mate_rr_labeler_get_type ())
#define MATE_RR_LABELER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MATE_TYPE_RR_LABELER, MateRRLabeler))
#define MATE_RR_LABELER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MATE_TYPE_RR_LABELER, MateRRLabelerClass))
#define MATE_IS_RR_LABELER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MATE_TYPE_RR_LABELER))
#define MATE_IS_RR_LABELER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MATE_TYPE_RR_LABELER))
#define MATE_RR_LABELER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MATE_TYPE_RR_LABELER, MateRRLabelerClass))
typedef struct _MateRRLabeler MateRRLabeler;
typedef struct _MateRRLabelerClass MateRRLabelerClass;
typedef struct _MateRRLabelerPrivate MateRRLabelerPrivate;
struct _MateRRLabeler {
GObject parent;
/*< private >*/
MateRRLabelerPrivate *priv;
};
struct _MateRRLabelerClass {
GObjectClass parent_class;
};
GType mate_rr_labeler_get_type (void);
MateRRLabeler *mate_rr_labeler_new (MateRRConfig *config);
void mate_rr_labeler_hide (MateRRLabeler *labeler);
void mate_rr_labeler_get_rgba_for_output (MateRRLabeler *labeler, MateRROutputInfo *output, GdkRGBA *color_out);
#endif

View File

@ -0,0 +1,252 @@
/* mate-rr-output-info.c
* -*- c-basic-offset: 4 -*-
*
* Copyright 2010 Giovanni Campagna
*
* This file is part of the Mate Desktop Library.
*
* The Mate Desktop Library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* The Mate 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with the Mate Desktop Library; see the file COPYING.LIB. If not,
* write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#define MATE_DESKTOP_USE_UNSTABLE_API
#include <config.h>
#include "mate-rr-config.h"
#include "edid.h"
#include "mate-rr-private.h"
G_DEFINE_TYPE_WITH_PRIVATE (MateRROutputInfo, mate_rr_output_info, G_TYPE_OBJECT)
static void
mate_rr_output_info_init (MateRROutputInfo *self)
{
self->priv = mate_rr_output_info_get_instance_private (self);
self->priv->name = NULL;
self->priv->on = FALSE;
self->priv->display_name = NULL;
}
static void
mate_rr_output_info_finalize (GObject *gobject)
{
MateRROutputInfo *self = MATE_RR_OUTPUT_INFO (gobject);
g_free (self->priv->name);
g_free (self->priv->display_name);
G_OBJECT_CLASS (mate_rr_output_info_parent_class)->finalize (gobject);
}
static void
mate_rr_output_info_class_init (MateRROutputInfoClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
gobject_class->finalize = mate_rr_output_info_finalize;
}
/**
* mate_rr_output_info_get_name:
*
* Returns: (transfer none): the output name
*/
char *mate_rr_output_info_get_name (MateRROutputInfo *self)
{
g_return_val_if_fail (MATE_IS_RR_OUTPUT_INFO (self), NULL);
return self->priv->name;
}
/**
* mate_rr_output_info_is_active:
*
* Returns: whether there is a CRTC assigned to this output (i.e. a signal is being sent to it)
*/
gboolean mate_rr_output_info_is_active (MateRROutputInfo *self)
{
g_return_val_if_fail (MATE_IS_RR_OUTPUT_INFO (self), FALSE);
return self->priv->on;
}
void mate_rr_output_info_set_active (MateRROutputInfo *self, gboolean active)
{
g_return_if_fail (MATE_IS_RR_OUTPUT_INFO (self));
self->priv->on = active;
}
/**
* mate_rr_output_info_get_geometry:
* @self: a #MateRROutputInfo
* @x: (out) (allow-none):
* @y: (out) (allow-none):
* @width: (out) (allow-none):
* @height: (out) (allow-none):
*/
void mate_rr_output_info_get_geometry (MateRROutputInfo *self, int *x, int *y, int *width, int *height)
{
g_return_if_fail (MATE_IS_RR_OUTPUT_INFO (self));
if (x)
*x = self->priv->x;
if (y)
*y = self->priv->y;
if (width)
*width = self->priv->width;
if (height)
*height = self->priv->height;
}
/**
* mate_rr_output_info_set_geometry:
* @self: a #MateRROutputInfo
* @x: x offset for monitor
* @y: y offset for monitor
* @width: monitor width
* @height: monitor height
*
* Set the geometry for the monitor connected to the specified output.
*/
void mate_rr_output_info_set_geometry (MateRROutputInfo *self, int x, int y, int width, int height)
{
g_return_if_fail (MATE_IS_RR_OUTPUT_INFO (self));
self->priv->x = x;
self->priv->y = y;
self->priv->width = width;
self->priv->height = height;
}
int mate_rr_output_info_get_refresh_rate (MateRROutputInfo *self)
{
g_return_val_if_fail (MATE_IS_RR_OUTPUT_INFO (self), 0);
return self->priv->rate;
}
void mate_rr_output_info_set_refresh_rate (MateRROutputInfo *self, int rate)
{
g_return_if_fail (MATE_IS_RR_OUTPUT_INFO (self));
self->priv->rate = rate;
}
MateRRRotation mate_rr_output_info_get_rotation (MateRROutputInfo *self)
{
g_return_val_if_fail (MATE_IS_RR_OUTPUT_INFO (self), MATE_RR_ROTATION_0);
return self->priv->rotation;
}
void mate_rr_output_info_set_rotation (MateRROutputInfo *self, MateRRRotation rotation)
{
g_return_if_fail (MATE_IS_RR_OUTPUT_INFO (self));
self->priv->rotation = rotation;
}
/**
* mate_rr_output_info_is_connected:
*
* Returns: whether the output is physically connected to a monitor
*/
gboolean mate_rr_output_info_is_connected (MateRROutputInfo *self)
{
g_return_val_if_fail (MATE_IS_RR_OUTPUT_INFO (self), FALSE);
return self->priv->connected;
}
/**
* mate_rr_output_info_get_vendor:
* @self: a #MateRROutputInfo
* @vendor: (out caller-allocates) (array fixed-size=4):
*/
void mate_rr_output_info_get_vendor (MateRROutputInfo *self, gchar* vendor)
{
g_return_if_fail (MATE_IS_RR_OUTPUT_INFO (self));
g_return_if_fail (vendor != NULL);
vendor[0] = self->priv->vendor[0];
vendor[1] = self->priv->vendor[1];
vendor[2] = self->priv->vendor[2];
vendor[3] = self->priv->vendor[3];
}
guint mate_rr_output_info_get_product (MateRROutputInfo *self)
{
g_return_val_if_fail (MATE_IS_RR_OUTPUT_INFO (self), 0);
return self->priv->product;
}
guint mate_rr_output_info_get_serial (MateRROutputInfo *self)
{
g_return_val_if_fail (MATE_IS_RR_OUTPUT_INFO (self), 0);
return self->priv->serial;
}
double mate_rr_output_info_get_aspect_ratio (MateRROutputInfo *self)
{
g_return_val_if_fail (MATE_IS_RR_OUTPUT_INFO (self), 0);
return self->priv->aspect;
}
/**
* mate_rr_output_info_get_display_name:
*
* Returns: (transfer none): the display name of this output
*/
char *mate_rr_output_info_get_display_name (MateRROutputInfo *self)
{
g_return_val_if_fail (MATE_IS_RR_OUTPUT_INFO (self), NULL);
return self->priv->display_name;
}
gboolean mate_rr_output_info_get_primary (MateRROutputInfo *self)
{
g_return_val_if_fail (MATE_IS_RR_OUTPUT_INFO (self), FALSE);
return self->priv->primary;
}
void mate_rr_output_info_set_primary (MateRROutputInfo *self, gboolean primary)
{
g_return_if_fail (MATE_IS_RR_OUTPUT_INFO (self));
self->priv->primary = primary;
}
int mate_rr_output_info_get_preferred_width (MateRROutputInfo *self)
{
g_return_val_if_fail (MATE_IS_RR_OUTPUT_INFO (self), 0);
return self->priv->pref_width;
}
int mate_rr_output_info_get_preferred_height (MateRROutputInfo *self)
{
g_return_val_if_fail (MATE_IS_RR_OUTPUT_INFO (self), 0);
return self->priv->pref_height;
}

View File

@ -0,0 +1,84 @@
#ifndef MATE_RR_PRIVATE_H
#define MATE_RR_PRIVATE_H
#include <X11/Xlib.h>
#ifdef HAVE_RANDR
#include <X11/extensions/Xrandr.h>
#endif
typedef struct ScreenInfo ScreenInfo;
struct ScreenInfo
{
int min_width;
int max_width;
int min_height;
int max_height;
#ifdef HAVE_RANDR
XRRScreenResources *resources;
#endif
MateRROutput ** outputs;
MateRRCrtc ** crtcs;
MateRRMode ** modes;
MateRRScreen * screen;
MateRRMode ** clone_modes;
#ifdef HAVE_RANDR
RROutput primary;
#endif
};
struct MateRRScreenPrivate
{
GdkScreen * gdk_screen;
GdkWindow * gdk_root;
Display * xdisplay;
Screen * xscreen;
Window xroot;
ScreenInfo * info;
int randr_event_base;
int rr_major_version;
int rr_minor_version;
Atom connector_type_atom;
};
struct MateRROutputInfoPrivate
{
char * name;
gboolean on;
int width;
int height;
int rate;
int x;
int y;
MateRRRotation rotation;
gboolean connected;
gchar vendor[4];
guint product;
guint serial;
double aspect;
int pref_width;
int pref_height;
char * display_name;
gboolean primary;
};
struct MateRRConfigPrivate
{
gboolean clone;
MateRRScreen *screen;
MateRROutputInfo **outputs;
};
gboolean _mate_rr_output_name_is_laptop (const char *name);
#endif

2164
libmate-desktop/mate-rr.c Normal file

File diff suppressed because it is too large Load Diff

200
libmate-desktop/mate-rr.h Normal file
View File

@ -0,0 +1,200 @@
/* mate-rr.h
*
* Copyright 2007, 2008, Red Hat, Inc.
*
* This file is part of the Mate Library.
*
* The Mate Library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* The Mate 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with the Mate Library; see the file COPYING.LIB. If not,
* write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
* Author: Soren Sandmann <sandmann@redhat.com>
*/
#ifndef MATE_RR_H
#define MATE_RR_H
#ifndef MATE_DESKTOP_USE_UNSTABLE_API
#error MateRR is unstable API. You must define MATE_DESKTOP_USE_UNSTABLE_API before including materr.h
#endif
#include <glib.h>
#include <gdk/gdk.h>
typedef struct MateRRScreenPrivate MateRRScreenPrivate;
typedef struct MateRROutput MateRROutput;
typedef struct MateRRCrtc MateRRCrtc;
typedef struct MateRRMode MateRRMode;
typedef struct {
GObject parent;
MateRRScreenPrivate* priv;
} MateRRScreen;
typedef struct {
GObjectClass parent_class;
void (* changed) (void);
} MateRRScreenClass;
typedef enum
{
MATE_RR_ROTATION_0 = (1 << 0),
MATE_RR_ROTATION_90 = (1 << 1),
MATE_RR_ROTATION_180 = (1 << 2),
MATE_RR_ROTATION_270 = (1 << 3),
MATE_RR_REFLECT_X = (1 << 4),
MATE_RR_REFLECT_Y = (1 << 5)
} MateRRRotation;
/* Error codes */
#define MATE_RR_ERROR (mate_rr_error_quark ())
GQuark mate_rr_error_quark (void);
typedef enum {
MATE_RR_ERROR_UNKNOWN, /* generic "fail" */
MATE_RR_ERROR_NO_RANDR_EXTENSION, /* RANDR extension is not present */
MATE_RR_ERROR_RANDR_ERROR, /* generic/undescribed error from the underlying XRR API */
MATE_RR_ERROR_BOUNDS_ERROR, /* requested bounds of a CRTC are outside the maximum size */
MATE_RR_ERROR_CRTC_ASSIGNMENT, /* could not assign CRTCs to outputs */
MATE_RR_ERROR_NO_MATCHING_CONFIG, /* none of the saved configurations matched the current configuration */
} MateRRError;
#define MATE_RR_CONNECTOR_TYPE_PANEL "Panel" /* This is a laptop's built-in LCD */
#define MATE_TYPE_RR_SCREEN (mate_rr_screen_get_type())
#define MATE_RR_SCREEN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MATE_TYPE_RR_SCREEN, MateRRScreen))
#define MATE_IS_RR_SCREEN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MATE_TYPE_RR_SCREEN))
#define MATE_RR_SCREEN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MATE_TYPE_RR_SCREEN, MateRRScreenClass))
#define MATE_IS_RR_SCREEN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MATE_TYPE_RR_SCREEN))
#define MATE_RR_SCREEN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MATE_TYPE_RR_SCREEN, MateRRScreenClass))
#define MATE_TYPE_RR_OUTPUT (mate_rr_output_get_type())
#define MATE_TYPE_RR_CRTC (mate_rr_crtc_get_type())
#define MATE_TYPE_RR_MODE (mate_rr_mode_get_type())
GType mate_rr_screen_get_type (void);
GType mate_rr_output_get_type (void);
GType mate_rr_crtc_get_type (void);
GType mate_rr_mode_get_type (void);
/* MateRRScreen */
MateRRScreen * mate_rr_screen_new (GdkScreen *screen,
GError **error);
MateRROutput **mate_rr_screen_list_outputs (MateRRScreen *screen);
MateRRCrtc ** mate_rr_screen_list_crtcs (MateRRScreen *screen);
MateRRMode ** mate_rr_screen_list_modes (MateRRScreen *screen);
MateRRMode ** mate_rr_screen_list_clone_modes (MateRRScreen *screen);
void mate_rr_screen_set_size (MateRRScreen *screen,
int width,
int height,
int mm_width,
int mm_height);
MateRRCrtc * mate_rr_screen_get_crtc_by_id (MateRRScreen *screen,
guint32 id);
gboolean mate_rr_screen_refresh (MateRRScreen *screen,
GError **error);
MateRROutput * mate_rr_screen_get_output_by_id (MateRRScreen *screen,
guint32 id);
MateRROutput * mate_rr_screen_get_output_by_name (MateRRScreen *screen,
const char *name);
void mate_rr_screen_get_ranges (MateRRScreen *screen,
int *min_width,
int *max_width,
int *min_height,
int *max_height);
void mate_rr_screen_get_timestamps (MateRRScreen *screen,
guint32 *change_timestamp_ret,
guint32 *config_timestamp_ret);
void mate_rr_screen_set_primary_output (MateRRScreen *screen,
MateRROutput *output);
/* MateRROutput */
guint32 mate_rr_output_get_id (MateRROutput *output);
const char * mate_rr_output_get_name (MateRROutput *output);
gboolean mate_rr_output_is_connected (MateRROutput *output);
int mate_rr_output_get_size_inches (MateRROutput *output);
int mate_rr_output_get_width_mm (MateRROutput *outout);
int mate_rr_output_get_height_mm (MateRROutput *output);
const guint8 * mate_rr_output_get_edid_data (MateRROutput *output);
MateRRCrtc ** mate_rr_output_get_possible_crtcs (MateRROutput *output);
MateRRMode * mate_rr_output_get_current_mode (MateRROutput *output);
MateRRCrtc * mate_rr_output_get_crtc (MateRROutput *output);
const char * mate_rr_output_get_connector_type (MateRROutput *output);
gboolean mate_rr_output_is_laptop (MateRROutput *output);
void mate_rr_output_get_position (MateRROutput *output,
int *x,
int *y);
gboolean mate_rr_output_can_clone (MateRROutput *output,
MateRROutput *clone);
MateRRMode ** mate_rr_output_list_modes (MateRROutput *output);
MateRRMode * mate_rr_output_get_preferred_mode (MateRROutput *output);
gboolean mate_rr_output_supports_mode (MateRROutput *output,
MateRRMode *mode);
gboolean mate_rr_output_get_is_primary (MateRROutput *output);
/* MateRRMode */
guint32 mate_rr_mode_get_id (MateRRMode *mode);
guint mate_rr_mode_get_width (MateRRMode *mode);
guint mate_rr_mode_get_height (MateRRMode *mode);
int mate_rr_mode_get_freq (MateRRMode *mode);
/* MateRRCrtc */
guint32 mate_rr_crtc_get_id (MateRRCrtc *crtc);
#ifndef MATE_DISABLE_DEPRECATED
gboolean mate_rr_crtc_set_config (MateRRCrtc *crtc,
int x,
int y,
MateRRMode *mode,
MateRRRotation rotation,
MateRROutput **outputs,
int n_outputs,
GError **error);
#endif
gboolean mate_rr_crtc_set_config_with_time (MateRRCrtc *crtc,
guint32 timestamp,
int x,
int y,
MateRRMode *mode,
MateRRRotation rotation,
MateRROutput **outputs,
int n_outputs,
GError **error);
gboolean mate_rr_crtc_can_drive_output (MateRRCrtc *crtc,
MateRROutput *output);
MateRRMode * mate_rr_crtc_get_current_mode (MateRRCrtc *crtc);
void mate_rr_crtc_get_position (MateRRCrtc *crtc,
int *x,
int *y);
MateRRRotation mate_rr_crtc_get_current_rotation (MateRRCrtc *crtc);
MateRRRotation mate_rr_crtc_get_rotations (MateRRCrtc *crtc);
gboolean mate_rr_crtc_supports_rotation (MateRRCrtc *crtc,
MateRRRotation rotation);
gboolean mate_rr_crtc_get_gamma (MateRRCrtc *crtc,
int *size,
unsigned short **red,
unsigned short **green,
unsigned short **blue);
void mate_rr_crtc_set_gamma (MateRRCrtc *crtc,
int size,
unsigned short *red,
unsigned short *green,
unsigned short *blue);
#endif /* MATE_RR_H */

162
libmate-desktop/meson.build Normal file
View File

@ -0,0 +1,162 @@
libmdt_inc = include_directories('.')
headers = files(
'mate-desktop.h',
'mate-desktop-utils.h',
'mate-desktop-item.h',
'mate-dconf.h',
'mate-gsettings.h',
'mate-bg.h',
'mate-bg-crossfade.h',
'mate-desktop-thumbnail.h',
'mate-rr.h',
'mate-languages.h',
'mate-rr-config.h',
'mate-rr-labeler.h',
'mate-colorbutton.h',
'mate-colorsel.h',
'mate-hsv.h',
'mate-colorseldialog.h',
)
install_headers(
headers,
subdir: 'mate-desktop-2.0/libmate-desktop',
)
sources = files(
'mate-desktop-item.c',
'mate-desktop-utils.c',
'mate-desktop-thumbnail.c',
'mate-dconf.c',
'mate-gsettings.c',
'mate-bg.c',
'mate-bg-crossfade.c',
'display-name.c',
'mate-rr.c',
'mate-languages.c',
'mate-rr-config.c',
'mate-rr-output-info.c',
'mate-rr-labeler.c',
'mate-colorbutton.c',
'mate-colorsel.c',
'mate-hsv.c',
'mate-colorseldialog.c',
'edid-parse.c',
)
deps = [
x11_dep,
gtk_dep,
m_dep,
libmdt_dep,
dconf_dep,
]
if get_option('pnp-ids-path') == 'internal'
pnp_ids_path = join_paths(matedt_pkgdatadir, 'pnp.ids')
install_data('pnp.ids', install_dir: matedt_pkgdatadir)
else
pnp_ids_path = get_option('pnp-ids-path')
endif
cflags = [
'-DMATELOCALEDIR="@0@"'.format(matedt_localedir),
'-DG_LOG_DOMAIN="MateDesktop"',
'-DISO_CODES_PREFIX="@0@"'.format(iso_codes_prefix),
'-DPNP_IDS="@0@"'.format(pnp_ids_path),
]
symbol_map = join_paths(meson.current_source_dir(), meson.project_name() + '.map')
test_ldflag = '-Wl,--version-script,' + symbol_map
ldflags = []
if cc.has_link_argument(test_ldflag)
ldflags += test_ldflag
endif
libmate_desktop = shared_library(
'mate-desktop-2',
sources: sources,
version: libversion,
include_directories: top_inc,
dependencies: deps,
c_args: cflags,
link_args: ldflags,
link_depends: symbol_map,
install: true,
install_dir: matedt_libdir,
)
libmate_desktop_dep = declare_dependency(
link_with: libmate_desktop,
include_directories: libmdt_inc,
dependencies: deps,
)
pkg.generate(
libraries: libmate_desktop,
version: matedt_version,
name: matedt_api_name,
description: 'Utility library for loading .desktop files',
filebase: matedt_api_name,
subdirs: matedt_api_name,
requires: [
'gtk+-3.0',
],
requires_private: 'dconf',
variables: 'exec_prefix=' + matedt_libexecdir,
install_dir: join_paths(get_option('libdir'), 'pkgconfig')
)
if enable_gir
gir_sources = sources + headers
gir_incs = [
'GObject-2.0',
'Gtk-3.0',
]
gir_extra_args = [
'--warn-all',
'--add-include-path=@0@'.format(meson.current_source_dir()),
'-DMATE_DESKTOP_USE_UNSTABLE_API',
]
gir_dir = join_paths(matedt_datadir, 'gir-1.0')
typelib_dir = join_paths(matedt_libdir, 'girepository-1.0')
gnome.generate_gir(
libmate_desktop,
sources: gir_sources,
nsversion: matedt_api_version,
namespace: matedt_gir_ns,
symbol_prefix: 'mate_',
identifier_prefix: 'Mate',
export_packages: matedt_api_name,
includes: gir_incs,
extra_args: gir_extra_args,
install: true,
install_dir_gir: gir_dir,
install_dir_typelib: typelib_dir,
)
endif
test_ditem = executable('test-ditem',
sources : 'test-ditem.c',
dependencies : libmate_desktop_dep,
install : false,
)
test_color_button = executable('test-color-button',
sources : 'test.c',
dependencies : libmate_desktop_dep,
install : false,
)
test_languages = executable('test-languages',
sources : 'test-languages.c',
dependencies : libmate_desktop_dep,
install : false,
)

2248
libmate-desktop/pnp.ids Normal file

File diff suppressed because it is too large Load Diff

36
libmate-desktop/private.h Normal file
View File

@ -0,0 +1,36 @@
/* private.h: various private functions
Copyright 2009, Novell, Inc.
This file is part of the Mate Library.
The Mate Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The Mate 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the Mate Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
Boston, MA 02110-1301, USA.
Author: Vincent Untz <vuntz@gnome.org>
*/
#ifndef __MATE_DESKTOP_PRIVATE_H__
#define __MATE_DESKTOP_PRIVATE_H__
#include <glib.h>
G_BEGIN_DECLS
void _mate_desktop_init_i18n (void);
G_END_DECLS
#endif

View File

@ -0,0 +1,63 @@
/*
* Copyright (C) 2012,2017 Red Hat, Inc.
*
* This file is part of the Mate Library.
*
* The Gnome Library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* The Gnome 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with the Gnome Library; see the file COPYING.LIB. If not,
* write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
* Authors: Bastien Nocera <hadess@hadess.net>
+ */
#define MATE_DESKTOP_USE_UNSTABLE_API
#include "mate-desktop-thumbnail.h"
#include <gtk/gtk.h>
int main (int argc, char **argv)
{
GdkPixbuf *pixbuf;
MateDesktopThumbnailFactory *factory;
GtkWidget *window, *image;
char *content_type;
gtk_init (&argc, &argv);
if (argc < 2) {
g_print ("Usage: %s FILE...\n", argv[0]);
return 1;
}
content_type = g_content_type_guess (argv[1], NULL, 0, NULL);
factory = mate_desktop_thumbnail_factory_new (MATE_DESKTOP_THUMBNAIL_SIZE_LARGE);
pixbuf = mate_desktop_thumbnail_factory_generate_thumbnail (factory, argv[1], content_type);
g_free (content_type);
g_object_unref (factory);
if (pixbuf == NULL) {
g_warning ("mate_desktop_thumbnail_factory_generate_thumbnail() failed to generate a thumbnail for %s", argv[1]);
return 1;
}
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL);
image = gtk_image_new_from_pixbuf (pixbuf);
g_object_unref (pixbuf);
gtk_container_add (GTK_CONTAINER (window), image);
gtk_widget_show_all (window);
gtk_main ();
return 0;
}

View File

@ -0,0 +1,160 @@
/* -*- Mode: C; c-set-style: gnu indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/*
* 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.
*/
#include <config.h>
#include <string.h>
#include <unistd.h>
#include <mate-desktop-item.h>
#include <locale.h>
#include <stdlib.h>
static void
test_ditem (const char *file)
{
MateDesktopItem *ditem;
MateDesktopItemType type;
const gchar *text;
char *uri;
char path[256];
ditem = mate_desktop_item_new_from_file (file,
MATE_DESKTOP_ITEM_LOAD_ONLY_IF_EXISTS,
NULL);
if (ditem == NULL) {
g_print ("File %s is not an existing ditem\n", file);
return;
}
text = mate_desktop_item_get_location (ditem);
g_print ("LOCATION: |%s|\n", text);
type = mate_desktop_item_get_entry_type (ditem);
g_print ("TYPE: |%u|\n", type);
text = mate_desktop_item_get_string
(ditem, MATE_DESKTOP_ITEM_TYPE);
g_print ("TYPE(string): |%s|\n", text);
text = mate_desktop_item_get_string
(ditem, MATE_DESKTOP_ITEM_EXEC);
g_print ("EXEC: |%s|\n", text);
text = mate_desktop_item_get_string
(ditem, MATE_DESKTOP_ITEM_ICON);
g_print ("ICON: |%s|\n", text);
text = mate_desktop_item_get_localestring
(ditem, MATE_DESKTOP_ITEM_NAME);
g_print ("NAME: |%s|\n", text);
text = mate_desktop_item_get_localestring_lang
(ditem, MATE_DESKTOP_ITEM_NAME,
"cs_CZ");
g_print ("NAME(lang=cs_CZ): |%s|\n", text);
text = mate_desktop_item_get_localestring_lang
(ditem, MATE_DESKTOP_ITEM_NAME,
"de");
g_print ("NAME(lang=de): |%s|\n", text);
text = mate_desktop_item_get_localestring_lang
(ditem, MATE_DESKTOP_ITEM_NAME,
NULL);
g_print ("NAME(lang=null): |%s|\n", text);
text = mate_desktop_item_get_localestring
(ditem, MATE_DESKTOP_ITEM_COMMENT);
g_print ("COMMENT: |%s|\n", text);
g_print ("Setting Name[de]=Neu gestzt! (I have no idea what that means)\n");
mate_desktop_item_set_localestring
(ditem,
MATE_DESKTOP_ITEM_NAME,
"Neu gesetzt!");
getcwd (path, 255 - strlen ("/foo.desktop"));
g_strlcat (path, "/foo.desktop", sizeof (path));
g_print ("Saving to foo.desktop\n");
uri = g_filename_to_uri (path, NULL, NULL);
g_print ("URI: %s\n", uri);
mate_desktop_item_save (ditem, uri, FALSE, NULL);
g_free (uri);
}
static void
launch_item (const char *file)
{
MateDesktopItem *ditem;
GList *file_list = NULL;
int ret;
ditem = mate_desktop_item_new_from_file (file,
MATE_DESKTOP_ITEM_LOAD_ONLY_IF_EXISTS,
NULL);
if (ditem == NULL) {
g_print ("File %s is not an existing ditem\n", file);
return;
}
#if 0
file_list = g_list_append (NULL, "file:///bin/sh");
file_list = g_list_append (file_list, "foo");
file_list = g_list_append (file_list, "bar");
file_list = g_list_append (file_list, "http://slashdot.org");
#endif
ret = mate_desktop_item_launch (ditem, file_list, 0, NULL);
g_print ("launch returned: %d\n", ret);
}
int
main (int argc, char **argv)
{
char *file;
gboolean launch = FALSE;
if (argc < 2 || argc > 3) {
fprintf (stderr, "Usage: test-ditem path [LAUNCH]\n");
exit (1);
}
if (argc == 3 &&
strcmp (argv[2], "LAUNCH") == 0)
launch = TRUE;
file = g_strdup (argv[1]);
gtk_init (&argc, &argv);
if (launch)
launch_item (file);
else
test_ditem (file);
/*
test_ditem_edit (file);
*/
return 0;
}

View File

@ -0,0 +1,88 @@
/* vi: set sw=4 ts=4 wrap ai: */
/*
* 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.
* */
#include <stdio.h>
#include <locale.h>
#define MATE_DESKTOP_USE_UNSTABLE_API
#include "mate-languages.h"
void test_one_locale(const gchar *locale);
void test_locales(void);
void test_one_locale(const gchar *locale)
{
char *lang, *country, *norm_locale;
char *language_code, *country_code, *codeset, *modifier;
lang = mate_get_language_from_locale (locale, locale);
country = mate_get_country_from_locale (locale, locale);
norm_locale = mate_normalize_locale (locale);
printf("Current locale: %s\n", locale);
printf("[locale]:\t\tlang=%s, country=%s, locale=%s\n", lang, country, norm_locale);
g_free(lang);
g_free(country);
g_free(norm_locale);
if (mate_parse_locale (locale, &language_code, &country_code, &codeset, &modifier)) {
lang = mate_get_language_from_code (language_code, locale);
country = mate_get_country_from_code (country_code, locale);
if (mate_language_has_translations(language_code)) {
printf("[mate_parse_locale]:\tlang_code=%s, country_code=%s, code=%s, modifier=%s\n"
"[code]:\t\t\tlang=%s, country=%s, Has translation\n",
language_code, country_code, codeset, modifier,
lang, country);
} else {
printf("[mate_parse_locale]:\tlang_code=%s, country_code=%s, code=%s, modifier=%s\n"
"[code]:\t\t\tlang=%s, country=%s\n",
language_code, country_code, codeset, modifier,
lang, country);
}
g_free(lang);
g_free(country);
}
putchar('\n');
g_free(language_code);
g_free(country_code);
g_free(codeset);
g_free(modifier);
}
void test_locales(void)
{
char **all;
guint i, len;
all= mate_get_all_locales ();
len = g_strv_length (all);
for (i =0; i < len; i++) {
test_one_locale(all[i]);
}
g_strfreev(all);
}
int main(int argc, char **argv)
{
if (argc == 2) {
test_one_locale(argv[1]);
} else {
test_locales();
}
return 0;
}

57
libmate-desktop/test.c Normal file
View File

@ -0,0 +1,57 @@
/*
* test.c: general tests for libmate-desktop
*
* Copyright (C) 2013-2014 Stefano Karapetsas
*
* 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.
*
* Authors:
* Stefano Karapetsas <stefano@karapetsas.com>
*/
#include <config.h>
#include "mate-desktop.h"
#include "mate-colorbutton.h"
int
main (int argc, char **argv)
{
GtkWindow *window = NULL;
GtkWidget *widget = NULL;
/* initialize GTK+ */
gtk_init (&argc, &argv);
/* create window */
window = GTK_WINDOW (gtk_window_new (GTK_WINDOW_TOPLEVEL));
gtk_window_set_title (window, "MATE Desktop Test");
/* create a MateColorButton */
widget = mate_color_button_new ();
/* add MateColorButton to window */
gtk_container_add (GTK_CONTAINER (window), widget);
/* quit signal */
g_signal_connect (GTK_WIDGET (window), "destroy", gtk_main_quit, NULL);
gtk_widget_show_all (GTK_WIDGET (window));
/* start application */
gtk_main ();
return 0;
}

6
makepot Executable file
View File

@ -0,0 +1,6 @@
#! /bin/sh
PACKAGE=mate-desktop;
make -C po $PACKAGE.pot && mv po/$PACKAGE.pot .
sed -i "/#, fuzzy/d" $PACKAGE.pot

9
man/Makefile.am Normal file
View File

@ -0,0 +1,9 @@
man_MANS = mate-color-select.1
if MATE_ABOUT_ENABLED
man_MANS += mate-about.1
endif
EXTRA_DIST = mate-about.1 mate-color-select.1
-include $(top_srcdir)/git.mk

24
man/mate-about.1 Normal file
View File

@ -0,0 +1,24 @@
.\"
.\" mate-about manual page.
.\" (C) 2010 Vincent Untz (vuntz@gnome.org)
.\"
.TH MATE-ABOUT 1 "MATE"
.SH NAME
mate-about \- Learn more about MATE
.SH SYNOPSIS
.B mate-about [\-\-version]
.SH DESCRIPTION
The \fImate-about\fP program is a tool to learn more about MATE and
who creates MATE. It contains an introduction about the project, and
lists all contributors.
.PP
The list of contributors used by \fImate-about\fP is the list of
MATE Foundation members.
.SH OPTIONS
The following options are supported:
.TP
.I "--version"
Output the MATE version instead of running a graphical interface.
.SH BUGS
If you find bugs in the \fImate-about\fP program, please report
these on http://bugzilla.gnome.org.

18
man/mate-color-select.1 Normal file
View File

@ -0,0 +1,18 @@
.\"
.\" mate-color-select manual page.
.\" (C) 2015 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
.\"
.TH mate-color-select 1 "MATE"
.SH NAME
mate-color-select \- Select a color from a palette or from screen
.SH SYNOPSIS
.B mate-color-select [<gtk-options>]
.SH DESCRIPTION
The \fImate-color-select\fP program is a tool to pick a color from a
color palette or from screen. It is not meant to be used on its own, but
as a MATE Desktop helper application.
.SH OPTIONS
The \fBmate-color-select\fR tool supports all known GTK options, but has no options of its own.
.SH BUGS
If you find bugs in the \fImate-color-select\fP program, please report
these on https://github.com/mate-desktop/mate-desktop/issues.

5
man/meson.build Normal file
View File

@ -0,0 +1,5 @@
install_man([
'mate-about.1',
'mate-color-select.1',
]
)

28
mate-about/Makefile.am Normal file
View File

@ -0,0 +1,28 @@
bin_PROGRAMS = mate-about
mate_about_SOURCES = mate-about.c mate-about.h
mate_about_CFLAGS = $(WARN_CFLAGS) $(MATE_ABOUT_CFLAGS)
mate_about_LDADD = $(MATE_ABOUT_LIBS)
AM_CPPFLAGS = \
-I$(top_srcdir) \
$(MATE_ABOUT_CFLAGS) \
-DLOCALE_DIR=\"$(datadir)/locale\" \
-DPIXMAPS_DIR=\"$(datadir)/pixmaps/\"
desktopdir = $(datadir)/applications
desktop_in_files = mate-about.desktop.in
desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
mate-about.desktop: mate-about.desktop.in
$(AM_V_GEN)$(MSGFMT) --desktop --template $< -d $(top_srcdir)/po -o $@
versiondir = $(datadir)/mate-about
version_DATA = mate-version.xml
EXTRA_DIST = $(desktop_in_files) \
mate-about.h.in \
mate-version.xml.in
CLEANFILES = $(desktop_DATA) $(bin_PROGRAMS) $(version_DATA) mate-about.h
#-include $(top_srcdir)/git.mk

115
mate-about/mate-about.c Normal file
View File

@ -0,0 +1,115 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* Copyright (C) 2011 Perberos <perberos@gmail.com>
*
* 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, 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.
*/
#include "mate-about.h"
/* get text macro, this should be on the common macros. or not?
*/
#ifndef mate_gettext
#define mate_gettext(package, locale, codeset) \
bindtextdomain(package, locale); \
bind_textdomain_codeset(package, codeset); \
textdomain(package);
#endif
static void mate_about_on_activate(GtkApplication* app)
{
GList* list;
GtkWidget* window;
list = gtk_application_get_windows(app);
if (list)
{
gtk_window_present(GTK_WINDOW(list->data));
}
else
{
mate_about_run();
}
}
void mate_about_run(void)
{
mate_about_dialog = (GtkAboutDialog*) gtk_about_dialog_new();
gtk_window_set_default_icon_name(icon);
gtk_about_dialog_set_logo_icon_name(mate_about_dialog, icon);
// name
gtk_about_dialog_set_program_name(mate_about_dialog, _(program_name));
// version
gtk_about_dialog_set_version(mate_about_dialog, version);
// credits and website
gtk_about_dialog_set_copyright(mate_about_dialog, _(copyright));
gtk_about_dialog_set_website(mate_about_dialog, website);
/**
* This generate a random message.
* The comments index must not be more than comments_count - 1
*/
gtk_about_dialog_set_comments(mate_about_dialog, gettext(comments_array[g_random_int_range(0, comments_count - 1)]));
gtk_about_dialog_set_authors(mate_about_dialog, authors);
gtk_about_dialog_set_artists(mate_about_dialog, artists);
gtk_about_dialog_set_documenters(mate_about_dialog, documenters);
/* Translators should localize the following string which will be
* displayed in the about box to give credit to the translator(s). */
gtk_about_dialog_set_translator_credits(mate_about_dialog, _("translator-credits"));
gtk_window_set_application(GTK_WINDOW(mate_about_dialog), mate_about_application);
// start and destroy
gtk_dialog_run((GtkDialog*) mate_about_dialog);
gtk_widget_destroy((GtkWidget*) mate_about_dialog);
}
int main(int argc, char** argv)
{
int status = 0;
mate_gettext(GETTEXT_PACKAGE, LOCALE_DIR, "UTF-8");
GOptionContext* context = g_option_context_new(NULL);
g_option_context_add_main_entries(context, command_entries, GETTEXT_PACKAGE);
g_option_context_add_group(context, gtk_get_option_group(TRUE));
g_option_context_parse(context, &argc, &argv, NULL);
g_option_context_free(context);
if (mate_about_nogui == TRUE)
{
printf("%s %s\n", gettext(program_name), version);
}
else
{
gtk_init(&argc, &argv);
mate_about_application = gtk_application_new("org.mate.about", 0);
g_signal_connect(mate_about_application, "activate", G_CALLBACK(mate_about_on_activate), NULL);
status = g_application_run(G_APPLICATION(mate_about_application), argc, argv);
g_object_unref(mate_about_application);
}
return status;
}

View File

@ -0,0 +1,12 @@
[Desktop Entry]
Name=About MATE
Comment=Learn more about MATE
Exec=mate-about
# Translators: Do NOT translate or transliterate this text (this is an icon file name)!
Icon=mate-desktop
Terminal=false
Type=Application
Categories=GTK;Core;Utility;
OnlyShowIn=MATE;
StartupNotify=false
NoDisplay=true

670
mate-about/mate-about.h.in Normal file
View File

@ -0,0 +1,670 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* Copyright (C) 2011 Perberos <perberos@gmail.com>
*
* 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, 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.
*/
#ifndef __MATE_ABOUT_H__
#define __MATE_ABOUT_H__
#include <config.h> // autogenerated by ./configure
#include <gtk/gtk.h>
#include <libintl.h> // for gettext
#include <glib/gi18n.h>
const char* program_name = N_("MATE Desktop Environment");
const char* version = PACKAGE_VERSION;
const char* icon = "mate-desktop";
const char* website = "https://mate-desktop.org/";
const char* copyright = N_("Copyright © 1997-2011 GNOME developers\n"
"Copyright © 2011 Perberos\n"
"Copyright © 2012-@RELEASE_YEAR@ MATE developers");
/* Increment comments_count if you add other comments. This will be
* used to choose a random comment. */
const int comments_count = 6;
const char* comments_array[] = {
N_("MATE provides an intuitive and attractive desktop to Linux users "
"using traditional metaphors."),
N_("MATE includes most of what you see on your computer, including the file "
"manager, document viewer, image viewer, menus, and many applications."),
N_("MATE is a Free, usable, stable, accessible desktop environment for the Unix-"
"like family of operating systems."),
N_("MATE is the continuation of GNOME 2. Hundreds of people have contributed code to "
"GNOME since it was started in 1997; many more have contributed in other "
"important ways, including translations, documentation, and quality assurance."),
N_("GNOME 2 was the most popular Linux desktop but its no longer available... "
"MATE is here to provide that same desktop to you!"),
N_("The name “MATE” comes from yerba maté, a species of holly native "
"to subtropical South America. Its leaves contain caffeine and are "
"used to make infusions and a beverage called mate.")
};
const char* authors[] = {
"MATE:",
/* MATE founders */
"Perberos <perberos@gmail.com>",
"Stefano Karapetsas <stefano@karapetsas.com>",
"Steve Zesch <stevezesch2@gmail.com>",
"Clement Lefebvre <root@linuxmint.com>",
/* MATE developers and contributors */
"Scott Balneaves <sbalneav@alburg.net>",
"Marcel Dijkstra <marcel.dykstra@gmail.com>",
"Jasmine Hassan <jasmine.aura@gmail.com>",
"Brent Hull <bhull2010@live.com>",
"Steev Klimaszewski <steev@gentoo.org>",
"Joseph Krieger <rowen.stipe@gmail.com>",
"Nelson Marques <nmo.marques@gmail.com>",
"Dan Mashal <dan.mashal@fedoraproject.org>",
"Elan Ruusamäe <glen@delfi.ee>",
"Yaakov Selkowitz <yselkowitz@users.sourceforge.net>",
"Sam Tygier <samtygier@yahoo.co.uk>",
"Wolfgang Ulbrich <chat-to-me@raveit.de>",
"Sander Sweers <infirit@gmail.com>",
"Benjamin Denisart <p.drouand@gmail.com>",
"Efstathios Iosifidis <iefstathios@gmail.com>",
"Martin Wimpress <code@flexion.org>",
"John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>",
"Mike Gabriel <sunweaver@debian.org>",
"Willy Sudiarto Raharjo <willysr@slackware-id.org>",
"Chess Griffin <chess.griffin@gmail.com>",
"Vlad Orlov <monsta@inbox.ru>",
"Abel McClendon <hcmmac@hosscomm.com>",
/* MATE Google Summer of Code students */
"Alexander van der Meij <alexandervdm@gliese.me>",
"Avishkar Gupta <avishkar_gupta@outlook.com>",
"Laszlo Boros <iamsemmu@gmail.com>",
"Michal Ratajsky <michal.ratajsky@gmail.com>",
"",
/* GNOME developers */
"GNOME:",
"Jérôme Abela",
"Rob Adams",
"Djihed Afifi",
"Sarfraaz Ahmed",
"Christopher Aillon",
"Lauri Alanko",
"Борислав Александров (Borislav Aleksandrov)",
"Seth Alves",
"Shawn T. Amundson",
"Robert Ancell",
"Erik Andersen",
"Филип Андонов (Filip Andonov)",
"Marius Andreiana",
"Jon Anhold",
"Арангел Ангов (Arangel Angov)",
"Никола Антонов (Nikola Antonov)",
"Sandy Armstrong",
"Frank Arnold",
"Arunprakash",
"Paolo Bacchilega",
"Peter Bach",
"Timur I. Bakeyev",
"Sébastien Bacher",
"Chris Ball",
"Szabolcs 'Shooby' Bán",
"Lasse Bang Mikkelsen",
"Matthew Barnes",
"Seba Barto",
"Emmanuele Bassi",
"Martin Baulig",
"Tom Bech",
"Andreas Beck",
"Carlos Amador Bedolla",
"Martijn van Beers",
"Frank Belew",
"Calum Benson",
"Jacob Berkman",
"Eckehard Berns",
"Žygimantas Beručka",
"Runa Bhattacharjee",
"Robert Bihlmeyer",
"Jonathan Blandford <jrb@redhat.com>",
"Christopher Blizzard",
"Bruno Boaventura",
"Евгени Боевски (Evgeni Boevski)",
"Jérôme Bolliet",
"Andreas Bolsch",
"Wouter Bolsterlee",
"David Bolter",
"Dave Bordoley",
"Paolo Borelli",
"James Bowes",
"Karsten Bräckelmann",
"Hendrik Brandt",
"Dario Bressanini",
"Emmanuel Briot",
"Stephen Browne",
"Marcus Brubaker",
"Christian Bucher",
"Ronald S. Bultje",
"Rich Burridge",
"Ross Burton",
"Jeff Cai",
"Brian Cameron",
"Dave Camp",
"Didier Carlier",
"Anders Carlsson",
"Luca Cavalli",
"Chema Celorio",
"Youssef Chahibi",
"Gaël Chamoulaud",
"Сава Чанков (Sava Chankov)",
"Damon Chaplin",
"Kevin Charter",
"Erwann Chénedé",
"張 國 冠",
"Павел Чолаков (Pavel Cholakov)",
"Kenneth Rohde Christiansen",
"Bryan Clark",
"Chad Clark",
"Matthias Clasen",
"Andrew Clausen",
"Jason Clinton",
"Jules Colding",
"Jeremy Collins",
"Rusty Conover",
"Pat Costello",
"Phil Cowans",
"Alan Cox",
"Dennis Cranston",
"Mark Crichton",
"Frédéric Crozat",
"Andreas Czechanowski",
"Виктор Дачев (Victor Dachev)",
"Johan Dahlin",
"Nalin Dahyabhai",
"Dan Damian",
"Sayamindu Dasgupta",
"Phil Dawes",
"Fatih Demir",
"Guillaume Desmottes",
"Frédéric Devernay",
"Joanmarie Diggs",
"Feico W. Dillema",
"Филип Димитров (Philip Dimitrov)",
"Carlos Eduardo Rodrigues Diógenes",
"Станимир Джевелеков (Stanimir Djevelekov)",
"Петър Добрев (Peter Dobrev)",
"Явор Доганов (Yavor Doganov)",
"Radek Doulik",
"Sebastian Dröge",
"Máirín Duffy",
"Alex Duggan",
"László Dvornik",
"Tom Dyas",
"Karl Eichwalder",
"John Ellis",
"Diego Escalante Urrelo",
"Behdad Esfahbod",
"Arturo Espinosa",
"Gus Estrella",
"David Etherton",
"Larry Ewing",
"Marc Ewing",
"Gergő Érdi",
"Peter Fales",
"Ahmad Farghal",
"Joaquim Fellmann",
"Christophe Fergeau",
"Jens Finke",
"Mark Finlay",
"Dave Finton",
"Milon Firikis",
"John Fleck",
"Raúl Perusquia Flores",
"Crispin Flowerday",
"Lawrence Foard",
"Leonardo Fontenelle",
"Glynn Foster",
"Ben FrantzDale",
"Jeff Freedman",
"David Abilleira Freijeiro",
"Nat Friedman",
"Jochen Friedrich",
"Adam Fritzler",
"Michael Fulbright",
"Christopher R. Gabriel",
"Mark Galassi",
"Tony Gale",
"Carlos García Campos",
"Matthew Garrett",
"Carlos Garnacho Parro",
"Jeff Garzik",
"Vincent Geddes",
"Владимир Герджиков (Vladimir Gerdjikov)",
"Tim Gerla",
"Björn Giesler",
"Quim Gil",
"Evandro Fernandes Giovanini",
"Владимира Гиргинова (Vladimira Girginova)",
"Dave Glowacki",
"Scott Goehring",
"Jody Goldberg",
"Randy Gordon",
"Ted Gould",
"Jens Granseuer",
"Kenny Graunke",
"Alex Graveley",
"Jamin Philip Gray",
"Dov Grobgeld",
"Bertrand Guiheneuf",
"Alan Aspuru Guzik",
"Telsa Gwynne",
"Fredrik Hallenberg",
"Mikael Hallendal",
"Lars Hamann",
"Bill Haneman",
"Michael Hanni",
"Raja R Harinath",
"Heath Harrelson",
"Peter Harvey",
"Mathias Hasselmann",
"Peter Hawkins",
"Chris Heath",
"Scott Heavner",
"Sebastian Heinlein",
"Jon K Hellan",
"James Henstridge <james@daa.com.au>",
"Fernando Herrera",
"Richard Hestilow",
"Raphael Higino",
"Thomas Hinkle",
"Iain Holmes",
"Adam Hooper",
"Alan Horkan",
"Khaled Hosny",
"Ihar Hrachyshka",
"Николай Христов (Nikolay Hristov)",
"Irene Huang",
"Richard Hughes",
"David Huggins-Daines",
"Richard Hult",
"Andreas Hyden",
"Miguel de Icaza <miguel@ximian.com>",
"Hiroyuki Ikezoe",
"Khandakar Mujahidul Islam",
"Johnny Jacob",
"Mayank Jain",
"Vivek Jain",
"Tim Janik",
"Stefan Jeske",
"王 剑",
"Amed Ç. Jiyan",
"Michael K. Johnson",
"Keld Jørn Simonsen",
"Andy Kahn",
"Mikkel Kamstrup Erlandsen",
"Sami Kananoja",
"Янко Канети (Yanko Kaneti)",
"Ивелина Кърчева (Ivelina Karcheva)",
"Theppitak Karoonboonyanan",
"Matt Keenan",
"Gábor Kelemen",
"Michael Kellen",
"Christian Kellner",
"Stephen Kiernan",
"Spencer Kimball",
"Christian Kintner",
"Christian Kirbach",
"Peter Kirchgessner",
"Alexander Kirillov",
"Димитър Киров (Dimitar Kirov)",
"Andre Klapper",
"Helmut Köberle",
"Alfredo Kojima",
"Атанас Кошаров (Atanas Kosharov)",
"Martin Kretzschmar",
"Harish Krishnaswamy",
"Andrew Kuchling",
"Tomas Kuliavas",
"Stephan Kulow",
"Kaushal Kumar",
"Nirmal Kumar",
"Praveen Kumar",
"Martynas Kunigelis",
"Tuomas Kuosmanen",
"Olof Kylander",
"Mathieu Lacage",
"Francis J. Lacoste",
"Chris Lahey",
"Dom Lachowicz",
"Scott Laird",
"Birger Langkjer",
"Ask Hjorth Larsen",
"Alexander Larsson",
"Guillaume Laurent",
"Ole Laursen",
"Michael Lausch",
"Will LaShell",
"Jens Lautenbacher",
"Evan Lawrence",
"Garrett LeSage",
"Jason Leach",
"George Lebl",
"Gregory Leblanc",
"Elliot Lee <sopwith@redhat.com>",
"Marc Lehmann",
"Noah Levitt",
"Raph Levien",
"廖 昭 雄",
"Tor Lillqvist",
"Matt Loper",
"Nick Lopez",
"Xan Lopez",
"Elixan Loran",
"Ryan Lortie",
"Harry Lu",
"Dirk Lutjens",
"Josh MacDonald",
"Og Maciel",
"David MacKay",
"Davyd Madeley",
"Mohamed Magdy",
"Paolo Maggi",
"Sam Magnuson",
"Ian Main",
"David Malcolm",
"Jordi Mallach",
"Mandrake",
"Daniel Manrique",
"Kjartan Maraas",
"Matthew Marjanovic",
"Heath Martin",
"Oliver Maruhn",
"Fabio Marzocca",
"Dave Mason",
"James Mastros",
"Peter Mattis",
"Gordon Matzigkeit",
"Dietmar Maurer <dietmar@ximian.com>",
"Justin Maurer",
"Shaun McCance",
"William Jon McCann",
"Callum McKenzie",
"Gregory McLean",
"Mark McLoughlin",
"Michael Meeks",
"Federico Mena-Quintero",
"Christophe Merlet",
"Christian Meyer",
"Tim Miao",
"Gintautas Miliauskas",
"Cesar Miquel",
"Julian Missig",
"Eric B. Mitchell",
"Jaka Mocnik",
"Paolo Molaro",
"Lynn Monsanto",
"David Mosberger",
"Rodrigo Moya <rodrigo@ximian.com>",
"Dan Mueth",
"Thomas Muldowney",
"Alexandre Muñiz",
"Tim-Philipp Müller",
"Sivaiah Nallagatla",
"남 성 현",
"Deepa Natarajan",
"Ales Navicki",
"Јован Наумовски (Jovan Naumovski)",
"Dave Neary",
"Karl Nelson",
"Elijah Newren",
"Christian Neumair",
"Mike Newman",
"Seth Nickell",
"Asger Alstrup Nielsen",
"Kenneth Nielsen",
"Nate Nielsen",
"Eric Nielson",
"Bastien Nocera",
"Martin Norbäck",
"Joachim Noreiko",
"Alexander Nyakhaychyk",
"Daniel Nylander",
"Padraig O'Briain",
"Eskil Olsen",
"Jimmy Olsen",
"David Orme",
"Karl Anders Oygard",
"Tomas Ögren",
"Keith Packard",
"Jay Painter",
"Chenthill Palanisamy",
"John Palmieri",
"Cameron Parish",
"Conrad Parker",
"Stuart Parmenter",
"Guilherme de S. Pastore",
"Sankarasivasubramaniam Pasupathilingam",
"Данило Шеган",
"Mike Pedersen",
"Nils Pedersen",
"Илия Пенев (Ilia Penev)",
"Havoc Pennington",
"Ettore Perazzoli",
"Carlos Perelló Marín",
"Christian Persch",
"Marco Pesenti Gritti",
"Ian Peters",
"Martin Kasper Petersen",
"Christof Petig",
"Владимир Петков (Vladimir \"Kaladan\" Petkov)",
"Joe Pfeiffer",
"Ben Pierce",
"Chris Pinkham",
"Hasbullah Bin Pit",
"Sebastian Pölsterl",
"Germán Poo-Caamaño",
"Пейо Попов (Peio Popov)",
"Dick Porter",
"Ясен Праматаров (Yasen Pramatarov)",
"Tero Pulkkinen",
"Атанас Пюскюлев (Atanas Pyuskyulev)",
"Sushma Rai",
"Ростислав Райков (Rostislav \"zbrox\" Raikov)",
"Madhan Raj M.",
"Srinivasa Ragavan",
"Rajeev Ramanathan",
"Jean-François Rameau",
"Sriram Ramkrishna",
"The Rasterman",
"Oliver Rauch",
"Lucas Rocha",
"Erdal Ronahi",
"Andreas Røsdal",
"Christian Rose",
"Cody Russell",
"Reklaw",
"Jens Christian Restemeier",
"Patrick Reynolds",
"Robert Richardson",
"Hendrik Richter",
"Kristian Rietveld",
"Sebastian Rittau",
"Alex Roberts",
"Michel Roelofs",
"Ueli Rutishauser",
"Lars Rydlinge",
"Peter Ryland",
"Claudio Saavedra",
"Joseph Sacco",
"Bibek Sahu",
"Arvind Samptur",
"Søren Sandmann",
"Damien Sandras",
"Pablo Saratxaga",
"笹 山 和 宏",
"Carsten Schaar",
"Christian Schaller",
"Wayne Schuller",
"Franck Schneider",
"Ingo Schneider",
"Bernd Schroeder",
"John Schulien",
"Chris Scobell",
"Don Scorgie",
"Jens Seidel",
"Dodji Seketeli",
"Shakti Sen",
"Iñigo Serna",
"Shaleh",
"Devashish Sharma",
"Joe Shaw",
"Александър Шопов (Alexander Shopov)",
"Clytie Siddall",
"Alejandro Aguilar Sierra",
"Miroslav Silovic",
"Manish Singh",
"Timo Sirainen",
"David F. Skoll",
"Jochen Skulj",
"Nuke Skyjumper",
"Петър Славов (Peter \"Peshka\" Slavov)",
"Josh Sled",
"John Slee",
"Raphaël Slinckx",
"Brent Smith",
"Garrett Smith",
"Suzanna Smith",
"Andrew Sobala",
"Shreyas Srinivasan",
"Maciej Stachowiak",
"Stalyn",
"Jeffrey Stedfast",
"Jakub Steiner",
"Ben Stern",
"Micah Stetson",
"Ray Strode",
"Luke Stroven",
"Mariano Suárez-Alvarez",
"Parthasarathi Susarla",
"Nathan Carl Summers",
"Istvan Szekeres",
"Петър Тахчиев (Peter Tahchiev)",
"HideToshi Tajima",
"Nigel Tao",
"Tristan Tarrant",
"Anthony Taylor",
"Owen Taylor",
"Peter Teichman",
"Arturo Tena",
"Thomas Thurman",
"Kimball Thurston",
"András Tímár",
"Boyd Timothy",
"Rêzan Tovjîn",
"Alp Toker",
"Chris Toshok",
"Christoph Toshok",
"Malcolm Tredinnick",
"Tom Tromey <tromey@redhat.com>",
"David Trowbridge",
"Jon Trowbridge",
"段 活 文",
"Сергей В. Удальцов",
"Juan Pablo Ugarte",
"Vincent Untz",
"Manish Vachharajani",
"Neil Vachharajani",
"Tristan Van Berkom",
"Philip Van Hoof",
"Thomas Vander Stichele",
"Veerapuram Varadhan",
"Васил Василев (Vasil Vasilev)",
"Daniel Veillard",
"Vendu",
"Andrew Veliath",
"Юлия Велкова (Julia Velkova)",
"Luis Villa",
"Olav Vitters",
"Marius Vollmer",
"Patrick Wade",
"Shawn Wagner",
"Will Walker",
"Hanna Wallach",
"Colin Walters",
"Matthias Warkus",
"Jeff Waugh",
"Morten Welinder",
"Jonh Wendell",
"Bruno Widmann",
"Robert Wilhelm",
"Sebastian Wilhelmi",
"Dan Williams",
"James Willcox",
"David Winkler",
"Dan Winship",
"Jeremy Wise",
"Roger Wolff",
"Ivan Wong",
"Frank Worsley",
"Rizoyê Xerzî",
"Wang Xin",
"James Youngman",
"Mengjie Yu",
"Li Yuan",
"Orest Zborowski",
"Simon Zheng",
"Sascha Ziemann",
"Michael Zucchi",
"Jason van Zyl",
NULL
};
// documentation
const char* documenters[] = {
"...", // TODO: fillme
NULL
};
// artists
const char* artists[] = {
"Marcel Dijkstra <marcel.dykstra@gmail.com>",
"Rowen Stipe <rowen.stipe@gmail.com>",
"Wolfgang Ulbrich <chat-to-me@raveit.de>",
NULL
};
// widget for mate-about window
GtkAboutDialog* mate_about_dialog = FALSE;
GtkApplication* mate_about_application;
/**
* If this value is set to TRUE, then mate_about_dialog will not be called
* on the main function.
*/
gboolean mate_about_nogui = FALSE;
// functions
void mate_about_run(void);
void mate_about_release_version(void);
static void mate_about_on_activate(GtkApplication* app);
// arguments definitions
static GOptionEntry command_entries[] = {
{"version", 'v', 0, G_OPTION_ARG_NONE, &mate_about_nogui, "Show MATE version", NULL},
{NULL}
};
#endif /* __MATE_ABOUT_H__ */

View File

@ -0,0 +1,7 @@
<?xml version="1.0"?>
<mate-version>
<platform>@MATE_PLATFORM@</platform>
<minor>@MATE_MINOR@</minor>
<micro>@MATE_MICRO@</micro>
@MATE_DATE_COMMENT_START@<date>@MATE_DATE@</date>@MATE_DATE_COMMENT_END@
</mate-version>

50
mate-about/meson.build Normal file
View File

@ -0,0 +1,50 @@
date_exe = find_program('date')
mate_date = run_command(date_exe, '+%Y-%m-%d').stdout().strip()
mate_year = run_command(date_exe, '+%Y').stdout().strip()
mate_data = configuration_data()
mate_data.set('MATE_DATE', mate_date)
mate_data.set('MATE_DATE_COMMENT_START', '<!--')
mate_data.set('MATE_DATE_COMMENT_END', '-->')
mate_data.set('MATE_PLATFORM', mate_platform)
mate_data.set('MATE_MINOR', mate_minor)
mate_data.set('MATE_MICRO', mate_micro)
mate_about_data = configuration_data()
mate_about_data.set('RELEASE_YEAR', mate_year)
executable('mate-about',
'mate-about.c',
c_args: [
'-DLOCALE_DIR="@0@"'.format(join_paths(get_option('prefix'), get_option('localedir'))),
'-DPIXMAPS_DIR="@0@"'.format(join_paths(get_option('prefix'), get_option('datadir'), 'pixmaps')),
],
dependencies : gtk_dep,
include_directories: top_inc,
install: true,
)
i18n.merge_file(
input: 'mate-about.desktop.in',
output: 'mate-about.desktop',
type: 'desktop',
po_dir: '../po',
install: true,
install_dir: join_paths(get_option('datadir'), 'applications'),
)
mate_version_xml_in = configure_file(
input: 'mate-version.xml.in',
output: 'mate-version.xml',
configuration: mate_data,
install: true,
install_dir: join_paths(get_option('datadir'), 'mate-about'),
)
mate_about_h_in = configure_file(
input: 'mate-about.h.in',
output: 'mate-about.h',
configuration: mate_about_data,
install: false,
)

1347
mate-desktop.pot Normal file

File diff suppressed because it is too large Load Diff

125
meson.build Normal file
View File

@ -0,0 +1,125 @@
project(
'mate-desktop',
'c',
version: '1.24.0',
license: [ 'GPL-2', 'FDL-1.1', 'LGPL-2' ],
)
matedt_version = meson.project_version()
version_array = matedt_version.split('.')
mate_major_version = version_array[0].to_int()
mate_minor_version = version_array[0].to_int()
mate_micro_version = version_array[0].to_int()
mate_platform = 1
mate_minor = 24
mate_micro = 0
matedt_api_version = '2.0'
matedt_api_name = '@0@-@1@'.format(meson.project_name(), matedt_api_version)
matedt_gir_ns = 'MateDesktop'
matedt_gir_version = '2.0'
matedt_gettext_package = meson.project_name()
matedt_prefix = get_option('prefix')
matedt_bindir = join_paths(matedt_prefix, get_option('bindir'))
matedt_datadir = join_paths(matedt_prefix, get_option('datadir'))
matedt_includedir = join_paths(matedt_prefix, get_option('includedir'))
matedt_libdir = join_paths(matedt_prefix, get_option('libdir'))
matedt_libexecdir = join_paths(matedt_prefix, get_option('libexecdir'))
matedt_localedir = join_paths(matedt_prefix, get_option('localedir'))
matedt_mandir = join_paths(matedt_prefix, get_option('mandir'))
matedt_pkgdatadir = join_paths(matedt_datadir, 'libmate-desktop')
# options
enable_gir = get_option('introspection')
enable_gtk_doc = get_option('gtk-doc')
enable_startup_notification = get_option('startup-notification')
# Before making a release, the LT_VERSION string should be modified.
# The string is of the form C:R:A.
# - If interfaces have been changed or added, but binary compatibility has
# been preserved, change to C+1:0:A+1
# - If binary compatibility has been broken (eg removed or changed interfaces)
# change to C+1:0:0
# - If the interface is the same as the previous version, change to C:R+1:A
current = 17
revision = 4
age = 1
libversion = '@0@.@1@.@2@'.format(current, age, revision)
cc = meson.get_compiler('c')
nm = find_program('nm')
config_h = configuration_data()
# i18n
config_h.set_quoted('GETTEXT_PACKAGE', matedt_gettext_package)
config_h.set_quoted('LOCALEDIR', matedt_localedir)
common_flags = [
'-DHAVE_CONFIG_H',
'-I' + meson.build_root(),
'-DPACKAGE_VERSION="@0@"'.format(matedt_version),
]
add_project_arguments(common_flags, language: 'c')
gtk_dep = dependency('gtk+-3.0', version: '>= 3.22.0')
m_dep = cc.find_library('m', required: false)
dconf_dep = dependency('dconf', version: '>= 0.13.4')
x11_dep = dependency('x11', required: true)
randr_dep = dependency('xrandr', version: '>= 1.3', required: false)
config_h.set('HAVE_RANDR', randr_dep.found())
iso_codes = dependency('iso-codes')
iso_codes_prefix = iso_codes.get_pkgconfig_variable('prefix')
libmdt_dep = [
dependency('gdk-pixbuf-2.0'),
dependency('gobject-2.0'),
dependency('glib-2.0', version: '>= 2.50.0'),
dependency('gio-2.0', version: '>= 2.26.0'),
dependency('libstartup-notification-1.0', version: '>= 0.5',
required: enable_startup_notification ),
randr_dep,
iso_codes,
]
gnome = import('gnome')
i18n = import('i18n')
pkg = import('pkgconfig')
po_dir = join_paths(meson.source_root(), 'po')
top_inc = include_directories('.')
subdir('icons')
subdir('libmate-desktop')
subdir('man')
if enable_gtk_doc
subdir('docs/reference/mate-desktop')
endif
subdir('po')
subdir('tools')
subdir('schemas')
if get_option('mate-about')
subdir('mate-about')
endif
configure_file(
output: 'config.h',
configuration: config_h,
)
meson.add_install_script('utils/post_install.py')
test('libmate-desktop symbols check',
find_program('abi-check'),
env: [
'LIB=@0@'.format(libmate_desktop.full_path()),
'NM=@0@'.format(nm.path()),
'ABI=@0@/libmate-desktop/mate-desktop.abi'.format(meson.source_root())
]
)

20
meson_options.txt Normal file
View File

@ -0,0 +1,20 @@
option('gtk-doc',
type: 'boolean',
value: 'false',
)
option('introspection',
type: 'boolean',
value: 'false',
)
option('mate-about',
type: 'boolean',
value: 'true',
)
option('startup-notification',
type: 'boolean',
value: 'false',
)
option('pnp-ids-path',
type: 'string',
value: 'internal',
)

120
po/LINGUAS Normal file
View File

@ -0,0 +1,120 @@
# please keep this list sorted alphabetically
#
af
am
an
ar
as
ast
az
be
bg
bn
bn_IN
br
bs
ca
ca@valencia
cmn
crh
cs
cy
da
de
de_CH
dz
el
en_AU
en_CA
en_GB
eo
es
es_AR
es_CL
es_CO
es_MX
et
eu
fa
fi
fr
frp
fur
fy
ga
gl
gu
he
hi
hr
hu
hy
ia
id
ie
ig
is
it
ja
jv
ka
kk
kn
ko
ku
ku_IQ
ky
li
lo
lt
lv
mai
mg
mi
mk
ml
mn
mr
ms
nb
nds
ne
nl
nn
nso
oc
or
pa
pl
ps
pt
pt_BR
ro
ru
sc
si
sk
sl
sq
sr
sr@latin
sv
ta
te
th
tk
tr
tt
ug
uk
ur
uz
vi
wa
xh
yi
yo
zh_CN
zh_HK
zh_TW
zu

78
po/Makevars Normal file
View File

@ -0,0 +1,78 @@
# Makefile variables for PO directory in any package using GNU gettext.
# Usually the message domain is the same as the package name.
DOMAIN = mate-desktop
# These two variables depend on the location of this directory.
subdir = po
top_builddir = ..
# These options get passed to xgettext.
XGETTEXT_OPTIONS = --from-code=UTF-8 --keyword=_ --keyword=N_ --keyword=C_:1c,2 --keyword=NC_:1c,2 --keyword=g_dngettext:2,3 --add-comments
# This is the copyright holder that gets inserted into the header of the
# $(DOMAIN).pot file. Set this to the copyright holder of the surrounding
# package. (Note that the msgstr strings, extracted from the package's
# sources, belong to the copyright holder of the package.) Translators are
# expected to transfer the copyright for their translations to this person
# or entity, or to disclaim their copyright. The empty string stands for
# the public domain; in this case the translators are expected to disclaim
# their copyright.
COPYRIGHT_HOLDER = MATE Developers
# This tells whether or not to prepend "GNU " prefix to the package
# name that gets inserted into the header of the $(DOMAIN).pot file.
# Possible values are "yes", "no", or empty. If it is empty, try to
# detect it automatically by scanning the files in $(top_srcdir) for
# "GNU packagename" string.
PACKAGE_GNU =
# This is the email address or URL to which the translators shall report
# bugs in the untranslated strings:
# - Strings which are not entire sentences, see the maintainer guidelines
# in the GNU gettext documentation, section 'Preparing Strings'.
# - Strings which use unclear terms or require additional context to be
# understood.
# - Strings which make invalid assumptions about notation of date, time or
# money.
# - Pluralisation problems.
# - Incorrect English spelling.
# - Incorrect formatting.
# It can be your email address, or a mailing list address where translators
# can write to without being subscribed, or the URL of a web page through
# which the translators can contact you.
MSGID_BUGS_ADDRESS =
# This is the list of locale categories, beyond LC_MESSAGES, for which the
# message catalogs shall be used. It is usually empty.
EXTRA_LOCALE_CATEGORIES =
# This tells whether the $(DOMAIN).pot file contains messages with an 'msgctxt'
# context. Possible values are "yes" and "no". Set this to yes if the
# package uses functions taking also a message context, like pgettext(), or
# if in $(XGETTEXT_OPTIONS) you define keywords with a context argument.
USE_MSGCTXT = no
# These options get passed to msgmerge.
# Useful options are in particular:
# --previous to keep previous msgids of translated messages,
# --quiet to reduce the verbosity.
MSGMERGE_OPTIONS =
# These options get passed to msginit.
# If you want to disable line wrapping when writing PO files, add
# --no-wrap to MSGMERGE_OPTIONS, XGETTEXT_OPTIONS, and
# MSGINIT_OPTIONS.
MSGINIT_OPTIONS =
# This tells whether or not to regenerate a PO file when $(DOMAIN).pot
# has changed. Possible values are "yes" and "no". Set this to no if
# the POT file is checked in the repository and the version control
# program ignores timestamps.
PO_DEPENDS_ON_POT = yes
# This tells whether or not to forcibly update $(DOMAIN).pot and
# regenerate PO files on "make dist". Possible values are "yes" and
# "no". Set this to no if the POT file and PO files are maintained
# externally.
DIST_DEPENDS_ON_UPDATE_PO = yes

39
po/POTFILES.in Normal file
View File

@ -0,0 +1,39 @@
# List of source files containing translatable strings.
# Please keep this file sorted alphabetically.
mate-about/mate-about.c
mate-about/mate-about.desktop.in
mate-about/mate-about.h
# When adding a file here, make sure that the entry point in the API of this
# file calls _mate_desktop_init_i18n ()
libmate-desktop/display-name.c
libmate-desktop/mate-colorbutton.c
libmate-desktop/mate-colorsel.c
libmate-desktop/mate-hsv.c
libmate-desktop/mate-colorseldialog.c
libmate-desktop/mate-desktop-item.c
libmate-desktop/mate-desktop-utils.c
libmate-desktop/mate-languages.c
libmate-desktop/mate-rr.c
libmate-desktop/mate-rr-config.c
libmate-desktop/mate-rr-labeler.c
schemas/org.mate.accessibility-keyboard.gschema.xml
schemas/org.mate.accessibility-startup.gschema.xml
schemas/org.mate.applications-at-mobility.gschema.xml
schemas/org.mate.applications-at-visual.gschema.xml
schemas/org.mate.applications-browser.gschema.xml
schemas/org.mate.applications-calculator.gschema.xml
schemas/org.mate.applications-messenger.gschema.xml
schemas/org.mate.applications-office.gschema.xml
schemas/org.mate.applications-terminal.gschema.xml
schemas/org.mate.background.gschema.xml.in
schemas/org.mate.debug.gschema.xml
schemas/org.mate.file-views.gschema.xml
schemas/org.mate.interface.gschema.xml
schemas/org.mate.lockdown.gschema.xml
schemas/org.mate.sound.gschema.xml
schemas/org.mate.thumbnail-cache.gschema.xml
schemas/org.mate.thumbnailers.gschema.xml
schemas/org.mate.typing-break.gschema.xml
tools/mate-color-select.c
tools/mate-color-select.desktop.in

4
po/POTFILES.skip Normal file
View File

@ -0,0 +1,4 @@
# List of source files containing translatable strings that should not be
# translated.
# Please keep this file sorted alphabetically.
mate-version.xml.in

Some files were not shown because too many files have changed in this diff Show More