Implement wxNotificationMessage using libnotify in wxGTK.
Use libnotify -- if detected by configure -- to provide native notifications in wxGTK. Our API maps to libnotify one in rather straightforward way, we might consider extending it to cover more of libnotify functionality (categories, user-defined icons and, especially, actions) later. Also update the dialogs sample to show another kind of notification and the documentation to clarify the behaviour of various methods. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72218 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
5a92b56137
commit
afbf46a317
34
Makefile.in
34
Makefile.in
@ -2918,6 +2918,7 @@ COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_GUI_HDR = \
|
||||
wx/gtk/menuitem.h \
|
||||
wx/gtk/msgdlg.h \
|
||||
wx/gtk/notebook.h \
|
||||
wx/gtk/notifmsg.h \
|
||||
wx/gtk/print.h \
|
||||
wx/gtk/radiobox.h \
|
||||
wx/gtk/radiobut.h \
|
||||
@ -2973,6 +2974,7 @@ COND_TOOLKIT_GTK_TOOLKIT_VERSION_3_GUI_HDR = \
|
||||
wx/gtk/menuitem.h \
|
||||
wx/gtk/msgdlg.h \
|
||||
wx/gtk/notebook.h \
|
||||
wx/gtk/notifmsg.h \
|
||||
wx/gtk/print.h \
|
||||
wx/gtk/radiobox.h \
|
||||
wx/gtk/radiobut.h \
|
||||
@ -5525,6 +5527,7 @@ COND_TOOLKIT_GTK_TOOLKIT_VERSION_2___GUI_SRC_OBJECTS = \
|
||||
monodll_gtk_msgdlg.o \
|
||||
monodll_gtk_nativewin.o \
|
||||
monodll_gtk_notebook.o \
|
||||
monodll_gtk_notifmsg.o \
|
||||
monodll_gtk_print.o \
|
||||
monodll_gtk_radiobox.o \
|
||||
monodll_gtk_radiobut.o \
|
||||
@ -5581,6 +5584,7 @@ COND_TOOLKIT_GTK_TOOLKIT_VERSION_3___GUI_SRC_OBJECTS = \
|
||||
monodll_gtk_msgdlg.o \
|
||||
monodll_gtk_nativewin.o \
|
||||
monodll_gtk_notebook.o \
|
||||
monodll_gtk_notifmsg.o \
|
||||
monodll_gtk_print.o \
|
||||
monodll_gtk_radiobox.o \
|
||||
monodll_gtk_radiobut.o \
|
||||
@ -7723,6 +7727,7 @@ COND_TOOLKIT_GTK_TOOLKIT_VERSION_2___GUI_SRC_OBJECTS_1 = \
|
||||
monolib_gtk_msgdlg.o \
|
||||
monolib_gtk_nativewin.o \
|
||||
monolib_gtk_notebook.o \
|
||||
monolib_gtk_notifmsg.o \
|
||||
monolib_gtk_print.o \
|
||||
monolib_gtk_radiobox.o \
|
||||
monolib_gtk_radiobut.o \
|
||||
@ -7779,6 +7784,7 @@ COND_TOOLKIT_GTK_TOOLKIT_VERSION_3___GUI_SRC_OBJECTS_1 = \
|
||||
monolib_gtk_msgdlg.o \
|
||||
monolib_gtk_nativewin.o \
|
||||
monolib_gtk_notebook.o \
|
||||
monolib_gtk_notifmsg.o \
|
||||
monolib_gtk_print.o \
|
||||
monolib_gtk_radiobox.o \
|
||||
monolib_gtk_radiobut.o \
|
||||
@ -10097,6 +10103,7 @@ COND_TOOLKIT_GTK_TOOLKIT_VERSION_2___GUI_SRC_OBJECTS_2 = \
|
||||
coredll_gtk_msgdlg.o \
|
||||
coredll_gtk_nativewin.o \
|
||||
coredll_gtk_notebook.o \
|
||||
coredll_notifmsg.o \
|
||||
coredll_gtk_print.o \
|
||||
coredll_gtk_radiobox.o \
|
||||
coredll_gtk_radiobut.o \
|
||||
@ -10153,6 +10160,7 @@ COND_TOOLKIT_GTK_TOOLKIT_VERSION_3___GUI_SRC_OBJECTS_2 = \
|
||||
coredll_gtk_msgdlg.o \
|
||||
coredll_gtk_nativewin.o \
|
||||
coredll_gtk_notebook.o \
|
||||
coredll_notifmsg.o \
|
||||
coredll_gtk_print.o \
|
||||
coredll_gtk_radiobox.o \
|
||||
coredll_gtk_radiobut.o \
|
||||
@ -11740,6 +11748,7 @@ COND_TOOLKIT_GTK_TOOLKIT_VERSION_2___GUI_SRC_OBJECTS_3 = \
|
||||
corelib_gtk_msgdlg.o \
|
||||
corelib_gtk_nativewin.o \
|
||||
corelib_gtk_notebook.o \
|
||||
corelib_notifmsg.o \
|
||||
corelib_gtk_print.o \
|
||||
corelib_gtk_radiobox.o \
|
||||
corelib_gtk_radiobut.o \
|
||||
@ -11796,6 +11805,7 @@ COND_TOOLKIT_GTK_TOOLKIT_VERSION_3___GUI_SRC_OBJECTS_3 = \
|
||||
corelib_gtk_msgdlg.o \
|
||||
corelib_gtk_nativewin.o \
|
||||
corelib_gtk_notebook.o \
|
||||
corelib_notifmsg.o \
|
||||
corelib_gtk_print.o \
|
||||
corelib_gtk_radiobox.o \
|
||||
corelib_gtk_radiobut.o \
|
||||
@ -20111,6 +20121,12 @@ monodll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONODLL_ODEP)
|
||||
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1_WXUNIV_0@monodll_gtk_notebook.o: $(srcdir)/src/gtk/notebook.cpp $(MONODLL_ODEP)
|
||||
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/gtk/notebook.cpp
|
||||
|
||||
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_3_USE_GUI_1_WXUNIV_0@monodll_gtk_notifmsg.o: $(srcdir)/src/gtk/notifmsg.cpp $(MONODLL_ODEP)
|
||||
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_3_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/gtk/notifmsg.cpp
|
||||
|
||||
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1_WXUNIV_0@monodll_gtk_notifmsg.o: $(srcdir)/src/gtk/notifmsg.cpp $(MONODLL_ODEP)
|
||||
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/gtk/notifmsg.cpp
|
||||
|
||||
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_3_USE_GUI_1_WXUNIV_0@monodll_gtk_print.o: $(srcdir)/src/gtk/print.cpp $(MONODLL_ODEP)
|
||||
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_3_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/gtk/print.cpp
|
||||
|
||||
@ -25805,6 +25821,12 @@ monolib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONOLIB_ODEP)
|
||||
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1_WXUNIV_0@monolib_gtk_notebook.o: $(srcdir)/src/gtk/notebook.cpp $(MONOLIB_ODEP)
|
||||
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/gtk/notebook.cpp
|
||||
|
||||
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_3_USE_GUI_1_WXUNIV_0@monolib_gtk_notifmsg.o: $(srcdir)/src/gtk/notifmsg.cpp $(MONOLIB_ODEP)
|
||||
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_3_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/gtk/notifmsg.cpp
|
||||
|
||||
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1_WXUNIV_0@monolib_gtk_notifmsg.o: $(srcdir)/src/gtk/notifmsg.cpp $(MONOLIB_ODEP)
|
||||
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/gtk/notifmsg.cpp
|
||||
|
||||
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_3_USE_GUI_1_WXUNIV_0@monolib_gtk_print.o: $(srcdir)/src/gtk/print.cpp $(MONOLIB_ODEP)
|
||||
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_3_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/gtk/print.cpp
|
||||
|
||||
@ -31670,6 +31692,12 @@ coredll_win32.o: $(srcdir)/src/univ/themes/win32.cpp $(COREDLL_ODEP)
|
||||
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1_WXUNIV_0@coredll_gtk_notebook.o: $(srcdir)/src/gtk/notebook.cpp $(COREDLL_ODEP)
|
||||
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/gtk/notebook.cpp
|
||||
|
||||
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_3_USE_GUI_1_WXUNIV_0@coredll_notifmsg.o: $(srcdir)/src/gtk/notifmsg.cpp $(COREDLL_ODEP)
|
||||
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_3_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/gtk/notifmsg.cpp
|
||||
|
||||
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1_WXUNIV_0@coredll_notifmsg.o: $(srcdir)/src/gtk/notifmsg.cpp $(COREDLL_ODEP)
|
||||
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/gtk/notifmsg.cpp
|
||||
|
||||
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_3_USE_GUI_1_WXUNIV_0@coredll_gtk_print.o: $(srcdir)/src/gtk/print.cpp $(COREDLL_ODEP)
|
||||
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_3_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/gtk/print.cpp
|
||||
|
||||
@ -35924,6 +35952,12 @@ corelib_win32.o: $(srcdir)/src/univ/themes/win32.cpp $(CORELIB_ODEP)
|
||||
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1_WXUNIV_0@corelib_gtk_notebook.o: $(srcdir)/src/gtk/notebook.cpp $(CORELIB_ODEP)
|
||||
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/gtk/notebook.cpp
|
||||
|
||||
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_3_USE_GUI_1_WXUNIV_0@corelib_notifmsg.o: $(srcdir)/src/gtk/notifmsg.cpp $(CORELIB_ODEP)
|
||||
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_3_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/gtk/notifmsg.cpp
|
||||
|
||||
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1_WXUNIV_0@corelib_notifmsg.o: $(srcdir)/src/gtk/notifmsg.cpp $(CORELIB_ODEP)
|
||||
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/gtk/notifmsg.cpp
|
||||
|
||||
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_3_USE_GUI_1_WXUNIV_0@corelib_gtk_print.o: $(srcdir)/src/gtk/print.cpp $(CORELIB_ODEP)
|
||||
@COND_TOOLKIT_GTK_TOOLKIT_VERSION_3_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/gtk/print.cpp
|
||||
|
||||
|
@ -1162,6 +1162,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
|
||||
src/gtk/msgdlg.cpp
|
||||
src/gtk/nativewin.cpp
|
||||
src/gtk/notebook.cpp
|
||||
src/gtk/notifmsg.cpp
|
||||
src/gtk/print.cpp
|
||||
src/gtk/radiobox.cpp
|
||||
src/gtk/radiobut.cpp
|
||||
@ -1222,6 +1223,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
|
||||
wx/gtk/menuitem.h
|
||||
wx/gtk/msgdlg.h
|
||||
wx/gtk/notebook.h
|
||||
wx/gtk/notifmsg.h
|
||||
wx/gtk/print.h
|
||||
wx/gtk/radiobox.h
|
||||
wx/gtk/radiobut.h
|
||||
|
145
configure
vendored
145
configure
vendored
@ -980,6 +980,8 @@ HILDON2_LIBS
|
||||
HILDON2_CFLAGS
|
||||
HILDON_LIBS
|
||||
HILDON_CFLAGS
|
||||
LIBNOTIFY_LIBS
|
||||
LIBNOTIFY_CFLAGS
|
||||
GNOMEVFS_LIBS
|
||||
GNOMEVFS_CFLAGS
|
||||
LIBGNOMEPRINTUI_LIBS
|
||||
@ -1126,6 +1128,7 @@ with_libmspack
|
||||
with_gtkprint
|
||||
with_gnomeprint
|
||||
with_gnomevfs
|
||||
with_libnotify
|
||||
with_hildon
|
||||
with_opengl
|
||||
with_dmalloc
|
||||
@ -1429,6 +1432,8 @@ LIBGNOMEPRINTUI_CFLAGS
|
||||
LIBGNOMEPRINTUI_LIBS
|
||||
GNOMEVFS_CFLAGS
|
||||
GNOMEVFS_LIBS
|
||||
LIBNOTIFY_CFLAGS
|
||||
LIBNOTIFY_LIBS
|
||||
HILDON_CFLAGS
|
||||
HILDON_LIBS
|
||||
HILDON2_CFLAGS
|
||||
@ -2349,6 +2354,7 @@ Optional Packages:
|
||||
--without-gtkprint don't use GTK printing support
|
||||
--without-gnomeprint don't use GNOME printing libraries
|
||||
--with-gnomevfs use GNOME VFS for associating MIME types
|
||||
--with-libnotify use libnotify for notifications
|
||||
--with-hildon use Hildon framework for Nokia 770/800/810
|
||||
--with-opengl use OpenGL (or Mesa)
|
||||
--with-dmalloc use dmalloc library (http://dmalloc.com/)
|
||||
@ -2425,6 +2431,10 @@ Some influential environment variables:
|
||||
C compiler flags for GNOMEVFS, overriding pkg-config
|
||||
GNOMEVFS_LIBS
|
||||
linker flags for GNOMEVFS, overriding pkg-config
|
||||
LIBNOTIFY_CFLAGS
|
||||
C compiler flags for LIBNOTIFY, overriding pkg-config
|
||||
LIBNOTIFY_LIBS
|
||||
linker flags for LIBNOTIFY, overriding pkg-config
|
||||
HILDON_CFLAGS
|
||||
C compiler flags for HILDON, overriding pkg-config
|
||||
HILDON_LIBS linker flags for HILDON, overriding pkg-config
|
||||
@ -5181,6 +5191,50 @@ fi
|
||||
$as_echo "$result" >&6; }
|
||||
|
||||
|
||||
withstring=
|
||||
defaultval=$wxUSE_ALL_FEATURES
|
||||
if test -z "$defaultval"; then
|
||||
if test x"$withstring" = xwithout; then
|
||||
defaultval=yes
|
||||
else
|
||||
defaultval=no
|
||||
fi
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --${withstring:-with}-libnotify" >&5
|
||||
$as_echo_n "checking for --${withstring:-with}-libnotify... " >&6; }
|
||||
|
||||
# Check whether --with-libnotify was given.
|
||||
if test "${with_libnotify+set}" = set; then :
|
||||
withval=$with_libnotify;
|
||||
if test "$withval" = yes; then
|
||||
wx_cv_use_libnotify='wxUSE_LIBNOTIFY=yes'
|
||||
else
|
||||
wx_cv_use_libnotify='wxUSE_LIBNOTIFY=no'
|
||||
fi
|
||||
|
||||
else
|
||||
|
||||
wx_cv_use_libnotify='wxUSE_LIBNOTIFY=${'DEFAULT_wxUSE_LIBNOTIFY":-$defaultval}"
|
||||
|
||||
fi
|
||||
|
||||
|
||||
eval "$wx_cv_use_libnotify"
|
||||
|
||||
if test x"$withstring" = xwithout; then
|
||||
if test $wxUSE_LIBNOTIFY = yes; then
|
||||
result=no
|
||||
else
|
||||
result=yes
|
||||
fi
|
||||
else
|
||||
result=$wxUSE_LIBNOTIFY
|
||||
fi
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $result" >&5
|
||||
$as_echo "$result" >&6; }
|
||||
|
||||
|
||||
withstring=
|
||||
defaultval=$wxUSE_ALL_FEATURES
|
||||
if test -z "$defaultval"; then
|
||||
@ -33972,6 +34026,94 @@ $as_echo "yes" >&6; }
|
||||
$as_echo "#define wxUSE_LIBGNOMEVFS 1" >>confdefs.h
|
||||
|
||||
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$wxUSE_NOTIFICATION_MESSAGE" = "yes" ; then
|
||||
if test "$wxUSE_LIBNOTIFY" = "yes" ; then
|
||||
|
||||
pkg_failed=no
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBNOTIFY" >&5
|
||||
$as_echo_n "checking for LIBNOTIFY... " >&6; }
|
||||
|
||||
if test -n "$PKG_CONFIG"; then
|
||||
if test -n "$LIBNOTIFY_CFLAGS"; then
|
||||
pkg_cv_LIBNOTIFY_CFLAGS="$LIBNOTIFY_CFLAGS"
|
||||
else
|
||||
if test -n "$PKG_CONFIG" && \
|
||||
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libnotify >= 0.7\""; } >&5
|
||||
($PKG_CONFIG --exists --print-errors "libnotify >= 0.7") 2>&5
|
||||
ac_status=$?
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
||||
test $ac_status = 0; }; then
|
||||
pkg_cv_LIBNOTIFY_CFLAGS=`$PKG_CONFIG --cflags "libnotify >= 0.7" 2>/dev/null`
|
||||
else
|
||||
pkg_failed=yes
|
||||
fi
|
||||
fi
|
||||
else
|
||||
pkg_failed=untried
|
||||
fi
|
||||
if test -n "$PKG_CONFIG"; then
|
||||
if test -n "$LIBNOTIFY_LIBS"; then
|
||||
pkg_cv_LIBNOTIFY_LIBS="$LIBNOTIFY_LIBS"
|
||||
else
|
||||
if test -n "$PKG_CONFIG" && \
|
||||
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libnotify >= 0.7\""; } >&5
|
||||
($PKG_CONFIG --exists --print-errors "libnotify >= 0.7") 2>&5
|
||||
ac_status=$?
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
||||
test $ac_status = 0; }; then
|
||||
pkg_cv_LIBNOTIFY_LIBS=`$PKG_CONFIG --libs "libnotify >= 0.7" 2>/dev/null`
|
||||
else
|
||||
pkg_failed=yes
|
||||
fi
|
||||
fi
|
||||
else
|
||||
pkg_failed=untried
|
||||
fi
|
||||
|
||||
|
||||
|
||||
if test $pkg_failed = yes; then
|
||||
|
||||
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
|
||||
_pkg_short_errors_supported=yes
|
||||
else
|
||||
_pkg_short_errors_supported=no
|
||||
fi
|
||||
if test $_pkg_short_errors_supported = yes; then
|
||||
LIBNOTIFY_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "libnotify >= 0.7"`
|
||||
else
|
||||
LIBNOTIFY_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "libnotify >= 0.7"`
|
||||
fi
|
||||
# Put the nasty error message in config.log where it belongs
|
||||
echo "$LIBNOTIFY_PKG_ERRORS" >&5
|
||||
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: libnotify not found, wxNotificationMessage will use generic implementation." >&5
|
||||
$as_echo "$as_me: WARNING: libnotify not found, wxNotificationMessage will use generic implementation." >&2;}
|
||||
|
||||
|
||||
elif test $pkg_failed = untried; then
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: libnotify not found, wxNotificationMessage will use generic implementation." >&5
|
||||
$as_echo "$as_me: WARNING: libnotify not found, wxNotificationMessage will use generic implementation." >&2;}
|
||||
|
||||
|
||||
else
|
||||
LIBNOTIFY_CFLAGS=$pkg_cv_LIBNOTIFY_CFLAGS
|
||||
LIBNOTIFY_LIBS=$pkg_cv_LIBNOTIFY_LIBS
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||
$as_echo "yes" >&6; }
|
||||
|
||||
GUI_TK_LIBRARY="$GUI_TK_LIBRARY $LIBNOTIFY_LIBS"
|
||||
CFLAGS="$LIBNOTIFY_CFLAGS $CFLAGS"
|
||||
CXXFLAGS="$LIBNOTIFY_CFLAGS $CXXFLAGS"
|
||||
$as_echo "#define wxUSE_LIBNOTIFY 1" >>confdefs.h
|
||||
|
||||
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
@ -37353,6 +37495,9 @@ case "$TOOLKIT" in
|
||||
if test "$wxUSE_LIBGNOMEVFS" = "yes" ; then
|
||||
TOOLKIT_EXTRA="$TOOLKIT_EXTRA gnomevfs"
|
||||
fi
|
||||
if test "$wxUSE_LIBNOTIFY" = "yes" ; then
|
||||
TOOLKIT_EXTRA="$TOOLKIT_EXTRA libnotify"
|
||||
fi
|
||||
if test "$wxUSE_LIBHILDON" = "yes"; then
|
||||
TOOLKIT_EXTRA="$TOOLKIT_EXTRA hildon"
|
||||
fi
|
||||
|
20
configure.in
20
configure.in
@ -591,6 +591,7 @@ WX_ARG_WITH(libmspack, [ --with-libmspack use libmspack (CHM help fi
|
||||
WX_ARG_WITHOUT(gtkprint, [ --without-gtkprint don't use GTK printing support], wxUSE_GTKPRINT)
|
||||
WX_ARG_WITHOUT(gnomeprint, [ --without-gnomeprint don't use GNOME printing libraries], wxUSE_LIBGNOMEPRINT)
|
||||
WX_ARG_WITH(gnomevfs, [ --with-gnomevfs use GNOME VFS for associating MIME types], wxUSE_LIBGNOMEVFS)
|
||||
WX_ARG_WITH(libnotify, [ --with-libnotify use libnotify for notifications], wxUSE_LIBNOTIFY)
|
||||
WX_ARG_WITH(hildon, [ --with-hildon use Hildon framework for Nokia 770/800/810], wxUSE_LIBHILDON)
|
||||
WX_ARG_WITH(opengl, [ --with-opengl use OpenGL (or Mesa)], wxUSE_OPENGL)
|
||||
|
||||
@ -5665,6 +5666,22 @@ if test "$WXGTK2" = 1; then
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$wxUSE_NOTIFICATION_MESSAGE" = "yes" ; then
|
||||
if test "$wxUSE_LIBNOTIFY" = "yes" ; then
|
||||
PKG_CHECK_MODULES(LIBNOTIFY, [libnotify >= 0.7],
|
||||
[
|
||||
GUI_TK_LIBRARY="$GUI_TK_LIBRARY $LIBNOTIFY_LIBS"
|
||||
CFLAGS="$LIBNOTIFY_CFLAGS $CFLAGS"
|
||||
CXXFLAGS="$LIBNOTIFY_CFLAGS $CXXFLAGS"
|
||||
AC_DEFINE(wxUSE_LIBNOTIFY)
|
||||
],
|
||||
[
|
||||
AC_MSG_WARN([libnotify not found, wxNotificationMessage will use generic implementation.])
|
||||
]
|
||||
)
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$wxUSE_LIBHILDON" = "yes" ; then
|
||||
PKG_CHECK_MODULES(HILDON,
|
||||
[hildon-lgpl >= 0.9],
|
||||
@ -7981,6 +7998,9 @@ case "$TOOLKIT" in
|
||||
if test "$wxUSE_LIBGNOMEVFS" = "yes" ; then
|
||||
TOOLKIT_EXTRA="$TOOLKIT_EXTRA gnomevfs"
|
||||
fi
|
||||
if test "$wxUSE_LIBNOTIFY" = "yes" ; then
|
||||
TOOLKIT_EXTRA="$TOOLKIT_EXTRA libnotify"
|
||||
fi
|
||||
if test "$wxUSE_LIBHILDON" = "yes"; then
|
||||
TOOLKIT_EXTRA="$TOOLKIT_EXTRA hildon"
|
||||
fi
|
||||
|
2
debian/control.in
vendored
2
debian/control.in
vendored
@ -1,7 +1,7 @@
|
||||
Source: wxwidgets=V
|
||||
Section: libs
|
||||
Priority: optional
|
||||
Build-Depends: debhelper (>=4.0), bc, flex, bison, gettext, libgtk2.0-dev, =PY, =PY-dev, zlib1g-dev, libjpeg62-dev, libpng12-dev, libtiff4-dev, libsm-dev, libgl1-mesa-dev | libgl-dev, libglu1-mesa-dev | libglu-dev, libesd0-dev, libgnomeprintui2.2-dev, libgconf2-dev, libgstreamer0.10-dev, libgstreamer-plugins-base0.10-dev
|
||||
Build-Depends: debhelper (>=4.0), bc, flex, bison, gettext, libgtk2.0-dev, =PY, =PY-dev, zlib1g-dev, libjpeg62-dev, libpng12-dev, libtiff4-dev, libsm-dev, libgl1-mesa-dev | libgl-dev, libglu1-mesa-dev | libglu-dev, libesd0-dev, libgnomeprintui2.2-dev, libgconf2-dev, libgstreamer0.10-dev, libgstreamer-plugins-base0.10-dev, libnotify-dev
|
||||
Maintainer: wxWidgets dev-team <wx-dev@lists.wxwidgets.org>
|
||||
Standards-Version: 3.6.2.1
|
||||
|
||||
|
@ -539,6 +539,7 @@ All (GUI):
|
||||
wxGTK:
|
||||
|
||||
- Allow building wxGTK3 with Broadway backend (Kolya Kosenko).
|
||||
- Provide native implementation of wxNotificationMessage using libnotify.
|
||||
- Improve drag-and-drop of URLs.
|
||||
|
||||
wxMSW:
|
||||
|
47
include/wx/gtk/notifmsg.h
Normal file
47
include/wx/gtk/notifmsg.h
Normal file
@ -0,0 +1,47 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/gtk/notifmsg.h
|
||||
// Purpose: wxNotificationMessage for wxGTK.
|
||||
// Author: Vadim Zeitlin
|
||||
// Created: 2012-07-25
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2012 Vadim Zeitlin <vadim@wxwidgets.org>
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_GTK_NOTIFMSG_H_
|
||||
#define _WX_GTK_NOTIFMSG_H_
|
||||
|
||||
typedef struct _NotifyNotification NotifyNotification;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxNotificationMessage
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_ADV wxNotificationMessage : public wxNotificationMessageBase
|
||||
{
|
||||
public:
|
||||
wxNotificationMessage() { Init(); }
|
||||
wxNotificationMessage(const wxString& title,
|
||||
const wxString& message = wxString(),
|
||||
wxWindow *parent = NULL,
|
||||
int flags = wxICON_INFORMATION)
|
||||
: wxNotificationMessageBase(title, message, parent, flags)
|
||||
{
|
||||
Init();
|
||||
}
|
||||
|
||||
virtual ~wxNotificationMessage();
|
||||
|
||||
|
||||
virtual bool Show(int timeout = Timeout_Auto);
|
||||
virtual bool Close();
|
||||
|
||||
private:
|
||||
void Init() { m_notification = NULL; }
|
||||
|
||||
NotifyNotification* m_notification;
|
||||
|
||||
wxDECLARE_NO_COPY_CLASS(wxNotificationMessage);
|
||||
};
|
||||
|
||||
#endif // _WX_GTK_NOTIFMSG_H_
|
@ -127,13 +127,14 @@ private:
|
||||
wxDECLARE_NO_COPY_CLASS(wxNotificationMessageBase);
|
||||
};
|
||||
|
||||
#if defined(__WXGTK__) && (wxUSE_LIBHILDON || wxUSE_LIBHILDON2)
|
||||
#include "wx/gtk/hildon/notifmsg.h"
|
||||
/*
|
||||
TODO: provide support for
|
||||
- libnotify (Gnome)
|
||||
- Growl (http://growl.info/, OS X)
|
||||
TODO: Implement under OS X using notification centre (10.8+) or
|
||||
Growl (http://growl.info/) for the previous versions.
|
||||
*/
|
||||
#if defined(__WXGTK__) && wxUSE_LIBNOTIFY
|
||||
#include "wx/gtk/notifmsg.h"
|
||||
#elif defined(__WXGTK__) && (wxUSE_LIBHILDON || wxUSE_LIBHILDON2)
|
||||
#include "wx/gtk/hildon/notifmsg.h"
|
||||
#elif defined(__WXMSW__) && wxUSE_TASKBARICON && wxUSE_TASKBARICON_BALLOONS
|
||||
#include "wx/msw/notifmsg.h"
|
||||
#else
|
||||
|
@ -11,10 +11,9 @@
|
||||
|
||||
This class allows to show the user a message non intrusively.
|
||||
|
||||
Currently it is implemented natively only for the Maemo platform and uses
|
||||
Currently it is implemented natively for Windows and GTK and uses
|
||||
(non-modal) dialogs for the display of the notifications under the other
|
||||
platforms but it will be extended to use the platform-specific notifications
|
||||
in the other ports in the future.
|
||||
platforms.
|
||||
|
||||
Notice that this class is not a window and so doesn't derive from wxWindow.
|
||||
|
||||
@ -46,6 +45,14 @@ public:
|
||||
wxNotificationMessage(const wxString& title, const wxString& message = wxEmptyString,
|
||||
wxWindow* parent = NULL, int flags = wxICON_INFORMATION);
|
||||
|
||||
/**
|
||||
Destructor does not hide the notification.
|
||||
|
||||
The notification can continue to be shown even after the C++ object was
|
||||
destroyed, call Close() explicitly if it needs to be hidden.
|
||||
*/
|
||||
virtual ~wxNotificationMessage();
|
||||
|
||||
/**
|
||||
Hides the notification.
|
||||
|
||||
@ -95,6 +102,11 @@ public:
|
||||
because the current platform may only support default timeout value
|
||||
and also because the user may be able to close the notification.
|
||||
|
||||
@note When using native notifications in wxGTK, the timeout is ignored
|
||||
for the notifications with @c wxICON_WARNING or @c wxICON_ERROR
|
||||
flags, they always remain shown unless they're explicitly hidden by
|
||||
the user, i.e. behave as if Timeout_Auto were given.
|
||||
|
||||
@return @false if an error occurred.
|
||||
*/
|
||||
virtual bool Show(int timeout = Timeout_Auto);
|
||||
|
@ -1747,6 +1747,9 @@ void MyFrame::OnRequestUserAttention(wxCommandEvent& WXUNUSED(event))
|
||||
|
||||
void MyFrame::OnNotifMsgAuto(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
// Notice that the notification remains shown even after the
|
||||
// wxNotificationMessage object itself is destroyed so we can show simple
|
||||
// notifications using temporary objects.
|
||||
if ( !wxNotificationMessage
|
||||
(
|
||||
"Automatic Notification",
|
||||
@ -1756,6 +1759,11 @@ void MyFrame::OnNotifMsgAuto(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxLogStatus("Failed to show notification message");
|
||||
}
|
||||
|
||||
// But it doesn't have to be a temporary, of course.
|
||||
wxNotificationMessage n("Dummy Warning", "Example of a warning notification.");
|
||||
n.SetFlags(wxICON_ERROR);
|
||||
n.Show(5); // Just for testing, use 5 second delay.
|
||||
}
|
||||
|
||||
void MyFrame::OnNotifMsgShow(wxCommandEvent& WXUNUSED(event))
|
||||
|
@ -822,6 +822,10 @@
|
||||
* Use the Hildon 2.0 framework
|
||||
*/
|
||||
#define wxUSE_LIBHILDON2 0
|
||||
/*
|
||||
* Use libnotify library.
|
||||
*/
|
||||
#define wxUSE_LIBNOTIFY 0
|
||||
/*
|
||||
* Use libXpm
|
||||
*/
|
||||
|
@ -869,6 +869,10 @@ typedef pid_t GPid;
|
||||
* Use the Hildon 2.0 framework
|
||||
*/
|
||||
#define wxUSE_LIBHILDON2 0
|
||||
/*
|
||||
* Use libnotify library.
|
||||
*/
|
||||
#define wxUSE_LIBNOTIFY 0
|
||||
|
||||
#define wxUSE_DC_TRANSFORM_MATRIX 1
|
||||
|
||||
|
194
src/gtk/notifmsg.cpp
Normal file
194
src/gtk/notifmsg.cpp
Normal file
@ -0,0 +1,194 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: src/gtk/notifmsg.cpp
|
||||
// Purpose: wxNotificationMessage for wxGTK using libnotify.
|
||||
// Author: Vadim Zeitlin
|
||||
// Created: 2012-07-25
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2012 Vadim Zeitlin <vadim@wxwidgets.org>
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ============================================================================
|
||||
// declarations
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// for compilers that support precompilation, includes "wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#if wxUSE_NOTIFICATION_MESSAGE
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#endif // WX_PRECOMP
|
||||
|
||||
#include "wx/notifmsg.h"
|
||||
|
||||
#include <libnotify/notify.h>
|
||||
|
||||
#include "wx/module.h"
|
||||
|
||||
// General note about error handling: as notifications are meant to be
|
||||
// non-intrusive, we use wxLogDebug() and not wxLogError() if anything goes
|
||||
// wrong here to avoid spamming the user with message boxes. As all methods
|
||||
// return boolean indicating success or failure, the caller could show the
|
||||
// notification in some other way or notify about the error itself if needed.
|
||||
#include "wx/gtk/private/error.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// A module for cleaning up libnotify on exit.
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class wxLibnotifyModule : public wxModule
|
||||
{
|
||||
public:
|
||||
virtual bool OnInit()
|
||||
{
|
||||
// We're initialized on demand.
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual void OnExit()
|
||||
{
|
||||
if ( notify_is_initted() )
|
||||
notify_uninit();
|
||||
}
|
||||
|
||||
// Do initialize the library.
|
||||
static bool Initialize()
|
||||
{
|
||||
if ( !notify_is_initted() )
|
||||
{
|
||||
if ( !notify_init(wxTheApp->GetAppName().utf8_str()) )
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
wxDECLARE_DYNAMIC_CLASS(wxLibnotifyModule);
|
||||
};
|
||||
|
||||
wxIMPLEMENT_DYNAMIC_CLASS(wxLibnotifyModule, wxModule);
|
||||
|
||||
// ============================================================================
|
||||
// wxNotificationMessage implementation
|
||||
// ============================================================================
|
||||
|
||||
bool wxNotificationMessage::Show(int timeout)
|
||||
{
|
||||
if ( !wxLibnotifyModule::Initialize() )
|
||||
return false;
|
||||
|
||||
// Determine the GTK+ icon to use from flags and also set the urgency
|
||||
// appropriately.
|
||||
const char* icon;
|
||||
NotifyUrgency urgency;
|
||||
switch ( GetFlags() )
|
||||
{
|
||||
case wxICON_INFORMATION:
|
||||
icon = "dialog-information";
|
||||
urgency = NOTIFY_URGENCY_LOW;
|
||||
break;
|
||||
|
||||
case wxICON_WARNING:
|
||||
icon = "dialog-warning";
|
||||
urgency = NOTIFY_URGENCY_NORMAL;
|
||||
break;
|
||||
|
||||
case wxICON_ERROR:
|
||||
icon = "dialog-error";
|
||||
urgency = NOTIFY_URGENCY_CRITICAL;
|
||||
break;
|
||||
|
||||
default:
|
||||
wxFAIL_MSG( "Unknown notification message flags." );
|
||||
return false;
|
||||
}
|
||||
|
||||
// Create the notification or update an existing one if we had already been
|
||||
// shown before.
|
||||
if ( !m_notification )
|
||||
{
|
||||
m_notification = notify_notification_new
|
||||
(
|
||||
GetTitle().utf8_str(),
|
||||
GetMessage().utf8_str(),
|
||||
icon
|
||||
);
|
||||
if ( !m_notification )
|
||||
{
|
||||
wxLogDebug("Failed to creation notification.");
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( !notify_notification_update
|
||||
(
|
||||
m_notification,
|
||||
GetTitle().utf8_str(),
|
||||
GetMessage().utf8_str(),
|
||||
icon
|
||||
) )
|
||||
{
|
||||
wxLogDebug(wxS("notify_notification_update() unexpectedly failed."));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Set the notification parameters not specified during creation.
|
||||
notify_notification_set_timeout
|
||||
(
|
||||
m_notification,
|
||||
timeout == Timeout_Auto ? NOTIFY_EXPIRES_DEFAULT
|
||||
: timeout == Timeout_Never ? NOTIFY_EXPIRES_NEVER
|
||||
: 1000*timeout
|
||||
);
|
||||
|
||||
notify_notification_set_urgency(m_notification, urgency);
|
||||
|
||||
|
||||
// Finally do show the notification.
|
||||
wxGtkError error;
|
||||
if ( !notify_notification_show(m_notification, error.Out()) )
|
||||
{
|
||||
wxLogDebug("Failed to shown notification: %s", error.GetMessage());
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool wxNotificationMessage::Close()
|
||||
{
|
||||
wxCHECK_MSG( m_notification, false,
|
||||
wxS("Can't close not shown notification.") );
|
||||
|
||||
wxGtkError error;
|
||||
if ( !notify_notification_close(m_notification, error.Out()) )
|
||||
{
|
||||
wxLogDebug("Failed to hide notification: %s", error.GetMessage());
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
wxNotificationMessage::~wxNotificationMessage()
|
||||
{
|
||||
if ( m_notification )
|
||||
g_object_unref(m_notification);
|
||||
}
|
||||
|
||||
#endif // wxUSE_NOTIFICATION_MESSAGE
|
Loading…
Reference in New Issue
Block a user