aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/com.canonical.indicator.messages.service.xml4
-rw-r--r--configure.ac21
-rw-r--r--debian/changelog123
-rw-r--r--debian/control4
-rw-r--r--libmessaging-menu/messaging-menu-app.c4
-rw-r--r--m4/ax_python_module.m449
-rw-r--r--src/app-section.c23
-rw-r--r--test/Makefile.am11
-rw-r--r--test/applications/test.desktop2
-rwxr-xr-xtest/test-client.py75
10 files changed, 305 insertions, 11 deletions
diff --git a/common/com.canonical.indicator.messages.service.xml b/common/com.canonical.indicator.messages.service.xml
index 00ae154..3c3c779 100644
--- a/common/com.canonical.indicator.messages.service.xml
+++ b/common/com.canonical.indicator.messages.service.xml
@@ -11,6 +11,10 @@
<arg type="s" name="desktop_id" direction="in" />
</method>
+ <method name="ApplicationStoppedRunning">
+ <arg type="s" name="desktop_id" direction="in" />
+ </method>
+
<method name="SetStatus">
<arg type="s" name="desktop_id" direction="in" />
<arg type="s" name="status" direction="in" />
diff --git a/configure.ac b/configure.ac
index 1b1a1af..e67b66a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -41,7 +41,7 @@ AC_PROG_CXX
GTK_REQUIRED_VERSION=3.5.18
GIO_UNIX_REQUIRED_VERSION=2.33.10
INDICATOR_REQUIRED_VERSION=0.3.19
-GLIB_REQUIRED_VERSION=2.33.10
+GLIB_REQUIRED_VERSION=2.35.4
INTROSPECTION_REQUIRED_VERSION=1.32.0
PKG_CHECK_MODULES(APPLET, gtk+-3.0 >= $GTK_REQUIRED_VERSION
@@ -81,7 +81,7 @@ AC_SUBST(COVERAGE_CXXFLAGS)
AC_SUBST(COVERAGE_LDFLAGS)
###########################
-# Google Test framework
+# Tests
###########################
AC_ARG_ENABLE([tests],
@@ -91,10 +91,16 @@ AC_ARG_ENABLE([tests],
if test "x$enable_tests" != "xno"; then
m4_include([m4/gtest.m4])
CHECK_GTEST
- if test "x$enable_tests" = "xauto"; then
- enable_tests=${have_gtest}
- elif test "x$enable_tests" = "xyes" && test "x$have_gtest" != "xyes"; then
- AC_MSG_ERROR([tests were requested but gtest is not installed.])
+ AM_PATH_PYTHON(3.0,, [:])
+ AC_PYTHON_MODULE(dbusmock)
+ if test "x$have_gtest" = "xyes" -a "x$HAVE_PYMOD_DBUSMOCK" = "xyes"; then
+ enable_tests="yes"
+ else
+ if test "x$enable_tests" = "xyes"; then
+ AC_MSG_ERROR([tests were requested but gtest or dbusmock are not installed.])
+ else
+ enable_tests="no"
+ fi
fi
fi
AM_CONDITIONAL([BUILD_TESTS],[test "x$enable_tests" = "xyes"])
@@ -186,7 +192,8 @@ AC_MSG_NOTICE([
Messaging Indicator Configuration:
Prefix: $prefix
- gtest: $enable_tests
+ Indicator Dir: $INDICATORDIR
+ tests: $enable_tests
gcov: $use_gcov
introspecion: $enable_introspection
Vala bindings: $enable_vala
diff --git a/debian/changelog b/debian/changelog
index 6919c93..a28b7d7 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -4,12 +4,135 @@ indicator-messages (13.10.0phablet1) raring; urgency=low
-- Sergio Schvezov <sergio.schvezov@canonical.com> Fri, 26 Apr 2013 13:53:53 -0300
+indicator-messages (12.10.6+13.10.20130702-0ubuntu1) saucy; urgency=low
+
+ [ Mathias Dietrich ]
+ * Change abbreviation for minutes from m to min. (LP: #652845)
+
+ [ Ubuntu daily release ]
+ * Automatic snapshot from revision 350
+
+ -- Ubuntu daily release <ps-jenkins@lists.canonical.com> Tue, 02 Jul 2013 02:02:36 +0000
+
indicator-messages (12.10.6phablet1) quantal; urgency=low
* Adding guards for g_type_init
-- Sergio Schvezov <sergio.schvezov@canonical.com> Fri, 22 Mar 2013 17:23:45 -0300
+indicator-messages (12.10.6daily13.06.19-0ubuntu1) saucy; urgency=low
+
+ [ Sebastien Bacher ]
+ * use gtk_style_context_get instead of deprecated
+ gtk_style_context_get_font.
+
+ [ Jeremy Bicha ]
+ * Have libmessaging-menu-dev depend on gir1.2-messagingmenu-1.0.
+
+ [ Lars Uebernickel ]
+ * use gtk_style_context_get instead of deprecated
+ gtk_style_context_get_font.
+ * Notify the service when an app unrefs its MessagingMenuApp. (LP:
+ #1154099)
+
+ [ Ubuntu daily release ]
+ * Automatic snapshot from revision 348
+
+ -- Ubuntu daily release <ps-jenkins@lists.canonical.com> Wed, 19 Jun 2013 02:01:48 +0000
+
+indicator-messages (12.10.6daily13.05.15-0ubuntu1) saucy; urgency=low
+
+ [ Lars Uebernickel ]
+ * libmessaging-menu: don't use detailed action names Detailed action
+ names are of the form action::target or action(target), so they
+ can't have colons or parens in them. This restriction does not apply
+ to messaging menu ids. (LP: #1180302)
+
+ [ Ubuntu daily release ]
+ * Automatic snapshot from revision 344
+
+ -- Ubuntu daily release <ps-jenkins@lists.canonical.com> Wed, 15 May 2013 16:59:49 +0000
+
+indicator-messages (12.10.6daily13.05.02-0ubuntu1) saucy; urgency=low
+
+ [ Marco Trevisan (Treviño) ]
+ * Opening new-window from quicklist static action does not focus the
+ newly opened window (LP: #1164483)
+
+ [ Ubuntu daily release ]
+ * Automatic snapshot from revision 342
+
+ -- Ubuntu daily release <ps-jenkins@lists.canonical.com> Thu, 02 May 2013 22:59:03 +0000
+
+indicator-messages (12.10.6daily13.04.09-0ubuntu1) raring; urgency=low
+
+ * Automatic snapshot from revision 340
+
+ -- Ubuntu daily release <ps-jenkins@lists.canonical.com> Tue, 09 Apr 2013 02:02:02 +0000
+
+indicator-messages (12.10.6daily13.04.08-0ubuntu1) raring; urgency=low
+
+ [ Marco Trevisan (Treviño) ]
+ * Window management - Apps raised from indicators sometimes dont have
+ the focus (LP: #627195)
+
+ [ Ubuntu daily release ]
+ * Automatic snapshot from revision 339
+
+ -- Ubuntu daily release <ps-jenkins@lists.canonical.com> Mon, 08 Apr 2013 02:02:06 +0000
+
+indicator-messages (12.10.6daily13.02.13-0ubuntu1) raring; urgency=low
+
+ [ Jason Conti ]
+ * Stuck notifications (blue envolope remains after I've already read
+ msg) (LP: #1113721)
+
+ [ Automatic PS uploader ]
+ * Automatic snapshot from revision 337
+
+ -- Automatic PS uploader <ps-jenkins@lists.canonical.com> Wed, 13 Feb 2013 02:02:11 +0000
+
+indicator-messages (12.10.6daily13.01.25-0ubuntu1) raring; urgency=low
+
+ [ Charles Kerr ]
+ * indicators call deprecated glib function g_type_init() (LP:
+ #1103087)
+
+ [ Automatic PS uploader ]
+ * Automatic snapshot from revision 335
+
+ -- Automatic PS uploader <ps-jenkins@lists.canonical.com> Fri, 25 Jan 2013 02:01:11 +0000
+
+indicator-messages (12.10.6daily12.11.22-0ubuntu1) raring; urgency=low
+
+ [ Lars Uebernickel ]
+ * Crash in g_variant_valist_get_leaf when highlighted (LP: #1081754)
+
+ [ Automatic PS uploader ]
+ * Automatic snapshot from revision 333
+
+ -- Automatic PS uploader <ps-jenkins@lists.canonical.com> Thu, 22 Nov 2012 10:02:35 +0000
+
+indicator-messages (12.10.6daily12.11.21.1-0ubuntu1) raring; urgency=low
+
+ [ Mathieu Trudel-Lapierre ]
+ * debian/rules:
+ - Use autogen.sh for dh_autoreconf.
+ - Drop the override for dh_makeshlibs.
+ - Add DPKG_GENSYMBOLS_CHECK_LEVEL=4.
+ * debian/control:
+ - Fix styling: add trailing commas at the end of lists.
+ - Update Vcs-Bzr, Vcs-Browser fields and add a notice for developers.
+ - Add libgtest-dev to Build-Depends.
+ * Automatic snapshot from revision 329 (bootstrap):
+ - Clear the detail (count or time) of a source when another type of detail
+ is set. (LP: #1071640)
+
+ [ Automatic PS uploader ]
+ * Automatic snapshot from revision 331
+
+ -- Automatic PS uploader <ps-jenkins@lists.canonical.com> Wed, 21 Nov 2012 10:41:37 +0000
+
indicator-messages (12.10.6-0ubuntu1phablet9) quantal; urgency=low
* add "remove-all" signal to imapplicationlist (temporarily)
diff --git a/debian/control b/debian/control
index f16f831..47d4c0e 100644
--- a/debian/control
+++ b/debian/control
@@ -18,6 +18,7 @@ Build-Depends: debhelper (>= 9),
libgtk-3-dev (>= 3.5.18),
libindicator3-dev,
libtelepathy-glib-dev (>= 0.9.0),
+ python3-dbusmock,
valac,
Standards-Version: 3.9.3
Homepage: https://launchpad.net/indicator-messages
@@ -68,6 +69,7 @@ Architecture: any
Section: libdevel
Depends: ${shlibs:Depends},
${misc:Depends},
+ gir1.2-messagingmenu-1.0 (=${binary:Version}),
libmessaging-menu0 (=${binary:Version}),
libglib2.0-dev,
Description: Messaging Menu - library development files
@@ -75,7 +77,7 @@ Description: Messaging Menu - library development files
the messaging menu.
Package: gir1.2-messagingmenu-1.0
-Section: libs
+Section: introspection
Architecture: any
Depends: ${misc:Depends},
${gir:Depends},
diff --git a/libmessaging-menu/messaging-menu-app.c b/libmessaging-menu/messaging-menu-app.c
index c841db2..421a09f 100644
--- a/libmessaging-menu/messaging-menu-app.c
+++ b/libmessaging-menu/messaging-menu-app.c
@@ -302,6 +302,10 @@ messaging_menu_app_dispose (GObject *object)
if (app->messages_service)
{
+ indicator_messages_service_call_application_stopped_running (app->messages_service,
+ g_app_info_get_id (G_APP_INFO (app->appinfo)),
+ NULL, NULL, NULL);
+
g_signal_handlers_disconnect_by_func (app->messages_service,
global_status_changed,
app);
diff --git a/m4/ax_python_module.m4 b/m4/ax_python_module.m4
new file mode 100644
index 0000000..bd70a06
--- /dev/null
+++ b/m4/ax_python_module.m4
@@ -0,0 +1,49 @@
+# ===========================================================================
+# http://www.gnu.org/software/autoconf-archive/ax_python_module.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+# AX_PYTHON_MODULE(modname[, fatal])
+#
+# DESCRIPTION
+#
+# Checks for Python module.
+#
+# If fatal is non-empty then absence of a module will trigger an error.
+#
+# LICENSE
+#
+# Copyright (c) 2008 Andrew Collier <colliera@ukzn.ac.za>
+#
+# Copying and distribution of this file, with or without modification, are
+# permitted in any medium without royalty provided the copyright notice
+# and this notice are preserved. This file is offered as-is, without any
+# warranty.
+
+#serial 5
+
+AU_ALIAS([AC_PYTHON_MODULE], [AX_PYTHON_MODULE])
+AC_DEFUN([AX_PYTHON_MODULE],[
+ if test -z $PYTHON;
+ then
+ PYTHON="python"
+ fi
+ PYTHON_NAME=`basename $PYTHON`
+ AC_MSG_CHECKING($PYTHON_NAME module: $1)
+ $PYTHON -c "import $1" 2>/dev/null
+ if test $? -eq 0;
+ then
+ AC_MSG_RESULT(yes)
+ eval AS_TR_CPP(HAVE_PYMOD_$1)=yes
+ else
+ AC_MSG_RESULT(no)
+ eval AS_TR_CPP(HAVE_PYMOD_$1)=no
+ #
+ if test -n "$2"
+ then
+ AC_MSG_ERROR(failed to find required module $1)
+ exit 1
+ fi
+ fi
+])
diff --git a/src/app-section.c b/src/app-section.c
index 3a55147..4f91835 100644
--- a/src/app-section.c
+++ b/src/app-section.c
@@ -25,6 +25,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include "config.h"
#endif
+#include <gdk/gdk.h>
#include <glib/gi18n.h>
#include <gio/gdesktopappinfo.h>
#include <gio/gio.h>
@@ -289,6 +290,17 @@ app_section_finalize (GObject *object)
G_OBJECT_CLASS (app_section_parent_class)->dispose (object);
}
+static GAppLaunchContext *
+get_launch_context (guint32 timestamp)
+{
+ GdkDisplay *display = gdk_display_get_default();
+ GdkAppLaunchContext *launch_context = gdk_display_get_app_launch_context (display);
+
+ gdk_app_launch_context_set_timestamp (launch_context, timestamp);
+
+ return G_APP_LAUNCH_CONTEXT (launch_context);
+}
+
/* Respond to one of the shortcuts getting clicked on. */
static void
nick_activate_cb (GSimpleAction *action,
@@ -305,6 +317,8 @@ nick_activate_cb (GSimpleAction *action,
g_warning("Unable to execute nick '%s' for desktop file '%s'",
nick, g_desktop_app_info_get_filename (priv->appinfo));
}
+
+ g_object_unref (context);
}
static void
@@ -389,7 +403,7 @@ app_section_update_menu (AppSection *self)
g_simple_action_group_clear (priv->static_shortcuts);
is_running = priv->name_watch_id > 0;
- launch = g_simple_action_new_stateful ("launch", NULL, g_variant_new_boolean (is_running));
+ launch = g_simple_action_new_stateful ("launch", G_VARIANT_TYPE_UINT32, g_variant_new_boolean (is_running));
g_signal_connect (launch, "activate", G_CALLBACK (activate_cb), self);
g_signal_connect (launch, "change-state", G_CALLBACK (launch_action_change_state), self);
g_simple_action_group_insert (priv->static_shortcuts, G_ACTION (launch));
@@ -414,7 +428,7 @@ app_section_update_menu (AppSection *self)
name = indicator_desktop_shortcuts_nick_get_name(priv->ids, nicks[i]);
- action = g_simple_action_new (nicks[i], NULL);
+ action = g_simple_action_new (nicks[i], G_VARIANT_TYPE_UINT32);
g_signal_connect(action, "activate", G_CALLBACK (nick_activate_cb), self);
g_simple_action_group_insert (priv->static_shortcuts, G_ACTION (action));
g_object_unref (action);
@@ -510,13 +524,16 @@ activate_cb (GSimpleAction *action,
AppSection * mi = APP_SECTION (userdata);
AppSectionPrivate * priv = mi->priv;
GError *error = NULL;
+ GAppLaunchContext *launch_context = get_launch_context (g_variant_get_uint32 (param));
- if (!g_app_info_launch (G_APP_INFO (priv->appinfo), NULL, NULL, &error)) {
+ if (!g_app_info_launch (G_APP_INFO (priv->appinfo), NULL, launch_context, &error)) {
g_warning("Unable to execute application for desktop file '%s': %s",
g_desktop_app_info_get_filename (priv->appinfo),
error->message);
g_error_free (error);
}
+
+ g_object_unref (launch_context);
}
static void
diff --git a/test/Makefile.am b/test/Makefile.am
index 8c8c160..c39aea4 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -66,3 +66,14 @@ libindicator_messages_service_la_LIBADD = \
libindicator_messages_service_la_LDFLAGS = \
$(COVERAGE_LDFLAGS)
+
+######################################
+# Test client with dbusmock
+######################################
+
+TESTS_ENVIRONMENT = \
+ export LD_LIBRARY_PATH=$(top_builddir)/libmessaging-menu/.libs; \
+ export GI_TYPELIB_PATH=$(top_builddir)/libmessaging-menu; \
+ export XDG_DATA_DIRS=$(abs_srcdir);
+
+TESTS += test-client.py
diff --git a/test/applications/test.desktop b/test/applications/test.desktop
new file mode 100644
index 0000000..c2332b9
--- /dev/null
+++ b/test/applications/test.desktop
@@ -0,0 +1,2 @@
+[Desktop Entry]
+Type=Application
diff --git a/test/test-client.py b/test/test-client.py
new file mode 100755
index 0000000..a1d503f
--- /dev/null
+++ b/test/test-client.py
@@ -0,0 +1,75 @@
+#!/usr/bin/env python3
+
+import unittest
+import dbus
+from dbus.mainloop.glib import DBusGMainLoop
+import dbusmock
+import subprocess
+from gi.repository import GLib, Gio, MessagingMenu
+
+DBusGMainLoop(set_as_default=True)
+
+class MessagingMenuTest(dbusmock.DBusTestCase):
+ @classmethod
+ def setUpClass(klass):
+ klass.start_session_bus()
+ klass.bus = klass.get_dbus(False)
+
+ def setUp(self):
+ name = 'com.canonical.indicator.messages'
+ obj_path = '/com/canonical/indicator/messages/service'
+ iface = 'com.canonical.indicator.messages.service'
+
+ self.messaging_service = self.spawn_server(name, obj_path, iface, stdout=subprocess.PIPE)
+ self.mock = dbus.Interface(self.bus.get_object(name, obj_path), dbusmock.MOCK_IFACE)
+ self.mock.AddMethod('', 'RegisterApplication', 'so', '', '')
+ self.mock.AddMethod('', 'UnregisterApplication', 's', '', '')
+ self.mock.AddMethod('', 'ApplicationStoppedRunning', 's', '', '')
+ self.mock.AddMethod('', 'SetStatus', 'ss', '', '')
+
+ self.loop = GLib.MainLoop()
+
+ def tearDown(self):
+ self.messaging_service.terminate()
+ self.messaging_service.wait()
+
+ def assertArgumentsEqual(self, args, *expected_args):
+ self.assertEqual(len(args), len(expected_args))
+ for i in range(len(args)):
+ if expected_args[i]:
+ self.assertEqual(args[i], expected_args[i])
+
+ def assertMethodCalled(self, name, *expected_args):
+ # set a flag on timeout, assertions don't get bubbled up through c functions
+ self.timed_out = False
+ def timeout(): self.timed_out = True
+ timeout_id = GLib.timeout_add_seconds(10, timeout)
+ while 1:
+ calls = self.mock.GetMethodCalls(name)
+ if len(calls) > 0:
+ GLib.source_remove(timeout_id)
+ self.assertArgumentsEqual(calls[0][1], *expected_args)
+ break
+ GLib.MainContext.default().iteration(True)
+ if self.timed_out:
+ raise self.failureException('method %s was not called after 10 seconds' % name)
+
+ def test_registration(self):
+ mmapp = MessagingMenu.App.new('test.desktop')
+ mmapp.register()
+ self.assertMethodCalled('RegisterApplication', 'test.desktop', None)
+
+ mmapp.unregister()
+ self.assertMethodCalled('UnregisterApplication', 'test.desktop')
+
+ # ApplicationStoppedRunning is called when the last ref on mmapp is dropped
+ del mmapp
+ self.assertMethodCalled('ApplicationStoppedRunning', 'test.desktop')
+
+ def test_status(self):
+ mmapp = MessagingMenu.App.new('test.desktop')
+ mmapp.register()
+ mmapp.set_status(MessagingMenu.Status.AWAY)
+ self.assertMethodCalled('SetStatus', 'test.desktop', 'away')
+
+unittest.main(testRunner=unittest.TextTestRunner())