diff options
author | Perberos <[email protected]> | 2011-12-01 22:49:12 -0300 |
---|---|---|
committer | Perberos <[email protected]> | 2011-12-01 22:49:12 -0300 |
commit | 781b0ff3f74abd6f5353b6d08763bbba93f2f21c (patch) | |
tree | 20c130b413586219356ec360efb5918a498cee69 /src/themes/slider | |
download | mate-notification-daemon-781b0ff3f74abd6f5353b6d08763bbba93f2f21c.tar.bz2 mate-notification-daemon-781b0ff3f74abd6f5353b6d08763bbba93f2f21c.tar.xz |
moving from https://github.com/perberos/mate-desktop-environment
Diffstat (limited to 'src/themes/slider')
-rw-r--r-- | src/themes/slider/Makefile.am | 15 | ||||
-rw-r--r-- | src/themes/slider/Makefile.in | 604 | ||||
-rw-r--r-- | src/themes/slider/theme.c | 914 |
3 files changed, 1533 insertions, 0 deletions
diff --git a/src/themes/slider/Makefile.am b/src/themes/slider/Makefile.am new file mode 100644 index 0000000..a94ceaa --- /dev/null +++ b/src/themes/slider/Makefile.am @@ -0,0 +1,15 @@ +NULL = + +enginedir = $(libdir)/mate-notification-daemon/engines +engine_LTLIBRARIES = libslider.la + +AM_CPPFLAGS = $(THEME_CFLAGS) + +libslider_la_SOURCES = theme.c + +libslider_la_LDFLAGS = -module -avoid-version +libslider_la_LIBADD = \ + $(THEME_LIBS) \ + $(NULL) + +-include $(top_srcdir)/git.mk diff --git a/src/themes/slider/Makefile.in b/src/themes/slider/Makefile.in new file mode 100644 index 0000000..bf685a1 --- /dev/null +++ b/src/themes/slider/Makefile.in @@ -0,0 +1,604 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = src/themes/slider +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/macros/intltool.m4 \ + $(top_srcdir)/macros/libtool.m4 \ + $(top_srcdir)/macros/ltoptions.m4 \ + $(top_srcdir)/macros/ltsugar.m4 \ + $(top_srcdir)/macros/ltversion.m4 \ + $(top_srcdir)/macros/lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__installdirs = "$(DESTDIR)$(enginedir)" +LTLIBRARIES = $(engine_LTLIBRARIES) +am__DEPENDENCIES_1 = +libslider_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +am_libslider_la_OBJECTS = theme.lo +libslider_la_OBJECTS = $(am_libslider_la_OBJECTS) +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +libslider_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(libslider_la_LDFLAGS) $(LDFLAGS) -o $@ +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +SOURCES = $(libslider_la_SOURCES) +DIST_SOURCES = $(libslider_la_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALL_LINGUAS = @ALL_LINGUAS@ +AMTAR = @AMTAR@ +AM_CFLAGS = @AM_CFLAGS@ +AM_CXXFLAGS = @AM_CXXFLAGS@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATADIR = @DATADIR@ +DATADIRNAME = @DATADIRNAME@ +DBUS_SERVICES_DIR = @DBUS_SERVICES_DIR@ +DBUS_SYS_DIR = @DBUS_SYS_DIR@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DISABLE_DEPRECATED = @DISABLE_DEPRECATED@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GDK_CFLAGS = @GDK_CFLAGS@ +GDK_LIBS = @GDK_LIBS@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTOBJEXT = @INSTOBJEXT@ +INTLLIBS = @INTLLIBS@ +INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ +INTLTOOL_MERGE = @INTLTOOL_MERGE@ +INTLTOOL_PERL = @INTLTOOL_PERL@ +INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBDIR = @LIBDIR@ +LIBEXECDIR = @LIBEXECDIR@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MATECONFTOOL = @MATECONFTOOL@ +MATECONF_SCHEMA_CONFIG_SOURCE = @MATECONF_SCHEMA_CONFIG_SOURCE@ +MATECONF_SCHEMA_FILE_DIR = @MATECONF_SCHEMA_FILE_DIR@ +MKDIR_P = @MKDIR_P@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MSGFMT = @MSGFMT@ +MSGFMT_OPTS = @MSGFMT_OPTS@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NOTIFICATION_CAPPLET_CFLAGS = @NOTIFICATION_CAPPLET_CFLAGS@ +NOTIFICATION_CAPPLET_LIBS = @NOTIFICATION_CAPPLET_LIBS@ +NOTIFICATION_DAEMON_CFLAGS = @NOTIFICATION_DAEMON_CFLAGS@ +NOTIFICATION_DAEMON_LIBS = @NOTIFICATION_DAEMON_LIBS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POFILES = @POFILES@ +POSUB = @POSUB@ +PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ +PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +SYSCONFDIR = @SYSCONFDIR@ +THEME_CFLAGS = @THEME_CFLAGS@ +THEME_LIBS = @THEME_LIBS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WARN_CFLAGS = @WARN_CFLAGS@ +WARN_CXXFLAGS = @WARN_CXXFLAGS@ +XGETTEXT = @XGETTEXT@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +NULL = +enginedir = $(libdir)/mate-notification-daemon/engines +engine_LTLIBRARIES = libslider.la +AM_CPPFLAGS = $(THEME_CFLAGS) +libslider_la_SOURCES = theme.c +libslider_la_LDFLAGS = -module -avoid-version +libslider_la_LIBADD = \ + $(THEME_LIBS) \ + $(NULL) + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/themes/slider/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/themes/slider/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-engineLTLIBRARIES: $(engine_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(enginedir)" || $(MKDIR_P) "$(DESTDIR)$(enginedir)" + @list='$(engine_LTLIBRARIES)'; test -n "$(enginedir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(enginedir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(enginedir)"; \ + } + +uninstall-engineLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(engine_LTLIBRARIES)'; test -n "$(enginedir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(enginedir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(enginedir)/$$f"; \ + done + +clean-engineLTLIBRARIES: + -test -z "$(engine_LTLIBRARIES)" || rm -f $(engine_LTLIBRARIES) + @list='$(engine_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libslider.la: $(libslider_la_OBJECTS) $(libslider_la_DEPENDENCIES) + $(AM_V_CCLD)$(libslider_la_LINK) -rpath $(enginedir) $(libslider_la_OBJECTS) $(libslider_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/theme.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) +installdirs: + for dir in "$(DESTDIR)$(enginedir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-engineLTLIBRARIES clean-generic clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-engineLTLIBRARIES + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-engineLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean \ + clean-engineLTLIBRARIES clean-generic clean-libtool ctags \ + distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am \ + install-engineLTLIBRARIES install-exec install-exec-am \ + install-html install-html-am install-info install-info-am \ + install-man install-pdf install-pdf-am install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ + uninstall-am uninstall-engineLTLIBRARIES + + +-include $(top_srcdir)/git.mk + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/src/themes/slider/theme.c b/src/themes/slider/theme.c new file mode 100644 index 0000000..b147134 --- /dev/null +++ b/src/themes/slider/theme.c @@ -0,0 +1,914 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * Copyright (C) 2006-2007 Christian Hammond <[email protected]> + * Copyright (C) 2009 Red Hat, Inc. + * Copyright (C) 2011 Perberos <[email protected]> + * + * 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 <gtk/gtk.h> + +typedef void (*ActionInvokedCb) (GtkWindow* nw, const char* key); +typedef void (*UrlClickedCb) (GtkWindow* nw, const char* url); + +typedef struct { + GtkWidget* win; + GtkWidget* main_hbox; + GtkWidget* iconbox; + GtkWidget* icon; + GtkWidget* content_hbox; + GtkWidget* summary_label; + GtkWidget* close_button; + GtkWidget* body_label; + GtkWidget* actions_box; + GtkWidget* last_sep; + GtkWidget* pie_countdown; + + gboolean has_arrow; + gboolean composited; + + int width; + int height; + int last_width; + int last_height; + + guchar urgency; + glong timeout; + glong remaining; + + UrlClickedCb url_clicked; +} WindowData; + +enum { + URGENCY_LOW, + URGENCY_NORMAL, + URGENCY_CRITICAL +}; + +#define WIDTH 400 +#define DEFAULT_X0 0 +#define DEFAULT_Y0 0 +#define DEFAULT_RADIUS 8 +#define IMAGE_SIZE 48 +#define PIE_RADIUS 8 +#define PIE_WIDTH (2 * PIE_RADIUS) +#define PIE_HEIGHT (2 * PIE_RADIUS) +#define BODY_X_OFFSET (IMAGE_SIZE + 4) +#define BACKGROUND_ALPHA 0.90 + +#define MAX_ICON_SIZE IMAGE_SIZE + +#define USE_COMPOSITE + +static void draw_round_rect(cairo_t* cr, gdouble aspect, gdouble x, gdouble y, gdouble corner_radius, gdouble width, gdouble height) +{ + gdouble radius = corner_radius / aspect; + + cairo_move_to(cr, x + radius, y); + + // top-right, left of the corner + cairo_line_to(cr, x + width - radius, y); + + // top-right, below the corner + cairo_arc(cr, x + width - radius, y + radius, radius, -90.0f * G_PI / 180.0f, 0.0f * G_PI / 180.0f); + + // bottom-right, above the corner + cairo_line_to(cr, x + width, y + height - radius); + + // bottom-right, left of the corner + cairo_arc(cr, x + width - radius, y + height - radius, radius, 0.0f * G_PI / 180.0f, 90.0f * G_PI / 180.0f); + + // bottom-left, right of the corner + cairo_line_to(cr, x + radius, y + height); + + // bottom-left, above the corner + cairo_arc(cr, x + radius, y + height - radius, radius, 90.0f * G_PI / 180.0f, 180.0f * G_PI / 180.0f); + + // top-left, below the corner + cairo_line_to(cr, x, y + radius); + + // top-left, right of the corner + cairo_arc(cr, x + radius, y + radius, radius, 180.0f * G_PI / 180.0f, 270.0f * G_PI / 180.0f); +} + +static void fill_background(GtkWidget* widget, WindowData* windata, cairo_t* cr) +{ + GdkColor color; + double r, g, b; + + #if GTK_CHECK_VERSION(3, 0, 0) + + GtkAllocation allocation; + + gtk_widget_get_allocation(widget, &allocation); + + draw_round_rect(cr, 1.0f, DEFAULT_X0 + 1, DEFAULT_Y0 + 1, DEFAULT_RADIUS, allocation.width - 2, allocation.height - 2); + + //GdkRGBA color; + + //gtk_style_context_get_background_color(); + color = widget->style->bg[GTK_STATE_NORMAL]; + r = (float) color.red / 65535.0; + g = (float) color.green / 65535.0; + b = (float) color.blue / 65535.0; + cairo_set_source_rgba(cr, r, g, b, BACKGROUND_ALPHA); + cairo_fill_preserve(cr); + + /* Should we show urgency somehow? Probably doesn't + * have any meaningful value to the user... */ + + color = widget->style->text_aa[GTK_STATE_NORMAL]; + r = (float) color.red / 65535.0; + g = (float) color.green / 65535.0; + b = (float) color.blue / 65535.0; + cairo_set_source_rgba(cr, r, g, b, BACKGROUND_ALPHA / 2); + cairo_set_line_width(cr, 1); + cairo_stroke(cr); + + #else + + draw_round_rect(cr, 1.0f, DEFAULT_X0 + 1, DEFAULT_Y0 + 1, DEFAULT_RADIUS, widget->allocation.width - 2, widget->allocation.height - 2); + + color = widget->style->bg[GTK_STATE_NORMAL]; + r = (float) color.red / 65535.0; + g = (float) color.green / 65535.0; + b = (float) color.blue / 65535.0; + cairo_set_source_rgba(cr, r, g, b, BACKGROUND_ALPHA); + cairo_fill_preserve(cr); + + /* Should we show urgency somehow? Probably doesn't + * have any meaningful value to the user... */ + + color = widget->style->text_aa[GTK_STATE_NORMAL]; + r = (float) color.red / 65535.0; + g = (float) color.green / 65535.0; + b = (float) color.blue / 65535.0; + cairo_set_source_rgba(cr, r, g, b, BACKGROUND_ALPHA / 2); + cairo_set_line_width(cr, 1); + cairo_stroke(cr); + #endif +} + +static void update_shape(WindowData* windata) +{ + GdkBitmap* mask; + cairo_t* cr; + + if (windata->width == windata->last_width && windata->height == windata->last_height) + { + return; + } + + if (windata->width == 0 || windata->height == 0) + { + #if GTK_CHECK_VERSION(3, 0, 0) + + GtkAllocation allocation; + + gtk_widget_get_allocation(windata->win, &allocation); + + windata->width = MAX(allocation.width, 1); + windata->height = MAX(allocation.height, 1); + #else + windata->width = MAX(windata->win->allocation.width, 1); + windata->height = MAX(windata->win->allocation.height, 1); + #endif + } + + if (windata->composited) + { + gtk_widget_shape_combine_mask(windata->win, NULL, 0, 0); + return; + } + + windata->last_width = windata->width; + windata->last_height = windata->height; + mask = (GdkBitmap*) gdk_pixmap_new(NULL, windata->width, windata->height, 1); + + if (mask == NULL) + { + return; + } + + cr = gdk_cairo_create(mask); + + if (cairo_status(cr) == CAIRO_STATUS_SUCCESS) + { + cairo_set_operator(cr, CAIRO_OPERATOR_CLEAR); + cairo_paint(cr); + + cairo_set_operator(cr, CAIRO_OPERATOR_OVER); + cairo_set_source_rgb(cr, 1.0f, 1.0f, 1.0f); + draw_round_rect(cr, 1.0f, DEFAULT_X0, DEFAULT_Y0, DEFAULT_RADIUS, windata->width, windata->height); + cairo_fill(cr); + + gtk_widget_shape_combine_mask(windata->win, mask, 0, 0); + } + cairo_destroy(cr); + + g_object_unref(mask); +} + +static void paint_window(GtkWidget* widget, WindowData* windata) +{ + cairo_t* context; + cairo_surface_t* surface; + cairo_t* cr; + + if (windata->width == 0 || windata->height == 0) + { + #if GTK_CHECK_VERSION(3, 0, 0) + + GtkAllocation allocation; + + gtk_widget_get_allocation(windata->win, &allocation); + + windata->width = MAX(allocation.width, 1); + windata->height = MAX(allocation.height, 1); + #else + windata->width = MAX(windata->win->allocation.width, 1); + windata->height = MAX(windata->win->allocation.height, 1); + #endif + } + + context = gdk_cairo_create(widget->window); + + cairo_set_operator(context, CAIRO_OPERATOR_SOURCE); + + + #if GTK_CHECK_VERSION(3, 0, 0) + + GtkAllocation allocation; + + gtk_widget_get_allocation(widget, &allocation); + + surface = cairo_surface_create_similar(cairo_get_target(context), CAIRO_CONTENT_COLOR_ALPHA, allocation.width, allocation.height); + #else + + surface = cairo_surface_create_similar(cairo_get_target(context), CAIRO_CONTENT_COLOR_ALPHA, widget->allocation.width, widget->allocation.height); + #endif + + cr = cairo_create(surface); + + fill_background(widget, windata, cr); + + cairo_destroy(cr); + cairo_set_source_surface(context, surface, 0, 0); + cairo_paint(context); + cairo_surface_destroy(surface); + cairo_destroy(context); + + update_shape(windata); +} + +static gboolean on_window_map(GtkWidget* widget, GdkEvent* event, WindowData* windata) +{ + return FALSE; +} + +static gboolean on_window_expose(GtkWidget* widget, GdkEventExpose* event, WindowData* windata) +{ + paint_window(widget, windata); + + return FALSE; +} + +static void destroy_windata(WindowData* windata) +{ + g_free(windata); +} + +static void update_content_hbox_visibility(WindowData* windata) +{ + if (GTK_WIDGET_VISIBLE(windata->icon) || GTK_WIDGET_VISIBLE(windata->body_label) || GTK_WIDGET_VISIBLE(windata->actions_box)) + { + gtk_widget_show(windata->content_hbox); + } + else + { + gtk_widget_hide(windata->content_hbox); + } +} + +static gboolean on_configure_event(GtkWidget* widget, GdkEventConfigure* event, WindowData* windata) +{ + windata->width = event->width; + windata->height = event->height; + + gtk_widget_queue_draw(widget); + + return FALSE; +} + +static void on_window_realize(GtkWidget* widget, WindowData* windata) +{ + /* Nothing */ +} + +static void color_reverse(const GdkColor* a, GdkColor* b) +{ + gdouble red; + gdouble green; + gdouble blue; + gdouble h; + gdouble s; + gdouble v; + + red = (gdouble) a->red / 65535.0; + green = (gdouble) a->green / 65535.0; + blue = (gdouble) a->blue / 65535.0; + + gtk_rgb_to_hsv(red, green, blue, &h, &s, &v); + + /* pivot brightness around the center */ + v = 0.5 + (0.5 - v); + + if (v > 1.0) + { + v = 1.0; + } + else if (v < 0.0) + { + v = 0.0; + } + + /* reduce saturation by 50% */ + s *= 0.5; + + gtk_hsv_to_rgb(h, s, v, &red, &green, &blue); + + b->red = red * 65535.0; + b->green = green * 65535.0; + b->blue = blue * 65535.0; +} + +static void override_style(GtkWidget* widget, GtkStyle* previous_style) +{ + GtkStateType state; + GtkStyle* style; + GdkColor fg; + GdkColor bg; + + style = gtk_style_copy(widget->style); + + if (previous_style == NULL || (previous_style != NULL && (previous_style->bg[GTK_STATE_NORMAL].red != style->bg[GTK_STATE_NORMAL].red || previous_style->bg[GTK_STATE_NORMAL].green != style->bg[GTK_STATE_NORMAL].green || previous_style->bg[GTK_STATE_NORMAL].blue != style->bg[GTK_STATE_NORMAL].blue))) + { + state = (GtkStateType) 0; + + while (state < (GtkStateType) G_N_ELEMENTS(widget->style->bg)) + { + color_reverse(&style->bg[state], &bg); + gtk_widget_modify_bg(widget, state, &bg); + state++; + } + } + + if (previous_style == NULL || (previous_style != NULL && (previous_style->fg[GTK_STATE_NORMAL].red != style->fg[GTK_STATE_NORMAL].red || previous_style->fg[GTK_STATE_NORMAL].green != style->fg[GTK_STATE_NORMAL].green || previous_style->fg[GTK_STATE_NORMAL].blue != style->fg[GTK_STATE_NORMAL].blue))) + { + state = (GtkStateType) 0; + + while (state < (GtkStateType) G_N_ELEMENTS(widget->style->fg)) + { + color_reverse(&style->fg[state], &fg); + gtk_widget_modify_fg(widget, state, &fg); + state++; + } + } + + g_object_unref(style); +} + +static void on_style_set(GtkWidget* widget, GtkStyle* previous_style, WindowData* windata) +{ + g_signal_handlers_block_by_func(G_OBJECT(widget), on_style_set, windata); + override_style(widget, previous_style); + + gtk_widget_queue_draw(widget); + + g_signal_handlers_unblock_by_func(G_OBJECT(widget), on_style_set, windata); +} + +static void on_composited_changed(GtkWidget* window, WindowData* windata) +{ + windata->composited = gdk_screen_is_composited(gtk_widget_get_screen(window)); + update_shape(windata); +} + +GtkWindow* create_notification(UrlClickedCb url_clicked) +{ + GtkWidget* win; + GtkWidget* main_vbox; + GtkWidget* vbox; + GtkWidget* close_button; + GtkWidget* image; + GtkWidget* alignment; + AtkObject* atkobj; + GtkRcStyle* rcstyle; + WindowData* windata; + #ifdef USE_COMPOSITE + GdkColormap* colormap; + GdkScreen* screen; + #endif + + windata = g_new0(WindowData, 1); + windata->urgency = URGENCY_NORMAL; + windata->url_clicked = url_clicked; + + win = gtk_window_new(GTK_WINDOW_POPUP); + gtk_window_set_resizable(GTK_WINDOW(win), FALSE); + gtk_widget_set_app_paintable(win, TRUE); + g_signal_connect(G_OBJECT(win), "style-set", G_CALLBACK(on_style_set), windata); + g_signal_connect(G_OBJECT(win), "map-event", G_CALLBACK(on_window_map), windata); + g_signal_connect(G_OBJECT(win), "expose-event", G_CALLBACK(on_window_expose), windata); + g_signal_connect(G_OBJECT(win), "realize", G_CALLBACK(on_window_realize), windata); + + windata->win = win; + + windata->composited = FALSE; + + #ifdef USE_COMPOSITE + screen = gtk_window_get_screen(GTK_WINDOW(win)); + colormap = gdk_screen_get_rgba_colormap(screen); + + if (colormap != NULL) + { + gtk_widget_set_colormap(win, colormap); + + if (gdk_screen_is_composited(screen)) + { + windata->composited = TRUE; + } + } + + g_signal_connect(win, "composited-changed", G_CALLBACK(on_composited_changed), windata); + #endif + + gtk_window_set_title(GTK_WINDOW(win), "Notification"); + gtk_window_set_type_hint(GTK_WINDOW(win), GDK_WINDOW_TYPE_HINT_NOTIFICATION); + gtk_widget_add_events(win, GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK); + + g_object_set_data_full(G_OBJECT(win), "windata", windata, (GDestroyNotify) destroy_windata); + atk_object_set_role(gtk_widget_get_accessible(win), ATK_ROLE_ALERT); + + g_signal_connect(G_OBJECT(win), "configure-event", G_CALLBACK(on_configure_event), windata); + + main_vbox = gtk_vbox_new(FALSE, 0); + g_signal_connect(G_OBJECT(main_vbox), "style-set", G_CALLBACK(on_style_set), windata); + gtk_widget_show(main_vbox); + gtk_container_add(GTK_CONTAINER(win), main_vbox); + gtk_container_set_border_width(GTK_CONTAINER(main_vbox), 12); + + windata->main_hbox = gtk_hbox_new(FALSE, 0); + gtk_widget_show(windata->main_hbox); + gtk_box_pack_start(GTK_BOX(main_vbox), windata->main_hbox, FALSE, FALSE, 0); + + /* First row (icon, vbox, close) */ + windata->iconbox = gtk_alignment_new(0.5, 0, 0, 0); + gtk_widget_show(windata->iconbox); + gtk_alignment_set_padding(GTK_ALIGNMENT(windata->iconbox), 5, 0, 0, 0); + gtk_box_pack_start(GTK_BOX(windata->main_hbox), windata->iconbox, FALSE, FALSE, 0); + gtk_widget_set_size_request(windata->iconbox, BODY_X_OFFSET, -1); + + windata->icon = gtk_image_new(); + gtk_widget_show(windata->icon); + gtk_container_add(GTK_CONTAINER(windata->iconbox), windata->icon); + + vbox = gtk_vbox_new(FALSE, 6); + gtk_widget_show(vbox); + gtk_box_pack_start(GTK_BOX(windata->main_hbox), vbox, TRUE, TRUE, 0); + gtk_container_set_border_width(GTK_CONTAINER(vbox), 10); + + /* Add the close button */ + alignment = gtk_alignment_new(0.5, 0, 0, 0); + gtk_widget_show(alignment); + gtk_box_pack_start(GTK_BOX(windata->main_hbox), alignment, FALSE, FALSE, 0); + + close_button = gtk_button_new(); + g_signal_connect(G_OBJECT(close_button), "style-set", G_CALLBACK(on_style_set), windata); + gtk_widget_show(close_button); + windata->close_button = close_button; + gtk_container_add(GTK_CONTAINER(alignment), close_button); + gtk_button_set_relief(GTK_BUTTON(close_button), GTK_RELIEF_NONE); + gtk_container_set_border_width(GTK_CONTAINER(close_button), 0); + g_signal_connect_swapped(G_OBJECT(close_button), "clicked", G_CALLBACK(gtk_widget_destroy), win); + + rcstyle = gtk_rc_style_new(); + rcstyle->xthickness = rcstyle->ythickness = 0; + gtk_widget_modify_style(close_button, rcstyle); + g_object_unref(rcstyle); + + atkobj = gtk_widget_get_accessible(close_button); + atk_action_set_description(ATK_ACTION(atkobj), 0, "Closes the notification."); + atk_object_set_name(atkobj, ""); + atk_object_set_description(atkobj, "Closes the notification."); + + image = gtk_image_new_from_stock(GTK_STOCK_CLOSE, GTK_ICON_SIZE_MENU); + gtk_widget_show(image); + gtk_container_add(GTK_CONTAINER(close_button), image); + + /* center vbox */ + windata->summary_label = gtk_label_new(NULL); + g_signal_connect(G_OBJECT(windata->summary_label), "style-set", G_CALLBACK(on_style_set), windata); + gtk_widget_show(windata->summary_label); + gtk_box_pack_start(GTK_BOX(vbox), windata->summary_label, TRUE, TRUE, 0); + gtk_misc_set_alignment(GTK_MISC(windata->summary_label), 0, 0); + gtk_label_set_line_wrap(GTK_LABEL(windata->summary_label), TRUE); + + atkobj = gtk_widget_get_accessible(windata->summary_label); + atk_object_set_description(atkobj, "Notification summary text."); + + windata->content_hbox = gtk_hbox_new(FALSE, 6); + gtk_widget_show(windata->content_hbox); + gtk_box_pack_start(GTK_BOX(vbox), windata->content_hbox, FALSE, FALSE, 0); + + + vbox = gtk_vbox_new(FALSE, 6); + gtk_widget_show(vbox); + gtk_box_pack_start(GTK_BOX(windata->content_hbox), vbox, TRUE, TRUE, 0); + + windata->body_label = gtk_label_new(NULL); + g_signal_connect(G_OBJECT(windata->body_label), "style-set", G_CALLBACK(on_style_set), windata); + gtk_widget_show(windata->body_label); + gtk_box_pack_start(GTK_BOX(vbox), windata->body_label, TRUE, TRUE, 0); + gtk_misc_set_alignment(GTK_MISC(windata->body_label), 0, 0); + gtk_label_set_line_wrap(GTK_LABEL(windata->body_label), TRUE); + g_signal_connect_swapped(G_OBJECT(windata->body_label), "activate-link", G_CALLBACK(windata->url_clicked), win); + + atkobj = gtk_widget_get_accessible(windata->body_label); + atk_object_set_description(atkobj, "Notification body text."); + + alignment = gtk_alignment_new(1, 0.5, 0, 0); + gtk_widget_show(alignment); + gtk_box_pack_start(GTK_BOX(vbox), alignment, FALSE, TRUE, 0); + + windata->actions_box = gtk_hbox_new(FALSE, 6); + gtk_widget_show(windata->actions_box); + gtk_container_add(GTK_CONTAINER(alignment), windata->actions_box); + + return GTK_WINDOW(win); +} + +void set_notification_hints(GtkWindow* nw, GHashTable* hints) +{ + WindowData* windata = g_object_get_data(G_OBJECT(nw), "windata"); + + g_assert(windata != NULL); + + GValue* value = (GValue*) g_hash_table_lookup(hints, "urgency"); + + if (value != NULL && G_VALUE_HOLDS_UCHAR(value)) + { + windata->urgency = g_value_get_uchar(value); + + if (windata->urgency == URGENCY_CRITICAL) + { + gtk_window_set_title(GTK_WINDOW(nw), "Critical Notification"); + } + else + { + gtk_window_set_title(GTK_WINDOW(nw), "Notification"); + } + } +} + +void set_notification_timeout(GtkWindow *nw, glong timeout) +{ + WindowData* windata = g_object_get_data(G_OBJECT(nw), "windata"); + + g_assert(windata != NULL); + + windata->timeout = timeout; +} + +void notification_tick(GtkWindow* nw, glong remaining) +{ + WindowData* windata = g_object_get_data(G_OBJECT(nw), "windata"); + + windata->remaining = remaining; + + if (windata->pie_countdown != NULL) + { + gtk_widget_queue_draw_area(windata->pie_countdown, 0, 0, PIE_WIDTH, PIE_HEIGHT); + } +} + +void set_notification_text(GtkWindow* nw, const char* summary, const char* body) +{ + char* str; + char* quoted; + GtkRequisition req; + WindowData* windata; + int summary_width; + + windata = g_object_get_data(G_OBJECT(nw), "windata"); + + g_assert(windata != NULL); + + quoted = g_markup_escape_text(summary, -1); + str = g_strdup_printf("<b><big>%s</big></b>", quoted); + g_free(quoted); + + gtk_label_set_markup(GTK_LABEL(windata->summary_label), str); + g_free(str); + + gtk_label_set_markup(GTK_LABEL(windata->body_label), body); + + if (body == NULL || *body == '\0') + { + gtk_widget_hide(windata->body_label); + } + else + { + gtk_widget_show(windata->body_label); + } + + update_content_hbox_visibility(windata); + + gtk_widget_size_request(windata->close_button, &req); + /* -1: main_vbox border width + -10: vbox border width + -6: spacing for hbox */ + summary_width = WIDTH - (1 * 2) - (10 * 2) - BODY_X_OFFSET - req.width - (6 * 2); + + if (body != NULL && *body != '\0') + { + gtk_widget_set_size_request(windata->body_label, summary_width, -1); + } + + gtk_widget_set_size_request(windata->summary_label, summary_width, -1); +} + +static GdkPixbuf* scale_pixbuf(GdkPixbuf* pixbuf, int max_width, int max_height, gboolean no_stretch_hint) +{ + float scale_factor_x = 1.0; + float scale_factor_y = 1.0; + float scale_factor = 1.0; + + int pw = gdk_pixbuf_get_width(pixbuf); + int ph = gdk_pixbuf_get_height(pixbuf); + + /* Determine which dimension requires the smallest scale. */ + scale_factor_x = (float) max_width / (float) pw; + scale_factor_y = (float) max_height / (float) ph; + + if (scale_factor_x > scale_factor_y) + { + scale_factor = scale_factor_y; + } + else + { + scale_factor = scale_factor_x; + } + + /* always scale down, allow to disable scaling up */ + if (scale_factor < 1.0 || !no_stretch_hint) + { + int scale_x; + int scale_y; + + scale_x = (int) (pw * scale_factor); + scale_y = (int) (ph * scale_factor); + + return gdk_pixbuf_scale_simple(pixbuf, scale_x, scale_y, GDK_INTERP_BILINEAR); + } + else + { + return g_object_ref(pixbuf); + } +} + +void set_notification_icon(GtkWindow* nw, GdkPixbuf* pixbuf) +{ + WindowData* windata = g_object_get_data(G_OBJECT(nw), "windata"); + + g_assert(windata != NULL); + + GdkPixbuf* scaled = NULL; + + if (pixbuf != NULL) + { + scaled = scale_pixbuf(pixbuf, MAX_ICON_SIZE, MAX_ICON_SIZE, TRUE); + } + + gtk_image_set_from_pixbuf(GTK_IMAGE(windata->icon), scaled); + + if (scaled != NULL) + { + int pixbuf_width = gdk_pixbuf_get_width(scaled); + + gtk_widget_show(windata->icon); + gtk_widget_set_size_request(windata->iconbox, MAX(BODY_X_OFFSET, pixbuf_width), -1); + g_object_unref(scaled); + } + else + { + gtk_widget_hide(windata->icon); + + gtk_widget_set_size_request(windata->iconbox, BODY_X_OFFSET, -1); + } + + update_content_hbox_visibility(windata); +} + +void set_notification_arrow(GtkWidget* nw, gboolean visible, int x, int y) +{ + WindowData* windata = g_object_get_data(G_OBJECT(nw), "windata"); + + g_assert(windata != NULL); +} + +static gboolean on_countdown_expose(GtkWidget* pie, GdkEventExpose* event, WindowData* windata) +{ + GtkStyle* style; + cairo_t* context; + cairo_surface_t* surface; + cairo_t* cr; + GdkColor color; + double r, g, b; + + style = gtk_widget_get_style(windata->win); + + #if GTK_CHECK_VERSION(3, 0, 0) + context = gdk_cairo_create(GDK_WINDOW(windata->pie_countdown->window)); + #else + context = gdk_cairo_create(GDK_DRAWABLE(windata->pie_countdown->window)); + #endif + + cairo_set_operator(context, CAIRO_OPERATOR_SOURCE); + + + #if GTK_CHECK_VERSION(3, 0, 0) + + GtkAllocation allocation; + + gtk_widget_get_allocation(pie, &allocation); + + surface = cairo_surface_create_similar(cairo_get_target(context), CAIRO_CONTENT_COLOR_ALPHA, allocation.width, allocation.height); + + #else + + surface = cairo_surface_create_similar(cairo_get_target(context), CAIRO_CONTENT_COLOR_ALPHA, pie->allocation.width, pie->allocation.height); + + #endif + + cr = cairo_create(surface); + + cairo_set_operator(cr, CAIRO_OPERATOR_OVER); + color = windata->win->style->bg[GTK_STATE_NORMAL]; + r = (float) color.red / 65535.0; + g = (float) color.green / 65535.0; + b = (float) color.blue / 65535.0; + cairo_set_source_rgba(cr, r, g, b, BACKGROUND_ALPHA); + cairo_paint(cr); + + if (windata->timeout > 0) + { + gdouble pct = (gdouble) windata->remaining / (gdouble) windata->timeout; + + gdk_cairo_set_source_color(cr, &style->fg[GTK_STATE_NORMAL]); + + cairo_move_to(cr, PIE_RADIUS, PIE_RADIUS); + cairo_arc_negative(cr, PIE_RADIUS, PIE_RADIUS, PIE_RADIUS, -G_PI_2, -(pct * G_PI * 2) - G_PI_2); + cairo_line_to(cr, PIE_RADIUS, PIE_RADIUS); + cairo_fill(cr); + } + + cairo_destroy(cr); + cairo_set_source_surface(context, surface, 0, 0); + cairo_paint(context); + cairo_surface_destroy(surface); + cairo_destroy(context); + + return TRUE; +} + +static void on_action_clicked(GtkWidget* w, GdkEventButton *event, ActionInvokedCb action_cb) +{ + GtkWindow* nw = g_object_get_data(G_OBJECT(w), "_nw"); + const char* key = g_object_get_data(G_OBJECT(w), "_action_key"); + + action_cb(nw, key); +} + +void add_notification_action(GtkWindow* nw, const char* text, const char* key, ActionInvokedCb cb) +{ + WindowData* windata = g_object_get_data(G_OBJECT(nw), "windata"); + GtkWidget* label; + GtkWidget* button; + GtkWidget* hbox; + GdkPixbuf* pixbuf; + char* buf; + + g_assert(windata != NULL); + + if (!GTK_WIDGET_VISIBLE(windata->actions_box)) + { + GtkWidget* alignment; + + gtk_widget_show(windata->actions_box); + update_content_hbox_visibility(windata); + + alignment = gtk_alignment_new(1, 0.5, 0, 0); + gtk_widget_show(alignment); + gtk_box_pack_end(GTK_BOX(windata->actions_box), alignment, FALSE, TRUE, 0); + + windata->pie_countdown = gtk_drawing_area_new(); + g_signal_connect(G_OBJECT(windata->pie_countdown), "style-set", G_CALLBACK(on_style_set), windata); + + gtk_widget_show(windata->pie_countdown); + gtk_container_add(GTK_CONTAINER(alignment), windata->pie_countdown); + gtk_widget_set_size_request(windata->pie_countdown, PIE_WIDTH, PIE_HEIGHT); + g_signal_connect(G_OBJECT(windata->pie_countdown), "expose_event", G_CALLBACK(on_countdown_expose), windata); + } + + button = gtk_button_new(); + g_signal_connect(G_OBJECT(button), "style-set", G_CALLBACK(on_style_set), windata); + gtk_widget_show(button); + gtk_box_pack_start(GTK_BOX(windata->actions_box), button, FALSE, FALSE, 0); + gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); + gtk_container_set_border_width(GTK_CONTAINER(button), 0); + + hbox = gtk_hbox_new(FALSE, 6); + gtk_widget_show(hbox); + gtk_container_add(GTK_CONTAINER(button), hbox); + + /* Try to be smart and find a suitable icon. */ + buf = g_strdup_printf("stock_%s", key); + pixbuf = gtk_icon_theme_load_icon(gtk_icon_theme_get_for_screen(gdk_drawable_get_screen(GTK_WIDGET(nw)->window)), buf, 16, GTK_ICON_LOOKUP_USE_BUILTIN, NULL); + g_free(buf); + + if (pixbuf != NULL) + { + GtkWidget* image = gtk_image_new_from_pixbuf(pixbuf); + g_signal_connect(G_OBJECT(image), "style-set", G_CALLBACK(on_style_set), windata); + gtk_widget_show(image); + gtk_box_pack_start(GTK_BOX(hbox), image, FALSE, FALSE, 0); + gtk_misc_set_alignment(GTK_MISC(image), 0.5, 0.5); + } + + label = gtk_label_new(NULL); + g_signal_connect(G_OBJECT(label), "style-set", G_CALLBACK(on_style_set), windata); + gtk_widget_show(label); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); + gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); + buf = g_strdup_printf("<small>%s</small>", text); + gtk_label_set_markup(GTK_LABEL(label), buf); + g_free(buf); + + g_object_set_data(G_OBJECT(button), "_nw", nw); + g_object_set_data_full(G_OBJECT(button), "_action_key", g_strdup(key), g_free); + g_signal_connect(G_OBJECT(button), "button-release-event", G_CALLBACK(on_action_clicked), cb); +} + +void clear_notification_actions(GtkWindow* nw) +{ + WindowData* windata = g_object_get_data(G_OBJECT(nw), "windata"); + + windata->pie_countdown = NULL; + + gtk_widget_hide(windata->actions_box); + gtk_container_foreach(GTK_CONTAINER(windata->actions_box), (GtkCallback) gtk_object_destroy, NULL); +} + +void move_notification(GtkWidget* widget, int x, int y) +{ + WindowData* windata = g_object_get_data(G_OBJECT(widget), "windata"); + + g_assert(windata != NULL); + + gtk_window_move(GTK_WINDOW(windata->win), x, y); +} + +void get_theme_info(char** theme_name, char** theme_ver, char** author, char** homepage) +{ + *theme_name = g_strdup("Slider"); + *theme_ver = g_strdup_printf("%d.%d.%d", NOTIFICATION_DAEMON_MAJOR_VERSION, NOTIFICATION_DAEMON_MINOR_VERSION, NOTIFICATION_DAEMON_MICRO_VERSION); + *author = g_strdup("William Jon McCann"); + *homepage = g_strdup("http://www.gnome.org/"); +} + +gboolean get_always_stack(GtkWidget* nw) +{ + return TRUE; +} + +gboolean theme_check_init(unsigned int major_ver, unsigned int minor_ver, unsigned int micro_ver) +{ + return major_ver == 0 && (minor_ver > 3 || (minor_ver == 3 && micro_ver >= 2)); +} |