[Galago-commits] r2287 - in trunk: . notify-daemon-ng
notify-daemon-ng/src
galago-commits at freedesktop.org
galago-commits at freedesktop.org
Thu Nov 10 12:41:43 PST 2005
Author: johnp
Date: 2005-11-10 12:41:37 -0800 (Thu, 10 Nov 2005)
New Revision: 2287
Added:
trunk/notify-daemon-ng/
trunk/notify-daemon-ng/AUTHORS
trunk/notify-daemon-ng/COPYING
trunk/notify-daemon-ng/ChangeLog
trunk/notify-daemon-ng/INSTALL
trunk/notify-daemon-ng/Makefile.am
trunk/notify-daemon-ng/NEWS
trunk/notify-daemon-ng/README
trunk/notify-daemon-ng/acinclude.m4
trunk/notify-daemon-ng/autogen.sh
trunk/notify-daemon-ng/configure.ac
trunk/notify-daemon-ng/nd-test-compile
trunk/notify-daemon-ng/notification-daemon.service.in
trunk/notify-daemon-ng/src/
trunk/notify-daemon-ng/src/Makefile.am
trunk/notify-daemon-ng/src/eggnotificationbubblewidget.c
trunk/notify-daemon-ng/src/eggnotificationbubblewidget.h
trunk/notify-daemon-ng/src/notifydaemon-dbus-glue.h
trunk/notify-daemon-ng/src/notifydaemon.c
trunk/notify-daemon-ng/src/notifydaemon.h
trunk/notify-daemon-ng/src/notifydaemon.xml
Log:
Initial import for the next generation notification daemon
Added: trunk/notify-daemon-ng/AUTHORS
===================================================================
--- trunk/notify-daemon-ng/AUTHORS 2005-11-10 19:18:10 UTC (rev 2286)
+++ trunk/notify-daemon-ng/AUTHORS 2005-11-10 20:41:37 UTC (rev 2287)
@@ -0,0 +1 @@
+John (J5) Palmieri <johnp at redhat.com>
Added: trunk/notify-daemon-ng/COPYING
===================================================================
--- trunk/notify-daemon-ng/COPYING 2005-11-10 19:18:10 UTC (rev 2286)
+++ trunk/notify-daemon-ng/COPYING 2005-11-10 20:41:37 UTC (rev 2287)
@@ -0,0 +1,340 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ 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.
Added: trunk/notify-daemon-ng/ChangeLog
===================================================================
--- trunk/notify-daemon-ng/ChangeLog 2005-11-10 19:18:10 UTC (rev 2286)
+++ trunk/notify-daemon-ng/ChangeLog 2005-11-10 20:41:37 UTC (rev 2287)
@@ -0,0 +1,3 @@
+2005-11-10 John (J5) Palmieri <johnp at redhat.com>
+
+ * Initial checkin of the next generation notification daemon
Added: trunk/notify-daemon-ng/INSTALL
===================================================================
--- trunk/notify-daemon-ng/INSTALL 2005-11-10 19:18:10 UTC (rev 2286)
+++ trunk/notify-daemon-ng/INSTALL 2005-11-10 20:41:37 UTC (rev 2287)
@@ -0,0 +1,229 @@
+Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software
+Foundation, Inc.
+
+ This file is free documentation; the Free Software Foundation gives
+unlimited permission to copy, distribute and modify it.
+
+Basic Installation
+==================
+
+ 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, and a
+file `config.log' containing compiler output (useful mainly for
+debugging `configure').
+
+ It can also use an optional file (typically called `config.cache'
+and enabled with `--cache-file=config.cache' or simply `-C') that saves
+the results of its tests to speed up reconfiguring. (Caching is
+disabled by default to prevent problems with accidental use of stale
+cache files.)
+
+ 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 you are using the cache, and at
+some point `config.cache' contains results you don't want to keep, you
+may remove or edit it.
+
+ The file `configure.ac' (or `configure.in') is used to create
+`configure' by a program called `autoconf'. You only need
+`configure.ac' 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. Run `./configure --help'
+for details on some of the pertinent environment variables.
+
+ You can give `configure' initial values for configuration parameters
+by setting variables in the command line or in the environment. Here
+is an example:
+
+ ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix
+
+ *Note Defining Variables::, for more details.
+
+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 support 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' cannot figure out
+automatically, but needs to determine by the type of machine the package
+will run on. Usually, assuming the package is built to be run on the
+_same_ architectures, `configure' can figure that out, but if it prints
+a message saying it cannot guess the machine type, give it the
+`--build=TYPE' option. TYPE can either be a short name for the system
+type, such as `sun4', or a canonical name which has the form:
+
+ CPU-COMPANY-SYSTEM
+
+where SYSTEM can have one of these forms:
+
+ OS KERNEL-OS
+
+ 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 machine type.
+
+ If you are _building_ compiler tools for cross-compiling, you should
+use the `--target=TYPE' option to select the type of system they will
+produce code for.
+
+ If you want to _use_ a cross compiler, that generates code for a
+platform different from the build platform, you should specify the
+"host" platform (i.e., that on which the generated programs will
+eventually be run) with `--host=TYPE'.
+
+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.
+
+Defining Variables
+==================
+
+ Variables not defined in a site shell script can be set in the
+environment passed to `configure'. However, some packages may run
+configure again during the build, and the customized values of these
+variables may be lost. In order to avoid this problem, you should set
+them in the `configure' command line, using `VAR=value'. For example:
+
+ ./configure CC=/usr/local2/bin/gcc
+
+will cause the specified gcc to be used as the C compiler (unless it is
+overridden in the site shell script).
+
+`configure' Invocation
+======================
+
+ `configure' recognizes the following options to control how it
+operates.
+
+`--help'
+`-h'
+ Print a summary of the options to `configure', and exit.
+
+`--version'
+`-V'
+ Print the version of Autoconf used to generate the `configure'
+ script, and exit.
+
+`--cache-file=FILE'
+ Enable the cache: use and save the results of the tests in FILE,
+ traditionally `config.cache'. FILE defaults to `/dev/null' to
+ disable caching.
+
+`--config-cache'
+`-C'
+ Alias for `--cache-file=config.cache'.
+
+`--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.
+
+`configure' also accepts some other, not widely useful, options. Run
+`configure --help' for more details.
+
Added: trunk/notify-daemon-ng/Makefile.am
===================================================================
--- trunk/notify-daemon-ng/Makefile.am 2005-11-10 19:18:10 UTC (rev 2286)
+++ trunk/notify-daemon-ng/Makefile.am 2005-11-10 20:41:37 UTC (rev 2287)
@@ -0,0 +1,22 @@
+SUBDIRS = src
+
+EXTRA_DIST = \
+ AUTHORS NEWS INSTALL COPYING README \
+ ChangeLog \
+ Doxyfile.in \
+ autogen.sh \
+ configure.ac \
+ notification-daemon.service \
+ notification-daemon.service.in
+
+servicedir = $(DBUS_SERVICES_DIR)
+service_in_files = notification-daemon.service.in
+service_DATA = notification-daemon.service
+
+%.service: %.service.in
+ @sed -e "s|\@libexecdir\@|$(libexecdir)|" $< > $@
+
+$(OBJECTS): libtool
+libtool: $(LIBTOOL_DEPS)
+ $(SHELL) ./config.status --recheck
+
Added: trunk/notify-daemon-ng/NEWS
===================================================================
Added: trunk/notify-daemon-ng/README
===================================================================
Added: trunk/notify-daemon-ng/acinclude.m4
===================================================================
--- trunk/notify-daemon-ng/acinclude.m4 2005-11-10 19:18:10 UTC (rev 2286)
+++ trunk/notify-daemon-ng/acinclude.m4 2005-11-10 20:41:37 UTC (rev 2287)
@@ -0,0 +1,40 @@
+dnl AS_AC_EXPAND(VAR, CONFIGURE_VAR)
+dnl
+dnl example
+dnl AS_AC_EXPAND(SYSCONFDIR, $sysconfdir)
+dnl will set SYSCONFDIR to /usr/local/etc if prefix=/usr/local
+
+AC_DEFUN([AS_AC_EXPAND],
+[
+ EXP_VAR=[$1]
+ FROM_VAR=[$2]
+
+ dnl first expand prefix and exec_prefix if necessary
+ prefix_save=$prefix
+ exec_prefix_save=$exec_prefix
+
+ dnl if no prefix given, then use /usr/local, the default prefix
+ if test "x$prefix" = "xNONE"; then
+ prefix=$ac_default_prefix
+ fi
+ dnl if no exec_prefix given, then use prefix
+ if test "x$exec_prefix" = "xNONE"; then
+ exec_prefix=$prefix
+ fi
+
+ full_var="$FROM_VAR"
+ dnl loop until it doesn't change anymore
+ while true; do
+ new_full_var="`eval echo $full_var`"
+ if test "x$new_full_var"="x$full_var"; then break; fi
+ full_var=$new_full_var
+ done
+
+ dnl clean up
+ full_var=$new_full_var
+ AC_SUBST([$1], "$full_var")
+
+ dnl restore prefix and exec_prefix
+ prefix=$prefix_save
+ exec_prefix=$exec_prefix_save
+])
Added: trunk/notify-daemon-ng/autogen.sh
===================================================================
--- trunk/notify-daemon-ng/autogen.sh 2005-11-10 19:18:10 UTC (rev 2286)
+++ trunk/notify-daemon-ng/autogen.sh 2005-11-10 20:41:37 UTC (rev 2287)
@@ -0,0 +1,58 @@
+#!/bin/sh
+# Run this to generate all the initial makefiles, etc.
+
+DIE=0
+
+PACKAGE=libnotify
+
+echo "Generating configuration files for $PACKAGE, please wait..."
+
+(autoconf --version) < /dev/null > /dev/null 2>&1 || {
+ echo
+ echo "You must have autoconf installed to compile $PACKAGE."
+ echo "Download the appropriate package for your distribution,"
+ echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
+ DIE=1
+}
+
+(libtool --version) < /dev/null > /dev/null 2>&1 || {
+ echo
+ echo "You must have libtool installed to compile $PACKAGE."
+ echo "Download the appropriate package for your distribution,"
+ echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
+ DIE=1
+}
+
+(automake --version) < /dev/null > /dev/null 2>&1 || {
+ echo
+ echo "You must have automake installed to compile $PACKAGE."
+ echo "Download the appropriate package for your distribution,"
+ echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
+ DIE=1
+}
+
+[ $DIE -eq 1 ] && exit 1;
+
+echo " libtoolize --copy --force"
+libtoolize --copy --force
+echo " aclocal $ACLOCAL_FLAGS"
+aclocal $ACLOCAL_FLAGS
+echo " autoheader"
+autoheader
+echo " automake --add-missing"
+automake --add-missing
+echo " autoconf"
+autoconf
+
+if [ -x config.status -a -z "$*" ]; then
+ ./config.status --recheck
+else
+ if test -z "$*"; then
+ echo "I am going to run ./configure with no arguments - if you wish"
+ echo "to pass any to it, please specify them on the $0 command line."
+ echo "If you do not wish to run ./configure, press Ctrl-C now."
+ trap 'echo "configure aborted" ; exit 0' 1 2 15
+ sleep 1
+ fi
+ ./configure "$@";
+fi
Property changes on: trunk/notify-daemon-ng/autogen.sh
___________________________________________________________________
Name: svn:executable
+
Added: trunk/notify-daemon-ng/configure.ac
===================================================================
--- trunk/notify-daemon-ng/configure.ac 2005-11-10 19:18:10 UTC (rev 2286)
+++ trunk/notify-daemon-ng/configure.ac 2005-11-10 20:41:37 UTC (rev 2287)
@@ -0,0 +1,165 @@
+dnl Process this file with autoconf to create configure.
+
+dnl ################################################################
+dnl # Initialize autoconf
+dnl ################################################################
+AC_INIT(notification-daemon, 0.0.2, johnp at redhat.com)
+AC_PREREQ(2.50)
+AC_CONFIG_SRCDIR(config.h.in)
+AC_COPYRIGHT([Copyright 2005 John (J5) Palmieri])
+
+
+dnl ################################################################
+dnl # Version information
+dnl ################################################################
+NOTIFICATION_DAEMON_MAJOR_VERSION=0
+NOTIFICATION_DAEMON_MINOR_VERSION=0
+NOTIFICATION_DAEMON_MICRO_VERSION=2
+NOTIFICATION_DAEMON_DEVEL_VERSION=0
+
+NOTIFICATION_DAEMON_VERSION=$NOTIFICATION_DAEMON_MAJOR_VERSION.$NOTIFICATION_DAEMON_MINOR_VERSION.$NOTIFICATION_DAEMON_MICRO_VERSION
+
+if test "x$NOTIFICATION_DAEMON_DEVEL_VERSION" != "x0"; then
+ if test "x$NOTIFICATION_DAEMON_MICRO_VERSION" = "x0"; then
+ NOTIFICATION_DAEMON_MICRO_VERSION=$NOTIFICATION_DAEMON_DEVEL_VERSION
+ NOTIFICATION_DAEMON_VERSION=$NOTIFICATION_DAEMON_MAJOR_VERSION.$NOTIFICATION_DAEMON_MINOR_VERSION.$NOTIFICATION_DAEMON_DEVEL_VERSION
+ else
+ NOTIFICATION_DAEMON_VERSION=$NOTIFICATION_DAEMON_VERSION.$NOTIFICATION_DAEMON_DEVEL_VERSION
+ fi
+fi
+
+AC_DEFINE_UNQUOTED(NOTIFICATION_DAEMON_MAJOR_VERSION, $NOTIFICATION_DAEMON_MAJOR_VERSION,
+ [notification-daemon major version.])
+AC_DEFINE_UNQUOTED(NOTIFICATION_DAEMON_MINOR_VERSION, $NOTIFICATION_DAEMON_MINOR_VERSION,
+ [notification-daemon minor version.])
+AC_DEFINE_UNQUOTED(NOTIFICATION_DAEMON_MICRO_VERSION, $NOTIFICATION_DAEMON_MICRO_VERSION,
+ [notification-daemon micro version.])
+AC_DEFINE_UNQUOTED(NOTIFICATION_DAEMON_VERSION, "$NOTIFICATION_DAEMON_VERSION",
+ [notification-daemon version.])
+
+dnl ################################################################
+dnl # Initialize automake
+dnl ################################################################
+VERSION=$NOTIFICATION_DAEMON_VERSION
+PACKAGE=notification-daemon
+
+AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
+
+dnl ################################################################
+dnl # Specify a header configuration file
+dnl ################################################################
+AM_CONFIG_HEADER(config.h)
+
+dnl ################################################################
+dnl # Check for some standard stuff.
+dnl ################################################################
+AC_PROG_CC
+#AC_ARG_PROGRAM
+AC_PROG_CPP
+AC_PROG_MAKE_SET
+AC_PROG_LN_S
+AC_PROG_INSTALL
+
+AC_C_CONST
+AC_TYPE_SIZE_T
+AC_EXEEXT
+
+AM_PROG_LIBTOOL
+
+AC_CHECK_LIB([popt], [poptGetArg], , AC_MSG_ERROR([Popt is required]))
+
+pkg_modules="gtk+-2.0 >= 2.2.2 glib-2.0 >= 2.2.2, dbus-1 >= 0.35, dbus-glib-1 >= 0.35"
+PKG_CHECK_MODULES(NOTIFICATION_DAEMON, [$pkg_modules])
+AC_SUBST(NOTIFICATION_DAEMON_CFLAGS)
+AC_SUBST(NOTIFICATION_DAEMON_LIBS)
+
+gdk_modules="gdk-2.0 gdk-pixbuf-2.0"
+PKG_CHECK_MODULES(GDK, [$gdk_modules], have_gdk=yes,
+[
+ have_gdk=no
+
+ AC_WARN("Some test apps will not be built")
+])
+
+AM_CONDITIONAL(HAVE_GDK, test "x$have_gdk" = "xyes")
+
+AC_SUBST(GDK_CFLAGS)
+AC_SUBST(GDK_LIBS)
+
+dnl
+dnl Check the D-BUS version.
+dnl
+
+AC_MSG_CHECKING([dbus version])
+DBUS_VERSION=`$PKG_CONFIG --modversion dbus-1`
+DBUS_MAJOR_VER=`echo $DBUS_VERSION | cut -d. -f 1`
+DBUS_MINOR_VER=`echo $DBUS_VERSION | cut -d. -f 2`
+DBUS_MICRO_VER=`echo $DBUS_VERSION | cut -d. -f 3`
+
+AC_MSG_RESULT($DBUS_VERSION)
+AC_DEFINE_UNQUOTED(DBUS_MAJOR_VER, $DBUS_MAJOR_VER, [D-BUS major version.])
+AC_DEFINE_UNQUOTED(DBUS_MINOR_VER, $DBUS_MINOR_VER, [D-BUS minor version.])
+AC_DEFINE_UNQUOTED(DBUS_MICRO_VER, $DBUS_MICRO_VER, [D-BUS micro version.])
+
+AC_DEFINE_UNQUOTED(DBUS_API_SUBJECT_TO_CHANGE, ,DBUS API is subject to change)
+
+AS_AC_EXPAND(SYSCONFDIR, $sysconfdir)
+AS_AC_EXPAND(LIBDIR, $libdir)
+AS_AC_EXPAND(DATADIR, $datadir)
+
+AC_ARG_WITH(dbus-sys, [ --with-dbus-sys=<dir> where D-BUS system.d directory is])
+AC_ARG_WITH(dbus-services, [ --with-dbus-services=<dir> where D-BUS services directory is])
+
+if ! test -z "$with_dbus_sys" ; then
+ DBUS_SYS_DIR="$with_dbus_sys"
+else
+ DBUS_SYS_DIR="$SYSCONFDIR/dbus-1/system.d"
+fi
+
+if ! test -z "$with_dbus_services" ; then
+ DBUS_SERVICES_DIR="$with_dbus_services"
+else
+ # D-BUS 0.23 and higher use $prefix/share/dbus-1/services
+ # D-BUS 0.22 and lower use $prefix/lib/dbus-1/services
+ if test "$DBUS_MAJOR_VER" -ge 1 -o \
+ "$DBUS_MINOR_VER" -ge 23; then
+ DBUS_SERVICES_DIR="$DATADIR/dbus-1/services"
+ else
+ DBUS_SERVICES_DIR="$LIBDIR/dbus-1/services"
+ fi
+fi
+
+AC_SUBST(DBUS_SYS_DIR)
+AC_SUBST(DBUS_SERVICES_DIR)
+AC_DEFINE_UNQUOTED(DBUS_SYSTEMD_DIR, "$DBUS_SYS_DIR", [Where system.d dir for DBUS is])
+AC_DEFINE_UNQUOTED(DBUS_SERVICES_DIR, "$DBUS_SERVICES_DIR", [Where services dir for DBUS is])
+
+dnl # Use wall if we have GCC
+if test "x$GCC" = "xyes"; then
+ CFLAGS="$CFLAGS -Wall"
+fi
+
+AC_SUBST(CFLAGS)
+
+dnl ################################################################
+dnl # Output the Makefiles
+dnl ################################################################
+AC_CONFIG_FILES([
+Makefile
+notification-daemon.service
+src/Makefile
+])
+
+AC_OUTPUT
+
+echo
+echo $PACKAGE v$VERSION
+
+echo prefix............... : $prefix
+echo dbus-1 system.d dir.. : $DBUS_SYS_DIR
+echo dbus-1 services dir.. : $DBUS_SERVICES_DIR
+
+echo "Now type make to compile"
+echo "Then su to root and type: make install"
+echo
+
Added: trunk/notify-daemon-ng/nd-test-compile
===================================================================
--- trunk/notify-daemon-ng/nd-test-compile 2005-11-10 19:18:10 UTC (rev 2286)
+++ trunk/notify-daemon-ng/nd-test-compile 2005-11-10 20:41:37 UTC (rev 2287)
@@ -0,0 +1,3 @@
+dbus-binding-tool --mode=glib-server notifydaemon.xml > notifydaemon-dbus-glue.h
+
+gcc notifydaemon.c eggnotificationbubblewidget.c -o notifydaemon-test -Wall -DFORTIFY_SOURCE=3 -O1 -ggdb3 -DNOTIFY_DAEMON_ENABLE_TEST -DDBUS_API_SUBJECT_TO_CHANGE `pkg-config --cflags --libs gtk+-2.0 dbus-1 dbus-glib-1` -I ../../
Property changes on: trunk/notify-daemon-ng/nd-test-compile
___________________________________________________________________
Name: svn:executable
+
Added: trunk/notify-daemon-ng/notification-daemon.service.in
===================================================================
--- trunk/notify-daemon-ng/notification-daemon.service.in 2005-11-10 19:18:10 UTC (rev 2286)
+++ trunk/notify-daemon-ng/notification-daemon.service.in 2005-11-10 20:41:37 UTC (rev 2287)
@@ -0,0 +1,3 @@
+[D-BUS Service]
+Name=org.freedesktop.Notifications
+Exec=@libexecdir@/notification-daemon
Added: trunk/notify-daemon-ng/src/Makefile.am
===================================================================
--- trunk/notify-daemon-ng/src/Makefile.am 2005-11-10 19:18:10 UTC (rev 2286)
+++ trunk/notify-daemon-ng/src/Makefile.am 2005-11-10 20:41:37 UTC (rev 2287)
@@ -0,0 +1,22 @@
+SUBDIRS = src
+
+EXTRA_DIST = \
+ AUTHORS NEWS INSTALL COPYING README \
+ ChangeLog \
+ Doxyfile.in \
+ autogen.sh \
+ configure.ac \
+ notification-daemon.service \
+ notification-daemon.service.in
+
+servicedir = $(DBUS_SERVICES_DIR)
+service_in_files = notification-daemon.service.in
+service_DATA = notification-daemon.service
+
+%.service: %.service.in
+ @sed -e "s|\@libexecdir\@|$(libexecdir)|" $< > $@
+
+$(OBJECTS): libtool
+libtool: $(LIBTOOL_DEPS)
+ $(SHELL) ./config.status --recheck
+
Added: trunk/notify-daemon-ng/src/eggnotificationbubblewidget.c
===================================================================
--- trunk/notify-daemon-ng/src/eggnotificationbubblewidget.c 2005-11-10 19:18:10 UTC (rev 2286)
+++ trunk/notify-daemon-ng/src/eggnotificationbubblewidget.c 2005-11-10 20:41:37 UTC (rev 2287)
@@ -0,0 +1,845 @@
+/* EggNotificationBubbleWidget
+ * Copyright (C) 2005 Colin Walters <walters at verbum.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 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+
+#include <gtk/gtk.h>
+#include "eggnotificationbubblewidget.h"
+
+#define BORDER_SIZE 15
+
+static void egg_notification_bubble_widget_class_init (EggNotificationBubbleWidgetClass *klass);
+static void egg_notification_bubble_widget_init (EggNotificationBubbleWidget *bubble_widget);
+static void egg_notification_bubble_widget_finalize (GObject *object);
+static void egg_notification_bubble_widget_event_handler (GtkWidget *widget,
+ GdkEvent *event,
+ gpointer user_data);
+static gboolean egg_notification_bubble_widget_expose (GtkWidget *widget, GdkEventExpose *event);
+
+static void populate_window (EggNotificationBubbleWidget *bubble_widget);
+static void draw_bubble_widget (EggNotificationBubbleWidget *bubble_widget);
+
+static GtkWindowClass *parent_class;
+
+#define BEVEL_ALPHA_LIGHT 0.2
+#define BEVEL_ALPHA_MEDIUM 0.5
+#define BEVEL_ALPHA_DARK 0.8
+
+
+enum
+{
+ ORIENT_TOP = 0,
+ ORIENT_BOTTOM = 1
+};
+
+enum {
+ TRIANGLE_LEFT = 0,
+ TRIANGLE_RIGHT = 1
+};
+
+enum
+{
+ NOTIFICATION_CLICKED,
+ LAST_SIGNAL
+};
+
+static guint egg_notification_bubble_widget_signals[LAST_SIGNAL] = { 0 };
+
+GType
+egg_notification_bubble_widget_get_type (void)
+{
+ static GType bubble_widget_type = 0;
+
+ if (!bubble_widget_type)
+ {
+ static const GTypeInfo bubble_widget_info =
+ {
+ sizeof (EggNotificationBubbleWidgetClass),
+ NULL, /* base_init */
+ NULL, /* base_finalize */
+ (GClassInitFunc) egg_notification_bubble_widget_class_init,
+ NULL, /* class_finalize */
+ NULL, /* class_data */
+ sizeof (EggNotificationBubbleWidget),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) egg_notification_bubble_widget_init,
+ };
+
+ bubble_widget_type = g_type_register_static (GTK_TYPE_WINDOW, "EggNotificationBubbleWidget",
+ &bubble_widget_info, 0);
+ }
+
+ return bubble_widget_type;
+}
+
+static void
+egg_notification_bubble_widget_class_init (EggNotificationBubbleWidgetClass *class)
+{
+ GObjectClass *object_class;
+ GtkWidgetClass *widget_class;
+
+ object_class = (GObjectClass *) class;
+ widget_class = (GtkWidgetClass *) class;
+
+ parent_class = g_type_class_peek_parent (class);
+
+ object_class->finalize = egg_notification_bubble_widget_finalize;
+ widget_class->expose_event = egg_notification_bubble_widget_expose;
+
+ egg_notification_bubble_widget_signals[NOTIFICATION_CLICKED] =
+ g_signal_new ("clicked",
+ EGG_TYPE_NOTIFICATION_BUBBLE_WIDGET,
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (EggNotificationBubbleWidgetClass, clicked),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE,
+ 0);
+}
+
+static void
+egg_notification_bubble_widget_init (EggNotificationBubbleWidget *bubble_widget)
+{
+ GtkWindow *win;
+
+ win = GTK_WINDOW (bubble_widget);
+
+ populate_window (bubble_widget);
+
+}
+
+static void
+egg_notification_bubble_widget_finalize (GObject *object)
+{
+ EggNotificationBubbleWidget *bubble_widget = EGG_NOTIFICATION_BUBBLE_WIDGET (object);
+
+ g_return_if_fail (bubble_widget != NULL);
+
+ if (G_OBJECT_CLASS (parent_class)->finalize)
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+populate_window (EggNotificationBubbleWidget *bubble_widget)
+{
+ g_return_if_fail (EGG_IS_NOTIFICATION_BUBBLE_WIDGET (bubble_widget));
+
+ GtkWidget *vbox;
+ GtkWidget *hbox;
+ GtkWidget *widget;
+
+ widget = GTK_WIDGET (bubble_widget);
+
+ gtk_widget_add_events (widget, GDK_BUTTON_PRESS_MASK);
+ gtk_widget_set_app_paintable (widget, TRUE);
+ gtk_window_set_resizable (GTK_WINDOW (bubble_widget), FALSE);
+ gtk_widget_set_name (widget, "gtk-tooltips");
+ gtk_container_set_border_width (GTK_CONTAINER (bubble_widget), BORDER_SIZE + 5);
+
+ bubble_widget->bubble_widget_header_label = gtk_label_new (NULL);
+ bubble_widget->bubble_widget_body_label = gtk_label_new (NULL);
+ bubble_widget->icon = gtk_image_new_from_stock (GTK_STOCK_INFO, GTK_ICON_SIZE_BUTTON);
+ gtk_label_set_line_wrap (GTK_LABEL (bubble_widget->bubble_widget_header_label), TRUE);
+ gtk_label_set_line_wrap (GTK_LABEL (bubble_widget->bubble_widget_body_label), TRUE);
+ gtk_misc_set_alignment (GTK_MISC (bubble_widget->bubble_widget_header_label), 0.0, 0.0);
+ gtk_misc_set_alignment (GTK_MISC (bubble_widget->bubble_widget_body_label), 0.0, 0.0);
+
+ gtk_misc_set_alignment (GTK_MISC (bubble_widget->icon), 0.0, 0.0);
+ gtk_widget_show (bubble_widget->icon);
+ gtk_widget_show (bubble_widget->bubble_widget_header_label);
+ gtk_widget_show (bubble_widget->bubble_widget_body_label);
+
+ bubble_widget->main_hbox = gtk_hbox_new (FALSE, 10);
+
+ vbox = gtk_vbox_new (FALSE, 5);
+ hbox = gtk_hbox_new (FALSE, 5);
+ gtk_box_pack_start (GTK_BOX (hbox), bubble_widget->icon, FALSE, FALSE, 0);
+ gtk_container_add (GTK_CONTAINER (vbox), bubble_widget->bubble_widget_header_label);
+ gtk_container_add (GTK_CONTAINER (vbox), bubble_widget->bubble_widget_body_label);
+ gtk_container_add (GTK_CONTAINER (hbox), vbox);
+ gtk_container_add (GTK_CONTAINER (bubble_widget), hbox);
+
+ g_signal_connect_after (bubble_widget, "event-after",
+ G_CALLBACK (egg_notification_bubble_widget_event_handler),
+ bubble_widget);
+
+}
+
+static void
+_destroy_pixmap_data_func (guchar *pixels,
+ gpointer data)
+{
+ g_free (pixels);
+}
+
+void
+egg_notification_bubble_widget_set_icon_from_data (EggNotificationBubbleWidget *bubble_widget,
+ const guchar *data,
+ gboolean has_alpha,
+ int bits_per_sample,
+ int width,
+ int height,
+ int rowstride)
+{
+ GdkPixbuf *pixbuf;
+
+ pixbuf = gdk_pixbuf_new_from_data (data,
+ GDK_COLORSPACE_RGB,
+ has_alpha,
+ bits_per_sample,
+ width,
+ height,
+ rowstride,
+ _destroy_pixmap_data_func,
+ NULL);
+
+ gtk_image_set_from_pixbuf (GTK_IMAGE (bubble_widget->icon), pixbuf);
+ gdk_pixbuf_unref (pixbuf);
+}
+
+void
+egg_notification_bubble_widget_set (EggNotificationBubbleWidget *bubble_widget,
+ const gchar *bubble_widget_header_text,
+ const gchar *icon,
+ const gchar *bubble_widget_body_text)
+{
+ gchar *markupquoted;
+ gchar *markuptext;
+ gchar *paddedtext;
+
+ g_return_if_fail (EGG_IS_NOTIFICATION_BUBBLE_WIDGET (bubble_widget));
+
+ g_free (bubble_widget->bubble_widget_header_text);
+ g_free (bubble_widget->bubble_widget_body_text);
+ bubble_widget->bubble_widget_header_text = g_strdup (bubble_widget_header_text);
+ bubble_widget->bubble_widget_body_text = g_strdup (bubble_widget_body_text);
+
+ if (icon != NULL || strcmp (icon, "") != 0)
+ {
+ if (g_str_has_prefix (icon, "file://"))
+ {
+ gchar *icon_path = (gchar *) icon + (7 * sizeof (gchar));
+ gtk_image_set_from_file (GTK_IMAGE (bubble_widget->icon), icon_path);
+ }
+ else
+ {
+ gtk_image_set_from_icon_name (GTK_IMAGE (bubble_widget->icon), icon, GTK_ICON_SIZE_DIALOG);
+ }
+ }
+
+ markupquoted = g_markup_escape_text (bubble_widget->bubble_widget_header_text, -1);
+ markuptext = g_strdup_printf ("<b>%s</b>", markupquoted);
+ gtk_label_set_markup (GTK_LABEL (bubble_widget->bubble_widget_header_label), markuptext);
+ g_free (markuptext);
+ g_free (markupquoted);
+
+ paddedtext = g_strdup_printf (" %s", bubble_widget->bubble_widget_body_text);
+ gtk_label_set_text (GTK_LABEL (bubble_widget->bubble_widget_body_label), paddedtext);
+ g_free (paddedtext);
+}
+
+void
+egg_notification_bubble_widget_set_pos (EggNotificationBubbleWidget *bubble_widget,
+ gint x, gint y)
+{
+ bubble_widget->x = x;
+ bubble_widget->y = y;
+}
+
+static gboolean
+egg_notification_bubble_widget_expose (GtkWidget *widget, GdkEventExpose *event)
+{
+ GtkRequisition req;
+ GtkWidgetClass *widget_parent_class;
+
+ gtk_widget_size_request (widget, &req);
+ gtk_paint_flat_box (widget->style, widget->window,
+ GTK_STATE_NORMAL, GTK_SHADOW_OUT,
+ NULL, widget, "notification",
+ 0, 0, req.width, req.height);
+
+ draw_bubble_widget (EGG_NOTIFICATION_BUBBLE_WIDGET(widget));
+
+ widget_parent_class = (GtkWidgetClass *)parent_class;
+ if (widget_parent_class->expose_event)
+ widget_parent_class->expose_event (widget, event);
+
+ return FALSE;
+}
+
+static void
+subtract_rectangle (GdkRegion *region, GdkRectangle *rectangle)
+{
+ GdkRegion *temp_region;
+
+ temp_region = gdk_region_rectangle (rectangle);
+ gdk_region_subtract (region, temp_region);
+ gdk_region_destroy (temp_region);
+}
+
+static GdkRegion *
+add_bevels_to_rectangle (GdkRectangle *rectangle, cairo_t *cairo_context, int orient, int orient_triangle)
+{
+ GdkRectangle temp_rect;
+ GdkRegion *region = gdk_region_rectangle (rectangle);
+
+ /* Top left */
+ if (!(orient == ORIENT_TOP && orient_triangle == TRIANGLE_LEFT))
+ {
+ temp_rect.width = 5;
+ temp_rect.height = 1;
+ temp_rect.x = rectangle->x;
+ temp_rect.y = rectangle->y;
+ subtract_rectangle (region, &temp_rect);
+
+ temp_rect.y += 1;
+ temp_rect.width -= 2;
+ subtract_rectangle (region, &temp_rect);
+
+ temp_rect.y += 1;
+ temp_rect.width -= 1;
+ subtract_rectangle (region, &temp_rect);
+
+ temp_rect.y += 1;
+ temp_rect.width -= 1;
+ temp_rect.height = 2;
+ subtract_rectangle (region, &temp_rect);
+
+ temp_rect.x = rectangle->x;
+ temp_rect.y = rectangle->y;
+
+ cairo_move_to (cairo_context, temp_rect.x + 3, temp_rect.y + 1.5);
+ cairo_line_to (cairo_context, temp_rect.x + 5, temp_rect.y + 1.5);
+
+ cairo_move_to (cairo_context, temp_rect.x + 2, temp_rect.y + 2.5);
+ cairo_line_to (cairo_context, temp_rect.x + 3, temp_rect.y + 2.5);
+
+ cairo_move_to (cairo_context, temp_rect.x + 1, temp_rect.y + 3.5);
+ cairo_line_to (cairo_context, temp_rect.x + 2, temp_rect.y + 3.5);
+
+ cairo_move_to (cairo_context, temp_rect.x + 1, temp_rect.y + 4.5);
+ cairo_line_to (cairo_context, temp_rect.x + 2, temp_rect.y + 4.5);
+
+ cairo_set_source_rgba (cairo_context, 0.0, 0.0, 0.0, BEVEL_ALPHA_MEDIUM);
+ cairo_stroke (cairo_context);
+
+ cairo_move_to (cairo_context, temp_rect.x + 3, temp_rect.y + 2.5);
+ cairo_line_to (cairo_context, temp_rect.x + 5, temp_rect.y + 2.5);
+
+ cairo_move_to (cairo_context, temp_rect.x + 2, temp_rect.y + 3.5);
+ cairo_line_to (cairo_context, temp_rect.x + 3, temp_rect.y + 3.5);
+
+ cairo_move_to (cairo_context, temp_rect.x + 2, temp_rect.y + 4.5);
+ cairo_line_to (cairo_context, temp_rect.x + 3, temp_rect.y + 4.5);
+
+ cairo_set_source_rgba (cairo_context, 0.0, 0.0, 0.0, BEVEL_ALPHA_LIGHT);
+ cairo_stroke (cairo_context);
+ }
+
+ /* Top right */
+ if (!(orient == ORIENT_TOP && orient_triangle == TRIANGLE_RIGHT))
+ {
+ temp_rect.width = 5;
+ temp_rect.height = 1;
+
+ temp_rect.x = (rectangle->x + rectangle->width) - temp_rect.width;
+ temp_rect.y = rectangle->y;
+ subtract_rectangle (region, &temp_rect);
+
+ temp_rect.y += 1;
+ temp_rect.x += 2;
+ subtract_rectangle (region, &temp_rect);
+
+ temp_rect.y += 1;
+ temp_rect.x += 1;
+ subtract_rectangle (region, &temp_rect);
+
+ temp_rect.y += 1;
+ temp_rect.x += 1;
+ temp_rect.height = 2;
+ subtract_rectangle (region, &temp_rect);
+
+ temp_rect.x = rectangle->x + rectangle->width;
+ temp_rect.y = rectangle->y;
+
+ cairo_move_to (cairo_context, temp_rect.x - 3, temp_rect.y + 1.5);
+ cairo_line_to (cairo_context, temp_rect.x - 5, temp_rect.y + 1.5);
+
+ cairo_move_to (cairo_context, temp_rect.x - 2, temp_rect.y + 2.5);
+ cairo_line_to (cairo_context, temp_rect.x - 3, temp_rect.y + 2.5);
+
+ cairo_move_to (cairo_context, temp_rect.x - 1, temp_rect.y + 3.5);
+ cairo_line_to (cairo_context, temp_rect.x - 2, temp_rect.y + 3.5);
+
+ cairo_move_to (cairo_context, temp_rect.x - 1, temp_rect.y + 4.5);
+ cairo_line_to (cairo_context, temp_rect.x - 2, temp_rect.y + 4.5);
+
+ cairo_set_source_rgba (cairo_context, 0.0, 0.0, 0.0, BEVEL_ALPHA_MEDIUM);
+ cairo_stroke (cairo_context);
+
+ cairo_move_to (cairo_context, temp_rect.x - 3, temp_rect.y + 2.5);
+ cairo_line_to (cairo_context, temp_rect.x - 5, temp_rect.y + 2.5);
+
+ cairo_move_to (cairo_context, temp_rect.x - 2, temp_rect.y + 3.5);
+ cairo_line_to (cairo_context, temp_rect.x - 3, temp_rect.y + 3.5);
+
+ cairo_move_to (cairo_context, temp_rect.x - 2, temp_rect.y + 4.5);
+ cairo_line_to (cairo_context, temp_rect.x - 3, temp_rect.y + 4.5);
+
+ cairo_set_source_rgba (cairo_context, 0.0, 0.0, 0.0, BEVEL_ALPHA_LIGHT);
+ cairo_stroke (cairo_context);
+
+ }
+
+ /* Bottom right */
+ if (!(orient == ORIENT_BOTTOM && orient_triangle == TRIANGLE_RIGHT))
+ {
+ temp_rect.width = 5;
+ temp_rect.height = 1;
+
+ temp_rect.x = (rectangle->x + rectangle->width) - temp_rect.width;
+ temp_rect.y = (rectangle->y + rectangle->height) - temp_rect.height;
+ subtract_rectangle (region, &temp_rect);
+
+ temp_rect.y -= 1;
+ temp_rect.x += 2;
+ subtract_rectangle (region, &temp_rect);
+
+ temp_rect.y -= 1;
+ temp_rect.x += 1;
+ subtract_rectangle (region, &temp_rect);
+
+ temp_rect.y -= 2;
+ temp_rect.x += 1;
+ temp_rect.height = 2;
+ subtract_rectangle (region, &temp_rect);
+
+ temp_rect.x = rectangle->x + rectangle->width;
+ temp_rect.y = rectangle->y + rectangle->height;
+
+ cairo_move_to (cairo_context, temp_rect.x - 3, temp_rect.y - 1.5);
+ cairo_line_to (cairo_context, temp_rect.x - 5, temp_rect.y - 1.5);
+
+ cairo_move_to (cairo_context, temp_rect.x - 2, temp_rect.y - 2.5);
+ cairo_line_to (cairo_context, temp_rect.x - 3, temp_rect.y - 2.5);
+
+ cairo_move_to (cairo_context, temp_rect.x - 1, temp_rect.y - 3.5);
+ cairo_line_to (cairo_context, temp_rect.x - 2, temp_rect.y - 3.5);
+
+ cairo_move_to (cairo_context, temp_rect.x - 1, temp_rect.y - 4.5);
+ cairo_line_to (cairo_context, temp_rect.x - 2, temp_rect.y - 4.5);
+
+ cairo_set_source_rgba (cairo_context, 0.0, 0.0, 0.0, BEVEL_ALPHA_MEDIUM);
+ cairo_stroke (cairo_context);
+
+ cairo_move_to (cairo_context, temp_rect.x - 3, temp_rect.y - 2.5);
+ cairo_line_to (cairo_context, temp_rect.x - 5, temp_rect.y - 2.5);
+
+ cairo_move_to (cairo_context, temp_rect.x - 2, temp_rect.y - 3.5);
+ cairo_line_to (cairo_context, temp_rect.x - 3, temp_rect.y - 3.5);
+
+ cairo_move_to (cairo_context, temp_rect.x - 2, temp_rect.y - 4.5);
+ cairo_line_to (cairo_context, temp_rect.x - 3, temp_rect.y - 4.5);
+
+ cairo_set_source_rgba (cairo_context, 0.0, 0.0, 0.0, BEVEL_ALPHA_LIGHT);
+ cairo_stroke (cairo_context);
+
+ }
+
+ /* Bottom left */
+ if (!(orient == ORIENT_BOTTOM && orient_triangle == TRIANGLE_LEFT))
+ {
+ temp_rect.width = 5;
+ temp_rect.height = 1;
+
+ temp_rect.x = rectangle->x;
+ temp_rect.y = rectangle->y + rectangle->height - 1;
+ subtract_rectangle (region, &temp_rect);
+
+ temp_rect.y -= 1;
+ temp_rect.width -= 2;
+ subtract_rectangle (region, &temp_rect);
+
+ temp_rect.y -= 1;
+ temp_rect.width -= 1;
+ subtract_rectangle (region, &temp_rect);
+
+ temp_rect.y -= 2;
+ temp_rect.width -= 1;
+ temp_rect.height = 2;
+ subtract_rectangle (region, &temp_rect);
+
+ temp_rect.x = rectangle->x;
+ temp_rect.y = rectangle->y + rectangle->height;
+
+ cairo_move_to (cairo_context, temp_rect.x + 3, temp_rect.y - 1.5);
+ cairo_line_to (cairo_context, temp_rect.x + 5, temp_rect.y - 1.5);
+
+ cairo_move_to (cairo_context, temp_rect.x + 2, temp_rect.y - 2.5);
+ cairo_line_to (cairo_context, temp_rect.x + 3, temp_rect.y - 2.5);
+
+ cairo_move_to (cairo_context, temp_rect.x + 1, temp_rect.y - 3.5);
+ cairo_line_to (cairo_context, temp_rect.x + 2, temp_rect.y - 3.5);
+
+ cairo_move_to (cairo_context, temp_rect.x + 1, temp_rect.y - 4.5);
+ cairo_line_to (cairo_context, temp_rect.x + 2, temp_rect.y - 4.5);
+
+ cairo_set_source_rgba (cairo_context, 0.0, 0.0, 0.0, BEVEL_ALPHA_MEDIUM);
+ cairo_stroke (cairo_context);
+
+ cairo_move_to (cairo_context, temp_rect.x + 3, temp_rect.y - 2.5);
+ cairo_line_to (cairo_context, temp_rect.x + 5, temp_rect.y - 2.5);
+
+ cairo_move_to (cairo_context, temp_rect.x + 2, temp_rect.y - 3.5);
+ cairo_line_to (cairo_context, temp_rect.x + 3, temp_rect.y - 3.5);
+
+ cairo_move_to (cairo_context, temp_rect.x + 2, temp_rect.y - 4.5);
+ cairo_line_to (cairo_context, temp_rect.x + 3, temp_rect.y - 4.5);
+
+ cairo_set_source_rgba (cairo_context, 0.0, 0.0, 0.0, BEVEL_ALPHA_LIGHT);
+ cairo_stroke (cairo_context);
+ }
+
+ return region;
+}
+
+static void
+draw_bubble_widget (EggNotificationBubbleWidget *bubble_widget)
+{
+ GtkRequisition requisition;
+ GtkStyle *style;
+ gint x, y, w, h;
+ GdkScreen *screen;
+ gint monitor_num;
+ GdkRectangle monitor;
+ GdkPoint triangle_points[3];
+ GdkRectangle rectangle;
+ GdkRegion *region;
+ GdkRegion *triangle_region;
+
+ int orient;
+ int orient_triangle;
+ guint rectangle_border;
+ GtkWidget *widget;
+ cairo_t *cairo_context;
+
+ widget = GTK_WIDGET(bubble_widget);
+ cairo_context = gdk_cairo_create (widget->window);
+
+
+ gtk_widget_ensure_style (widget);
+ style = widget->style;
+
+ gtk_widget_size_request (widget, &requisition);
+ w = requisition.width;
+ h = requisition.height;
+
+ x = bubble_widget->x;
+ y = bubble_widget->y;
+
+ orient = ORIENT_TOP;
+
+ screen = gtk_window_get_screen (GTK_WINDOW(widget));
+ monitor_num = gdk_screen_get_monitor_at_window (screen, widget->window);
+ gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor);
+
+ if ((y + h) > monitor.y + monitor.height)
+ {
+ y -= (h + 5);
+ orient = ORIENT_BOTTOM;
+ }
+ else
+ y = y + 5;
+
+ rectangle_border = BORDER_SIZE-2;
+
+ rectangle.x = rectangle_border;
+ rectangle.y = rectangle_border;
+ rectangle.width = w - (rectangle_border * 2);
+ rectangle.height = h - (rectangle_border * 2);
+
+ if (x < (monitor.x + monitor.width) / 2)
+ {
+ orient_triangle = TRIANGLE_LEFT;
+ triangle_points[0].x = rectangle.x;
+ }
+ else
+ {
+ orient_triangle = TRIANGLE_RIGHT;
+ triangle_points[0].x = rectangle.x + rectangle.width - 10;
+ }
+
+ cairo_set_line_width (cairo_context, 1.0);
+ region = add_bevels_to_rectangle (&rectangle, cairo_context, orient, orient_triangle);
+
+ triangle_points[0].y = orient == ORIENT_TOP ? rectangle.y : rectangle.y + rectangle.height;
+ triangle_points[1].x = triangle_points[0].x + 10;
+ triangle_points[1].y = triangle_points[0].y;
+ triangle_points[2].y = orient == ORIENT_TOP ? 0 : h;
+
+ if (orient_triangle == TRIANGLE_LEFT)
+ triangle_points[2].x = triangle_points[0].x;
+ else
+ triangle_points[2].x = triangle_points[1].x;
+
+ triangle_region = gdk_region_polygon (triangle_points, 3, GDK_WINDING_RULE);
+ gdk_region_union (region, triangle_region);
+ gdk_region_destroy (triangle_region);
+
+ gdk_window_shape_combine_region (widget->window, region, 0, 0);
+
+ if (orient == ORIENT_TOP)
+ {
+ /* top from triangle */
+ if (orient_triangle == TRIANGLE_LEFT)
+ {
+ cairo_move_to (cairo_context, triangle_points[0].x + 0.5, triangle_points[0].y);
+ cairo_line_to (cairo_context, triangle_points[2].x + 0.5, triangle_points[2].y);
+ cairo_set_source_rgba (cairo_context, 0.0, 0.0, 0.0, BEVEL_ALPHA_MEDIUM);
+
+ cairo_move_to (cairo_context, triangle_points[2].x - 0.5, triangle_points[2].y + 0.5);
+ cairo_line_to (cairo_context, triangle_points[1].x - 0.5, triangle_points[1].y + 0.5);
+ cairo_stroke (cairo_context);
+
+ cairo_move_to (cairo_context, triangle_points[0].x + 1.5, triangle_points[0].y + 5);
+ cairo_line_to (cairo_context, triangle_points[2].x + 1.5, triangle_points[2].y);
+ cairo_line_to (cairo_context, triangle_points[1].x - 1.5, triangle_points[1].y + 1.5);
+ cairo_set_source_rgba (cairo_context, 0.0, 0.0, 0.0, BEVEL_ALPHA_LIGHT);
+ cairo_stroke (cairo_context);
+
+ cairo_move_to (cairo_context, triangle_points[1].x, triangle_points[1].y + 0.5);
+ cairo_line_to (cairo_context, rectangle.x + rectangle.width, rectangle.y + 0.5);
+ cairo_set_source_rgba (cairo_context, 0.0, 0.0, 0.0, BEVEL_ALPHA_MEDIUM);
+ cairo_stroke (cairo_context);
+
+ cairo_move_to (cairo_context, triangle_points[1].x + 1, triangle_points[1].y + 1.5);
+ cairo_line_to (cairo_context, rectangle.x + rectangle.width - 5, rectangle.y + 1.5);
+ cairo_set_source_rgba (cairo_context, 0.0, 0.0, 0.0, BEVEL_ALPHA_LIGHT);
+ cairo_stroke (cairo_context);
+ }
+
+ /* right */
+ cairo_move_to (cairo_context, rectangle.x + rectangle.width - 0.5, rectangle.y + 1.5);
+ cairo_line_to (cairo_context, rectangle.x + rectangle.width - 0.5 , rectangle.y + rectangle.height);
+ cairo_set_source_rgba (cairo_context, 0.0, 0.0, 0.0, BEVEL_ALPHA_DARK);
+ cairo_stroke (cairo_context);
+
+ cairo_move_to (cairo_context, rectangle.x + rectangle.width - 1.5, rectangle.y + 4.5);
+ cairo_line_to (cairo_context, rectangle.x + rectangle.width - 1.5 , rectangle.y + rectangle.height - 4.5);
+ cairo_set_source_rgba (cairo_context, 0.0, 0.0, 0.0, BEVEL_ALPHA_LIGHT);
+ cairo_stroke (cairo_context);
+
+ /* bottom */
+ cairo_move_to (cairo_context, rectangle.x + rectangle.width, rectangle.y + rectangle.height - 0.5);
+ cairo_line_to (cairo_context, rectangle.x, rectangle.y + rectangle.height - 0.5);
+ cairo_set_source_rgba (cairo_context, 0.0, 0.0, 0.0, BEVEL_ALPHA_DARK);
+ cairo_stroke (cairo_context);
+
+ cairo_move_to (cairo_context, rectangle.x + rectangle.width - 5, rectangle.y + rectangle.height - 1.5);
+ cairo_line_to (cairo_context, rectangle.x + 5, rectangle.y + rectangle.height - 1.5);
+ cairo_set_source_rgba (cairo_context, 0.0, 0.0, 0.0, BEVEL_ALPHA_LIGHT);
+ cairo_stroke (cairo_context);
+
+ /* left */
+ cairo_move_to (cairo_context, rectangle.x + 0.5, rectangle.y + rectangle.height);
+ cairo_line_to (cairo_context, rectangle.x + 0.5, rectangle.y);
+ cairo_set_source_rgba (cairo_context, 0.0, 0.0, 0.0, BEVEL_ALPHA_MEDIUM);
+ cairo_stroke (cairo_context);
+
+ cairo_move_to (cairo_context, rectangle.x + 1.5, rectangle.y + rectangle.height - 5);
+ cairo_line_to (cairo_context, rectangle.x + 1.5, rectangle.y + 5);
+ cairo_set_source_rgba (cairo_context, 0.0, 0.0, 0.0, BEVEL_ALPHA_LIGHT);
+ cairo_stroke (cairo_context);
+
+ /* top back to triangle */
+ if (orient_triangle == TRIANGLE_RIGHT)
+ {
+
+ cairo_move_to (cairo_context, triangle_points[0].x - 0.5, triangle_points[0].y + 0.5);
+ cairo_line_to (cairo_context, triangle_points[2].x - 0.5, triangle_points[2].y + 0.5);
+ cairo_set_source_rgba (cairo_context, 0.0, 0.0, 0.0, BEVEL_ALPHA_MEDIUM);
+ cairo_stroke (cairo_context);
+
+ cairo_move_to (cairo_context, triangle_points[2].x - 0.5, triangle_points[2].y);
+ cairo_line_to (cairo_context, triangle_points[1].x - 0.5, triangle_points[1].y + 2);
+ cairo_set_source_rgba (cairo_context, 0.0, 0.0, 0.0, BEVEL_ALPHA_DARK);
+ cairo_stroke (cairo_context);
+
+ cairo_move_to (cairo_context, triangle_points[0].x + 1.5, triangle_points[0].y);
+ cairo_line_to (cairo_context, triangle_points[2].x, triangle_points[2].y);
+ cairo_move_to (cairo_context, triangle_points[1].x - 1.5, triangle_points[2].y);
+ cairo_line_to (cairo_context, triangle_points[1].x - 1.5, triangle_points[1].y + 4.5);
+ cairo_set_source_rgba (cairo_context, 0.0, 0.0, 0.0, BEVEL_ALPHA_LIGHT);
+ cairo_stroke (cairo_context);
+
+ cairo_move_to (cairo_context, rectangle.x, rectangle.y + 0.5);
+ cairo_line_to (cairo_context, triangle_points[0].x, triangle_points[0].y + 0.5);
+ cairo_set_source_rgba (cairo_context, 0.0, 0.0, 0.0, BEVEL_ALPHA_MEDIUM);
+ cairo_stroke (cairo_context);
+
+ cairo_move_to (cairo_context, rectangle.x + 5, rectangle.y + 1.5);
+ cairo_line_to (cairo_context, triangle_points[0].x, triangle_points[0].y + 1.5);
+ cairo_set_source_rgba (cairo_context, 0.0, 0.0, 0.0, BEVEL_ALPHA_LIGHT);
+ cairo_stroke (cairo_context);
+
+ }
+
+
+ }
+ else
+ {
+ /* bottom from triangle */
+ if (orient_triangle == TRIANGLE_LEFT)
+ {
+ cairo_move_to (cairo_context, triangle_points[0].x + 0.5, triangle_points[0].y);
+ cairo_line_to (cairo_context, triangle_points[2].x + 0.5, triangle_points[2].y);
+ cairo_set_source_rgba (cairo_context, 0.0, 0.0, 0.0, BEVEL_ALPHA_MEDIUM);
+ cairo_stroke (cairo_context);
+
+ cairo_move_to (cairo_context, triangle_points[2].x, triangle_points[2].y);
+ cairo_line_to (cairo_context, triangle_points[1].x, triangle_points[1].y);
+ cairo_set_source_rgba (cairo_context, 0.0, 0.0, 0.0, BEVEL_ALPHA_DARK);
+ cairo_stroke (cairo_context);
+
+ cairo_move_to (cairo_context, triangle_points[0].x + 1.5, triangle_points[0].y);
+ cairo_line_to (cairo_context, triangle_points[2].x + 1.5, triangle_points[2].y);
+ cairo_line_to (cairo_context, triangle_points[1].x - 1.5, triangle_points[1].y + 1.5);
+ cairo_set_source_rgba (cairo_context, 0.0, 0.0, 0.0, BEVEL_ALPHA_LIGHT);
+ cairo_stroke (cairo_context);
+
+ cairo_move_to (cairo_context, triangle_points[1].x, triangle_points[1].y - 0.5);
+ cairo_line_to (cairo_context, rectangle.x + rectangle.width, rectangle.y + rectangle.height - 0.5);
+ cairo_set_source_rgba (cairo_context, 0.0, 0.0, 0.0, BEVEL_ALPHA_DARK);
+ cairo_stroke (cairo_context);
+
+ cairo_move_to (cairo_context, triangle_points[1].x, triangle_points[1].y - 1.5);
+ cairo_line_to (cairo_context, rectangle.x + rectangle.width, rectangle.y + rectangle.height - 1.5);
+ cairo_set_source_rgba (cairo_context, 0.0, 0.0, 0.0, BEVEL_ALPHA_LIGHT);
+ cairo_stroke (cairo_context);
+ }
+
+ /* top */
+ cairo_move_to (cairo_context, rectangle.x, rectangle.y + 0.5);
+ cairo_line_to (cairo_context, rectangle.x + rectangle.width, rectangle.y + 0.5);
+ cairo_set_source_rgba (cairo_context, 0.0, 0.0, 0.0, BEVEL_ALPHA_MEDIUM);
+ cairo_stroke (cairo_context);
+
+ cairo_move_to (cairo_context, rectangle.x, rectangle.y + 1.5);
+ cairo_line_to (cairo_context, rectangle.x + rectangle.width, rectangle.y + 1.5);
+ cairo_set_source_rgba (cairo_context, 0.0, 0.0, 0.0, BEVEL_ALPHA_LIGHT);
+ cairo_stroke (cairo_context);
+
+ /* left */
+ cairo_move_to (cairo_context, rectangle.x + 0.5, rectangle.y + rectangle.height);
+ cairo_line_to (cairo_context, rectangle.x + 0.5, rectangle.y);
+ cairo_set_source_rgba (cairo_context, 0.0, 0.0, 0.0, BEVEL_ALPHA_MEDIUM);
+ cairo_stroke (cairo_context);
+
+ cairo_move_to (cairo_context, rectangle.x + 1.5, rectangle.y + rectangle.height);
+ cairo_line_to (cairo_context, rectangle.x + 1.5, rectangle.y);
+ cairo_set_source_rgba (cairo_context, 0.0, 0.0, 0.0, BEVEL_ALPHA_LIGHT);
+ cairo_stroke (cairo_context);
+
+ /* right */
+ cairo_move_to (cairo_context, rectangle.x + rectangle.width - 0.5, rectangle.y + 1);
+ cairo_line_to (cairo_context, rectangle.x + rectangle.width - 0.5 , rectangle.y + rectangle.height);
+ cairo_set_source_rgba (cairo_context, 0.0, 0.0, 0.0, BEVEL_ALPHA_DARK);
+ cairo_stroke (cairo_context);
+
+ cairo_move_to (cairo_context, rectangle.x + rectangle.width - 1.5, rectangle.y + 1);
+ cairo_line_to (cairo_context, rectangle.x + rectangle.width - 1.5 , rectangle.y + rectangle.height);
+ cairo_set_source_rgba (cairo_context, 0.0, 0.0, 0.0, BEVEL_ALPHA_LIGHT);
+ cairo_stroke (cairo_context);
+
+ /* bottom to triangle */
+ if (orient_triangle == TRIANGLE_RIGHT)
+ {
+ cairo_move_to (cairo_context, triangle_points[0].x + 0.5, triangle_points[0].y);
+ cairo_line_to (cairo_context, triangle_points[2].x + 0.5, triangle_points[2].y);
+
+ cairo_move_to (cairo_context, triangle_points[2].x - 0.5, triangle_points[2].y);
+ cairo_line_to (cairo_context, triangle_points[1].x - 0.5, triangle_points[1].y);
+ cairo_set_source_rgba (cairo_context, 0.0, 0.0, 0.0, BEVEL_ALPHA_DARK);
+ cairo_stroke (cairo_context);
+
+ cairo_move_to (cairo_context, triangle_points[0].x + 1.5, triangle_points[0].y);
+ cairo_line_to (cairo_context, triangle_points[2].x - 1.5, triangle_points[2].y);
+ cairo_line_to (cairo_context, triangle_points[1].x - 1.5, triangle_points[1].y);
+ cairo_set_source_rgba (cairo_context, 0.0, 0.0, 0.0, BEVEL_ALPHA_LIGHT);
+ cairo_stroke (cairo_context);
+
+ cairo_move_to (cairo_context, triangle_points[0].x, triangle_points[0].y - 0.5);
+ cairo_line_to (cairo_context, rectangle.x, rectangle.y + rectangle.height - 0.5);
+ cairo_set_source_rgba (cairo_context, 0.0, 0.0, 0.0, BEVEL_ALPHA_DARK);
+ cairo_stroke (cairo_context);
+
+ cairo_move_to (cairo_context, triangle_points[0].x, triangle_points[0].y - 1.5);
+ cairo_line_to (cairo_context, rectangle.x, rectangle.y + rectangle.height - 1.5);
+ cairo_set_source_rgba (cairo_context, 0.0, 0.0, 0.0, BEVEL_ALPHA_LIGHT);
+ cairo_stroke (cairo_context);
+ }
+
+ }
+
+ region = add_bevels_to_rectangle (&rectangle, cairo_context, orient, orient_triangle);
+
+ gtk_window_move (GTK_WINDOW (widget), x - triangle_points[2].x, y);
+ bubble_widget->active = TRUE;
+}
+
+void
+egg_notification_bubble_widget_show (EggNotificationBubbleWidget *bubble_widget)
+{
+ gtk_widget_show_all (GTK_WIDGET (bubble_widget));
+}
+
+void
+egg_notification_bubble_widget_hide (EggNotificationBubbleWidget *bubble_widget)
+{
+ if (bubble_widget)
+ gtk_widget_hide (GTK_WIDGET (bubble_widget));
+}
+
+EggNotificationBubbleWidget*
+egg_notification_bubble_widget_new (void)
+{
+ return g_object_new (EGG_TYPE_NOTIFICATION_BUBBLE_WIDGET, "type", GTK_WINDOW_POPUP, NULL);
+}
+
+static void
+egg_notification_bubble_widget_event_handler (GtkWidget *widget,
+ GdkEvent *event,
+ gpointer user_data)
+{
+ EggNotificationBubbleWidget *bubble_widget;
+
+ bubble_widget = EGG_NOTIFICATION_BUBBLE_WIDGET (user_data);
+
+ switch (event->type)
+ {
+ case GDK_BUTTON_PRESS:
+ g_signal_emit (bubble_widget, egg_notification_bubble_widget_signals[NOTIFICATION_CLICKED], 0);
+ break;
+ default:
+ break;
+ }
+}
+
Added: trunk/notify-daemon-ng/src/eggnotificationbubblewidget.h
===================================================================
--- trunk/notify-daemon-ng/src/eggnotificationbubblewidget.h 2005-11-10 19:18:10 UTC (rev 2286)
+++ trunk/notify-daemon-ng/src/eggnotificationbubblewidget.h 2005-11-10 20:41:37 UTC (rev 2287)
@@ -0,0 +1,91 @@
+/* EggNotificationBubbleWidget
+ * Copyright (C) 2005 Colin Walters <walters at verbum.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 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+#ifndef __EGG_NOTIFICATION_BUBBLE_WIDGET_H__
+#define __EGG_NOTIFICATION_BUBBLE_WIDGET_H__
+
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+#define EGG_TYPE_NOTIFICATION_BUBBLE_WIDGET (egg_notification_bubble_widget_get_type ())
+#define EGG_NOTIFICATION_BUBBLE_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EGG_TYPE_NOTIFICATION_BUBBLE_WIDGET, EggNotificationBubbleWidget))
+#define EGG_NOTIFICATION_BUBBLE_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EGG_TYPE_NOTIFICATION_BUBBLE_WIDGET, EggNotificationBubbleWidgetClass))
+#define EGG_IS_NOTIFICATION_BUBBLE_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EGG_TYPE_NOTIFICATION_BUBBLE_WIDGET))
+#define EGG_IS_NOTIFICATION_BUBBLE_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EGG_TYPE_NOTIFICATION_BUBBLE_WIDGET))
+#define EGG_NOTIFICATION_BUBBLE_WIDGET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EGG_TYPE_NOTIFICATION_BUBBLE_WIDGET, EggNotificationBubbleWidgetClass))
+
+
+typedef struct _EggNotificationBubbleWidget EggNotificationBubbleWidget;
+typedef struct _EggNotificationBubbleWidgetClass EggNotificationBubbleWidgetClass;
+typedef struct _EggNotificationBubbleWidgetData EggNotificationBubbleWidgetData;
+
+struct _EggNotificationBubbleWidget
+{
+ GtkWindow parent_instance;
+
+ char *bubble_widget_header_text;
+ char *bubble_widget_body_text;
+ GtkWidget *icon;
+
+ gboolean active;
+ GtkWidget *main_hbox;
+ GtkWidget *bubble_widget_header_label;
+ GtkWidget *bubble_widget_body_label;
+
+ gint x, y;
+};
+
+struct _EggNotificationBubbleWidgetClass
+{
+ GtkWindowClass parent_class;
+
+ void (*clicked) (void);
+
+ /* Padding for future expansion */
+ void (*_gtk_reserved1) (void);
+ void (*_gtk_reserved2) (void);
+ void (*_gtk_reserved3) (void);
+ void (*_gtk_reserved4) (void);
+};
+
+GType egg_notification_bubble_widget_get_type (void) G_GNUC_CONST;
+EggNotificationBubbleWidget* egg_notification_bubble_widget_new (void);
+
+void egg_notification_bubble_widget_set (EggNotificationBubbleWidget *bubble_widget,
+ const gchar *notification_header,
+ const gchar *icon,
+ const gchar *notification_body);
+
+void egg_notification_bubble_widget_show (EggNotificationBubbleWidget *bubble_widget);
+void egg_notification_bubble_widget_hide (EggNotificationBubbleWidget *bubble_widget);
+
+
+void egg_notification_bubble_widget_set_pos (EggNotificationBubbleWidget *bubble_widget,
+ gint x, gint y);
+
+void egg_notification_bubble_widget_set_icon_from_data (EggNotificationBubbleWidget *bubble_widget,
+ const guchar *data,
+ gboolean has_alpha,
+ int bits_per_sample,
+ int width,
+ int height,
+ int rowstride);
+G_END_DECLS
+
+#endif /* __EGG_NOTIFICATION_BUBBLE_WIDGET_H__ */
Added: trunk/notify-daemon-ng/src/notifydaemon-dbus-glue.h
===================================================================
--- trunk/notify-daemon-ng/src/notifydaemon-dbus-glue.h 2005-11-10 19:18:10 UTC (rev 2286)
+++ trunk/notify-daemon-ng/src/notifydaemon-dbus-glue.h 2005-11-10 20:41:37 UTC (rev 2287)
@@ -0,0 +1,184 @@
+/* Generated by dbus-binding-tool; do not edit! */
+
+
+#ifndef __dbus_glib_marshal__MARSHAL_H__
+#define __dbus_glib_marshal__MARSHAL_H__
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#ifdef G_ENABLE_DEBUG
+#define g_marshal_value_peek_boolean(v) g_value_get_boolean (v)
+#define g_marshal_value_peek_char(v) g_value_get_char (v)
+#define g_marshal_value_peek_uchar(v) g_value_get_uchar (v)
+#define g_marshal_value_peek_int(v) g_value_get_int (v)
+#define g_marshal_value_peek_uint(v) g_value_get_uint (v)
+#define g_marshal_value_peek_long(v) g_value_get_long (v)
+#define g_marshal_value_peek_ulong(v) g_value_get_ulong (v)
+#define g_marshal_value_peek_int64(v) g_value_get_int64 (v)
+#define g_marshal_value_peek_uint64(v) g_value_get_uint64 (v)
+#define g_marshal_value_peek_enum(v) g_value_get_enum (v)
+#define g_marshal_value_peek_flags(v) g_value_get_flags (v)
+#define g_marshal_value_peek_float(v) g_value_get_float (v)
+#define g_marshal_value_peek_double(v) g_value_get_double (v)
+#define g_marshal_value_peek_string(v) (char*) g_value_get_string (v)
+#define g_marshal_value_peek_param(v) g_value_get_param (v)
+#define g_marshal_value_peek_boxed(v) g_value_get_boxed (v)
+#define g_marshal_value_peek_pointer(v) g_value_get_pointer (v)
+#define g_marshal_value_peek_object(v) g_value_get_object (v)
+#else /* !G_ENABLE_DEBUG */
+/* WARNING: This code accesses GValues directly, which is UNSUPPORTED API.
+ * Do not access GValues directly in your code. Instead, use the
+ * g_value_get_*() functions
+ */
+#define g_marshal_value_peek_boolean(v) (v)->data[0].v_int
+#define g_marshal_value_peek_char(v) (v)->data[0].v_int
+#define g_marshal_value_peek_uchar(v) (v)->data[0].v_uint
+#define g_marshal_value_peek_int(v) (v)->data[0].v_int
+#define g_marshal_value_peek_uint(v) (v)->data[0].v_uint
+#define g_marshal_value_peek_long(v) (v)->data[0].v_long
+#define g_marshal_value_peek_ulong(v) (v)->data[0].v_ulong
+#define g_marshal_value_peek_int64(v) (v)->data[0].v_int64
+#define g_marshal_value_peek_uint64(v) (v)->data[0].v_uint64
+#define g_marshal_value_peek_enum(v) (v)->data[0].v_long
+#define g_marshal_value_peek_flags(v) (v)->data[0].v_ulong
+#define g_marshal_value_peek_float(v) (v)->data[0].v_float
+#define g_marshal_value_peek_double(v) (v)->data[0].v_double
+#define g_marshal_value_peek_string(v) (v)->data[0].v_pointer
+#define g_marshal_value_peek_param(v) (v)->data[0].v_pointer
+#define g_marshal_value_peek_boxed(v) (v)->data[0].v_pointer
+#define g_marshal_value_peek_pointer(v) (v)->data[0].v_pointer
+#define g_marshal_value_peek_object(v) (v)->data[0].v_pointer
+#endif /* !G_ENABLE_DEBUG */
+
+
+/* BOOLEAN:STRING,STRING,UINT,STRING,STRING,BOXED,BOXED,INT,POINTER,POINTER (/tmp/dbus-binding-tool-c-marshallers.Dt9soe:1) */
+extern void dbus_glib_marshal__BOOLEAN__STRING_STRING_UINT_STRING_STRING_BOXED_BOXED_INT_POINTER_POINTER (GClosure *closure,
+ GValue *return_value,
+ guint n_param_values,
+ const GValue *param_values,
+ gpointer invocation_hint,
+ gpointer marshal_data);
+void
+dbus_glib_marshal__BOOLEAN__STRING_STRING_UINT_STRING_STRING_BOXED_BOXED_INT_POINTER_POINTER (GClosure *closure,
+ GValue *return_value,
+ guint n_param_values,
+ const GValue *param_values,
+ gpointer invocation_hint,
+ gpointer marshal_data)
+{
+ typedef gboolean (*GMarshalFunc_BOOLEAN__STRING_STRING_UINT_STRING_STRING_BOXED_BOXED_INT_POINTER_POINTER) (gpointer data1,
+ gpointer arg_1,
+ gpointer arg_2,
+ guint arg_3,
+ gpointer arg_4,
+ gpointer arg_5,
+ gpointer arg_6,
+ gpointer arg_7,
+ gint arg_8,
+ gpointer arg_9,
+ gpointer arg_10,
+ gpointer data2);
+ register GMarshalFunc_BOOLEAN__STRING_STRING_UINT_STRING_STRING_BOXED_BOXED_INT_POINTER_POINTER callback;
+ register GCClosure *cc = (GCClosure*) closure;
+ register gpointer data1, data2;
+ gboolean v_return;
+
+ g_return_if_fail (return_value != NULL);
+ g_return_if_fail (n_param_values == 11);
+
+ if (G_CCLOSURE_SWAP_DATA (closure))
+ {
+ data1 = closure->data;
+ data2 = g_value_peek_pointer (param_values + 0);
+ }
+ else
+ {
+ data1 = g_value_peek_pointer (param_values + 0);
+ data2 = closure->data;
+ }
+ callback = (GMarshalFunc_BOOLEAN__STRING_STRING_UINT_STRING_STRING_BOXED_BOXED_INT_POINTER_POINTER) (marshal_data ? marshal_data : cc->callback);
+
+ v_return = callback (data1,
+ g_marshal_value_peek_string (param_values + 1),
+ g_marshal_value_peek_string (param_values + 2),
+ g_marshal_value_peek_uint (param_values + 3),
+ g_marshal_value_peek_string (param_values + 4),
+ g_marshal_value_peek_string (param_values + 5),
+ g_marshal_value_peek_boxed (param_values + 6),
+ g_marshal_value_peek_boxed (param_values + 7),
+ g_marshal_value_peek_int (param_values + 8),
+ g_marshal_value_peek_pointer (param_values + 9),
+ g_marshal_value_peek_pointer (param_values + 10),
+ data2);
+
+ g_value_set_boolean (return_value, v_return);
+}
+
+/* BOOLEAN:UINT,POINTER (/tmp/dbus-binding-tool-c-marshallers.Dt9soe:2) */
+extern void dbus_glib_marshal__BOOLEAN__UINT_POINTER (GClosure *closure,
+ GValue *return_value,
+ guint n_param_values,
+ const GValue *param_values,
+ gpointer invocation_hint,
+ gpointer marshal_data);
+void
+dbus_glib_marshal__BOOLEAN__UINT_POINTER (GClosure *closure,
+ GValue *return_value,
+ guint n_param_values,
+ const GValue *param_values,
+ gpointer invocation_hint,
+ gpointer marshal_data)
+{
+ typedef gboolean (*GMarshalFunc_BOOLEAN__UINT_POINTER) (gpointer data1,
+ guint arg_1,
+ gpointer arg_2,
+ gpointer data2);
+ register GMarshalFunc_BOOLEAN__UINT_POINTER callback;
+ register GCClosure *cc = (GCClosure*) closure;
+ register gpointer data1, data2;
+ gboolean v_return;
+
+ g_return_if_fail (return_value != NULL);
+ g_return_if_fail (n_param_values == 3);
+
+ if (G_CCLOSURE_SWAP_DATA (closure))
+ {
+ data1 = closure->data;
+ data2 = g_value_peek_pointer (param_values + 0);
+ }
+ else
+ {
+ data1 = g_value_peek_pointer (param_values + 0);
+ data2 = closure->data;
+ }
+ callback = (GMarshalFunc_BOOLEAN__UINT_POINTER) (marshal_data ? marshal_data : cc->callback);
+
+ v_return = callback (data1,
+ g_marshal_value_peek_uint (param_values + 1),
+ g_marshal_value_peek_pointer (param_values + 2),
+ data2);
+
+ g_value_set_boolean (return_value, v_return);
+}
+
+G_END_DECLS
+
+#endif /* __dbus_glib_marshal__MARSHAL_H__ */
+
+#include <dbus/dbus-glib.h>
+static const DBusGMethodInfo dbus_glib__methods[] = {
+ { (GCallback) notify_daemon_notify_handler, dbus_glib_marshal__BOOLEAN__STRING_STRING_UINT_STRING_STRING_BOXED_BOXED_INT_POINTER_POINTER, 0 },
+ { (GCallback) notify_daemon_close_notification_handler, dbus_glib_marshal__BOOLEAN__UINT_POINTER, 148 },
+};
+
+const DBusGObjectInfo dbus_glib__object_info = {
+ 0,
+ dbus_glib__methods,
+ 2,
+"org.freedesktop.Notifications\0Notify\0S\0app_name\0I\0s\0icon\0I\0s\0id\0I\0u\0trouble\0I\0s\0d_ret\0I\0s\0str_ret\0I\0as\0hints\0I\0a{sv}\0timeout\0I\0i\0return_id\0O\0F\0N\0u\0\0org.freedesktop.Notifications\0CloseNotification\0S\0id\0I\0u\0\0\0",
+"\0",
+"\0"
+};
+
Added: trunk/notify-daemon-ng/src/notifydaemon.c
===================================================================
--- trunk/notify-daemon-ng/src/notifydaemon.c 2005-11-10 19:18:10 UTC (rev 2286)
+++ trunk/notify-daemon-ng/src/notifydaemon.c 2005-11-10 20:41:37 UTC (rev 2287)
@@ -0,0 +1,561 @@
+/* notifydaemon.c - Implementation of the destop notification spec
+ *
+ * Copyright (C) 2005 John (J5) Palmieri <johnp at redhat.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+
+#include "config.h"
+#include "notifydaemon.h"
+#include "eggnotificationbubblewidget.h"
+#include "notifydaemon-dbus-glue.h"
+
+#include <stdlib.h>
+#include <errno.h>
+#include <string.h>
+#include <stdio.h>
+
+#include <glib.h>
+#include <glib-object.h>
+#include <glib/gi18n.h>
+#include <dbus/dbus-glib.h>
+#include <gtk/gtk.h>
+
+struct _NotifyTimeout
+{
+ GTimeVal expiration;
+ gboolean has_timeout;
+ guint id;
+
+ EggNotificationBubbleWidget *widget;
+};
+
+typedef struct _NotifyTimeout NotifyTimeout;
+
+struct _NotifyDaemonPrivate
+{
+ guint next_id;
+ guint timeout_source;
+ GHashTable *notification_hash;
+};
+
+static void notify_daemon_finalize (GObject * object);
+
+G_DEFINE_TYPE (NotifyDaemon, notify_daemon, G_TYPE_OBJECT);
+
+static void
+notify_daemon_class_init (NotifyDaemonClass * daemon_class)
+{
+ GObjectClass *object_class;
+
+ object_class = G_OBJECT_CLASS (daemon_class);
+
+ object_class->finalize = notify_daemon_finalize;
+
+ g_type_class_add_private (daemon_class, sizeof (NotifyDaemonPrivate));
+}
+
+static void
+_notify_timeout_destroy (NotifyTimeout *nt)
+{
+ gtk_widget_destroy ((GtkWidget *)nt->widget);
+ g_free (nt);
+}
+
+static void
+notify_daemon_init (NotifyDaemon * daemon)
+{
+ daemon->priv = G_TYPE_INSTANCE_GET_PRIVATE (daemon,
+ NOTIFY_TYPE_DAEMON,
+ NotifyDaemonPrivate);
+
+ daemon->priv->next_id = 1;
+ daemon->priv->timeout_source = 0;
+ daemon->priv->notification_hash = g_hash_table_new_full ((GHashFunc) g_int_hash,
+ (GEqualFunc) g_int_equal,
+ (GDestroyNotify) g_free,
+ (GDestroyNotify) _notify_timeout_destroy);
+}
+
+static void
+notify_daemon_finalize (GObject * object)
+{
+ NotifyDaemon *daemon;
+ GObjectClass *parent_class;
+
+ daemon = NOTIFY_DAEMON (object);
+
+ g_hash_table_destroy (daemon->priv->notification_hash);
+
+ parent_class = G_OBJECT_CLASS (notify_daemon_parent_class);
+
+ if (parent_class->finalize != NULL)
+ parent_class->finalize (object);
+}
+
+NotifyDaemon *
+notify_daemon_new (void)
+{
+ NotifyDaemon *daemon;
+
+ daemon = g_object_new (NOTIFY_TYPE_DAEMON, NULL);
+
+ return daemon;
+}
+
+static void
+_close_notification (NotifyDaemon *daemon,
+ guint id)
+{
+ NotifyDaemonPrivate *priv;
+ NotifyTimeout *nt;
+
+ priv = daemon->priv;
+
+ nt = (NotifyTimeout *)
+ g_hash_table_lookup (priv->notification_hash, &id);
+
+ if (nt)
+ {
+ egg_notification_bubble_widget_hide (nt->widget);
+ g_hash_table_remove (priv->notification_hash, &id);
+ }
+
+ /* TODO: send message to client that notification was closed */
+}
+
+
+static gboolean
+_is_expired (gpointer key,
+ gpointer value,
+ gpointer data)
+{
+ NotifyTimeout *nt;
+ gboolean *phas_more_timeouts;
+ GTimeVal now;
+ GTimeVal expiration;
+
+ nt = (NotifyTimeout *) value;
+ phas_more_timeouts = data;
+
+ if (!nt->has_timeout)
+ return FALSE;
+
+ g_get_current_time (&now);
+ expiration = nt->expiration;
+
+ if (now.tv_sec > expiration.tv_sec)
+ return TRUE;
+ else if (now.tv_sec == expiration.tv_sec)
+ if (now.tv_usec > expiration.tv_usec)
+ return TRUE;
+
+ *phas_more_timeouts = TRUE;
+
+ return FALSE;
+}
+
+static gboolean
+_check_expiration (gpointer data)
+{
+ NotifyDaemon *daemon;
+ gboolean has_more_timeouts;
+
+ has_more_timeouts = FALSE;
+
+ daemon = (NotifyDaemon *) data;
+
+ g_hash_table_foreach_remove (daemon->priv->notification_hash,
+ (GHRFunc) _is_expired,
+ (gpointer) &has_more_timeouts);
+
+ if (!has_more_timeouts)
+ daemon->priv->timeout_source = 0;
+
+ return has_more_timeouts;
+
+}
+
+static void
+_calculate_timeout (NotifyDaemon *daemon, NotifyTimeout *nt, int timeout)
+{
+ if (timeout == 0)
+ nt->has_timeout = FALSE;
+ else
+ {
+ gulong usec;
+
+ nt->has_timeout = TRUE;
+ if (timeout == -1)
+ timeout = NOTIFY_DAEMON_DEFAULT_TIMEOUT;
+
+ usec = timeout * 1000; /* convert from msec to usec */
+ g_get_current_time (&nt->expiration);
+ g_time_val_add (&nt->expiration, usec);
+
+ if (daemon->priv->timeout_source == 0)
+ daemon->priv->timeout_source =
+ g_timeout_add (500,
+ (GSourceFunc) _check_expiration,
+ (gpointer) daemon);
+ }
+
+}
+
+static guint
+_store_notification (NotifyDaemon *daemon,
+ EggNotificationBubbleWidget *bw,
+ int timeout)
+{
+ NotifyDaemonPrivate *priv;
+ NotifyTimeout *nt;
+ guint id;
+ priv = daemon->priv;
+ id = 0;
+
+ do
+ {
+ id = priv->next_id;
+
+ if (id != UINT_MAX)
+ priv->next_id++;
+ else
+ priv->next_id = 1;
+
+ if (g_hash_table_lookup (priv->notification_hash, &id) != NULL)
+ id = 0;
+ }
+ while (id == 0);
+
+ nt = (NotifyTimeout *) g_new0(NotifyTimeout, 1);
+
+ nt->id = id;
+ nt->widget = bw;
+
+ _calculate_timeout (daemon, nt, timeout);
+
+ g_hash_table_insert (priv->notification_hash,
+ g_memdup(&id, sizeof (guint)),
+ (gpointer) nt);
+
+ return id;
+}
+
+static gboolean
+_notify_daemon_process_icon_data (NotifyDaemon *daemon,
+ EggNotificationBubbleWidget *bw,
+ GValue *icon_data)
+{
+ const guchar *data;
+ gboolean has_alpha;
+ int bits_per_sample;
+ int width;
+ int height;
+ int rowstride;
+ int n_channels;
+ gsize expected_len;
+
+ GValueArray *image_struct;
+ GValue *value;
+ GArray *tmp_array;
+
+ data = NULL;
+
+ if (!G_VALUE_HOLDS (icon_data, G_TYPE_VALUE_ARRAY))
+ {
+ g_warning ("_notify_daemon_process_icon_data expected a GValue of type GValueArray");
+ return FALSE;
+ }
+
+ image_struct = (GValueArray *) (g_value_get_boxed (icon_data));
+
+ value = g_value_array_get_nth (image_struct, 0);
+ if (!value)
+ {
+ g_warning ("_notify_daemon_process_icon_data expected possition 0 of the GValueArray to exist");
+ return FALSE;
+ }
+
+ if (!G_VALUE_HOLDS (value, G_TYPE_INT))
+ {
+ g_warning ("_notify_daemon_process_icon_data expected possition 0 of the GValueArray to be of type int");
+ return FALSE;
+ }
+
+ width = g_value_get_int (value);
+
+ value = g_value_array_get_nth (image_struct, 1);
+ if (!value)
+ {
+ g_warning ("_notify_daemon_process_icon_data expected possition 1 of the GValueArray to exist");
+ return FALSE;
+ }
+
+ if (!G_VALUE_HOLDS (value, G_TYPE_INT))
+ {
+ g_warning ("_notify_daemon_process_icon_data expected possition 1 of the GValueArray to be of type int");
+ return FALSE;
+ }
+
+ height = g_value_get_int (value);
+
+ value = g_value_array_get_nth (image_struct, 2);
+ if (!value)
+ {
+ g_warning ("_notify_daemon_process_icon_data expected possition 2 of the GValueArray to exist");
+ return FALSE;
+ }
+
+ if (!G_VALUE_HOLDS (value, G_TYPE_INT))
+ {
+ g_warning ("_notify_daemon_process_icon_data expected possition 2 of the GValueArray to be of type int");
+ return FALSE;
+ }
+
+ rowstride = g_value_get_int (value);
+
+ value = g_value_array_get_nth (image_struct, 3);
+ if (!value)
+ {
+ g_warning ("_notify_daemon_process_icon_data expected possition 3 of the GValueArray to exist");
+ return FALSE;
+ }
+
+ if (!G_VALUE_HOLDS (value, G_TYPE_BOOLEAN))
+ {
+ g_warning ("_notify_daemon_process_icon_data expected possition 3 of the GValueArray to be of type gboolean");
+ return FALSE;
+ }
+
+ has_alpha = g_value_get_boolean (value);
+
+ value = g_value_array_get_nth (image_struct, 4);
+ if (!value)
+ {
+ g_warning ("_notify_daemon_process_icon_data expected possition 4 of the GValueArray to exist");
+ return FALSE;
+ }
+
+ if (!G_VALUE_HOLDS (value, G_TYPE_INT))
+ {
+ g_warning ("_notify_daemon_process_icon_data expected possition 4 of the GValueArray to be of type int");
+ return FALSE;
+ }
+
+ bits_per_sample = g_value_get_int (value);
+
+ value = g_value_array_get_nth (image_struct, 5);
+ if (!value)
+ {
+ g_warning ("_notify_daemon_process_icon_data expected possition 5 of the GValueArray to exist");
+ return FALSE;
+ }
+
+ if (!G_VALUE_HOLDS (value, G_TYPE_INT))
+ {
+ g_warning ("_notify_daemon_process_icon_data expected possition 5 of the GValueArray to be of type int");
+ return FALSE;
+ }
+
+ n_channels = g_value_get_int (value);
+
+
+ value = g_value_array_get_nth (image_struct, 6);
+ if (!value)
+ {
+ g_warning ("_notify_daemon_process_icon_data expected possition 6 of the GValueArray to exist");
+ return FALSE;
+ }
+
+ if (!G_VALUE_HOLDS (value, dbus_g_type_get_collection ("GArray", G_TYPE_UCHAR)))
+ {
+ g_warning ("_notify_daemon_process_icon_data expected possition 6 of the GValueArray to be of type GArray");
+ return FALSE;
+ }
+
+ tmp_array = (GArray *) g_value_get_boxed (value);
+ expected_len = (height -1) * rowstride + width * ((n_channels * bits_per_sample + 7) / 8);
+
+ if (expected_len != tmp_array->len)
+ {
+ g_warning ("_notify_daemon_process_icon_data expected image data to be of length %i but got a length of %i", expected_len, tmp_array->len);
+ return FALSE;
+ }
+
+ data = (guchar *)g_memdup (tmp_array->data, tmp_array->len);
+
+ egg_notification_bubble_widget_set_icon_from_data (bw,
+ data,
+ has_alpha,
+ bits_per_sample,
+ width,
+ height,
+ rowstride);
+ return TRUE;
+}
+
+static void
+_notification_daemon_handle_bubble_widget_default (EggNotificationBubbleWidget *bw,
+ NotifyDaemon *daemon)
+{
+ _close_notification (daemon, GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (bw), "_notify_id")));
+}
+
+gboolean
+notify_daemon_notify_handler (NotifyDaemon *daemon,
+ const gchar *app_name,
+ const gchar *icon,
+ guint id,
+ const gchar *summary,
+ const gchar *body,
+ GSList *actions,
+ GHashTable *hints,
+ int timeout,
+ guint *return_id,
+ GError **error)
+{
+ NotifyDaemonPrivate *priv;
+ NotifyTimeout *nt;
+ EggNotificationBubbleWidget *bw;
+ GValue *data;
+ gboolean use_pos_data;
+ gint x, y;
+
+ nt = NULL;
+
+ priv = daemon->priv;
+ bw = NULL;
+ if (id > 0)
+ nt = (NotifyTimeout *)
+ g_hash_table_lookup (priv->notification_hash, &id);
+
+ if (!nt)
+ {
+ bw = egg_notification_bubble_widget_new ();
+ id = 0;
+ }
+ else
+ bw = nt->widget;
+
+ use_pos_data = FALSE;
+
+ egg_notification_bubble_widget_set (bw, summary, icon, body);
+
+ /* deal with x, and y hints */
+ data = (GValue *) (g_hash_table_lookup (hints, "x"));
+ if (data)
+ {
+ x = g_value_get_int (data);
+ data = (GValue *) g_hash_table_lookup (hints, "y");
+
+ if (data)
+ {
+ y = g_value_get_int (data);
+ use_pos_data = TRUE;
+ }
+ }
+
+ if (use_pos_data)
+ egg_notification_bubble_widget_set_pos (bw, x, y);
+
+ /* check for icon_data if icon == "" */
+ if (strcmp ("", icon) == 0)
+ {
+ data = (GValue *) (g_hash_table_lookup (hints, "icon_data"));
+ if (data)
+ _notify_daemon_process_icon_data (daemon, bw, data);
+ }
+
+ g_signal_connect (bw, "clicked", (GCallback)_notification_daemon_handle_bubble_widget_default, daemon);
+
+ egg_notification_bubble_widget_show (bw);
+
+ if (id == 0)
+ *return_id = _store_notification (daemon, bw, timeout);
+ else
+ *return_id = id;
+
+ g_object_set_data (G_OBJECT (bw), "_notify_id", GUINT_TO_POINTER (*return_id));
+
+ if (nt)
+ _calculate_timeout (daemon, nt, timeout);
+
+ return TRUE;
+}
+
+gboolean
+notify_daemon_close_notification_handler (NotifyDaemon *daemon,
+ guint id,
+ GError **error)
+{
+ _close_notification (daemon, id);
+
+ return TRUE;
+}
+
+int
+main (int argc, char **argv)
+{
+ NotifyDaemon *daemon;
+ DBusGConnection *connection;
+ DBusGProxy *bus_proxy;
+ GError *error;
+ guint request_name_result;
+ g_log_set_always_fatal (G_LOG_LEVEL_ERROR
+ | G_LOG_LEVEL_CRITICAL);
+
+ g_message ("initializing glib type system");
+ gtk_init (&argc, &argv);
+
+ error = NULL;
+ connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
+
+ if (connection == NULL)
+ {
+ g_printerr ("Failed to open connection to bus: %s\n",
+ error->message);
+ g_error_free (error);
+ exit (1);
+ }
+
+ g_message ("register 'daemon' type with dbus-glib...");
+ dbus_g_object_type_install_info (NOTIFY_TYPE_DAEMON, &dbus_glib__object_info);
+ g_message ("'daemon' successfully registered");
+
+ bus_proxy = dbus_g_proxy_new_for_name (connection, "org.freedesktop.DBus",
+ "/org/freedesktop/DBus",
+ "org.freedesktop.DBus");
+
+ if (!dbus_g_proxy_call (bus_proxy, "RequestName", &error,
+ G_TYPE_STRING, "org.freedesktop.Notifications",
+ G_TYPE_UINT, 0,
+ G_TYPE_INVALID,
+ G_TYPE_UINT, &request_name_result,
+ G_TYPE_INVALID))
+ g_error ("Could not aquire name: %s", error->message);
+
+ g_message ("creating instance of 'daemon' object...");
+ daemon = notify_daemon_new ();
+ g_message ("'daemon' object created successfully");
+
+ g_message ("exporting instance of 'daemon' object over the bus...");
+ dbus_g_connection_register_g_object (connection, "/org/freedesktop/Notifications", G_OBJECT (daemon));
+ g_message ("'daemon' object exported successfully");
+
+ gtk_main();
+
+ return 0;
+}
Added: trunk/notify-daemon-ng/src/notifydaemon.h
===================================================================
--- trunk/notify-daemon-ng/src/notifydaemon.h 2005-11-10 19:18:10 UTC (rev 2286)
+++ trunk/notify-daemon-ng/src/notifydaemon.h 2005-11-10 20:41:37 UTC (rev 2287)
@@ -0,0 +1,82 @@
+/* notifydaemon.h - Implementation of the destop notification spec
+ *
+ * Copyright (C) 2005 John (J5) Palmieri <johnp at redhat.com>
+ *
+ * Written by John (J5) Palmieri <johnp at redhat.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+#ifndef NOTIFY_DAEMON_H
+#define NOTIFY_DAEMON_H
+
+#include <glib.h>
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+#define NOTIFY_TYPE_DAEMON (notify_daemon_get_type ())
+#define NOTIFY_DAEMON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NOTIFY_TYPE_DAEMON, NotifyDaemon))
+#define NOTIFY_DAEMON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NOTIFY_TYPE_DAEMON, NotifyDaemonClass))
+#define NOTIFY_IS_DAEMON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NOTIFY_TYPE_DAEMON))
+#define NOTIFY_IS_DAEMON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NOTIFY_TYPE_DAEMON))
+#define NOTIFY_DAEMON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), NOTIFY_TYPE_DAEMON, NotifyDaemonClass))
+
+#define NOTIFY_DAEMON_DEFAULT_TIMEOUT 7000
+
+typedef struct _NotifyDaemon NotifyDaemon;
+typedef struct _NotifyDaemonClass NotifyDaemonClass;
+typedef struct _NotifyDaemonPrivate NotifyDaemonPrivate;
+
+struct _NotifyDaemon
+{
+ GObject parent;
+
+ /*< private > */
+ NotifyDaemonPrivate *priv;
+};
+
+struct _NotifyDaemonClass
+{
+ GObjectClass parent_class;
+};
+
+enum _NotifyDaemonError
+{
+ NOTIFY_DAEMON_ERROR_GENERIC = 0,
+};
+
+GType notify_daemon_get_type (void);
+
+NotifyDaemon *notify_daemon_new (void)
+ G_GNUC_MALLOC;
+
+gboolean notify_daemon_notify_handler (NotifyDaemon *daemon,
+ const gchar *app_name,
+ const gchar *icon,
+ guint id,
+ const gchar *summary,
+ const gchar *body,
+ GSList *actions,
+ GHashTable *hints,
+ int timeout,
+ guint *return_id,
+ GError **error);
+
+gboolean notify_daemon_close_notification_handler (NotifyDaemon *daemon,
+ guint id,
+ GError **error);
+
+G_END_DECLS
+#endif /* NOTIFY_DAEMON_H */
Added: trunk/notify-daemon-ng/src/notifydaemon.xml
===================================================================
--- trunk/notify-daemon-ng/src/notifydaemon.xml 2005-11-10 19:18:10 UTC (rev 2286)
+++ trunk/notify-daemon-ng/src/notifydaemon.xml 2005-11-10 20:41:37 UTC (rev 2287)
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<node name="/org/freedesktop/Notifications">
+
+ <interface name="org.freedesktop.Notifications">
+ <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="NotifyDaemon"/>
+ <method name="Notify">
+ <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="notify_daemon_notify_handler"/>
+ <arg type="s" name="app_name" direction="in" />
+ <arg type="s" name="icon" direction="in" />
+ <arg type="u" name="id" direction="in" />
+ <arg type="s" name="trouble" direction="in" />
+ <arg type="s" name="d_ret" direction="in" />
+ <arg type="as" name="str_ret" direction="in" />
+ <arg type="a{sv}" name="hints" direction="in" />
+ <arg type="i" name="timeout" direction="in" />
+ <arg type="u" name="return_id" direction="out" />
+ </method>
+ <method name="CloseNotification">
+ <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="notify_daemon_close_notification_handler"/>
+ <arg type="u" name="id" direction="in" />
+ </method>
+ </interface>
+</node>
More information about the galago-commits
mailing list