[libnotifymm] Update for libnotify 0.7.5, first part.
- From: Kjell Ahlstedt <kjellahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libnotifymm] Update for libnotify 0.7.5, first part.
- Date: Thu, 10 Jan 2013 19:00:45 +0000 (UTC)
commit 70a2dac8e9c569ad256cc438a8432e5124b3a005
Author: Kjell Ahlstedt <kjell ahlstedt bredband net>
Date: Thu Jan 10 19:27:31 2013 +0100
Update for libnotify 0.7.5, first part.
A large part of these changes has been done by Phong Cao. Bug #691389.
More commits will follow before the update to 0.7.5 is finished.
* .gitignore: New file.
* Makefile.am: Remove unnecessary space.
* configure.ac: Update version (to 0.7.0 for now) and dependency checks.
* examples/Makefile.am: Don't try to build status-icon and widget.
* examples/action/test-window.[cc|h]: Don't call the deleted method
Notification::attach_to_widget(). Add on_button_clicked(), on_closed(),
m_is_closed.
* examples/update/main.cc: Add sleep() before update(). Don't test
GLIBMM_EXCEPTIONS_ENABLED. Glibmm exceptions are always enabled nowadays.
* libnotify/libnotifymm/Makefile.am: Don't include wrap_init.h in
files_extra_h. It's added by Makefile_build_gensrc.am_fragment.
* libnotify/src/libnotify_methods.defs:
* libnotify/src/libnotify_signals.defs: Updated from libnotify.
* libnotify/src/notification.[ccg|hg]: Members deleted and added to get it
in sync with libnotify 0.7.5.
* tools/extra_defs_gen/generate_defs_libnotify.cc: Avoid compiler warnings.
* tools/m4/convert.m4: Include convert_glibmm.m4 instead of convert_gtkmm.m4.
* tools/m4/convert_libnotifymm.m4: Replace _CONVERSION of GtkStatusIcon by
_CONVERSION of GdkPixbuf.
.gitignore | 49 +++++++++
ChangeLog | 27 +++++
Makefile.am | 2 +-
configure.ac | 18 ++--
examples/Makefile.am | 2 +-
examples/action/test-window.cc | 57 +++++++----
examples/action/test-window.h | 8 +-
examples/update/main.cc | 41 +++-----
libnotify/libnotifymm/Makefile.am | 2 +-
libnotify/src/libnotify_methods.defs | 125 +++++++++++++----------
libnotify/src/libnotify_signals.defs | 26 +++---
libnotify/src/notification.ccg | 21 ++--
libnotify/src/notification.hg | 120 +++++++++-------------
tools/extra_defs_gen/generate_defs_libnotify.cc | 15 ++--
tools/m4/convert.m4 | 9 +-
tools/m4/convert_libnotifymm.m4 | 2 +-
16 files changed, 295 insertions(+), 229 deletions(-)
---
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..dc3f13e
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,49 @@
+# wildcard patterns
+.deps/
+.dirstamp
+.libs/
+Makefile
+Makefile.in
+stamp-h?
+*.[ao]
+*.l[ao]
+*~
+
+# ./
+/INSTALL
+/aclocal.m4
+/autom4te.cache/
+/build/
+/config*.lineno
+/config.log
+/config.status
+/configure
+/libnotifymm-*.tar.*
+/libtool
+
+# docs/
+/docs/doc-install.pl
+/docs/doc-postprocess.pl
+/docs/doxygen.css
+/docs/tagfile-to-devhelp2.xsl
+/docs/reference/Doxyfile
+/docs/reference/doxygen.log
+/docs/reference/libnotifymm-*.devhelp2
+/docs/reference/libnotifymm-*.tag
+/docs/reference/html/
+
+# examples/
+/examples/*/example
+
+# libnotify/
+/libnotify/libnotifymm-*.pc
+/libnotify/libnotifymmconfig.h
+/libnotify/libnotifymm/notification.cc
+/libnotify/libnotifymm/notification.h
+/libnotify/libnotifymm/wrap_init.cc
+/libnotify/libnotifymm/private/*_p.h
+/libnotify/src/.stamps/
+
+# tools/
+/tools/extra_defs_gen/generate_extra_defs
+
diff --git a/ChangeLog b/ChangeLog
index 8e8ca7e..afd9337 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,30 @@
+2013-01-10 Kjell Ahlstedt <kjell ahlstedt bredband net>
+
+ Update for libnotify 0.7.5, first part.
+
+ A large part of these changes has been done by Phong Cao. Bug #691389.
+ More commits will follow before the update to 0.7.5 is finished.
+
+ * .gitignore: New file.
+ * Makefile.am: Remove unnecessary space.
+ * configure.ac: Update version (to 0.7.0 for now) and dependency checks.
+ * examples/Makefile.am: Don't try to build status-icon and widget.
+ * examples/action/test-window.[cc|h]: Don't call the deleted method
+ Notification::attach_to_widget(). Add on_button_clicked(), on_closed(),
+ m_is_closed.
+ * examples/update/main.cc: Add sleep() before update(). Don't test
+ GLIBMM_EXCEPTIONS_ENABLED. Glibmm exceptions are always enabled nowadays.
+ * libnotify/libnotifymm/Makefile.am: Don't include wrap_init.h in
+ files_extra_h. It's added by Makefile_build_gensrc.am_fragment.
+ * libnotify/src/libnotify_methods.defs:
+ * libnotify/src/libnotify_signals.defs: Updated from libnotify.
+ * libnotify/src/notification.[ccg|hg]: Members deleted and added to get it
+ in sync with libnotify 0.7.5.
+ * tools/extra_defs_gen/generate_defs_libnotify.cc: Avoid compiler warnings.
+ * tools/m4/convert.m4: Include convert_glibmm.m4 instead of convert_gtkmm.m4.
+ * tools/m4/convert_libnotifymm.m4: Replace _CONVERSION of GtkStatusIcon by
+ _CONVERSION of GdkPixbuf.
+
2009-05-06 David King <davidk openismus com>
* debian/[changelog|control|rules]: Add -dbg package.
diff --git a/Makefile.am b/Makefile.am
index aa9c708..69c3b0c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,4 +1,4 @@
-SUBDIRS = tools libnotify docs examples
+SUBDIRS = tools libnotify docs examples
DIST_SUBDIRS = $(SUBDIRS) scripts
EXTRA_DIST = \
diff --git a/configure.ac b/configure.ac
index 7c56f2c..28c6e23 100644
--- a/configure.ac
+++ b/configure.ac
@@ -16,8 +16,8 @@ AC_INIT(libnotify/libnotifymmconfig.h.in)
# Version and initialization
#########################################################################
LIBNOTIFYMM_MAJOR_VERSION=0
-LIBNOTIFYMM_MINOR_VERSION=6
-LIBNOTIFYMM_MICRO_VERSION=2
+LIBNOTIFYMM_MINOR_VERSION=7
+LIBNOTIFYMM_MICRO_VERSION=0
#
# +1 : ? : +1 == new interface that does not break old one
@@ -30,10 +30,10 @@ LIBNOTIFYMM_SO_VERSION=8:0:1
LIBNOTIFYMM_VERSION=$LIBNOTIFYMM_MAJOR_VERSION.$LIBNOTIFYMM_MINOR_VERSION.$LIBNOTIFYMM_MICRO_VERSION
LIBNOTIFYMM_RELEASE=$LIBNOTIFYMM_MAJOR_VERSION.$LIBNOTIFYMM_MINOR_VERSION
-AC_DEFINE_UNQUOTED(LIBNOTIFYMM_MAJOR_VERSION, $LIBNOTIFYMM_MAJOR_VERSION)
-AC_DEFINE_UNQUOTED(LIBNOTIFYMM_MINOR_VERSION, $LIBNOTIFYMM_MINOR_VERSION)
-AC_DEFINE_UNQUOTED(LIBNOTIFYMM_MICRO_VERSION, $LIBNOTIFYMM_MICRO_VERSION)
-AC_DEFINE_UNQUOTED(LIBNOTIFYMM_VERSION, "$LIBNOTIFYMM_VERSION")
+AC_DEFINE_UNQUOTED(LIBNOTIFYMM_MAJOR_VERSION, $LIBNOTIFYMM_MAJOR_VERSION, [libnotifymm major version])
+AC_DEFINE_UNQUOTED(LIBNOTIFYMM_MINOR_VERSION, $LIBNOTIFYMM_MINOR_VERSION, [libnotifymm minor version])
+AC_DEFINE_UNQUOTED(LIBNOTIFYMM_MICRO_VERSION, $LIBNOTIFYMM_MICRO_VERSION, [libnotifymm micro version])
+AC_DEFINE_UNQUOTED(LIBNOTIFYMM_VERSION, "$LIBNOTIFYMM_VERSION", [libnotifymm version])
AC_SUBST(LIBNOTIFYMM_VERSION)
AC_SUBST(LIBNOTIFYMM_RELEASE)
AC_SUBST(LIBNOTIFYMM_SO_VERSION)
@@ -64,8 +64,8 @@ AC_PROG_CC
AC_PROG_CPP
AC_PROG_MAKE_SET
AC_CANONICAL_HOST
-AM_DISABLE_STATIC
-AM_PROG_LIBTOOL
+AC_DISABLE_STATIC
+AC_PROG_LIBTOOL
AL_PROG_GNU_M4(AC_MSG_ERROR([dnl
SUN m4 does not work for building gtkmm.
@@ -82,7 +82,7 @@ AC_CHECK_PROGS(PERL, perl5 perl)
#########################################################################
# Dependancy checks
#########################################################################
-PKG_CHECK_MODULES(LIBNOTIFYMM, glibmm-2.4 >= 2.12.8 gtkmm-2.4 >= 2.10 libnotify >= 0.4.3)
+PKG_CHECK_MODULES(LIBNOTIFYMM, glibmm-2.4 >= 2.28.0 gtkmm-3.0 >= 3.4.1 libnotify >= 0.7.5)
AC_SUBST(LIBNOTIFYMM_CFLAGS)
AC_SUBST(LIBNOTIFYMM_LIBS)
diff --git a/examples/Makefile.am b/examples/Makefile.am
index bc22be3..0e777f6 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -1,4 +1,4 @@
-SUBDIRS = basic icon status-icon update server-info widget action
+SUBDIRS = basic icon update server-info action
EXTRA_DIST = Makefile.am_fragment
diff --git a/examples/action/test-window.cc b/examples/action/test-window.cc
index cef78c3..88ecfbe 100644
--- a/examples/action/test-window.cc
+++ b/examples/action/test-window.cc
@@ -26,42 +26,51 @@
#include <iostream>
TestWindow::TestWindow() :
- m_button("Test"),
+ m_is_closed(true),
m_notify("Low disk space", "You can free up some disk space by "
- "emptying the trash can.")
+ "emptying the trash can."),
+ m_button("Test")
{
- m_notify.set_timeout(0);
-
+ set_default_size(150, 80);
+
+ m_notify.set_timeout(10000); // 10 seconds
m_notify.set_urgency(Notify::URGENCY_CRITICAL);
- m_notify.set_timeout(Notify::EXPIRES_DEFAULT);
+
m_notify.add_action("help", "Help", sigc::mem_fun(*this, &TestWindow::on_help));
m_notify.add_action("ignore", "Ignore", sigc::mem_fun(*this, &TestWindow::on_ignore));
m_notify.add_action("empty", "Empty Trash", sigc::mem_fun(*this, &TestWindow::on_empty));
m_notify.set_category("device");
-
-#ifdef GLIBMM_EXCEPTIONS_ENABLED
+
+ m_notify.signal_closed().connect(sigc::mem_fun(*this, &TestWindow::on_closed));
+ m_button.signal_clicked().connect(sigc::mem_fun(*this, &TestWindow::on_button_clicked));
+
+ add(m_button);
+ show_all_children();
+}
+
+void TestWindow::on_button_clicked()
+{
try
- {
- if (!m_notify.show())
-#else
- std::auto_ptr<Glib::Error> error;
- if (!m_notify.show(error))
-#endif
{
- std::cerr << "failed to send notification" << std::endl;
- }
-#ifdef GLIBMM_EXCEPTIONS_ENABLED
+ if (!m_is_closed)
+ {
+ m_notify.close();
+ m_is_closed = true;
+ }
+ if (m_notify.show())
+ {
+ m_is_closed = false;
+ }
+ else
+ {
+ std::cerr << "failed to send notification" << std::endl;
+ }
}
catch (Glib::Error& err)
{
std::cout << err.what() << std::endl;
}
-#endif
-
- add(m_button);
- show_all_children();
- m_notify.attach_to_widget(m_button);
}
void TestWindow::on_help(const Glib::ustring& action)
@@ -79,3 +88,9 @@ void TestWindow::on_empty(const Glib::ustring& action)
std::cout << "You clicked empty: " << action << std::endl;
}
+void TestWindow::on_closed()
+{
+ m_is_closed = true;
+ std::cout << "Notification closed" << std::endl;
+}
+
diff --git a/examples/action/test-window.h b/examples/action/test-window.h
index 9d4821c..027b6cd 100644
--- a/examples/action/test-window.h
+++ b/examples/action/test-window.h
@@ -28,18 +28,20 @@
#include <gtkmm.h>
#include <libnotifymm.h>
-class TestWindow: public Gtk::Window
+class TestWindow: public Gtk::Window
{
public:
TestWindow();
protected:
+ void on_button_clicked();
void on_help(const Glib::ustring& action);
void on_ignore(const Glib::ustring& action);
- void on_empty(const Glib::ustring& action);
+ void on_empty(const Glib::ustring& action);
+ void on_closed();
+ bool m_is_closed;
Notify::Notification m_notify;
-
Gtk::Button m_button;
};
diff --git a/examples/update/main.cc b/examples/update/main.cc
index e3adcd4..d6ec54a 100644
--- a/examples/update/main.cc
+++ b/examples/update/main.cc
@@ -30,51 +30,38 @@ int main (int argc, char** argv)
Notify::Notification n("First Summary",
"First body");
- n.set_timeout(0); //no timeout
+ n.set_timeout(Notify::EXPIRES_NEVER); //no timeout
-#ifdef GLIBMM_EXCEPTIONS_ENABLED
try
{
- if (!n.show())
-#else
- std::auto_ptr<Glib::Error> error;
- if (!n.show(error))
-#endif
- {
- std::cerr << "failed to send notification" << std::endl;
- return 1;
- }
-#ifdef GLIBMM_EXCEPTIONS_ENABLED
+ if (!n.show())
+ {
+ std::cerr << "failed to send notification" << std::endl;
+ return 1;
+ }
}
catch (Glib::Error& err)
{
std::cout << err.what() << std::endl;
}
-#endif
-
+
+ sleep(2); // 2 second
+
n.update("Second Summary", "Second body", "");
n.set_timeout(3000); // 3 seconds;
- #ifdef GLIBMM_EXCEPTIONS_ENABLED
try
{
- if (!n.show())
-#else
- if (!n.show(error))
-#endif
- {
- std::cerr << "failed to send notification" << std::endl;
- return 1;
- }
-#ifdef GLIBMM_EXCEPTIONS_ENABLED
+ if (!n.show())
+ {
+ std::cerr << "failed to send notification" << std::endl;
+ return 1;
+ }
}
catch (Glib::Error& err)
{
std::cout << err.what() << std::endl;
}
-#endif
return 0;
}
-
-
diff --git a/libnotify/libnotifymm/Makefile.am b/libnotify/libnotifymm/Makefile.am
index 89d5c95..2597b4d 100644
--- a/libnotify/libnotifymm/Makefile.am
+++ b/libnotify/libnotifymm/Makefile.am
@@ -11,7 +11,7 @@ sublib_cflags = $(LIBNOTIFYMM_CFLAGS)
sublib_topdir = libnotify
-files_extra_h = init.h wrap_init.h notify.h
+files_extra_h = init.h notify.h
files_extra_cc = init.cc notify.cc
include $(top_srcdir)/build_shared/Makefile_build_gensrc.am_fragment
diff --git a/libnotify/src/libnotify_methods.defs b/libnotify/src/libnotify_methods.defs
index 352de40..8b4c0ac 100644
--- a/libnotify/src/libnotify_methods.defs
+++ b/libnotify/src/libnotify_methods.defs
@@ -26,8 +26,6 @@
(define-function notify_notification_get_type
(c-name "notify_notification_get_type")
(return-type "GType")
- (parameters
- )
)
(define-function notify_notification_new
@@ -35,21 +33,9 @@
(is-constructor-of "NotifyNotification")
(return-type "NotifyNotification*")
(parameters
- '("const-gchar*" "summary")
- '("const-gchar*" "body")
- '("const-gchar*" "icon")
- '("GtkWidget*" "attach")
- )
-)
-
-(define-function notify_notification_new_with_status_icon
- (c-name "notify_notification_new_with_status_icon")
- (return-type "NotifyNotification*")
- (parameters
- '("const-gchar*" "summary")
- '("const-gchar*" "body")
- '("const-gchar*" "icon")
- '("GtkStatusIcon*" "status_icon")
+ '("const-char*" "summary")
+ '("const-char*" "body")
+ '("const-char*" "icon")
)
)
@@ -58,38 +44,9 @@
(c-name "notify_notification_update")
(return-type "gboolean")
(parameters
- '("const-gchar*" "summary")
- '("const-gchar*" "body")
- '("const-gchar*" "icon")
- )
-)
-
-(define-method attach_to_widget
- (of-object "NotifyNotification")
- (c-name "notify_notification_attach_to_widget")
- (return-type "none")
- (parameters
- '("GtkWidget*" "attach")
- )
-)
-
-(define-method attach_to_status_icon
- (of-object "NotifyNotification")
- (c-name "notify_notification_attach_to_status_icon")
- (return-type "none")
- (parameters
- '("GtkStatusIcon*" "status_icon")
- )
-)
-
-(define-method set_geometry_hints
- (of-object "NotifyNotification")
- (c-name "notify_notification_set_geometry_hints")
- (return-type "none")
- (parameters
- '("GdkScreen*" "screen")
- '("gint" "x")
- '("gint" "y")
+ '("const-char*" "summary")
+ '("const-char*" "body")
+ '("const-char*" "icon")
)
)
@@ -129,6 +86,15 @@
)
)
+(define-method set_image_from_pixbuf
+ (of-object "NotifyNotification")
+ (c-name "notify_notification_set_image_from_pixbuf")
+ (return-type "none")
+ (parameters
+ '("GdkPixbuf*" "pixbuf")
+ )
+)
+
(define-method set_icon_from_pixbuf
(of-object "NotifyNotification")
(c-name "notify_notification_set_icon_from_pixbuf")
@@ -143,17 +109,27 @@
(c-name "notify_notification_set_hint_int32")
(return-type "none")
(parameters
- '("const-gchar*" "key")
+ '("const-char*" "key")
'("gint" "value")
)
)
+(define-method set_hint_uint32
+ (of-object "NotifyNotification")
+ (c-name "notify_notification_set_hint_uint32")
+ (return-type "none")
+ (parameters
+ '("const-char*" "key")
+ '("guint" "value")
+ )
+)
+
(define-method set_hint_double
(of-object "NotifyNotification")
(c-name "notify_notification_set_hint_double")
(return-type "none")
(parameters
- '("const-gchar*" "key")
+ '("const-char*" "key")
'("gdouble" "value")
)
)
@@ -163,8 +139,8 @@
(c-name "notify_notification_set_hint_string")
(return-type "none")
(parameters
- '("const-gchar*" "key")
- '("const-gchar*" "value")
+ '("const-char*" "key")
+ '("const-char*" "value")
)
)
@@ -173,7 +149,7 @@
(c-name "notify_notification_set_hint_byte")
(return-type "none")
(parameters
- '("const-gchar*" "key")
+ '("const-char*" "key")
'("guchar" "value")
)
)
@@ -183,12 +159,31 @@
(c-name "notify_notification_set_hint_byte_array")
(return-type "none")
(parameters
- '("const-gchar*" "key")
+ '("const-char*" "key")
'("const-guchar*" "value")
'("gsize" "len")
)
)
+(define-method set_hint
+ (of-object "NotifyNotification")
+ (c-name "notify_notification_set_hint")
+ (return-type "none")
+ (parameters
+ '("const-char*" "key")
+ '("GVariant*" "value")
+ )
+)
+
+(define-method set_app_name
+ (of-object "NotifyNotification")
+ (c-name "notify_notification_set_app_name")
+ (return-type "none")
+ (parameters
+ '("const-char*" "app_name")
+ )
+)
+
(define-method clear_hints
(of-object "NotifyNotification")
(c-name "notify_notification_clear_hints")
@@ -223,6 +218,12 @@
)
)
+(define-method get_closed_reason
+ (of-object "NotifyNotification")
+ (c-name "notify_notification_get_closed_reason")
+ (return-type "gint")
+)
+
;; From notify-enum-types.h
@@ -234,6 +235,10 @@
+;; From notify-features.h
+
+
+
;; From notify.h
(define-function notify_init
@@ -256,7 +261,15 @@
(define-function notify_get_app_name
(c-name "notify_get_app_name")
- (return-type "const-gchar*")
+ (return-type "const-char*")
+)
+
+(define-function notify_set_app_name
+ (c-name "notify_set_app_name")
+ (return-type "none")
+ (parameters
+ '("const-char*" "app_name")
+ )
)
(define-function notify_get_server_caps
diff --git a/libnotify/src/libnotify_signals.defs b/libnotify/src/libnotify_signals.defs
index e168396..e69b446 100644
--- a/libnotify/src/libnotify_signals.defs
+++ b/libnotify/src/libnotify_signals.defs
@@ -15,48 +15,48 @@
(construct-only #f)
)
-(define-property summary
+(define-property app-name
(of-object "NotifyNotification")
(prop-type "GParamString")
- (docs "The summary text")
+ (docs "The application name to use for this notification")
(readable #t)
(writable #t)
(construct-only #f)
)
-(define-property body
+(define-property summary
(of-object "NotifyNotification")
(prop-type "GParamString")
- (docs "The message body text")
+ (docs "The summary text")
(readable #t)
(writable #t)
(construct-only #f)
)
-(define-property icon-name
+(define-property body
(of-object "NotifyNotification")
(prop-type "GParamString")
- (docs "The icon filename or icon theme-compliant name")
+ (docs "The message body text")
(readable #t)
(writable #t)
(construct-only #f)
)
-(define-property attach-widget
+(define-property icon-name
(of-object "NotifyNotification")
- (prop-type "GParamObject")
- (docs "The widget to attach the notification to")
+ (prop-type "GParamString")
+ (docs "The icon filename or icon theme-compliant name")
(readable #t)
(writable #t)
(construct-only #f)
)
-(define-property status-icon
+(define-property closed-reason
(of-object "NotifyNotification")
- (prop-type "GParamObject")
- (docs "The status icon to attach the notification to")
+ (prop-type "GParamInt")
+ (docs "The reason code for why the notification was closed")
(readable #t)
- (writable #t)
+ (writable #f)
(construct-only #f)
)
diff --git a/libnotify/src/notification.ccg b/libnotify/src/notification.ccg
index 940334d..c06c5b7 100644
--- a/libnotify/src/notification.ccg
+++ b/libnotify/src/notification.ccg
@@ -50,20 +50,23 @@ static void SignalProxy_ActivateLink_gtk_callback_destroy(void* data)
namespace Notify
{
-
const int EXPIRES_DEFAULT = NOTIFY_EXPIRES_DEFAULT;
const int EXPIRES_NEVER = NOTIFY_EXPIRES_NEVER;
-Notification::Notification(const Glib::ustring& summary, const Glib::ustring& body)
+Notification::Notification(const Glib::ustring& summary, const Glib::ustring& body, const Glib::ustring& icon)
:
- _CONSTRUCT("summary", summary.c_str(), "body", body.c_str())
-{}
+ // Mark this class as non-derived to allow C++ vfuncs to be skipped.
+ Glib::ObjectBase(0),
+ Glib::Object(Glib::ConstructParams(notification_class_.init(), "summary", summary.c_str(),
+ "body", body.empty() ? 0 : body.c_str(), "icon-name", icon.empty() ? 0 : icon.c_str(), static_cast<char*>(0)))
+{
+}
-Notification::Notification(const Glib::ustring& summary, const Glib::ustring& body,
- const Glib::ustring& icon_name)
-:
- _CONSTRUCT("summary", summary.c_str(), "body", body.c_str(), "icon-name", icon_name.c_str())
-{}
+bool Notification::update(const Glib::ustring& summary, const Glib::ustring& body, const Glib::ustring& icon)
+{
+ return notify_notification_update(gobj(), summary.c_str(),
+ body.empty() ? 0 : body.c_str(), icon.empty() ? 0 : icon.c_str());
+}
void Notification::set_hint(const Glib::ustring& key, const Glib::ArrayHandle<guchar>& values)
{
diff --git a/libnotify/src/notification.hg b/libnotify/src/notification.hg
index d8e4d9e..1577fae 100644
--- a/libnotify/src/notification.hg
+++ b/libnotify/src/notification.hg
@@ -1,8 +1,4 @@
-/* $Id: client.hg,v 1.17 2006/12/23 09:29:35 murrayc Exp $ */
-// -*- C++ -*- //
-
-/* client.h
- *
+/*
* Copyright 2003 libnotifymm Development Team
*
* This library is free software; you can redistribute it and/or
@@ -20,120 +16,98 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include <libnotifymm/notification.h>
-
_DEFS(libnotifymm,libnotify)
_PINCLUDE(glibmm/private/object_p.h)
#include <gtkmm/widget.h>
-#include <gtkmm/statusicon.h>
namespace Notify
{
-//TODO: Use an enum?
+/** The default expiration time on a notification.
+ */
extern const int EXPIRES_DEFAULT;
+
+/** The notification never expires. It stays open until closed by the calling API
+ * or the user.
+ */
extern const int EXPIRES_NEVER;
_WRAP_ENUM(Urgency, NotifyUrgency)
-/** Notification offers a way to show notification for a widget or
+/** Notification offers a way to show notification for a widget or
* in the system tray.
*/
class Notification : public Glib::Object
{
_CLASS_GOBJECT(Notification, NotifyNotification, NOTIFY_NOTIFICATION, Glib::Object, GObject)
public:
-
- /** A constructor for Notification
- *
- * @param summary summary of the notification
- * @param body body text of the notification
- *
- * Creates a new Notification with summary and body. You can set attach_widget and icon later
- */
- Notification(const Glib::ustring& summary, const Glib::ustring& body);
-
- /** A constructor for Notification
- *
- * @param summary summary of the notification
- * @param body body text of the notification
- * @param icon_name name of the icon for the notification, can be a stock id
- *
- * Creates a new Notification with summary, body and icon. You can set an attach_widget later
- */
- Notification(const Glib::ustring& summary, const Glib::ustring& body, const Glib::ustring& icon_name);
- /** A constructor for Notification
- *
- * @param summary summary of the notification
- * @param body body text of the notification
- * @param icon_name name of the icon for the notification, can be a stock id
- * @param attach_widget widget the notification is attach to
- *
- * Creates a new Notification
- */
- _WRAP_CTOR(Notification(const Glib::ustring& summary, const Glib::ustring& body, const Glib::ustring& icon_name, Gtk::Widget& attach_widget), notify_notification_new)
-
- /** A constructor for Notification
- *
- * @param summary summary of the notification
- * @param body body text of the notification
- * @param icon_name name of the icon for the notification, can be a stock id
- * @param status_icon Gtk::StatusIcon the notification is attached to
- *
- * Creates a new Notification
- */
- _WRAP_CTOR(Notification(const Glib::ustring& summary, const Glib::ustring& body, const Glib::ustring& icon_name, const Glib::RefPtr<Gtk::StatusIcon>& status_icon), notify_notification_new_with_status_icon)
-
- _WRAP_METHOD(bool update(const Glib::ustring& summary, const Glib::ustring& body, const Glib::ustring& icon), notify_notification_update)
-
- _WRAP_METHOD(void attach_to_widget(Gtk::Widget& attach), notify_notification_attach_to_widget)
- _WRAP_METHOD(void attach_to_status_icon(const Glib::RefPtr<Gtk::StatusIcon>& status_icon), notify_notification_attach_to_status_icon)
-
- _WRAP_METHOD(void set_geometry_hints(const Glib::RefPtr<Gdk::Screen>& screen, int x, int y), notify_notification_set_geometry_hints)
+ _WRAP_METHOD_DOCS_ONLY(notify_notification_new)
+ explicit Notification(const Glib::ustring& summary, const Glib::ustring& body = Glib::ustring(),
+ const Glib::ustring& icon = Glib::ustring());
+
+ _WRAP_METHOD_DOCS_ONLY(notify_notification_update)
+ bool update(const Glib::ustring& summary, const Glib::ustring& body = Glib::ustring(),
+ const Glib::ustring& icon = Glib::ustring());
+
_WRAP_METHOD(bool show(), notify_notification_show, errthrow)
+
+ _WRAP_METHOD(void set_app_name(const Glib::ustring& app_name), notify_notification_set_app_name)
+
_WRAP_METHOD(void set_timeout(int timeout), notify_notification_set_timeout)
+
_WRAP_METHOD(void set_category(const Glib::ustring& category), notify_notification_set_category)
+
_WRAP_METHOD(void set_urgency(Urgency urgency), notify_notification_set_urgency)
+
_WRAP_METHOD(void set_icon_from_pixbuf(const Glib::RefPtr<Gdk::Pixbuf>& icon), notify_notification_set_icon_from_pixbuf)
+ _WRAP_METHOD(void set_image_from_pixbuf(const Glib::RefPtr<Gdk::Pixbuf>& pixbuf), notify_notification_set_image_from_pixbuf)
+
+ _WRAP_METHOD(void set_hint(const Glib::ustring& key, const Glib::VariantBase& value), notify_notification_set_hint)
+
_WRAP_METHOD(void set_hint(const Glib::ustring& key, int value), notify_notification_set_hint_int32)
+
+ _WRAP_METHOD(void set_hint(const Glib::ustring& key, guint value), notify_notification_set_hint_uint32)
+
_WRAP_METHOD(void set_hint(const Glib::ustring& key, double value), notify_notification_set_hint_double)
+
_WRAP_METHOD(void set_hint(const Glib::ustring& key, const Glib::ustring& value), notify_notification_set_hint_string)
+
_WRAP_METHOD(void set_hint(const Glib::ustring& key, guchar value), notify_notification_set_hint_byte)
/** Set byte array hint
- *
- * @param key The hint.
- * @param values The hint's value.
*
- * Sets a hint with a byte array value.
+ * @param key the hint
+ * @param values the hint's value
+ *
+ * Sets a hint with a byte array value
*/
void set_hint(const Glib::ustring& key, const Glib::ArrayHandle<guchar>& values);
_IGNORE(notify_notification_set_hint_byte_array)
- /** For instance,
- * void on_invoke(const Glib::ustring& action);
- */
+ _WRAP_METHOD(void clear_hints(), notify_notification_clear_hints)
+
typedef sigc::slot<void, const Glib::ustring& /* action */> SlotInvokeAction;
/** Add an action to the notification
*
- * @param action The action id
- * @param label The action label
+ * @param action the action id
+ * @param label the action label
* @param slot A function or method to call when the action is invoked
*
- * Adds an action to a notification. When the action is invoked, the
- * specified callback function will be called.
+ * Adds an action to a notification. When the action is invoked,
+ * the specified callback function will be called.
*/
void add_action(const Glib::ustring& action, const Glib::ustring& label, const SlotInvokeAction& slot);
_IGNORE(notify_notification_add_action)
- _WRAP_METHOD(void clear_hints(), notify_notification_clear_hints)
-
_WRAP_METHOD(void clear_actions(), notify_notification_clear_actions)
- _WRAP_METHOD(void close(), notify_notification_close, errthrow)
+
+ _WRAP_METHOD(bool close(), notify_notification_close, errthrow)
+
+ _WRAP_METHOD(int get_closed_reason(), notify_notification_get_closed_reason)
_WRAP_SIGNAL(void closed(), "closed")
@@ -141,8 +115,8 @@ public:
_WRAP_PROPERTY("summary", Glib::ustring)
_WRAP_PROPERTY("body", Glib::ustring)
_WRAP_PROPERTY("icon-name", Glib::ustring)
- _WRAP_PROPERTY("attach-widget", Gtk::Widget)
- _WRAP_PROPERTY("status-icon", Glib::RefPtr<Gtk::StatusIcon>)
+ _WRAP_PROPERTY("app-name", Glib::ustring)
+ _WRAP_PROPERTY("closed-reason", int)
};
} // namespace Notify
diff --git a/tools/extra_defs_gen/generate_defs_libnotify.cc b/tools/extra_defs_gen/generate_defs_libnotify.cc
index 6a23ed8..023196d 100644
--- a/tools/extra_defs_gen/generate_defs_libnotify.cc
+++ b/tools/extra_defs_gen/generate_defs_libnotify.cc
@@ -1,7 +1,4 @@
-/* $Id: generate_defs_gda.cc 1017 2007-02-14 23:03:00Z arminb $ */
-
-/* generate_defs_gda.h
- *
+/*
* Copyright (C) 2001 The Free Software Foundation
*
* This library is free software; you can redistribute it and/or
@@ -19,13 +16,15 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include "glibmm_generate_extra_defs/generate_extra_defs.h"
+#include <glibmm_generate_extra_defs/generate_extra_defs.h>
#include <libnotify/notification.h>
#include <libnotify/notify.h>
-int main (int argc, char *argv[])
+int main(int, char**)
{
- notify_init("generate_extra_defs");
+ notify_init("generate_extra_defs");
+
+ std::cout << get_defs(NOTIFY_TYPE_NOTIFICATION);
- std::cout << get_defs(NOTIFY_TYPE_NOTIFICATION);
+ return 0;
}
diff --git a/tools/m4/convert.m4 b/tools/m4/convert.m4
index ceb0f8f..d3885f2 100644
--- a/tools/m4/convert.m4
+++ b/tools/m4/convert.m4
@@ -1,6 +1,3 @@
-dnl $Id: convert.m4 192 2002-04-14 14:53:01Z murrayc $
-
-# Override of the file of the same name in gtkmm.
-
-include(convert_gtkmm.m4)
-include(convert_libnotifymm.m4)
+dnl Include gmmproc type conversion definitions:
+m4_include(`convert_glibmm.m4')
+m4_include(`convert_libnotifymm.m4')
diff --git a/tools/m4/convert_libnotifymm.m4 b/tools/m4/convert_libnotifymm.m4
index da21375..aeb3982 100644
--- a/tools/m4/convert_libnotifymm.m4
+++ b/tools/m4/convert_libnotifymm.m4
@@ -1,4 +1,4 @@
-_CONVERSION(`const Glib::RefPtr<Gtk::StatusIcon>&',`GtkStatusIcon*',__CONVERT_REFPTR_TO_P)
+_CONVERSION(`const Glib::RefPtr<Gdk::Pixbuf>&',`GdkPixbuf*',__CONVERT_REFPTR_TO_P)
# enums
_CONV_ENUM(Notify,Urgency)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]