Compare commits
No commits in common. "master" and "GLADE3_2_91_0" have entirely different histories.
master
...
GLADE3_2_9
25
.cvsignore
Normal file
@ -0,0 +1,25 @@
|
||||
ltconfig
|
||||
aclocal.m4
|
||||
autom4te.cache
|
||||
intl
|
||||
ABOUT-NLS
|
||||
config.guess
|
||||
config.sub
|
||||
ltmain.sh
|
||||
config.h.in
|
||||
stamp-h.in
|
||||
Makefile.in
|
||||
configure
|
||||
configure.lineno
|
||||
config.log
|
||||
config.h
|
||||
config.cache
|
||||
config.status
|
||||
intltool-*
|
||||
glade-3.desktop
|
||||
stamp-h
|
||||
stamp-h1
|
||||
libtool
|
||||
Makefile
|
||||
missing
|
||||
mkinstalldirs
|
1
.gitignore
vendored
@ -1 +0,0 @@
|
||||
_build
|
@ -1,15 +0,0 @@
|
||||
include: 'https://gitlab.gnome.org/GNOME/citemplates/raw/master/flatpak/flatpak_ci_initiative.yml'
|
||||
|
||||
flatpak:
|
||||
extends: '.flatpak'
|
||||
variables:
|
||||
MANIFEST_PATH: "org.gnome.Glade.json"
|
||||
RUNTIME_REPO: "https://nightly.gnome.org/gnome-nightly.flatpakrepo"
|
||||
FLATPAK_MODULE: "glade"
|
||||
APP_ID: "org.gnome.Glade"
|
||||
BUNDLE: "glade-git.flatpak"
|
||||
|
||||
nightly:
|
||||
extends: '.publish_nightly'
|
||||
dependencies: ['flatpak']
|
||||
needs: ['flatpak']
|
14
AUTHORS
@ -1,9 +1,7 @@
|
||||
Chema Celorio <chema@ximian.com>
|
||||
Joaquin Cuenca Abela <e98cuenc@yahoo.com>
|
||||
Paolo Borelli <pborelli@katamail.com>
|
||||
Archit Baweja <bighead@users.sourceforge.net>
|
||||
Shane Butler <shane_b@operamail.com>
|
||||
Tristan Van Berkom <tvb@gnome.org>
|
||||
Ivan Wong <email@ivanwong.info>
|
||||
Juan Pablo Ugarte <juanpablougarte@gmail.com>
|
||||
Vincent Geddes <vincent.geddes@gmail.com>
|
||||
|
||||
Thanks to :
|
||||
Michal Palczewski <mpalczew@u.washington.edu> - Widget tree window
|
||||
Archit Baweja <bighead@users.sourceforge.net> - New widgets, _get_type
|
||||
Shane Butler <shane_b@operamail.com> - Glade Widget signals editor
|
||||
Tristan Van Berkom <tvb@gnome.org> - Non widget support.
|
||||
|
@ -1,75 +0,0 @@
|
||||
Glade official git repository is hosted by the GNOME foundation at
|
||||
gitlab.gnome.org
|
||||
|
||||
Maintainer
|
||||
============
|
||||
Glade is looking for a new maintainer, if you are interested please contact us
|
||||
on gitlab.
|
||||
|
||||
GitLab
|
||||
========
|
||||
Glade bugs are tracked at
|
||||
|
||||
https://gitlab.gnome.org/GNOME/glade
|
||||
|
||||
|
||||
GIT
|
||||
===
|
||||
You can browse the source code at https://gitlab.gnome.org/GNOME/glade
|
||||
To check out a copy of Glade you can use the following command:
|
||||
|
||||
git clone https://gitlab.gnome.org/GNOME/glade.git
|
||||
|
||||
Patches
|
||||
=======
|
||||
Patches must be in the unified format (diff -u) and must include a
|
||||
ChangeLog entry. Please send all patches to bugzilla.
|
||||
|
||||
It is better to use git format-patch command
|
||||
|
||||
```
|
||||
git format-patch HEAD^
|
||||
```
|
||||
|
||||
Coding Style
|
||||
============
|
||||
Code in Glade should follow the GNU style of GNOME Programming Guidelines
|
||||
(https://developer.gnome.org/programming-guidelines/stable/c-coding-style.html.en),
|
||||
basically this means being consistent with the surrounding code.
|
||||
The only exception is that we prefer having braces always on a new line
|
||||
e.g.:
|
||||
|
||||
```
|
||||
if (...)
|
||||
{
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
Note however that a lot of the current codebase still uses the following
|
||||
style:
|
||||
|
||||
```
|
||||
if (...) {
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
Over time we'll migrate to the preferred form.
|
||||
|
||||
Naming conventions:
|
||||
- function names should be lowercase and prefixed with the
|
||||
file name (or, if the function is static and the name too long,
|
||||
with an abbreviation), e.g:
|
||||
`glade_project_window_my_function ()`
|
||||
`gpw_my_loooooooooong_named_fuction ()`
|
||||
- variable names should be lowercase and be short but self explanatory;
|
||||
if you need more than one word use an underscore, e.g:
|
||||
`my_variable`
|
||||
|
||||
Also try to order your functions so that prototypes are not needed.
|
||||
|
||||
|
||||
|
343
COPYING
@ -1,5 +1,340 @@
|
||||
This package is licensed under the GNU LGPL. Some code is still only available under GNU GPL.
|
||||
Files that are not yet completely licenced under GNU LGPL are still marked as being licended as GNU GPL.
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Please see COPYING.LGPL for the full text of the LGPL license and the COPYING.GPL
|
||||
for the full text of the GPL text respectively.
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 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 Library 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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 Library General
|
||||
Public License instead of this License.
|
||||
|
280
COPYING.GPL
@ -1,280 +0,0 @@
|
||||
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
|
437
COPYING.LGPL
@ -1,437 +0,0 @@
|
||||
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
|
BIN
ChangeLog.old.gz
68
HACKING
Normal file
@ -0,0 +1,68 @@
|
||||
|
||||
Mailing List
|
||||
~~~~~~~~~~~~
|
||||
Glade-3 discussion takes place on glade-devel@ximian.org
|
||||
To subscribe or to consult archives visit
|
||||
http://lists.ximian.com/mailman/listinfo/glade-devel
|
||||
When posting to the list include [glade3] in the subject,
|
||||
since the list is also used for Glade-2 developement.
|
||||
|
||||
|
||||
Bugzilla
|
||||
~~~~~~~~
|
||||
Glade-3 bugs are tracked in the glade3 module of
|
||||
http://bugzilla.gnome.org
|
||||
|
||||
|
||||
CVS
|
||||
~~~
|
||||
The Glade-3 repository is hosted at cvs.gnome.org
|
||||
To check out a copy of Glade-3 you can use the following commands:
|
||||
cvs -d:pserver:anonymous@anoncvs.gnome.org:/cvs/gnome login
|
||||
[just press enter when required for a password]
|
||||
cvs -z3 -d:pserver:anonymous@anoncvs.gnome.org:/cvs/gnome co glade3
|
||||
You then need to run autogen.sh and make to build Glade-3.
|
||||
|
||||
|
||||
Patches
|
||||
~~~~~~~
|
||||
Patches must be in the unified format (diff -u) and must include a
|
||||
ChangeLog entry. Please send all patches to bugzilla.
|
||||
|
||||
|
||||
Coding Style
|
||||
~~~~~~~~~~~~
|
||||
Code in Glade-3 should follow the GNOME Programming Guidelines
|
||||
(http://developer.gnome.org/doc/guides/programming-guidelines/),
|
||||
basically this means being consistent with the sorrounding code.
|
||||
The only exception is that we prefer having braces always on a new line
|
||||
e.g.:
|
||||
|
||||
if (...)
|
||||
{
|
||||
...
|
||||
}
|
||||
|
||||
Note however that a lot of the current codebase still uses the following
|
||||
style:
|
||||
|
||||
if (...) {
|
||||
...
|
||||
}
|
||||
|
||||
Over time we'll migrate to the preferred form.
|
||||
|
||||
Naming conventions:
|
||||
- function names should be lowercase and prefixed with the
|
||||
file name (or, if the function is static and the name too long,
|
||||
with an abbreviation), e.g:
|
||||
glade_project_window_my_function ()
|
||||
gpw_my_loooooooooong_named_fuction ()
|
||||
- variable names should be lowercase and be short but self explanatory;
|
||||
if you need more than one word use an underscore, e.g:
|
||||
my_variable
|
||||
|
||||
Also try to order your functions so that prototypes are not needed.
|
||||
|
||||
|
||||
|
225
INSTALL
Normal file
@ -0,0 +1,225 @@
|
||||
|
||||
Basic Installation
|
||||
==================
|
||||
|
||||
Glade uses configure to ease installation. The majority of people
|
||||
should be able to install & run Glade by entering:
|
||||
|
||||
./configure (or ./configure --with-included-gettext for Solaris
|
||||
machines and practically anything which doesn't have a
|
||||
recent version of the GNU libc libraries.)
|
||||
make
|
||||
make install
|
||||
glade
|
||||
|
||||
(As of Glade 0.5.0 you must install Glade with 'make install' if you want
|
||||
to build C applications.)
|
||||
|
||||
If you have installed GTK+ in a non-standard directory, you will need to
|
||||
make sure that the gtk-config program is in your PATH, and that the GTK+
|
||||
libraries can be found when glade is run. If you installed GTK+ with the
|
||||
prefix /usr/local then gtk-config will be in /usr/local/bin. To make sure
|
||||
the GTK+ libraries are found, under Linux you can change /etc/ld.so.conf
|
||||
and run ldconfig or add the libraries directory to LD_LIBRARY_PATH.
|
||||
|
||||
|
||||
Common Problems
|
||||
===============
|
||||
|
||||
The most common problem relates to the gettext translation library.
|
||||
Usually when linking you see errors like this:
|
||||
|
||||
Unresolved reference to dcgettext()
|
||||
|
||||
To solve this, try configuring with:
|
||||
|
||||
./configure --with-included-gettext
|
||||
|
||||
and running make again. As a last resort you can also try
|
||||
|
||||
./configure --disable-nls
|
||||
|
||||
|
||||
Generic Configure Instructions
|
||||
==============================
|
||||
|
||||
These are generic installation instructions.
|
||||
|
||||
The `configure' shell script attempts to guess correct values for
|
||||
various system-dependent variables used during compilation. It uses
|
||||
those values to create a `Makefile' in each directory of the package.
|
||||
It may also create one or more `.h' files containing system-dependent
|
||||
definitions. Finally, it creates a shell script `config.status' that
|
||||
you can run in the future to recreate the current configuration, a file
|
||||
`config.cache' that saves the results of its tests to speed up
|
||||
reconfiguring, and a file `config.log' containing compiler output
|
||||
(useful mainly for debugging `configure').
|
||||
|
||||
If you need to do unusual things to compile the package, please try
|
||||
to figure out how `configure' could check whether to do them, and mail
|
||||
diffs or instructions to the address given in the `README' so they can
|
||||
be considered for the next release. If at some point `config.cache'
|
||||
contains results you don't want to keep, you may remove or edit it.
|
||||
|
||||
The file `configure.in' is used to create `configure' by a program
|
||||
called `autoconf'. You only need `configure.in' if you want to change
|
||||
it or regenerate `configure' using a newer version of `autoconf'.
|
||||
|
||||
The simplest way to compile this package is:
|
||||
|
||||
1. `cd' to the directory containing the package's source code and type
|
||||
`./configure' to configure the package for your system. If you're
|
||||
using `csh' on an old version of System V, you might need to type
|
||||
`sh ./configure' instead to prevent `csh' from trying to execute
|
||||
`configure' itself.
|
||||
|
||||
Running `configure' takes awhile. While running, it prints some
|
||||
messages telling which features it is checking for.
|
||||
|
||||
2. Type `make' to compile the package.
|
||||
|
||||
3. Optionally, type `make check' to run any self-tests that come with
|
||||
the package.
|
||||
|
||||
4. Type `make install' to install the programs and any data files and
|
||||
documentation.
|
||||
|
||||
5. You can remove the program binaries and object files from the
|
||||
source code directory by typing `make clean'. To also remove the
|
||||
files that `configure' created (so you can compile the package for
|
||||
a different kind of computer), type `make distclean'. There is
|
||||
also a `make maintainer-clean' target, but that is intended mainly
|
||||
for the package's developers. If you use it, you may have to get
|
||||
all sorts of other programs in order to regenerate files that came
|
||||
with the distribution.
|
||||
|
||||
Compilers and Options
|
||||
=====================
|
||||
|
||||
Some systems require unusual options for compilation or linking that
|
||||
the `configure' script does not know about. You can give `configure'
|
||||
initial values for variables by setting them in the environment. Using
|
||||
a Bourne-compatible shell, you can do that on the command line like
|
||||
this:
|
||||
CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
|
||||
|
||||
Or on systems that have the `env' program, you can do it like this:
|
||||
env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
|
||||
|
||||
Compiling For Multiple Architectures
|
||||
====================================
|
||||
|
||||
You can compile the package for more than one kind of computer at the
|
||||
same time, by placing the object files for each architecture in their
|
||||
own directory. To do this, you must use a version of `make' that
|
||||
supports the `VPATH' variable, such as GNU `make'. `cd' to the
|
||||
directory where you want the object files and executables to go and run
|
||||
the `configure' script. `configure' automatically checks for the
|
||||
source code in the directory that `configure' is in and in `..'.
|
||||
|
||||
If you have to use a `make' that does not supports the `VPATH'
|
||||
variable, you have to compile the package for one architecture at a time
|
||||
in the source code directory. After you have installed the package for
|
||||
one architecture, use `make distclean' before reconfiguring for another
|
||||
architecture.
|
||||
|
||||
Installation Names
|
||||
==================
|
||||
|
||||
By default, `make install' will install the package's files in
|
||||
`/usr/local/bin', `/usr/local/man', etc. You can specify an
|
||||
installation prefix other than `/usr/local' by giving `configure' the
|
||||
option `--prefix=PATH'.
|
||||
|
||||
You can specify separate installation prefixes for
|
||||
architecture-specific files and architecture-independent files. If you
|
||||
give `configure' the option `--exec-prefix=PATH', the package will use
|
||||
PATH as the prefix for installing programs and libraries.
|
||||
Documentation and other data files will still use the regular prefix.
|
||||
|
||||
In addition, if you use an unusual directory layout you can give
|
||||
options like `--bindir=PATH' to specify different values for particular
|
||||
kinds of files. Run `configure --help' for a list of the directories
|
||||
you can set and what kinds of files go in them.
|
||||
|
||||
If the package supports it, you can cause programs to be installed
|
||||
with an extra prefix or suffix on their names by giving `configure' the
|
||||
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
|
||||
|
||||
Optional Features
|
||||
=================
|
||||
|
||||
Some packages pay attention to `--enable-FEATURE' options to
|
||||
`configure', where FEATURE indicates an optional part of the package.
|
||||
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
|
||||
is something like `gnu-as' or `x' (for the X Window System). The
|
||||
`README' should mention any `--enable-' and `--with-' options that the
|
||||
package recognizes.
|
||||
|
||||
For packages that use the X Window System, `configure' can usually
|
||||
find the X include and library files automatically, but if it doesn't,
|
||||
you can use the `configure' options `--x-includes=DIR' and
|
||||
`--x-libraries=DIR' to specify their locations.
|
||||
|
||||
Specifying the System Type
|
||||
==========================
|
||||
|
||||
There may be some features `configure' can not figure out
|
||||
automatically, but needs to determine by the type of host the package
|
||||
will run on. Usually `configure' can figure that out, but if it prints
|
||||
a message saying it can not guess the host type, give it the
|
||||
`--host=TYPE' option. TYPE can either be a short name for the system
|
||||
type, such as `sun4', or a canonical name with three fields:
|
||||
CPU-COMPANY-SYSTEM
|
||||
|
||||
See the file `config.sub' for the possible values of each field. If
|
||||
`config.sub' isn't included in this package, then this package doesn't
|
||||
need to know the host type.
|
||||
|
||||
If you are building compiler tools for cross-compiling, you can also
|
||||
use the `--target=TYPE' option to select the type of system they will
|
||||
produce code for and the `--build=TYPE' option to select the type of
|
||||
system on which you are compiling the package.
|
||||
|
||||
Sharing Defaults
|
||||
================
|
||||
|
||||
If you want to set default values for `configure' scripts to share,
|
||||
you can create a site shell script called `config.site' that gives
|
||||
default values for variables like `CC', `cache_file', and `prefix'.
|
||||
`configure' looks for `PREFIX/share/config.site' if it exists, then
|
||||
`PREFIX/etc/config.site' if it exists. Or, you can set the
|
||||
`CONFIG_SITE' environment variable to the location of the site script.
|
||||
A warning: not all `configure' scripts look for a site script.
|
||||
|
||||
Operation Controls
|
||||
==================
|
||||
|
||||
`configure' recognizes the following options to control how it
|
||||
operates.
|
||||
|
||||
`--cache-file=FILE'
|
||||
Use and save the results of the tests in FILE instead of
|
||||
`./config.cache'. Set FILE to `/dev/null' to disable caching, for
|
||||
debugging `configure'.
|
||||
|
||||
`--help'
|
||||
Print a summary of the options to `configure', and exit.
|
||||
|
||||
`--quiet'
|
||||
`--silent'
|
||||
`-q'
|
||||
Do not print messages saying which checks are being made. To
|
||||
suppress all normal output, redirect it to `/dev/null' (any error
|
||||
messages will still be shown).
|
||||
|
||||
`--srcdir=DIR'
|
||||
Look for the package's source code in directory DIR. Usually
|
||||
`configure' can determine that directory automatically.
|
||||
|
||||
`--version'
|
||||
Print the version of Autoconf used to generate the `configure'
|
||||
script, and exit.
|
||||
|
||||
`configure' also accepts some other, not widely useful, options.
|
||||
|
16
INTERNALS
@ -1,22 +1,22 @@
|
||||
Glade internals
|
||||
~~~~~~~~~~~~~~~
|
||||
Glade3 internals
|
||||
~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
about this document
|
||||
===================
|
||||
|
||||
This is a short description of the designs goals and of the
|
||||
implementation choices of Glade. It isn't complete, but
|
||||
implementation choices of Glade3. It isn't complete, but
|
||||
I hope that it may be useful.
|
||||
|
||||
* Note: not only I'm not the original author/designer of
|
||||
glade, but also I have not touched glade for many months.
|
||||
glade3, but also I have not touched glade3 for many months.
|
||||
|
||||
The only reason why I'm writing this doc is that glade development
|
||||
The only reason why I'm writing this doc is that glade3 development
|
||||
has been stagnating for a long time... now it seems that there are some
|
||||
developers interested in resuming work on it, so I thought that it was
|
||||
right to put down some notes on what I remember to ease their way
|
||||
through the glade codebase.
|
||||
through the glade3 codebase.
|
||||
|
||||
Everyone who spots errors and inaccuracies in this doc, or who wants to
|
||||
add informations to it, should feel free to improve it!
|
||||
@ -35,8 +35,8 @@ the description of a Gtk+ GUI to an xml file.
|
||||
* glade is a tool to create and edit the desired interface in an easy
|
||||
way and then automatically serialize it to the xml file.
|
||||
|
||||
Glade is a complete rewrite of the original glade and takes advantage
|
||||
of the introspection properties of the GTK toolkit.
|
||||
Glade3 is a complete rewrite of the original glade and takes advantage
|
||||
of the introspection properties of the GTK+2 toolkit.
|
||||
|
||||
|
||||
|
||||
|
11
MAINTAINERS
@ -1,11 +1,4 @@
|
||||
Tristan Van Berkom
|
||||
E-mail: tristan.van.berkom@gmail.com
|
||||
Userid: tvb
|
||||
|
||||
Juan Pablo Ugarte
|
||||
E-mail: juanpablougarte@gmail.com
|
||||
Userid: jpu
|
||||
Tristan Van Berkom is the current glade-3 maintainer.
|
||||
|
||||
Alberto Fanjul
|
||||
E-mail: albfan@gnome.org
|
||||
Userid: albfan
|
||||
Email: tristan.van.berkom@gmail.com
|
||||
|
26
Makefile.am
Normal file
@ -0,0 +1,26 @@
|
||||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
SUBDIRS = src po pixmaps widgets
|
||||
|
||||
@INTLTOOL_DESKTOP_RULE@
|
||||
|
||||
DESKTOP_IN_FILES = glade-3.desktop.in
|
||||
DESKTOP_FILES =$(DESKTOP_IN_FILES:.desktop.in=.desktop)
|
||||
|
||||
desktopdir = $(datadir)/applications
|
||||
desktop_DATA = $(DESKTOP_FILES)
|
||||
|
||||
appicondir = $(datadir)/pixmaps
|
||||
appicon_DATA = glade-3.png
|
||||
|
||||
EXTRA_DIST = \
|
||||
glade-3.desktop.in \
|
||||
glade-3.png \
|
||||
intltool-extract.in \
|
||||
intltool-merge.in \
|
||||
intltool-update.in
|
||||
|
||||
|
||||
CLEANFILES = $(DESKTOP_FILES)
|
||||
|
||||
DISTCLEANFILES = intltool-extract intltool-merge intltool-update
|
79
README
Normal file
@ -0,0 +1,79 @@
|
||||
Glade
|
||||
=====
|
||||
|
||||
A User Interface Builder for Gtk+ and Gnome
|
||||
|
||||
Web: http://glade.gnome.org
|
||||
|
||||
Mailing Lists: glade-users@ximian.com - For discussions about using
|
||||
Glade to build applications.
|
||||
glade-devel@ximian.com - For discussions about the
|
||||
development of Glade itself.
|
||||
|
||||
|
||||
General Information
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Glade is a RAD tool to enable quick & easy development of user interfaces
|
||||
for the Gtk+ toolkit and the GNOME desktop environment.
|
||||
The user interfaces designed in Glade are stored in XML format,
|
||||
enabling easy integration with external tools.
|
||||
In particular libglade can load the XML files and create the interfaces
|
||||
at runtime. The DTD for the XML files is included with libglade, and is
|
||||
also at http://glade.gnome.org/glade-2.0.dtd.
|
||||
Other tools are available which can turn the XML files into source code
|
||||
in languages such as C++, Perl and Python.
|
||||
|
||||
|
||||
About Glade-3
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
This version of Glade (Glade-3) is a complete rewrite of the original Glade codebase.
|
||||
|
||||
One of the main differnces from glade-2 is that C code generation has been removed from
|
||||
glade-3: this has been done on purpose, since using generated code is deprecated; the preferred
|
||||
way to use glade files is with libglade (if code generation is needed, this can be provided
|
||||
as another tool or plugin, code generation is simply not a part of the glade-3 project).
|
||||
Another main difference is that glade-3 was designed to make maximal use of GObject
|
||||
introspection, thus easing the integration of external toolkits and handling widgets,
|
||||
signals and properties genericly; thus making it easier to write fancy features in the
|
||||
future (toolkits such as gtk+ itself, gnome, gnome-db and any others are implemented
|
||||
externaly as widget catalogs with optional support libraries, thus catalogs may be
|
||||
distributed seperatly; possibly along with their libglade support modules).
|
||||
|
||||
It has a few useful new features such as stacked Undo/Redo and Multiple Project support
|
||||
and respects the same XML format as glade-2.
|
||||
|
||||
For a more details on what has changed, what still needs work, etc. see
|
||||
the NEWS file & the glade-3 product at bugzilla.gnome.org.
|
||||
Comments, bug reports and patches are more than welcome.
|
||||
|
||||
|
||||
License
|
||||
~~~~~~~
|
||||
|
||||
Glade is distributed under the GNU General Public License (GPL), as described
|
||||
in the COPYING file.
|
||||
Note that you are free to use whatever license you like for the source code
|
||||
generated by Glade. (We do not consider the code generated by Glade to be
|
||||
'a work based on the Program' as described at the start of the GPL.)
|
||||
|
||||
|
||||
Requirements
|
||||
~~~~~~~~~~~~
|
||||
|
||||
o GTK+ 2.8.0 or above - http://www.gtk.org
|
||||
You also need the glib, pango and atk libraries.
|
||||
Make sure you have the devel packages as well, as these will contain the
|
||||
header files which you will need to compile C applications.
|
||||
|
||||
o libxml 2.4.1 - used to parse the XML files. If you have GNOME 2 you
|
||||
should already have this.
|
||||
|
||||
|
||||
Installation
|
||||
~~~~~~~~~~~~
|
||||
|
||||
See the file 'INSTALL'
|
||||
|
||||
|
7
README.cvs
Normal file
@ -0,0 +1,7 @@
|
||||
If you are a long time gnome committer and you have a minor patch
|
||||
that you are sure is correct, then go ahead and commit.
|
||||
|
||||
For the other great majority of the time; please ask before commiting
|
||||
at glade-devel@lists.ximian.com.
|
||||
|
||||
All commits must have a ChangeLog entry.
|
122
README.md
@ -1,122 +0,0 @@
|
||||
# Glade
|
||||
|
||||
User interface designer for Gtk+ and GNOME
|
||||
|
||||
* Web - <https://glade.gnome.org>
|
||||
* Git - <https://gitlab.gnome.org/GNOME/glade>
|
||||
|
||||
Mailing Lists:
|
||||
|
||||
Both users and devel mailing list have been archived, you can find the archives at
|
||||
|
||||
* https://mail.gnome.org/archives/glade-users-list/
|
||||
* https://mail.gnome.org/archives/glade-devel-list/
|
||||
|
||||
## Development status
|
||||
|
||||
Glade is not being actively developed or maintained anymore.
|
||||
If you are interested in becoming a maintainer please contact us on gitlab.
|
||||
|
||||
## General Information
|
||||
|
||||
Glade is a RAD tool to enable quick and easy development of user interfaces
|
||||
for the GTK+ 3 toolkit and the GNOME desktop environment.
|
||||
|
||||
The user interfaces designed in Glade are saved as XML and these can be loaded
|
||||
by applications dynamically as needed by using GtkBuilder or used directly to
|
||||
define a new GtkWidget derived object class using Gtk+ new template feature.
|
||||
|
||||
By using GtkBuilder, Glade XML files can be used in numerous programming
|
||||
languages including C, C++, C#, Vala, Java, Perl, Python, and others.
|
||||
|
||||
This version of Glade targets GTK 3
|
||||
If you need to work with GTK 2, you can still use Glade 3.8
|
||||
([more information](http://blogs.gnome.org/tvb/2011/01/15/the-glade-dl/))
|
||||
|
||||
## License
|
||||
|
||||
Glade is distributed under the
|
||||
[GNU General Public License](https://www.gnu.org/licenses/gpl-2.0.en.html),
|
||||
version 2 (GPL) and
|
||||
[GNU Library General Public License](https://www.gnu.org/licenses/old-licenses/lgpl-2.0.en.html),
|
||||
version 2 (LGPL) as described in the COPYING file.
|
||||
|
||||
## Manual instalation
|
||||
|
||||
Requirements
|
||||
|
||||
* C compiler like [gcc](https://gcc.gnu.org/)
|
||||
* [Meson](http://mesonbuild.org) build system
|
||||
* [GTK](http://www.gtk.org) 3.24.0 or above
|
||||
* [libxml](http://xmlsoft.org/) 2.4.1 - used to parse XML files
|
||||
* libgirepository1.0 - Build-time dependency
|
||||
* xsltproc - for man pages generation
|
||||
|
||||
Optional dependencies:
|
||||
|
||||
* glib-networking plugins for TLS support (Needed for survey)
|
||||
* libwebkit2gtk-4.0 - For Webkit plugin
|
||||
* python-gi - For Python plugin
|
||||
* libgjs - For JavaScript plugin
|
||||
* gettext, itstool - For translation support
|
||||
|
||||
Download sources from git and build using meson/ninja
|
||||
|
||||
# Install dependencies, for example in debian
|
||||
sudo apt install gcc meson libgtk-3-dev libxml2-dev libgirepository1.0-dev xsltproc gettext itstool
|
||||
|
||||
# Optional dependencies
|
||||
sudo apt install libgjs-dev libwebkit2gtk-4.0-dev python-gi-dev glib-networking
|
||||
|
||||
# Clone the source repository or download tarball
|
||||
git clone https://gitlab.gnome.org/GNOME/glade.git
|
||||
|
||||
# Create build directory and configure project
|
||||
mkdir glade/build && cd glade/build
|
||||
meson --prefix=~/.local
|
||||
|
||||
# Build and install
|
||||
ninja
|
||||
ninja install
|
||||
|
||||
To run it you might need to set up LD_LIBRARY_PATH depending on your
|
||||
distribution defaults
|
||||
|
||||
LD_LIBRARY_PATH=~/.local/lib/x86_64-linux-gnu/ glade
|
||||
|
||||
## Linux
|
||||
|
||||
Debian
|
||||
|
||||
apt install glade
|
||||
|
||||
Fedora
|
||||
|
||||
yum install glade
|
||||
|
||||
Any distribution with Flatpak
|
||||
|
||||
flatpak install flathub org.gnome.Glade
|
||||
|
||||
[<img width='240' alt='Download on Flathub' src='https://flathub.org/assets/badges/flathub-badge-i-en.png'/>](https://flathub.org/apps/details/org.gnome.Glade)
|
||||
|
||||
## Windows
|
||||
|
||||
Available as a
|
||||
[package](https://packages.msys2.org/package/mingw-w64-x86_64-glade) in
|
||||
[MSYS2](https://www.msys2.org/)
|
||||
|
||||
pacman -S mingw-w64-x86_64-glade
|
||||
|
||||
## OSX
|
||||
|
||||
Available as a [package](https://formulae.brew.sh/formula/glade) in
|
||||
[Brew](https://brew.sh/)
|
||||
|
||||
brew install glade
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
45
TODO
@ -1,45 +0,0 @@
|
||||
Split Project data model from view model:
|
||||
========================================
|
||||
|
||||
Currently we create a GladeWidget object for each project object but
|
||||
GladeProject and gladeui api in general uses the very same runtime object.
|
||||
Ideally we should only depend on GladeWidget and the actual runtime object
|
||||
should only be used for the view in the workspace.
|
||||
|
||||
A first step could be updating GladeProject to only use GladeWidget internally
|
||||
and then we can update gladeui api to use GladeWidget instead but this means a
|
||||
API/ABI break
|
||||
|
||||
GtkBuilder unsuported features:
|
||||
==============================
|
||||
|
||||
* Property bindings
|
||||
|
||||
Unsupported object classes:
|
||||
==========================
|
||||
|
||||
Glib
|
||||
|
||||
* GMenu/GMenuModel (<menu> GtkBuilder element)
|
||||
Because GMenu is in Glib library it can not implement GtkBuildable iface which
|
||||
is in GTK+ this lead to implementing GMenu object construction in GtkBuilder
|
||||
using a custom element <menu>
|
||||
Ideally we should move GtkBuilder and GtkBuildable to Glib and rename them
|
||||
GBuilder and GBuildable so that we can implemet GBuildable in GMenu object
|
||||
A way to avoid this would be to create a new object type in GTK that derives
|
||||
from GMenu say GtkMenuObject (GtkMenu is already taken ;) and make it implement
|
||||
GtkBuildable iface.
|
||||
|
||||
* GAction, GSimpleAction, GActionGroup
|
||||
|
||||
GTK+ 3.4
|
||||
|
||||
* GtkApplication (add buildable iface to support GMenuModel?¿)
|
||||
|
||||
GTK+ 3.14
|
||||
|
||||
* type="action" children in GtkDialog
|
||||
|
||||
GTK+ 3.20
|
||||
|
||||
* GtkShortcutsWindow
|
51
autogen.sh
Executable file
@ -0,0 +1,51 @@
|
||||
#!/bin/sh
|
||||
# Run this to generate all the initial makefiles, etc.
|
||||
|
||||
srcdir=`dirname $0`
|
||||
test -z "$srcdir" && srcdir=.
|
||||
|
||||
PKG_NAME="glade"
|
||||
|
||||
(test -f $srcdir/configure.in \
|
||||
&& test -f $srcdir/autogen.sh) || {
|
||||
echo -n "**Error**: Directory "\`$srcdir\'" does not look like the"
|
||||
echo " top-level $PKG_NAME directory"
|
||||
exit 1
|
||||
}
|
||||
|
||||
DIE=0
|
||||
|
||||
# This is a bit complicated here since we can't use gnome-config yet.
|
||||
# It'll be easier after switching to pkg-config since we can then
|
||||
# use pkg-config to find the gnome-autogen.sh script.
|
||||
|
||||
gnome_autogen=
|
||||
gnome_datadir=
|
||||
|
||||
ifs_save="$IFS"; IFS=":"
|
||||
for dir in $PATH ; do
|
||||
test -z "$dir" && dir=.
|
||||
if test -f $dir/gnome-autogen.sh ; then
|
||||
gnome_autogen="$dir/gnome-autogen.sh"
|
||||
gnome_datadir=`echo $dir | sed -e 's,/bin$,/share,'`
|
||||
break
|
||||
fi
|
||||
done
|
||||
IFS="$ifs_save"
|
||||
|
||||
if test -z "$gnome_autogen" ; then
|
||||
echo "You need to install the gnome-common module and make"
|
||||
echo "sure the gnome-autogen.sh script is in your \$PATH."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
automake_version=
|
||||
case `uname` in
|
||||
CYGWIN*)
|
||||
# automake 1.4 of cygwin does not define EGREP in libtool.m4, and
|
||||
# fails to do the file magic test when -rpath is given
|
||||
automake_version=1.7
|
||||
;;
|
||||
esac
|
||||
|
||||
REQUIRED_AUTOMAKE_VERSION="$automake_version" GNOME_DATADIR="$gnome_datadir" USE_GNOME2_MACROS=1 . $gnome_autogen
|
111
configure.in
Normal file
@ -0,0 +1,111 @@
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_PREREQ(2.52)
|
||||
AC_INIT(glade-3, 2.91.0,
|
||||
http://bugzilla.gnome.org/enter_bug.cgi?product=glade3)
|
||||
AC_CANONICAL_SYSTEM
|
||||
|
||||
AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
|
||||
AM_MAINTAINER_MODE
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
|
||||
AC_PROG_INTLTOOL([0.29])
|
||||
AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)
|
||||
AC_PATH_PROG(DLLTOOL, dlltool)
|
||||
|
||||
AC_ISC_POSIX
|
||||
AC_PROG_CC
|
||||
AC_DISABLE_STATIC
|
||||
AC_PROG_INSTALL
|
||||
AC_PROG_MAKE_SET
|
||||
|
||||
AC_LIBTOOL_DLOPEN
|
||||
AC_LIBTOOL_WIN32_DLL
|
||||
AM_PROG_LIBTOOL
|
||||
|
||||
# If the source code has changed at all, increment GLADE_REVISION
|
||||
# If any interfaces have been added, removed, or changed, increment GLADE_CURRENT, and set GLADE_REVISION to 0.
|
||||
# If any interfaces have been added since the last public release, then increment GLADE_AGE.
|
||||
# If any interfaces have been removed since the last public release, then set GLADE_AGE to 0.
|
||||
# Reference: http://www.gnu.org/software/libtool/manual.html#Versioning
|
||||
GLADE_REVISION=0
|
||||
GLADE_CURRENT=0
|
||||
GLADE_AGE=0
|
||||
AC_SUBST(GLADE_REVISION)
|
||||
AC_SUBST(GLADE_CURRENT)
|
||||
AC_SUBST(GLADE_AGE)
|
||||
|
||||
|
||||
dnl ================================================================
|
||||
dnl Gettext stuff.
|
||||
dnl ================================================================
|
||||
GETTEXT_PACKAGE=AC_PACKAGE_NAME
|
||||
AC_SUBST(GETTEXT_PACKAGE)
|
||||
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [Name of the gettext package.])
|
||||
ALL_LINGUAS="az da en_CA es fr ja ms nb nn no pl pt pt_BR ru sk sv ta tr uk zh_CN"
|
||||
AM_GLIB_GNU_GETTEXT
|
||||
|
||||
|
||||
dnl ================================================================
|
||||
dnl Start of pkg-config checks
|
||||
dnl ================================================================
|
||||
PKG_CHECK_MODULES(GLADE, gtk+-2.0 >= 2.6.0 libxml-2.0 >= 2.4.0)
|
||||
AC_SUBST(GLADE_LIBS)
|
||||
AC_SUBST(GLADE_CFLAGS)
|
||||
|
||||
AC_CHECK_LIB(popt, poptStrippedArgv,, AC_MSG_ERROR([popt 1.5 or newer is required to build
|
||||
glade 3.0. You can download the latest version from ftp://people.redhat.com/sopwith/popt/]))
|
||||
|
||||
|
||||
glade_version="${VERSION}"
|
||||
glade_datadir='${datadir}/${PACKAGE}'
|
||||
glade_libdir='${libdir}/${PACKAGE}'
|
||||
glade_catalogsdir='${glade_datadir}/catalogs'
|
||||
glade_modulesdir='${glade_libdir}/modules'
|
||||
glade_pixmapsdir='${glade_datadir}/pixmaps'
|
||||
glade_icondir='${datadir}/pixmaps'
|
||||
glade_localedir='${prefix}/${DATADIRNAME}/locale'
|
||||
|
||||
AC_SUBST(glade_version)
|
||||
AC_SUBST(glade_datadir)
|
||||
AC_SUBST(glade_libdir)
|
||||
AC_SUBST(glade_catalogsdir)
|
||||
AC_SUBST(glade_modulesdir)
|
||||
AC_SUBST(glade_pixmapsdir)
|
||||
AC_SUBST(glade_icondir)
|
||||
AC_SUBST(glade_localedir)
|
||||
|
||||
|
||||
case $host_os in
|
||||
*mingw* | pw32* | cygwin*)
|
||||
win32=yes
|
||||
AC_ARG_ENABLE(popt_dll,
|
||||
[ --disable-popt-dll disable use of libpopt.dll (use static version instead)],
|
||||
popt_dll=$enableval, popt_dll=yes)
|
||||
if test "x$popt_dll" = "xyes"; then
|
||||
AC_DEFINE(USE_POPT_DLL, 1, [Define to 1 if libpopt.dll is to be used.])
|
||||
else
|
||||
AC_DEFINE(POPT_STATIC, 1, [Define to 1 if static version of libpopt is to be used.])
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
AM_CONDITIONAL(WITH_WIN32, test x"$win32" = "xyes")
|
||||
|
||||
AC_OUTPUT([
|
||||
Makefile
|
||||
pixmaps/Makefile
|
||||
widgets/Makefile
|
||||
po/Makefile.in
|
||||
src/Makefile
|
||||
src/libgladeui-1.0.pc
|
||||
src/glade-paths.sh
|
||||
])
|
||||
|
||||
echo "
|
||||
|
||||
Configuration:
|
||||
|
||||
Source code location: ${srcdir}
|
||||
Compiler: ${CC}
|
||||
|
||||
"
|
4
data/.gitignore
vendored
@ -1,4 +0,0 @@
|
||||
/org.gnome.Glade.desktop
|
||||
/org.gnome.Glade.desktop.in
|
||||
/gladeui-1.0.pc
|
||||
/org.gnome.Glade.appdata.xml
|
@ -1,18 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<its:rules xmlns:its="http://www.w3.org/2005/11/its"
|
||||
xmlns:gt="https://www.gnu.org/s/gettext/ns/its/extensions/1.0"
|
||||
version="2.0">
|
||||
<its:translateRule selector="/glade-catalog" translate="no"/>
|
||||
|
||||
<its:translateRule selector="/glade-catalog//glade-widget-class/@title" translate="yes"/>
|
||||
<its:translateRule selector="/glade-catalog//glade-widget-class//action/@name" translate="yes"/>
|
||||
<its:translateRule selector="/glade-catalog//glade-widget-class//property/@name" translate="yes"/>
|
||||
<its:translateRule selector="/glade-catalog//glade-widget-class//property//value/@name" translate="yes"/>
|
||||
<its:translateRule selector="/glade-catalog//glade-widget-class//property/tooltip" translate="yes"/>
|
||||
|
||||
<its:translateRule selector="/glade-catalog//glade-widget-group/@title" translate="yes"/>
|
||||
|
||||
<!-- Extracted strings are consumed by the library and are never
|
||||
merged back; we don't want to escape special characters. -->
|
||||
<gt:escapeRule selector="/glade-catalog" escape="no"/>
|
||||
</its:rules>
|
@ -1,6 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<locatingRules>
|
||||
<locatingRule name="GladeCatalog" pattern="*.xml">
|
||||
<documentRule localName="glade-catalog" target="glade-catalog.its"/>
|
||||
</locatingRule>
|
||||
</locatingRules>
|
Before Width: | Height: | Size: 437 B |
Before Width: | Height: | Size: 671 B |
Before Width: | Height: | Size: 651 B |
Before Width: | Height: | Size: 216 B |
Before Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 97 KiB |
Before Width: | Height: | Size: 6.2 KiB |
@ -1,125 +0,0 @@
|
||||
<?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:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
sodipodi:docname="glade-symbolic.svg"
|
||||
height="16"
|
||||
id="svg7384"
|
||||
inkscape:version="0.92.2 2405546, 2018-03-11"
|
||||
version="1.1"
|
||||
width="16">
|
||||
<metadata
|
||||
id="metadata90">
|
||||
<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>Gnome Symbolic Icon Theme</dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<sodipodi:namedview
|
||||
inkscape:bbox-paths="true"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
inkscape:current-layer="layer9"
|
||||
inkscape:cx="20.812152"
|
||||
inkscape:cy="4.0924638"
|
||||
gridtolerance="10"
|
||||
inkscape:guide-bbox="true"
|
||||
guidetolerance="10"
|
||||
id="namedview88"
|
||||
inkscape:object-nodes="false"
|
||||
inkscape:object-paths="false"
|
||||
objecttolerance="10"
|
||||
pagecolor="#555753"
|
||||
inkscape:pageopacity="1"
|
||||
inkscape:pageshadow="2"
|
||||
showborder="true"
|
||||
showgrid="false"
|
||||
showguides="true"
|
||||
inkscape:snap-bbox="true"
|
||||
inkscape:snap-bbox-midpoints="false"
|
||||
inkscape:snap-global="true"
|
||||
inkscape:snap-grids="true"
|
||||
inkscape:snap-nodes="true"
|
||||
inkscape:snap-others="false"
|
||||
inkscape:snap-to-guides="true"
|
||||
inkscape:window-height="1381"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:window-width="2560"
|
||||
inkscape:window-x="1600"
|
||||
inkscape:window-y="27"
|
||||
inkscape:zoom="1"
|
||||
borderlayer="true"
|
||||
inkscape:showpageshadow="false">
|
||||
<inkscape:grid
|
||||
empspacing="2"
|
||||
enabled="true"
|
||||
id="grid4866"
|
||||
snapvisiblegridlinesonly="true"
|
||||
spacingx="1"
|
||||
spacingy="1"
|
||||
type="xygrid"
|
||||
visible="true"
|
||||
originx="0"
|
||||
originy="0" />
|
||||
</sodipodi:namedview>
|
||||
<title
|
||||
id="title9167">Gnome Symbolic Icon Theme</title>
|
||||
<defs
|
||||
id="defs7386" />
|
||||
<g
|
||||
inkscape:groupmode="layer"
|
||||
id="layer9"
|
||||
inkscape:label="apps"
|
||||
style="display:inline"
|
||||
transform="translate(-223.0002,-215)">
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 239.00778,222.70429 v 8.31023 h -14 z m -2,3.95138 -4,2.35885 h 4 z"
|
||||
id="path4349"
|
||||
sodipodi:nodetypes="cccccccc"
|
||||
style="display:inline;fill:#3d3846;fill-opacity:1;stroke:none;enable-background:new" />
|
||||
<circle
|
||||
r="1.5"
|
||||
cy="219.51451"
|
||||
cx="227.50777"
|
||||
id="circle1750"
|
||||
style="display:inline;opacity:1;vector-effect:none;fill:#3d3846;fill-opacity:0.99607843;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;marker-start:none;marker-mid:none;marker-end:none;paint-order:normal;enable-background:new" />
|
||||
<path
|
||||
style="display:inline;opacity:1;vector-effect:none;fill:none;fill-opacity:0.99607843;stroke:#3d3846;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;marker-start:none;marker-mid:none;marker-end:none;paint-order:normal;enable-background:new"
|
||||
d="m 224.00778,229.01452 v -13 h 14 v 4"
|
||||
id="path1752"
|
||||
inkscape:connector-curvature="0" />
|
||||
<rect
|
||||
style="display:inline;opacity:1;vector-effect:none;fill:#3d3846;fill-opacity:0.99607843;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;marker-start:none;marker-mid:none;marker-end:none;paint-order:normal;enable-background:new"
|
||||
id="rect1754"
|
||||
width="5"
|
||||
height="1"
|
||||
x="230.00777"
|
||||
y="219.01451" />
|
||||
<circle
|
||||
style="display:inline;opacity:1;vector-effect:none;fill:#3d3846;fill-opacity:0.99607843;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;marker-start:none;marker-mid:none;marker-end:none;paint-order:normal;enable-background:new"
|
||||
id="circle1761"
|
||||
cx="227.50777"
|
||||
cy="223.51451"
|
||||
r="1.5" />
|
||||
<rect
|
||||
y="223.01451"
|
||||
x="230.00777"
|
||||
height="1"
|
||||
width="5"
|
||||
id="rect1763"
|
||||
style="display:inline;opacity:1;vector-effect:none;fill:#3d3846;fill-opacity:0.99607843;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;marker-start:none;marker-mid:none;marker-end:none;paint-order:normal;enable-background:new" />
|
||||
</g>
|
||||
</svg>
|
Before Width: | Height: | Size: 5.0 KiB |
Before Width: | Height: | Size: 240 B |
Before Width: | Height: | Size: 147 B |
@ -1,65 +0,0 @@
|
||||
desktop_conf = configuration_data()
|
||||
desktop_conf.set('VERSION', glade_version)
|
||||
|
||||
i18n.merge_file(
|
||||
type: 'desktop',
|
||||
input: configure_file(
|
||||
input: 'org.gnome.Glade.desktop.in.in',
|
||||
output: '@BASENAME@',
|
||||
configuration: desktop_conf,
|
||||
),
|
||||
output: '@BASENAME@',
|
||||
po_dir: po_dir,
|
||||
install: true,
|
||||
install_dir: glade_datadir / 'applications',
|
||||
)
|
||||
|
||||
appdata = glade_name + '.appdata.xml'
|
||||
|
||||
i18n.merge_file(
|
||||
input: 'org.gnome.Glade.appdata.xml.in',
|
||||
output: '@BASENAME@',
|
||||
po_dir: po_dir,
|
||||
install: true,
|
||||
install_dir: glade_datadir / 'metainfo',
|
||||
)
|
||||
|
||||
# FIXME: replace these by install_subdir once autotools is removed
|
||||
install_data(
|
||||
'icons/hicolor/scalable/apps/org.gnome.Glade.svg',
|
||||
install_dir: glade_datadir / 'icons/hicolor/scalable/apps',
|
||||
)
|
||||
|
||||
icon_symbolic_data = files(
|
||||
'icons/hicolor/symbolic/apps/glade-brand-symbolic.svg',
|
||||
'icons/hicolor/symbolic/apps/org.gnome.Glade-symbolic.svg',
|
||||
)
|
||||
|
||||
install_data(
|
||||
icon_symbolic_data,
|
||||
install_dir: glade_datadir / 'icons/hicolor/symbolic/apps',
|
||||
)
|
||||
|
||||
pixmaps_data = files(
|
||||
'icons/deprecated-16x16.png',
|
||||
'icons/deprecated-22x22.png',
|
||||
'icons/devhelp.png',
|
||||
'icons/fixed-bg.png',
|
||||
'icons/placeholder.png',
|
||||
'icons/plus.png',
|
||||
)
|
||||
|
||||
install_data(
|
||||
pixmaps_data,
|
||||
install_dir: glade_datadir / glade_pixmapdir,
|
||||
)
|
||||
|
||||
its_data = files(
|
||||
'gettext/its/glade-catalog.its',
|
||||
'gettext/its/glade-catalog.loc',
|
||||
)
|
||||
|
||||
install_data(
|
||||
its_data,
|
||||
install_dir: glade_datadir / 'gettext/its',
|
||||
)
|
@ -1,171 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<component type="desktop">
|
||||
<id>org.gnome.Glade</id>
|
||||
<metadata_license>CC0-1.0</metadata_license>
|
||||
<project_license>GPL-2.0+ and LGPL-2.0+</project_license>
|
||||
<name>Glade</name>
|
||||
<summary>Create or open user interface designs for GTK+ applications</summary>
|
||||
<description>
|
||||
|
||||
<!-- To translators: AppData description first paragraph -->
|
||||
<p>
|
||||
Glade is a RAD tool to enable quick & easy development of user interfaces
|
||||
for the GTK+ 3 toolkit and the GNOME desktop environment.
|
||||
</p>
|
||||
|
||||
<!-- To translators: AppData description second paragraph -->
|
||||
<p>
|
||||
The user interfaces designed in Glade are saved as XML and these can be
|
||||
loaded by applications dynamically as needed by using GtkBuilder or used
|
||||
directly to define a new GtkWidget derived object class using
|
||||
GTK+ new template feature.
|
||||
</p>
|
||||
|
||||
<!-- To translators: AppData description third paragraph -->
|
||||
<p>
|
||||
By using GtkBuilder, Glade XML files can be used in numerous programming
|
||||
languages including C, C++, C#, Vala, Java, Perl, Python, and others.
|
||||
</p>
|
||||
</description>
|
||||
<screenshots>
|
||||
<screenshot type="default">
|
||||
<image>https://glade.gnome.org/images/glade-main-page.png</image>
|
||||
</screenshot>
|
||||
</screenshots>
|
||||
<provides>
|
||||
<id>glade.desktop</id>
|
||||
</provides>
|
||||
<launchable type="desktop-id">org.gnome.Glade.desktop</launchable>
|
||||
<url type="homepage">https://glade.gnome.org/</url>
|
||||
<url type="bugtracker">https://gitlab.gnome.org/GNOME/glade/issues</url>
|
||||
<url type="donation">https://www.gnome.org/friends/</url>
|
||||
<url type="help">https://help.gnome.org/users/glade/stable/</url>
|
||||
<update_contact>juanpablougarte_at_gmail.com</update_contact>
|
||||
<kudos>
|
||||
<kudo>HiDpiIcon</kudo>
|
||||
<kudo>ModernToolkit</kudo>
|
||||
<kudo>UserDocs</kudo>
|
||||
</kudos>
|
||||
<project_group>GNOME</project_group>
|
||||
<translation type="gettext">glade</translation>
|
||||
<releases>
|
||||
<release version="3.40.0" date="2022-08-10">
|
||||
<description>
|
||||
<p>Last Release!
|
||||
Glade is not being actively developed or maintained anymore.
|
||||
If you are interested in becoming a maintainer please contact us on gitlab.
|
||||
</p>
|
||||
<ul>
|
||||
<li>Remove survey</li>
|
||||
<li>Add user manual menu item (Sabri Ünal)</li>
|
||||
<li>'Clear' action in "Setup Text Attributes" dialog now clears only selected attributes (crvi)</li>
|
||||
<li>Fix windows build on msys</li>
|
||||
<li>Fix build against Python 3.9</li>
|
||||
<li>Fix issue pasing widget with ctrl+v in GtkGrid</li>
|
||||
<li>Several bug fixes</li>
|
||||
</ul>
|
||||
</description>
|
||||
<issues>
|
||||
<issue url="https://gitlab.gnome.org/GNOME/glade/-/issues/502">Fix issue #502 sync draw-indicator on setting xalign (Caolán McNamara)</issue>
|
||||
<issue url="https://gitlab.gnome.org/GNOME/glade/-/issues/499">Fix issue #499 and #509 "Drop overzealous check using only the first child"</issue>
|
||||
<issue url="https://gitlab.gnome.org/GNOME/glade/-/issues/385">Fix Segfault in gnome-builder when widget doesn't have a name (Peter Maatman)</issue>
|
||||
<issue url="https://gitlab.gnome.org/GNOME/glade/-/issues/373">Fix issue #373 "Move separator in hamburger menu one up, to be consistent with other GNOME applications"</issue>
|
||||
<issue url="https://gitlab.gnome.org/GNOME/glade/-/issues/484">Fix issue #484 "Crash with GtkRecentChooserDialog"</issue>
|
||||
<issue url="https://gitlab.gnome.org/GNOME/glade/-/issues/194">Fix issue #194 "Using List Store can result in program crash."</issue>
|
||||
<issue url="https://gitlab.gnome.org/GNOME/glade/-/issues/53">Fix issue #53 "Can't choose a FileChooserDialog for a FileChooserButton"</issue>
|
||||
<issue url="https://gitlab.gnome.org/GNOME/glade/-/issues/98">Fix issue #98 #491</issue>
|
||||
<issue url="https://gitlab.gnome.org/GNOME/glade/-/issues/355">Fix issue #355 "Make notification text selectable"</issue>
|
||||
<issue url="https://gitlab.gnome.org/GNOME/glade/-/issues/360">Fix issue #360 "No examples in documentation on using custom catalogues with gtkBuilder"</issue>
|
||||
<issue url="https://gitlab.gnome.org/GNOME/glade/-/issues/406">Fix issue #406 "AtkObject::accessible-role should not be translatable"</issue>
|
||||
<issue url="https://gitlab.gnome.org/GNOME/glade/-/issues/479">Fix issue #479 "Glade 3.36.0 segfaults when opening a file"</issue>
|
||||
<issue url="https://gitlab.gnome.org/GNOME/glade/-/issues/471">Fix issue #471 "XML not updated after adding element"</issue>
|
||||
<issue url="https://gitlab.gnome.org/GNOME/glade/-/issues/474">Fix issue #474 "GtkLabel: setup text attribute issues"</issue>
|
||||
<issue url="https://gitlab.gnome.org/GNOME/glade/-/issues/480">Fix issue #480 "version field not always updated in XML"</issue>
|
||||
<issue url="https://gitlab.gnome.org/GNOME/glade/-/issues/470">Fix issue #470 "Widgets of type need placeholders to add children"</issue>
|
||||
<issue url="https://gitlab.gnome.org/GNOME/glade/-/issues/472">Fix issue #472 "gnome-nightly: About dialog should display git commit rev"</issue>
|
||||
</issues>
|
||||
</release>
|
||||
<release version="3.38.0" date="2020-09-12">
|
||||
<description>
|
||||
<p>Glade 3.38.0 release!</p>
|
||||
<ul>
|
||||
<li>Load template files as new GTypes and add them to "User templates" widget group automatically without the need of a catalog</li>
|
||||
<li>Added JavaScript widget support</li>
|
||||
<li>Use version data from gir to improve deprecation/target tests</li>
|
||||
<li>Implement survey using new backend at surveys.gnome.org</li>
|
||||
<li>Keep survey state in config file</li>
|
||||
<li>Associate with application/x-gtk-builder (Caolán McNamara)</li>
|
||||
<li>Project properties dialog improvements. (Use headerbar, stack and stach switcher, add warnings textview)</li>
|
||||
<li>Improve toolkit target version selection in project properties dialog</li>
|
||||
<li>Improve treemodel char data type handling</li>
|
||||
<li>Remove autotools (Iñigo Martínez)</li>
|
||||
<li>New gjs-1.0 1.64 dependency</li>
|
||||
<li>Bump Gtk dependency to 3.24</li>
|
||||
<li>Bump webkit2gtk dependency to 2.28</li>
|
||||
<li>Fixed all compiler/gir warnings</li>
|
||||
</ul>
|
||||
</description>
|
||||
<issues>
|
||||
<issue url="https://gitlab.gnome.org/GNOME/glade/-/issues/385">Issue #385: GtkCellRendererText causes deprecated warnings for ghost properties</issue>
|
||||
<issue url="https://gitlab.gnome.org/GNOME/glade/-/issues/444">Issue #444: show-emoji-icon is missing "minimum version"/since constraint</issue>
|
||||
<issue url="https://gitlab.gnome.org/GNOME/glade/-/issues/367">Issue #367: Glade removes double/triple slashes from URLs</issue>
|
||||
<issue url="https://gitlab.gnome.org/GNOME/glade/-/issues/452">Issue #452: GtkComboBox cell renderers editor is too hard to discover</issue>
|
||||
<issue url="https://gitlab.gnome.org/GNOME/glade/-/issues/363">Issue #363: Toplevel windows are leaked when closing a project</issue>
|
||||
<issue url="https://gitlab.gnome.org/GNOME/glade/-/issues/462">Issue #462: Crash when creating a new GtkAssistant and pressing it</issue>
|
||||
<issue url="https://gitlab.gnome.org/GNOME/glade/-/issues/463">Issue #463: Specify file on command line</issue>
|
||||
<issue url="https://gitlab.gnome.org/GNOME/glade/-/issues/461">Issue #461: Glade resets number of rows and columns in GtkGrid</issue>
|
||||
<issue url="https://gitlab.gnome.org/GNOME/glade/-/issues/460">Issue #460: 3.37.0: test suite fails because glade uses incorrectly asserts in test units</issue>
|
||||
<issue url="https://gitlab.gnome.org/GNOME/glade/-/issues/412">Issue #412: Fix inconsistent "top-level", "top level", "toplevel" spelling in translatable strings</issue>
|
||||
<issue url="https://gitlab.gnome.org/GNOME/glade/-/issues/281">Issue #281: GladeProperty: Do not replace - with _</issue>
|
||||
<issue url="https://gitlab.gnome.org/GNOME/glade/-/issues/389">Issue #389: GladeProject: show message on invalid GtkBuilder file</issue>
|
||||
<issue url="https://gitlab.gnome.org/GNOME/glade/-/issues/446">Issue #446: GladeGtkListBox: fix size request issue</issue>
|
||||
<issue url="https://gitlab.gnome.org/GNOME/glade/-/issues/432">Issue #432: GladeStandarStock, GladeStandarStockImage: fix get_type() functions for introspection</issue>
|
||||
<issue url="https://gitlab.gnome.org/GNOME/glade/-/issues/447">Issue #447: GladeGtkWindow: Fix CSD support</issue>
|
||||
<issue url="https://gitlab.gnome.org/GNOME/glade/-/issues/456">Issue #456: Utils: use g_param_spec_uchar() for uchar types</issue>
|
||||
<issue url="https://gitlab.gnome.org/GNOME/glade/-/issues/459">Issue #459: Gtk catalog: add GtkRecentChooserMenu to Display group</issue>
|
||||
<issue url="https://gitlab.gnome.org/GNOME/glade/-/issues/433">Issue #433: Implement survey using new backend at surveys.gnome.org</issue>
|
||||
<issue>Build: use gtk-mac-integration only when creating bundle (Tom Schoonjans)</issue>
|
||||
<issue>Ignore locale when saving numeric values (Alberto Fanjul)</issue>
|
||||
<issue>Remove config for external builds (Alberto Fanjul)</issue>
|
||||
<issue>Python plugin: fix linking error</issue>
|
||||
<issue>Tests: add python and javascript test case</issue>
|
||||
<issue>gtk: Add GtkScrolledWindow propagate-natural-width property (Corentin Noël)</issue>
|
||||
<issue>GladeScrolledWindowEditor: Squeeze width/height properties in two columns</issue>
|
||||
<issue>Gtk plugin: add missing displayable values</issue>
|
||||
<issue>Webkit2gtk plugin: add missing displayable values and sandbox web view</issue>
|
||||
<issue>dtd: Make init-function an element, not an attribute (Adrien Plazas)</issue>
|
||||
</issues>
|
||||
</release>
|
||||
<release version="3.36.0" date="2020-05-06"/>
|
||||
<release version="3.22.0" date="2018-03-12"/>
|
||||
</releases>
|
||||
<content_rating type="oars-1.1">
|
||||
<content_attribute id="violence-cartoon">none</content_attribute>
|
||||
<content_attribute id="violence-fantasy">none</content_attribute>
|
||||
<content_attribute id="violence-realistic">none</content_attribute>
|
||||
<content_attribute id="violence-bloodshed">none</content_attribute>
|
||||
<content_attribute id="violence-sexual">none</content_attribute>
|
||||
<content_attribute id="violence-desecration">none</content_attribute>
|
||||
<content_attribute id="violence-slavery">none</content_attribute>
|
||||
<content_attribute id="violence-worship">none</content_attribute>
|
||||
<content_attribute id="drugs-alcohol">none</content_attribute>
|
||||
<content_attribute id="drugs-narcotics">none</content_attribute>
|
||||
<content_attribute id="drugs-tobacco">none</content_attribute>
|
||||
<content_attribute id="sex-nudity">none</content_attribute>
|
||||
<content_attribute id="sex-themes">none</content_attribute>
|
||||
<content_attribute id="sex-homosexuality">none</content_attribute>
|
||||
<content_attribute id="sex-prostitution">none</content_attribute>
|
||||
<content_attribute id="sex-adultery">none</content_attribute>
|
||||
<content_attribute id="sex-appearance">none</content_attribute>
|
||||
<content_attribute id="language-profanity">none</content_attribute>
|
||||
<content_attribute id="language-humor">none</content_attribute>
|
||||
<content_attribute id="language-discrimination">none</content_attribute>
|
||||
<content_attribute id="social-chat">none</content_attribute>
|
||||
<content_attribute id="social-info">none</content_attribute>
|
||||
<content_attribute id="social-audio">none</content_attribute>
|
||||
<content_attribute id="social-location">none</content_attribute>
|
||||
<content_attribute id="social-contacts">none</content_attribute>
|
||||
<content_attribute id="money-purchasing">none</content_attribute>
|
||||
<content_attribute id="money-gambling">none</content_attribute>
|
||||
</content_rating>
|
||||
</component>
|
@ -1,15 +0,0 @@
|
||||
[Desktop Entry]
|
||||
Name=Glade
|
||||
GenericName=Interface Designer
|
||||
Comment=Create or open user interface designs for GTK+ applications
|
||||
# Translators: Search terms to find this application. Do NOT translate or localize the semicolons! The list MUST also end with a semicolon!
|
||||
Keywords=GUI designer;user interface;ui builder;
|
||||
Exec=glade %F
|
||||
Terminal=false
|
||||
StartupNotify=true
|
||||
Type=Application
|
||||
# Translators: Do NOT translate or transliterate this text (this is an icon file name)!
|
||||
Icon=org.gnome.Glade
|
||||
Categories=GNOME;GTK;Development;GUIDesigner;
|
||||
MimeType=application/x-gtk-builder;application/x-glade;
|
||||
X-GNOME-DocPath=glade/glade.xml
|
1
doc/.gitignore
vendored
@ -1 +0,0 @@
|
||||
/version.xml
|
@ -1,226 +0,0 @@
|
||||
<refentry id="catalogintro" revision="8 Feb 2006">
|
||||
<refmeta>
|
||||
<refentrytitle>Introducing the Glade Catalog</refentrytitle>
|
||||
<refmiscinfo>Glade UI</refmiscinfo>
|
||||
</refmeta>
|
||||
<refnamediv>
|
||||
<refname>Writing catalogs</refname>
|
||||
<refpurpose>
|
||||
How to write and install a catalog
|
||||
</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1>
|
||||
<title>Introduction</title>
|
||||
|
||||
<para>
|
||||
You can provide support for your custom widgets in a few ways, you can
|
||||
make a package and install it to the system directories, load additional
|
||||
catalogs in user directories, project directories for example, and
|
||||
you can optionally provide code support and/or icons, normally you need
|
||||
to at least have the object type in a library somewhere, but you can work
|
||||
around this using the 'parent' property described in the next section.
|
||||
If you dont provide icons for the inspector and palette Glade will simply
|
||||
print a warning and use a default icon. The catalog file is written in an
|
||||
XML format and a DTD for the format can be found in the plugins/ directory
|
||||
of the Glade tarball.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
In most cases gtk+ derived widgets can be added with little effort and it
|
||||
is enough to simply specify the widget's type; glade will introspect
|
||||
its properties and signals - but due to the organic nature of a widget
|
||||
toolkit there are always exceptions. In this document we'll try to provide
|
||||
some basic examples and describe a wealth of options that can be used to
|
||||
enhance UI editing and workaround exceptions.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Keep in mind you need to take extra steps to ensure GtkBuilder can pick up your
|
||||
new object types at runtime. Ussualy all you need is to link your executable
|
||||
with your widget library assuming it has properly named get_type() functions.
|
||||
|
||||
<![CDATA[GtkWindow -> gtk_window_get_type
|
||||
GtkHBox -> gtk_hbox_get_type
|
||||
GtkUIManager -> gtk_ui_manager_get_type
|
||||
GWeatherLocation -> gweather_location_get_type]]>
|
||||
|
||||
If not you can always register your widgets with the type system with g_type_ensure ()
|
||||
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The catalog file starts by specifying the name of the catalog and the plugin
|
||||
library to use, the following examples assume you have a namespace "Foo" and
|
||||
are integrating an object "Frobnicator":
|
||||
<programlisting>
|
||||
<![CDATA[<?xml version="1.0" encoding="UTF-8"?>
|
||||
<glade-catalog name="foo" library="foo" depends="gtk+">
|
||||
<init-function>my_catalog_init</init-function>
|
||||
|
||||
<glade-widget-classes>
|
||||
<glade-widget-class name="FooFrobnicator" generic-name="frobnicator" title="Frobnicator"/>
|
||||
|
||||
... widget classes go here
|
||||
</glade-widget-classes>
|
||||
|
||||
<glade-widget-group name="foo" title="Foo">
|
||||
<glade-widget-class-ref name="FooFrobnicator"/>
|
||||
... widget class references go here
|
||||
</glade-widget-group>
|
||||
|
||||
... widget groups go here
|
||||
</glade-catalog>]]></programlisting>
|
||||
</para>
|
||||
|
||||
</refsect1>
|
||||
<refsect1>
|
||||
<title>Toplevel catalog properties and tags</title>
|
||||
<para>
|
||||
When defining the catalog, the 'name' and 'library'
|
||||
are both mandatory attributes of the 'glade-catalog' tag; optionally
|
||||
you can also use 'icon-prefix', 'depends' and 'domain'.
|
||||
</para>
|
||||
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term>name</term>
|
||||
<listitem>
|
||||
<para>
|
||||
A string identifier for the catalog in question, it will be used to identify your
|
||||
catalog so that the glade file can explicitly require it and to manage inter
|
||||
catalog dependencies.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>version</term>
|
||||
<listitem>
|
||||
<para>
|
||||
A 'major.minor' formed version describing the current version of underlying widget kit;
|
||||
example: <literal>version="1.0"</literal>. This is needed for version checking to work.
|
||||
Please note that all versioning related support is completely optional.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>targetable</term>
|
||||
<listitem>
|
||||
<para>
|
||||
A comma separated list of 'major.minor' formed versions describing sensible previous
|
||||
targetable versions of the underlying toolkit not including the current version;
|
||||
example: <literal>targetable="0.6,0.8"</literal>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>icon-prefix</term>
|
||||
<listitem>
|
||||
<para>
|
||||
Used to form icon names for widgets. This property defaults to the value of the 'name' attribute.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>library</term>
|
||||
<listitem>
|
||||
<para>
|
||||
Used to load the types and introspect properties, unless you are faking your widget
|
||||
classes (which will be described later on), glade will need to load this library,
|
||||
it can either be the name of the library containing the widgets or the plugin library
|
||||
which is assumed to implicitly link to your widget library. The library will be loaded
|
||||
either by a user specified path, the system plugin directory:
|
||||
<literal>$prefix/lib/glade-3/modules/</literal>, or from the default system library
|
||||
paths in the afore mentioned order of precedence.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>depends</term>
|
||||
<listitem>
|
||||
<para>
|
||||
Used for inheritance of support code to work properly (i.e. if your object derives
|
||||
from an object in gtk+, you'll want the default support code in the gladegtk plugin
|
||||
to be enabled for your widget too). This property's value is the `name' property of
|
||||
another installed glade plugin; usually you'll want to declare: 'depends="gtk+"'
|
||||
for your plugin.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>domain</term>
|
||||
<listitem>
|
||||
<para>
|
||||
The domain in which to search for translatable strings from the
|
||||
catalog file; please note that all strings from the catalog that will appear in the UI are
|
||||
translated using this domain. If the 'domain' is not specified, the library property will
|
||||
be used in it's stead.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>book</term>
|
||||
<listitem>
|
||||
<para>
|
||||
Used to specify a namespace to search devhelp docs library with
|
||||
(specifically, it is the $(DOC_MODULE) that you specified in your gtk-doc Makefile.am).
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>init-function</term>
|
||||
<listitem>
|
||||
<para>
|
||||
Used to retrieve an optional global entry point to your plugin;
|
||||
if you need to initialize any backends or whatnot this is a good place.
|
||||
Your catalog's init-function will be called before any widget classes are instantiated.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
<refsect1>
|
||||
<title>Validating and installing</title>
|
||||
<para>
|
||||
The DTD that is shipped with Glade can be used to validate your catalog
|
||||
file. Note that properties must be entered in the same order as they are
|
||||
specified in the DTD for the validation to pass.
|
||||
</para>
|
||||
<para>
|
||||
To validate a file, do this:
|
||||
<programlisting>xmllint --dtdvalid glade-catalog.dtd --noout my-catalog.xml</programlisting>
|
||||
</para>
|
||||
<para>
|
||||
To install a widget plugin, the catalog XML file should be copied into
|
||||
the catalog directory, which can be retrieved as:
|
||||
<programlisting>pkg-config --variable=catalogdir gladeui-1.0</programlisting>
|
||||
The plugin library should be installed into the modules directory:
|
||||
<programlisting>pkg-config --variable=moduledir gladeui-1.0</programlisting>
|
||||
Widget icons if provided (recommended) need to be installed into the icon theme,
|
||||
this is described in the next chapter.
|
||||
</para>
|
||||
<para>
|
||||
You can also load your catalog from a user directory by specifying
|
||||
additional load path(s) in the environment, for instance:
|
||||
<programlisting>GLADE_CATALOG_SEARCH_PATH=~/mycatalogs:~/work/foo/glade</programlisting>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Same goes for optional plugin libraries, for instance:
|
||||
<programlisting>GLADE_MODULE_SEARCH_PATH=~/work/foo/src</programlisting>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Currently loading icons without installing them is unsupported.
|
||||
</para>
|
||||
|
||||
</refsect1>
|
||||
</refentry>
|
@ -1,99 +0,0 @@
|
||||
<refentry id="gjssupport" revision="5 Jun 2020">
|
||||
<refmeta>
|
||||
<refentrytitle>JavaScript Gtk widgets support</refentrytitle>
|
||||
<refmiscinfo>Glade UI</refmiscinfo>
|
||||
</refmeta>
|
||||
<refnamediv>
|
||||
<refname>Add GJS/JavaScript support to your catalog</refname>
|
||||
<refpurpose>
|
||||
How to write and install a catalog for a JavaScript widget library
|
||||
</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1>
|
||||
<title>Introduction</title>
|
||||
<para>
|
||||
Glade supports loading widgets programed in JavaScript by linking and running GJS from the gladegjs catalog plugin.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
So in order for glade to support your JavaScript widgets you will have to:
|
||||
|
||||
<varlistentry><listitem>
|
||||
a) specify gladegjs support code as your plugin library.
|
||||
</listitem></varlistentry>
|
||||
|
||||
<varlistentry><listitem>
|
||||
b) set glade_gjs_init as you init function.
|
||||
</listitem></varlistentry>
|
||||
|
||||
<varlistentry><listitem>
|
||||
c) make sure your catalog name is the same as your JavaScript import library since
|
||||
glade_gjs_init() will use this name to import your widgets into the
|
||||
interpreter.
|
||||
</listitem></varlistentry>
|
||||
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
<glade-catalog name="gjsplugin" library="gladegjs" domain="glade-3" depends="gtk+">
|
||||
<init-function>glade_gjs_init</init-function>
|
||||
|
||||
<glade-widget-classes>
|
||||
<glade-widget-class title="MyJSGrid" name="MyJSGrid" generic-name="mygrid"/>
|
||||
</glade-widget-classes>
|
||||
|
||||
<glade-widget-group name="gjs" title="Gjs">
|
||||
<glade-widget-class-ref name="MyJSGrid"/>
|
||||
</glade-widget-group>
|
||||
</glade-catalog>]]>
|
||||
</programlisting>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
GJS will look up for your widgets in the same places it looks
|
||||
for regular catalogs plugins, that is $GLADE_ENV_MODULE_PATH
|
||||
environment variable and `pkg-config --variable=moduledir gladeui-2.0`
|
||||
|
||||
So the easiest thing would be to make a symlink in one of those directory, just
|
||||
do not forget that the name should be the one specified in your catalog name.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
gjsplugin.js
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
#!/usr/bin/gjs
|
||||
|
||||
const GObject = imports.gi.GObject;
|
||||
const Gtk = imports.gi.Gtk;
|
||||
|
||||
var MyJSGrid = GObject.registerClass({
|
||||
GTypeName: 'MyJSGrid',
|
||||
Properties: {
|
||||
'string-property': GObject.ParamSpec.string('string-property', 'String Prop',
|
||||
'Longer description', GObject.ParamFlags.READWRITE | GObject.ParamFlags.CONSTRUCT,
|
||||
'Foobar'),
|
||||
'int-property': GObject.ParamSpec.int('int-property', 'Integer Prop',
|
||||
'Longer description',
|
||||
GObject.ParamFlags.READWRITE | GObject.ParamFlags.CONSTRUCT,
|
||||
0, 10, 5)
|
||||
},
|
||||
Signals: {'mysignal': {param_types: [GObject.TYPE_INT]}},
|
||||
}, class MyJSGrid extends Gtk.Grid {
|
||||
_init(props) {
|
||||
super._init(props);
|
||||
this.label = new Gtk.Label ({ visible: true });
|
||||
this.add (this.label);
|
||||
this.connect('notify::string-property', this._update.bind(this));
|
||||
this.connect('notify::int-property', this._update.bind(this));
|
||||
this._update();
|
||||
}
|
||||
_update (obj, pspec) {
|
||||
this.label.set_text ('JS Properties\nInteger = ' + this.int_property + '\nString = \'' + this.string_property + '\'');
|
||||
}
|
||||
});
|
||||
]]>
|
||||
</programlisting>
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
@ -1,92 +0,0 @@
|
||||
<refentry id="pythonsupport" revision="26 Feb 2011">
|
||||
<refmeta>
|
||||
<refentrytitle>Python Gtk widgets support</refentrytitle>
|
||||
<refmiscinfo>Glade UI</refmiscinfo>
|
||||
</refmeta>
|
||||
<refnamediv>
|
||||
<refname>Add python support to your catalog</refname>
|
||||
<refpurpose>
|
||||
How to write and install a catalog for a python widget library
|
||||
</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1>
|
||||
<title>Introduction</title>
|
||||
<para>
|
||||
Glade supports loading widgets coded in python by linking and running the python
|
||||
interpreter from the gladepython catalog plugin.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
So in order for glade to include your python gtk widgets you will have to:
|
||||
|
||||
<varlistentry><listitem>
|
||||
a) specify gladepython support code as your plugin library.
|
||||
</listitem></varlistentry>
|
||||
|
||||
<varlistentry><listitem>
|
||||
b) set glade_python_init as you init function.
|
||||
</listitem></varlistentry>
|
||||
|
||||
<varlistentry><listitem>
|
||||
c) make sure your catalog name is the same as your python import library since
|
||||
glade_python_init() will use this name to import your widgets into the
|
||||
interpreter.
|
||||
</listitem></varlistentry>
|
||||
|
||||
pythonplugin.xml
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
<glade-catalog name="pythonplugin" library="gladepython"
|
||||
domain="glade-3" depends="gtk+">
|
||||
<init-function>glade_python_init</init-function>
|
||||
|
||||
<glade-widget-classes>
|
||||
<glade-widget-class title="MyPythonBox" name="MyPythonBox" generic-name="mypythonbox"/>
|
||||
</glade-widget-classes>
|
||||
|
||||
<glade-widget-group name="python" title="Python">
|
||||
<glade-widget-class-ref name="MyPythonBox"/>
|
||||
</glade-widget-group>
|
||||
</glade-catalog>]]>
|
||||
</programlisting>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Glade's python interpreter will look up for your widgets in the same
|
||||
places it looks
|
||||
for regular catalogs plugins, that is $GLADE_ENV_MODULE_PATH
|
||||
environment variable
|
||||
and `pkg-config --variable=moduledir gladeui-2.0`
|
||||
|
||||
So the easiest thing would be to make a symlink in one of those directory, just
|
||||
do not forget that the name should be the one specified in your catalog name.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
pythonplugin.py
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
from gi.repository import GLib, Gtk, GObject
|
||||
|
||||
class MyPythonBox(Gtk.Box):
|
||||
__gtype_name__ = 'MyPythonBox'
|
||||
|
||||
foo = GObject.Property(type=int, nick='An integer')
|
||||
bar = GObject.Property(type=str, nick='A String')
|
||||
|
||||
def _update(self, obj, pspec):
|
||||
self.label.set_text ('Python Properties\nInteger = ' + str(self.foo) + '\nString = \'' + self.bar + '\'')
|
||||
|
||||
def __init__ (self):
|
||||
Gtk.Box.__init__ (self)
|
||||
self.label = Gtk.Label (visible = True)
|
||||
self.add (self.label)
|
||||
self.connect('notify::foo', self._update)
|
||||
self.connect('notify::bar', self._update)
|
||||
self._update(None, None)
|
||||
]]>
|
||||
</programlisting>
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
@ -1,90 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE book PUBLIC '-//OASIS//DTD DocBook XML V4.5//EN'
|
||||
'http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd' [
|
||||
|
||||
<!ENTITY % local.common.attrib "xmlns:xi CDATA #FIXED 'http://www.w3.org/2003/XInclude'">
|
||||
<!ENTITY version SYSTEM "version.xml">
|
||||
]>
|
||||
<book id="index" xmlns:xi="http://www.w3.org/2003/XInclude">
|
||||
<bookinfo>
|
||||
<title>Glade User Interface Designer Reference Manual</title>
|
||||
<releaseinfo>
|
||||
for gladeui &version;.
|
||||
This document attempts to describe how to use the Glade UI Designer core
|
||||
library to integrate Glade into your application and how to integrate your
|
||||
custom GTK+ derived widgets into the Glade UI Designer.
|
||||
|
||||
The latest version of this documentation can be found on-line at
|
||||
<ulink role="online-location" url="https://developer.gnome.org/gladeui/stable/">
|
||||
https://developer.gnome.org/gladeui/stable
|
||||
</ulink>.
|
||||
</releaseinfo>
|
||||
</bookinfo>
|
||||
|
||||
<part id="catalog">
|
||||
<title>Adding your custom widgets</title>
|
||||
<xi:include href="catalogintro.sgml"/>
|
||||
<xi:include href="widgetclasses.sgml"/>
|
||||
<xi:include href="properties.sgml"/>
|
||||
<xi:include href="gladepython.sgml"/>
|
||||
<xi:include href="gladegjs.sgml"/>
|
||||
</part>
|
||||
|
||||
<part id="core">
|
||||
<title>Glade Core</title>
|
||||
<xi:include href="xml/glade-init.xml"/>
|
||||
<xi:include href="xml/glade-catalog.xml"/>
|
||||
<xi:include href="xml/glade-app.xml"/>
|
||||
<xi:include href="xml/glade-project.xml"/>
|
||||
<xi:include href="xml/glade-widget.xml"/>
|
||||
<xi:include href="xml/glade-widget-adaptor.xml"/>
|
||||
<xi:include href="xml/glade-widget-action.xml"/>
|
||||
<xi:include href="xml/glade-widget-action-def.xml"/>
|
||||
<xi:include href="xml/glade-fixed.xml"/>
|
||||
<xi:include href="xml/glade-property.xml"/>
|
||||
<xi:include href="xml/glade-property-def.xml"/>
|
||||
<xi:include href="xml/glade-command.xml"/>
|
||||
<xi:include href="xml/glade-clipboard.xml"/>
|
||||
<xi:include href="xml/glade-base-editor.xml"/>
|
||||
<xi:include href="xml/glade-placeholder.xml"/>
|
||||
<xi:include href="xml/glade-signal.xml"/>
|
||||
<xi:include href="xml/glade-signal-def.xml"/>
|
||||
<xi:include href="xml/glade-name-context.xml"/>
|
||||
<xi:include href="xml/glade-xml-utils.xml"/>
|
||||
</part>
|
||||
|
||||
<part id="dockables">
|
||||
<title>Dockable Glade UI Widgets</title>
|
||||
<xi:include href="xml/glade-editable.xml"/>
|
||||
<xi:include href="xml/glade-editor.xml"/>
|
||||
<xi:include href="xml/glade-editor-property.xml"/>
|
||||
<xi:include href="xml/glade-palette.xml"/>
|
||||
<xi:include href="xml/glade-inspector.xml"/>
|
||||
<xi:include href="xml/glade-signal-editor.xml"/>
|
||||
<xi:include href="xml/glade-previewer.xml"/>
|
||||
<xi:include href="xml/glade-design-view.xml"/>
|
||||
<xi:include href="xml/glade-preview.xml"/>
|
||||
<xi:include href="xml/glade-adaptor-chooser.xml"/>
|
||||
<xi:include href="xml/glade-property-label.xml"/>
|
||||
<xi:include href="xml/glade-property-shell.xml"/>
|
||||
</part>
|
||||
|
||||
<part id="misc">
|
||||
<title>Miscellaneous utilities</title>
|
||||
<xi:include href="xml/glade-cell-renderer-icon.xml"/>
|
||||
<xi:include href="xml/glade-object-stub.xml"/>
|
||||
<xi:include href="xml/glade-signal-model.xml"/>
|
||||
<xi:include href="xml/glade-utils.xml"/>
|
||||
</part>
|
||||
|
||||
<index id="api-index-full">
|
||||
<title>Index</title>
|
||||
<xi:include href="xml/api-index-full.xml"><xi:fallback /></xi:include>
|
||||
</index>
|
||||
<index id="api-index-deprecated" role="deprecated">
|
||||
<title>Index of deprecated symbols</title>
|
||||
<xi:include href="xml/api-index-deprecated.xml"><xi:fallback /></xi:include>
|
||||
</index>
|
||||
|
||||
<xi:include href="xml/annotation-glossary.xml"><xi:fallback /></xi:include>
|
||||
</book>
|
@ -1,18 +0,0 @@
|
||||
#include <glade.h>
|
||||
|
||||
glade_app_get_type
|
||||
glade_clipboard_get_type
|
||||
glade_command_get_type
|
||||
glade_editor_get_type
|
||||
glade_editor_property_get_type
|
||||
glade_palette_get_type
|
||||
glade_placeholder_get_type
|
||||
glade_project_get_type
|
||||
glade_inspector_get_type
|
||||
glade_property_get_type
|
||||
glade_signal_get_type
|
||||
glade_widget_get_type
|
||||
glade_widget_adaptor_get_type
|
||||
glade_design_view_get_type
|
||||
glade_base_editor_get_type
|
||||
glade_widget_action_get_type
|
@ -1,49 +0,0 @@
|
||||
private_doc_headers = [
|
||||
'glade-builtins.h',
|
||||
'glade-debug.h',
|
||||
'glade-design-private.h',
|
||||
'glade-drag.h',
|
||||
'glade-accumulators.h',
|
||||
'glade-marshallers.h',
|
||||
'glade-paths.h',
|
||||
'glade-custom.h',
|
||||
'glade-cursor.h',
|
||||
'glade-id-allocator.h',
|
||||
'glade.h',
|
||||
'glade-design-layout.h',
|
||||
'glade-popup.h',
|
||||
'glade-gtk.h',
|
||||
'glade-palette-expander.h',
|
||||
'glade-palette-item.h',
|
||||
'glade-named-icon-chooser-dialog.h',
|
||||
'glade-palette-box.h',
|
||||
'glade-private.h',
|
||||
]
|
||||
|
||||
content_files = files(
|
||||
'catalogintro.sgml',
|
||||
'gladepython.sgml',
|
||||
'properties.sgml',
|
||||
'widgetclasses.sgml',
|
||||
)
|
||||
|
||||
version_conf = configuration_data()
|
||||
version_conf.set('PACKAGE_STRING', '@0@ @1@'.format(glade_name, glade_version))
|
||||
|
||||
content_files += configure_file(
|
||||
input: 'version.xml.in',
|
||||
output: '@BASENAME@',
|
||||
configuration: version_conf,
|
||||
)
|
||||
|
||||
gnome.gtkdoc(
|
||||
gladeui_name,
|
||||
main_xml: gladeui_name + '-docs.xml',
|
||||
module_version: gladeui_major_version.to_string(),
|
||||
src_dir: gladeui_inc,
|
||||
ignore_headers: private_doc_headers,
|
||||
include_directories: top_inc,
|
||||
dependencies: libgladeui_dep,
|
||||
content_files: content_files,
|
||||
install: true,
|
||||
)
|
@ -1,272 +0,0 @@
|
||||
<refentry id="properties" revision="8 Feb 2006">
|
||||
<refmeta>
|
||||
<refentrytitle>Property Definitions</refentrytitle>
|
||||
<refmiscinfo>Glade UI</refmiscinfo>
|
||||
</refmeta>
|
||||
<refnamediv>
|
||||
<refname>Property Definitions</refname>
|
||||
<refpurpose>
|
||||
How to augment or define a #GladePropertyDef
|
||||
</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1>
|
||||
<title>Property Definition Configuration</title>
|
||||
<para>
|
||||
Properties are introspected at load time and loaded into #GladePropertyDef structures.
|
||||
The behaviour of properties can be modified by the catalog and fake properties can be added
|
||||
for editing purposes. Here is an example of the xml form:
|
||||
<programlisting><![CDATA[...
|
||||
|
||||
<property id="frobnicate-mode" default="FOO_FROBNICATE_RED">
|
||||
|
||||
... spec, tooltip etc
|
||||
|
||||
<displayable-values>
|
||||
|
||||
<value id="FOO_FROBNICATE_RED" name="Red"/>
|
||||
<value id="FOO_FROBNICATE_BLUE" name="Blue"/>
|
||||
|
||||
... values here
|
||||
|
||||
</displayable-values>
|
||||
</property>
|
||||
|
||||
...]]></programlisting>
|
||||
|
||||
|
||||
</para>
|
||||
<para>
|
||||
Properties of the 'property' tag:
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term>id</term>
|
||||
<listitem>
|
||||
<para>
|
||||
This is mandatory and specifies the property that we are modifying (or adding)
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>name</term>
|
||||
<listitem>
|
||||
<para>
|
||||
The name to be used in the interface.
|
||||
(if name is not specified; it defaults to the nickname of the #GParamSpec)
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>since</term>
|
||||
<listitem>
|
||||
<para>
|
||||
A 'major.minor' formed version describing the version of the owning catalog in which this
|
||||
property was introduced; example: <literal>since="1.0"</literal>. Properties are initialized
|
||||
to be supported since the introducing #GladeWidgetAdaptor was supported.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>disabled</term>
|
||||
<listitem>
|
||||
<para>
|
||||
Remove this property from this widget class and derived classes
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>default</term>
|
||||
<listitem>
|
||||
<para>
|
||||
A default value to be used for this property
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>translatable</term>
|
||||
<listitem>
|
||||
<para>
|
||||
For text properties, whether the property value is translatable in glade
|
||||
interfaces (this will enable the i18n dialog on text properties). Defaults to False.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>common</term>
|
||||
<listitem>
|
||||
<para>
|
||||
If set to "True", the property will end up on the common tab even if
|
||||
its not a property of GtkWidgetClass.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>optional</term>
|
||||
<listitem>
|
||||
<para>
|
||||
Whether this property is an optional property, this will make the property
|
||||
insensitive and add a check box to enable it (like width/height-request for
|
||||
example).
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>optional-default</term>
|
||||
<listitem>
|
||||
<para>
|
||||
If this is in fact an optional property; whether it is enabled by default.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>query</term>
|
||||
<listitem>
|
||||
<para>
|
||||
If query is set; the property will be queried from the user in a dialog
|
||||
when adding the owning widget class instance to the project.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>save</term>
|
||||
<listitem>
|
||||
<para>
|
||||
Whether to save this property to the glade file (default "True")
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>visible</term>
|
||||
<listitem>
|
||||
<para>
|
||||
Whether to show the property in the editor and reset dialog (default "True")
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>custom-layout</term>
|
||||
<listitem>
|
||||
<para>
|
||||
This is used to avoid loading this property in the editor when implementing
|
||||
a custom #GladeEditable that embeds the base #GladeEditorTable implementation,
|
||||
custom-layout properties will still show up in the reset dialog (default "False)
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>ignore</term>
|
||||
<listitem>
|
||||
<para>
|
||||
Whether to set the property on the object instance (via g_object_set_property or
|
||||
plugin override functions) when it changes in the editor (the value in the editor
|
||||
is the value saved).
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>themed-icon</term>
|
||||
<listitem>
|
||||
<para>
|
||||
Depicts a string property that is used for an icon from the theme. These will
|
||||
the appropriate editor.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>weight</term>
|
||||
<listitem>
|
||||
<para>
|
||||
A numerical value to specify this properties position in the property editor.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>transfer-on-paste</term>
|
||||
<listitem>
|
||||
<para>
|
||||
Used for packing properties; depicts packing properties that should follow
|
||||
the widget when pasted to a new container that supports the same properties.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>save-always</term>
|
||||
<listitem>
|
||||
<para>
|
||||
Specifies that the property should be saved regardless of its value (properties at their
|
||||
default values are normally not saved).
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Child tags of the 'property' tag:
|
||||
<variablelist>
|
||||
|
||||
<varlistentry>
|
||||
<term>spec</term>
|
||||
<listitem>
|
||||
<para>
|
||||
Specifies a function to be used to return a #GParamSpec for this property;
|
||||
this is used to add virtual properties to an object (like the "size" property
|
||||
on #GtkBox).
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>tooltip</term>
|
||||
<listitem>
|
||||
<para>
|
||||
The tooltip to be displayed in the property editor for this property.
|
||||
The tooltip defaults to the blurb of the associated #GParamSpec.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>visible-lines</term>
|
||||
<listitem>
|
||||
<para>
|
||||
An integer value to specify how many lines will be shown for text properties
|
||||
in the editor (this doesnt really work because of the complexity of calculating
|
||||
size of rendered text; instead, just set this to 2 if you want the text property
|
||||
to be edited in a textview with a scrolled window as opposed to a simple text entry).
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>displayable-values</term>
|
||||
<listitem>
|
||||
<para>
|
||||
Allows you to specify user friendly strings for enum and flag values as shown in the
|
||||
example above, use the `id' property in the value tag to depict the real value name
|
||||
and the `name' property for the human readable one.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
@ -1 +0,0 @@
|
||||
@PACKAGE_STRING@
|
@ -1,555 +0,0 @@
|
||||
<refentry id="widgetclasses" revision="8 Feb 2006">
|
||||
<refmeta>
|
||||
<refentrytitle>Widget Adaptor Definitions</refentrytitle>
|
||||
<refmiscinfo>Glade UI</refmiscinfo>
|
||||
</refmeta>
|
||||
<refnamediv>
|
||||
<refname>Widget Classes</refname>
|
||||
<refpurpose>
|
||||
Adding support for custom widgets
|
||||
</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1>
|
||||
<title>Forward</title>
|
||||
|
||||
<para>
|
||||
Widget support in Glade is provided by the #GladeWidgetAdaptor object, each
|
||||
`glade-widget-class' definition in the catalog will result in the creation
|
||||
of an adaptor, which inherits the functionality of the adaptor created for its
|
||||
parent, or the closest adaptor available in the ancestry. Adaptor methods can
|
||||
be overridden by functions in the plugin by specifying them in the catalog.
|
||||
There is also a wealth of options you can use in the `glade-widget-class' without
|
||||
writing code.
|
||||
</para>
|
||||
<para>
|
||||
A typical basic example of a widget class definition is as follows:
|
||||
<programlisting>
|
||||
<![CDATA[<glade-widget-class name="FooFrobnicator" generic-name="frobnicator" title="Frobnicator"/>]]></programlisting>
|
||||
</para>
|
||||
<para>
|
||||
Here is the complete example of the form of the `glade-widget-class' definition:
|
||||
<programlisting>
|
||||
<![CDATA[<glade-widget-class name="FooFrobnicator" generic-name="frobnicator" title="Frobnicator"/>
|
||||
<post-create-function>foo_frobnicator_plugin_post_create</post-create-function>
|
||||
|
||||
... widget class support functions go here
|
||||
|
||||
<properties>
|
||||
<property id="frobnicated" default="False"/>
|
||||
|
||||
... property definitions go here
|
||||
</properties>
|
||||
|
||||
<signals>
|
||||
<signal id="frobnicate" since="1.0"/>
|
||||
|
||||
... signal definitions go here
|
||||
</signals>
|
||||
|
||||
<packing-properties>
|
||||
... child packing property definitions go here
|
||||
</packing-properties>
|
||||
|
||||
<actions>
|
||||
<action id="launch_editor" name="Edit Frob" stock="gtk-edit"/>
|
||||
|
||||
... context menu action definitions go here
|
||||
</actions>
|
||||
|
||||
<packing-actions>
|
||||
... context menu action definitions for child objects go here
|
||||
</packing-actions>
|
||||
|
||||
<packing-defaults>
|
||||
<parent-class name="GtkVBox">
|
||||
<child-property id="expand" default="false"/>
|
||||
</parent-class>
|
||||
|
||||
... packing default definitions go here
|
||||
</packing-defaults>
|
||||
</glade-widget-class>]]></programlisting>
|
||||
</para>
|
||||
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>Widget Class Properties</title>
|
||||
<para>
|
||||
The following are all properties of the `glade-widget-class' tag
|
||||
</para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term>name</term>
|
||||
<listitem>
|
||||
<para>
|
||||
The class name of the widget; unless the 'get-type-function' property is present,
|
||||
this will essentially be used to instantiate the actual class by deriving
|
||||
'gtk_label_get_type' from 'GtkLabel' and searching for 'gtk_label_get_type' in the
|
||||
support library.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>since</term>
|
||||
<listitem>
|
||||
<para>
|
||||
A 'major.minor' formed version describing the version of the owning catalog in which this
|
||||
object class was introduced; example: <literal>since="1.0"</literal>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>deprecated</term>
|
||||
<listitem>
|
||||
<para>
|
||||
A boolean property depicting that this widget is currently deprecated.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>builder-unsupported</term>
|
||||
<listitem>
|
||||
<para>
|
||||
A boolean property depicting that this widget is not supported by #GtkBuilder.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>get-type-function</term>
|
||||
<listitem>
|
||||
<para>
|
||||
Used to explicitly specify the name of the function used to get the type of the widget.
|
||||
It is optional, but if it is not present, the 'name' property will be used to guess the
|
||||
name of the function, a process that could lead to unexpected results.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>generic-name</term>
|
||||
<listitem>
|
||||
<para>
|
||||
Used to generate a default name for instances of the
|
||||
widget in the UI editor. It is also used in conjunction with the 'icon-prefix'
|
||||
to form an icon name for the widget.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>icon-name</term>
|
||||
<listitem>
|
||||
<para>
|
||||
Used to explicitly set an icon name for this widget.
|
||||
These icon names are looked up in the current icon theme to retrieve an icon for
|
||||
the widget.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>title</term>
|
||||
<listitem>
|
||||
<para>
|
||||
Used to display the name of the class in the palette and widget
|
||||
tree and will be translated before use in the interface.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>parent</term>
|
||||
<listitem>
|
||||
<para>
|
||||
Use this to specify the name of the parent your widget derives from, you
|
||||
can use this option instead of loading a real widget type (this allows you
|
||||
to fake derive and still add properties and run your catalog independently
|
||||
of any plugins or libraries).
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>toplevel</term>
|
||||
<listitem>
|
||||
<para>
|
||||
Used to know whether this widget class is toplevel or not
|
||||
in Glade context. This property will be inherited from the adaptors parent.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>fixed</term>
|
||||
<listitem>
|
||||
<para>
|
||||
Used to mark a #GladeWidgetAdaptor for free form placement capacities
|
||||
to be handled with a #GladeFixed. This property will be inherited from the adaptors parent.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>use-placeholders</term>
|
||||
<listitem>
|
||||
<para>
|
||||
Used to inform the core about adaptors that implement
|
||||
#GtkContainer editing, and whether or not they use #GladePlaceholder. This property will
|
||||
be inherited from the adaptors parent.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>default-width</term>
|
||||
<listitem>
|
||||
<para>
|
||||
The default width to load a #GtkWindow derived widget in the #GladeDesignView.
|
||||
This property will be inherited from the adaptors parent.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>default-height</term>
|
||||
<listitem>
|
||||
<para>
|
||||
The default height to load a #GtkWindow derived widget in the #GladeDesignView.
|
||||
This property will be inherited from the adaptors parent.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>Adapter Methods</title>
|
||||
<para>
|
||||
The following are all child tags of the `glade-widget-class' tag
|
||||
</para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term>constructor-function</term>
|
||||
<listitem>
|
||||
<para>
|
||||
Used to override the actual #GObject constructor of the said #GladeWidgetAdaptor
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>post-create-function</term>
|
||||
<listitem>
|
||||
<para>
|
||||
A #GladePostCreateFunc support function that gets called whenever a widget of the said class is instantiated.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>deep-post-create-function</term>
|
||||
<listitem>
|
||||
<para>
|
||||
Same as `post-create-function' except in that you must always chain up
|
||||
to the super class definition as a rule.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>get-property-function</term>
|
||||
<listitem>
|
||||
<para>
|
||||
A #GladeGetPropertyFunc to get values of properties on an instance in the
|
||||
runtime.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>set-property-function</term>
|
||||
<listitem>
|
||||
<para>
|
||||
A #GladeSetPropertyFunc to set values of properties on an instance in the
|
||||
runtime.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>verify-function</term>
|
||||
<listitem>
|
||||
<para>
|
||||
A #GladeVerifyPropertyFunc to set values of properties on an instance in the
|
||||
runtime.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>add-child-function</term>
|
||||
<listitem>
|
||||
<para>
|
||||
A #GladeAddChildFunc to add children to instances in the runtime.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>remove-child-function</term>
|
||||
<listitem>
|
||||
<para>
|
||||
A #GladeRemoveChildFunc to remove children from instances in the runtime.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>replace-child-function</term>
|
||||
<listitem>
|
||||
<para>
|
||||
A #GladeReplaceChildFunc to replace children inside instances in the runtime.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>get-children-function</term>
|
||||
<listitem>
|
||||
<para>
|
||||
A #GladeGetChildrenFunc to get a list of children inside instances in the runtime.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>child-get-property-function</term>
|
||||
<listitem>
|
||||
<para>
|
||||
A #GladeChildGetPropertyFunc to get packing properties from instances in the runtime.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>child-set-property-function</term>
|
||||
<listitem>
|
||||
<para>
|
||||
A #GladeChildSetPropertyFunc to set packing properties on instances in the runtime.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>child-verify-function</term>
|
||||
<listitem>
|
||||
<para>
|
||||
A #GladeChildVerifyPropertyFunc to verify packing properties on instances in the runtime.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>get-internal-child-function</term>
|
||||
<listitem>
|
||||
<para>
|
||||
A #GladeGetInternalFunc to retrieve an internal child of a composite object in the runtime.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>action-activate-function</term>
|
||||
<listitem>
|
||||
<para>
|
||||
A #GladeActionActivateFunc to run a routine for a plugin defined #GladeWidgetAction.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>child-action-activate-function</term>
|
||||
<listitem>
|
||||
<para>
|
||||
A #GladeChildActionActivateFunc to run a routine for a plugin defined packing #GladeWidgetAction.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>read-widget-function</term>
|
||||
<listitem>
|
||||
<para>
|
||||
A #GladeReadWidgetFunc to load a widget from the xml.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>write-widget-function</term>
|
||||
<listitem>
|
||||
<para>
|
||||
A #GladeWriteWidgetFunc to write a widget from the xml.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>read-child-function</term>
|
||||
<listitem>
|
||||
<para>
|
||||
A #GladeReadWidgetFunc to read a child to the xml.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>write-child-function</term>
|
||||
<listitem>
|
||||
<para>
|
||||
A #GladeWriteWidgetFunc to write a child to the xml.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>create-editor-property-function</term>
|
||||
<listitem>
|
||||
<para>
|
||||
A #GladeCreateEPropFunc to create widgets to be used in Glade's property editor.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>string-from-value-function</term>
|
||||
<listitem>
|
||||
<para>
|
||||
A #GladeStringFromValueFunc to create a string from a #GValue, these strings must
|
||||
be unique and comparable for undo/redo to work properly.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>Action Definitions</title>
|
||||
<para>
|
||||
Actions are added under the `actions' and `packing-actions' tags, actions can also
|
||||
be nested so as to allow grouping in context menus, example:
|
||||
<programlisting>
|
||||
<![CDATA[...
|
||||
|
||||
<action id="manage_frobs" name="Manage Frobs">
|
||||
<action id="add_frob" name="Add" stock="gtk-add"/>
|
||||
<action id="remove_frob" name="Remove" stock="gtk-remove"/>
|
||||
</action>
|
||||
|
||||
...]]></programlisting>
|
||||
</para>
|
||||
<para>
|
||||
Here are the meanings of the `action' tag's properties:
|
||||
</para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term>id</term>
|
||||
<listitem>
|
||||
<para>
|
||||
The string identifier for this action, the action_path argument to your #GladeActionActivateFunc
|
||||
will be a combination if this id and any parents, for the above example:
|
||||
<literal>"manage_frobs/add_frob"</literal>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>name</term>
|
||||
<listitem>
|
||||
<para>
|
||||
A string to be displayed in the UI for this action.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>stock</term>
|
||||
<listitem>
|
||||
<para>
|
||||
An optional Gtk stock icon to represent this action.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>important</term>
|
||||
<listitem>
|
||||
<para>
|
||||
A boolean option to add emphasis to this action; currently actions marked as `important'
|
||||
are added to the toolbar.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>Packing Defaults</title>
|
||||
<para>
|
||||
Default values can be specified for packing properties on your widget when added
|
||||
to a said type of parent, as the example shows above; use the `parent-class' to
|
||||
specify what parent (or derivative of that parent) you are targeting and fill
|
||||
in any `child-property' tags you need for that parent using `id' property to
|
||||
specify the property name and the `default' property for the value.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>Signals</title>
|
||||
<para>
|
||||
The signal elements are currently only needed for versioning support, use
|
||||
the `signal' child tag as described above and set signal `id' to be supported
|
||||
since version `since'. Signals are initialized to be supported since the
|
||||
introducing #GladeWidgetAdaptor was supported.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>Icons</title>
|
||||
<para>
|
||||
The Glade palette and other components use icons to represent the various widget classes.
|
||||
It is a good idea to provide icons for your widget classes, as this
|
||||
enhances the user interface.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Glade uses the GTK+ GtkIconTheme facility to provide icons for widget classes. Any icon
|
||||
available in the current icon theme can be used as an icon for a widget class.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
By default, an icon name of the format "widget-CATALOG_NAME-GENERIC_NAME"
|
||||
is assigned to every widget class. CATALOG_NAME is the value of catalog name attribute,
|
||||
and GENERIC_NAME is the value of an widget class's generic name attribute.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
To explicitly set an icon name for a widget class, the "icon-name" attribute of the
|
||||
"glade-widget-class" element can be specified. This will override the default icon
|
||||
name assigned to the widget class.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Icon files can be installed under any system icon theme folder.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
10
glade-3.desktop.in
Normal file
@ -0,0 +1,10 @@
|
||||
[Desktop Entry]
|
||||
Encoding=UTF-8
|
||||
_Name=Glade 3.0 GUI builder
|
||||
_Comment=Design user interfaces
|
||||
Exec=glade-3 %F
|
||||
Terminal=false
|
||||
Type=Application
|
||||
Icon=glade-3.png
|
||||
Categories=Application;Development;
|
||||
MimeType=application/x-glade;
|
BIN
glade-3.png
Normal file
After Width: | Height: | Size: 5.0 KiB |
40
glade.doap
@ -1,40 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Project xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
|
||||
xmlns:foaf="http://xmlns.com/foaf/0.1/"
|
||||
xmlns:gnome="http://api.gnome.org/doap-extensions#"
|
||||
xmlns="http://usefulinc.com/ns/doap#">
|
||||
|
||||
<name xml:lang="en">Glade Interface Designer</name>
|
||||
<description>Glade is a RAD tool to enable quick and easy development of user interfaces for the GTK+ 3 toolkit and the GNOME desktop environment.</description>
|
||||
<shortdesc xml:lang="en">User Interface Builder for GTK+ applications</shortdesc>
|
||||
<homepage rdf:resource="http://glade.gnome.org/" />
|
||||
<developer-forum rdf:resource="https://discourse.gnome.org/tag/glade" />
|
||||
<download-page rdf:resource="https://download.gnome.org/sources/glade/" />
|
||||
<bug-database rdf:resource="https://gitlab.gnome.org/GNOME/glade/issues" />
|
||||
|
||||
<category rdf:resource="http://api.gnome.org/doap-extensions#apps" />
|
||||
<programming-language>C</programming-language>
|
||||
|
||||
<!-- <maintainer>
|
||||
<foaf:Person>
|
||||
<foaf:name>Tristan Van Berkom</foaf:name>
|
||||
<foaf:mbox rdf:resource="mailto:tristan.van.berkom@gmail.com" />
|
||||
<gnome:userid>tvb</gnome:userid>
|
||||
</foaf:Person>
|
||||
</maintainer> -->
|
||||
<maintainer>
|
||||
<foaf:Person>
|
||||
<foaf:name>Juan Pablo Ugarte</foaf:name>
|
||||
<foaf:mbox rdf:resource="mailto:juanpablougarte@gmail.com" />
|
||||
<gnome:userid>jpu</gnome:userid>
|
||||
</foaf:Person>
|
||||
</maintainer>
|
||||
<maintainer>
|
||||
<foaf:Person>
|
||||
<foaf:name>Alberto Fanjul Alonso</foaf:name>
|
||||
<foaf:mbox rdf:resource="mailto:albfan@gnome.org" />
|
||||
<gnome:userid>albfan</gnome:userid>
|
||||
</foaf:Person>
|
||||
</maintainer>
|
||||
</Project>
|
6
gladeui/.gitignore
vendored
@ -1,6 +0,0 @@
|
||||
/glade-marshallers.c
|
||||
/glade-marshallers.h
|
||||
/gladeui.rc
|
||||
|
||||
/glade-previewer
|
||||
/glade-previewer.rc
|
BIN
gladeui/atk.png
Before Width: | Height: | Size: 914 B |
@ -1,115 +0,0 @@
|
||||
/*
|
||||
* glade-clipboard.c - An object for handling Cut/Copy/Paste.
|
||||
*
|
||||
* Copyright (C) 2005 The GNOME Foundation.
|
||||
*
|
||||
* Author(s):
|
||||
* Tristan Van Berkom <tvb@gnome.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "glade-accumulators.h"
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
|
||||
gboolean
|
||||
_glade_single_object_accumulator (GSignalInvocationHint *ihint,
|
||||
GValue *return_accu,
|
||||
const GValue *handler_return,
|
||||
gpointer dummy)
|
||||
{
|
||||
GObject *object = g_value_get_object (handler_return);
|
||||
g_value_set_object (return_accu, object);
|
||||
|
||||
return (object == NULL);
|
||||
}
|
||||
|
||||
gboolean
|
||||
_glade_integer_handled_accumulator (GSignalInvocationHint *ihint,
|
||||
GValue *return_accu,
|
||||
const GValue *handler_return,
|
||||
gpointer dummy)
|
||||
{
|
||||
gboolean continue_emission;
|
||||
gint retval;
|
||||
|
||||
retval = g_value_get_int (handler_return);
|
||||
g_value_set_int (return_accu, retval >> 1);
|
||||
continue_emission = !(retval & 1);
|
||||
|
||||
return continue_emission;
|
||||
}
|
||||
|
||||
/* From gtkmain.c */
|
||||
gboolean
|
||||
_glade_boolean_handled_accumulator (GSignalInvocationHint *ihint,
|
||||
GValue *return_accu,
|
||||
const GValue *handler_return,
|
||||
gpointer dummy)
|
||||
{
|
||||
gboolean continue_emission;
|
||||
gboolean signal_handled;
|
||||
|
||||
signal_handled = g_value_get_boolean (handler_return);
|
||||
g_value_set_boolean (return_accu, signal_handled);
|
||||
continue_emission = !signal_handled;
|
||||
|
||||
return continue_emission;
|
||||
}
|
||||
|
||||
gboolean
|
||||
_glade_string_accumulator (GSignalInvocationHint *ihint,
|
||||
GValue *return_accu,
|
||||
const GValue *handler_return,
|
||||
gpointer dummy)
|
||||
{
|
||||
const gchar *handler_str;
|
||||
|
||||
g_free ((void *) g_value_get_string (return_accu));
|
||||
|
||||
handler_str = g_value_get_string (handler_return);
|
||||
g_value_set_string (return_accu, handler_str);
|
||||
|
||||
return (handler_str == NULL);
|
||||
}
|
||||
|
||||
gboolean
|
||||
_glade_strv_handled_accumulator (GSignalInvocationHint *ihint,
|
||||
GValue *return_accu,
|
||||
const GValue *handler_return, gpointer dummy)
|
||||
{
|
||||
const gchar **handler_strv;
|
||||
|
||||
handler_strv = g_value_get_boxed (handler_return);
|
||||
g_value_set_boxed (return_accu, handler_strv);
|
||||
|
||||
return (handler_strv == NULL);
|
||||
}
|
||||
|
||||
gboolean
|
||||
_glade_stop_emission_accumulator (GSignalInvocationHint *ihint,
|
||||
GValue *return_accu,
|
||||
const GValue *handler_return,
|
||||
gpointer dummy)
|
||||
{
|
||||
g_value_copy (handler_return, return_accu);
|
||||
|
||||
return FALSE;
|
||||
}
|
@ -1,63 +0,0 @@
|
||||
/*
|
||||
* glade-clipboard.h
|
||||
*
|
||||
* Copyright (C) 2005 The GNOME Foundation.
|
||||
*
|
||||
* Author(s):
|
||||
* Tristan Van Berkom <tvb@gnome.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*/
|
||||
|
||||
#ifndef __GLADE_ACCUMULATORS_H__
|
||||
#define __GLADE_ACCUMULATORS_H__
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
gboolean _glade_single_object_accumulator (GSignalInvocationHint *ihint,
|
||||
GValue *return_accu,
|
||||
const GValue *handler_return,
|
||||
gpointer dummy);
|
||||
|
||||
gboolean _glade_integer_handled_accumulator (GSignalInvocationHint *ihint,
|
||||
GValue *return_accu,
|
||||
const GValue *handler_return,
|
||||
gpointer dummy);
|
||||
|
||||
gboolean _glade_boolean_handled_accumulator (GSignalInvocationHint *ihint,
|
||||
GValue *return_accu,
|
||||
const GValue *handler_return,
|
||||
gpointer dummy);
|
||||
|
||||
gboolean _glade_string_accumulator (GSignalInvocationHint *ihint,
|
||||
GValue *return_accu,
|
||||
const GValue *handler_return,
|
||||
gpointer dummy);
|
||||
|
||||
gboolean _glade_strv_handled_accumulator (GSignalInvocationHint *ihint,
|
||||
GValue *return_accu,
|
||||
const GValue *handler_return,
|
||||
gpointer dummy);
|
||||
|
||||
gboolean _glade_stop_emission_accumulator (GSignalInvocationHint *ihint,
|
||||
GValue *return_accu,
|
||||
const GValue *handler_return,
|
||||
gpointer dummy);
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GLADE_ACCUMULATORS_H__ */
|
@ -1,650 +0,0 @@
|
||||
/*
|
||||
* glade-adaptor-chooser-widget.c
|
||||
*
|
||||
* Copyright (C) 2014-2017 Juan Pablo Ugarte
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Authors:
|
||||
* Juan Pablo Ugarte <juanpablougarte@gmail.com>
|
||||
*/
|
||||
|
||||
#include "glade-app.h"
|
||||
#include "glade-private.h"
|
||||
#include "gladeui-enum-types.h"
|
||||
#include "glade-adaptor-chooser-widget.h"
|
||||
#include "glade-dnd.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
enum
|
||||
{
|
||||
COLUMN_ADAPTOR = 0,
|
||||
COLUMN_GROUP,
|
||||
COLUMN_NORMALIZED_NAME,
|
||||
COLUMN_NORMALIZED_NAME_LEN,
|
||||
N_COLUMN
|
||||
};
|
||||
|
||||
typedef struct __GladeAdaptorChooserWidgetPrivate _GladeAdaptorChooserWidgetPrivate;
|
||||
struct __GladeAdaptorChooserWidgetPrivate
|
||||
{
|
||||
GtkTreeView *treeview;
|
||||
GtkListStore *store;
|
||||
GtkTreeModelFilter *treemodelfilter;
|
||||
GtkSearchEntry *searchentry;
|
||||
GtkEntryCompletion *entrycompletion;
|
||||
GtkScrolledWindow *scrolledwindow;
|
||||
|
||||
/* Needed for gtk_tree_view_column_set_cell_data_func() */
|
||||
GtkTreeViewColumn *column_icon;
|
||||
GtkCellRenderer *icon_cell;
|
||||
GtkTreeViewColumn *column_adaptor;
|
||||
GtkCellRenderer *adaptor_cell;
|
||||
|
||||
/* Properties */
|
||||
_GladeAdaptorChooserWidgetFlags flags;
|
||||
GladeProject *project;
|
||||
gboolean show_group_title;
|
||||
gchar *search_text;
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
|
||||
PROP_SHOW_FLAGS,
|
||||
PROP_PROJECT,
|
||||
PROP_SHOW_GROUP_TITLE
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
ADAPTOR_SELECTED,
|
||||
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
static guint adaptor_chooser_signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (_GladeAdaptorChooserWidget, _glade_adaptor_chooser_widget, GTK_TYPE_BOX)
|
||||
|
||||
#define GET_PRIVATE(d) ((_GladeAdaptorChooserWidgetPrivate *) _glade_adaptor_chooser_widget_get_instance_private((_GladeAdaptorChooserWidget*)d))
|
||||
|
||||
static void
|
||||
_glade_adaptor_chooser_widget_init (_GladeAdaptorChooserWidget *chooser)
|
||||
{
|
||||
gtk_widget_init_template (GTK_WIDGET (chooser));
|
||||
}
|
||||
|
||||
static void
|
||||
_glade_adaptor_chooser_widget_dispose (GObject *object)
|
||||
{
|
||||
_glade_adaptor_chooser_widget_set_project (GLADE_ADAPTOR_CHOOSER_WIDGET (object), NULL);
|
||||
|
||||
G_OBJECT_CLASS (_glade_adaptor_chooser_widget_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
_glade_adaptor_chooser_widget_finalize (GObject *object)
|
||||
{
|
||||
_GladeAdaptorChooserWidgetPrivate *priv = GET_PRIVATE (object);
|
||||
|
||||
g_clear_pointer (&priv->search_text, g_free);
|
||||
|
||||
G_OBJECT_CLASS (_glade_adaptor_chooser_widget_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
_glade_adaptor_chooser_widget_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
_GladeAdaptorChooserWidgetPrivate *priv;
|
||||
|
||||
g_return_if_fail (GLADE_IS_ADAPTOR_CHOOSER_WIDGET (object));
|
||||
|
||||
priv = GET_PRIVATE (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_SHOW_FLAGS:
|
||||
priv->flags = g_value_get_flags (value);
|
||||
break;
|
||||
case PROP_PROJECT:
|
||||
_glade_adaptor_chooser_widget_set_project (GLADE_ADAPTOR_CHOOSER_WIDGET (object),
|
||||
g_value_get_object (value));
|
||||
break;
|
||||
case PROP_SHOW_GROUP_TITLE:
|
||||
priv->show_group_title = g_value_get_boolean (value);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_glade_adaptor_chooser_widget_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
_GladeAdaptorChooserWidgetPrivate *priv;
|
||||
|
||||
g_return_if_fail (GLADE_IS_ADAPTOR_CHOOSER_WIDGET (object));
|
||||
|
||||
priv = GET_PRIVATE (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_SHOW_FLAGS:
|
||||
g_value_set_flags (value, priv->flags);
|
||||
break;
|
||||
case PROP_PROJECT:
|
||||
g_value_set_object (value, priv->project);
|
||||
break;
|
||||
case PROP_SHOW_GROUP_TITLE:
|
||||
g_value_set_boolean (value, priv->show_group_title);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static inline gchar *
|
||||
normalize_name (const gchar *name)
|
||||
{
|
||||
gchar *normalized_name = g_utf8_normalize (name, -1, G_NORMALIZE_DEFAULT);
|
||||
gchar *casefold_name = g_utf8_casefold (normalized_name, -1);
|
||||
g_free (normalized_name);
|
||||
return casefold_name;
|
||||
}
|
||||
|
||||
static inline void
|
||||
store_append_adaptor (GtkListStore *store, GladeWidgetAdaptor *adaptor)
|
||||
{
|
||||
gchar *normalized_name = normalize_name (glade_widget_adaptor_get_display_name (adaptor));
|
||||
|
||||
gtk_list_store_insert_with_values (store, NULL, -1,
|
||||
COLUMN_ADAPTOR, adaptor,
|
||||
COLUMN_NORMALIZED_NAME, normalized_name,
|
||||
COLUMN_NORMALIZED_NAME_LEN, strlen (normalized_name),
|
||||
-1);
|
||||
g_free (normalized_name);
|
||||
}
|
||||
|
||||
static void
|
||||
on_treeview_row_activated (GtkTreeView *tree_view,
|
||||
GtkTreePath *path,
|
||||
GtkTreeViewColumn *column,
|
||||
_GladeAdaptorChooserWidget *chooser)
|
||||
{
|
||||
GtkTreeModel *model = gtk_tree_view_get_model (tree_view);
|
||||
GtkTreeIter iter;
|
||||
|
||||
if (gtk_tree_model_get_iter (model, &iter, path))
|
||||
{
|
||||
GladeWidgetAdaptor *adaptor;
|
||||
|
||||
gtk_tree_model_get (model, &iter, COLUMN_ADAPTOR, &adaptor, -1);
|
||||
|
||||
if (!adaptor)
|
||||
return;
|
||||
|
||||
/* Emit selected signal */
|
||||
g_signal_emit (chooser, adaptor_chooser_signals[ADAPTOR_SELECTED], 0, adaptor);
|
||||
|
||||
g_object_unref (adaptor);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
on_searchentry_search_changed (GtkEntry *entry,
|
||||
_GladeAdaptorChooserWidget *chooser)
|
||||
{
|
||||
_GladeAdaptorChooserWidgetPrivate *priv = GET_PRIVATE (chooser);
|
||||
const gchar *text = gtk_entry_get_text (entry);
|
||||
|
||||
g_clear_pointer (&priv->search_text, g_free);
|
||||
|
||||
if (g_utf8_strlen (text, -1))
|
||||
priv->search_text = normalize_name (text);
|
||||
|
||||
gtk_tree_model_filter_refilter (priv->treemodelfilter);
|
||||
}
|
||||
|
||||
static void
|
||||
on_searchentry_activate (GtkEntry *entry, _GladeAdaptorChooserWidget *chooser)
|
||||
{
|
||||
_GladeAdaptorChooserWidgetPrivate *priv = GET_PRIVATE (chooser);
|
||||
const gchar *text = gtk_entry_get_text (entry);
|
||||
GladeWidgetAdaptor *adaptor;
|
||||
|
||||
/* try to find an adaptor by name */
|
||||
if (!(adaptor = glade_widget_adaptor_get_by_name (text)))
|
||||
{
|
||||
GtkTreeModel *model = GTK_TREE_MODEL (priv->treemodelfilter);
|
||||
gchar *normalized_name = normalize_name (text);
|
||||
GtkTreeIter iter;
|
||||
gboolean valid;
|
||||
gint count = 0;
|
||||
|
||||
valid = gtk_tree_model_get_iter_first (model, &iter);
|
||||
|
||||
/* we could not find it check if we can find it by normalized name */
|
||||
while (valid)
|
||||
{
|
||||
gchar *name;
|
||||
|
||||
gtk_tree_model_get (model, &iter, COLUMN_NORMALIZED_NAME, &name, -1);
|
||||
|
||||
if (g_strcmp0 (name, normalized_name) == 0)
|
||||
{
|
||||
gtk_tree_model_get (model, &iter, COLUMN_ADAPTOR, &adaptor, -1);
|
||||
g_free (name);
|
||||
break;
|
||||
}
|
||||
|
||||
valid = gtk_tree_model_iter_next (model, &iter);
|
||||
g_free (name);
|
||||
count++;
|
||||
}
|
||||
|
||||
/* if not, and there is only one row, then we select that one */
|
||||
if (!adaptor && count == 1 && gtk_tree_model_get_iter_first (model, &iter))
|
||||
gtk_tree_model_get (model, &iter, COLUMN_ADAPTOR, &adaptor, -1);
|
||||
|
||||
g_free (normalized_name);
|
||||
}
|
||||
|
||||
if (adaptor)
|
||||
g_signal_emit (chooser, adaptor_chooser_signals[ADAPTOR_SELECTED], 0, adaptor);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
chooser_match_func (_GladeAdaptorChooserWidget *chooser,
|
||||
GtkTreeModel *model,
|
||||
const gchar *key,
|
||||
GtkTreeIter *iter)
|
||||
{
|
||||
gboolean visible;
|
||||
gint name_len;
|
||||
gchar *name;
|
||||
|
||||
if (!key || *key == '\0')
|
||||
return TRUE;
|
||||
|
||||
gtk_tree_model_get (model, iter,
|
||||
COLUMN_NORMALIZED_NAME, &name,
|
||||
COLUMN_NORMALIZED_NAME_LEN, &name_len,
|
||||
-1);
|
||||
if (!name)
|
||||
return FALSE;
|
||||
|
||||
visible = (g_strstr_len (name, name_len, key) != NULL);
|
||||
g_free (name);
|
||||
|
||||
return visible;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
treemodelfilter_visible_func (GtkTreeModel *model, GtkTreeIter *iter, gpointer data)
|
||||
{
|
||||
_GladeAdaptorChooserWidgetPrivate *priv = GET_PRIVATE (data);
|
||||
GladeWidgetAdaptor *adaptor = NULL;
|
||||
gboolean visible = TRUE;
|
||||
|
||||
gtk_tree_model_get (model, iter, COLUMN_ADAPTOR, &adaptor, -1);
|
||||
|
||||
if (!adaptor)
|
||||
return priv->show_group_title && !priv->search_text;
|
||||
|
||||
/* Skip classes not available in project target version */
|
||||
if (priv->project)
|
||||
{
|
||||
const gchar *catalog = NULL;
|
||||
gint major, minor;
|
||||
|
||||
catalog = glade_widget_adaptor_get_catalog (adaptor);
|
||||
glade_project_get_target_version (priv->project, catalog, &major, &minor);
|
||||
|
||||
visible = GLADE_WIDGET_ADAPTOR_VERSION_CHECK (adaptor, major, minor);
|
||||
}
|
||||
|
||||
if (visible && priv->flags)
|
||||
{
|
||||
GType type = glade_widget_adaptor_get_object_type (adaptor);
|
||||
_GladeAdaptorChooserWidgetFlags flags = priv->flags;
|
||||
|
||||
/* Skip adaptors according to flags */
|
||||
if (flags & GLADE_ADAPTOR_CHOOSER_WIDGET_SKIP_DEPRECATED && GLADE_WIDGET_ADAPTOR_DEPRECATED (adaptor))
|
||||
visible = FALSE;
|
||||
else if (flags & GLADE_ADAPTOR_CHOOSER_WIDGET_SKIP_TOPLEVEL && GLADE_WIDGET_ADAPTOR_IS_TOPLEVEL (adaptor))
|
||||
visible = FALSE;
|
||||
else if (flags & GLADE_ADAPTOR_CHOOSER_WIDGET_WIDGET && !g_type_is_a (type, GTK_TYPE_WIDGET))
|
||||
visible = FALSE;
|
||||
else if (flags & GLADE_ADAPTOR_CHOOSER_WIDGET_TOPLEVEL && !GLADE_WIDGET_ADAPTOR_IS_TOPLEVEL (adaptor))
|
||||
visible = FALSE;
|
||||
}
|
||||
|
||||
if (visible && priv->search_text)
|
||||
visible = chooser_match_func (data, model, priv->search_text, iter);
|
||||
|
||||
g_clear_object (&adaptor);
|
||||
|
||||
return visible;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
entrycompletion_match_func (GtkEntryCompletion *entry, const gchar *key, GtkTreeIter *iter, gpointer data)
|
||||
{
|
||||
return chooser_match_func (data, gtk_entry_completion_get_model (entry), key, iter);
|
||||
}
|
||||
|
||||
static void
|
||||
adaptor_icon_cell_data_func (GtkTreeViewColumn *tree_column,
|
||||
GtkCellRenderer *cell,
|
||||
GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter,
|
||||
gpointer data)
|
||||
{
|
||||
GladeWidgetAdaptor *adaptor;
|
||||
gtk_tree_model_get (tree_model, iter, COLUMN_ADAPTOR, &adaptor, -1);
|
||||
|
||||
if (adaptor)
|
||||
g_object_set (cell, "sensitive", TRUE, "icon-name", glade_widget_adaptor_get_icon_name (adaptor), NULL);
|
||||
else
|
||||
g_object_set (cell, "sensitive", FALSE, "icon-name", "go-down-symbolic", NULL);
|
||||
|
||||
g_clear_object (&adaptor);
|
||||
}
|
||||
|
||||
static void
|
||||
adaptor_text_cell_data_func (GtkTreeViewColumn *tree_column,
|
||||
GtkCellRenderer *cell,
|
||||
GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter,
|
||||
gpointer data)
|
||||
{
|
||||
GladeWidgetAdaptor *adaptor;
|
||||
gchar *group;
|
||||
|
||||
gtk_tree_model_get (tree_model, iter,
|
||||
COLUMN_ADAPTOR, &adaptor,
|
||||
COLUMN_GROUP, &group,
|
||||
-1);
|
||||
if (adaptor)
|
||||
g_object_set (cell,
|
||||
"sensitive", TRUE,
|
||||
"text", glade_widget_adaptor_get_display_name (adaptor),
|
||||
"style", PANGO_STYLE_NORMAL,
|
||||
NULL);
|
||||
else
|
||||
g_object_set (cell,
|
||||
"sensitive", FALSE,
|
||||
"text", group,
|
||||
"style", PANGO_STYLE_ITALIC,
|
||||
NULL);
|
||||
|
||||
g_clear_object (&adaptor);
|
||||
g_free (group);
|
||||
}
|
||||
|
||||
static void
|
||||
glade_adaptor_chooser_widget_drag_begin (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
gpointer data)
|
||||
{
|
||||
GtkTreeSelection *selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (widget));
|
||||
GtkTreeModel *model;
|
||||
GtkTreeIter iter;
|
||||
|
||||
if (gtk_tree_selection_get_selected (selection, &model, &iter))
|
||||
{
|
||||
GladeWidgetAdaptor *adaptor;
|
||||
gtk_tree_model_get (model, &iter, COLUMN_ADAPTOR, &adaptor, -1);
|
||||
_glade_dnd_set_icon_widget (context,
|
||||
glade_widget_adaptor_get_icon_name (adaptor),
|
||||
glade_widget_adaptor_get_display_name (adaptor));
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
glade_adaptor_chooser_widget_drag_data_get (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GtkSelectionData *data,
|
||||
guint info,
|
||||
guint time,
|
||||
gpointer userdata)
|
||||
{
|
||||
GtkTreeSelection *selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (widget));
|
||||
GtkTreeModel *model;
|
||||
GtkTreeIter iter;
|
||||
|
||||
if (gtk_tree_selection_get_selected (selection, &model, &iter))
|
||||
{
|
||||
GladeWidgetAdaptor *adaptor;
|
||||
gtk_tree_model_get (model, &iter, COLUMN_ADAPTOR, &adaptor, -1);
|
||||
_glade_dnd_set_data (data, G_OBJECT (adaptor));
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_glade_adaptor_chooser_widget_constructed (GObject *object)
|
||||
{
|
||||
_GladeAdaptorChooserWidget *chooser = GLADE_ADAPTOR_CHOOSER_WIDGET (object);
|
||||
_GladeAdaptorChooserWidgetPrivate *priv = GET_PRIVATE (chooser);
|
||||
|
||||
/* Set cell data function: this save us from alocating name and icon name for each adaptor. */
|
||||
gtk_tree_view_column_set_cell_data_func (priv->column_icon,
|
||||
priv->icon_cell,
|
||||
adaptor_icon_cell_data_func,
|
||||
NULL, NULL);
|
||||
gtk_tree_view_column_set_cell_data_func (priv->column_adaptor,
|
||||
priv->adaptor_cell,
|
||||
adaptor_text_cell_data_func,
|
||||
NULL, NULL);
|
||||
/* Set tree model filter function */
|
||||
gtk_tree_model_filter_set_visible_func (priv->treemodelfilter,
|
||||
treemodelfilter_visible_func,
|
||||
chooser, NULL);
|
||||
/* Set completion match function */
|
||||
gtk_entry_completion_set_match_func (priv->entrycompletion,
|
||||
entrycompletion_match_func,
|
||||
chooser, NULL);
|
||||
/* Enable Drag & Drop */
|
||||
gtk_tree_view_enable_model_drag_source (priv->treeview, GDK_BUTTON1_MASK,
|
||||
_glade_dnd_get_target (), 1, GDK_ACTION_MOVE | GDK_ACTION_COPY);
|
||||
g_signal_connect_after (priv->treeview, "drag-begin",
|
||||
G_CALLBACK (glade_adaptor_chooser_widget_drag_begin),
|
||||
NULL);
|
||||
g_signal_connect (priv->treeview, "drag-data-get",
|
||||
G_CALLBACK (glade_adaptor_chooser_widget_drag_data_get),
|
||||
NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
_glade_adaptor_chooser_widget_map (GtkWidget *widget)
|
||||
{
|
||||
GtkWidget *toplevel = gtk_widget_get_toplevel (widget);
|
||||
|
||||
if (toplevel)
|
||||
{
|
||||
_GladeAdaptorChooserWidgetPrivate *priv = GET_PRIVATE (widget);
|
||||
gint height = gtk_widget_get_allocated_height (toplevel) - 100;
|
||||
|
||||
if (height > 512)
|
||||
height = height * 0.75;
|
||||
|
||||
gtk_scrolled_window_set_max_content_height (priv->scrolledwindow, height);
|
||||
}
|
||||
|
||||
GTK_WIDGET_CLASS (_glade_adaptor_chooser_widget_parent_class)->map (widget);
|
||||
}
|
||||
|
||||
static GType
|
||||
_glade_adaptor_chooser_widget_flags_get_type (void)
|
||||
{
|
||||
static GType etype = 0;
|
||||
if (G_UNLIKELY(etype == 0)) {
|
||||
static const GFlagsValue values[] = {
|
||||
{ GLADE_ADAPTOR_CHOOSER_WIDGET_WIDGET, "GLADE_ADAPTOR_CHOOSER_WIDGET_WIDGET", "widget" },
|
||||
{ GLADE_ADAPTOR_CHOOSER_WIDGET_TOPLEVEL, "GLADE_ADAPTOR_CHOOSER_WIDGET_TOPLEVEL", "toplevel" },
|
||||
{ GLADE_ADAPTOR_CHOOSER_WIDGET_SKIP_TOPLEVEL, "GLADE_ADAPTOR_CHOOSER_WIDGET_SKIP_TOPLEVEL", "skip-toplevel" },
|
||||
{ GLADE_ADAPTOR_CHOOSER_WIDGET_SKIP_DEPRECATED, "GLADE_ADAPTOR_CHOOSER_WIDGET_SKIP_DEPRECATED", "skip-deprecated" },
|
||||
{ 0, NULL, NULL }
|
||||
};
|
||||
etype = g_flags_register_static (g_intern_static_string ("_GladeAdaptorChooserWidgetFlag"), values);
|
||||
}
|
||||
return etype;
|
||||
}
|
||||
|
||||
static void
|
||||
_glade_adaptor_chooser_widget_class_init (_GladeAdaptorChooserWidgetClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
||||
|
||||
object_class->dispose = _glade_adaptor_chooser_widget_dispose;
|
||||
object_class->finalize = _glade_adaptor_chooser_widget_finalize;
|
||||
object_class->set_property = _glade_adaptor_chooser_widget_set_property;
|
||||
object_class->get_property = _glade_adaptor_chooser_widget_get_property;
|
||||
object_class->constructed = _glade_adaptor_chooser_widget_constructed;
|
||||
|
||||
widget_class->map = _glade_adaptor_chooser_widget_map;
|
||||
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_SHOW_FLAGS,
|
||||
g_param_spec_flags ("show-flags",
|
||||
"Show flags",
|
||||
"Widget adaptors show flags",
|
||||
_glade_adaptor_chooser_widget_flags_get_type (),
|
||||
0,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_SHOW_GROUP_TITLE,
|
||||
g_param_spec_boolean ("show-group-title",
|
||||
"Show group title",
|
||||
"Whether to show the group title",
|
||||
FALSE,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_PROJECT,
|
||||
g_param_spec_object ("project",
|
||||
"Glade Project",
|
||||
"If set, use project target version to skip unsupported classes",
|
||||
GLADE_TYPE_PROJECT,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
adaptor_chooser_signals[ADAPTOR_SELECTED] =
|
||||
g_signal_new ("adaptor-selected", G_OBJECT_CLASS_TYPE (klass), 0, 0,
|
||||
NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 1,
|
||||
GLADE_TYPE_WIDGET_ADAPTOR);
|
||||
|
||||
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/gladeui/glade-adaptor-chooser-widget.ui");
|
||||
gtk_widget_class_bind_template_child_private (widget_class, _GladeAdaptorChooserWidget, treeview);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, _GladeAdaptorChooserWidget, store);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, _GladeAdaptorChooserWidget, treemodelfilter);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, _GladeAdaptorChooserWidget, searchentry);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, _GladeAdaptorChooserWidget, entrycompletion);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, _GladeAdaptorChooserWidget, column_icon);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, _GladeAdaptorChooserWidget, icon_cell);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, _GladeAdaptorChooserWidget, column_adaptor);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, _GladeAdaptorChooserWidget, adaptor_cell);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, _GladeAdaptorChooserWidget, scrolledwindow);
|
||||
gtk_widget_class_bind_template_callback (widget_class, on_treeview_row_activated);
|
||||
gtk_widget_class_bind_template_callback (widget_class, on_searchentry_search_changed);
|
||||
gtk_widget_class_bind_template_callback (widget_class, on_searchentry_activate);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
_glade_adaptor_chooser_widget_new (_GladeAdaptorChooserWidgetFlags flags, GladeProject *project)
|
||||
{
|
||||
return GTK_WIDGET (g_object_new (GLADE_TYPE_ADAPTOR_CHOOSER_WIDGET,
|
||||
"show-flags", flags,
|
||||
"project", project,
|
||||
NULL));
|
||||
}
|
||||
|
||||
void
|
||||
_glade_adaptor_chooser_widget_set_project (_GladeAdaptorChooserWidget *chooser,
|
||||
GladeProject *project)
|
||||
{
|
||||
_GladeAdaptorChooserWidgetPrivate *priv;
|
||||
|
||||
g_return_if_fail (GLADE_IS_ADAPTOR_CHOOSER_WIDGET (chooser));
|
||||
priv = GET_PRIVATE (chooser);
|
||||
|
||||
if (priv->project)
|
||||
{
|
||||
g_object_remove_weak_pointer (G_OBJECT (priv->project), (gpointer *) &priv->project);
|
||||
priv->project = NULL;
|
||||
}
|
||||
|
||||
if (project)
|
||||
{
|
||||
priv->project = project;
|
||||
g_object_add_weak_pointer (G_OBJECT (project), (gpointer *) &priv->project);
|
||||
|
||||
gtk_tree_model_filter_refilter (priv->treemodelfilter);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
_glade_adaptor_chooser_widget_populate (_GladeAdaptorChooserWidget *chooser)
|
||||
{
|
||||
GList *l;
|
||||
|
||||
for (l = glade_app_get_catalogs (); l; l = g_list_next (l))
|
||||
_glade_adaptor_chooser_widget_add_catalog (chooser, l->data);
|
||||
}
|
||||
|
||||
void
|
||||
_glade_adaptor_chooser_widget_add_catalog (_GladeAdaptorChooserWidget *chooser,
|
||||
GladeCatalog *catalog)
|
||||
{
|
||||
GList *groups;
|
||||
|
||||
g_return_if_fail (GLADE_IS_ADAPTOR_CHOOSER_WIDGET (chooser));
|
||||
|
||||
for (groups = glade_catalog_get_widget_groups (catalog); groups;
|
||||
groups = g_list_next (groups))
|
||||
_glade_adaptor_chooser_widget_add_group (chooser, groups->data);
|
||||
}
|
||||
|
||||
void
|
||||
_glade_adaptor_chooser_widget_add_group (_GladeAdaptorChooserWidget *chooser,
|
||||
GladeWidgetGroup *group)
|
||||
{
|
||||
_GladeAdaptorChooserWidgetPrivate *priv;
|
||||
const GList *adaptors;
|
||||
|
||||
g_return_if_fail (GLADE_IS_ADAPTOR_CHOOSER_WIDGET (chooser));
|
||||
priv = GET_PRIVATE (chooser);
|
||||
|
||||
if (priv->show_group_title)
|
||||
gtk_list_store_insert_with_values (priv->store, NULL, -1,
|
||||
COLUMN_GROUP, glade_widget_group_get_title (group),
|
||||
-1);
|
||||
|
||||
for (adaptors = glade_widget_group_get_adaptors (group); adaptors;
|
||||
adaptors = g_list_next (adaptors))
|
||||
store_append_adaptor (priv->store, adaptors->data);
|
||||
}
|
||||
|
@ -1,64 +0,0 @@
|
||||
/*
|
||||
* glade-adaptor-chooser-widget.h
|
||||
*
|
||||
* Copyright (C) 2014-2017 Juan Pablo Ugarte
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Authors:
|
||||
* Juan Pablo Ugarte <juanpablougarte@gmail.com>
|
||||
*/
|
||||
|
||||
#ifndef _GLADE_ADAPTOR_CHOOSER_WIDGET_H_
|
||||
#define _GLADE_ADAPTOR_CHOOSER_WIDGET_H_
|
||||
|
||||
#include <gladeui/glade-widget-adaptor.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GLADE_TYPE_ADAPTOR_CHOOSER_WIDGET _glade_adaptor_chooser_widget_get_type ()
|
||||
G_DECLARE_DERIVABLE_TYPE (_GladeAdaptorChooserWidget, _glade_adaptor_chooser_widget, GLADE, ADAPTOR_CHOOSER_WIDGET, GtkBox)
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GLADE_ADAPTOR_CHOOSER_WIDGET_WIDGET = 1 << 0,
|
||||
GLADE_ADAPTOR_CHOOSER_WIDGET_TOPLEVEL = 1 << 1,
|
||||
GLADE_ADAPTOR_CHOOSER_WIDGET_SKIP_TOPLEVEL = 1 << 2,
|
||||
GLADE_ADAPTOR_CHOOSER_WIDGET_SKIP_DEPRECATED = 1 << 3
|
||||
} _GladeAdaptorChooserWidgetFlags;
|
||||
|
||||
struct __GladeAdaptorChooserWidgetClass
|
||||
{
|
||||
GtkBoxClass parent_class;
|
||||
};
|
||||
|
||||
GtkWidget *_glade_adaptor_chooser_widget_new (_GladeAdaptorChooserWidgetFlags flags,
|
||||
GladeProject *project);
|
||||
|
||||
void _glade_adaptor_chooser_widget_set_project (_GladeAdaptorChooserWidget *chooser,
|
||||
GladeProject *project);
|
||||
|
||||
void _glade_adaptor_chooser_widget_populate (_GladeAdaptorChooserWidget *chooser);
|
||||
|
||||
void _glade_adaptor_chooser_widget_add_catalog (_GladeAdaptorChooserWidget *chooser,
|
||||
GladeCatalog *catalog);
|
||||
|
||||
void _glade_adaptor_chooser_widget_add_group (_GladeAdaptorChooserWidget *chooser,
|
||||
GladeWidgetGroup *group);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* _GLADE_ADAPTOR_CHOOSER_WIDGET_H_ */
|
||||
|
@ -1,96 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generated with glade 3.21.0 -->
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.20"/>
|
||||
<object class="GtkListStore" id="store">
|
||||
<columns>
|
||||
<!-- column-name adaptor -->
|
||||
<column type="GObject"/>
|
||||
<!-- column-name group -->
|
||||
<column type="gchararray"/>
|
||||
<!-- column-name normalized-name -->
|
||||
<column type="gchararray"/>
|
||||
<!-- column-name normalized-name-len -->
|
||||
<column type="gint"/>
|
||||
</columns>
|
||||
</object>
|
||||
<object class="GtkTreeModelFilter" id="treemodelfilter">
|
||||
<property name="child_model">store</property>
|
||||
</object>
|
||||
<object class="GtkEntryCompletion" id="entrycompletion">
|
||||
<property name="model">treemodelfilter</property>
|
||||
<property name="text_column">1</property>
|
||||
<property name="inline_completion">True</property>
|
||||
<property name="popup_completion">False</property>
|
||||
<property name="popup_single_match">False</property>
|
||||
</object>
|
||||
<template class="_GladeAdaptorChooserWidget" parent="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="border_width">6</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkSearchEntry" id="searchentry">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="primary_icon_name">edit-find-symbolic</property>
|
||||
<property name="primary_icon_activatable">False</property>
|
||||
<property name="primary_icon_sensitive">False</property>
|
||||
<property name="completion">entrycompletion</property>
|
||||
<property name="input_hints">GTK_INPUT_HINT_WORD_COMPLETION | GTK_INPUT_HINT_NONE</property>
|
||||
<signal name="activate" handler="on_searchentry_activate" swapped="no"/>
|
||||
<signal name="search-changed" handler="on_searchentry_search_changed" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow" id="scrolledwindow">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="hscrollbar_policy">never</property>
|
||||
<property name="shadow_type">in</property>
|
||||
<property name="max_content_height">512</property>
|
||||
<property name="propagate_natural_width">True</property>
|
||||
<property name="propagate_natural_height">True</property>
|
||||
<child>
|
||||
<object class="GtkTreeView" id="treeview">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="model">treemodelfilter</property>
|
||||
<property name="headers_visible">False</property>
|
||||
<property name="enable_search">False</property>
|
||||
<property name="activate_on_single_click">True</property>
|
||||
<signal name="row-activated" handler="on_treeview_row_activated" swapped="no"/>
|
||||
<child internal-child="selection">
|
||||
<object class="GtkTreeSelection" id="treeview-selection"/>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkTreeViewColumn" id="column_icon">
|
||||
<child>
|
||||
<object class="GtkCellRendererPixbuf" id="icon_cell"/>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkTreeViewColumn" id="column_adaptor">
|
||||
<child>
|
||||
<object class="GtkCellRendererText" id="adaptor_cell"/>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</template>
|
||||
</interface>
|
@ -1,436 +0,0 @@
|
||||
/*
|
||||
* glade-adaptor-chooser.c
|
||||
*
|
||||
* Copyright (C) 2017 Juan Pablo Ugarte
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Authors:
|
||||
* Juan Pablo Ugarte <juanpablougarte@gmail.com>
|
||||
*/
|
||||
|
||||
#include "glade-adaptor-chooser-widget.h"
|
||||
#include "glade-adaptor-chooser.h"
|
||||
#include "glade-app.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GladeProject *project;
|
||||
|
||||
GtkWidget *gtk_button_box;
|
||||
GtkWidget *extra_button;
|
||||
GtkWidget *others_button;
|
||||
GtkImage *class_image;
|
||||
GtkLabel *class_label;
|
||||
GtkWidget *all_button;
|
||||
|
||||
GtkWidget *others_chooser;
|
||||
GtkWidget *all_chooser;
|
||||
GList *choosers;
|
||||
|
||||
gboolean needs_update;
|
||||
} GladeAdaptorChooserPrivate;
|
||||
|
||||
struct _GladeAdaptorChooser
|
||||
{
|
||||
GtkBox parent_instance;
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_PROJECT,
|
||||
|
||||
N_PROPERTIES
|
||||
};
|
||||
|
||||
static GParamSpec *properties[N_PROPERTIES];
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (GladeAdaptorChooser,
|
||||
glade_adaptor_chooser,
|
||||
GTK_TYPE_BOX);
|
||||
|
||||
#define GET_PRIVATE(d) ((GladeAdaptorChooserPrivate *) glade_adaptor_chooser_get_instance_private((GladeAdaptorChooser*)d))
|
||||
|
||||
static void
|
||||
glade_adaptor_chooser_init (GladeAdaptorChooser *chooser)
|
||||
{
|
||||
gtk_widget_init_template (GTK_WIDGET (chooser));
|
||||
}
|
||||
|
||||
static void
|
||||
glade_adaptor_chooser_finalize (GObject *object)
|
||||
{
|
||||
GladeAdaptorChooserPrivate *priv = GET_PRIVATE (object);
|
||||
|
||||
g_list_free (priv->choosers);
|
||||
|
||||
G_OBJECT_CLASS (glade_adaptor_chooser_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
glade_adaptor_chooser_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
g_return_if_fail (GLADE_IS_ADAPTOR_CHOOSER (object));
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_PROJECT:
|
||||
glade_adaptor_chooser_set_project (GLADE_ADAPTOR_CHOOSER (object),
|
||||
g_value_get_object (value));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
glade_adaptor_chooser_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GladeAdaptorChooserPrivate *priv;
|
||||
|
||||
g_return_if_fail (GLADE_IS_ADAPTOR_CHOOSER (object));
|
||||
priv = GET_PRIVATE (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_PROJECT:
|
||||
g_value_set_object (value, priv->project);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
on_adaptor_selected (GtkWidget *widget,
|
||||
GladeWidgetAdaptor *adaptor,
|
||||
GladeAdaptorChooser *chooser)
|
||||
{
|
||||
GladeAdaptorChooserPrivate *priv = GET_PRIVATE (chooser);
|
||||
|
||||
/* Auto-create toplevel types */
|
||||
if (GLADE_WIDGET_ADAPTOR_IS_TOPLEVEL (adaptor))
|
||||
{
|
||||
glade_command_create (adaptor, NULL, NULL, priv->project);
|
||||
}
|
||||
else
|
||||
{
|
||||
glade_project_set_add_item (priv->project, adaptor);
|
||||
glade_project_set_pointer_mode (priv->project, GLADE_POINTER_ADD_WIDGET);
|
||||
}
|
||||
|
||||
gtk_popover_popdown (GTK_POPOVER (gtk_widget_get_parent (widget)));
|
||||
}
|
||||
|
||||
static void
|
||||
glade_adaptor_chooser_button_add_chooser (GtkWidget *button, GtkWidget *chooser)
|
||||
{
|
||||
GtkPopover *popover = gtk_menu_button_get_popover (GTK_MENU_BUTTON (button));
|
||||
|
||||
if (!popover)
|
||||
{
|
||||
popover = GTK_POPOVER (gtk_popover_new (button));
|
||||
gtk_menu_button_set_popover (GTK_MENU_BUTTON (button),
|
||||
GTK_WIDGET (popover));
|
||||
}
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (popover), chooser);
|
||||
gtk_widget_show (chooser);
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
glade_adaptor_chooser_add_chooser (GladeAdaptorChooser *chooser,
|
||||
gboolean show_group_title)
|
||||
{
|
||||
GladeAdaptorChooserPrivate *priv = GET_PRIVATE (chooser);
|
||||
GtkWidget *chooser_widget = g_object_new (GLADE_TYPE_ADAPTOR_CHOOSER_WIDGET,
|
||||
"show-group-title", show_group_title,
|
||||
NULL);
|
||||
|
||||
priv->choosers = g_list_prepend (priv->choosers, chooser_widget);
|
||||
g_signal_connect (chooser_widget, "adaptor-selected",
|
||||
G_CALLBACK (on_adaptor_selected),
|
||||
chooser);
|
||||
|
||||
return chooser_widget;
|
||||
}
|
||||
|
||||
static void
|
||||
button_box_populate_from_catalog (GladeAdaptorChooser *chooser,
|
||||
GladeCatalog *catalog)
|
||||
{
|
||||
GladeAdaptorChooserPrivate *priv = GET_PRIVATE (chooser);
|
||||
GtkWidget *extra_chooser = NULL;
|
||||
GList *groups;
|
||||
|
||||
groups = glade_catalog_get_widget_groups (catalog);
|
||||
gtk_box_set_homogeneous (GTK_BOX (priv->gtk_button_box), FALSE);
|
||||
|
||||
for (; groups; groups = g_list_next (groups))
|
||||
{
|
||||
GladeWidgetGroup *group = GLADE_WIDGET_GROUP (groups->data);
|
||||
|
||||
if (!glade_widget_group_get_adaptors (group))
|
||||
continue;
|
||||
|
||||
if (glade_widget_group_get_expanded (group))
|
||||
{
|
||||
GtkWidget *button, *chooser_widget;
|
||||
|
||||
chooser_widget = glade_adaptor_chooser_add_chooser (chooser, FALSE);
|
||||
button = gtk_menu_button_new ();
|
||||
gtk_button_set_label (GTK_BUTTON (button), glade_widget_group_get_title (group));
|
||||
glade_adaptor_chooser_button_add_chooser (button, chooser_widget);
|
||||
_glade_adaptor_chooser_widget_add_group (GLADE_ADAPTOR_CHOOSER_WIDGET (chooser_widget), group);
|
||||
gtk_box_pack_start (GTK_BOX (priv->gtk_button_box), button, FALSE, FALSE, 0);
|
||||
gtk_widget_show (button);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!extra_chooser)
|
||||
{
|
||||
extra_chooser = glade_adaptor_chooser_add_chooser (chooser, TRUE);
|
||||
glade_adaptor_chooser_button_add_chooser (priv->extra_button, extra_chooser);
|
||||
gtk_widget_show (priv->extra_button);
|
||||
}
|
||||
|
||||
_glade_adaptor_chooser_widget_add_group (GLADE_ADAPTOR_CHOOSER_WIDGET (extra_chooser), group);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
remove_chooser_widget (GladeAdaptorChooser *chooser, GtkWidget *widget)
|
||||
{
|
||||
if (widget)
|
||||
{
|
||||
GladeAdaptorChooserPrivate *priv = GET_PRIVATE (chooser);
|
||||
priv->choosers = g_list_remove (priv->choosers, widget);
|
||||
gtk_widget_destroy (widget);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
update_all_others_chooser (GladeAdaptorChooser *chooser)
|
||||
{
|
||||
GladeAdaptorChooserPrivate *priv = GET_PRIVATE (chooser);
|
||||
GladeCatalog *gtk_catalog;
|
||||
GList *l;
|
||||
|
||||
priv->needs_update = FALSE;
|
||||
|
||||
gtk_catalog = glade_app_get_catalog ("gtk+");
|
||||
|
||||
remove_chooser_widget (chooser, priv->others_chooser);
|
||||
remove_chooser_widget (chooser, priv->all_chooser);
|
||||
|
||||
priv->others_chooser = glade_adaptor_chooser_add_chooser (chooser, TRUE);
|
||||
priv->all_chooser = glade_adaptor_chooser_add_chooser (chooser, TRUE);
|
||||
|
||||
glade_adaptor_chooser_button_add_chooser (priv->others_button, priv->others_chooser);
|
||||
glade_adaptor_chooser_button_add_chooser (priv->all_button, priv->all_chooser);
|
||||
|
||||
/* then the rest */
|
||||
for (l = glade_app_get_catalogs (); l; l = g_list_next (l))
|
||||
{
|
||||
GladeCatalog *catalog = l->data;
|
||||
|
||||
_glade_adaptor_chooser_widget_add_catalog (GLADE_ADAPTOR_CHOOSER_WIDGET (priv->all_chooser), catalog);
|
||||
|
||||
if (catalog != gtk_catalog)
|
||||
_glade_adaptor_chooser_widget_add_catalog (GLADE_ADAPTOR_CHOOSER_WIDGET (priv->others_chooser), catalog);
|
||||
}
|
||||
|
||||
_glade_adaptor_chooser_widget_set_project (GLADE_ADAPTOR_CHOOSER_WIDGET (priv->others_chooser), priv->project);
|
||||
_glade_adaptor_chooser_widget_set_project (GLADE_ADAPTOR_CHOOSER_WIDGET (priv->all_chooser), priv->project);
|
||||
}
|
||||
|
||||
static void
|
||||
on_widget_adaptor_registered (GladeApp *app,
|
||||
GladeWidgetAdaptor *adaptor,
|
||||
GladeAdaptorChooser *chooser)
|
||||
{
|
||||
GladeAdaptorChooserPrivate *priv = GET_PRIVATE (chooser);
|
||||
priv->needs_update = TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
on_button_clicked (GtkButton *button, GladeAdaptorChooser *chooser)
|
||||
{
|
||||
GladeAdaptorChooserPrivate *priv = GET_PRIVATE (chooser);
|
||||
|
||||
if (priv->needs_update)
|
||||
update_all_others_chooser (chooser);
|
||||
}
|
||||
|
||||
static void
|
||||
glade_adaptor_chooser_constructed (GObject *object)
|
||||
{
|
||||
GladeAdaptorChooser *chooser = GLADE_ADAPTOR_CHOOSER (object);
|
||||
GladeAdaptorChooserPrivate *priv = GET_PRIVATE (chooser);
|
||||
GladeCatalog *gtk_catalog;
|
||||
|
||||
/* GTK+ catalog goes first subdivided by group */
|
||||
gtk_catalog = glade_app_get_catalog ("gtk+");
|
||||
button_box_populate_from_catalog (chooser, gtk_catalog);
|
||||
|
||||
update_all_others_chooser (chooser);
|
||||
|
||||
g_signal_connect (glade_app_get(), "widget-adaptor-registered",
|
||||
G_CALLBACK (on_widget_adaptor_registered),
|
||||
chooser);
|
||||
|
||||
g_signal_connect (priv->others_button, "clicked",
|
||||
G_CALLBACK (on_button_clicked),
|
||||
chooser);
|
||||
g_signal_connect (priv->all_button, "clicked",
|
||||
G_CALLBACK (on_button_clicked),
|
||||
chooser);
|
||||
}
|
||||
|
||||
static void
|
||||
glade_adaptor_chooser_class_init (GladeAdaptorChooserClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
||||
|
||||
object_class->finalize = glade_adaptor_chooser_finalize;
|
||||
object_class->constructed = glade_adaptor_chooser_constructed;
|
||||
object_class->set_property = glade_adaptor_chooser_set_property;
|
||||
object_class->get_property = glade_adaptor_chooser_get_property;
|
||||
|
||||
/* Properties */
|
||||
properties[PROP_PROJECT] =
|
||||
g_param_spec_object ("project", "Project",
|
||||
"This adaptor chooser's current project",
|
||||
GLADE_TYPE_PROJECT,
|
||||
G_PARAM_READWRITE);
|
||||
|
||||
g_object_class_install_properties (object_class, N_PROPERTIES, properties);
|
||||
|
||||
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/gladeui/glade-adaptor-chooser.ui");
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GladeAdaptorChooser, gtk_button_box);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GladeAdaptorChooser, extra_button);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GladeAdaptorChooser, others_button);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GladeAdaptorChooser, class_image);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GladeAdaptorChooser, class_label);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GladeAdaptorChooser, all_button);
|
||||
}
|
||||
|
||||
/* Public API */
|
||||
|
||||
/**
|
||||
* glade_adaptor_chooser_new:
|
||||
*
|
||||
* Returns: (transfer full): A new #GladeAdaptorChooser
|
||||
*/
|
||||
GtkWidget *
|
||||
glade_adaptor_chooser_new ()
|
||||
{
|
||||
return (GtkWidget*) g_object_new (GLADE_TYPE_ADAPTOR_CHOOSER, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
glade_adaptor_chooser_update_adaptor (GladeAdaptorChooser *chooser)
|
||||
{
|
||||
GladeAdaptorChooserPrivate *priv = GET_PRIVATE (chooser);
|
||||
GladeWidgetAdaptor *adaptor;
|
||||
|
||||
if (priv->project && (adaptor = glade_project_get_add_item (priv->project)))
|
||||
{
|
||||
gtk_image_set_from_icon_name (priv->class_image,
|
||||
glade_widget_adaptor_get_icon_name (adaptor),
|
||||
GTK_ICON_SIZE_BUTTON);
|
||||
gtk_label_set_label (priv->class_label,
|
||||
glade_widget_adaptor_get_display_name (adaptor));
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_image_set_from_pixbuf (priv->class_image, NULL);
|
||||
gtk_label_set_label (priv->class_label, "");
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
on_project_weak_notify (gpointer data, GObject *project)
|
||||
{
|
||||
GladeAdaptorChooser *chooser = data;
|
||||
GladeAdaptorChooserPrivate *priv = GET_PRIVATE (chooser);
|
||||
|
||||
priv->project = NULL;
|
||||
}
|
||||
|
||||
void
|
||||
glade_adaptor_chooser_set_project (GladeAdaptorChooser *chooser,
|
||||
GladeProject *project)
|
||||
{
|
||||
GladeAdaptorChooserPrivate *priv;
|
||||
GList *l;
|
||||
|
||||
g_return_if_fail (GLADE_IS_ADAPTOR_CHOOSER (chooser));
|
||||
priv = GET_PRIVATE (chooser);
|
||||
|
||||
if (priv->project)
|
||||
{
|
||||
g_signal_handlers_disconnect_by_func (G_OBJECT (priv->project),
|
||||
G_CALLBACK (glade_adaptor_chooser_update_adaptor),
|
||||
chooser);
|
||||
g_object_weak_unref (G_OBJECT (priv->project), on_project_weak_notify, chooser);
|
||||
priv->project = NULL;
|
||||
}
|
||||
|
||||
if (project)
|
||||
{
|
||||
priv->project = project;
|
||||
g_object_weak_ref (G_OBJECT (project), on_project_weak_notify, chooser);
|
||||
|
||||
g_signal_connect_swapped (G_OBJECT (project), "notify::add-item",
|
||||
G_CALLBACK (glade_adaptor_chooser_update_adaptor),
|
||||
chooser);
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (chooser), TRUE);
|
||||
}
|
||||
else
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (chooser), FALSE);
|
||||
|
||||
/* Set project in chooser for filter to work */
|
||||
for (l = priv->choosers; l; l = g_list_next (l))
|
||||
_glade_adaptor_chooser_widget_set_project (l->data, project);
|
||||
|
||||
/* Update class image and label */
|
||||
glade_adaptor_chooser_update_adaptor (chooser);
|
||||
}
|
||||
|
||||
/**
|
||||
* glade_adaptor_chooser_get_project:
|
||||
* @chooser: a #GladeAdaptorChooser
|
||||
*
|
||||
* Returns: (transfer full): A #GladeProject
|
||||
*/
|
||||
GladeProject *
|
||||
glade_adaptor_chooser_get_project (GladeAdaptorChooser *chooser)
|
||||
{
|
||||
g_return_val_if_fail (GLADE_IS_ADAPTOR_CHOOSER (chooser), NULL);
|
||||
|
||||
return GET_PRIVATE (chooser)->project;
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
/*
|
||||
* glade-adaptor-chooser.h
|
||||
*
|
||||
* Copyright (C) 2017 Juan Pablo Ugarte
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Authors:
|
||||
* Juan Pablo Ugarte <juanpablougarte@gmail.com>
|
||||
*/
|
||||
|
||||
#ifndef _GLADE_ADAPTOR_CHOOSER_H_
|
||||
#define _GLADE_ADAPTOR_CHOOSER_H_
|
||||
|
||||
#include <gladeui/glade-widget-adaptor.h>
|
||||
#include <gladeui/glade-project.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GLADE_TYPE_ADAPTOR_CHOOSER (glade_adaptor_chooser_get_type ())
|
||||
G_DECLARE_FINAL_TYPE (GladeAdaptorChooser, glade_adaptor_chooser, GLADE, ADAPTOR_CHOOSER, GtkBox)
|
||||
|
||||
GtkWidget *glade_adaptor_chooser_new (void);
|
||||
|
||||
void glade_adaptor_chooser_set_project (GladeAdaptorChooser *chooser,
|
||||
GladeProject *project);
|
||||
GladeProject *glade_adaptor_chooser_get_project (GladeAdaptorChooser *chooser);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* _GLADE_ADAPTOR_CHOOSER_H_ */
|
@ -1,114 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generated with glade 3.20.0 -->
|
||||
<interface domain="glade">
|
||||
<requires lib="gtk+" version="3.20"/>
|
||||
<template class="GladeAdaptorChooser" parent="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">4</property>
|
||||
<child>
|
||||
<object class="GtkMenuButton" id="all_button">
|
||||
<property name="name">adaptor-search-button</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="tooltip_text" translatable="yes">All available widgets and objects</property>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="icon_name">edit-find-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkImage" id="class_image">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="class_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="tooltip_text" translatable="yes">Click on a placeholder to create this class
|
||||
(use middle button to create more than one)</property>
|
||||
<property name="ellipsize">end</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkMenuButton" id="others_button">
|
||||
<property name="name">adaptor-others-button</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="tooltip_text" translatable="yes">Non-GTK+ widgets and objects</property>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="icon_name">view-more-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="pack_type">end</property>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButtonBox" id="gtk_button_box">
|
||||
<property name="name">adaptor-gtk-buttonbox</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="layout_style">expand</property>
|
||||
<child>
|
||||
<object class="GtkMenuButton" id="extra_button">
|
||||
<property name="name">adaptor-extra-button</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="tooltip_text" translatable="yes">Extra GTK+ objects</property>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="icon_name">pan-down-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="pack_type">end</property>
|
||||
<property name="position">2</property>
|
||||
<property name="non_homogeneous">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="pack_type">end</property>
|
||||
<property name="position">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
</template>
|
||||
</interface>
|
@ -1,970 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2001 Ximian, Inc.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Authors:
|
||||
* Naba Kumar <naba@gnome.org>
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
/**
|
||||
* SECTION:glade-app
|
||||
* @Short_Description: The central control point of the Glade core.
|
||||
*
|
||||
* This main control object is where we try to draw the line between
|
||||
* what is the Glade core and what is the main application. The main
|
||||
* application must derive from the GladeApp object and create an instance
|
||||
* to initialize the Glade core.
|
||||
*/
|
||||
|
||||
#include "glade.h"
|
||||
#include "glade-debug.h"
|
||||
#include "glade-cursor.h"
|
||||
#include "glade-catalog.h"
|
||||
#include "glade-design-view.h"
|
||||
#include "glade-design-layout.h"
|
||||
#include "glade-marshallers.h"
|
||||
#include "glade-accumulators.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <glib.h>
|
||||
#include <glib/gstdio.h>
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#ifdef MAC_BUNDLE
|
||||
# include <gtkosxapplication.h>
|
||||
#endif
|
||||
|
||||
#define GLADE_CONFIG_FILENAME "glade.conf"
|
||||
|
||||
enum
|
||||
{
|
||||
DOC_SEARCH,
|
||||
SIGNAL_EDITOR_CREATED,
|
||||
WIDGET_ADAPTOR_REGISTERED,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
typedef struct _GladeAppPrivate GladeAppPrivate;
|
||||
struct _GladeAppPrivate
|
||||
{
|
||||
GtkWidget *window;
|
||||
|
||||
GladeClipboard *clipboard; /* See glade-clipboard */
|
||||
GList *catalogs; /* See glade-catalog */
|
||||
|
||||
GList *projects; /* The list of Projects */
|
||||
|
||||
GKeyFile *config; /* The configuration file */
|
||||
|
||||
GtkAccelGroup *accel_group; /* Default acceleration group for this app */
|
||||
};
|
||||
|
||||
static guint glade_app_signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
/* installation paths */
|
||||
static gchar *catalogs_dir = NULL;
|
||||
static gchar *modules_dir = NULL;
|
||||
static gchar *pixmaps_dir = NULL;
|
||||
static gchar *locale_dir = NULL;
|
||||
static gchar *bin_dir = NULL;
|
||||
static gchar *lib_dir = NULL;
|
||||
|
||||
static GladeApp *singleton_app = NULL;
|
||||
static gboolean check_initialised = FALSE;
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (GladeApp, glade_app, G_TYPE_OBJECT);
|
||||
|
||||
/*****************************************************************
|
||||
* GObjectClass *
|
||||
*****************************************************************/
|
||||
static GObject *
|
||||
glade_app_constructor (GType type,
|
||||
guint n_construct_properties,
|
||||
GObjectConstructParam *construct_properties)
|
||||
{
|
||||
GObject *object;
|
||||
|
||||
/* singleton */
|
||||
if (!singleton_app)
|
||||
{
|
||||
object = G_OBJECT_CLASS (glade_app_parent_class)->constructor (type,
|
||||
n_construct_properties,
|
||||
construct_properties);
|
||||
singleton_app = GLADE_APP (object);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_object_ref (singleton_app);
|
||||
}
|
||||
|
||||
return G_OBJECT (singleton_app);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
glade_app_dispose (GObject *app)
|
||||
{
|
||||
GladeAppPrivate *priv = glade_app_get_instance_private ((GladeApp *) app);
|
||||
|
||||
if (priv->clipboard)
|
||||
{
|
||||
g_object_unref (priv->clipboard);
|
||||
priv->clipboard = NULL;
|
||||
}
|
||||
/* FIXME: Remove projects */
|
||||
|
||||
if (priv->config)
|
||||
{
|
||||
g_key_file_free (priv->config);
|
||||
priv->config = NULL;
|
||||
}
|
||||
|
||||
G_OBJECT_CLASS (glade_app_parent_class)->dispose (app);
|
||||
}
|
||||
|
||||
static void
|
||||
glade_app_finalize (GObject *app)
|
||||
{
|
||||
g_free (catalogs_dir);
|
||||
g_free (modules_dir);
|
||||
g_free (pixmaps_dir);
|
||||
g_free (locale_dir);
|
||||
g_free (bin_dir);
|
||||
g_free (lib_dir);
|
||||
|
||||
singleton_app = NULL;
|
||||
check_initialised = FALSE;
|
||||
|
||||
G_OBJECT_CLASS (glade_app_parent_class)->finalize (app);
|
||||
}
|
||||
|
||||
/* build package paths at runtime */
|
||||
static void
|
||||
build_package_paths (void)
|
||||
{
|
||||
const gchar *path;
|
||||
|
||||
path = g_getenv (GLADE_ENV_PIXMAP_DIR);
|
||||
if (path)
|
||||
pixmaps_dir = g_strdup (path);
|
||||
|
||||
#if defined (G_OS_WIN32) || defined (MAC_BUNDLE)
|
||||
gchar *prefix;
|
||||
|
||||
# ifdef G_OS_WIN32
|
||||
prefix = g_win32_get_package_installation_directory_of_module (NULL);
|
||||
|
||||
# else // defined (MAC_BUNDLE)
|
||||
prefix = quartz_application_get_resource_path ();
|
||||
|
||||
# endif
|
||||
|
||||
if (!pixmaps_dir)
|
||||
pixmaps_dir = g_build_filename (prefix, "share", PACKAGE_NAME, "pixmaps", NULL);
|
||||
|
||||
catalogs_dir = g_build_filename (prefix, "share", PACKAGE_NAME, "catalogs", NULL);
|
||||
modules_dir = g_build_filename (prefix, "lib", PACKAGE_NAME, "modules", NULL);
|
||||
locale_dir = g_build_filename (prefix, "share", "locale", NULL);
|
||||
bin_dir = g_build_filename (prefix, "bin", NULL);
|
||||
lib_dir = g_build_filename (prefix, "lib", NULL);
|
||||
|
||||
g_free (prefix);
|
||||
#else
|
||||
catalogs_dir = g_strdup (GLADE_CATALOGSDIR);
|
||||
modules_dir = g_strdup (GLADE_MODULESDIR);
|
||||
|
||||
if (!pixmaps_dir)
|
||||
pixmaps_dir = g_strdup (GLADE_PIXMAPSDIR);
|
||||
locale_dir = g_strdup (GLADE_LOCALEDIR);
|
||||
bin_dir = g_strdup (GLADE_BINDIR);
|
||||
lib_dir = g_strdup (GLADE_LIBDIR);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* initialization function for libgladeui (not GladeApp) */
|
||||
static void
|
||||
glade_init_check (void)
|
||||
{
|
||||
if (check_initialised)
|
||||
return;
|
||||
|
||||
glade_init_debug_flags ();
|
||||
|
||||
/* Make sure path accessors work on osx */
|
||||
build_package_paths ();
|
||||
|
||||
bindtextdomain (GETTEXT_PACKAGE, locale_dir);
|
||||
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
|
||||
|
||||
check_initialised = TRUE;
|
||||
}
|
||||
|
||||
/*****************************************************************
|
||||
* GladeAppClass *
|
||||
*****************************************************************/
|
||||
const gchar *
|
||||
glade_app_get_catalogs_dir (void)
|
||||
{
|
||||
glade_init_check ();
|
||||
|
||||
return catalogs_dir;
|
||||
}
|
||||
|
||||
const gchar *
|
||||
glade_app_get_modules_dir (void)
|
||||
{
|
||||
glade_init_check ();
|
||||
|
||||
return modules_dir;
|
||||
}
|
||||
|
||||
const gchar *
|
||||
glade_app_get_pixmaps_dir (void)
|
||||
{
|
||||
glade_init_check ();
|
||||
|
||||
return pixmaps_dir;
|
||||
}
|
||||
|
||||
const gchar *
|
||||
glade_app_get_locale_dir (void)
|
||||
{
|
||||
glade_init_check ();
|
||||
|
||||
return locale_dir;
|
||||
}
|
||||
|
||||
const gchar *
|
||||
glade_app_get_bin_dir (void)
|
||||
{
|
||||
glade_init_check ();
|
||||
|
||||
return bin_dir;
|
||||
}
|
||||
|
||||
const gchar *
|
||||
glade_app_get_lib_dir (void)
|
||||
{
|
||||
glade_init_check ();
|
||||
|
||||
return lib_dir;
|
||||
}
|
||||
|
||||
static void
|
||||
pointer_mode_register_icon (const gchar *icon_name,
|
||||
gint real_size,
|
||||
GladePointerMode mode,
|
||||
GtkIconSize size)
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
|
||||
if ((pixbuf = glade_utils_pointer_mode_render_icon (mode, size)))
|
||||
{
|
||||
gtk_icon_theme_add_builtin_icon (icon_name, real_size, pixbuf);
|
||||
g_object_unref (pixbuf);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
register_icon (const gchar *new_icon_name,
|
||||
gint size,
|
||||
const gchar *icon_name,
|
||||
const gchar *file_name)
|
||||
{
|
||||
GtkIconTheme *icon_theme = gtk_icon_theme_get_default ();
|
||||
GdkPixbuf *pixbuf;
|
||||
GtkIconInfo *info;
|
||||
|
||||
if ((info = gtk_icon_theme_lookup_icon (icon_theme, icon_name, size, 0)))
|
||||
{
|
||||
pixbuf = gtk_icon_info_load_icon (info, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
gchar *path = g_build_filename (glade_app_get_pixmaps_dir (), file_name, NULL);
|
||||
pixbuf = gdk_pixbuf_new_from_file (path, NULL);
|
||||
g_free (path);
|
||||
}
|
||||
|
||||
if (pixbuf)
|
||||
{
|
||||
gtk_icon_theme_add_builtin_icon (new_icon_name, size, pixbuf);
|
||||
g_object_unref (pixbuf);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* glade_app_register_icon_names:
|
||||
* @size: icon size
|
||||
*
|
||||
* Register a new icon name for most of GladePointerMode.
|
||||
* After calling this function "glade-selector", "glade-drag-resize",
|
||||
* "glade-margin-edit" and "glade-align-edit" icon names will be available.
|
||||
*/
|
||||
static void
|
||||
glade_app_register_icon_names (GtkIconSize size)
|
||||
{
|
||||
gint w, h, real_size;
|
||||
|
||||
if (gtk_icon_size_lookup (size, &w, &h) == FALSE)
|
||||
return;
|
||||
|
||||
real_size = MIN (w, h);
|
||||
|
||||
pointer_mode_register_icon ("glade-selector", real_size, GLADE_POINTER_SELECT, size);
|
||||
pointer_mode_register_icon ("glade-drag-resize", real_size, GLADE_POINTER_DRAG_RESIZE, size);
|
||||
pointer_mode_register_icon ("glade-margin-edit", real_size, GLADE_POINTER_MARGIN_EDIT, size);
|
||||
pointer_mode_register_icon ("glade-align-edit", real_size, GLADE_POINTER_ALIGN_EDIT, size);
|
||||
|
||||
register_icon ("glade-devhelp", real_size,
|
||||
GLADE_DEVHELP_ICON_NAME,
|
||||
GLADE_DEVHELP_FALLBACK_ICON_FILE);
|
||||
}
|
||||
|
||||
/**
|
||||
* glade_init:
|
||||
*
|
||||
* Initialization function for libgladeui (not #GladeApp)
|
||||
* It builds paths, bind text domain, and register icons
|
||||
*/
|
||||
void
|
||||
glade_init (void)
|
||||
{
|
||||
static gboolean init = FALSE;
|
||||
|
||||
if (init) return;
|
||||
|
||||
glade_init_check ();
|
||||
|
||||
/* Register icons needed by the UI */
|
||||
glade_app_register_icon_names (GTK_ICON_SIZE_LARGE_TOOLBAR);
|
||||
|
||||
init = TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
glade_app_init (GladeApp *app)
|
||||
{
|
||||
static gboolean initialized = FALSE;
|
||||
GladeAppPrivate *priv = glade_app_get_instance_private (app);
|
||||
|
||||
singleton_app = app;
|
||||
|
||||
glade_init ();
|
||||
|
||||
if (!initialized)
|
||||
{
|
||||
GtkIconTheme *default_icon_theme = gtk_icon_theme_get_default ();
|
||||
const gchar *path;
|
||||
|
||||
gtk_icon_theme_append_search_path (default_icon_theme, pixmaps_dir);
|
||||
|
||||
/* Handle extra icon theme paths. Needed for tests to work */
|
||||
if ((path = g_getenv (GLADE_ENV_ICON_THEME_PATH)))
|
||||
{
|
||||
gchar **tokens = g_strsplit (path, ":", -1);
|
||||
gint i;
|
||||
|
||||
for (i = 0; tokens[i]; i++)
|
||||
gtk_icon_theme_append_search_path (default_icon_theme, tokens[i]);
|
||||
|
||||
g_strfreev (tokens);
|
||||
}
|
||||
|
||||
glade_cursor_init ();
|
||||
|
||||
initialized = TRUE;
|
||||
}
|
||||
|
||||
priv->accel_group = NULL;
|
||||
|
||||
/* Initialize app objects */
|
||||
priv->catalogs = (GList *) glade_catalog_load_all ();
|
||||
|
||||
/* Create clipboard */
|
||||
priv->clipboard = glade_clipboard_new ();
|
||||
|
||||
/* Load the configuration file */
|
||||
priv->config = g_key_file_ref (glade_app_get_config ());
|
||||
}
|
||||
|
||||
static void
|
||||
glade_app_event_handler (GdkEvent *event, gpointer data)
|
||||
{
|
||||
if (glade_app_do_event (event)) return;
|
||||
|
||||
gtk_main_do_event (event);
|
||||
}
|
||||
|
||||
static void
|
||||
glade_app_class_init (GladeAppClass *klass)
|
||||
{
|
||||
GObjectClass *object_class;
|
||||
|
||||
object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->constructor = glade_app_constructor;
|
||||
object_class->dispose = glade_app_dispose;
|
||||
object_class->finalize = glade_app_finalize;
|
||||
|
||||
/**
|
||||
* GladeApp::doc-search:
|
||||
* @gladeeditor: the #GladeEditor which received the signal.
|
||||
* @arg1: the (#gchar *) book to search or %NULL
|
||||
* @arg2: the (#gchar *) page to search or %NULL
|
||||
* @arg3: the (#gchar *) search string or %NULL
|
||||
*
|
||||
* Emitted when the glade core requests that a doc-search be performed.
|
||||
*/
|
||||
glade_app_signals[DOC_SEARCH] =
|
||||
g_signal_new ("doc-search",
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
G_SIGNAL_RUN_LAST, 0, NULL, NULL,
|
||||
_glade_marshal_VOID__STRING_STRING_STRING,
|
||||
G_TYPE_NONE, 3,
|
||||
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
|
||||
|
||||
/**
|
||||
* GladeApp::signal-editor-created:
|
||||
* @gladeapp: the #GladeApp which received the signal.
|
||||
* @signal_editor: the new #GladeSignalEditor.
|
||||
*
|
||||
* Emitted when a new signal editor created.
|
||||
* A tree view is created in the default handler.
|
||||
* Connect your handler before the default handler for setting a custom column or renderer
|
||||
* and after it for connecting to the tree view signals
|
||||
*/
|
||||
glade_app_signals[SIGNAL_EDITOR_CREATED] =
|
||||
g_signal_new ("signal-editor-created",
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0, NULL, NULL,
|
||||
_glade_marshal_VOID__OBJECT,
|
||||
G_TYPE_NONE, 1, G_TYPE_OBJECT);
|
||||
|
||||
/**
|
||||
* GladeApp::widget-adaptor-registered:
|
||||
* @gladeapp: the #GladeApp which received the signal.
|
||||
* @adaptor: the newly registered #GladeWidgetAdaptor.
|
||||
*
|
||||
* Emitted when a new widget adaptor is registered.
|
||||
*/
|
||||
glade_app_signals[WIDGET_ADAPTOR_REGISTERED] =
|
||||
g_signal_new ("widget-adaptor-registered",
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0, NULL, NULL,
|
||||
_glade_marshal_VOID__OBJECT,
|
||||
G_TYPE_NONE, 1, G_TYPE_OBJECT);
|
||||
|
||||
gdk_event_handler_set (glade_app_event_handler, NULL, NULL);
|
||||
}
|
||||
|
||||
/*****************************************************************
|
||||
* Public API *
|
||||
*****************************************************************/
|
||||
|
||||
/**
|
||||
* glade_app_do_event:
|
||||
* @event: the event to process.
|
||||
*
|
||||
* This function has to be called in an event handler for widget selection to work.
|
||||
* See gdk_event_handler_set()
|
||||
*
|
||||
* Returns: true if the event was handled.
|
||||
*/
|
||||
gboolean
|
||||
glade_app_do_event (GdkEvent *event)
|
||||
{
|
||||
GdkWindow *window = event->any.window;
|
||||
GtkWidget *layout;
|
||||
gpointer widget;
|
||||
|
||||
if (window == NULL) return FALSE;
|
||||
|
||||
gdk_window_get_user_data (window, &widget);
|
||||
|
||||
/* As a slight optimization we could replace gtk_widget_get_ancestor()
|
||||
* with a custom function that only iterates trough parents with windows.
|
||||
*/
|
||||
if (widget && GLADE_WIDGET_IS_EVENT (event->type) &&
|
||||
(layout = gtk_widget_get_ancestor (widget, GLADE_TYPE_DESIGN_LAYOUT)))
|
||||
return _glade_design_layout_do_event (GLADE_DESIGN_LAYOUT (layout), event);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* glade_app_config_save
|
||||
*
|
||||
* Saves the #GKeyFile to "g_get_user_config_dir()/GLADE_CONFIG_FILENAME"
|
||||
*
|
||||
* Returns: 0 on success.
|
||||
*/
|
||||
gint
|
||||
glade_app_config_save ()
|
||||
{
|
||||
GIOChannel *channel;
|
||||
GIOStatus status;
|
||||
gchar *data = NULL, *filename;
|
||||
const gchar *config_dir = g_get_user_config_dir ();
|
||||
GError *error = NULL;
|
||||
gsize size, written, bytes_written = 0;
|
||||
static gboolean error_shown = FALSE;
|
||||
GladeApp *app;
|
||||
GladeAppPrivate *priv;
|
||||
|
||||
/* If we had any errors; wait untill next session to retry.
|
||||
*/
|
||||
if (error_shown)
|
||||
return -1;
|
||||
|
||||
app = glade_app_get ();
|
||||
priv = glade_app_get_instance_private (app);
|
||||
|
||||
/* Just in case... try to create the config directory */
|
||||
if (g_file_test (config_dir, G_FILE_TEST_IS_DIR) == FALSE)
|
||||
{
|
||||
if (g_file_test (config_dir, G_FILE_TEST_EXISTS))
|
||||
{
|
||||
/* Config dir exists but is not a directory */
|
||||
glade_util_ui_message
|
||||
(glade_app_get_window (),
|
||||
GLADE_UI_ERROR, NULL,
|
||||
_("Trying to save private data to %s directory "
|
||||
"but it is a regular file.\n"
|
||||
"No private data will be saved in this session"), config_dir);
|
||||
error_shown = TRUE;
|
||||
return -1;
|
||||
}
|
||||
else if (g_mkdir (config_dir, S_IRWXU) != 0)
|
||||
{
|
||||
/* Doesnt exist; failed to create */
|
||||
glade_util_ui_message
|
||||
(glade_app_get_window (),
|
||||
GLADE_UI_ERROR, NULL,
|
||||
_("Failed to create directory %s to save private data.\n"
|
||||
"No private data will be saved in this session"), config_dir);
|
||||
error_shown = TRUE;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
filename = g_build_filename (config_dir, GLADE_CONFIG_FILENAME, NULL);
|
||||
|
||||
if ((channel = g_io_channel_new_file (filename, "w", &error)) != NULL)
|
||||
{
|
||||
if ((data =
|
||||
g_key_file_to_data (priv->config, &size, &error)) != NULL)
|
||||
{
|
||||
|
||||
/* Implement loop here */
|
||||
while ((status = g_io_channel_write_chars (channel, data + bytes_written, /* Offset of write */
|
||||
size - bytes_written, /* Size left to write */
|
||||
&written,
|
||||
&error)) !=
|
||||
G_IO_STATUS_ERROR && (bytes_written + written) < size)
|
||||
bytes_written += written;
|
||||
|
||||
if (status == G_IO_STATUS_ERROR)
|
||||
{
|
||||
glade_util_ui_message
|
||||
(glade_app_get_window (),
|
||||
GLADE_UI_ERROR, NULL,
|
||||
_("Error writing private data to %s (%s).\n"
|
||||
"No private data will be saved in this session"),
|
||||
filename, error->message);
|
||||
error_shown = TRUE;
|
||||
}
|
||||
g_free (data);
|
||||
}
|
||||
else
|
||||
{
|
||||
glade_util_ui_message
|
||||
(glade_app_get_window (),
|
||||
GLADE_UI_ERROR, NULL,
|
||||
_("Error serializing configuration data to save (%s).\n"
|
||||
"No private data will be saved in this session"),
|
||||
error->message);
|
||||
error_shown = TRUE;
|
||||
}
|
||||
g_io_channel_shutdown (channel, TRUE, NULL);
|
||||
g_io_channel_unref (channel);
|
||||
}
|
||||
else
|
||||
{
|
||||
glade_util_ui_message
|
||||
(glade_app_get_window (),
|
||||
GLADE_UI_ERROR, NULL,
|
||||
_("Error opening %s to write private data (%s).\n"
|
||||
"No private data will be saved in this session"),
|
||||
filename, error->message);
|
||||
error_shown = TRUE;
|
||||
}
|
||||
g_free (filename);
|
||||
|
||||
if (error)
|
||||
{
|
||||
g_error_free (error);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* glade_app_get:
|
||||
*
|
||||
* Returns: (transfer none): the #GladeApp
|
||||
*/
|
||||
GladeApp *
|
||||
glade_app_get (void)
|
||||
{
|
||||
if (!singleton_app)
|
||||
{
|
||||
singleton_app = glade_app_new ();
|
||||
}
|
||||
|
||||
return singleton_app;
|
||||
}
|
||||
|
||||
/**
|
||||
* glade_app_set_window:
|
||||
* @window: (transfer full): a #GtkWidget
|
||||
*
|
||||
* Set the window of the application
|
||||
*/
|
||||
void
|
||||
glade_app_set_window (GtkWidget *window)
|
||||
{
|
||||
GladeApp *app = glade_app_get ();
|
||||
GladeAppPrivate *priv = glade_app_get_instance_private (app);
|
||||
|
||||
priv->window = window;
|
||||
}
|
||||
|
||||
/**
|
||||
* glade_app_get_catalog:
|
||||
* @name: the name of the catalog
|
||||
*
|
||||
* Returns: (transfer none) (nullable): a #GladeCatalog or %NULL if none is found
|
||||
*/
|
||||
GladeCatalog *
|
||||
glade_app_get_catalog (const gchar *name)
|
||||
{
|
||||
GladeApp *app = glade_app_get ();
|
||||
GladeAppPrivate *priv = glade_app_get_instance_private (app);
|
||||
GList *list;
|
||||
GladeCatalog *catalog;
|
||||
|
||||
g_return_val_if_fail (name && name[0], NULL);
|
||||
|
||||
for (list = priv->catalogs; list; list = list->next)
|
||||
{
|
||||
catalog = list->data;
|
||||
if (!strcmp (glade_catalog_get_name (catalog), name))
|
||||
return catalog;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* glade_app_get_catalog_version:
|
||||
* @name: the name of the #GladeCatalog
|
||||
* @major: (out) (optional): the major version
|
||||
* @minor: (out) (optional): the minor version
|
||||
*
|
||||
* Returns: %TRUE if the catalog has been found. It is a programming error
|
||||
* to call this function with an unexisting catalog, returns %FALSE in this
|
||||
* case and throws a warning.
|
||||
*/
|
||||
gboolean
|
||||
glade_app_get_catalog_version (const gchar *name, gint *major, gint *minor)
|
||||
{
|
||||
GladeCatalog *catalog = glade_app_get_catalog (name);
|
||||
|
||||
g_return_val_if_fail (catalog != NULL, FALSE);
|
||||
|
||||
if (major)
|
||||
*major = glade_catalog_get_major_version (catalog);
|
||||
if (minor)
|
||||
*minor = glade_catalog_get_minor_version (catalog);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* glade_app_get_catalogs:
|
||||
*
|
||||
* Returns: (transfer none) (element-type GladeCatalog): a list of #GladeCatalog
|
||||
*/
|
||||
GList *
|
||||
glade_app_get_catalogs (void)
|
||||
{
|
||||
GladeApp *app = glade_app_get ();
|
||||
GladeAppPrivate *priv = glade_app_get_instance_private (app);
|
||||
|
||||
return priv->catalogs;
|
||||
}
|
||||
|
||||
/**
|
||||
* glade_app_get_window:
|
||||
*
|
||||
* Returns: (transfer none): a #GtkWidget
|
||||
*/
|
||||
GtkWidget *
|
||||
glade_app_get_window (void)
|
||||
{
|
||||
GladeApp *app = glade_app_get ();
|
||||
GladeAppPrivate *priv = glade_app_get_instance_private (app);
|
||||
|
||||
return priv->window;
|
||||
}
|
||||
|
||||
/**
|
||||
* glade_app_get_clipboard:
|
||||
*
|
||||
* Returns: (transfer none): a #GladeClipboard
|
||||
*/
|
||||
GladeClipboard *
|
||||
glade_app_get_clipboard (void)
|
||||
{
|
||||
GladeApp *app = glade_app_get ();
|
||||
GladeAppPrivate *priv = glade_app_get_instance_private (app);
|
||||
|
||||
return priv->clipboard;
|
||||
}
|
||||
|
||||
/**
|
||||
* glade_app_get_projects:
|
||||
*
|
||||
* Returns: (element-type GladeCatalog) (transfer none): a list of #GladeCatalog
|
||||
*/
|
||||
GList *
|
||||
glade_app_get_projects (void)
|
||||
{
|
||||
GladeApp *app = glade_app_get ();
|
||||
GladeAppPrivate *priv = glade_app_get_instance_private (app);
|
||||
|
||||
return priv->projects;
|
||||
}
|
||||
|
||||
/**
|
||||
* glade_app_get_config:
|
||||
*
|
||||
* Returns: (transfer full): a #GKeyFile
|
||||
*/
|
||||
GKeyFile *
|
||||
glade_app_get_config (void)
|
||||
{
|
||||
static GKeyFile *config = NULL;
|
||||
|
||||
if (config == NULL)
|
||||
{
|
||||
gchar *filename = g_build_filename (g_get_user_config_dir (),
|
||||
GLADE_CONFIG_FILENAME, NULL);
|
||||
config = g_key_file_new ();
|
||||
g_key_file_load_from_file (config, filename, G_KEY_FILE_NONE, NULL);
|
||||
g_free (filename);
|
||||
}
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
gboolean
|
||||
glade_app_is_project_loaded (const gchar *project_path)
|
||||
{
|
||||
GladeApp *app;
|
||||
GladeAppPrivate *priv;
|
||||
GList *list;
|
||||
gboolean loaded = FALSE;
|
||||
|
||||
if (project_path == NULL)
|
||||
return FALSE;
|
||||
|
||||
app = glade_app_get ();
|
||||
priv = glade_app_get_instance_private (app);
|
||||
|
||||
for (list = priv->projects; list; list = list->next)
|
||||
{
|
||||
GladeProject *cur_project = GLADE_PROJECT (list->data);
|
||||
|
||||
if ((loaded = glade_project_get_path (cur_project) &&
|
||||
(strcmp (glade_project_get_path (cur_project), project_path) == 0)))
|
||||
break;
|
||||
}
|
||||
|
||||
return loaded;
|
||||
}
|
||||
|
||||
/**
|
||||
* glade_app_get_project_by_path:
|
||||
* @project_path: The path of an open project
|
||||
*
|
||||
* Finds an open project with @path
|
||||
*
|
||||
* Returns: (nullable) (transfer none): A #GladeProject, or NULL if no such open project was found
|
||||
*/
|
||||
GladeProject *
|
||||
glade_app_get_project_by_path (const gchar *project_path)
|
||||
{
|
||||
GladeApp *app;
|
||||
GladeAppPrivate *priv;
|
||||
GList *l;
|
||||
gchar *canonical_path;
|
||||
|
||||
if (project_path == NULL)
|
||||
return NULL;
|
||||
|
||||
app = glade_app_get ();
|
||||
priv = glade_app_get_instance_private (app);
|
||||
|
||||
canonical_path = glade_util_canonical_path (project_path);
|
||||
|
||||
for (l = priv->projects; l; l = l->next)
|
||||
{
|
||||
GladeProject *project = (GladeProject *) l->data;
|
||||
|
||||
if (glade_project_get_path (project) &&
|
||||
strcmp (canonical_path, glade_project_get_path (project)) == 0)
|
||||
{
|
||||
g_free (canonical_path);
|
||||
return project;
|
||||
}
|
||||
}
|
||||
|
||||
g_free (canonical_path);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* glade_app_add_project:
|
||||
* @project: the project to add to the #GladeApp
|
||||
*/
|
||||
void
|
||||
glade_app_add_project (GladeProject *project)
|
||||
{
|
||||
GladeApp *app;
|
||||
GladeAppPrivate *priv;
|
||||
|
||||
g_return_if_fail (GLADE_IS_PROJECT (project));
|
||||
|
||||
app = glade_app_get ();
|
||||
priv = glade_app_get_instance_private (app);
|
||||
|
||||
/* If the project was previously loaded, don't re-load */
|
||||
if (g_list_find (priv->projects, project) != NULL)
|
||||
return;
|
||||
|
||||
/* Take a reference for GladeApp here... */
|
||||
priv->projects = g_list_append (priv->projects, g_object_ref (project));
|
||||
}
|
||||
|
||||
/**
|
||||
* glade_app_remove_project:
|
||||
* @project: the project to remove from the #GladeApp
|
||||
*/
|
||||
void
|
||||
glade_app_remove_project (GladeProject *project)
|
||||
{
|
||||
GladeApp *app;
|
||||
GladeAppPrivate *priv;
|
||||
g_return_if_fail (GLADE_IS_PROJECT (project));
|
||||
|
||||
app = glade_app_get ();
|
||||
priv = glade_app_get_instance_private (app);
|
||||
|
||||
priv->projects = g_list_remove (priv->projects, project);
|
||||
|
||||
/* Its safe to just release the project as the project emits a
|
||||
* "close" signal and everyone is responsable for cleaning up at
|
||||
* that point.
|
||||
*/
|
||||
g_object_unref (project);
|
||||
}
|
||||
|
||||
/**
|
||||
* glade_app_set_accel_group:
|
||||
* @accel_group: (transfer full): a #GtkAccelGroup to set
|
||||
*
|
||||
* Sets @accel_group to app.
|
||||
* The acceleration group will made available for editor dialog windows
|
||||
* from the plugin backend.
|
||||
*/
|
||||
void
|
||||
glade_app_set_accel_group (GtkAccelGroup *accel_group)
|
||||
{
|
||||
GladeApp *app;
|
||||
GladeAppPrivate *priv;
|
||||
|
||||
g_return_if_fail (GTK_IS_ACCEL_GROUP (accel_group));
|
||||
|
||||
app = glade_app_get ();
|
||||
priv = glade_app_get_instance_private (app);
|
||||
|
||||
priv->accel_group = accel_group;
|
||||
}
|
||||
|
||||
/**
|
||||
* glade_app_get_accel_group:
|
||||
*
|
||||
* Returns: (transfer none): the #GtkAccelGroup
|
||||
*/
|
||||
GtkAccelGroup *
|
||||
glade_app_get_accel_group (void)
|
||||
{
|
||||
GladeApp *app = glade_app_get ();
|
||||
GladeAppPrivate *priv = glade_app_get_instance_private (app);
|
||||
|
||||
return priv->accel_group;
|
||||
}
|
||||
|
||||
/**
|
||||
* glade_app_new:
|
||||
*
|
||||
* Returns: (transfer full): the #GladeApp
|
||||
*/
|
||||
GladeApp *
|
||||
glade_app_new (void)
|
||||
{
|
||||
return g_object_new (GLADE_TYPE_APP, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* glade_app_search_docs:
|
||||
* @book: the name of a book
|
||||
* @page: the name of a page
|
||||
* @search: the search query
|
||||
*
|
||||
* Searches for @book, @page and @search in the documentation.
|
||||
*/
|
||||
void
|
||||
glade_app_search_docs (const gchar *book,
|
||||
const gchar *page,
|
||||
const gchar *search)
|
||||
{
|
||||
GladeApp *app;
|
||||
|
||||
app = glade_app_get ();
|
||||
|
||||
g_signal_emit (G_OBJECT (app), glade_app_signals[DOC_SEARCH], 0,
|
||||
book, page, search);
|
||||
}
|
@ -1,91 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2001 Ximian, Inc.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Authors:
|
||||
* Naba Kumar <naba@gnome.org>
|
||||
*/
|
||||
|
||||
#ifndef __GLADE_APP_H__
|
||||
#define __GLADE_APP_H__
|
||||
|
||||
#include <gladeui/glade-editor.h>
|
||||
#include <gladeui/glade-palette.h>
|
||||
#include <gladeui/glade-clipboard.h>
|
||||
#include <gladeui/glade-catalog.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GLADE_TYPE_APP glade_app_get_type ()
|
||||
G_DECLARE_DERIVABLE_TYPE (GladeApp, glade_app, GLADE, APP, GObject)
|
||||
|
||||
#define GLADE_ENV_CATALOG_PATH "GLADE_CATALOG_SEARCH_PATH"
|
||||
#define GLADE_ENV_MODULE_PATH "GLADE_MODULE_SEARCH_PATH"
|
||||
#define GLADE_ENV_TESTING "GLADE_TESTING"
|
||||
#define GLADE_ENV_PIXMAP_DIR "GLADE_PIXMAP_DIR"
|
||||
#define GLADE_ENV_ICON_THEME_PATH "GLADE_ICON_THEME_PATH"
|
||||
#define GLADE_ENV_BUNDLED "GLADE_BUNDLED"
|
||||
|
||||
struct _GladeAppClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
|
||||
gpointer padding[6];
|
||||
};
|
||||
|
||||
void glade_init (void);
|
||||
|
||||
GladeApp* glade_app_new (void);
|
||||
GladeApp* glade_app_get (void);
|
||||
GKeyFile* glade_app_get_config (void);
|
||||
gint glade_app_config_save (void);
|
||||
|
||||
gboolean glade_app_do_event (GdkEvent *event);
|
||||
|
||||
gboolean glade_app_get_catalog_version (const gchar *name,
|
||||
gint *major,
|
||||
gint *minor);
|
||||
GList *glade_app_get_catalogs (void);
|
||||
GladeCatalog *glade_app_get_catalog (const gchar *name);
|
||||
GladeClipboard* glade_app_get_clipboard (void);
|
||||
|
||||
void glade_app_add_project (GladeProject *project);
|
||||
void glade_app_remove_project (GladeProject *project);
|
||||
GList* glade_app_get_projects (void);
|
||||
gboolean glade_app_is_project_loaded (const gchar *project_path);
|
||||
GladeProject* glade_app_get_project_by_path (const gchar *project_path);
|
||||
|
||||
void glade_app_set_window (GtkWidget *window);
|
||||
GtkWidget* glade_app_get_window (void);
|
||||
|
||||
void glade_app_set_accel_group (GtkAccelGroup *accel_group);
|
||||
GtkAccelGroup *glade_app_get_accel_group (void);
|
||||
|
||||
void glade_app_search_docs (const gchar *book,
|
||||
const gchar *page,
|
||||
const gchar *search);
|
||||
|
||||
/* package paths */
|
||||
const gchar *glade_app_get_catalogs_dir (void) G_GNUC_CONST;
|
||||
const gchar *glade_app_get_modules_dir (void) G_GNUC_CONST;
|
||||
const gchar *glade_app_get_pixmaps_dir (void) G_GNUC_CONST;
|
||||
const gchar *glade_app_get_locale_dir (void) G_GNUC_CONST;
|
||||
const gchar *glade_app_get_bin_dir (void) G_GNUC_CONST;
|
||||
const gchar *glade_app_get_lib_dir (void) G_GNUC_CONST;
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GLADE_APP_H__ */
|
@ -1,81 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2006 Juan Pablo Ugarte.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Authors:
|
||||
* Juan Pablo Ugarte <juanpablougarte@gmail.com>
|
||||
*/
|
||||
|
||||
#ifndef __GLADE_BASE_EDITOR_H__
|
||||
#define __GLADE_BASE_EDITOR_H__
|
||||
|
||||
#include <gladeui/glade-widget.h>
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GLADE_TYPE_BASE_EDITOR glade_base_editor_get_type ()
|
||||
G_DECLARE_DERIVABLE_TYPE (GladeBaseEditor, glade_base_editor, GLADE, BASE_EDITOR, GtkBox)
|
||||
|
||||
struct _GladeBaseEditorClass
|
||||
{
|
||||
GtkBoxClass parent_class;
|
||||
|
||||
void (*child_selected) (GladeBaseEditor *editor, GladeWidget *gchild);
|
||||
gboolean (*change_type) (GladeBaseEditor *editor, GladeWidget *gchild, GType type);
|
||||
gchar * (*get_display_name) (GladeBaseEditor *editor, GladeWidget *gchild);
|
||||
GladeWidget * (*build_child) (GladeBaseEditor *editor, GladeWidget *parent, GType type);
|
||||
gboolean (*delete_child) (GladeBaseEditor *editor, GladeWidget *parent, GladeWidget *gchild);
|
||||
gboolean (*move_child) (GladeBaseEditor *editor, GladeWidget *gparent, GladeWidget *gchild);
|
||||
|
||||
gpointer padding[6];
|
||||
};
|
||||
|
||||
GladeBaseEditor *glade_base_editor_new (GObject *container,
|
||||
GladeEditable *main_editable,
|
||||
...);
|
||||
|
||||
void glade_base_editor_append_types (GladeBaseEditor *editor,
|
||||
GType parent_type,
|
||||
...);
|
||||
|
||||
void glade_base_editor_add_editable (GladeBaseEditor *editor,
|
||||
GladeWidget *gchild,
|
||||
GladeEditorPageType page);
|
||||
|
||||
void glade_base_editor_add_default_properties (GladeBaseEditor *editor,
|
||||
GladeWidget *gchild);
|
||||
|
||||
void glade_base_editor_add_properties (GladeBaseEditor *editor,
|
||||
GladeWidget *gchild,
|
||||
gboolean packing,
|
||||
...);
|
||||
|
||||
void glade_base_editor_add_label (GladeBaseEditor *editor,
|
||||
gchar *str);
|
||||
|
||||
void glade_base_editor_set_show_signal_editor (GladeBaseEditor *editor,
|
||||
gboolean val);
|
||||
|
||||
/* Convenience functions */
|
||||
GtkWidget *glade_base_editor_pack_new_window (GladeBaseEditor *editor,
|
||||
gchar *title,
|
||||
gchar *help_markup);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GLADE_BASE_EDITOR_H__ */
|
@ -1,259 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generated with glade 3.21.0 -->
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.20"/>
|
||||
<requires lib="gladeui" version="0.0"/>
|
||||
<template class="GladeBaseEditor" parent="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="events"/>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">8</property>
|
||||
<signal name="realize" handler="glade_base_editor_realize_callback" swapped="no"/>
|
||||
<child>
|
||||
<object class="GtkPaned" id="paned">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="events"/>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="wide_handle">True</property>
|
||||
<child>
|
||||
<object class="GtkPaned">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="wide_handle">True</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="events"/>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="events"/>
|
||||
<property name="hscrollbar_policy">never</property>
|
||||
<property name="vscrollbar_policy">always</property>
|
||||
<child>
|
||||
<object class="GtkTreeView" id="treeview">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="events">GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_TOUCH_MASK</property>
|
||||
<property name="reorderable">True</property>
|
||||
<property name="rules_hint">True</property>
|
||||
<property name="search_column">2</property>
|
||||
<signal name="button-press-event" handler="glade_base_editor_popup_handler" swapped="no"/>
|
||||
<signal name="cursor-changed" handler="glade_base_editor_treeview_cursor_changed" swapped="no"/>
|
||||
<signal name="key-press-event" handler="glade_base_editor_treeview_key_press_event" swapped="no"/>
|
||||
<child internal-child="selection">
|
||||
<object class="GtkTreeSelection"/>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="border_width">4</property>
|
||||
<child>
|
||||
<object class="GtkButtonBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="layout_style">expand</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="help_button">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="icon_name">help-browser</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButtonBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="layout_style">expand</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="add_button">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="events"/>
|
||||
<signal name="clicked" handler="glade_base_editor_add_activate" swapped="no"/>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="icon_name">list-add</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="delete_button">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="events"/>
|
||||
<signal name="clicked" handler="glade_base_editor_delete_activate" swapped="no"/>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="icon_name">list-remove</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="resize">True</property>
|
||||
<property name="shrink">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="tip_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_left">4</property>
|
||||
<property name="margin_right">4</property>
|
||||
<property name="use_markup">True</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="events"/>
|
||||
<property name="hscrollbar_policy">never</property>
|
||||
<child>
|
||||
<object class="GtkViewport">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="events"/>
|
||||
<child>
|
||||
<object class="GtkGrid" id="table">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="events"/>
|
||||
<property name="margin_left">4</property>
|
||||
<property name="margin_right">4</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="row_spacing">4</property>
|
||||
<property name="column_spacing">4</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="message_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="use_markup">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="resize">True</property>
|
||||
<property name="shrink">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="resize">True</property>
|
||||
<property name="shrink">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GladeSignalEditor" id="signal_editor">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="events"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="resize">True</property>
|
||||
<property name="shrink">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
</template>
|
||||
</interface>
|
@ -1,653 +0,0 @@
|
||||
/*
|
||||
* glade-clipboard.c - An object for handling Cut/Copy/Paste.
|
||||
*
|
||||
* Copyright (C) 2005 The GNOME Foundation.
|
||||
*
|
||||
* Author(s):
|
||||
* Tristan Van Berkom <tvb@gnome.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include <string.h>
|
||||
#include "glade-builtins.h"
|
||||
#include "glade-displayable-values.h"
|
||||
|
||||
|
||||
struct _GladeParamSpecObjects
|
||||
{
|
||||
GParamSpec parent_instance;
|
||||
|
||||
GType type; /* Object or interface type accepted
|
||||
* in this object list.
|
||||
*/
|
||||
};
|
||||
|
||||
typedef struct _GladeStockItem
|
||||
{
|
||||
gchar *value_name;
|
||||
gchar *value_nick;
|
||||
gchar *clean_name;
|
||||
gint value;
|
||||
} GladeStockItem;
|
||||
|
||||
|
||||
/************************************************************
|
||||
* Auto-generate the enum type for stock properties *
|
||||
************************************************************/
|
||||
|
||||
/* Hard-coded list of stock images (and displayable translations) from gtk+ that are not stock "items" */
|
||||
static const gchar *builtin_stock_images[] = {
|
||||
"gtk-dialog-authentication", /* GTK_STOCK_DIALOG_AUTHENTICATION */
|
||||
"gtk-dnd", /* GTK_STOCK_DND */
|
||||
"gtk-dnd-multiple", /* GTK_STOCK_DND_MULTIPLE */
|
||||
"gtk-color-picker", /* GTK_STOCK_COLOR_PICKER */
|
||||
"gtk-directory", /* GTK_STOCK_DIRECTORY */
|
||||
"gtk-file", /* GTK_STOCK_FILE */
|
||||
"gtk-missing-image" /* GTK_STOCK_MISSING_IMAGE */
|
||||
};
|
||||
|
||||
static const gchar *builtin_stock_displayables[] = {
|
||||
/* GTK_STOCK_DIALOG_AUTHENTICATION */
|
||||
N_("Authentication"),
|
||||
/* GTK_STOCK_DND */
|
||||
N_("Drag and Drop"),
|
||||
/* GTK_STOCK_DND_MULTIPLE */
|
||||
N_("Drag and Drop Multiple"),
|
||||
/* GTK_STOCK_COLOR_PICKER */
|
||||
N_("Color Picker"),
|
||||
/* GTK_STOCK_DIRECTORY */
|
||||
N_("Directory"),
|
||||
/* GTK_STOCK_FILE */
|
||||
N_("File"),
|
||||
/* GTK_STOCK_MISSING_IMAGE */
|
||||
N_("Missing Image")
|
||||
};
|
||||
|
||||
static GSList *stock_prefixs = NULL;
|
||||
static gboolean stock_prefixs_done = FALSE;
|
||||
|
||||
/* FIXME: func needs documentation
|
||||
*/
|
||||
void
|
||||
glade_standard_stock_append_prefix (const gchar * prefix)
|
||||
{
|
||||
if (stock_prefixs_done)
|
||||
{
|
||||
g_warning
|
||||
("glade_standard_stock_append_prefix should be used in catalog init-function");
|
||||
return;
|
||||
}
|
||||
|
||||
stock_prefixs = g_slist_append (stock_prefixs, g_strdup (prefix));
|
||||
}
|
||||
|
||||
static GladeStockItem *
|
||||
new_from_values (const gchar * name, const gchar * nick, gint value)
|
||||
{
|
||||
GladeStockItem *new_gsi = NULL;
|
||||
gchar *clean_name;
|
||||
size_t len = 0;
|
||||
guint i = 0;
|
||||
guint j = 0;
|
||||
|
||||
new_gsi = (GladeStockItem *) g_malloc0 (sizeof (GladeStockItem));
|
||||
|
||||
new_gsi->value_name = g_strdup (name);
|
||||
new_gsi->value_nick = g_strdup (nick);
|
||||
new_gsi->value = value;
|
||||
|
||||
|
||||
clean_name = g_strdup (name);
|
||||
len = strlen (clean_name);
|
||||
|
||||
while (i + j <= len)
|
||||
{
|
||||
if (clean_name[i + j] == '_')
|
||||
j++;
|
||||
|
||||
clean_name[i] = clean_name[i + j];
|
||||
i++;
|
||||
}
|
||||
|
||||
new_gsi->clean_name = g_utf8_collate_key (clean_name, i - j);
|
||||
|
||||
g_free (clean_name);
|
||||
|
||||
return new_gsi;
|
||||
}
|
||||
|
||||
|
||||
static gint
|
||||
compare_two_gsi (gconstpointer a, gconstpointer b)
|
||||
{
|
||||
GladeStockItem *gsi1 = (GladeStockItem *) a;
|
||||
GladeStockItem *gsi2 = (GladeStockItem *) b;
|
||||
|
||||
return strcmp (gsi1->clean_name, gsi2->clean_name);
|
||||
}
|
||||
|
||||
static GArray *
|
||||
list_stock_items (gboolean include_images)
|
||||
{
|
||||
GtkStockItem item;
|
||||
GSList *l = NULL, *stock_list = NULL, *p = NULL;
|
||||
gchar *stock_id = NULL, *prefix = NULL;
|
||||
gint stock_enum = 0, i = 0;
|
||||
GEnumValue value;
|
||||
GArray *values = NULL;
|
||||
GladeStockItem *gsi;
|
||||
GSList *gsi_list = NULL;
|
||||
GSList *gsi_list_list = NULL;
|
||||
|
||||
if (gdk_display_get_default () == NULL)
|
||||
{
|
||||
values = g_array_sized_new (TRUE, TRUE, sizeof (GEnumValue), 1);
|
||||
|
||||
value.value = 0;
|
||||
value.value_name = "dummy";
|
||||
value.value_nick = "Dummy";
|
||||
g_array_append_val (values, value);
|
||||
|
||||
return values;
|
||||
}
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
stock_list = g_slist_reverse (gtk_stock_list_ids ());
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
|
||||
values = g_array_sized_new (TRUE, TRUE, sizeof (GEnumValue),
|
||||
g_slist_length (stock_list));
|
||||
|
||||
/* We want gtk+ stock items to appear first */
|
||||
if ((stock_prefixs && strcmp (stock_prefixs->data, "gtk-")) ||
|
||||
stock_prefixs == NULL)
|
||||
stock_prefixs = g_slist_prepend (stock_prefixs, g_strdup ("gtk-"));
|
||||
|
||||
for (p = stock_prefixs; p; p = g_slist_next (p))
|
||||
{
|
||||
prefix = p->data;
|
||||
|
||||
for (l = stock_list; l; l = g_slist_next (l))
|
||||
{
|
||||
stock_id = l->data;
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
if (g_str_has_prefix (stock_id, prefix) == FALSE ||
|
||||
gtk_stock_lookup (stock_id, &item) == FALSE)
|
||||
continue;
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
|
||||
gsi = new_from_values (item.label, stock_id, stock_enum++);
|
||||
gsi_list =
|
||||
g_slist_insert_sorted (gsi_list, gsi,
|
||||
(GCompareFunc) compare_two_gsi);
|
||||
}
|
||||
|
||||
gsi_list_list = g_slist_append (gsi_list_list, gsi_list);
|
||||
gsi_list = NULL;
|
||||
|
||||
/* Images are appended after the gtk+ group of items */
|
||||
if (include_images && !strcmp (prefix, "gtk-"))
|
||||
{
|
||||
for (i = 0; i < G_N_ELEMENTS (builtin_stock_images); i++)
|
||||
{
|
||||
gsi =
|
||||
new_from_values (builtin_stock_images[i],
|
||||
builtin_stock_images[i], stock_enum++);
|
||||
gsi_list =
|
||||
g_slist_insert_sorted (gsi_list, gsi,
|
||||
(GCompareFunc) compare_two_gsi);
|
||||
}
|
||||
gsi_list_list = g_slist_append (gsi_list_list, gsi_list);
|
||||
gsi_list = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
for (p = gsi_list_list; p; p = g_slist_next (p))
|
||||
{
|
||||
|
||||
for (l = (GSList *) p->data; l; l = g_slist_next (l))
|
||||
{
|
||||
gsi = (GladeStockItem *) l->data;
|
||||
value.value = gsi->value;
|
||||
value.value_name = g_strdup (gsi->value_name);
|
||||
value.value_nick = g_strdup (gsi->value_nick);
|
||||
values = g_array_append_val (values, value);
|
||||
|
||||
g_free (gsi->value_nick);
|
||||
g_free (gsi->value_name);
|
||||
g_free (gsi->clean_name);
|
||||
g_free (gsi);
|
||||
}
|
||||
g_slist_free ((GSList *) p->data);
|
||||
}
|
||||
|
||||
g_slist_free (gsi_list_list);
|
||||
|
||||
stock_prefixs_done = TRUE;
|
||||
g_slist_free_full (stock_list, g_free);
|
||||
|
||||
return values;
|
||||
}
|
||||
|
||||
static gchar *
|
||||
clean_stock_name (const gchar * name)
|
||||
{
|
||||
gchar *clean_name, *str;
|
||||
size_t len = 0;
|
||||
guint i = 0;
|
||||
guint j = 0;
|
||||
|
||||
g_assert (name && name[0]);
|
||||
|
||||
str = g_strdup (name);
|
||||
len = strlen (str);
|
||||
|
||||
while (i + j <= len)
|
||||
{
|
||||
if (str[i + j] == '_')
|
||||
j++;
|
||||
|
||||
str[i] = str[i + j];
|
||||
i++;
|
||||
}
|
||||
clean_name = g_strndup (str, i - j);
|
||||
g_free (str);
|
||||
|
||||
return clean_name;
|
||||
}
|
||||
|
||||
GType
|
||||
glade_standard_stock_get_type (void)
|
||||
{
|
||||
static GType etype = 0;
|
||||
|
||||
if (etype == 0)
|
||||
{
|
||||
GArray *values = list_stock_items (FALSE);
|
||||
gint i, n_values = values->len;
|
||||
GEnumValue *enum_values = (GEnumValue *) values->data;
|
||||
GtkStockItem item;
|
||||
|
||||
etype = g_enum_register_static ("GladeStock",
|
||||
(GEnumValue *) g_array_free (values,
|
||||
FALSE));
|
||||
|
||||
if (gdk_display_get_default () == NULL)
|
||||
return etype;
|
||||
|
||||
/* Register displayable by GType, i.e. after the types been created. */
|
||||
for (i = 0; i < n_values; i++)
|
||||
{
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
gboolean valid_item = gtk_stock_lookup (enum_values[i].value_nick, &item);
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
|
||||
if (valid_item)
|
||||
{
|
||||
gchar *clean_name = clean_stock_name (item.label);
|
||||
|
||||
if (!glade_get_displayable_value (etype, enum_values[i].value_nick))
|
||||
glade_register_translated_value (etype, enum_values[i].value_nick, clean_name);
|
||||
g_free (clean_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
return etype;
|
||||
}
|
||||
|
||||
|
||||
GType
|
||||
glade_standard_stock_image_get_type (void)
|
||||
{
|
||||
static GType etype = 0;
|
||||
|
||||
if (etype == 0)
|
||||
{
|
||||
GArray *values = list_stock_items (TRUE);
|
||||
gint i, n_values = values->len;
|
||||
GEnumValue *enum_values = (GEnumValue *) values->data;
|
||||
GtkStockItem item;
|
||||
|
||||
etype = g_enum_register_static ("GladeStockImage",
|
||||
(GEnumValue *) g_array_free (values,
|
||||
FALSE));
|
||||
|
||||
if (gdk_display_get_default () == NULL)
|
||||
return etype;
|
||||
|
||||
/* Register displayable by GType, i.e. after the types been created. */
|
||||
for (i = 0; i < n_values; i++)
|
||||
{
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
gboolean valid_item = gtk_stock_lookup (enum_values[i].value_nick, &item);
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
if (valid_item)
|
||||
{
|
||||
gchar *clean_name = clean_stock_name (item.label);
|
||||
|
||||
/* These are translated, we just cut out the mnemonic underscores */
|
||||
if (!glade_get_displayable_value (etype, enum_values[i].value_nick))
|
||||
glade_register_translated_value (etype, enum_values[i].value_nick, clean_name);
|
||||
g_free (clean_name);
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (builtin_stock_images); i++)
|
||||
{
|
||||
/* these ones are translated from glade */
|
||||
if (!glade_get_displayable_value (etype, builtin_stock_images[i]))
|
||||
glade_register_displayable_value (etype,
|
||||
builtin_stock_images[i],
|
||||
GETTEXT_PACKAGE,
|
||||
builtin_stock_displayables[i]);
|
||||
}
|
||||
}
|
||||
return etype;
|
||||
}
|
||||
|
||||
/**
|
||||
* glade_standard_stock_spec:
|
||||
*
|
||||
* Returns: (transfer full): a #GParamSpec describing a list of builtin stock item
|
||||
*/
|
||||
GParamSpec *
|
||||
glade_standard_stock_spec (void)
|
||||
{
|
||||
return g_param_spec_enum ("stock", _("Stock"),
|
||||
_("A builtin stock item"),
|
||||
GLADE_TYPE_STOCK, 0, G_PARAM_READWRITE);
|
||||
}
|
||||
|
||||
/**
|
||||
* glade_standard_stock_image_spec:
|
||||
*
|
||||
* Returns: (transfer full): a #GParamSpec describing a list of builtin stock image
|
||||
*/
|
||||
GParamSpec *
|
||||
glade_standard_stock_image_spec (void)
|
||||
{
|
||||
return g_param_spec_enum ("stock-image", _("Stock Image"),
|
||||
_("A builtin stock image"),
|
||||
GLADE_TYPE_STOCK_IMAGE, 0, G_PARAM_READWRITE);
|
||||
}
|
||||
|
||||
/****************************************************************
|
||||
* A GList boxed type used by GladeParamSpecObjects and *
|
||||
* GladeParamSpecAccel (which is now in the glade-gtk backend) *
|
||||
****************************************************************/
|
||||
GType
|
||||
glade_glist_get_type (void)
|
||||
{
|
||||
static GType type_id = 0;
|
||||
|
||||
if (!type_id)
|
||||
type_id = g_boxed_type_register_static
|
||||
("GladeGList",
|
||||
(GBoxedCopyFunc) g_list_copy, (GBoxedFreeFunc) g_list_free);
|
||||
return type_id;
|
||||
}
|
||||
|
||||
/****************************************************************
|
||||
* Built-in GladeParamSpecObjects for object list properties *
|
||||
* (Used as a pspec to describe an AtkRelationSet, but can *
|
||||
* for any object list property) *
|
||||
****************************************************************/
|
||||
static void
|
||||
param_objects_init (GParamSpec * pspec)
|
||||
{
|
||||
GladeParamSpecObjects *ospec = GLADE_PARAM_SPEC_OBJECTS (pspec);
|
||||
ospec->type = G_TYPE_OBJECT;
|
||||
}
|
||||
|
||||
static void
|
||||
param_objects_set_default (GParamSpec * pspec, GValue * value)
|
||||
{
|
||||
if (value->data[0].v_pointer != NULL)
|
||||
{
|
||||
g_free (value->data[0].v_pointer);
|
||||
}
|
||||
value->data[0].v_pointer = NULL;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
param_objects_validate (GParamSpec * pspec, GValue * value)
|
||||
{
|
||||
GladeParamSpecObjects *ospec = GLADE_PARAM_SPEC_OBJECTS (pspec);
|
||||
GList *objects, *list, *toremove = NULL;
|
||||
GObject *object;
|
||||
|
||||
objects = value->data[0].v_pointer;
|
||||
|
||||
for (list = objects; list; list = list->next)
|
||||
{
|
||||
object = list->data;
|
||||
|
||||
if (!(G_OBJECT_TYPE (object) == ospec->type ||
|
||||
g_type_is_a (G_OBJECT_TYPE (object), ospec->type)))
|
||||
toremove = g_list_prepend (toremove, object);
|
||||
}
|
||||
|
||||
for (list = toremove; list; list = list->next)
|
||||
{
|
||||
object = list->data;
|
||||
objects = g_list_remove (objects, object);
|
||||
}
|
||||
if (toremove)
|
||||
g_list_free (toremove);
|
||||
|
||||
value->data[0].v_pointer = objects;
|
||||
|
||||
return toremove != NULL;
|
||||
}
|
||||
|
||||
static gint
|
||||
param_objects_values_cmp (GParamSpec * pspec,
|
||||
const GValue * value1, const GValue * value2)
|
||||
{
|
||||
guint8 *p1 = value1->data[0].v_pointer;
|
||||
guint8 *p2 = value2->data[0].v_pointer;
|
||||
|
||||
/* not much to compare here, try to at least provide stable lesser/greater result */
|
||||
|
||||
return p1 < p2 ? -1 : p1 > p2;
|
||||
}
|
||||
|
||||
GType
|
||||
glade_param_objects_get_type (void)
|
||||
{
|
||||
static GType objects_type = 0;
|
||||
|
||||
if (objects_type == 0)
|
||||
{
|
||||
static /* const */ GParamSpecTypeInfo pspec_info = {
|
||||
sizeof (GladeParamSpecObjects), /* instance_size */
|
||||
16, /* n_preallocs */
|
||||
param_objects_init, /* instance_init */
|
||||
0xdeadbeef, /* value_type, assigned further down */
|
||||
NULL, /* finalize */
|
||||
param_objects_set_default, /* value_set_default */
|
||||
param_objects_validate, /* value_validate */
|
||||
param_objects_values_cmp, /* values_cmp */
|
||||
};
|
||||
pspec_info.value_type = GLADE_TYPE_GLIST;
|
||||
|
||||
objects_type = g_param_type_register_static
|
||||
("GladeParamObjects", &pspec_info);
|
||||
}
|
||||
return objects_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* glade_param_spec_objects:
|
||||
*
|
||||
* Returns: (transfer full): a #GParamSpec describing a list of #GObject
|
||||
*/
|
||||
GParamSpec *
|
||||
glade_param_spec_objects (const gchar * name,
|
||||
const gchar * nick,
|
||||
const gchar * blurb,
|
||||
GType accepted_type, GParamFlags flags)
|
||||
{
|
||||
GladeParamSpecObjects *pspec;
|
||||
|
||||
pspec = g_param_spec_internal (GLADE_TYPE_PARAM_OBJECTS,
|
||||
name, nick, blurb, flags);
|
||||
|
||||
pspec->type = accepted_type;
|
||||
return G_PARAM_SPEC (pspec);
|
||||
}
|
||||
|
||||
void
|
||||
glade_param_spec_objects_set_type (GladeParamSpecObjects * pspec, GType type)
|
||||
{
|
||||
pspec->type = type;
|
||||
}
|
||||
|
||||
GType
|
||||
glade_param_spec_objects_get_type (GladeParamSpecObjects * pspec)
|
||||
{
|
||||
return pspec->type;
|
||||
}
|
||||
|
||||
/**
|
||||
* glade_standard_objects_spec:
|
||||
*
|
||||
* This was developed for the purpose of holding a list
|
||||
* of 'targets' in an AtkRelation (we are setting it up
|
||||
* as a property)
|
||||
*
|
||||
* Returns: (transfer full): a #GParamSpec describing a list of #GObject
|
||||
*/
|
||||
GParamSpec *
|
||||
glade_standard_objects_spec (void)
|
||||
{
|
||||
return glade_param_spec_objects ("objects", _("Objects"),
|
||||
_("A list of objects"),
|
||||
G_TYPE_OBJECT, G_PARAM_READWRITE);
|
||||
}
|
||||
|
||||
/**
|
||||
* glade_standard_pixbuf_spec:
|
||||
*
|
||||
* Returns: (transfer full): a #GParamSpec describing a #GdkPixbuf
|
||||
*/
|
||||
GParamSpec *
|
||||
glade_standard_pixbuf_spec (void)
|
||||
{
|
||||
return g_param_spec_object ("pixbuf", _("Image File Name"),
|
||||
_("Enter a filename, relative path or full path to "
|
||||
"load the image"), GDK_TYPE_PIXBUF,
|
||||
G_PARAM_READWRITE);
|
||||
}
|
||||
|
||||
/**
|
||||
* glade_standard_gdkcolor_spec:
|
||||
*
|
||||
* Returns: (transfer full): a #GParamSpec describing a #GdkColor
|
||||
*/
|
||||
GParamSpec *
|
||||
glade_standard_gdkcolor_spec (void)
|
||||
{
|
||||
return g_param_spec_boxed ("gdkcolor", _("Color"),
|
||||
_("A GDK color value"), GDK_TYPE_COLOR,
|
||||
G_PARAM_READWRITE);
|
||||
}
|
||||
|
||||
/****************************************************************
|
||||
* Basic types follow *
|
||||
****************************************************************/
|
||||
|
||||
/**
|
||||
* glade_standard_int_spec:
|
||||
*
|
||||
* Returns: (transfer full): a #GParamSpec describing an int
|
||||
*/
|
||||
GParamSpec *
|
||||
glade_standard_int_spec (void)
|
||||
{
|
||||
return g_param_spec_int ("int", "Integer",
|
||||
"An integer value",
|
||||
G_MININT, G_MAXINT, 0, G_PARAM_READWRITE);
|
||||
}
|
||||
|
||||
/**
|
||||
* glade_standard_uint_spec:
|
||||
*
|
||||
* Returns: (transfer full): a #GParamSpec describing an uint
|
||||
*/
|
||||
GParamSpec *
|
||||
glade_standard_uint_spec (void)
|
||||
{
|
||||
return g_param_spec_uint ("uint", "Unsigned Integer",
|
||||
"An unsigned integer value",
|
||||
0, G_MAXUINT, 0, G_PARAM_READWRITE);
|
||||
}
|
||||
|
||||
/**
|
||||
* glade_standard_string_spec:
|
||||
*
|
||||
* Returns: (transfer full): a #GParamSpec describing a string
|
||||
*/
|
||||
GParamSpec *
|
||||
glade_standard_string_spec (void)
|
||||
{
|
||||
return g_param_spec_string ("string", _("String"),
|
||||
_("An entry"), "", G_PARAM_READWRITE);
|
||||
}
|
||||
|
||||
/**
|
||||
* glade_standard_strv_spec:
|
||||
*
|
||||
* Returns: (transfer full): a #GParamSpec describing an array of strings
|
||||
*/
|
||||
GParamSpec *
|
||||
glade_standard_strv_spec (void)
|
||||
{
|
||||
return g_param_spec_boxed ("strv", "Strv",
|
||||
"String array", G_TYPE_STRV, G_PARAM_READWRITE);
|
||||
}
|
||||
|
||||
/**
|
||||
* glade_standard_float_spec:
|
||||
*
|
||||
* Returns: (transfer full): a #GParamSpec describing a float
|
||||
*/
|
||||
GParamSpec *
|
||||
glade_standard_float_spec (void)
|
||||
{
|
||||
return g_param_spec_float ("float", "Float",
|
||||
"A floating point entry",
|
||||
0.0F, G_MAXFLOAT, 0.0F, G_PARAM_READWRITE);
|
||||
}
|
||||
|
||||
/**
|
||||
* glade_standard_boolean_spec:
|
||||
*
|
||||
* Returns: (transfer full): a #GParamSpec describing a boolean
|
||||
*/
|
||||
GParamSpec *
|
||||
glade_standard_boolean_spec (void)
|
||||
{
|
||||
return g_param_spec_boolean ("boolean", "Boolean",
|
||||
"A boolean value", FALSE, G_PARAM_READWRITE);
|
||||
}
|
@ -1,85 +0,0 @@
|
||||
/*
|
||||
* glade-clipboard.c - An object for handling Cut/Copy/Paste.
|
||||
*
|
||||
* Copyright (C) 2005 The GNOME Foundation.
|
||||
*
|
||||
* Author(s):
|
||||
* Tristan Van Berkom <tvb@gnome.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
* USA.
|
||||
*/
|
||||
|
||||
#ifndef __GLADE_BUILTINS_H__
|
||||
#define __GLADE_BUILTINS_H__
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <gladeui/glade.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef struct _GladeParamSpecObjects GladeParamSpecObjects;
|
||||
|
||||
|
||||
#define GLADE_TYPE_STOCK (glade_standard_stock_get_type())
|
||||
#define GLADE_TYPE_STOCK_IMAGE (glade_standard_stock_image_get_type())
|
||||
#define GLADE_TYPE_GLIST (glade_glist_get_type())
|
||||
#define GLADE_TYPE_PARAM_OBJECTS (glade_param_objects_get_type())
|
||||
|
||||
#define GLADE_IS_STOCK(pspec) \
|
||||
(G_TYPE_CHECK_INSTANCE_TYPE ((pspec), GLADE_TYPE_STOCK))
|
||||
|
||||
#define GLADE_IS_STOCK_IMAGE(pspec) \
|
||||
(G_TYPE_CHECK_INSTANCE_TYPE ((pspec), GLADE_TYPE_STOCK_IMAGE))
|
||||
|
||||
#define GLADE_IS_PARAM_SPEC_OBJECTS(pspec) \
|
||||
(G_TYPE_CHECK_INSTANCE_TYPE ((pspec), \
|
||||
GLADE_TYPE_PARAM_OBJECTS))
|
||||
#define GLADE_PARAM_SPEC_OBJECTS(pspec) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST ((pspec), \
|
||||
GLADE_TYPE_PARAM_OBJECTS, GladeParamSpecObjects))
|
||||
|
||||
GType glade_standard_stock_get_type (void) G_GNUC_CONST;
|
||||
GType glade_standard_stock_image_get_type (void) G_GNUC_CONST;
|
||||
GType glade_glist_get_type (void) G_GNUC_CONST;
|
||||
GType glade_param_objects_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GParamSpec *glade_param_spec_objects (const gchar *name,
|
||||
const gchar *nick,
|
||||
const gchar *blurb,
|
||||
GType accepted_type,
|
||||
GParamFlags flags);
|
||||
|
||||
void glade_param_spec_objects_set_type (GladeParamSpecObjects *pspec,
|
||||
GType type);
|
||||
GType glade_param_spec_objects_get_type (GladeParamSpecObjects *pspec);
|
||||
|
||||
GParamSpec *glade_standard_pixbuf_spec (void);
|
||||
GParamSpec *glade_standard_gdkcolor_spec (void);
|
||||
GParamSpec *glade_standard_objects_spec (void);
|
||||
GParamSpec *glade_standard_stock_spec (void);
|
||||
GParamSpec *glade_standard_stock_image_spec (void);
|
||||
GParamSpec *glade_standard_int_spec (void);
|
||||
GParamSpec *glade_standard_uint_spec (void);
|
||||
GParamSpec *glade_standard_string_spec (void);
|
||||
GParamSpec *glade_standard_strv_spec (void);
|
||||
GParamSpec *glade_standard_float_spec (void);
|
||||
GParamSpec *glade_standard_boolean_spec (void);
|
||||
|
||||
void glade_standard_stock_append_prefix (const gchar *prefix);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GLADE_BUILTINS_H__ */
|
@ -1,91 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2001 Ximian, Inc.
|
||||
* Copyright (C) 2004 Imendio AB
|
||||
* Copyright (C) 2007 The GNOME Foundation
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef __GLADE_CATALOG_H__
|
||||
#define __GLADE_CATALOG_H__
|
||||
|
||||
#include <glib.h>
|
||||
#include <gladeui/glade-xml-utils.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GLADE_CATALOG(c) ((GladeCatalog *) c)
|
||||
#define GLADE_IS_CATALOG(c) (c != NULL)
|
||||
|
||||
|
||||
#define GLADE_WIDGET_GROUP(g) ((GladeWidgetGroup *) g)
|
||||
#define GLADE_IS_WIDGET_GROUP(g) (g != NULL)
|
||||
|
||||
typedef struct _GladeCatalog GladeCatalog;
|
||||
typedef struct _GladeWidgetGroup GladeWidgetGroup;
|
||||
|
||||
|
||||
/**
|
||||
* GladeCatalogInitFunc:
|
||||
* @name: The name of the catalog
|
||||
*
|
||||
* Called once at glade startup time for every catalog, catalogs
|
||||
* are initialized in order of dependencies.
|
||||
*/
|
||||
typedef void (*GladeCatalogInitFunc) (const gchar *name);
|
||||
|
||||
|
||||
typedef struct {
|
||||
gint major;
|
||||
gint minor;
|
||||
} GladeTargetableVersion;
|
||||
|
||||
|
||||
void glade_catalog_add_path (const gchar *path);
|
||||
void glade_catalog_remove_path (const gchar *path);
|
||||
const GList *glade_catalog_get_extra_paths (void);
|
||||
const GList *glade_catalog_load_all (void);
|
||||
|
||||
const gchar *glade_catalog_get_name (GladeCatalog *catalog);
|
||||
const gchar *glade_catalog_get_prefix (GladeCatalog *catalog);
|
||||
const gchar *glade_catalog_get_icon_prefix(GladeCatalog *catalog);
|
||||
const gchar *glade_catalog_get_domain (GladeCatalog *catalog);
|
||||
const gchar *glade_catalog_get_book (GladeCatalog *catalog);
|
||||
|
||||
GList *glade_catalog_get_targets (GladeCatalog *catalog);
|
||||
|
||||
guint16 glade_catalog_get_major_version (GladeCatalog *catalog);
|
||||
guint16 glade_catalog_get_minor_version (GladeCatalog *catalog);
|
||||
|
||||
GList *glade_catalog_get_widget_groups (GladeCatalog *catalog);
|
||||
|
||||
GList *glade_catalog_get_adaptors (GladeCatalog *catalog);
|
||||
|
||||
gboolean glade_catalog_is_loaded (const gchar *name);
|
||||
|
||||
void glade_catalog_destroy_all (void);
|
||||
|
||||
|
||||
const gchar *glade_widget_group_get_name (GladeWidgetGroup *group);
|
||||
|
||||
const gchar *glade_widget_group_get_title (GladeWidgetGroup *group);
|
||||
|
||||
gboolean glade_widget_group_get_expanded (GladeWidgetGroup *group);
|
||||
|
||||
const GList *glade_widget_group_get_adaptors (GladeWidgetGroup *group);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GLADE_CATALOG_H__ */
|
@ -1,239 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2008 Tristan Van Berkom.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Authors:
|
||||
* Tristan Van Berkom <tvb@gnome.org>
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "glade-cell-renderer-icon.h"
|
||||
#include "glade-marshallers.h"
|
||||
|
||||
static void glade_cell_renderer_icon_get_property (GObject *object,
|
||||
guint param_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void glade_cell_renderer_icon_set_property (GObject *object,
|
||||
guint param_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static gboolean glade_cell_renderer_icon_activate (GtkCellRenderer *cell,
|
||||
GdkEvent *event,
|
||||
GtkWidget *widget,
|
||||
const gchar *path,
|
||||
const GdkRectangle *background_area,
|
||||
const GdkRectangle *cell_area,
|
||||
GtkCellRendererState flags);
|
||||
|
||||
typedef struct _GladeCellRendererIconPrivate
|
||||
{
|
||||
guint active : 1;
|
||||
guint activatable : 1;
|
||||
} GladeCellRendererIconPrivate;
|
||||
|
||||
enum
|
||||
{
|
||||
ACTIVATE,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_ACTIVATABLE,
|
||||
PROP_ACTIVE,
|
||||
N_PROPERTIES
|
||||
};
|
||||
|
||||
static GParamSpec *properties[N_PROPERTIES];
|
||||
static guint icon_cell_signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (GladeCellRendererIcon,
|
||||
glade_cell_renderer_icon,
|
||||
GTK_TYPE_CELL_RENDERER_PIXBUF)
|
||||
|
||||
static void glade_cell_renderer_icon_init (GladeCellRendererIcon *cellicon)
|
||||
{
|
||||
GladeCellRendererIconPrivate *priv = glade_cell_renderer_icon_get_instance_private (cellicon);
|
||||
|
||||
priv->activatable = TRUE;
|
||||
priv->active = FALSE;
|
||||
|
||||
g_object_set (G_OBJECT (cellicon), "mode", GTK_CELL_RENDERER_MODE_ACTIVATABLE,
|
||||
NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
glade_cell_renderer_icon_class_init (GladeCellRendererIconClass *class)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (class);
|
||||
GtkCellRendererClass *cell_class = GTK_CELL_RENDERER_CLASS (class);
|
||||
|
||||
object_class->get_property = glade_cell_renderer_icon_get_property;
|
||||
object_class->set_property = glade_cell_renderer_icon_set_property;
|
||||
|
||||
cell_class->activate = glade_cell_renderer_icon_activate;
|
||||
|
||||
properties[PROP_ACTIVE] =
|
||||
g_param_spec_boolean ("active", "Icon state",
|
||||
"The icon state of the button",
|
||||
FALSE,
|
||||
G_PARAM_READABLE | G_PARAM_WRITABLE);
|
||||
|
||||
properties[PROP_ACTIVATABLE] =
|
||||
g_param_spec_boolean ("activatable",
|
||||
"Activatable",
|
||||
"The icon button can be activated",
|
||||
TRUE,
|
||||
G_PARAM_READABLE | G_PARAM_WRITABLE);
|
||||
|
||||
/* Install all properties */
|
||||
g_object_class_install_properties (object_class, N_PROPERTIES, properties);
|
||||
|
||||
icon_cell_signals[ACTIVATE] =
|
||||
g_signal_new ("activate",
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GladeCellRendererIconClass, activate),
|
||||
NULL, NULL,
|
||||
_glade_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING);
|
||||
}
|
||||
|
||||
static void
|
||||
glade_cell_renderer_icon_get_property (GObject *object,
|
||||
guint param_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GladeCellRendererIcon *cellicon = GLADE_CELL_RENDERER_ICON (object);
|
||||
GladeCellRendererIconPrivate *priv = glade_cell_renderer_icon_get_instance_private (cellicon);
|
||||
|
||||
switch (param_id)
|
||||
{
|
||||
case PROP_ACTIVE:
|
||||
g_value_set_boolean (value, priv->active);
|
||||
break;
|
||||
case PROP_ACTIVATABLE:
|
||||
g_value_set_boolean (value, priv->activatable);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
glade_cell_renderer_icon_set_property (GObject *object,
|
||||
guint param_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GladeCellRendererIcon *cellicon = GLADE_CELL_RENDERER_ICON (object);
|
||||
GladeCellRendererIconPrivate *priv = glade_cell_renderer_icon_get_instance_private (cellicon);
|
||||
|
||||
switch (param_id)
|
||||
{
|
||||
case PROP_ACTIVE:
|
||||
priv->active = g_value_get_boolean (value);
|
||||
break;
|
||||
case PROP_ACTIVATABLE:
|
||||
priv->activatable = g_value_get_boolean (value);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
GtkCellRenderer *
|
||||
glade_cell_renderer_icon_new (void)
|
||||
{
|
||||
return g_object_new (GLADE_TYPE_CELL_RENDERER_ICON, NULL);
|
||||
}
|
||||
|
||||
static gint
|
||||
glade_cell_renderer_icon_activate (GtkCellRenderer *cell,
|
||||
GdkEvent *event,
|
||||
GtkWidget *widget,
|
||||
const gchar *path,
|
||||
const GdkRectangle *background_area,
|
||||
const GdkRectangle *cell_area,
|
||||
GtkCellRendererState flags)
|
||||
{
|
||||
GladeCellRendererIcon *cellicon = GLADE_CELL_RENDERER_ICON (cell);
|
||||
GladeCellRendererIconPrivate *priv = glade_cell_renderer_icon_get_instance_private (cellicon);
|
||||
|
||||
if (priv->activatable)
|
||||
{
|
||||
g_signal_emit (cell, icon_cell_signals[ACTIVATE], 0, path);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
glade_cell_renderer_icon_get_active (GladeCellRendererIcon *icon)
|
||||
{
|
||||
GladeCellRendererIconPrivate *priv = glade_cell_renderer_icon_get_instance_private (icon);
|
||||
|
||||
g_return_val_if_fail (GLADE_IS_CELL_RENDERER_ICON (icon), FALSE);
|
||||
|
||||
return priv->active;
|
||||
}
|
||||
|
||||
void
|
||||
glade_cell_renderer_icon_set_active (GladeCellRendererIcon *icon,
|
||||
gboolean setting)
|
||||
{
|
||||
GladeCellRendererIconPrivate *priv = glade_cell_renderer_icon_get_instance_private (icon);
|
||||
|
||||
g_return_if_fail (GLADE_IS_CELL_RENDERER_ICON (icon));
|
||||
|
||||
if (priv->active != setting)
|
||||
{
|
||||
priv->active = setting ? TRUE : FALSE;
|
||||
g_object_notify_by_pspec (G_OBJECT (icon), properties[PROP_ACTIVE]);
|
||||
}
|
||||
}
|
||||
|
||||
gboolean
|
||||
glade_cell_renderer_icon_get_activatable (GladeCellRendererIcon *icon)
|
||||
{
|
||||
GladeCellRendererIconPrivate *priv = glade_cell_renderer_icon_get_instance_private (icon);
|
||||
|
||||
g_return_val_if_fail (GLADE_IS_CELL_RENDERER_ICON (icon), FALSE);
|
||||
|
||||
return priv->activatable;
|
||||
}
|
||||
|
||||
void
|
||||
glade_cell_renderer_icon_set_activatable (GladeCellRendererIcon *icon,
|
||||
gboolean setting)
|
||||
{
|
||||
GladeCellRendererIconPrivate *priv = glade_cell_renderer_icon_get_instance_private (icon);
|
||||
|
||||
g_return_if_fail (GLADE_IS_CELL_RENDERER_ICON (icon));
|
||||
|
||||
if (priv->activatable != setting)
|
||||
{
|
||||
priv->activatable = setting ? TRUE : FALSE;
|
||||
g_object_notify_by_pspec (G_OBJECT (icon), properties[PROP_ACTIVATABLE]);
|
||||
}
|
||||
}
|
@ -1,54 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2010 Tristan Van Berkom.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Authors:
|
||||
* Tristan Van Berkom <tvb@gnome.org>
|
||||
*/
|
||||
|
||||
#ifndef __GLADE_CELL_RENDERER_ICON_H__
|
||||
#define __GLADE_CELL_RENDERER_ICON_H__
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GLADE_TYPE_CELL_RENDERER_ICON glade_cell_renderer_icon_get_type ()
|
||||
G_DECLARE_DERIVABLE_TYPE (GladeCellRendererIcon, glade_cell_renderer_icon, GLADE, CELL_RENDERER_ICON, GtkCellRendererPixbuf)
|
||||
|
||||
struct _GladeCellRendererIconClass
|
||||
{
|
||||
GtkCellRendererPixbufClass parent_class;
|
||||
|
||||
void (* activate) (GladeCellRendererIcon *cell_renderer_icon,
|
||||
const gchar *path);
|
||||
};
|
||||
|
||||
GtkCellRenderer *glade_cell_renderer_icon_new (void);
|
||||
|
||||
gboolean glade_cell_renderer_icon_get_active (GladeCellRendererIcon *icon);
|
||||
void glade_cell_renderer_icon_set_active (GladeCellRendererIcon *icon,
|
||||
gboolean setting);
|
||||
|
||||
gboolean glade_cell_renderer_icon_get_activatable (GladeCellRendererIcon *icon);
|
||||
void glade_cell_renderer_icon_set_activatable (GladeCellRendererIcon *icon,
|
||||
gboolean setting);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GLADE_CELL_RENDERER_ICON_H__ */
|
@ -1,224 +0,0 @@
|
||||
/*
|
||||
* glade-clipboard.c - An object for handling Cut/Copy/Paste.
|
||||
*
|
||||
* Copyright (C) 2001 The GNOME Foundation.
|
||||
*
|
||||
* Author(s):
|
||||
* Archit Baweja <bighead@users.sourceforge.net>
|
||||
*
|
||||
* 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 "config.h"
|
||||
|
||||
/**
|
||||
* SECTION:glade-clipboard
|
||||
* @Short_Description: A list of #GladeWidget objects not in any #GladeProject.
|
||||
*
|
||||
* The #GladeClipboard is a singleton and is an accumulative shelf
|
||||
* of all cut or copied #GladeWidget in the application. A #GladeWidget
|
||||
* can be cut from one #GladeProject and pasted to another.
|
||||
*/
|
||||
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include "glade.h"
|
||||
#include "glade-clipboard.h"
|
||||
#include "glade-widget.h"
|
||||
#include "glade-placeholder.h"
|
||||
#include "glade-project.h"
|
||||
|
||||
typedef struct _GladeClipboardPrivate
|
||||
{
|
||||
GList *widgets; /* A list of GladeWidget's on the clipboard */
|
||||
gboolean has_selection; /* TRUE if clipboard has selection */
|
||||
} GladeClipboardPrivate;
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_HAS_SELECTION,
|
||||
N_PROPERTIES
|
||||
};
|
||||
|
||||
static GParamSpec *properties[N_PROPERTIES];
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (GladeClipboard, glade_clipboard, G_TYPE_OBJECT)
|
||||
|
||||
static void
|
||||
glade_project_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GladeClipboard *clipboard = GLADE_CLIPBOARD (object);
|
||||
GladeClipboardPrivate *priv = glade_clipboard_get_instance_private (clipboard);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_HAS_SELECTION:
|
||||
g_value_set_boolean (value, priv->has_selection);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
glade_clipboard_class_init (GladeClipboardClass * klass)
|
||||
{
|
||||
GObjectClass *object_class;
|
||||
|
||||
object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->get_property = glade_project_get_property;
|
||||
|
||||
properties[PROP_HAS_SELECTION] =
|
||||
g_param_spec_boolean ("has-selection",
|
||||
"Has Selection",
|
||||
"Whether clipboard has a selection of items to paste",
|
||||
FALSE,
|
||||
G_PARAM_READABLE);
|
||||
|
||||
/* Install all properties */
|
||||
g_object_class_install_properties (object_class, N_PROPERTIES, properties);
|
||||
}
|
||||
|
||||
static void
|
||||
glade_clipboard_init (GladeClipboard *clipboard)
|
||||
{
|
||||
GladeClipboardPrivate *priv = glade_clipboard_get_instance_private (clipboard);
|
||||
|
||||
priv->widgets = NULL;
|
||||
priv->has_selection = FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
glade_clipboard_set_has_selection (GladeClipboard *clipboard,
|
||||
gboolean has_selection)
|
||||
{
|
||||
GladeClipboardPrivate *priv = glade_clipboard_get_instance_private (clipboard);
|
||||
|
||||
if (priv->has_selection != has_selection)
|
||||
{
|
||||
priv->has_selection = has_selection;
|
||||
g_object_notify_by_pspec (G_OBJECT (clipboard), properties[PROP_HAS_SELECTION]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* glade_clipboard_get_has_selection:
|
||||
* @clipboard: a #GladeClipboard
|
||||
*
|
||||
* Returns: TRUE if this clipboard has selected items to paste.
|
||||
*/
|
||||
gboolean
|
||||
glade_clipboard_get_has_selection (GladeClipboard *clipboard)
|
||||
{
|
||||
GladeClipboardPrivate *priv = glade_clipboard_get_instance_private (clipboard);
|
||||
|
||||
g_return_val_if_fail (GLADE_IS_CLIPBOARD (clipboard), FALSE);
|
||||
|
||||
return priv->has_selection;
|
||||
}
|
||||
|
||||
/**
|
||||
* glade_clipboard_widgets:
|
||||
* @clipboard: a #GladeClipboard
|
||||
*
|
||||
* Returns: (element-type GladeWidget) (transfer none): a #GList of #GladeWidgets
|
||||
*/
|
||||
GList *
|
||||
glade_clipboard_widgets (GladeClipboard *clipboard)
|
||||
{
|
||||
GladeClipboardPrivate *priv = glade_clipboard_get_instance_private (clipboard);
|
||||
|
||||
g_return_val_if_fail (GLADE_IS_CLIPBOARD (clipboard), NULL);
|
||||
|
||||
return priv->widgets;
|
||||
}
|
||||
|
||||
/**
|
||||
* glade_clipboard_new:
|
||||
*
|
||||
* Returns: a new #GladeClipboard object
|
||||
*/
|
||||
GladeClipboard *
|
||||
glade_clipboard_new (void)
|
||||
{
|
||||
return GLADE_CLIPBOARD (g_object_new (GLADE_TYPE_CLIPBOARD, NULL));
|
||||
}
|
||||
|
||||
/**
|
||||
* glade_clipboard_add:
|
||||
* @clipboard: a #GladeClipboard
|
||||
* @widgets: (element-type GladeWidget): a #GList of #GladeWidgets
|
||||
*
|
||||
* Adds @widgets to @clipboard.
|
||||
* This increases the reference count of each #GladeWidget in @widgets.
|
||||
*/
|
||||
void
|
||||
glade_clipboard_add (GladeClipboard *clipboard, GList *widgets)
|
||||
{
|
||||
GladeClipboardPrivate *priv = glade_clipboard_get_instance_private (clipboard);
|
||||
GladeWidget *widget;
|
||||
GList *list;
|
||||
|
||||
g_return_if_fail (GLADE_IS_CLIPBOARD (clipboard));
|
||||
|
||||
glade_clipboard_clear (clipboard);
|
||||
|
||||
/*
|
||||
* Add the widgets to the list of children.
|
||||
*/
|
||||
for (list = widgets; list && list->data; list = list->next)
|
||||
{
|
||||
widget = list->data;
|
||||
priv->widgets =
|
||||
g_list_prepend (priv->widgets, g_object_ref_sink (G_OBJECT (widget)));
|
||||
}
|
||||
|
||||
glade_clipboard_set_has_selection (clipboard, TRUE);
|
||||
}
|
||||
|
||||
/**
|
||||
* glade_clipboard_clear:
|
||||
* @clipboard: a #GladeClipboard
|
||||
*
|
||||
* Removes all widgets from the @clipboard.
|
||||
*/
|
||||
void
|
||||
glade_clipboard_clear (GladeClipboard *clipboard)
|
||||
{
|
||||
GladeClipboardPrivate *priv = glade_clipboard_get_instance_private (clipboard);
|
||||
GladeWidget *widget;
|
||||
GList *list;
|
||||
|
||||
g_return_if_fail (GLADE_IS_CLIPBOARD (clipboard));
|
||||
|
||||
for (list = priv->widgets; list && list->data; list = list->next)
|
||||
{
|
||||
widget = list->data;
|
||||
|
||||
g_object_unref (G_OBJECT (widget));
|
||||
}
|
||||
|
||||
priv->widgets =
|
||||
(g_list_free (priv->widgets), NULL);
|
||||
|
||||
glade_clipboard_set_has_selection (clipboard, FALSE);
|
||||
}
|
@ -1,52 +0,0 @@
|
||||
/*
|
||||
* glade-clipboard.h
|
||||
*
|
||||
* Copyright (C) 2001 The GNOME Foundation.
|
||||
*
|
||||
* Author(s):
|
||||
* Archit Baweja <bighead@users.sourceforge.net>
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef __GLADE_CLIPBOARD_H__
|
||||
#define __GLADE_CLIPBOARD_H__
|
||||
|
||||
#include <gladeui/glade.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GLADE_TYPE_CLIPBOARD glade_clipboard_get_type ()
|
||||
G_DECLARE_DERIVABLE_TYPE (GladeClipboard, glade_clipboard, GLADE, CLIPBOARD, GObject)
|
||||
|
||||
struct _GladeClipboardClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
|
||||
gpointer padding[4];
|
||||
};
|
||||
|
||||
GladeClipboard *glade_clipboard_new (void);
|
||||
void glade_clipboard_add (GladeClipboard *clipboard,
|
||||
GList *widgets);
|
||||
void glade_clipboard_clear (GladeClipboard *clipboard);
|
||||
|
||||
gboolean glade_clipboard_get_has_selection(GladeClipboard *clipboard);
|
||||
GList *glade_clipboard_widgets (GladeClipboard *clipboard);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GLADE_CLIPBOARD_H__ */
|
@ -1,182 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2002 Joaquín Cuenca Abela
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Authors:
|
||||
* Joaquín Cuenca Abela <e98cuenc@yahoo.com>
|
||||
* Archit Baweja <bighead@users.sourceforge.net>
|
||||
*/
|
||||
|
||||
#ifndef __GLADE_COMMAND_H__
|
||||
#define __GLADE_COMMAND_H__
|
||||
|
||||
#include <gladeui/glade-placeholder.h>
|
||||
#include <gladeui/glade-widget.h>
|
||||
#include <gladeui/glade-signal.h>
|
||||
#include <gladeui/glade-property.h>
|
||||
#include <gladeui/glade-project.h>
|
||||
#include <glib-object.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GLADE_TYPE_COMMAND glade_command_get_type ()
|
||||
G_DECLARE_DERIVABLE_TYPE (GladeCommand, glade_command, GLADE, COMMAND, GObject)
|
||||
|
||||
typedef struct _GladeCommandSetPropData GladeCommandSetPropData;
|
||||
|
||||
/**
|
||||
* GladeCommandSetPropData
|
||||
* @property: A #GladeProperty to set
|
||||
* @new_value: The new #GValue to assign to @property
|
||||
* @old_value: The old #GValue of @property
|
||||
*
|
||||
* #GladeProperty can be set in a list as one command,
|
||||
* for Undo purposes; we store the list of #GladeCommandSetPropData with
|
||||
* their old and new #GValue.
|
||||
*/
|
||||
struct _GladeCommandSetPropData {
|
||||
GladeProperty *property;
|
||||
GValue *new_value;
|
||||
GValue *old_value;
|
||||
};
|
||||
|
||||
struct _GladeCommandClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
|
||||
gboolean (* execute) (GladeCommand *command);
|
||||
gboolean (* undo) (GladeCommand *command);
|
||||
gboolean (* unifies) (GladeCommand *command, GladeCommand *other);
|
||||
void (* collapse) (GladeCommand *command, GladeCommand *other);
|
||||
|
||||
gpointer padding[4];
|
||||
};
|
||||
|
||||
void glade_command_push_group (const gchar *fmt,
|
||||
...) G_GNUC_PRINTF (1, 2);
|
||||
void glade_command_pop_group (void);
|
||||
gint glade_command_get_group_depth (void);
|
||||
|
||||
const gchar *glade_command_description (GladeCommand *command);
|
||||
gint glade_command_group_id (GladeCommand *command);
|
||||
gboolean glade_command_execute (GladeCommand *command);
|
||||
gboolean glade_command_undo (GladeCommand *command);
|
||||
gboolean glade_command_unifies (GladeCommand *command,
|
||||
GladeCommand *other);
|
||||
void glade_command_collapse (GladeCommand *command,
|
||||
GladeCommand *other);
|
||||
|
||||
/************************ project ******************************/
|
||||
void glade_command_set_project_target (GladeProject *project,
|
||||
const gchar *catalog,
|
||||
gint major,
|
||||
gint minor);
|
||||
|
||||
void glade_command_set_project_domain (GladeProject *project,
|
||||
const gchar *domain);
|
||||
|
||||
void glade_command_set_project_template(GladeProject *project,
|
||||
GladeWidget *widget);
|
||||
|
||||
void glade_command_set_project_license (GladeProject *project,
|
||||
const gchar *license);
|
||||
|
||||
void glade_command_set_project_resource_path (GladeProject *project,
|
||||
const gchar *path);
|
||||
|
||||
/************************** properties *********************************/
|
||||
|
||||
void glade_command_set_property_enabled(GladeProperty *property,
|
||||
gboolean enabled);
|
||||
|
||||
void glade_command_set_property (GladeProperty *property,
|
||||
...);
|
||||
|
||||
void glade_command_set_property_value (GladeProperty *property,
|
||||
const GValue *value);
|
||||
|
||||
void glade_command_set_properties (GladeProperty *property,
|
||||
const GValue *old_value,
|
||||
const GValue *new_value,
|
||||
...);
|
||||
|
||||
void glade_command_set_properties_list (GladeProject *project,
|
||||
GList *props); /* list of GladeCommandSetPropData */
|
||||
|
||||
/************************** name ******************************/
|
||||
|
||||
void glade_command_set_name (GladeWidget *glade_widget, const gchar *name);
|
||||
|
||||
|
||||
/************************ protection ******************************/
|
||||
|
||||
void glade_command_lock_widget (GladeWidget *widget,
|
||||
GladeWidget *locked);
|
||||
|
||||
void glade_command_unlock_widget (GladeWidget *widget);
|
||||
|
||||
|
||||
/************************ create/add/delete ******************************/
|
||||
|
||||
void glade_command_add (GList *widgets,
|
||||
GladeWidget *parent,
|
||||
GladePlaceholder *placeholder,
|
||||
GladeProject *project,
|
||||
gboolean pasting);
|
||||
|
||||
void glade_command_delete (GList *widgets);
|
||||
|
||||
GladeWidget *glade_command_create (GladeWidgetAdaptor *adaptor,
|
||||
GladeWidget *parent,
|
||||
GladePlaceholder *placeholder,
|
||||
GladeProject *project);
|
||||
|
||||
/************************ cut/paste/dnd ******************************/
|
||||
|
||||
void glade_command_cut (GList *widgets);
|
||||
|
||||
void glade_command_paste (GList *widgets,
|
||||
GladeWidget *parent,
|
||||
GladePlaceholder *placeholder,
|
||||
GladeProject *project);
|
||||
|
||||
void glade_command_dnd (GList *widgets,
|
||||
GladeWidget *parent,
|
||||
GladePlaceholder *placeholder);
|
||||
|
||||
/************************ signals ******************************/
|
||||
|
||||
void glade_command_add_signal (GladeWidget *glade_widget,
|
||||
const GladeSignal *signal);
|
||||
|
||||
void glade_command_remove_signal (GladeWidget *glade_widget,
|
||||
const GladeSignal *signal);
|
||||
|
||||
void glade_command_change_signal (GladeWidget *glade_widget,
|
||||
const GladeSignal *old_signal,
|
||||
const GladeSignal *new_signal);
|
||||
|
||||
/************************ set i18n ******************************/
|
||||
|
||||
void glade_command_set_i18n (GladeProperty *property,
|
||||
gboolean translatable,
|
||||
const gchar *context,
|
||||
const gchar *comment);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GLADE_COMMAND_H__ */
|
@ -1,200 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2001 Ximian, Inc.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Authors:
|
||||
* Chema Celorio <chema@celorio.com>
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "glade-app.h"
|
||||
#include "glade-palette.h"
|
||||
#include "glade-cursor.h"
|
||||
#include "glade-widget-adaptor.h"
|
||||
|
||||
#include <glib.h>
|
||||
#include <glib/gi18n.h>
|
||||
|
||||
#define ADD_PIXBUF_FILENAME "plus.png"
|
||||
|
||||
static GladeCursor *cursor = NULL;
|
||||
|
||||
static void
|
||||
set_cursor_recurse (GtkWidget * widget, GdkCursor * gdk_cursor)
|
||||
{
|
||||
GList *children, *list;
|
||||
|
||||
if (!gtk_widget_get_visible (widget) || !gtk_widget_get_realized (widget))
|
||||
return;
|
||||
|
||||
gdk_window_set_cursor (gtk_widget_get_window (widget), gdk_cursor);
|
||||
|
||||
if (GTK_IS_CONTAINER (widget) &&
|
||||
(children =
|
||||
glade_util_container_get_all_children (GTK_CONTAINER (widget))) != NULL)
|
||||
{
|
||||
for (list = children; list; list = list->next)
|
||||
{
|
||||
set_cursor_recurse (GTK_WIDGET (list->data), gdk_cursor);
|
||||
}
|
||||
g_list_free (children);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
set_cursor (GladeProject *project,
|
||||
GdkCursor *gdk_cursor)
|
||||
{
|
||||
GList *list;
|
||||
|
||||
for (list = (GList *) glade_project_get_objects (project);
|
||||
list; list = list->next)
|
||||
{
|
||||
GObject *object = list->data;
|
||||
|
||||
if (GTK_IS_WIDGET (object) &&
|
||||
gtk_widget_get_has_window (GTK_WIDGET (object)))
|
||||
{
|
||||
set_cursor_recurse (GTK_WIDGET (object), gdk_cursor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* glade_cursor_set:
|
||||
* @window: a #GdkWindow
|
||||
* @type: a #GladeCursorType
|
||||
*
|
||||
* Sets the cursor for @window to something appropriate based on @type.
|
||||
* (also sets the cursor on all visible project widgets)
|
||||
*/
|
||||
void
|
||||
glade_cursor_set (GladeProject *project,
|
||||
GdkWindow *window,
|
||||
GladeCursorType type)
|
||||
{
|
||||
GladeWidgetAdaptor *adaptor;
|
||||
GdkCursor *the_cursor = NULL;
|
||||
g_return_if_fail (cursor != NULL);
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case GLADE_CURSOR_SELECTOR:
|
||||
the_cursor = cursor->selector;
|
||||
break;
|
||||
case GLADE_CURSOR_ADD_WIDGET:
|
||||
if ((adaptor =
|
||||
glade_project_get_add_item (project)) != NULL)
|
||||
{
|
||||
g_object_get (adaptor, "cursor", &the_cursor, NULL);
|
||||
|
||||
if (the_cursor == NULL)
|
||||
the_cursor = cursor->add_widget;
|
||||
}
|
||||
else
|
||||
the_cursor = cursor->add_widget;
|
||||
break;
|
||||
case GLADE_CURSOR_RESIZE_TOP_LEFT:
|
||||
the_cursor = cursor->resize_top_left;
|
||||
break;
|
||||
case GLADE_CURSOR_RESIZE_TOP_RIGHT:
|
||||
the_cursor = cursor->resize_top_right;
|
||||
break;
|
||||
case GLADE_CURSOR_RESIZE_BOTTOM_LEFT:
|
||||
the_cursor = cursor->resize_bottom_left;
|
||||
break;
|
||||
case GLADE_CURSOR_RESIZE_BOTTOM_RIGHT:
|
||||
the_cursor = cursor->resize_bottom_right;
|
||||
break;
|
||||
case GLADE_CURSOR_RESIZE_LEFT:
|
||||
the_cursor = cursor->resize_left;
|
||||
break;
|
||||
case GLADE_CURSOR_RESIZE_RIGHT:
|
||||
the_cursor = cursor->resize_right;
|
||||
break;
|
||||
case GLADE_CURSOR_RESIZE_TOP:
|
||||
the_cursor = cursor->resize_top;
|
||||
break;
|
||||
case GLADE_CURSOR_RESIZE_BOTTOM:
|
||||
the_cursor = cursor->resize_bottom;
|
||||
break;
|
||||
case GLADE_CURSOR_DRAG:
|
||||
the_cursor = cursor->drag;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (the_cursor != gdk_window_get_cursor (window))
|
||||
{
|
||||
set_cursor (project, cursor->selector);
|
||||
gdk_window_set_cursor (window, the_cursor);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* glade_cursor_init:
|
||||
*
|
||||
* Initializes cursors for use with glade_cursor_set().
|
||||
*/
|
||||
void
|
||||
glade_cursor_init (void)
|
||||
{
|
||||
gchar *path;
|
||||
GError *error = NULL;
|
||||
GdkDisplay *display;
|
||||
|
||||
cursor = g_new0 (GladeCursor, 1);
|
||||
display = gdk_display_get_default ();
|
||||
|
||||
cursor->selector = NULL;
|
||||
cursor->add_widget = gdk_cursor_new_from_name (display, "crosshair");
|
||||
cursor->resize_top_left = gdk_cursor_new_from_name (display, "nw-resize");
|
||||
cursor->resize_top_right = gdk_cursor_new_from_name (display, "ne-resize");
|
||||
cursor->resize_bottom_left = gdk_cursor_new_from_name (display, "sw-resize");
|
||||
cursor->resize_bottom_right = gdk_cursor_new_from_name (display, "se-resize");
|
||||
cursor->resize_left = gdk_cursor_new_from_name (display, "w-resize");
|
||||
cursor->resize_right = gdk_cursor_new_from_name (display, "e-resize");
|
||||
cursor->resize_top = gdk_cursor_new_from_name (display, "n-resize");
|
||||
cursor->resize_bottom = gdk_cursor_new_from_name (display, "s-resize");
|
||||
cursor->drag = gdk_cursor_new_from_name (display, "move");
|
||||
cursor->add_widget_pixbuf = NULL;
|
||||
|
||||
/* load "add" cursor pixbuf */
|
||||
path =
|
||||
g_build_filename (glade_app_get_pixmaps_dir (), ADD_PIXBUF_FILENAME,
|
||||
NULL);
|
||||
|
||||
cursor->add_widget_pixbuf = gdk_pixbuf_new_from_file (path, &error);
|
||||
|
||||
if (cursor->add_widget_pixbuf == NULL)
|
||||
{
|
||||
g_critical (_("Unable to load image (%s)"), error->message);
|
||||
|
||||
g_error_free (error);
|
||||
error = NULL;
|
||||
}
|
||||
g_free (path);
|
||||
}
|
||||
|
||||
const GdkPixbuf *
|
||||
glade_cursor_get_add_widget_pixbuf (void)
|
||||
{
|
||||
g_return_val_if_fail (cursor != NULL, NULL);
|
||||
|
||||
return cursor->add_widget_pixbuf;
|
||||
}
|
@ -1,77 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2001 Ximian, Inc.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Authors:
|
||||
* Chema Celorio <chema@celorio.com>
|
||||
*/
|
||||
|
||||
#ifndef __GLADE_CURSOR_H__
|
||||
#define __GLADE_CURSOR_H__
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/* GladeCursor is just a structures that has a pointer to all the cursors
|
||||
* that we are going to use. The benefit of this struct is that once
|
||||
* glade_cursor_init is called you just need to call glade_cursor_set
|
||||
* with it's enumed value to set the window cursor.
|
||||
*/
|
||||
|
||||
/* Has a pointer to the loaded GdkCursors. It is loaded when _init
|
||||
* is called
|
||||
*/
|
||||
typedef struct _GladeCursor {
|
||||
GdkCursor *selector;
|
||||
GdkCursor *add_widget; /* fallback cursor if we cannot use widget_class->cursor */
|
||||
GdkCursor *resize_top_left;
|
||||
GdkCursor *resize_top_right;
|
||||
GdkCursor *resize_bottom_left;
|
||||
GdkCursor *resize_bottom_right;
|
||||
GdkCursor *resize_left;
|
||||
GdkCursor *resize_right;
|
||||
GdkCursor *resize_top;
|
||||
GdkCursor *resize_bottom;
|
||||
GdkCursor *drag;
|
||||
|
||||
GdkPixbuf *add_widget_pixbuf; /* a pixbuf of the generic 'add' cursor */
|
||||
} GladeCursor;
|
||||
|
||||
/* Enumed values for each of the cursors for GladeCursor. For every
|
||||
* GdkCursor above there should be a enum here
|
||||
*/
|
||||
typedef enum {
|
||||
GLADE_CURSOR_SELECTOR,
|
||||
GLADE_CURSOR_ADD_WIDGET,
|
||||
GLADE_CURSOR_RESIZE_TOP_LEFT,
|
||||
GLADE_CURSOR_RESIZE_TOP_RIGHT,
|
||||
GLADE_CURSOR_RESIZE_BOTTOM_LEFT,
|
||||
GLADE_CURSOR_RESIZE_BOTTOM_RIGHT,
|
||||
GLADE_CURSOR_RESIZE_LEFT,
|
||||
GLADE_CURSOR_RESIZE_RIGHT,
|
||||
GLADE_CURSOR_RESIZE_TOP,
|
||||
GLADE_CURSOR_RESIZE_BOTTOM,
|
||||
GLADE_CURSOR_DRAG
|
||||
} GladeCursorType;
|
||||
|
||||
void glade_cursor_init (void);
|
||||
void glade_cursor_set (GladeProject *project,
|
||||
GdkWindow *window,
|
||||
GladeCursorType type);
|
||||
const GdkPixbuf* glade_cursor_get_add_widget_pixbuf (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GLADE_CURSOR_H__ */
|
@ -1,107 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2003 Joaquin Cuenca Abela
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Authors:
|
||||
* Joaquin Cuenca Abela <e98cuenc@yahoo.com>
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "glade.h"
|
||||
#include "glade-debug.h"
|
||||
|
||||
#ifdef G_OS_UNIX
|
||||
#include <signal.h>
|
||||
#endif
|
||||
|
||||
#ifndef RETSIGTYPE
|
||||
#define RETSIGTYPE void
|
||||
#endif
|
||||
|
||||
|
||||
static void
|
||||
glade_log_handler (const char *domain,
|
||||
GLogLevelFlags level, const char *message, gpointer data)
|
||||
{
|
||||
static volatile int want_breakpoint = 0;
|
||||
|
||||
/* Ignore this message */
|
||||
if (g_strcmp0 ("gdk_window_set_composited called but compositing is not supported", message) != 0)
|
||||
g_log_default_handler (domain, level, message, data);
|
||||
|
||||
if (want_breakpoint &&
|
||||
((level & (G_LOG_LEVEL_CRITICAL /* | G_LOG_LEVEL_WARNING */ )) != 0))
|
||||
G_BREAKPOINT ();
|
||||
}
|
||||
|
||||
static void
|
||||
glade_set_log_handler (const char *domain)
|
||||
{
|
||||
g_log_set_handler (domain, G_LOG_LEVEL_MASK, glade_log_handler, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* glade_setup_log_handlers:
|
||||
*
|
||||
* Sets up a log handler to manage all %G_LOG_LEVEL_MASK errors of domain:
|
||||
* GLib, GLib-GObject, Gtk, Gdk, and domainless.
|
||||
*/
|
||||
void
|
||||
glade_setup_log_handlers ()
|
||||
{
|
||||
glade_set_log_handler ("");
|
||||
glade_set_log_handler ("GLib");
|
||||
glade_set_log_handler ("GLib-GObject");
|
||||
glade_set_log_handler ("Gtk");
|
||||
glade_set_log_handler ("Gdk");
|
||||
}
|
||||
|
||||
static GladeDebugFlag glade_debug_flags = 0;
|
||||
|
||||
static const GDebugKey glade_debug_keys[] = {
|
||||
{ "ref-counts", GLADE_DEBUG_REF_COUNTS },
|
||||
{ "widget-events", GLADE_DEBUG_WIDGET_EVENTS },
|
||||
{ "commands", GLADE_DEBUG_COMMANDS },
|
||||
{ "properties", GLADE_DEBUG_PROPERTIES },
|
||||
{ "verify", GLADE_DEBUG_VERIFY }
|
||||
};
|
||||
|
||||
guint
|
||||
glade_get_debug_flags (void)
|
||||
{
|
||||
return glade_debug_flags;
|
||||
}
|
||||
|
||||
void
|
||||
glade_init_debug_flags (void)
|
||||
{
|
||||
static gboolean initialized = FALSE;
|
||||
|
||||
if (G_UNLIKELY (!initialized))
|
||||
{
|
||||
const gchar *env_string;
|
||||
|
||||
initialized = TRUE;
|
||||
|
||||
env_string = g_getenv ("GLADE_DEBUG");
|
||||
if (env_string != NULL)
|
||||
glade_debug_flags =
|
||||
g_parse_debug_string (env_string,
|
||||
glade_debug_keys,
|
||||
G_N_ELEMENTS (glade_debug_keys));
|
||||
}
|
||||
}
|
@ -1,56 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2003 Joaquin Cuenca Abela
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Authors:
|
||||
* Joaquin Cuenca Abela <e98cuenc@yahoo.com>
|
||||
*/
|
||||
|
||||
#ifndef __GLADE_DEBUG_H__
|
||||
#define __GLADE_DEBUG_H__
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef enum {
|
||||
GLADE_DEBUG_REF_COUNTS = (1 << 0),
|
||||
GLADE_DEBUG_WIDGET_EVENTS = (1 << 1),
|
||||
GLADE_DEBUG_COMMANDS = (1 << 2),
|
||||
GLADE_DEBUG_PROPERTIES = (1 << 3),
|
||||
GLADE_DEBUG_VERIFY = (1 << 4)
|
||||
} GladeDebugFlag;
|
||||
|
||||
#ifdef GLADE_ENABLE_DEBUG
|
||||
|
||||
#define GLADE_NOTE(type,action) \
|
||||
G_STMT_START { \
|
||||
if (glade_get_debug_flags () & GLADE_DEBUG_##type) \
|
||||
{ action; }; \
|
||||
} G_STMT_END
|
||||
|
||||
#else /* !GLADE_ENABLE_DEBUG */
|
||||
|
||||
#define GLADE_NOTE(type, action)
|
||||
|
||||
#endif /* GLADE_ENABLE_DEBUG */
|
||||
|
||||
void glade_init_debug_flags (void);
|
||||
guint glade_get_debug_flags (void);
|
||||
|
||||
void glade_setup_log_handlers (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GLADE_DEBUG_H__ */
|
@ -1,55 +0,0 @@
|
||||
/*
|
||||
* glade-design-layout.css
|
||||
*
|
||||
* Copyright (C) 2016 Juan Pablo Ugarte
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Author: Juan Pablo Ugarte <juanpablougarte@gmail.com>
|
||||
*
|
||||
*/
|
||||
|
||||
glade-design-layout {
|
||||
background: none;
|
||||
border: 4px solid @borders;
|
||||
color: @theme_selected_fg_color;
|
||||
border-radius: 4px 4px 0px 4px;
|
||||
}
|
||||
|
||||
glade-design-layout:selected {
|
||||
border: 4px solid @theme_selected_bg_color;
|
||||
}
|
||||
|
||||
glade-design-layout.handle {
|
||||
background-color: @borders;
|
||||
border-radius: 0px 0px 4px 4px;
|
||||
}
|
||||
|
||||
glade-design-layout:selected.handle {
|
||||
background-color: @theme_selected_bg_color;
|
||||
border-radius: 0px 0px 4px 4px;
|
||||
}
|
||||
|
||||
glade-design-layout.selection {
|
||||
border: 2px solid @theme_selected_bg_color;
|
||||
border-radius: 0px;
|
||||
background-color:transparent;
|
||||
background-image: -gtk-gradient (radial,
|
||||
center center, 0,
|
||||
center center, 1,
|
||||
from (alpha(@theme_selected_bg_color, .08)),
|
||||
to (alpha(@theme_selected_bg_color, .50)));
|
||||
}
|
||||
|
@ -1,50 +0,0 @@
|
||||
/*
|
||||
* glade-design-layout.h
|
||||
*
|
||||
* Copyright (C) 2006-2007 Vincent Geddes
|
||||
*
|
||||
* Authors:
|
||||
* Vincent Geddes <vgeddes@gnome.org>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __GLADE_DESIGN_LAYOUT_H__
|
||||
#define __GLADE_DESIGN_LAYOUT_H__
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include "glade-design-view.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GLADE_TYPE_DESIGN_LAYOUT glade_design_layout_get_type ()
|
||||
G_DECLARE_DERIVABLE_TYPE (GladeDesignLayout, glade_design_layout, GLADE, DESIGN_LAYOUT, GtkBin)
|
||||
|
||||
struct _GladeDesignLayoutClass
|
||||
{
|
||||
GtkBinClass parent_class;
|
||||
|
||||
gpointer padding[5];
|
||||
};
|
||||
|
||||
GtkWidget *_glade_design_layout_new (GladeDesignView *view);
|
||||
|
||||
gboolean _glade_design_layout_do_event (GladeDesignLayout *layout,
|
||||
GdkEvent *event);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GLADE_DESIGN_LAYOUT_H__ */
|
@ -1,65 +0,0 @@
|
||||
/*
|
||||
* glade-design-private.h
|
||||
*
|
||||
* Copyright (C) 2011 Juan Pablo Ugarte
|
||||
*
|
||||
* Authors:
|
||||
* Juan Pablo Ugarte <juanpablougarte@gmail.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __GLADE_DESIGN_PRIVATE_H__
|
||||
#define __GLADE_DESIGN_PRIVATE_H__
|
||||
|
||||
#include "glade-design-view.h"
|
||||
#include "glade-design-layout.h"
|
||||
#include "glade-dnd.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
void _glade_design_layout_get_colors (GdkRGBA *c1, GdkRGBA *c2,
|
||||
GdkRGBA *c3, GdkRGBA *c4);
|
||||
|
||||
void _glade_design_layout_draw_node (cairo_t *cr,
|
||||
gdouble x,
|
||||
gdouble y,
|
||||
GdkRGBA *fg,
|
||||
GdkRGBA *bg);
|
||||
|
||||
void _glade_design_layout_draw_pushpin (cairo_t *cr,
|
||||
gdouble needle_length,
|
||||
GdkRGBA *outline,
|
||||
GdkRGBA *fill,
|
||||
GdkRGBA *bg,
|
||||
GdkRGBA *fg);
|
||||
|
||||
void _glade_design_layout_get_hot_point (GladeDesignLayout *layout,
|
||||
gint *x,
|
||||
gint *y);
|
||||
|
||||
GladeWidget * _glade_design_layout_get_child (GladeDesignLayout *layout);
|
||||
|
||||
GtkWidget *_glade_design_layout_get_child_at_position (GtkWidget *widget,
|
||||
gint x,
|
||||
gint y);
|
||||
|
||||
void _glade_design_layout_set_highlight (GladeDesignLayout *layout,
|
||||
GladeWidget *drag);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GLADE_DESIGN_PRIVATE_H__ */
|
@ -1,866 +0,0 @@
|
||||
/*
|
||||
* glade-design-view.c
|
||||
*
|
||||
* Copyright (C) 2006 Vincent Geddes
|
||||
* 2011-2016 Juan Pablo Ugarte
|
||||
*
|
||||
* Authors:
|
||||
* Vincent Geddes <vincent.geddes@gmail.com>
|
||||
* Juan Pablo Ugarte <juanpablougarte@gmail.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* SECTION:glade-design-view
|
||||
* @Title: GladeDesignView
|
||||
* @Short_Description: A widget to embed the workspace.
|
||||
*
|
||||
* Use this widget to embed toplevel widgets in a given #GladeProject.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "glade.h"
|
||||
#include "glade-dnd.h"
|
||||
#include "glade-utils.h"
|
||||
#include "glade-design-view.h"
|
||||
#include "glade-design-layout.h"
|
||||
#include "glade-design-private.h"
|
||||
#include "glade-path.h"
|
||||
#include "glade-adaptor-chooser-widget.h"
|
||||
|
||||
#include <glib.h>
|
||||
#include <glib/gi18n.h>
|
||||
|
||||
#define GLADE_DESIGN_VIEW_KEY "GLADE_DESIGN_VIEW_KEY"
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_PROJECT
|
||||
};
|
||||
|
||||
typedef struct _GladeDesignViewPrivate
|
||||
{
|
||||
GladeProject *project;
|
||||
GtkWidget *scrolled_window; /* Main scrolled window */
|
||||
GtkWidget *layout_box; /* Box to pack a GladeDesignLayout for each toplevel in project */
|
||||
|
||||
_GladeDrag *drag_target;
|
||||
GObject *drag_data;
|
||||
gboolean drag_highlight;
|
||||
} GladeDesignViewPrivate;
|
||||
|
||||
static GtkVBoxClass *parent_class = NULL;
|
||||
|
||||
static void glade_design_view_drag_init (_GladeDragInterface *iface);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GladeDesignView, glade_design_view, GTK_TYPE_BOX,
|
||||
G_ADD_PRIVATE (GladeDesignView)
|
||||
G_IMPLEMENT_INTERFACE (GLADE_TYPE_DRAG,
|
||||
glade_design_view_drag_init))
|
||||
|
||||
static void
|
||||
glade_design_layout_scroll (GladeDesignView *view, gint x, gint y, gint w, gint h)
|
||||
{
|
||||
GladeDesignViewPrivate *priv = glade_design_view_get_instance_private (view);
|
||||
gdouble vadj_val, hadj_val, vpage_end, hpage_end;
|
||||
GtkAdjustment *vadj, *hadj;
|
||||
|
||||
g_assert (GLADE_IS_DESIGN_VIEW (view));
|
||||
|
||||
vadj = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (priv->scrolled_window));
|
||||
hadj = gtk_scrolled_window_get_hadjustment (GTK_SCROLLED_WINDOW (priv->scrolled_window));
|
||||
|
||||
vadj_val = gtk_adjustment_get_value (vadj);
|
||||
hadj_val = gtk_adjustment_get_value (hadj);
|
||||
vpage_end = gtk_adjustment_get_page_size (vadj) + vadj_val;
|
||||
hpage_end = gtk_adjustment_get_page_size (hadj) + hadj_val;
|
||||
|
||||
/* TODO: we could set this value in increments in a timeout callback
|
||||
* to make it look like its scrolling instead of jumping.
|
||||
*/
|
||||
if (y < vadj_val || y > vpage_end || (y + h) > vpage_end)
|
||||
gtk_adjustment_set_value (vadj, y);
|
||||
|
||||
if (x < hadj_val || x > hpage_end || (x + w) > hpage_end)
|
||||
gtk_adjustment_set_value (hadj, x);
|
||||
}
|
||||
|
||||
static void
|
||||
on_layout_size_allocate (GtkWidget *widget, GtkAllocation *alloc, GladeDesignView *view)
|
||||
{
|
||||
g_assert (GLADE_IS_DESIGN_VIEW (view));
|
||||
|
||||
glade_design_layout_scroll (view, alloc->x, alloc->y, alloc->width, alloc->height);
|
||||
g_signal_handlers_disconnect_by_func (widget, on_layout_size_allocate, view);
|
||||
}
|
||||
|
||||
static void
|
||||
glade_design_view_update_state (GList *objects, GtkStateFlags state)
|
||||
{
|
||||
GList *l;
|
||||
|
||||
for (l = objects; l && l->data; l = g_list_next (l))
|
||||
{
|
||||
GtkWidget *view, *widget = l->data;
|
||||
|
||||
if (GTK_IS_WIDGET (widget) &&
|
||||
gtk_widget_get_visible (widget) &&
|
||||
(view = gtk_widget_get_ancestor (widget, GLADE_TYPE_DESIGN_LAYOUT)))
|
||||
{
|
||||
gtk_widget_set_state_flags (view, state, TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
glade_design_view_selection_changed (GladeProject *project, GladeDesignView *view)
|
||||
{
|
||||
GtkWidget *layout;
|
||||
GList *selection;
|
||||
|
||||
g_assert (GLADE_IS_DESIGN_VIEW (view));
|
||||
|
||||
glade_design_view_update_state (glade_project_toplevels (project),
|
||||
GTK_STATE_FLAG_NORMAL);
|
||||
|
||||
if (!(selection = glade_project_selection_get (project)))
|
||||
return;
|
||||
|
||||
glade_design_view_update_state (selection, GTK_STATE_FLAG_SELECTED);
|
||||
|
||||
/* Check if its only one widget selected and scroll viewport to show toplevel */
|
||||
if (g_list_next (selection) == NULL &&
|
||||
GTK_IS_WIDGET (selection->data) &&
|
||||
(layout = gtk_widget_get_ancestor (selection->data, GLADE_TYPE_DESIGN_LAYOUT)))
|
||||
{
|
||||
GtkAllocation alloc;
|
||||
gtk_widget_get_allocation (layout, &alloc);
|
||||
|
||||
if (alloc.x < 0)
|
||||
g_signal_connect (layout, "size-allocate", G_CALLBACK (on_layout_size_allocate), view);
|
||||
else
|
||||
glade_design_layout_scroll (view, alloc.x, alloc.y, alloc.width, alloc.height);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
glade_design_view_add_toplevel (GladeDesignView *view, GladeWidget *widget)
|
||||
{
|
||||
GladeDesignViewPrivate *priv = glade_design_view_get_instance_private (view);
|
||||
GtkWidget *layout;
|
||||
GList *toplevels;
|
||||
GObject *object;
|
||||
|
||||
g_assert (GLADE_IS_DESIGN_VIEW (view));
|
||||
|
||||
if (glade_widget_get_parent (widget) ||
|
||||
(object = glade_widget_get_object (widget)) == NULL ||
|
||||
!GTK_IS_WIDGET (object) ||
|
||||
gtk_widget_get_parent (GTK_WIDGET (object)))
|
||||
return;
|
||||
|
||||
/* Create a GladeDesignLayout and add the toplevel widget to the view */
|
||||
layout = _glade_design_layout_new (view);
|
||||
gtk_widget_set_halign (layout, GTK_ALIGN_START);
|
||||
gtk_box_pack_start (GTK_BOX (priv->layout_box), layout, FALSE, FALSE, 0);
|
||||
|
||||
if ((toplevels = glade_project_toplevels (priv->project)))
|
||||
gtk_box_reorder_child (GTK_BOX (priv->layout_box), layout,
|
||||
g_list_index (toplevels, GTK_WIDGET (object)));
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (layout), GTK_WIDGET (object));
|
||||
|
||||
gtk_widget_show (GTK_WIDGET (object));
|
||||
gtk_widget_show (layout);
|
||||
}
|
||||
|
||||
static void
|
||||
glade_design_view_remove_toplevel (GladeDesignView *view, GladeWidget *widget)
|
||||
{
|
||||
GtkWidget *layout;
|
||||
GObject *object;
|
||||
|
||||
g_assert (GLADE_IS_DESIGN_VIEW (view));
|
||||
|
||||
if (glade_widget_get_parent (widget) ||
|
||||
(object = glade_widget_get_object (widget)) == NULL ||
|
||||
!GTK_IS_WIDGET (object)) return;
|
||||
|
||||
/* Remove toplevel widget from the view */
|
||||
if ((layout = gtk_widget_get_parent (GTK_WIDGET (object))) &&
|
||||
gtk_widget_is_ancestor (layout, GTK_WIDGET (view)))
|
||||
{
|
||||
GladeDesignViewPrivate *priv = glade_design_view_get_instance_private (view);
|
||||
|
||||
gtk_container_remove (GTK_CONTAINER (layout), GTK_WIDGET (object));
|
||||
gtk_container_remove (GTK_CONTAINER (priv->layout_box), layout);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
glade_design_view_widget_visibility_changed (GladeProject *project,
|
||||
GladeWidget *widget,
|
||||
gboolean visible,
|
||||
GladeDesignView *view)
|
||||
{
|
||||
g_assert (GLADE_IS_DESIGN_VIEW (view));
|
||||
|
||||
if (visible)
|
||||
glade_design_view_add_toplevel (view, widget);
|
||||
else
|
||||
glade_design_view_remove_toplevel (view, widget);
|
||||
}
|
||||
|
||||
static void
|
||||
on_project_add_widget (GladeProject *project, GladeWidget *widget, GladeDesignView *view)
|
||||
{
|
||||
g_assert (GLADE_IS_DESIGN_VIEW (view));
|
||||
|
||||
glade_design_view_add_toplevel (view, widget);
|
||||
}
|
||||
|
||||
static void
|
||||
on_project_remove_widget (GladeProject *project, GladeWidget *widget, GladeDesignView *view)
|
||||
{
|
||||
g_assert (GLADE_IS_DESIGN_VIEW (view));
|
||||
|
||||
glade_design_view_remove_toplevel (view, widget);
|
||||
}
|
||||
|
||||
static void
|
||||
glade_design_view_set_project (GladeDesignView *view, GladeProject *project)
|
||||
{
|
||||
GladeDesignViewPrivate *priv = glade_design_view_get_instance_private (view);
|
||||
|
||||
g_assert (GLADE_IS_DESIGN_VIEW (view));
|
||||
|
||||
if (priv->project)
|
||||
{
|
||||
g_object_remove_weak_pointer (G_OBJECT (priv->project), (gpointer *) &priv->project);
|
||||
|
||||
g_signal_handlers_disconnect_by_data (priv->project, view);
|
||||
g_signal_handlers_disconnect_by_data (priv->project, priv->scrolled_window);
|
||||
|
||||
g_object_set_data (G_OBJECT (priv->project), GLADE_DESIGN_VIEW_KEY, NULL);
|
||||
}
|
||||
|
||||
priv->project = project;
|
||||
|
||||
if (!project)
|
||||
return;
|
||||
|
||||
g_assert (GLADE_IS_PROJECT (project));
|
||||
|
||||
g_object_add_weak_pointer (G_OBJECT (project), (gpointer *) &priv->project);
|
||||
|
||||
g_signal_connect (project, "add-widget",
|
||||
G_CALLBACK (on_project_add_widget), view);
|
||||
g_signal_connect (project, "remove-widget",
|
||||
G_CALLBACK (on_project_remove_widget), view);
|
||||
g_signal_connect_swapped (project, "parse-began",
|
||||
G_CALLBACK (gtk_widget_hide),
|
||||
priv->scrolled_window);
|
||||
g_signal_connect_swapped (project, "parse-finished",
|
||||
G_CALLBACK (gtk_widget_show),
|
||||
priv->scrolled_window);
|
||||
g_signal_connect (project, "selection-changed",
|
||||
G_CALLBACK (glade_design_view_selection_changed), view);
|
||||
g_signal_connect (project, "widget-visibility-changed",
|
||||
G_CALLBACK (glade_design_view_widget_visibility_changed), view);
|
||||
|
||||
g_object_set_data (G_OBJECT (project), GLADE_DESIGN_VIEW_KEY, view);
|
||||
}
|
||||
|
||||
static void
|
||||
glade_design_view_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value, GParamSpec *pspec)
|
||||
{
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_PROJECT:
|
||||
glade_design_view_set_project (GLADE_DESIGN_VIEW (object),
|
||||
g_value_get_object (value));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
glade_design_view_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GladeDesignViewPrivate *priv = glade_design_view_get_instance_private ((GladeDesignView *) object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_PROJECT:
|
||||
g_value_set_object (value, priv->project);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
logo_draw (GtkWidget *widget, cairo_t *cr, GdkRGBA *c)
|
||||
{
|
||||
GtkAllocation alloc;
|
||||
gdouble scale;
|
||||
|
||||
gtk_widget_get_allocation (widget, &alloc);
|
||||
|
||||
cairo_save (cr);
|
||||
|
||||
cairo_set_source_rgba (cr, c->red, c->green, c->blue, .06);
|
||||
|
||||
scale = MIN ((alloc.width/1.5)/(glade_path_WIDTH), (alloc.height/1.5)/(glade_path_HEIGHT));
|
||||
|
||||
cairo_scale (cr, scale, scale);
|
||||
|
||||
cairo_translate (cr, (alloc.width / scale) - glade_path_WIDTH,
|
||||
(alloc.height / scale) - glade_path_HEIGHT);
|
||||
cairo_append_path (cr, &glade_path);
|
||||
cairo_fill (cr);
|
||||
|
||||
cairo_restore (cr);
|
||||
}
|
||||
|
||||
static void
|
||||
on_chooser_adaptor_widget_selected (_GladeAdaptorChooserWidget *chooser,
|
||||
GladeWidgetAdaptor *adaptor,
|
||||
GladeProject *project)
|
||||
|
||||
{
|
||||
glade_command_create (adaptor, NULL, NULL, project);
|
||||
gtk_widget_destroy (gtk_widget_get_ancestor (GTK_WIDGET (chooser), GTK_TYPE_POPOVER));
|
||||
}
|
||||
|
||||
static gboolean
|
||||
glade_design_view_viewport_button_press (GtkWidget *widget,
|
||||
GdkEventButton *event,
|
||||
GladeDesignView *view)
|
||||
{
|
||||
GladeDesignViewPrivate *priv = glade_design_view_get_instance_private ((GladeDesignView *) view);
|
||||
GdkRectangle rect = {event->x, event->y, 8, 8};
|
||||
GtkWidget *pop, *chooser;
|
||||
|
||||
g_assert (GLADE_IS_DESIGN_VIEW (view));
|
||||
|
||||
if (event->type != GDK_2BUTTON_PRESS)
|
||||
return FALSE;
|
||||
|
||||
pop = gtk_popover_new (widget);
|
||||
gtk_popover_set_pointing_to (GTK_POPOVER (pop), &rect);
|
||||
gtk_popover_set_position (GTK_POPOVER (pop), GTK_POS_BOTTOM);
|
||||
|
||||
chooser = _glade_adaptor_chooser_widget_new (GLADE_ADAPTOR_CHOOSER_WIDGET_TOPLEVEL |
|
||||
GLADE_ADAPTOR_CHOOSER_WIDGET_WIDGET |
|
||||
GLADE_ADAPTOR_CHOOSER_WIDGET_SKIP_DEPRECATED,
|
||||
priv->project);
|
||||
_glade_adaptor_chooser_widget_populate (GLADE_ADAPTOR_CHOOSER_WIDGET (chooser));
|
||||
g_signal_connect (chooser, "adaptor-selected",
|
||||
G_CALLBACK (on_chooser_adaptor_widget_selected),
|
||||
priv->project);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (pop), chooser);
|
||||
gtk_widget_show (chooser);
|
||||
gtk_popover_popup (GTK_POPOVER (pop));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
glade_design_view_viewport_draw (GtkWidget *widget, cairo_t *cr, GladeDesignView *view)
|
||||
{
|
||||
GladeDesignViewPrivate *priv = glade_design_view_get_instance_private ((GladeDesignView *) view);
|
||||
GtkStyleContext *context = gtk_widget_get_style_context (widget);
|
||||
GdkRGBA fg_color;
|
||||
|
||||
g_assert (GLADE_IS_DESIGN_VIEW (view));
|
||||
|
||||
gtk_style_context_get_color (context, gtk_style_context_get_state (context),
|
||||
&fg_color);
|
||||
|
||||
logo_draw (widget, cr, &fg_color);
|
||||
|
||||
if (priv->drag_highlight)
|
||||
{
|
||||
GdkRGBA c;
|
||||
|
||||
gtk_style_context_save (context);
|
||||
gtk_style_context_get_background_color (context,
|
||||
gtk_style_context_get_state (context) |
|
||||
GTK_STATE_FLAG_SELECTED |
|
||||
GTK_STATE_FLAG_FOCUSED, &c);
|
||||
gtk_style_context_restore (context);
|
||||
|
||||
cairo_set_line_width (cr, 2);
|
||||
gdk_cairo_set_source_rgba (cr, &c);
|
||||
cairo_rectangle (cr, 0, 0,
|
||||
gtk_widget_get_allocated_width (widget),
|
||||
gtk_widget_get_allocated_height (widget));
|
||||
cairo_stroke (cr);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
glade_design_view_init (GladeDesignView *view)
|
||||
{
|
||||
GladeDesignViewPrivate *priv = glade_design_view_get_instance_private (view);
|
||||
GtkWidget *viewport;
|
||||
|
||||
gtk_widget_set_no_show_all (GTK_WIDGET (view), TRUE);
|
||||
gtk_orientable_set_orientation (GTK_ORIENTABLE (view),
|
||||
GTK_ORIENTATION_VERTICAL);
|
||||
|
||||
priv->project = NULL;
|
||||
priv->layout_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
||||
gtk_widget_set_valign (priv->layout_box, GTK_ALIGN_START);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (priv->layout_box), 0);
|
||||
|
||||
priv->scrolled_window = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (priv->scrolled_window),
|
||||
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
|
||||
|
||||
viewport = gtk_viewport_new (NULL, NULL);
|
||||
gtk_widget_add_events (viewport, GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK);
|
||||
g_signal_connect (viewport, "button-press-event",
|
||||
G_CALLBACK (glade_design_view_viewport_button_press),
|
||||
view);
|
||||
g_signal_connect (viewport, "draw",
|
||||
G_CALLBACK (glade_design_view_viewport_draw),
|
||||
view);
|
||||
gtk_viewport_set_shadow_type (GTK_VIEWPORT (viewport), GTK_SHADOW_NONE);
|
||||
gtk_container_add (GTK_CONTAINER (viewport), priv->layout_box);
|
||||
gtk_container_add (GTK_CONTAINER (priv->scrolled_window), viewport);
|
||||
|
||||
gtk_widget_show (priv->scrolled_window);
|
||||
gtk_widget_show (viewport);
|
||||
gtk_widget_show_all (priv->layout_box);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (view), priv->scrolled_window, TRUE, TRUE, 0);
|
||||
|
||||
gtk_container_set_border_width (GTK_CONTAINER (view), 0);
|
||||
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (view)),
|
||||
GTK_STYLE_CLASS_VIEW);
|
||||
|
||||
_glade_dnd_dest_set (GTK_WIDGET (view));
|
||||
}
|
||||
|
||||
static void
|
||||
glade_design_view_dispose (GObject *object)
|
||||
{
|
||||
GladeDesignView *view = GLADE_DESIGN_VIEW (object);
|
||||
GladeDesignViewPrivate *priv = glade_design_view_get_instance_private (view);
|
||||
|
||||
glade_design_view_set_project (view, NULL);
|
||||
g_clear_object (&priv->drag_target);
|
||||
g_clear_object (&priv->drag_data);
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GtkWidget *child;
|
||||
gint x, y;
|
||||
} FindInContainerData;
|
||||
|
||||
static void
|
||||
find_inside_container (GtkWidget *widget, FindInContainerData *data)
|
||||
{
|
||||
GtkAllocation alloc;
|
||||
gint x, y;
|
||||
|
||||
if (data->child || !gtk_widget_get_mapped (widget))
|
||||
return;
|
||||
|
||||
x = data->x;
|
||||
y = data->y;
|
||||
gtk_widget_get_allocation (widget, &alloc);
|
||||
|
||||
if (x >= alloc.x && x <= (alloc.x + alloc.width) &&
|
||||
y >= alloc.y && y <= (alloc.y + alloc.height))
|
||||
{
|
||||
data->child = widget;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
glade_design_view_drag_highlight (_GladeDrag *dest,
|
||||
gint x,
|
||||
gint y)
|
||||
{
|
||||
if (GLADE_IS_WIDGET (dest))
|
||||
{
|
||||
GObject *obj = glade_widget_get_object (GLADE_WIDGET (dest));
|
||||
|
||||
if (GTK_IS_WIDGET (obj))
|
||||
{
|
||||
GtkWidget *layout = gtk_widget_get_ancestor (GTK_WIDGET (obj),
|
||||
GLADE_TYPE_DESIGN_LAYOUT);
|
||||
if (layout)
|
||||
_glade_design_layout_set_highlight (GLADE_DESIGN_LAYOUT (layout),
|
||||
(x<0 || y<0) ? NULL : GLADE_WIDGET (dest));
|
||||
}
|
||||
}
|
||||
|
||||
_glade_drag_highlight (dest, x, y);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
glade_design_view_drag_motion (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
gint x, gint y,
|
||||
guint time)
|
||||
{
|
||||
GladeDesignView *view = GLADE_DESIGN_VIEW (widget);
|
||||
GladeDesignViewPrivate *priv = glade_design_view_get_instance_private (view);
|
||||
FindInContainerData data;
|
||||
_GladeDrag *drag = NULL;
|
||||
gint xx, yy;
|
||||
|
||||
g_assert (GLADE_IS_DESIGN_VIEW (view));
|
||||
|
||||
if (!priv->drag_data)
|
||||
{
|
||||
GdkAtom target = gtk_drag_dest_find_target (widget, context, NULL);
|
||||
|
||||
if (target)
|
||||
gtk_drag_get_data (widget, context, target, time);
|
||||
}
|
||||
|
||||
data.child = NULL;
|
||||
gtk_widget_translate_coordinates (widget, GTK_WIDGET (priv->layout_box),
|
||||
x, y, &data.x, &data.y);
|
||||
gtk_container_forall (GTK_CONTAINER (priv->layout_box),
|
||||
(GtkCallback) find_inside_container,
|
||||
&data);
|
||||
|
||||
if (data.child)
|
||||
{
|
||||
GladeDesignLayout *layout = GLADE_DESIGN_LAYOUT (data.child);
|
||||
GladeWidget *gchild = _glade_design_layout_get_child (layout);
|
||||
GtkWidget *child = GTK_WIDGET (glade_widget_get_object (gchild));
|
||||
GtkWidget *drag_target;
|
||||
|
||||
gtk_widget_translate_coordinates (widget, child, x, y, &xx, &yy);
|
||||
|
||||
drag_target = _glade_design_layout_get_child_at_position (child, xx, yy);
|
||||
|
||||
if (drag_target)
|
||||
{
|
||||
_GladeDrag *gwidget = NULL;
|
||||
|
||||
if (GLADE_IS_PLACEHOLDER (drag_target)) {
|
||||
gwidget = (_GladeDrag *) drag_target;
|
||||
} else if (GLADE_IS_WIDGET (drag_target)) {
|
||||
gwidget = (_GladeDrag *) glade_widget_get_from_gobject ((GladeWidget *) drag_target);
|
||||
}
|
||||
|
||||
while (gwidget && !_glade_drag_can_drop (gwidget,
|
||||
xx, yy, priv->drag_data)) {
|
||||
if (GLADE_IS_WIDGET (gwidget)) {
|
||||
gwidget = (_GladeDrag *) glade_widget_get_parent ((GladeWidget *) gwidget);
|
||||
} else if (GLADE_IS_PLACEHOLDER (gwidget)) {
|
||||
gwidget = (_GladeDrag *) glade_placeholder_get_parent ((GladePlaceholder *) gwidget);
|
||||
} else {
|
||||
gwidget = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (gwidget) {
|
||||
drag = GLADE_DRAG (gwidget);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (_glade_drag_can_drop (GLADE_DRAG (widget), x, y, priv->drag_data))
|
||||
{
|
||||
drag = GLADE_DRAG (widget);
|
||||
xx = x;
|
||||
yy = y;
|
||||
}
|
||||
|
||||
if (priv->drag_target && priv->drag_target != drag)
|
||||
{
|
||||
glade_design_view_drag_highlight (priv->drag_target, -1, -1);
|
||||
g_clear_object (&priv->drag_target);
|
||||
}
|
||||
|
||||
if (drag)
|
||||
{
|
||||
priv->drag_target = g_object_ref (drag);
|
||||
|
||||
glade_design_view_drag_highlight (drag, xx, yy);
|
||||
|
||||
gdk_drag_status (context, GDK_ACTION_COPY, time);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gdk_drag_status (context, 0, time);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
glade_design_view_drag_leave (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
guint time)
|
||||
{
|
||||
GladeDesignView *view = GLADE_DESIGN_VIEW (widget);
|
||||
GladeDesignViewPrivate *priv = glade_design_view_get_instance_private (view);
|
||||
|
||||
g_assert (GLADE_IS_DESIGN_VIEW (view));
|
||||
|
||||
if (priv->drag_target)
|
||||
glade_design_view_drag_highlight (priv->drag_target, -1, -1);
|
||||
}
|
||||
|
||||
static void
|
||||
on_source_drag_end (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GladeDesignView *view)
|
||||
{
|
||||
GladeDesignViewPrivate *priv = glade_design_view_get_instance_private (view);
|
||||
|
||||
g_assert (GLADE_IS_DESIGN_VIEW (view));
|
||||
|
||||
if (priv->drag_target)
|
||||
{
|
||||
glade_design_view_drag_highlight (priv->drag_target, -1, -1);
|
||||
g_clear_object (&priv->drag_target);
|
||||
}
|
||||
|
||||
g_clear_object (&priv->drag_data);
|
||||
}
|
||||
|
||||
static void
|
||||
glade_design_view_drag_data_received (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
gint x,
|
||||
gint y,
|
||||
GtkSelectionData *selection,
|
||||
guint info,
|
||||
guint time)
|
||||
{
|
||||
GtkWidget *source = gtk_drag_get_source_widget (context);
|
||||
GladeDesignView *view = GLADE_DESIGN_VIEW (widget);
|
||||
GladeDesignViewPrivate *priv = glade_design_view_get_instance_private (view);
|
||||
|
||||
g_assert (GLADE_IS_DESIGN_VIEW (view));
|
||||
|
||||
g_signal_handlers_disconnect_by_func (source, on_source_drag_end, view);
|
||||
|
||||
g_set_object (&priv->drag_data, _glade_dnd_get_data (context, selection, info));
|
||||
|
||||
g_signal_connect_object (source, "drag-end", G_CALLBACK (on_source_drag_end), view, 0);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
glade_design_view_drag_drop (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
gint x,
|
||||
gint y,
|
||||
guint time)
|
||||
{
|
||||
GladeDesignView *view = GLADE_DESIGN_VIEW (widget);
|
||||
GladeDesignViewPrivate *priv = glade_design_view_get_instance_private (view);
|
||||
|
||||
g_assert (GLADE_IS_DESIGN_VIEW (view));
|
||||
|
||||
if (priv->drag_data && priv->drag_target)
|
||||
{
|
||||
GtkWidget *target;
|
||||
gint xx, yy;
|
||||
|
||||
if (GLADE_IS_WIDGET (priv->drag_target))
|
||||
target = GTK_WIDGET (glade_widget_get_object (GLADE_WIDGET (priv->drag_target)));
|
||||
else
|
||||
target = GTK_WIDGET (priv->drag_target);
|
||||
|
||||
gtk_widget_translate_coordinates (widget, target, x, y, &xx, &yy);
|
||||
_glade_drag_drop (GLADE_DRAG (priv->drag_target), xx, yy, priv->drag_data);
|
||||
gtk_drag_finish (context, TRUE, FALSE, time);
|
||||
}
|
||||
else
|
||||
gtk_drag_finish (context, FALSE, FALSE, time);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
glade_design_view_drag_iface_can_drop (_GladeDrag *drag,
|
||||
gint x, gint y,
|
||||
GObject *data)
|
||||
{
|
||||
GladeWidget *gwidget;
|
||||
|
||||
if (GLADE_IS_WIDGET_ADAPTOR (data) ||
|
||||
((gwidget = glade_widget_get_from_gobject (data)) &&
|
||||
glade_widget_get_parent (gwidget)))
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
glade_design_view_drag_iface_drop (_GladeDrag *drag,
|
||||
gint x, gint y,
|
||||
GObject *data)
|
||||
{
|
||||
GladeDesignView *view = GLADE_DESIGN_VIEW (drag);
|
||||
GladeDesignViewPrivate *priv = glade_design_view_get_instance_private (view);
|
||||
GladeWidget *gsource;
|
||||
|
||||
g_assert (GLADE_IS_DESIGN_VIEW (view));
|
||||
|
||||
if (GLADE_IS_WIDGET_ADAPTOR (data))
|
||||
{
|
||||
glade_command_create (GLADE_WIDGET_ADAPTOR (data),
|
||||
NULL, NULL, priv->project);
|
||||
return TRUE;
|
||||
}
|
||||
else if ((gsource = glade_widget_get_from_gobject (data)))
|
||||
{
|
||||
GList widgets = {gsource, NULL, NULL};
|
||||
glade_command_dnd (&widgets, NULL, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
glade_design_view_drag_iface_highlight (_GladeDrag *drag, gint x, gint y)
|
||||
{
|
||||
GladeDesignView *view = GLADE_DESIGN_VIEW (drag);
|
||||
GladeDesignViewPrivate *priv = glade_design_view_get_instance_private (view);
|
||||
gboolean highlight = !(x < 0 || y < 0);
|
||||
|
||||
g_assert (GLADE_IS_DESIGN_VIEW (view));
|
||||
|
||||
if (priv->drag_highlight == highlight)
|
||||
return;
|
||||
|
||||
priv->drag_highlight = highlight;
|
||||
|
||||
gtk_widget_queue_draw (priv->scrolled_window);
|
||||
}
|
||||
|
||||
static void
|
||||
glade_design_view_drag_init (_GladeDragInterface *iface)
|
||||
{
|
||||
iface->can_drag = NULL;
|
||||
iface->can_drop = glade_design_view_drag_iface_can_drop;
|
||||
iface->drop = glade_design_view_drag_iface_drop;
|
||||
iface->highlight = glade_design_view_drag_iface_highlight;
|
||||
}
|
||||
|
||||
static void
|
||||
glade_design_view_class_init (GladeDesignViewClass *klass)
|
||||
{
|
||||
GObjectClass *object_class;
|
||||
GtkWidgetClass *widget_class;
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
object_class = G_OBJECT_CLASS (klass);
|
||||
widget_class = GTK_WIDGET_CLASS (klass);
|
||||
|
||||
object_class->dispose = glade_design_view_dispose;
|
||||
object_class->get_property = glade_design_view_get_property;
|
||||
object_class->set_property = glade_design_view_set_property;
|
||||
|
||||
widget_class->drag_motion = glade_design_view_drag_motion;
|
||||
widget_class->drag_leave = glade_design_view_drag_leave;
|
||||
widget_class->drag_data_received = glade_design_view_drag_data_received;
|
||||
widget_class->drag_drop = glade_design_view_drag_drop;
|
||||
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_PROJECT,
|
||||
g_param_spec_object ("project",
|
||||
"Project",
|
||||
"The project for this view",
|
||||
GLADE_TYPE_PROJECT,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT_ONLY));
|
||||
}
|
||||
|
||||
/* Public API */
|
||||
|
||||
/**
|
||||
* glade_design_view_get_project:
|
||||
* @view: A #GladeDesignView
|
||||
*
|
||||
* Returns: (transfer none): a #GladeProject
|
||||
*/
|
||||
GladeProject *
|
||||
glade_design_view_get_project (GladeDesignView *view)
|
||||
{
|
||||
GladeDesignViewPrivate *priv = glade_design_view_get_instance_private (view);
|
||||
|
||||
g_return_val_if_fail (GLADE_IS_DESIGN_VIEW (view), NULL);
|
||||
|
||||
return priv->project;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* glade_design_view_new:
|
||||
* @project: A #GladeProject
|
||||
*
|
||||
* Returns: (transfer full): a new #GladeDesignView
|
||||
*/
|
||||
GtkWidget *
|
||||
glade_design_view_new (GladeProject *project)
|
||||
{
|
||||
GladeDesignView *view;
|
||||
|
||||
g_return_val_if_fail (GLADE_IS_PROJECT (project), NULL);
|
||||
|
||||
view = g_object_new (GLADE_TYPE_DESIGN_VIEW, "project", project, NULL);
|
||||
|
||||
return GTK_WIDGET (view);
|
||||
}
|
||||
|
||||
/**
|
||||
* glade_design_view_get_from_project:
|
||||
* @project: A #GladeProject
|
||||
*
|
||||
* Returns: (transfer none) (nullable): a #GladeDesignView
|
||||
*/
|
||||
GladeDesignView *
|
||||
glade_design_view_get_from_project (GladeProject *project)
|
||||
{
|
||||
gpointer p;
|
||||
|
||||
g_return_val_if_fail (GLADE_IS_PROJECT (project), NULL);
|
||||
|
||||
p = g_object_get_data (G_OBJECT (project), GLADE_DESIGN_VIEW_KEY);
|
||||
|
||||
return (p != NULL) ? GLADE_DESIGN_VIEW (p) : NULL;
|
||||
}
|
@ -1,53 +0,0 @@
|
||||
/*
|
||||
* glade-design-view.h
|
||||
*
|
||||
* Copyright (C) 2006 Vincent Geddes
|
||||
*
|
||||
* Authors:
|
||||
* Vincent Geddes <vincent.geddes@gmail.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __GLADE_DESIGN_VIEW_H__
|
||||
#define __GLADE_DESIGN_VIEW_H__
|
||||
|
||||
#include <gladeui/glade.h>
|
||||
#include <gladeui/glade-project.h>
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GLADE_TYPE_DESIGN_VIEW glade_design_view_get_type ()
|
||||
G_DECLARE_DERIVABLE_TYPE (GladeDesignView, glade_design_view, GLADE, DESIGN_VIEW, GtkBox)
|
||||
|
||||
struct _GladeDesignViewClass
|
||||
{
|
||||
GtkBoxClass parent_class;
|
||||
|
||||
gpointer padding[4];
|
||||
};
|
||||
|
||||
GtkWidget *glade_design_view_new (GladeProject *project);
|
||||
|
||||
GladeProject *glade_design_view_get_project (GladeDesignView *view);
|
||||
|
||||
GladeDesignView *glade_design_view_get_from_project (GladeProject *project);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GLADE_DESIGN_VIEW_H__ */
|
@ -1,201 +0,0 @@
|
||||
/*
|
||||
* glade-displayable-values.c
|
||||
*
|
||||
* Copyright (C) 2008 Tristan Van Berkom.
|
||||
*
|
||||
* Authors:
|
||||
* Tristan Van Berkom <tvb@gnome.org>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <glib/gi18n-lib.h>
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "glade-displayable-values.h"
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
gchar *value;
|
||||
gchar *string;
|
||||
gboolean disabled:1;
|
||||
} ValueTab;
|
||||
|
||||
static GHashTable *values_hash = NULL;
|
||||
|
||||
|
||||
static gint
|
||||
find_by_value (ValueTab *a, const gchar *b)
|
||||
{
|
||||
return strcmp (a->value, b);
|
||||
}
|
||||
|
||||
|
||||
static gint
|
||||
find_by_displayable (ValueTab *a, const gchar *b)
|
||||
{
|
||||
return strcmp (a->string, b);
|
||||
}
|
||||
|
||||
void
|
||||
glade_register_displayable_value (GType type,
|
||||
const gchar *value,
|
||||
const gchar *domain,
|
||||
const gchar *string)
|
||||
{
|
||||
g_return_if_fail (value && value[0]);
|
||||
g_return_if_fail (domain && domain[0]);
|
||||
|
||||
glade_register_translated_value (type, value, dgettext (domain, string));
|
||||
}
|
||||
|
||||
void
|
||||
glade_register_translated_value (GType type,
|
||||
const gchar *value,
|
||||
const gchar *string)
|
||||
{
|
||||
ValueTab *tab;
|
||||
gpointer klass;
|
||||
GList *values;
|
||||
|
||||
g_return_if_fail (value && value[0]);
|
||||
klass = g_type_class_ref (type);
|
||||
g_return_if_fail (klass != NULL);
|
||||
|
||||
if (!values_hash)
|
||||
values_hash = g_hash_table_new (NULL, NULL);
|
||||
|
||||
tab = g_new0 (ValueTab, 1);
|
||||
tab->value = g_strdup (value);
|
||||
tab->string = g_strdup (string);
|
||||
tab->disabled = FALSE;
|
||||
|
||||
if ((values = g_hash_table_lookup (values_hash, klass)) != NULL)
|
||||
{
|
||||
if (!g_list_find_custom
|
||||
(values, tab->value, (GCompareFunc) find_by_value))
|
||||
values = g_list_append (values, tab);
|
||||
else
|
||||
{
|
||||
g_warning ("Already registered displayable value %s for %s (type %s)",
|
||||
tab->string, tab->value, g_type_name (type));
|
||||
g_free (tab->string);
|
||||
g_free (tab->value);
|
||||
g_free (tab);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
values = g_list_append (NULL, tab);
|
||||
g_hash_table_insert (values_hash, klass, values);
|
||||
}
|
||||
g_type_class_unref (klass);
|
||||
}
|
||||
|
||||
static ValueTab *
|
||||
get_value_tab (GType type, const gchar *value, GCompareFunc cmpfunc)
|
||||
{
|
||||
GList *values, *tab_iter;
|
||||
gpointer klass;
|
||||
ValueTab *tab;
|
||||
|
||||
if (!values_hash) return NULL;
|
||||
|
||||
klass = g_type_class_ref (type);
|
||||
|
||||
if ((values = g_hash_table_lookup (values_hash, klass)) != NULL &&
|
||||
(tab_iter = g_list_find_custom (values, value, cmpfunc)) != NULL)
|
||||
tab = tab_iter->data;
|
||||
else
|
||||
tab = NULL;
|
||||
|
||||
g_type_class_unref (klass);
|
||||
|
||||
return tab;
|
||||
}
|
||||
|
||||
gboolean
|
||||
glade_type_has_displayable_values (GType type)
|
||||
{
|
||||
gboolean has;
|
||||
gpointer klass = g_type_class_ref (type);
|
||||
|
||||
has = values_hash && g_hash_table_lookup (values_hash, klass) != NULL;
|
||||
|
||||
g_type_class_unref (klass);
|
||||
|
||||
return has;
|
||||
}
|
||||
|
||||
const gchar *
|
||||
glade_get_displayable_value (GType type, const gchar *value)
|
||||
{
|
||||
ValueTab *tab;
|
||||
|
||||
g_return_val_if_fail (value && value[0], NULL);
|
||||
|
||||
if ((tab = get_value_tab (type, value, (GCompareFunc) find_by_value)))
|
||||
return tab->string;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
const gchar *
|
||||
glade_get_value_from_displayable (GType type, const gchar *displayable)
|
||||
{
|
||||
ValueTab *tab;
|
||||
|
||||
g_return_val_if_fail (displayable && displayable[0], NULL);
|
||||
|
||||
if ((tab = get_value_tab (type, displayable, (GCompareFunc) find_by_displayable)))
|
||||
return tab->value;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
gboolean
|
||||
glade_displayable_value_is_disabled (GType type, const gchar *value)
|
||||
{
|
||||
ValueTab *tab;
|
||||
|
||||
g_return_val_if_fail (value && value[0], FALSE);
|
||||
|
||||
if ((tab = get_value_tab (type, value, (GCompareFunc) find_by_value)))
|
||||
return tab->disabled;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
glade_displayable_value_set_disabled (GType type,
|
||||
const gchar *value,
|
||||
gboolean disabled)
|
||||
{
|
||||
ValueTab *tab;
|
||||
|
||||
g_return_if_fail (value && value[0]);
|
||||
|
||||
if ((tab = get_value_tab (type, value, (GCompareFunc) find_by_value)))
|
||||
tab->disabled = disabled;
|
||||
}
|
@ -1,61 +0,0 @@
|
||||
/*
|
||||
* glade-displayable-values.h
|
||||
*
|
||||
* Copyright (C) 2008 Tristan Van Berkom.
|
||||
*
|
||||
* Authors:
|
||||
* Tristan Van Berkom <tvb@gnome.org>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __GLADE_DISAPLAYABLE_VALUES_H__
|
||||
#define __GLADE_DISAPLAYABLE_VALUES_H__
|
||||
|
||||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
void glade_register_displayable_value (GType type,
|
||||
const gchar *value,
|
||||
const gchar *domain,
|
||||
const gchar *string);
|
||||
|
||||
void glade_register_translated_value (GType type,
|
||||
const gchar *value,
|
||||
const gchar *string);
|
||||
|
||||
gboolean glade_type_has_displayable_values (GType type);
|
||||
|
||||
const
|
||||
gchar *glade_get_displayable_value (GType type,
|
||||
const gchar *value);
|
||||
|
||||
gboolean glade_displayable_value_is_disabled (GType type,
|
||||
const gchar *value);
|
||||
|
||||
void glade_displayable_value_set_disabled (GType type,
|
||||
const gchar *value,
|
||||
gboolean disabled);
|
||||
|
||||
const
|
||||
gchar *glade_get_value_from_displayable (GType type,
|
||||
const gchar *displayabe);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GLADE_DISAPLAYABLE_VALUES_H__ */
|
@ -1,175 +0,0 @@
|
||||
/*
|
||||
* glade-dnd.c
|
||||
*
|
||||
* Copyright (C) 2013 Juan Pablo Ugarte
|
||||
*
|
||||
* Authors:
|
||||
* Juan Pablo Ugarte <juanpablougarte@gmail.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "glade.h"
|
||||
#include "glade-dnd.h"
|
||||
|
||||
GtkTargetEntry *
|
||||
_glade_dnd_get_target (void)
|
||||
{
|
||||
static GtkTargetEntry target = {GLADE_DND_TARGET_DATA, GTK_TARGET_SAME_APP, GLADE_DND_INFO_DATA};
|
||||
return ⌖
|
||||
}
|
||||
|
||||
void
|
||||
_glade_dnd_dest_set (GtkWidget *target)
|
||||
{
|
||||
gtk_drag_dest_set (target, 0, _glade_dnd_get_target (), 1, GDK_ACTION_MOVE | GDK_ACTION_COPY);
|
||||
}
|
||||
|
||||
GObject *
|
||||
_glade_dnd_get_data (GdkDragContext *context,
|
||||
GtkSelectionData *selection,
|
||||
guint info)
|
||||
{
|
||||
GdkAtom target = gtk_selection_data_get_target (selection);
|
||||
gchar *target_name = gdk_atom_name (target);
|
||||
gboolean is_target_data = (g_strcmp0 (target_name, GLADE_DND_TARGET_DATA) == 0);
|
||||
|
||||
g_free (target_name);
|
||||
|
||||
if (info == GLADE_DND_INFO_DATA && is_target_data)
|
||||
{
|
||||
const guchar *data = gtk_selection_data_get_data (selection);
|
||||
if (data)
|
||||
return *((GObject **)data);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_glade_dnd_set_data (GtkSelectionData *selection, GObject *data)
|
||||
{
|
||||
static GdkAtom type = 0;
|
||||
|
||||
if (!type)
|
||||
type = gdk_atom_intern_static_string (GLADE_DND_TARGET_DATA);
|
||||
|
||||
gtk_selection_data_set (selection, type, sizeof (gpointer),
|
||||
(const guchar *)&data,
|
||||
sizeof (gpointer));
|
||||
}
|
||||
|
||||
static gboolean
|
||||
on_drag_icon_draw (GtkWidget *widget, cairo_t *cr)
|
||||
{
|
||||
GtkStyleContext *context = gtk_widget_get_style_context (widget);
|
||||
cairo_pattern_t *gradient;
|
||||
GtkAllocation alloc;
|
||||
gint x, y, w, h;
|
||||
gdouble h2;
|
||||
GdkRGBA bg;
|
||||
|
||||
/* Not needed according to GtkWidget:draw documentation
|
||||
* But seems like there is a bug when used as a drag_icon that makes the
|
||||
* cairo translation used here persist when drawing children.
|
||||
*/
|
||||
cairo_save (cr);
|
||||
|
||||
/* Clear BG */
|
||||
cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
|
||||
cairo_paint (cr);
|
||||
cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
|
||||
|
||||
gtk_widget_get_allocation (widget, &alloc);
|
||||
x = alloc.x;
|
||||
y = alloc.y;
|
||||
w = alloc.width;
|
||||
h = alloc.height;
|
||||
h2 = h/2.0;
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
|
||||
gtk_style_context_get_background_color (context, gtk_style_context_get_state (context), &bg);
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS;
|
||||
|
||||
gradient = cairo_pattern_create_linear (x, y, x, y+h);
|
||||
cairo_pattern_add_color_stop_rgba (gradient, 0, bg.red, bg.green, bg.blue, 0);
|
||||
cairo_pattern_add_color_stop_rgba (gradient, .5, bg.red, bg.green, bg.blue, .8);
|
||||
cairo_pattern_add_color_stop_rgba (gradient, 1, bg.red, bg.green, bg.blue, 0);
|
||||
|
||||
cairo_set_source (cr, gradient);
|
||||
cairo_rectangle (cr, x+h2, y, w-h, h);
|
||||
cairo_fill (cr);
|
||||
cairo_pattern_destroy (gradient);
|
||||
|
||||
gradient = cairo_pattern_create_radial (x+h2, y+h2, 0, x+h2, y+h2, h2);
|
||||
cairo_pattern_add_color_stop_rgba (gradient, 0, bg.red, bg.green, bg.blue, .8);
|
||||
cairo_pattern_add_color_stop_rgba (gradient, 1, bg.red, bg.green, bg.blue, 0);
|
||||
|
||||
cairo_set_source (cr, gradient);
|
||||
cairo_rectangle (cr, x, y, h2, h);
|
||||
cairo_fill (cr);
|
||||
|
||||
cairo_translate (cr, w-h, 0);
|
||||
cairo_set_source (cr, gradient);
|
||||
cairo_rectangle (cr, x+h2, y, h2, h);
|
||||
cairo_fill (cr);
|
||||
|
||||
cairo_pattern_destroy (gradient);
|
||||
cairo_restore (cr);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
_glade_dnd_set_icon_widget (GdkDragContext *context,
|
||||
const gchar *icon_name,
|
||||
const gchar *description)
|
||||
{
|
||||
GtkWidget *window, *box, *label, *icon;
|
||||
GdkScreen *screen;
|
||||
GdkVisual *visual;
|
||||
|
||||
screen = gdk_window_get_screen (gdk_drag_context_get_source_window (context));
|
||||
window = gtk_window_new (GTK_WINDOW_POPUP);
|
||||
|
||||
gtk_window_set_type_hint (GTK_WINDOW (window), GDK_WINDOW_TYPE_HINT_DND);
|
||||
gtk_window_set_screen (GTK_WINDOW (window), screen);
|
||||
|
||||
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (box), 12);
|
||||
|
||||
icon = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_BUTTON);
|
||||
gtk_widget_set_opacity (icon, .8);
|
||||
|
||||
label = gtk_label_new (description);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (box), icon, FALSE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (box), label, FALSE, TRUE, 0);
|
||||
|
||||
gtk_widget_show_all (box);
|
||||
gtk_container_add (GTK_CONTAINER (window), box);
|
||||
|
||||
if ((visual = gdk_screen_get_rgba_visual (screen)))
|
||||
{
|
||||
gtk_widget_set_visual (window, visual);
|
||||
gtk_widget_set_app_paintable (window, TRUE);
|
||||
g_signal_connect (window, "draw", G_CALLBACK (on_drag_icon_draw), NULL);
|
||||
}
|
||||
|
||||
g_object_ref_sink (window);
|
||||
gtk_drag_set_icon_widget (context, window, 0, 0);
|
||||
g_object_unref (window);
|
||||
}
|
@ -1,52 +0,0 @@
|
||||
/*
|
||||
* glade-dnd.h
|
||||
*
|
||||
* Copyright (C) 2013 Juan Pablo Ugarte
|
||||
*
|
||||
* Authors:
|
||||
* Juan Pablo Ugarte <juanpablougarte@gmail.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __GLADE_DND_H__
|
||||
#define __GLADE_DND_H__
|
||||
|
||||
#define GLADE_DND_INFO_DATA 96323
|
||||
#define GLADE_DND_TARGET_DATA "glade/x-drag-data"
|
||||
|
||||
#include "glade-drag.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
GtkTargetEntry *_glade_dnd_get_target (void);
|
||||
|
||||
void _glade_dnd_dest_set (GtkWidget *target);
|
||||
|
||||
void _glade_dnd_set_data (GtkSelectionData *selection,
|
||||
GObject *data);
|
||||
|
||||
GObject *_glade_dnd_get_data (GdkDragContext *context,
|
||||
GtkSelectionData *selection,
|
||||
guint info);
|
||||
|
||||
void _glade_dnd_set_icon_widget (GdkDragContext *context,
|
||||
const gchar *icon_name,
|
||||
const gchar *description);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GLADE_DND_H__ */
|
@ -1,86 +0,0 @@
|
||||
/*
|
||||
* glade-drag.c
|
||||
*
|
||||
* Copyright (C) 2013 Juan Pablo Ugarte
|
||||
*
|
||||
* Authors:
|
||||
* Juan Pablo Ugarte <juanpablougarte@gmail.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "glade-drag.h"
|
||||
|
||||
G_DEFINE_INTERFACE (_GladeDrag, _glade_drag, G_TYPE_OBJECT)
|
||||
|
||||
static void
|
||||
_glade_drag_default_init (_GladeDragInterface *iface)
|
||||
{
|
||||
}
|
||||
|
||||
gboolean
|
||||
_glade_drag_can_drag (_GladeDrag *source)
|
||||
{
|
||||
_GladeDragInterface *iface;
|
||||
|
||||
g_return_val_if_fail (GLADE_IS_DRAG (source), FALSE);
|
||||
iface = GLADE_DRAG_GET_IFACE (source);
|
||||
|
||||
if (iface->can_drag)
|
||||
return iface->can_drag (source);
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
_glade_drag_can_drop (_GladeDrag *dest, gint x, gint y, GObject *data)
|
||||
{
|
||||
_GladeDragInterface *iface;
|
||||
|
||||
g_return_val_if_fail (GLADE_IS_DRAG (dest), FALSE);
|
||||
iface = GLADE_DRAG_GET_IFACE (dest);
|
||||
|
||||
if (iface->can_drop)
|
||||
return iface->can_drop (dest, x, y, data);
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
_glade_drag_drop (_GladeDrag *dest, gint x, gint y, GObject *data)
|
||||
{
|
||||
_GladeDragInterface *iface;
|
||||
|
||||
g_return_val_if_fail (GLADE_IS_DRAG (dest), FALSE);
|
||||
iface = GLADE_DRAG_GET_IFACE (dest);
|
||||
|
||||
if (iface->drop)
|
||||
return iface->drop (dest, x, y, data);
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
_glade_drag_highlight (_GladeDrag *dest, gint x, gint y)
|
||||
{
|
||||
_GladeDragInterface *iface;
|
||||
|
||||
g_return_if_fail (GLADE_IS_DRAG (dest));
|
||||
iface = GLADE_DRAG_GET_IFACE (dest);
|
||||
|
||||
if (iface->highlight)
|
||||
iface->highlight (dest, x, y);
|
||||
}
|
@ -1,74 +0,0 @@
|
||||
/*
|
||||
* glade-drag.h
|
||||
*
|
||||
* Copyright (C) 2013 Juan Pablo Ugarte
|
||||
*
|
||||
* Authors:
|
||||
* Juan Pablo Ugarte <juanpablougarte@gmail.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _GLADE_DRAG_H_
|
||||
#define _GLADE_DRAG_H_
|
||||
|
||||
#include "glade-widget-adaptor.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GLADE_TYPE_DRAG _glade_drag_get_type ()
|
||||
G_DECLARE_INTERFACE (_GladeDrag, _glade_drag, GLADE, DRAG, GObject)
|
||||
|
||||
struct __GladeDragInterface
|
||||
{
|
||||
GTypeInterface parent_instance;
|
||||
|
||||
gboolean (*can_drag) (_GladeDrag *source);
|
||||
|
||||
gboolean (*can_drop) (_GladeDrag *dest,
|
||||
gint x,
|
||||
gint y,
|
||||
GObject *data);
|
||||
|
||||
gboolean (*drop) (_GladeDrag *dest,
|
||||
gint x,
|
||||
gint y,
|
||||
GObject *data);
|
||||
|
||||
void (*highlight) (_GladeDrag *dest,
|
||||
gint x,
|
||||
gint y);
|
||||
};
|
||||
|
||||
gboolean _glade_drag_can_drag (_GladeDrag *source);
|
||||
|
||||
gboolean _glade_drag_can_drop (_GladeDrag *dest,
|
||||
gint x,
|
||||
gint y,
|
||||
GObject *data);
|
||||
|
||||
gboolean _glade_drag_drop (_GladeDrag *dest,
|
||||
gint x,
|
||||
gint y,
|
||||
GObject *data);
|
||||
|
||||
void _glade_drag_highlight (_GladeDrag *dest,
|
||||
gint x,
|
||||
gint y);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* _GLADE_DRAG_DEST_H_ */
|
@ -1,222 +0,0 @@
|
||||
/*
|
||||
* glade-editable.c
|
||||
*
|
||||
* Copyright (C) 2008 Tristan Van Berkom.
|
||||
*
|
||||
* Authors:
|
||||
* Tristan Van Berkom <tvb@gnome.org>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <glib/gi18n-lib.h>
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "glade-project.h"
|
||||
#include "glade-widget.h"
|
||||
#include "glade-editable.h"
|
||||
|
||||
G_DEFINE_INTERFACE (GladeEditable, glade_editable, GTK_TYPE_WIDGET)
|
||||
|
||||
static GQuark glade_editable_project_quark = 0;
|
||||
static GQuark glade_editable_widget_quark = 0;
|
||||
static GQuark glade_editable_loading_quark = 0;
|
||||
static GQuark glade_editable_destroy_quark = 0;
|
||||
|
||||
static void
|
||||
project_changed (GladeProject *project,
|
||||
GladeCommand *command,
|
||||
gboolean execute,
|
||||
GladeEditable *editable)
|
||||
{
|
||||
GladeWidget *widget;
|
||||
|
||||
widget = g_object_get_qdata (G_OBJECT (editable), glade_editable_widget_quark);
|
||||
|
||||
glade_editable_load (editable, widget);
|
||||
}
|
||||
|
||||
static void
|
||||
project_closed (GladeProject *project,
|
||||
GladeEditable *editable)
|
||||
{
|
||||
glade_editable_load (editable, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
editable_destroyed (GladeEditable *editable)
|
||||
{
|
||||
glade_editable_load (editable, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
glade_editable_load_default (GladeEditable *editable,
|
||||
GladeWidget *widget)
|
||||
{
|
||||
GladeWidget *old_widget;
|
||||
GladeProject *old_project;
|
||||
|
||||
old_widget = g_object_get_qdata (G_OBJECT (editable), glade_editable_widget_quark);
|
||||
old_project = g_object_get_qdata (G_OBJECT (editable), glade_editable_project_quark);
|
||||
|
||||
if (old_widget != widget)
|
||||
{
|
||||
if (old_project)
|
||||
{
|
||||
g_signal_handlers_disconnect_by_func (old_project, G_CALLBACK (project_changed), editable);
|
||||
g_signal_handlers_disconnect_by_func (old_project, G_CALLBACK (project_closed), editable);
|
||||
|
||||
g_object_set_qdata (G_OBJECT (editable), glade_editable_widget_quark, NULL);
|
||||
g_object_set_qdata (G_OBJECT (editable), glade_editable_project_quark, NULL);
|
||||
}
|
||||
|
||||
if (widget)
|
||||
{
|
||||
GladeProject *project = glade_widget_get_project (widget);
|
||||
|
||||
g_object_set_qdata (G_OBJECT (editable), glade_editable_widget_quark, widget);
|
||||
g_object_set_qdata (G_OBJECT (editable), glade_editable_project_quark, project);
|
||||
|
||||
g_signal_connect (project, "changed",
|
||||
G_CALLBACK (project_changed), editable);
|
||||
g_signal_connect (project, "close",
|
||||
G_CALLBACK (project_closed), editable);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
glade_editable_default_init (GladeEditableInterface *iface)
|
||||
{
|
||||
glade_editable_project_quark = g_quark_from_static_string ("glade-editable-project-quark");
|
||||
glade_editable_widget_quark = g_quark_from_static_string ("glade-editable-widget-quark");
|
||||
glade_editable_loading_quark = g_quark_from_static_string ("glade-editable-loading-quark");
|
||||
glade_editable_destroy_quark = g_quark_from_static_string ("glade-editable-destroy-quark");
|
||||
|
||||
iface->load = glade_editable_load_default;
|
||||
}
|
||||
|
||||
/**
|
||||
* glade_editable_load:
|
||||
* @editable: A #GladeEditable
|
||||
* @widget: the #GladeWidget to load
|
||||
*
|
||||
* Loads @widget property values into @editable
|
||||
* (the editable will watch the widgets properties
|
||||
* until its loaded with another widget or %NULL)
|
||||
*/
|
||||
void
|
||||
glade_editable_load (GladeEditable *editable, GladeWidget *widget)
|
||||
{
|
||||
GladeEditableInterface *iface;
|
||||
g_return_if_fail (GLADE_IS_EDITABLE (editable));
|
||||
g_return_if_fail (widget == NULL || GLADE_IS_WIDGET (widget));
|
||||
|
||||
/* Connect to the destroy signal once, make sure we unload the widget and disconnect
|
||||
* to any signals when destroying
|
||||
*/
|
||||
if (!GPOINTER_TO_INT (g_object_get_qdata (G_OBJECT (editable), glade_editable_destroy_quark)))
|
||||
{
|
||||
g_signal_connect (editable, "destroy", G_CALLBACK (editable_destroyed), NULL);
|
||||
g_object_set_qdata (G_OBJECT (editable), glade_editable_destroy_quark, GINT_TO_POINTER (TRUE));
|
||||
}
|
||||
|
||||
iface = GLADE_EDITABLE_GET_IFACE (editable);
|
||||
|
||||
g_object_set_qdata (G_OBJECT (editable), glade_editable_loading_quark, GINT_TO_POINTER (TRUE));
|
||||
|
||||
if (iface->load)
|
||||
iface->load (editable, widget);
|
||||
else
|
||||
g_critical ("No GladeEditable::load() support on type %s",
|
||||
G_OBJECT_TYPE_NAME (editable));
|
||||
|
||||
g_object_set_qdata (G_OBJECT (editable), glade_editable_loading_quark, GINT_TO_POINTER (FALSE));
|
||||
}
|
||||
|
||||
/**
|
||||
* glade_editable_set_show_name:
|
||||
* @editable: A #GladeEditable
|
||||
* @show_name: Whether or not to show the name entry
|
||||
*
|
||||
* This only applies for the general page in the property
|
||||
* editor, editables that embed the #GladeEditorTable implementation
|
||||
* for the general page should use this to forward the message
|
||||
* to its embedded editable.
|
||||
*/
|
||||
void
|
||||
glade_editable_set_show_name (GladeEditable *editable, gboolean show_name)
|
||||
{
|
||||
GladeEditableInterface *iface;
|
||||
g_return_if_fail (GLADE_IS_EDITABLE (editable));
|
||||
|
||||
iface = GLADE_EDITABLE_GET_IFACE (editable);
|
||||
|
||||
if (iface->set_show_name)
|
||||
iface->set_show_name (editable, show_name);
|
||||
}
|
||||
|
||||
/**
|
||||
* glade_editable_loaded_widget:
|
||||
* @editable: A #GladeEditable
|
||||
*
|
||||
* Returns: (transfer none) (nullable): a #GladeWidget or %NULL if the editable hasn't been loaded
|
||||
*/
|
||||
GladeWidget *
|
||||
glade_editable_loaded_widget (GladeEditable *editable)
|
||||
{
|
||||
return g_object_get_qdata (G_OBJECT (editable), glade_editable_widget_quark);
|
||||
}
|
||||
|
||||
gboolean
|
||||
glade_editable_loading (GladeEditable *editable)
|
||||
{
|
||||
return GPOINTER_TO_INT (g_object_get_qdata (G_OBJECT (editable), glade_editable_loading_quark));
|
||||
}
|
||||
|
||||
void
|
||||
glade_editable_block (GladeEditable *editable)
|
||||
{
|
||||
GladeProject *project;
|
||||
|
||||
g_return_if_fail (GLADE_IS_EDITABLE (editable));
|
||||
|
||||
project = g_object_get_qdata (G_OBJECT (editable), glade_editable_project_quark);
|
||||
|
||||
g_return_if_fail (GLADE_IS_PROJECT (project));
|
||||
|
||||
g_signal_handlers_block_by_func (project, G_CALLBACK (project_changed), editable);
|
||||
}
|
||||
|
||||
void
|
||||
glade_editable_unblock (GladeEditable *editable)
|
||||
{
|
||||
GladeProject *project;
|
||||
|
||||
g_return_if_fail (GLADE_IS_EDITABLE (editable));
|
||||
|
||||
project = g_object_get_qdata (G_OBJECT (editable), glade_editable_project_quark);
|
||||
|
||||
g_return_if_fail (GLADE_IS_PROJECT (project));
|
||||
|
||||
g_signal_handlers_unblock_by_func (project, G_CALLBACK (project_changed), editable);
|
||||
}
|
@ -1,70 +0,0 @@
|
||||
/*
|
||||
* glade-editable.h
|
||||
*
|
||||
* Copyright (C) 2008 Tristan Van Berkom.
|
||||
*
|
||||
* Authors:
|
||||
* Tristan Van Berkom <tvb@gnome.org>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __GLADE_EDITABLE_H__
|
||||
#define __GLADE_EDITABLE_H__
|
||||
|
||||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GLADE_TYPE_EDITABLE glade_editable_get_type ()
|
||||
G_DECLARE_INTERFACE (GladeEditable, glade_editable, GLADE, EDITABLE, GtkWidget)
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GLADE_PAGE_GENERAL,
|
||||
GLADE_PAGE_COMMON,
|
||||
GLADE_PAGE_PACKING,
|
||||
GLADE_PAGE_ATK,
|
||||
GLADE_PAGE_QUERY,
|
||||
GLADE_PAGE_SIGNAL
|
||||
} GladeEditorPageType;
|
||||
|
||||
|
||||
struct _GladeEditableInterface
|
||||
{
|
||||
GTypeInterface g_iface;
|
||||
|
||||
/* virtual table */
|
||||
void (* load) (GladeEditable *editable,
|
||||
GladeWidget *widget);
|
||||
void (* set_show_name) (GladeEditable *editable,
|
||||
gboolean show_name);
|
||||
};
|
||||
|
||||
void glade_editable_load (GladeEditable *editable,
|
||||
GladeWidget *widget);
|
||||
void glade_editable_set_show_name (GladeEditable *editable,
|
||||
gboolean show_name);
|
||||
GladeWidget *glade_editable_loaded_widget (GladeEditable *editable);
|
||||
gboolean glade_editable_loading (GladeEditable *editable);
|
||||
|
||||
void glade_editable_block (GladeEditable *editable);
|
||||
void glade_editable_unblock (GladeEditable *editable);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GLADE_EDITABLE_H__ */
|
@ -1,136 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2001 Ximian, Inc.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Authors:
|
||||
* Tristan Van Berkom <tvb@gnome.org>
|
||||
*/
|
||||
|
||||
#ifndef __GLADE_EDITOR_PROPERTY_H__
|
||||
#define __GLADE_EDITOR_PROPERTY_H__
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/*******************************************************************************
|
||||
Boiler plate macros (inspired from glade-command.c)
|
||||
*******************************************************************************/
|
||||
/* XXX document me ! */
|
||||
|
||||
#define GLADE_MAKE_EPROP(type, func, MODULE, OBJ_NAME) \
|
||||
G_DECLARE_FINAL_TYPE (type, func, MODULE, OBJ_NAME, GladeEditorProperty) \
|
||||
G_DEFINE_TYPE (type, func, GLADE_TYPE_EDITOR_PROPERTY) \
|
||||
static void \
|
||||
func ## _finalize (GObject *object); \
|
||||
static void \
|
||||
func ## _load (GladeEditorProperty *me, GladeProperty *property); \
|
||||
static GtkWidget * \
|
||||
func ## _create_input (GladeEditorProperty *me); \
|
||||
static void \
|
||||
func ## _class_init (type ## Class *klass) \
|
||||
{ \
|
||||
GladeEditorPropertyClass *ep_class = GLADE_EDITOR_PROPERTY_CLASS (klass); \
|
||||
GObjectClass* object_class = G_OBJECT_CLASS (klass); \
|
||||
ep_class->load = func ## _load; \
|
||||
ep_class->create_input = func ## _create_input; \
|
||||
object_class->finalize = func ## _finalize; \
|
||||
} \
|
||||
static void \
|
||||
func ## _init (type *self) \
|
||||
{ \
|
||||
}
|
||||
|
||||
#define GLADE_TYPE_EDITOR_PROPERTY glade_editor_property_get_type ()
|
||||
G_DECLARE_DERIVABLE_TYPE (GladeEditorProperty, glade_editor_property, GLADE, EDITOR_PROPERTY, GtkBox)
|
||||
|
||||
struct _GladeEditorPropertyClass {
|
||||
GtkBoxClass parent_class;
|
||||
|
||||
void (* load) (GladeEditorProperty *eprop, GladeProperty *property);
|
||||
GtkWidget *(* create_input) (GladeEditorProperty *eprop);
|
||||
void (* commit) (GladeEditorProperty *eprop, GValue *value);
|
||||
void *(* changed) (GladeEditorProperty *eprop, GladeProperty *property);
|
||||
|
||||
gpointer padding[4];
|
||||
};
|
||||
|
||||
void glade_editor_property_load (GladeEditorProperty *eprop,
|
||||
GladeProperty *property);
|
||||
|
||||
void glade_editor_property_load_by_widget (GladeEditorProperty *eprop,
|
||||
GladeWidget *widget);
|
||||
|
||||
void glade_editor_property_commit (GladeEditorProperty *eprop,
|
||||
GValue *value);
|
||||
void glade_editor_property_commit_no_callback (GladeEditorProperty *eprop,
|
||||
GValue *value);
|
||||
void glade_editor_property_set_custom_text (GladeEditorProperty *eprop,
|
||||
const gchar *custom_text);
|
||||
const gchar *glade_editor_property_get_custom_text (GladeEditorProperty *eprop);
|
||||
void glade_editor_property_set_disable_check (GladeEditorProperty *eprop,
|
||||
gboolean disable_check);
|
||||
gboolean glade_editor_property_get_disable_check (GladeEditorProperty *eprop);
|
||||
|
||||
GtkWidget *glade_editor_property_get_item_label (GladeEditorProperty *eprop);
|
||||
GladePropertyDef *glade_editor_property_get_property_def (GladeEditorProperty *eprop);
|
||||
GladeProperty *glade_editor_property_get_property (GladeEditorProperty *eprop);
|
||||
gboolean glade_editor_property_loading (GladeEditorProperty *eprop);
|
||||
|
||||
gboolean glade_editor_property_show_i18n_dialog (GtkWidget *parent,
|
||||
gchar **text,
|
||||
gchar **context,
|
||||
gchar **comment,
|
||||
gboolean *translatable);
|
||||
gboolean glade_editor_property_show_resource_dialog (GladeProject *project,
|
||||
GtkWidget *parent,
|
||||
gchar **filename);
|
||||
|
||||
gboolean glade_editor_property_show_object_dialog (GladeProject *project,
|
||||
const gchar *title,
|
||||
GtkWidget *parent,
|
||||
GType object_type,
|
||||
GladeWidget *exception,
|
||||
GladeWidget **object);
|
||||
|
||||
/* Generic eprops */
|
||||
#define GLADE_TYPE_EPROP_NUMERIC (glade_eprop_numeric_get_type())
|
||||
#define GLADE_TYPE_EPROP_ENUM (glade_eprop_enum_get_type())
|
||||
#define GLADE_TYPE_EPROP_FLAGS (glade_eprop_flags_get_type())
|
||||
#define GLADE_TYPE_EPROP_COLOR (glade_eprop_color_get_type())
|
||||
#define GLADE_TYPE_EPROP_NAMED_ICON (glade_eprop_named_icon_get_type())
|
||||
#define GLADE_TYPE_EPROP_TEXT (glade_eprop_text_get_type())
|
||||
#define GLADE_TYPE_EPROP_BOOL (glade_eprop_bool_get_type())
|
||||
#define GLADE_TYPE_EPROP_CHECK (glade_eprop_check_get_type())
|
||||
#define GLADE_TYPE_EPROP_UNICHAR (glade_eprop_unichar_get_type())
|
||||
#define GLADE_TYPE_EPROP_OBJECT (glade_eprop_object_get_type())
|
||||
#define GLADE_TYPE_EPROP_OBJECTS (glade_eprop_objects_get_type())
|
||||
GType glade_eprop_numeric_get_type (void) G_GNUC_CONST;
|
||||
GType glade_eprop_enum_get_type (void) G_GNUC_CONST;
|
||||
GType glade_eprop_flags_get_type (void) G_GNUC_CONST;
|
||||
GType glade_eprop_color_get_type (void) G_GNUC_CONST;
|
||||
GType glade_eprop_named_icon_get_type (void) G_GNUC_CONST;
|
||||
GType glade_eprop_text_get_type (void) G_GNUC_CONST;
|
||||
GType glade_eprop_bool_get_type (void) G_GNUC_CONST;
|
||||
GType glade_eprop_check_get_type (void) G_GNUC_CONST;
|
||||
GType glade_eprop_unichar_get_type (void) G_GNUC_CONST;
|
||||
GType glade_eprop_object_get_type (void) G_GNUC_CONST;
|
||||
GType glade_eprop_objects_get_type (void) G_GNUC_CONST;
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GLADE_EDITOR_PROPERTY_H__ */
|
@ -1,266 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2013 Tristan Van Berkom.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Authors:
|
||||
* Tristan Van Berkom <tvb@gnome.org>
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <glib/gi18n-lib.h>
|
||||
|
||||
#include "glade.h"
|
||||
#include "glade-widget.h"
|
||||
#include "glade-popup.h"
|
||||
#include "glade-editable.h"
|
||||
#include "glade-editor-skeleton.h"
|
||||
|
||||
/* GObjectClass */
|
||||
static void glade_editor_skeleton_dispose (GObject *object);
|
||||
|
||||
/* GladeEditableInterface */
|
||||
static void glade_editor_skeleton_editable_init (GladeEditableInterface *iface);
|
||||
|
||||
/* GtkBuildableIface */
|
||||
static void glade_editor_skeleton_buildable_init (GtkBuildableIface *iface);
|
||||
|
||||
typedef struct _GladeEditorSkeletonPrivate GladeEditorSkeletonPrivate;
|
||||
|
||||
struct _GladeEditorSkeletonPrivate
|
||||
{
|
||||
GSList *editors;
|
||||
};
|
||||
|
||||
static GladeEditableInterface *parent_editable_iface;
|
||||
static GtkBuildableIface *parent_buildable_iface;
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GladeEditorSkeleton, glade_editor_skeleton, GTK_TYPE_BOX,
|
||||
G_ADD_PRIVATE (GladeEditorSkeleton)
|
||||
G_IMPLEMENT_INTERFACE (GLADE_TYPE_EDITABLE,
|
||||
glade_editor_skeleton_editable_init)
|
||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE,
|
||||
glade_editor_skeleton_buildable_init))
|
||||
|
||||
static void
|
||||
glade_editor_skeleton_init (GladeEditorSkeleton *skeleton)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
glade_editor_skeleton_class_init (GladeEditorSkeletonClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
gobject_class->dispose = glade_editor_skeleton_dispose;
|
||||
}
|
||||
|
||||
/***********************************************************
|
||||
* GObjectClass *
|
||||
***********************************************************/
|
||||
static void
|
||||
glade_editor_skeleton_dispose (GObject *object)
|
||||
{
|
||||
GladeEditorSkeleton *skeleton = GLADE_EDITOR_SKELETON (object);
|
||||
GladeEditorSkeletonPrivate *priv = glade_editor_skeleton_get_instance_private (skeleton);
|
||||
|
||||
if (priv->editors)
|
||||
{
|
||||
g_slist_free_full (priv->editors, (GDestroyNotify)g_object_unref);
|
||||
priv->editors = NULL;
|
||||
}
|
||||
|
||||
G_OBJECT_CLASS (glade_editor_skeleton_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* GladeEditableInterface *
|
||||
*******************************************************************************/
|
||||
static void
|
||||
glade_editor_skeleton_load (GladeEditable *editable,
|
||||
GladeWidget *widget)
|
||||
{
|
||||
GladeEditorSkeleton *skeleton = GLADE_EDITOR_SKELETON (editable);
|
||||
GladeEditorSkeletonPrivate *priv = glade_editor_skeleton_get_instance_private (skeleton);
|
||||
GSList *l;
|
||||
|
||||
/* Chain up to default implementation */
|
||||
parent_editable_iface->load (editable, widget);
|
||||
|
||||
for (l = priv->editors; l; l = l->next)
|
||||
{
|
||||
GladeEditable *editor = l->data;
|
||||
|
||||
glade_editable_load (editor, widget);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
glade_editor_skeleton_set_show_name (GladeEditable *editable, gboolean show_name)
|
||||
{
|
||||
GladeEditorSkeleton *skeleton = GLADE_EDITOR_SKELETON (editable);
|
||||
GladeEditorSkeletonPrivate *priv = glade_editor_skeleton_get_instance_private (skeleton);
|
||||
GSList *l;
|
||||
|
||||
for (l = priv->editors; l; l = l->next)
|
||||
{
|
||||
GladeEditable *editor = l->data;
|
||||
|
||||
glade_editable_set_show_name (editor, show_name);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
glade_editor_skeleton_editable_init (GladeEditableInterface *iface)
|
||||
{
|
||||
parent_editable_iface = g_type_default_interface_peek (GLADE_TYPE_EDITABLE);
|
||||
|
||||
iface->load = glade_editor_skeleton_load;
|
||||
iface->set_show_name = glade_editor_skeleton_set_show_name;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* GtkBuildableIface *
|
||||
*******************************************************************************/
|
||||
typedef struct
|
||||
{
|
||||
GSList *editors;
|
||||
} EditorParserData;
|
||||
|
||||
static void
|
||||
editor_start_element (GMarkupParseContext *context,
|
||||
const gchar *element_name,
|
||||
const gchar **names,
|
||||
const gchar **values,
|
||||
gpointer user_data,
|
||||
GError **error)
|
||||
{
|
||||
EditorParserData *editor_data = (EditorParserData *)user_data;
|
||||
gchar *id;
|
||||
|
||||
if (strcmp (element_name, "editor") == 0)
|
||||
{
|
||||
if (g_markup_collect_attributes (element_name,
|
||||
names,
|
||||
values,
|
||||
error,
|
||||
G_MARKUP_COLLECT_STRDUP, "id", &id,
|
||||
G_MARKUP_COLLECT_INVALID))
|
||||
{
|
||||
editor_data->editors = g_slist_append (editor_data->editors, id);
|
||||
}
|
||||
}
|
||||
else if (strcmp (element_name, "child-editors") == 0)
|
||||
;
|
||||
else
|
||||
g_warning ("Unsupported tag for GladeEditorSkeleton: %s\n", element_name);
|
||||
}
|
||||
|
||||
static const GMarkupParser editor_parser =
|
||||
{
|
||||
editor_start_element,
|
||||
};
|
||||
|
||||
static gboolean
|
||||
glade_editor_skeleton_custom_tag_start (GtkBuildable *buildable,
|
||||
GtkBuilder *builder,
|
||||
GObject *child,
|
||||
const gchar *tagname,
|
||||
GMarkupParser *parser,
|
||||
gpointer *data)
|
||||
{
|
||||
if (strcmp (tagname, "child-editors") == 0)
|
||||
{
|
||||
EditorParserData *parser_data;
|
||||
|
||||
parser_data = g_slice_new0 (EditorParserData);
|
||||
*parser = editor_parser;
|
||||
*data = parser_data;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return parent_buildable_iface->custom_tag_start (buildable, builder, child,
|
||||
tagname, parser, data);
|
||||
}
|
||||
|
||||
static void
|
||||
glade_editor_skeleton_custom_finished (GtkBuildable *buildable,
|
||||
GtkBuilder *builder,
|
||||
GObject *child,
|
||||
const gchar *tagname,
|
||||
gpointer user_data)
|
||||
{
|
||||
EditorParserData *editor_data = (EditorParserData *)user_data;
|
||||
GSList *l;
|
||||
|
||||
if (strcmp (tagname, "child-editors") != 0)
|
||||
{
|
||||
parent_buildable_iface->custom_finished (buildable, builder, child,
|
||||
tagname, user_data);
|
||||
return;
|
||||
}
|
||||
|
||||
for (l = editor_data->editors; l; l = l->next)
|
||||
{
|
||||
GObject *object;
|
||||
gchar *id = l->data;
|
||||
|
||||
object = gtk_builder_get_object (builder, id);
|
||||
|
||||
if (!GLADE_EDITABLE (object))
|
||||
g_warning ("Object '%s' is not a GladeEditable\n",
|
||||
object ? G_OBJECT_TYPE_NAME (object) : "(null)");
|
||||
else
|
||||
glade_editor_skeleton_add_editor (GLADE_EDITOR_SKELETON (buildable),
|
||||
GLADE_EDITABLE (object));
|
||||
}
|
||||
|
||||
g_slist_free_full (editor_data->editors, g_free);
|
||||
g_slice_free (EditorParserData, editor_data);
|
||||
}
|
||||
|
||||
static void
|
||||
glade_editor_skeleton_buildable_init (GtkBuildableIface *iface)
|
||||
{
|
||||
parent_buildable_iface = g_type_interface_peek_parent (iface);
|
||||
iface->custom_tag_start = glade_editor_skeleton_custom_tag_start;
|
||||
iface->custom_finished = glade_editor_skeleton_custom_finished;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* API *
|
||||
*******************************************************************************/
|
||||
GtkWidget *
|
||||
glade_editor_skeleton_new (void)
|
||||
{
|
||||
return g_object_new (GLADE_TYPE_EDITOR_SKELETON, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
glade_editor_skeleton_add_editor (GladeEditorSkeleton *skeleton,
|
||||
GladeEditable *editor)
|
||||
{
|
||||
GladeEditorSkeletonPrivate *priv = glade_editor_skeleton_get_instance_private (skeleton);
|
||||
|
||||
g_return_if_fail (GLADE_IS_EDITOR_SKELETON (skeleton));
|
||||
g_return_if_fail (GLADE_IS_EDITABLE (editor));
|
||||
|
||||
g_object_ref (editor);
|
||||
priv->editors = g_slist_prepend (priv->editors, editor);
|
||||
}
|
@ -1,45 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2013 Tristan Van Berkom.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Authors:
|
||||
* Tristan Van Berkom <tvb@gnome.org>
|
||||
*/
|
||||
|
||||
#ifndef __GLADE_EDITOR_SKELETON_H__
|
||||
#define __GLADE_EDITOR_SKELETON_H__
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <gladeui/glade-xml-utils.h>
|
||||
#include <gladeui/glade-editable.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GLADE_TYPE_EDITOR_SKELETON glade_editor_skeleton_get_type ()
|
||||
G_DECLARE_DERIVABLE_TYPE (GladeEditorSkeleton, glade_editor_skeleton, GLADE, EDITOR_SKELETON, GtkBox)
|
||||
|
||||
struct _GladeEditorSkeletonClass
|
||||
{
|
||||
GtkBoxClass parent_class;
|
||||
};
|
||||
|
||||
GtkWidget *glade_editor_skeleton_new (void);
|
||||
void glade_editor_skeleton_add_editor (GladeEditorSkeleton *skeleton,
|
||||
GladeEditable *editor);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GLADE_EDITOR_SKELETON_H__ */
|