[the-board] [ui] Show notification when thing is added remotely
- From: Lucas Rocha <lucasr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [the-board] [ui] Show notification when thing is added remotely
- Date: Sat, 27 Nov 2010 23:24:37 +0000 (UTC)
commit 9118d4c1497afe4fb880af290a36c235bb0028d2
Author: Lucas Rocha <lucasr gnome org>
Date: Sat Nov 27 01:41:50 2010 +0000
[ui] Show notification when thing is added remotely
configure.ac | 26 ++++++++++++++++++++++++--
po/POTFILES.in | 1 +
src/Makefile-js.am | 8 +++++++-
src/Makefile.am | 3 ++-
src/js/ui/application.js | 30 +++++++++++++++++++++++++++---
src/js/util/features.js.in | 1 +
6 files changed, 62 insertions(+), 7 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index e87aa6e..0e9e533 100644
--- a/configure.ac
+++ b/configure.ac
@@ -56,6 +56,26 @@ PKG_CHECK_MODULES(THE_BOARD,
clutter-gtk-1.0
clutter-gst-1.0)
+AC_ARG_ENABLE([libnotify],
+ AC_HELP_STRING([--enable-libnotify],[enable libnotify support]),,
+ [enable_libnotify=yes])
+
+HAVE_LIBNOTIFY=0
+
+if test x$enable_libnotify = xyes ; then
+ PKG_CHECK_MODULES([LIBNOTIFY],
+ [libnotify >= 0.7],
+ [HAVE_LIBNOTIFY=1],[HAVE_LIBNOTIFY=0])
+fi
+
+AC_SUBST(HAVE_LIBNOTIFY)
+
+if test x$HAVE_LIBNOTIFY = x1 ; then
+ HAVE_LIBNOTIFY_RESULT="yes"
+else
+ HAVE_LIBNOTIFY_RESULT="no"
+fi
+
GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0`
AC_SUBST(GLIB_MKENUMS)
@@ -83,8 +103,10 @@ echo "
The Board $VERSION
==================
- prefix: ${prefix}
- compiler: ${CC}
+ prefix: ${prefix}
+ compiler: ${CC}
+
+ libnotify: $HAVE_LIBNOTIFY_RESULT
Now type 'make' to build $PACKAGE
"
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 886bcee..3a2db66 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -6,6 +6,7 @@ src/js/ui/things/label.js
src/js/ui/things/note.js
src/js/ui/things/photo.js
src/js/ui/things/video.js
+src/js/ui/application.js
src/js/ui/mainWindow.js
src/js/ui/pageButton.js
src/js/ui/toolBoxBackgrounds.js
diff --git a/src/Makefile-js.am b/src/Makefile-js.am
index c3126e0..6fc99db 100644
--- a/src/Makefile-js.am
+++ b/src/Makefile-js.am
@@ -43,12 +43,18 @@ jsutildir = $(pkgdatadir)/js/util
js/util/path.js: js/util/path.js.in
$(AM_V_GEN) $(do_subst) $< > $@
+js/util/features.js: js/util/features.js.in
+ $(AM_V_GEN) $(do_subst) $< > $@
+
dist_jsutil_DATA = \
+ js/util/features.js \
js/util/json.js \
js/util/mathUtil.js \
js/util/path.js
-CLEANFILES += js/util/path.js
+CLEANFILES += \
+ js/util/features.js \
+ js/util/path.js
EXTRA_DIST += \
js/util/path.js.in
diff --git a/src/Makefile.am b/src/Makefile.am
index 9a18fd3..ef926f3 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -36,7 +36,8 @@ do_subst = sed -e 's|@abs_top_srcdir[ ]|$(abs_top_srcdir)|g' \
-e 's|@bindir[ ]|$(bindir)|g' \
-e 's|@libexecdir[ ]|$(libexecdir)|g' \
-e 's|@pkglibdir[ ]|$(pkglibdir)|g' \
- -e 's|@pkgdatadir[ ]|$(pkgdatadir)|g'
+ -e 's|@pkgdatadir[ ]|$(pkgdatadir)|g' \
+ -e 's|@have_libnotify[ ]|$(HAVE_LIBNOTIFY)|g'
# gobject-introspection rules
include $(INTROSPECTION_MAKEFILE)
diff --git a/src/js/ui/application.js b/src/js/ui/application.js
index 5126f0a..24c5e14 100644
--- a/src/js/ui/application.js
+++ b/src/js/ui/application.js
@@ -1,17 +1,23 @@
// standard imports
const DBus = imports.dbus;
+const Gettext = imports.gettext.domain("the-board");
const Lang = imports.lang;
+// util imports
+const Features = imports.util.features;
+const Path = imports.util.path;
+
// gi imports
const Gtk = imports.gi.Gtk;
const Mx = imports.gi.Mx;
+if (Features.HAVE_LIBNOTIFY) {
+ const Notify = imports.gi.Notify;
+}
+
// ui imports
const MainWindow = imports.ui.mainWindow;
-// util imports
-const Path = imports.util.path;
-
const _THE_BOARD_DBUS_PATH = "/org/gnome/TheBoard";
const TheBoardIface = {
@@ -70,12 +76,29 @@ Application.prototype = {
style.load_from_file(Path.STYLE_DIR + "style.css");
},
+ _notifyInit : function() {
+ if (Features.HAVE_LIBNOTIFY) {
+ Notify.init("The Board");
+ }
+ },
+
+ _showNotification : function(text) {
+ if (Features.HAVE_LIBNOTIFY) {
+ let notification =
+ Notify.Notification.new(text, null, "the-board");
+
+ notification.set_timeout(3000);
+ notification.show();
+ }
+ },
+
_onNameAcquired : function() {
log('Application: acquired ' + TheBoardIface.name);
DBus.session.exportObject(_THE_BOARD_DBUS_PATH, this);
this._defineStyleAndThemes();
+ this._notifyInit();
this._createMainWindow();
this._mainWindow.showAll();
@@ -110,6 +133,7 @@ Application.prototype = {
if (this._mainWindow.currentPage) {
this._mainWindow.currentPage.addThingFromState(args);
+ this._showNotification(Gettext.gettext("Added to The Board"));
}
},
diff --git a/src/js/util/features.js.in b/src/js/util/features.js.in
new file mode 100644
index 0000000..4cb2efa
--- /dev/null
+++ b/src/js/util/features.js.in
@@ -0,0 +1 @@
+let HAVE_LIBNOTIFY = @have_libnotify@;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]