indicator-messages-13.10.1+14.04.20140410/0000755000015301777760000000000012321504777020037 5ustar pbusernogroup00000000000000indicator-messages-13.10.1+14.04.20140410/test/0000755000015301777760000000000012321504777021016 5ustar pbusernogroup00000000000000indicator-messages-13.10.1+14.04.20140410/test/test-gactionmuxer.cpp0000644000015301777760000003111512321504521025170 0ustar pbusernogroup00000000000000/* An indicator to show information that is in messaging applications that the user is using. Copyright 2012 Canonical Ltd. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 3, as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, SATISFACTORY QUALITY, 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, see . */ #include #include #include extern "C" { #include "gactionmuxer.h" } static gboolean strv_contains (gchar **str_array, const gchar *str) { gchar **it; for (it = str_array; *it; it++) { if (!g_strcmp0 (*it, str)) return TRUE; } return FALSE; } TEST(GActionMuxerTest, Sanity) { GActionMuxer *muxer; #if G_ENCODE_VERSION(GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION) <= GLIB_VERSION_2_34 g_type_init (); #endif g_test_expect_message ("Indicator-Messages", G_LOG_LEVEL_CRITICAL, "*G_IS_ACTION_MUXER*"); g_action_muxer_insert (NULL, NULL, NULL); g_test_assert_expected_messages (); g_test_expect_message ("Indicator-Messages", G_LOG_LEVEL_CRITICAL, "*G_IS_ACTION_MUXER*"); g_action_muxer_remove (NULL, NULL); g_test_assert_expected_messages (); muxer = g_action_muxer_new (); g_action_muxer_insert (muxer, NULL, NULL); g_action_muxer_remove (muxer, NULL); g_test_expect_message ("Indicator-Messages", G_LOG_LEVEL_CRITICAL, "*NULL*"); EXPECT_FALSE (g_action_group_has_action (G_ACTION_GROUP (muxer), NULL)); g_test_assert_expected_messages (); g_test_expect_message ("Indicator-Messages", G_LOG_LEVEL_CRITICAL, "*NULL*"); EXPECT_FALSE (g_action_group_get_action_enabled (G_ACTION_GROUP (muxer), NULL)); g_test_assert_expected_messages (); g_test_expect_message ("Indicator-Messages", G_LOG_LEVEL_CRITICAL, "*NULL*"); EXPECT_FALSE (g_action_group_query_action (G_ACTION_GROUP (muxer), NULL, NULL, NULL, NULL, NULL, NULL)); g_test_assert_expected_messages (); g_test_expect_message ("GLib-GIO", G_LOG_LEVEL_CRITICAL, "*NULL*"); g_action_group_activate_action (G_ACTION_GROUP (muxer), NULL, NULL); g_test_assert_expected_messages (); g_object_unref (muxer); } TEST(GActionMuxerTest, Empty) { GActionMuxer *muxer; gchar **actions; #if G_ENCODE_VERSION(GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION) <= GLIB_VERSION_2_34 g_type_init (); #endif muxer = g_action_muxer_new (); actions = g_action_group_list_actions (G_ACTION_GROUP (muxer)); EXPECT_EQ (0, g_strv_length (actions)); g_strfreev (actions); g_object_unref (muxer); } TEST(GActionMuxerTest, AddAndRemove) { const GActionEntry entries1[] = { { "one" }, { "two" }, { "three" } }; const GActionEntry entries2[] = { { "gb" }, { "es" }, { "fr" } }; const GActionEntry entries3[] = { { "foo" }, { "bar" } }; GSimpleActionGroup *group1; GSimpleActionGroup *group2; GSimpleActionGroup *group3; GActionMuxer *muxer; gchar **actions; #if G_ENCODE_VERSION(GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION) <= GLIB_VERSION_2_34 g_type_init (); #endif group1 = g_simple_action_group_new (); g_action_map_add_action_entries (G_ACTION_MAP (group1), entries1, G_N_ELEMENTS (entries1), NULL); group2 = g_simple_action_group_new (); g_action_map_add_action_entries (G_ACTION_MAP (group2), entries2, G_N_ELEMENTS (entries2), NULL); group3 = g_simple_action_group_new (); g_action_map_add_action_entries (G_ACTION_MAP (group3), entries3, G_N_ELEMENTS (entries3), NULL); muxer = g_action_muxer_new (); g_action_muxer_insert (muxer, "first", G_ACTION_GROUP (group1)); g_action_muxer_insert (muxer, "second", G_ACTION_GROUP (group2)); g_action_muxer_insert (muxer, NULL, G_ACTION_GROUP (group3)); actions = g_action_group_list_actions (G_ACTION_GROUP (muxer)); EXPECT_TRUE (g_action_group_has_action (G_ACTION_GROUP (muxer), "first.one")); EXPECT_FALSE (g_action_group_has_action (G_ACTION_GROUP (muxer), "one")); EXPECT_EQ (8, g_strv_length (actions)); EXPECT_TRUE (strv_contains (actions, "first.one")); EXPECT_TRUE (strv_contains (actions, "first.two")); EXPECT_TRUE (strv_contains (actions, "first.three")); EXPECT_TRUE (strv_contains (actions, "second.gb")); EXPECT_TRUE (strv_contains (actions, "second.es")); EXPECT_TRUE (strv_contains (actions, "second.fr")); EXPECT_TRUE (strv_contains (actions, "foo")); EXPECT_TRUE (strv_contains (actions, "bar")); g_strfreev (actions); g_action_muxer_remove (muxer, NULL); EXPECT_FALSE (g_action_group_has_action (G_ACTION_GROUP (muxer), "foo")); EXPECT_TRUE (g_action_group_has_action (G_ACTION_GROUP (muxer), "first.one")); actions = g_action_group_list_actions (G_ACTION_GROUP (muxer)); EXPECT_EQ (6, g_strv_length (actions)); EXPECT_FALSE (strv_contains (actions, "foo")); EXPECT_TRUE (strv_contains (actions, "first.one")); g_strfreev (actions); g_action_muxer_remove (muxer, "first"); EXPECT_FALSE (g_action_group_has_action (G_ACTION_GROUP (muxer), "first.two")); EXPECT_TRUE (g_action_group_has_action (G_ACTION_GROUP (muxer), "second.es")); actions = g_action_group_list_actions (G_ACTION_GROUP (muxer)); EXPECT_EQ (3, g_strv_length (actions)); EXPECT_FALSE (strv_contains (actions, "first.two")); EXPECT_TRUE (strv_contains (actions, "second.es")); g_strfreev (actions); g_action_muxer_insert (muxer, "second", G_ACTION_GROUP (group2)); actions = g_action_group_list_actions (G_ACTION_GROUP (muxer)); EXPECT_EQ (3, g_strv_length (actions)); g_strfreev (actions); g_action_muxer_insert (muxer, NULL, G_ACTION_GROUP (group3)); actions = g_action_group_list_actions (G_ACTION_GROUP (muxer)); EXPECT_EQ (5, g_strv_length (actions)); g_strfreev (actions); g_object_unref (muxer); g_object_unref (group1); g_object_unref (group2); g_object_unref (group3); } static gboolean g_variant_equal0 (gconstpointer one, gconstpointer two) { if (one == NULL) return two == NULL; else return g_variant_equal (one, two); } TEST(GActionMuxerTest, ActionAttributes) { GSimpleActionGroup *group; GSimpleAction *action; GActionMuxer *muxer; gboolean enabled[2]; const GVariantType *param_type[2]; const GVariantType *state_type[2]; GVariant *state_hint[2]; GVariant *state[2]; #if G_ENCODE_VERSION(GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION) <= GLIB_VERSION_2_34 g_type_init (); #endif group = g_simple_action_group_new (); action = g_simple_action_new ("one", G_VARIANT_TYPE_STRING); g_action_map_add_action (G_ACTION_MAP(group), G_ACTION (action)); muxer = g_action_muxer_new (); g_action_muxer_insert (muxer, "first", G_ACTION_GROUP (group)); /* test two of the convenience functions */ EXPECT_TRUE (g_action_group_get_action_enabled (G_ACTION_GROUP (muxer), "first.one")); g_simple_action_set_enabled (action, FALSE); EXPECT_FALSE (g_action_group_get_action_enabled (G_ACTION_GROUP (muxer), "first.one")); EXPECT_STREQ ((gchar *) g_action_group_get_action_parameter_type (G_ACTION_GROUP (muxer), "first.one"), (gchar *) G_VARIANT_TYPE_STRING); /* query_action */ g_action_group_query_action (G_ACTION_GROUP (group), "one", &enabled[0], ¶m_type[0], &state_type[0], &state_hint[0], &state[0]); g_action_group_query_action (G_ACTION_GROUP (muxer), "first.one", &enabled[1], ¶m_type[1], &state_type[1], &state_hint[1], &state[1]); EXPECT_EQ (enabled[0], enabled[1]); EXPECT_STREQ ((gchar *) param_type[0], (gchar *) param_type[1]); EXPECT_STREQ ((gchar *) state_type[0], (gchar *) state_type[1]); EXPECT_TRUE (g_variant_equal0 ((gconstpointer) state_hint[0], (gconstpointer) state_hint[1])); EXPECT_TRUE (g_variant_equal0 ((gconstpointer) state[0], (gconstpointer) state[1])); g_object_unref (action); g_object_unref (group); g_object_unref (muxer); } typedef struct { gboolean signal_ran; const gchar *name; } TestSignalClosure; static void action_added (GActionGroup *group, gchar *action_name, gpointer user_data) { TestSignalClosure *c = (TestSignalClosure *)user_data; EXPECT_STREQ (c->name, action_name); c->signal_ran = TRUE; } static void action_enabled_changed (GActionGroup *group, gchar *action_name, gboolean enabled, gpointer user_data) { TestSignalClosure *c = (TestSignalClosure *)user_data; EXPECT_EQ (enabled, FALSE); c->signal_ran = TRUE; } static void action_state_changed (GActionGroup *group, gchar *action_name, GVariant *value, gpointer user_data) { TestSignalClosure *c = (TestSignalClosure *)user_data; EXPECT_STREQ (g_variant_get_string (value, NULL), "off"); c->signal_ran = TRUE; } static void action_removed (GActionGroup *group, gchar *action_name, gpointer user_data) { TestSignalClosure *c = (TestSignalClosure *)user_data; EXPECT_STREQ (c->name, action_name); c->signal_ran = TRUE; } TEST(GActionMuxerTest, Signals) { GSimpleActionGroup *group; GSimpleAction *action; GActionMuxer *muxer; TestSignalClosure closure; group = g_simple_action_group_new (); action = g_simple_action_new ("one", G_VARIANT_TYPE_STRING); g_action_map_add_action (G_ACTION_MAP(group), G_ACTION (action)); g_object_unref (action); muxer = g_action_muxer_new (); g_signal_connect (muxer, "action-added", G_CALLBACK (action_added), (gpointer) &closure); g_signal_connect (muxer, "action-enabled-changed", G_CALLBACK (action_enabled_changed), (gpointer) &closure); g_signal_connect (muxer, "action-state-changed", G_CALLBACK (action_state_changed), (gpointer) &closure); g_signal_connect (muxer, "action-removed", G_CALLBACK (action_removed), (gpointer) &closure); /* add the group with "one" action and check whether the signal is emitted */ closure.signal_ran = FALSE; closure.name = "first.one"; g_action_muxer_insert (muxer, "first", G_ACTION_GROUP (group)); EXPECT_TRUE (closure.signal_ran); /* add a second action after the group was added to the muxer */ closure.signal_ran = FALSE; closure.name = "first.two"; action = g_simple_action_new_stateful ("two", G_VARIANT_TYPE_STRING, g_variant_new_string ("on")); g_action_map_add_action (G_ACTION_MAP(group), G_ACTION (action)); EXPECT_TRUE (closure.signal_ran); /* disable the action */ closure.signal_ran = FALSE; g_simple_action_set_enabled (action, FALSE); EXPECT_TRUE (closure.signal_ran); /* change its state */ closure.signal_ran = FALSE; g_simple_action_set_state (action, g_variant_new_string ("off")); EXPECT_TRUE (closure.signal_ran); g_object_unref (action); /* remove the first action */ closure.signal_ran = FALSE; closure.name = "first.one"; g_action_map_remove_action (G_ACTION_MAP(group), "one"); EXPECT_TRUE (closure.signal_ran); /* remove the whole group, should be notified about "first.two" */ closure.signal_ran = FALSE; closure.name = "first.two"; g_action_muxer_remove (muxer, "first"); EXPECT_TRUE (closure.signal_ran); g_object_unref (group); g_object_unref (muxer); } static void action_activated (GSimpleAction *simple, GVariant *parameter, gpointer user_data) { gboolean *signal_ran = (gboolean *)user_data; EXPECT_STREQ (g_variant_get_string (parameter, NULL), "value"); *signal_ran = TRUE; } static void action_change_state (GSimpleAction *simple, GVariant *value, gpointer user_data) { gboolean *signal_ran = (gboolean *)user_data; EXPECT_STREQ (g_variant_get_string (value, NULL), "off"); *signal_ran = TRUE; } TEST(GActionMuxerTest, ActivateAction) { GSimpleActionGroup *group; GSimpleAction *action; GActionMuxer *muxer; gboolean signal_ran; group = g_simple_action_group_new (); action = g_simple_action_new ("one", G_VARIANT_TYPE_STRING); g_action_map_add_action (G_ACTION_MAP(group), G_ACTION (action)); g_signal_connect (action, "activate", G_CALLBACK (action_activated), (gpointer) &signal_ran); g_object_unref (action); action = g_simple_action_new_stateful ("two", NULL, g_variant_new_string ("on")); g_action_map_add_action (G_ACTION_MAP(group), G_ACTION (action)); g_signal_connect (action, "change-state", G_CALLBACK (action_change_state), (gpointer) &signal_ran); g_object_unref (action); muxer = g_action_muxer_new (); g_action_muxer_insert (muxer, "first", G_ACTION_GROUP (group)); signal_ran = FALSE; g_action_group_activate_action (G_ACTION_GROUP (muxer), "first.one", g_variant_new_string ("value")); EXPECT_TRUE (signal_ran); signal_ran = FALSE; g_action_group_change_action_state (G_ACTION_GROUP (muxer), "first.two", g_variant_new_string ("off")); EXPECT_TRUE (signal_ran); g_object_unref (group); g_object_unref (muxer); } indicator-messages-13.10.1+14.04.20140410/test/Makefile.am0000644000015301777760000000344712321504521023045 0ustar pbusernogroup00000000000000 check_LIBRARIES = libgtest.a check_PROGRAMS = test-gactionmuxer TESTS = $(check_PROGRAMS) AM_CPPFLAGS = $(GTEST_CPPFLAGS) \ -I${top_srcdir}/src nodist_libgtest_a_SOURCES = \ $(GTEST_SOURCE)/src/gtest-all.cc \ $(GTEST_SOURCE)/src/gtest_main.cc libgtest_a_CPPFLAGS = \ $(GTEST_CPPFLAGS) -w \ $(AM_CPPFLAGS) libgtest_a_CXXFLAGS = \ $(AM_CXXFLAGS) test_gactionmuxer_SOURCES = \ test-gactionmuxer.cpp test_gactionmuxer_CPPFLAGS = \ $(APPLET_CFLAGS) \ $(AM_CPPFLAGS) test_gactionmuxer_LDADD = \ $(APPLET_LIBS) \ libindicator-messages-service.la \ libgtest.a ###################################### # Lib containing code under test ###################################### noinst_LTLIBRARIES = \ libindicator-messages-service.la libindicator_messages_service_la_SOURCES = \ $(top_builddir)/common/indicator-messages-service.c \ $(top_builddir)/common/indicator-messages-service.h \ $(top_srcdir)/src/gactionmuxer.c \ $(top_srcdir)/src/gactionmuxer.h $(top_srcdir)/src/dbus-data.h libindicator_messages_service_ladir = \ $(includedir)/libindicator-messages-service/ libindicator_messages_service_la_CFLAGS = \ $(APPLET_CFLAGS) \ $(COVERAGE_CFLAGS) \ -I$(top_builddir)/src \ -I$(top_builddir)/common \ -Wall \ -Wl,-Bsymbolic-functions \ -Wl,-z,defs \ -Wl,--as-needed \ -Werror -Wno-error=deprecated-declarations \ -DG_LOG_DOMAIN=\"Indicator-Messages\" libindicator_messages_service_la_LIBADD = \ $(APPLET_LIBS) 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 indicator-messages-13.10.1+14.04.20140410/test/indicator-messages-service-activate.c0000644000015301777760000000336412321504521030170 0ustar pbusernogroup00000000000000/* An indicator to show information that is in messaging applications that the user is using. Copyright 2009 Canonical Ltd. Authors: Ted Gould This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 3, as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, SATISFACTORY QUALITY, 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, see . */ #include #include #include #include "../src/dbus-data.h" int main (int argc, char ** argv) { #if G_ENCODE_VERSION(GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION) <= GLIB_VERSION_2_34 g_type_init(); #endif guint returnval = 0; GError * error = NULL; DBusGConnection * connection = dbus_g_bus_get(DBUS_BUS_SESSION, NULL); DBusGProxy * proxy = dbus_g_proxy_new_for_name(connection, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS); g_debug("Activating service: %s", INDICATOR_MESSAGES_DBUS_NAME); if (!org_freedesktop_DBus_start_service_by_name (proxy, INDICATOR_MESSAGES_DBUS_NAME, 0, &returnval, &error)) { g_error("Unable to send message to DBus to start service: %s", error != NULL ? error->message : "(NULL error)" ); g_error_free(error); return 1; } if (returnval != DBUS_START_REPLY_SUCCESS && returnval != DBUS_START_REPLY_ALREADY_RUNNING) { g_error("Return value isn't indicative of success: %d", returnval); return 1; } return 0; } indicator-messages-13.10.1+14.04.20140410/test/applications/0000755000015301777760000000000012321504777023504 5ustar pbusernogroup00000000000000indicator-messages-13.10.1+14.04.20140410/test/applications/test.desktop0000644000015301777760000000004112321504521026034 0ustar pbusernogroup00000000000000[Desktop Entry] Type=Application indicator-messages-13.10.1+14.04.20140410/test/indicator-messages-service-activate.build.sh0000644000015301777760000000021412321504521031445 0ustar pbusernogroup00000000000000#!/bin/sh gcc -o indicator-messages-service-activate indicator-messages-service-activate.c `pkg-config --cflags --libs dbus-1 dbus-glib-1` indicator-messages-13.10.1+14.04.20140410/test/test-client.py0000755000015301777760000000615612321504521023621 0ustar pbusernogroup00000000000000#!/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 # Since mmapp is the only thing holding on to a GDBusConnection, the # connection might get freed before it sends the StoppedRunning # message. Flush the connection to make sure it is sent. bus = Gio.bus_get_sync(Gio.BusType.SESSION, None) bus.flush_sync(None) 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()) indicator-messages-13.10.1+14.04.20140410/Makefile.am0000644000015301777760000000246112321504521022061 0ustar pbusernogroup00000000000000 SUBDIRS = \ common \ src \ libmessaging-menu \ data \ po if ENABLE_GTK_DOC SUBDIRS += doc endif if BUILD_TESTS SUBDIRS += \ test # build src first test: src endif DISTCHECK_CONFIGURE_FLAGS = --enable-localinstall --enable-deprecations --enable-introspection --enable-gtk-doc dist-hook: @if test -d "$(top_srcdir)/.bzr"; \ then \ echo Creating ChangeLog && \ ( cd "$(top_srcdir)" && \ echo '# Generated by Makefile. Do not edit.'; echo; \ $(top_srcdir)/missing --run bzr log --gnu-changelog ) > ChangeLog.tmp \ && mv -f ChangeLog.tmp $(top_distdir)/ChangeLog \ || (rm -f ChangeLog.tmp; \ echo Failed to generate ChangeLog >&2 ); \ else \ echo Failed to generate ChangeLog: not a branch >&2; \ fi @if test -d "$(top_srcdir)/.bzr"; \ then \ echo Creating AUTHORS && \ ( cd "$(top_srcdir)" && \ echo '# Generated by Makefile. Do not edit.'; echo; \ $(top_srcdir)/missing --run bzr log --long --levels=0 | grep -e "^\s*author:" -e "^\s*committer:" | cut -d ":" -f 2 | cut -d "<" -f 1 | sort -u) > AUTHORS.tmp \ && mv -f AUTHORS.tmp $(top_distdir)/AUTHORS \ || (rm -f AUTHORS.tmp; \ echo Failed to generate AUTHORS >&2 ); \ else \ echo Failed to generate AUTHORS: not a branch >&2; \ fi include $(top_srcdir)/Makefile.am.coverage indicator-messages-13.10.1+14.04.20140410/COPYING.GPLv30000644000015301777760000010451312321504521021753 0ustar pbusernogroup00000000000000 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 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 3 of the License, 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, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . indicator-messages-13.10.1+14.04.20140410/tests/0000755000015301777760000000000012321504777021201 5ustar pbusernogroup00000000000000indicator-messages-13.10.1+14.04.20140410/tests/manual0000644000015301777760000000143112321504521022363 0ustar pbusernogroup00000000000000 Test-case indicator-messages/unity7-items-check
Log in to a Unity 7 user session
Go to the panel and click on the Messages indicator
Ensure there are items in the menu
Test-case indicator-messages/unity7-greeter-items-check
Start a system and wait for the greeter or logout of the current user session
Go to the panel and click on the Messages indicator
Ensure there are items in the menu
Test-case indicator-messages/unity8-items-check
Login to a user session running Unity 8
Pull down the top panel until it sticks open
Navigate through the tabs until "Incoming" is shown
Incoming is at the top of the menu
The menu is populated with items
indicator-messages-13.10.1+14.04.20140410/Makefile.am.coverage0000644000015301777760000000250512321504521023652 0ustar pbusernogroup00000000000000 # Coverage targets .PHONY: clean-gcno clean-gcda \ coverage-html generate-coverage-html clean-coverage-html \ coverage-gcovr generate-coverage-gcovr clean-coverage-gcovr clean-local: clean-gcno clean-coverage-html clean-coverage-gcovr if HAVE_GCOV clean-gcno: @echo Removing old coverage instrumentation -find -name '*.gcno' -print | xargs -r rm clean-gcda: @echo Removing old coverage results -find -name '*.gcda' -print | xargs -r rm coverage-html: clean-gcda -$(MAKE) $(AM_MAKEFLAGS) -k check $(MAKE) $(AM_MAKEFLAGS) generate-coverage-html generate-coverage-html: @echo Collecting coverage data $(LCOV) --directory $(top_builddir) --capture --output-file coverage.info --no-checksum --compat-libtool LANG=C $(GENHTML) --prefix $(top_builddir) --output-directory coveragereport --title "Code Coverage" --legend --show-details coverage.info clean-coverage-html: clean-gcda -$(LCOV) --directory $(top_builddir) -z -rm -rf coverage.info coveragereport if HAVE_GCOVR coverage-gcovr: clean-gcda -$(MAKE) $(AM_MAKEFLAGS) -k check $(MAKE) $(AM_MAKEFLAGS) generate-coverage-gcovr generate-coverage-gcovr: @echo Generating coverage GCOVR report $(GCOVR) -x -r $(top_builddir) -o $(top_builddir)/coverage.xml clean-coverage-gcovr: clean-gcda -rm -rf $(top_builddir)/coverage.xml endif # HAVE_GCOVR endif # HAVE_GCOV indicator-messages-13.10.1+14.04.20140410/libmessaging-menu/0000755000015301777760000000000012321504777023445 5ustar pbusernogroup00000000000000indicator-messages-13.10.1+14.04.20140410/libmessaging-menu/Makefile.am0000644000015301777760000000350712321504521025471 0ustar pbusernogroup00000000000000 lib_LTLIBRARIES = libmessaging-menu.la libmessaging_menu_ladir = $(includedir)/messaging-menu libmessaging_menu_la_SOURCES = \ messaging-menu-app.c \ messaging-menu-message.c libmessaging_menu_la_HEADERS = \ messaging-menu-app.h \ messaging-menu.h \ messaging-menu-message.h libmessaging_menu_la_LIBADD = \ $(GIO_LIBS) \ $(top_builddir)/common/libmessaging-common.la libmessaging_menu_la_CFLAGS = \ -I$(top_builddir)/common \ $(GIO_CFLAGS) \ -Wall libmessaging_menu_la_LDFLAGS = -export-symbols-regex "^messaging_menu_.*" pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = messaging-menu.pc -include $(INTROSPECTION_MAKEFILE) INTROSPECTION_GIRS = INTROSPECTION_SCANNER_ARGS = --add-include-path=$(srcdir) --warn-all INTROSPECTION_COMPILER_ARGS = --includedir=$(srcdir) if HAVE_INTROSPECTION MessagingMenu-1.0.gir: libmessaging-menu.la MessagingMenu_1_0_gir_NAMESPACE = MessagingMenu MessagingMenu_1_0_gir_INCLUDES = GObject-2.0 Gio-2.0 MessagingMenu_1_0_gir_CFLAGS = $(INCLUDES) $(GIO_CFLAGS) MessagingMenu_1_0_gir_SCANNERFLAGS = --c-include="messaging-menu.h" MessagingMenu_1_0_gir_LIBS = libmessaging-menu.la MessagingMenu_1_0_gir_FILES = \ messaging-menu-app.c \ messaging-menu-app.h \ messaging-menu-message.c \ messaging-menu-message.h MessagingMenu_1_0_gir_EXPORT_PACKAGES = messaging-menu INTROSPECTION_GIRS += MessagingMenu-1.0.gir girdir = $(datadir)/gir-1.0 gir_DATA = $(INTROSPECTION_GIRS) typelibdir = $(libdir)/girepository-1.0 typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib) CLEANFILES = $(gir_DATA) $(typelib_DATA) ######################### # VAPI Files ######################### if HAVE_VALA vapidir = $(datadir)/vala/vapi vapi_DATA = MessagingMenu-1.0.vapi MessagingMenu-1.0.vapi: MessagingMenu-1.0.gir $(VALA_API_GEN) --pkg gio-2.0 --library=MessagingMenu-1.0 $< CLEANFILES += $(vapi_DATA) endif endif indicator-messages-13.10.1+14.04.20140410/libmessaging-menu/messaging-menu.pc.in0000644000015301777760000000041712321504521027302 0ustar pbusernogroup00000000000000prefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@/messaging-menu Name: Messaging Menu Library Description: Messaging Menu client library Version: @VERSION@ Requires: gio-unix-2.0 Libs: -L${libdir} -lmessaging-menu Cflags: -I${includedir} indicator-messages-13.10.1+14.04.20140410/libmessaging-menu/messaging-menu-app.c0000644000015301777760000013507312321504521027302 0ustar pbusernogroup00000000000000/* * Copyright 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License version 3, as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranties of * MERCHANTABILITY, SATISFACTORY QUALITY, 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, see . * * Authors: * Lars Uebernickel */ #include "messaging-menu-app.h" #include "indicator-messages-service.h" #include "indicator-messages-application.h" #include #include /** * SECTION:messaging-menu * @title: MessagingMenuApp * @short_description: An application section in the messaging menu * @include: messaging-menu.h * * A #MessagingMenuApp represents an application section in the * Messaging Menu. An application section is tied to an installed * application through a desktop file id, which must be passed to * messaging_menu_app_new(). * * To register the application with the Messaging Menu, call * messaging_menu_app_register(). This signifies that the application * should be present in the menu and be marked as "running". * * The first menu item in an application section represents the * application itself, using the name and icon found in the associated * desktop file. Activating this item starts the application. * * Following the application item, the Messaging Menu inserts all * shortcut actions found in the desktop file. Actions whose * NotShowIn keyword contains "Messaging Menu" or whose * OnlyShowIn keyword does not contain "Messaging Menu" * will not appear (the * desktop file specification contains a detailed explanation of * shortcut actions.) An application cannot add, remove, or change * these shortcut items while it is running. * * Next, an application section contains menu items for message sources. * What exactly constitutes a message source depends on the type of * application: an email client's message sources are folders * containing new messages, while those of a chat program are persons * that have contacted the user. * * A message source is represented in the menu by a label and optionally * also an icon. It can be associated with either a count, a time, or * an arbitrary string, which will appear on the right side of the menu * item. * * When the user activates a source, the source is immediately removed * from the menu and the "activate-source" signal is emitted. * * Applications should always expose all the message sources available. * However, the Messaging Menu might limit the amount of sources it * displays to the user. * * The Messaging Menu offers users a way to set their chat status * (available, away, busy, invisible, or offline) for multiple * applications at once. Applications that appear in the Messaging Menu * can integrate with this by setting the * "X-MessagingMenu-UsesChatSection" key in their desktop file to True. * Use messaging_menu_app_set_status() to signify that the application's * chat status has changed. When the user changes status through the * Messaging Menu, the ::status-changed signal will be emitted. * * If the application stops running without calling * messaging_menu_app_unregister(), it will be marked as "not running". * Its application and shortcut items stay in the menu, but all message * sources are removed. If messaging_menu_app_unregister() is called, * the application section is removed completely. * * More information about the design and recommended usage of the * Messaging Menu is available at https://wiki.ubuntu.com/MessagingMenu. */ /** * MessagingMenuApp: * * #MessagingMenuApp is an opaque structure. */ struct _MessagingMenuApp { GObject parent_instance; GDesktopAppInfo *appinfo; int registered; /* -1 for unknown */ MessagingMenuStatus status; gboolean status_set; GDBusConnection *bus; GHashTable *messages; GList *sources; IndicatorMessagesApplication *app_interface; IndicatorMessagesService *messages_service; guint watch_id; GCancellable *cancellable; }; G_DEFINE_TYPE (MessagingMenuApp, messaging_menu_app, G_TYPE_OBJECT); enum { PROP_0, PROP_DESKTOP_ID, N_PROPERTIES }; enum { ACTIVATE_SOURCE, STATUS_CHANGED, N_SIGNALS }; static GParamSpec *properties[N_PROPERTIES]; static guint signals[N_SIGNALS]; static const gchar *status_ids[] = { "available", "away", "busy", "invisible", "offline" }; typedef struct { gchar *id; GIcon *icon; gchar *label; guint32 count; gint64 time; gchar *string; gboolean draws_attention; } Source; static void global_status_changed (IndicatorMessagesService *service, const gchar *status_str, gpointer user_data); /* in messaging-menu-message.c */ GVariant * _messaging_menu_message_to_variant (MessagingMenuMessage *msg); static void source_free (gpointer data) { Source *source = data; if (source) { g_free (source->id); g_clear_object (&source->icon); g_free (source->label); g_free (source->string); g_slice_free (Source, source); } } static GVariant * source_to_variant (Source *source) { GVariant *v; GVariant *serialized_icon; GVariantBuilder builder; serialized_icon = source->icon ? g_icon_serialize (source->icon) : NULL; g_variant_builder_init (&builder, G_VARIANT_TYPE ("av")); if (serialized_icon) { g_variant_builder_add (&builder, "v", serialized_icon); g_variant_unref (serialized_icon); } v = g_variant_new ("(ssavuxsb)", source->id, source->label, &builder, source->count, source->time, source->string ? source->string : "", source->draws_attention); return v; } static gchar * messaging_menu_app_get_dbus_object_path (MessagingMenuApp *app) { gchar *path; if (!app->appinfo) return NULL; path = g_strconcat ("/com/canonical/indicator/messages/", g_app_info_get_id (G_APP_INFO (app->appinfo)), NULL); g_strcanon (path, "/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", '_'); return path; } static void messaging_menu_app_got_bus (GObject *source, GAsyncResult *res, gpointer user_data) { MessagingMenuApp *app = user_data; GError *error = NULL; gchar *object_path; app->bus = g_bus_get_finish (res, &error); if (app->bus == NULL) { g_warning ("unable to connect to session bus: %s", error->message); g_error_free (error); return; } object_path = messaging_menu_app_get_dbus_object_path (app); if (object_path && !g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (app->app_interface), app->bus, object_path, &error)) { g_warning ("unable to export application interface: %s", error->message); g_clear_error (&error); } g_free (object_path); } static void messaging_menu_app_set_desktop_id (MessagingMenuApp *app, const gchar *desktop_id) { g_return_if_fail (desktop_id != NULL); /* no need to clean up, it's construct only */ app->appinfo = g_desktop_app_info_new (desktop_id); if (app->appinfo == NULL) { g_warning ("could not find the desktop file for '%s'", desktop_id); } g_bus_get (G_BUS_TYPE_SESSION, app->cancellable, messaging_menu_app_got_bus, app); } static void messaging_menu_app_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { MessagingMenuApp *app = MESSAGING_MENU_APP (object); switch (prop_id) { case PROP_DESKTOP_ID: messaging_menu_app_set_desktop_id (app, g_value_get_string (value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); } } static void messaging_menu_app_finalize (GObject *object) { G_OBJECT_CLASS (messaging_menu_app_parent_class)->finalize (object); } static void messaging_menu_app_dispose (GObject *object) { MessagingMenuApp *app = MESSAGING_MENU_APP (object); if (app->watch_id > 0) { g_bus_unwatch_name (app->watch_id); app->watch_id = 0; } if (app->cancellable) { g_cancellable_cancel (app->cancellable); g_object_unref (app->cancellable); app->cancellable = NULL; } 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); g_clear_object (&app->messages_service); } g_clear_pointer (&app->messages, g_hash_table_unref); g_list_free_full (app->sources, source_free); app->sources = NULL; g_clear_object (&app->app_interface); g_clear_object (&app->appinfo); g_clear_object (&app->bus); G_OBJECT_CLASS (messaging_menu_app_parent_class)->dispose (object); } static void messaging_menu_app_class_init (MessagingMenuAppClass *class) { GObjectClass *object_class = G_OBJECT_CLASS (class); object_class->set_property = messaging_menu_app_set_property; object_class->finalize = messaging_menu_app_finalize; object_class->dispose = messaging_menu_app_dispose; /** * MessagingMenuApp:desktop-id: * * The desktop id of the application associated with this application * section. Must be given when the #MessagingMenuApp is created. */ properties[PROP_DESKTOP_ID] = g_param_spec_string ("desktop-id", "Desktop Id", "The desktop id of the associated application", NULL, G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS); g_object_class_install_properties (object_class, N_PROPERTIES, properties); /** * MessagingMenuApp::activate-source: * @mmapp: the #MessagingMenuApp * @source_id: the source id that was activated * * Emitted when the user has activated the message source with id * @source_id. The source is immediately removed from the menu, * handlers of this signal do not need to call * messaging_menu_app_remove_source(). */ signals[ACTIVATE_SOURCE] = g_signal_new ("activate-source", MESSAGING_MENU_TYPE_APP, G_SIGNAL_RUN_FIRST | G_SIGNAL_DETAILED, 0, NULL, NULL, g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING); /** * MessagingMenuApp::status-changed: * @mmapp: the #MessagingMenuApp * @status: a #MessagingMenuStatus * * Emitted when the chat status is changed through the messaging menu. * * Applications which are registered to use the chat status should * change their status to @status upon receiving this signal. Call * messaging_menu_app_set_status() to acknowledge that the application * changed its status. */ signals[STATUS_CHANGED] = g_signal_new ("status-changed", MESSAGING_MENU_TYPE_APP, G_SIGNAL_RUN_FIRST, 0, NULL, NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT); } static void created_messages_service (GObject *source_object, GAsyncResult *result, gpointer user_data) { MessagingMenuApp *app = user_data; GError *error = NULL; app->messages_service = indicator_messages_service_proxy_new_finish (result, &error); if (!app->messages_service) { g_warning ("unable to connect to the mesaging menu service: %s", error->message); g_error_free (error); return; } g_signal_connect (app->messages_service, "status-changed", G_CALLBACK (global_status_changed), app); /* sync current status */ if (app->registered == TRUE) messaging_menu_app_register (app); else if (app->registered == FALSE) messaging_menu_app_unregister (app); if (app->status_set) messaging_menu_app_set_status (app, app->status); } static void indicator_messages_appeared (GDBusConnection *bus, const gchar *name, const gchar *name_owner, gpointer user_data) { MessagingMenuApp *app = user_data; indicator_messages_service_proxy_new (bus, G_DBUS_PROXY_FLAGS_NONE, "com.canonical.indicator.messages", "/com/canonical/indicator/messages/service", app->cancellable, created_messages_service, app); } static void indicator_messages_vanished (GDBusConnection *bus, const gchar *name, gpointer user_data) { MessagingMenuApp *app = user_data; if (app->messages_service) { g_signal_handlers_disconnect_by_func (app->messages_service, global_status_changed, app); g_clear_object (&app->messages_service); } } static gboolean messaging_menu_app_list_sources (IndicatorMessagesApplication *app_interface, GDBusMethodInvocation *invocation, gpointer user_data) { MessagingMenuApp *app = user_data; GVariantBuilder builder; GList *it; g_variant_builder_init (&builder, G_VARIANT_TYPE ("a(ssavuxsb)")); for (it = app->sources; it; it = it->next) g_variant_builder_add_value (&builder, source_to_variant (it->data)); indicator_messages_application_complete_list_sources (app_interface, invocation, g_variant_builder_end (&builder)); return TRUE; } static gint compare_source_id (gconstpointer a, gconstpointer b) { const Source *source = a; const gchar *id = b; return strcmp (source->id, id); } static gboolean messaging_menu_app_remove_source_internal (MessagingMenuApp *app, const gchar *source_id) { GList *node; node = g_list_find_custom (app->sources, source_id, compare_source_id); if (node) { source_free (node->data); app->sources = g_list_delete_link (app->sources, node); return TRUE; } return FALSE; } static gboolean messaging_menu_app_remove_message_internal (MessagingMenuApp *app, const gchar *message_id) { return g_hash_table_remove (app->messages, message_id); } static gboolean messaging_menu_app_activate_source (IndicatorMessagesApplication *app_interface, GDBusMethodInvocation *invocation, const gchar *source_id, gpointer user_data) { MessagingMenuApp *app = user_data; GQuark q = g_quark_from_string (source_id); /* Activate implies removing the source, no need for SourceRemoved */ if (messaging_menu_app_remove_source_internal (app, source_id)) g_signal_emit (app, signals[ACTIVATE_SOURCE], q, source_id); indicator_messages_application_complete_activate_source (app_interface, invocation); return TRUE; } static gboolean messaging_menu_app_list_messages (IndicatorMessagesApplication *app_interface, GDBusMethodInvocation *invocation, gpointer user_data) { MessagingMenuApp *app = user_data; GVariantBuilder builder; GHashTableIter iter; MessagingMenuMessage *message; g_variant_builder_init (&builder, G_VARIANT_TYPE ("a(savsssxaa{sv}b)")); g_hash_table_iter_init (&iter, app->messages); while (g_hash_table_iter_next (&iter, NULL, (gpointer *) &message)) g_variant_builder_add_value (&builder, _messaging_menu_message_to_variant (message)); indicator_messages_application_complete_list_messages (app_interface, invocation, g_variant_builder_end (&builder)); return TRUE; } static gboolean messaging_menu_app_activate_message (IndicatorMessagesApplication *app_interface, GDBusMethodInvocation *invocation, const gchar *message_id, const gchar *action_id, GVariant *params, gpointer user_data) { MessagingMenuApp *app = user_data; MessagingMenuMessage *msg; msg = g_hash_table_lookup (app->messages, message_id); if (msg) { if (*action_id) { gchar *signal; signal = g_strconcat ("activate::", action_id, NULL); if (g_variant_n_children (params)) { GVariant *param; g_variant_get_child (params, 0, "v", ¶m); g_signal_emit_by_name (msg, signal, action_id, param); g_variant_unref (param); } else g_signal_emit_by_name (msg, signal, action_id, NULL); g_free (signal); } else g_signal_emit_by_name (msg, "activate", NULL, NULL); /* Activate implies removing the message, no need for MessageRemoved */ messaging_menu_app_remove_message_internal (app, message_id); } indicator_messages_application_complete_activate_message (app_interface, invocation); return TRUE; } static gboolean messaging_menu_app_dismiss (IndicatorMessagesApplication *app_interface, GDBusMethodInvocation *invocation, const gchar * const *sources, const gchar * const *messages, gpointer user_data) { MessagingMenuApp *app = user_data; const gchar * const *it; for (it = sources; *it; it++) messaging_menu_app_remove_source_internal (app, *it); for (it = messages; *it; it++) messaging_menu_app_remove_message_internal (app, *it); return TRUE; } static void messaging_menu_app_init (MessagingMenuApp *app) { app->registered = -1; app->status_set = FALSE; app->bus = NULL; app->cancellable = g_cancellable_new (); app->app_interface = indicator_messages_application_skeleton_new (); g_signal_connect (app->app_interface, "handle-list-sources", G_CALLBACK (messaging_menu_app_list_sources), app); g_signal_connect (app->app_interface, "handle-activate-source", G_CALLBACK (messaging_menu_app_activate_source), app); g_signal_connect (app->app_interface, "handle-list-messages", G_CALLBACK (messaging_menu_app_list_messages), app); g_signal_connect (app->app_interface, "handle-activate-message", G_CALLBACK (messaging_menu_app_activate_message), app); g_signal_connect (app->app_interface, "handle-dismiss", G_CALLBACK (messaging_menu_app_dismiss), app); app->messages = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref); app->watch_id = g_bus_watch_name (G_BUS_TYPE_SESSION, "com.canonical.indicator.messages", G_BUS_NAME_WATCHER_FLAGS_NONE, indicator_messages_appeared, indicator_messages_vanished, app, NULL); } /** * messaging_menu_new: * @desktop_id: a desktop file id. See g_desktop_app_info_new() * * Creates a new #MessagingMenuApp for the application associated with * @desktop_id. * * The application will not show up (nor be marked as "running") in the * Messaging Menu before messaging_menu_app_register() has been called. * * Returns: (transfer full): a new #MessagingMenuApp */ MessagingMenuApp * messaging_menu_app_new (const gchar *desktop_id) { return g_object_new (MESSAGING_MENU_TYPE_APP, "desktop-id", desktop_id, NULL); } /** * messaging_menu_app_register: * @app: a #MessagingMenuApp * * Registers @app with the Messaging Menu. * * If the application doesn't already have a section in the Messaging * Menu, one will be created for it. The application will also be * marked as "running". * * The application will be marked as "not running" as soon as @app is * destroyed. The application launcher as well as shortcut actions will * remain in the menu. To completely remove the application section * from the Messaging Menu, call messaging_menu_app_unregister(). */ void messaging_menu_app_register (MessagingMenuApp *app) { gchar *object_path; g_return_if_fail (MESSAGING_MENU_IS_APP (app)); app->registered = TRUE; /* state will be synced right after connecting to the service */ if (!app->messages_service) return; object_path = messaging_menu_app_get_dbus_object_path (app); if (!object_path) return; indicator_messages_service_call_register_application (app->messages_service, g_app_info_get_id (G_APP_INFO (app->appinfo)), object_path, app->cancellable, NULL, NULL); g_free (object_path); } /** * messaging_menu_app_unregister: * @app: a #MessagingMenuApp * * Completely removes the @app from the Messaging Menu. If the * application's launcher and shortcut actions should remain in the * menu, destroying @app with g_object_unref() suffices. * * Note: @app will remain valid and usable after this call. */ void messaging_menu_app_unregister (MessagingMenuApp *app) { g_return_if_fail (MESSAGING_MENU_IS_APP (app)); app->registered = FALSE; /* state will be synced right after connecting to the service */ if (!app->messages_service) return; if (!app->appinfo) return; indicator_messages_service_call_unregister_application (app->messages_service, g_app_info_get_id (G_APP_INFO (app->appinfo)), app->cancellable, NULL, NULL); } /** * messaging_menu_app_set_status: * @app: a #MessagingMenuApp * @status: a #MessagingMenuStatus * * Notify the Messaging Menu that the chat status of @app has changed to * @status. * * Connect to the ::status-changed signal to receive notification about * the user changing their global chat status through the Messaging * Menu. * * This function does nothing for applications whose desktop file does * not include X-MessagingMenu-UsesChatSection. */ void messaging_menu_app_set_status (MessagingMenuApp *app, MessagingMenuStatus status) { g_return_if_fail (MESSAGING_MENU_IS_APP (app)); g_return_if_fail (status >= MESSAGING_MENU_STATUS_AVAILABLE && status <= MESSAGING_MENU_STATUS_OFFLINE); app->status = status; app->status_set = TRUE; /* state will be synced right after connecting to the service */ if (!app->messages_service) return; if (!app->appinfo) return; indicator_messages_service_call_set_status (app->messages_service, g_app_info_get_id (G_APP_INFO (app->appinfo)), status_ids [status], app->cancellable, NULL, NULL); } static int status_from_string (const gchar *s) { int i; if (!s) return -1; for (i = 0; i <= MESSAGING_MENU_STATUS_OFFLINE; i++) { if (g_str_equal (s, status_ids[i])) return i; } return -1; } static void global_status_changed (IndicatorMessagesService *service, const gchar *status_str, gpointer user_data) { MessagingMenuApp *app = user_data; int status; status = status_from_string (status_str); g_return_if_fail (status >= 0); g_signal_emit (app, signals[STATUS_CHANGED], 0, status); } static Source * messaging_menu_app_lookup_source (MessagingMenuApp *app, const gchar *id) { GList *node; node = g_list_find_custom (app->sources, id, compare_source_id); return node ? node->data : NULL; } static Source * messaging_menu_app_get_source (MessagingMenuApp *app, const gchar *id) { Source *source; source = messaging_menu_app_lookup_source (app, id); if (!source) g_warning ("a source with id '%s' doesn't exist", id); return source; } static void messaging_menu_app_notify_source_changed (MessagingMenuApp *app, Source *source) { indicator_messages_application_emit_source_changed (app->app_interface, source_to_variant (source)); } static void messaging_menu_app_insert_source_internal (MessagingMenuApp *app, gint position, const gchar *id, GIcon *icon, const gchar *label, guint count, gint64 time, const gchar *string) { Source *source; g_return_if_fail (MESSAGING_MENU_IS_APP (app)); g_return_if_fail (id != NULL); g_return_if_fail (label != NULL); if (messaging_menu_app_lookup_source (app, id)) { g_warning ("a source with id '%s' already exists", id); return; } source = g_slice_new0 (Source); source->id = g_strdup (id); source->label = g_strdup (label); if (icon) source->icon = g_object_ref (icon); source->count = count; source->time = time; source->string = g_strdup (string); app->sources = g_list_insert (app->sources, source, position); indicator_messages_application_emit_source_added (app->app_interface, position, source_to_variant (source)); } /** * messaging_menu_app_insert_source: * @app: a #MessagingMenuApp * @position: the position at which to insert the source * @id: a unique identifier for the source to be added * @icon: the icon associated with the source * @label: a user-visible string best describing the source * * Inserts a new message source into the section representing @app. Equivalent * to calling messaging_menu_app_insert_source_with_time() with the current * time. * * It is an error to insert a source with an @id which already exists. Use * messaging_menu_app_has_source() to find out whether there is such a source. */ void messaging_menu_app_insert_source (MessagingMenuApp *app, gint position, const gchar *id, GIcon *icon, const gchar *label) { messaging_menu_app_insert_source_with_time (app, position, id, icon, label, g_get_real_time ()); } /** * messaging_menu_app_append_source: * @app: a #MessagingMenuApp * @id: a unique identifier for the source to be added * @icon: (allow-none): the icon associated with the source * @label: a user-visible string best describing the source * * Appends a new message source to the end of the section representing @app. * Equivalent to calling messaging_menu_app_append_source_with_time() with the * current time. * * It is an error to add a source with an @id which already exists. Use * messaging_menu_app_has_source() to find out whether there is such a source. */ void messaging_menu_app_append_source (MessagingMenuApp *app, const gchar *id, GIcon *icon, const gchar *label) { messaging_menu_app_insert_source (app, -1, id, icon, label); } /** * messaging_menu_app_insert_source_with_count: * @app: a #MessagingMenuApp * @position: the position at which to insert the source * @id: a unique identifier for the source to be added * @icon: (allow-none): the icon associated with the source * @label: a user-visible string best describing the source * @count: the count for the source * * Inserts a new message source into the section representing @app and * initializes it with @count. * * To update the count, use messaging_menu_app_set_source_count(). * * It is an error to insert a source with an @id which already exists. Use * messaging_menu_app_has_source() to find out whether there is such a source. */ void messaging_menu_app_insert_source_with_count (MessagingMenuApp *app, gint position, const gchar *id, GIcon *icon, const gchar *label, guint count) { messaging_menu_app_insert_source_internal (app, position, id, icon, label, count, 0, ""); } /** * messaging_menu_app_append_source_with_count: * @app: a #MessagingMenuApp * @id: a unique identifier for the source to be added * @icon: (allow-none): the icon associated with the source * @label: a user-visible string best describing the source * @count: the count for the source * * Appends a new message source to the end of the section representing @app and * initializes it with @count. * * To update the count, use messaging_menu_app_set_source_count(). * * It is an error to add a source with an @id which already exists. Use * messaging_menu_app_has_source() to find out whether there is such a source. */ void messaging_menu_app_append_source_with_count (MessagingMenuApp *app, const gchar *id, GIcon *icon, const gchar *label, guint count) { messaging_menu_app_insert_source_with_count (app, -1, id, icon, label, count); } /** * messaging_menu_app_insert_source_with_time: * @app: a #MessagingMenuApp * @position: the position at which to insert the source * @id: a unique identifier for the source to be added * @icon: (allow-none): the icon associated with the source * @label: a user-visible string best describing the source * @time: the time when the source was created, in microseconds * * Inserts a new message source into the section representing @app and * initializes it with @time. Use messaging_menu_app_insert_source() to * insert a source with the current time. * * To change the time, use messaging_menu_app_set_source_time(). * * It is an error to insert a source with an @id which already exists. Use * messaging_menu_app_has_source() to find out whether there is such a source. */ void messaging_menu_app_insert_source_with_time (MessagingMenuApp *app, gint position, const gchar *id, GIcon *icon, const gchar *label, gint64 time) { messaging_menu_app_insert_source_internal (app, position, id, icon, label, 0, time, ""); } /** * messaging_menu_app_append_source_with_time: * @app: a #MessagingMenuApp * @id: a unique identifier for the source to be added * @icon: (allow-none): the icon associated with the source * @label: a user-visible string best describing the source * @time: the time when the source was created, in microseconds * * Appends a new message source to the end of the section representing * @app and initializes it with @time. Use * messaging_menu_app_append_source() to append a source with the * current time. * * To change the time, use messaging_menu_app_set_source_time(). * * It is an error to insert a source with an @id which already exists. Use * messaging_menu_app_has_source() to find out whether there is such a source. */ void messaging_menu_app_append_source_with_time (MessagingMenuApp *app, const gchar *id, GIcon *icon, const gchar *label, gint64 time) { messaging_menu_app_insert_source_with_time (app, -1, id, icon, label, time); } /** * messaging_menu_app_insert_source_with_string: * @app: a #MessagingMenuApp * @position: the position at which to insert the source * @id: a unique identifier for the source to be added * @icon: (allow-none): the icon associated with the source * @label: a user-visible string best describing the source * @str: a string associated with the source * * Inserts a new message source into the section representing @app and * initializes it with @str. * * To update the string, use messaging_menu_app_set_source_string(). * * It is an error to insert a source with an @id which already exists. Use * messaging_menu_app_has_source() to find out whether there is such a source. */ void messaging_menu_app_insert_source_with_string (MessagingMenuApp *app, gint position, const gchar *id, GIcon *icon, const gchar *label, const gchar *str) { messaging_menu_app_insert_source_internal (app, position, id, icon, label, 0, 0, str); } /** * messaging_menu_app_append_source_with_string: * @app: a #MessagingMenuApp * @id: a unique identifier for the source to be added * @icon: (allow-none): the icon associated with the source * @label: a user-visible string best describing the source * @str: a string associated with the source * * Appends a new message source to the end of the section representing @app and * initializes it with @str. * * To update the string, use messaging_menu_app_set_source_string(). * * It is an error to insert a source with an @id which already exists. Use * messaging_menu_app_has_source() to find out whether there is such a source. */ void messaging_menu_app_append_source_with_string (MessagingMenuApp *app, const gchar *id, GIcon *icon, const gchar *label, const gchar *str) { messaging_menu_app_insert_source_with_string (app, -1, id, icon, label, str); } /** * messaging_menu_app_remove_source: * @app: a #MessagingMenuApp * @source_id: the id of the source to remove * * Removes the source corresponding to @source_id from the menu. */ void messaging_menu_app_remove_source (MessagingMenuApp *app, const gchar *source_id) { g_return_if_fail (MESSAGING_MENU_IS_APP (app)); g_return_if_fail (source_id != NULL); if (messaging_menu_app_remove_source_internal (app, source_id)) indicator_messages_application_emit_source_removed (app->app_interface, source_id); } /** * messaging_menu_app_has_source: * @app: a #MessagingMenuApp * @source_id: a source id * * Returns: TRUE if there is a source associated with @source_id */ gboolean messaging_menu_app_has_source (MessagingMenuApp *app, const gchar *source_id) { g_return_val_if_fail (MESSAGING_MENU_IS_APP (app), FALSE); g_return_val_if_fail (source_id != NULL, FALSE); return messaging_menu_app_lookup_source (app, source_id) != NULL; } /** * messaging_menu_app_set_source_label: * @app: a #MessagingMenuApp * @source_id: a source id * @label: the new label for the source * * Changes the label of @source_id to @label. */ void messaging_menu_app_set_source_label (MessagingMenuApp *app, const gchar *source_id, const gchar *label) { Source *source; g_return_if_fail (MESSAGING_MENU_IS_APP (app)); g_return_if_fail (source_id != NULL); g_return_if_fail (label != NULL); source = messaging_menu_app_get_source (app, source_id); if (source) { g_free (source->label); source->label = g_strdup (label); messaging_menu_app_notify_source_changed (app, source); } } /** * messaging_menu_app_set_source_icon: * @app: a #MessagingMenuApp * @source_id: a source id * @icon: (allow-none): the new icon for the source * * Changes the icon of @source_id to @icon. */ void messaging_menu_app_set_source_icon (MessagingMenuApp *app, const gchar *source_id, GIcon *icon) { Source *source; g_return_if_fail (MESSAGING_MENU_IS_APP (app)); g_return_if_fail (source_id != NULL); source = messaging_menu_app_get_source (app, source_id); if (source) { g_clear_object (&source->icon); if (icon) source->icon = g_object_ref (icon); messaging_menu_app_notify_source_changed (app, source); } } /** * messaging_menu_app_set_source_count: * @app: a #MessagingMenuApp * @source_id: a source id * @count: the new count for the source * * Updates the count of @source_id to @count. */ void messaging_menu_app_set_source_count (MessagingMenuApp *app, const gchar *source_id, guint count) { Source *source; g_return_if_fail (MESSAGING_MENU_IS_APP (app)); g_return_if_fail (source_id != NULL); source = messaging_menu_app_get_source (app, source_id); if (source) { source->count = count; messaging_menu_app_notify_source_changed (app, source); } } /** * messaging_menu_app_set_source_time: * @app: a #MessagingMenuApp * @source_id: a source id * @time: the new time for the source, in microseconds * * Updates the time of @source_id to @time. */ void messaging_menu_app_set_source_time (MessagingMenuApp *app, const gchar *source_id, gint64 time) { Source *source; g_return_if_fail (MESSAGING_MENU_IS_APP (app)); g_return_if_fail (source_id != NULL); source = messaging_menu_app_get_source (app, source_id); if (source) { source->time = time; messaging_menu_app_notify_source_changed (app, source); } } /** * messaging_menu_app_set_source_string: * @app: a #MessagingMenuApp * @source_id: a source id * @str: the new string for the source * * Updates the string displayed next to @source_id to @str. */ void messaging_menu_app_set_source_string (MessagingMenuApp *app, const gchar *source_id, const gchar *str) { Source *source; g_return_if_fail (MESSAGING_MENU_IS_APP (app)); g_return_if_fail (source_id != NULL); source = messaging_menu_app_get_source (app, source_id); if (source) { g_free (source->string); source->string = g_strdup (str); messaging_menu_app_notify_source_changed (app, source); } } /** * messaging_menu_app_draw_attention: * @app: a #MessagingMenuApp * @source_id: a source id * * Indicates that @source_id has important unread messages. Currently, this * means that the messaging menu's envelope icon will turn blue. * * Use messaging_menu_app_remove_attention() to stop indicating that the source * needs attention. */ void messaging_menu_app_draw_attention (MessagingMenuApp *app, const gchar *source_id) { Source *source; g_return_if_fail (MESSAGING_MENU_IS_APP (app)); g_return_if_fail (source_id != NULL); source = messaging_menu_app_get_source (app, source_id); if (source) { source->draws_attention = TRUE; messaging_menu_app_notify_source_changed (app, source); } } /** * messaging_menu_app_remove_attention: * @app: a #MessagingMenuApp * @source_id: a source id * * Stop indicating that @source_id needs attention. * * This function does not need to be called when the source is removed * with messaging_menu_app_remove_source() or the user has activated the * source. * * Use messaging_menu_app_draw_attention() to make @source_id draw attention * again. */ void messaging_menu_app_remove_attention (MessagingMenuApp *app, const gchar *source_id) { Source *source; g_return_if_fail (MESSAGING_MENU_IS_APP (app)); g_return_if_fail (source_id != NULL); source = messaging_menu_app_get_source (app, source_id); if (source) { source->draws_attention = FALSE; messaging_menu_app_notify_source_changed (app, source); } } /** * messaging_menu_app_append_message: * @app: a #MessagingMenuApp * @msg: the #MessagingMenuMessage to append * @source_id: (allow-none): the source id to which @msg is added, or NULL * @notify: whether a notification bubble should be shown for this * message * * Appends @msg to the source with id @source_id of @app. The messaging * menu might not display this message immediately if other messages are * queued before this one. * * If @source_id has a count associated with it, that count will be * increased by one. * * If @source_id is %NULL, @msg won't be associated with a source. */ void messaging_menu_app_append_message (MessagingMenuApp *app, MessagingMenuMessage *msg, const gchar *source_id, gboolean notify) { const gchar *id; g_return_if_fail (MESSAGING_MENU_IS_APP (app)); g_return_if_fail (MESSAGING_MENU_IS_MESSAGE (msg)); id = messaging_menu_message_get_id (msg); if (g_hash_table_lookup (app->messages, id)) { g_warning ("a message with id '%s' already exists", id); return; } g_hash_table_insert (app->messages, g_strdup (id), g_object_ref (msg)); indicator_messages_application_emit_message_added (app->app_interface, _messaging_menu_message_to_variant (msg)); if (source_id) { Source *source; source = messaging_menu_app_get_source (app, source_id); if (source && source->count >= 0) { source->count++; messaging_menu_app_notify_source_changed (app, source); } } } /** * messaging_menu_app_get_message: * @app: a #MessagingMenuApp * @id: id of the message to retrieve * * Retrieves the message with @id, that was added with * messaging_menu_app_append_message(). * * Returns: (transfer none) (allow-none): the #MessagingMenuApp with * @id, or %NULL */ MessagingMenuMessage * messaging_menu_app_get_message (MessagingMenuApp *app, const gchar *id) { g_return_val_if_fail (MESSAGING_MENU_IS_APP (app), NULL); g_return_val_if_fail (id != NULL, NULL); return g_hash_table_lookup (app->messages, id); } /** * messaging_menu_app_remove_message: * @app: a #MessagingMenuApp * @msg: the #MessagingMenuMessage to remove * * Removes @msg from @app. * * If @source_id has a count associated with it, that count will be * decreased by one. */ void messaging_menu_app_remove_message (MessagingMenuApp *app, MessagingMenuMessage *msg) { /* take a ref of @msg here to make sure the pointer returned by * _get_id() is valid for the duration of remove_message_by_id. */ g_object_ref (msg); messaging_menu_app_remove_message_by_id (app, messaging_menu_message_get_id (msg)); g_object_unref (msg); } /** * messaging_menu_app_remove_message_by_id: * @app: a #MessagingMenuApp * @id: the unique id of @msg * * Removes the message with the id @id from @app. * * If @source_id has a count associated with it, that count will be * decreased by one. */ void messaging_menu_app_remove_message_by_id (MessagingMenuApp *app, const gchar *id) { g_return_if_fail (MESSAGING_MENU_IS_APP (app)); g_return_if_fail (id != NULL); if (messaging_menu_app_remove_message_internal (app, id)) indicator_messages_application_emit_message_removed (app->app_interface, id); } indicator-messages-13.10.1+14.04.20140410/libmessaging-menu/messaging-menu-app.h0000644000015301777760000002216512321504521027304 0ustar pbusernogroup00000000000000/* * Copyright 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License version 3, as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranties of * MERCHANTABILITY, SATISFACTORY QUALITY, 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, see . * * Authors: * Lars Uebernickel */ #ifndef __messaging_menu_app_h__ #define __messaging_menu_app_h__ #include #include "messaging-menu-message.h" G_BEGIN_DECLS #define MESSAGING_MENU_TYPE_APP messaging_menu_app_get_type() #define MESSAGING_MENU_APP(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), MESSAGING_MENU_TYPE_APP, MessagingMenuApp)) #define MESSAGING_MENU_APP_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), MESSAGING_MENU_TYPE_APP, MessagingMenuAppClass)) #define MESSAGING_MENU_IS_APP(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), MESSAGING_MENU_TYPE_APP)) /** * MessagingMenuStatus: * @MESSAGING_MENU_STATUS_AVAILABLE: available * @MESSAGING_MENU_STATUS_AWAY: away * @MESSAGING_MENU_STATUS_BUSY: busy * @MESSAGING_MENU_STATUS_INVISIBLE: invisible * @MESSAGING_MENU_STATUS_OFFLINE: offline * * An enumeration for the possible chat statuses the messaging menu can be in. */ typedef enum { MESSAGING_MENU_STATUS_AVAILABLE, MESSAGING_MENU_STATUS_AWAY, MESSAGING_MENU_STATUS_BUSY, MESSAGING_MENU_STATUS_INVISIBLE, MESSAGING_MENU_STATUS_OFFLINE } MessagingMenuStatus; typedef GObjectClass MessagingMenuAppClass; typedef struct _MessagingMenuApp MessagingMenuApp; GType messaging_menu_app_get_type (void) G_GNUC_CONST; MessagingMenuApp * messaging_menu_app_new (const gchar *desktop_id); void messaging_menu_app_register (MessagingMenuApp *app); void messaging_menu_app_unregister (MessagingMenuApp *app); void messaging_menu_app_set_status (MessagingMenuApp *app, MessagingMenuStatus status); void messaging_menu_app_insert_source (MessagingMenuApp *app, gint position, const gchar *id, GIcon *icon, const gchar *label); void messaging_menu_app_append_source (MessagingMenuApp *app, const gchar *id, GIcon *icon, const gchar *label); void messaging_menu_app_insert_source_with_count (MessagingMenuApp *app, gint position, const gchar *id, GIcon *icon, const gchar *label, guint count); void messaging_menu_app_append_source_with_count (MessagingMenuApp *app, const gchar *id, GIcon *icon, const gchar *label, guint count); void messaging_menu_app_insert_source_with_time (MessagingMenuApp *app, gint position, const gchar *id, GIcon *icon, const gchar *label, gint64 time); void messaging_menu_app_append_source_with_time (MessagingMenuApp *app, const gchar *id, GIcon *icon, const gchar *label, gint64 time); void messaging_menu_app_append_source_with_string (MessagingMenuApp *app, const gchar *id, GIcon *icon, const gchar *label, const gchar *str); void messaging_menu_app_insert_source_with_string (MessagingMenuApp *app, gint position, const gchar *id, GIcon *icon, const gchar *label, const gchar *str); void messaging_menu_app_remove_source (MessagingMenuApp *app, const gchar *source_id); gboolean messaging_menu_app_has_source (MessagingMenuApp *app, const gchar *source_id); void messaging_menu_app_set_source_label (MessagingMenuApp *app, const gchar *source_id, const gchar *label); void messaging_menu_app_set_source_icon (MessagingMenuApp *app, const gchar *source_id, GIcon *icon); void messaging_menu_app_set_source_count (MessagingMenuApp *app, const gchar *source_id, guint count); void messaging_menu_app_set_source_time (MessagingMenuApp *app, const gchar *source_id, gint64 time); void messaging_menu_app_set_source_string (MessagingMenuApp *app, const gchar *source_id, const gchar *str); void messaging_menu_app_draw_attention (MessagingMenuApp *app, const gchar *source_id); void messaging_menu_app_remove_attention (MessagingMenuApp *app, const gchar *source_id); void messaging_menu_app_append_message (MessagingMenuApp *app, MessagingMenuMessage *msg, const gchar *source_id, gboolean notify); MessagingMenuMessage * messaging_menu_app_get_message (MessagingMenuApp *app, const gchar *id); void messaging_menu_app_remove_message (MessagingMenuApp *app, MessagingMenuMessage *msg); void messaging_menu_app_remove_message_by_id (MessagingMenuApp *app, const gchar *id); G_END_DECLS #endif indicator-messages-13.10.1+14.04.20140410/libmessaging-menu/messaging-menu-message.h0000644000015301777760000000711212321504521030143 0ustar pbusernogroup00000000000000/* * Copyright 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License version 3, as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranties of * MERCHANTABILITY, SATISFACTORY QUALITY, 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, see . * * Authors: * Lars Uebernickel */ #ifndef __messaging_menu_message_h__ #define __messaging_menu_message_h__ #include G_BEGIN_DECLS #define MESSAGING_MENU_TYPE_MESSAGE (messaging_menu_message_get_type ()) #define MESSAGING_MENU_MESSAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MESSAGING_MENU_TYPE_MESSAGE, MessagingMenuMessage)) #define MESSAGING_MENU_MESSAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MESSAGING_MENU_TYPE_MESSAGE, MessagingMenuMessageClass)) #define MESSAGING_MENU_IS_MESSAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MESSAGING_MENU_TYPE_MESSAGE)) #define MESSAGING_MENU_IS_MESSAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MESSAGING_MENU_TYPE_MESSAGE)) #define MESSAGING_MENU_MESSAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MESSAGING_MENU_TYPE_MESSAGE, MessagingMenuMessageClass)) typedef struct _MessagingMenuMessage MessagingMenuMessage; GType messaging_menu_message_get_type (void) G_GNUC_CONST; MessagingMenuMessage * messaging_menu_message_new (const gchar *id, GIcon *icon, const gchar *title, const gchar *subtitle, const gchar *body, gint64 time); const gchar * messaging_menu_message_get_id (MessagingMenuMessage *msg); GIcon * messaging_menu_message_get_icon (MessagingMenuMessage *msg); const gchar * messaging_menu_message_get_title (MessagingMenuMessage *msg); const gchar * messaging_menu_message_get_subtitle (MessagingMenuMessage *msg); const gchar * messaging_menu_message_get_body (MessagingMenuMessage *msg); gint64 messaging_menu_message_get_time (MessagingMenuMessage *msg); gboolean messaging_menu_message_get_draws_attention (MessagingMenuMessage *msg); void messaging_menu_message_set_draws_attention (MessagingMenuMessage *msg, gboolean draws_attention); void messaging_menu_message_add_action (MessagingMenuMessage *msg, const gchar *id, const gchar *label, const GVariantType *parameter_type, GVariant *parameter_hint); G_END_DECLS #endif indicator-messages-13.10.1+14.04.20140410/libmessaging-menu/messaging-menu-message.c0000644000015301777760000003753212321504521030147 0ustar pbusernogroup00000000000000/* * Copyright 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License version 3, as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranties of * MERCHANTABILITY, SATISFACTORY QUALITY, 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, see . * * Authors: * Lars Uebernickel */ #include "messaging-menu-message.h" typedef GObjectClass MessagingMenuMessageClass; struct _MessagingMenuMessage { GObject parent; gchar *id; GIcon *icon; gchar *title; gchar *subtitle; gchar *body; gint64 time; gboolean draws_attention; GSList *actions; }; G_DEFINE_TYPE (MessagingMenuMessage, messaging_menu_message, G_TYPE_OBJECT); enum { PROP_0, PROP_ID, PROP_ICON, PROP_TITLE, PROP_SUBTITLE, PROP_BODY, PROP_TIME, PROP_DRAWS_ATTENTION, NUM_PROPERTIES }; static GParamSpec *properties[NUM_PROPERTIES]; typedef struct { gchar *id; gchar *label; GVariantType *parameter_type; GVariant *parameter_hint; } Action; static void action_free (gpointer data) { Action *action = data; g_free (action->id); g_free (action->label); if (action->parameter_type) g_variant_type_free (action->parameter_type); if (action->parameter_hint) g_variant_unref (action->parameter_hint); g_slice_free (Action, action); } static void messaging_menu_message_dispose (GObject *object) { MessagingMenuMessage *msg = MESSAGING_MENU_MESSAGE (object); g_clear_object (&msg->icon); G_OBJECT_CLASS (messaging_menu_message_parent_class)->dispose (object); } static void messaging_menu_message_finalize (GObject *object) { MessagingMenuMessage *msg = MESSAGING_MENU_MESSAGE (object); g_free (msg->id); g_free (msg->title); g_free (msg->subtitle); g_free (msg->body); g_slist_free_full (msg->actions, action_free); msg->actions = NULL; G_OBJECT_CLASS (messaging_menu_message_parent_class)->finalize (object); } static void messaging_menu_message_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) { MessagingMenuMessage *msg = MESSAGING_MENU_MESSAGE (object); switch (property_id) { case PROP_ID: g_value_set_string (value, msg->id); break; case PROP_ICON: g_value_set_object (value, msg->icon); break; case PROP_TITLE: g_value_set_string (value, msg->title); break; case PROP_SUBTITLE: g_value_set_string (value, msg->subtitle); break; case PROP_BODY: g_value_set_string (value, msg->body); case PROP_TIME: g_value_set_int64 (value, msg->time); break; case PROP_DRAWS_ATTENTION: g_value_set_boolean (value, msg->draws_attention); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); } } static void messaging_menu_message_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) { MessagingMenuMessage *msg = MESSAGING_MENU_MESSAGE (object); switch (property_id) { case PROP_ID: msg->id = g_value_dup_string (value); break; case PROP_ICON: msg->icon = g_value_dup_object (value); break; case PROP_TITLE: msg->title = g_value_dup_string (value); break; case PROP_SUBTITLE: msg->subtitle = g_value_dup_string (value); break; case PROP_BODY: msg->body = g_value_dup_string (value); case PROP_TIME: msg->time = g_value_get_int64 (value); break; case PROP_DRAWS_ATTENTION: messaging_menu_message_set_draws_attention (msg, g_value_get_boolean (value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); } } static void messaging_menu_message_class_init (MessagingMenuMessageClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); object_class->dispose = messaging_menu_message_dispose; object_class->finalize = messaging_menu_message_finalize; object_class->get_property = messaging_menu_message_get_property; object_class->set_property = messaging_menu_message_set_property; properties[PROP_ID] = g_param_spec_string ("id", "Id", "Unique id of the message", NULL, G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); properties[PROP_ICON] = g_param_spec_object ("icon", "Icon", "Icon of the message", G_TYPE_ICON, G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); properties[PROP_TITLE] = g_param_spec_string ("title", "Title", "Title of the message", NULL, G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); properties[PROP_SUBTITLE] = g_param_spec_string ("subtitle", "Subtitle", "Subtitle of the message", NULL, G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); properties[PROP_BODY] = g_param_spec_string ("body", "Body", "First lines of the body of the message", NULL, G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); properties[PROP_TIME] = g_param_spec_int64 ("time", "Time", "Time the message was sent, in microseconds", 0, G_MAXINT64, 0, G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); properties[PROP_DRAWS_ATTENTION] = g_param_spec_boolean ("draws-attention", "Draws attention", "Whether the message should draw attention", TRUE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); g_object_class_install_properties (klass, NUM_PROPERTIES, properties); /** * MessagingMenuMessage::activate: * @msg: the #MessagingMenuMessage * @action: (allow-none): the id of activated action, or %NULL * @parameter: (allow-none): activation parameter, or %NULL * * Emitted when the user has activated the message. The message is * immediately removed from the application's menu, handlers of this * signal do not need to call messaging_menu_app_remove_message(). */ g_signal_new ("activate", MESSAGING_MENU_TYPE_MESSAGE, G_SIGNAL_RUN_FIRST | G_SIGNAL_DETAILED, 0, NULL, NULL, g_cclosure_marshal_generic, G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_VARIANT); } static void messaging_menu_message_init (MessagingMenuMessage *self) { self->draws_attention = TRUE; } /** * messaging_menu_message_new: * @id: unique id of the message * @icon: (transfer full) (allow-none): a #GIcon representing the message * @title: the title of the message * @subtitle: (allow-none): the subtitle of the message * @body: (allow-none): the message body * @time: the time the message was received * * Creates a new #MessagingMenuMessage. * * Returns: (transfer full): a new #MessagingMenuMessage */ MessagingMenuMessage * messaging_menu_message_new (const gchar *id, GIcon *icon, const gchar *title, const gchar *subtitle, const gchar *body, gint64 time) { g_return_val_if_fail (id != NULL, NULL); g_return_val_if_fail (title != NULL, NULL); return g_object_new (MESSAGING_MENU_TYPE_MESSAGE, "id", id, "icon", icon, "title", title, "subtitle", subtitle, "body", body, "time", time, NULL); } /** * messaging_menu_message_get_id: * @msg: a #MessagingMenuMessage * * Returns: the unique id of @msg */ const gchar * messaging_menu_message_get_id (MessagingMenuMessage *msg) { g_return_val_if_fail (MESSAGING_MENU_IS_MESSAGE (msg), NULL); return msg->id; } /** * messaging_menu_message_get_icon: * @msg: a #MessagingMenuMessage * * Returns: (transfer none): the icon of @msg */ GIcon * messaging_menu_message_get_icon (MessagingMenuMessage *msg) { g_return_val_if_fail (MESSAGING_MENU_IS_MESSAGE (msg), NULL); return msg->icon; } /** * messaging_menu_message_get_title: * @msg: a #MessagingMenuMessage * * Returns: the title of @msg */ const gchar * messaging_menu_message_get_title (MessagingMenuMessage *msg) { g_return_val_if_fail (MESSAGING_MENU_IS_MESSAGE (msg), NULL); return msg->title; } /** * messaging_menu_message_get_subtitle: * @msg: a #MessagingMenuMessage * * Returns: the subtitle of @msg */ const gchar * messaging_menu_message_get_subtitle (MessagingMenuMessage *msg) { g_return_val_if_fail (MESSAGING_MENU_IS_MESSAGE (msg), NULL); return msg->subtitle; } /** * messaging_menu_message_get_body: * @msg: a #MessagingMenuMessage * * Returns: the body of @msg */ const gchar * messaging_menu_message_get_body (MessagingMenuMessage *msg) { g_return_val_if_fail (MESSAGING_MENU_IS_MESSAGE (msg), NULL); return msg->body; } /** * messaging_menu_message_get_time: * @msg: a #MessagingMenuMessage * * Returns: the time at which @msg was received */ gint64 messaging_menu_message_get_time (MessagingMenuMessage *msg) { g_return_val_if_fail (MESSAGING_MENU_IS_MESSAGE (msg), 0); return msg->time; } /** * messaging_menu_message_get_draws_attention: * @msg: a #MessagingMenuMessage * * Returns: whether @msg is drawing attention */ gboolean messaging_menu_message_get_draws_attention (MessagingMenuMessage *msg) { g_return_val_if_fail (MESSAGING_MENU_IS_MESSAGE (msg), FALSE); return msg->draws_attention; } /** * messaging_menu_message_set_draws_attention: * @msg: a #MessagingMenuMessage * @draws_attention: whether @msg should draw attention * * Sets whether @msg is drawing attention. */ void messaging_menu_message_set_draws_attention (MessagingMenuMessage *msg, gboolean draws_attention) { g_return_if_fail (MESSAGING_MENU_IS_MESSAGE (msg)); msg->draws_attention = draws_attention; g_object_notify_by_pspec (G_OBJECT (msg), properties[PROP_DRAWS_ATTENTION]); } /** * messaging_menu_message_add_action: * @msg: a #MessagingMenuMessage * @id: unique id of the action * @label: (allow-none): label of the action * @parameter_type: (allow-none): a #GVariantType * @parameter_hint: (allow-none): a #GVariant suggesting a valid range * for parameters * * Adds an action with @id and @label to @message. Actions are an * alternative way for users to activate a message. Note that messages * can still be activated without an action. * * If @parameter_type is non-%NULL, the action is able to receive user * input in addition to simply activating the action. Currently, only * string parameters are supported. * * A list of predefined parameters can be supplied as a #GVariant array * of @parameter_type in @parameter_hint. If @parameter_hint is * floating, it will be consumed. * * It is recommended to add at most two actions to a message. */ void messaging_menu_message_add_action (MessagingMenuMessage *msg, const gchar *id, const gchar *label, const GVariantType *parameter_type, GVariant *parameter_hint) { Action *action; g_return_if_fail (MESSAGING_MENU_IS_MESSAGE (msg)); g_return_if_fail (id != NULL); action = g_slice_new (Action); action->id = g_strdup (id); action->label = g_strdup (label); action->parameter_type = parameter_type ? g_variant_type_copy (parameter_type) : NULL; action->parameter_hint = parameter_hint ? g_variant_ref_sink (parameter_hint) : NULL; msg->actions = g_slist_append (msg->actions, action); } static GVariant * action_to_variant (Action *action) { GVariantBuilder builder; g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); g_variant_builder_add (&builder, "{sv}", "name", g_variant_new_string (action->id)); if (action->label) g_variant_builder_add (&builder, "{sv}", "label", g_variant_new_string (action->label)); if (action->parameter_type) { gchar *type = g_variant_type_dup_string (action->parameter_type); g_variant_builder_add (&builder, "{sv}", "parameter-type", g_variant_new_signature (type)); g_free (type); } if (action->parameter_hint) g_variant_builder_add (&builder, "{sv}", "parameter-hint", action->parameter_hint); return g_variant_builder_end (&builder); } /* * _messaging_menu_message_to_variant: * @msg: a #MessagingMenuMessage * * Serializes @msg to a #GVariant of the form (savsssxaa{sv}b): * * id * icon (fake-maybe) * title * subtitle * body * time * array of action dictionaries * draws_attention * * Returns: a new floating #GVariant instance */ GVariant * _messaging_menu_message_to_variant (MessagingMenuMessage *msg) { GVariantBuilder builder; GSList *it; GVariant *serialized_icon; GVariantBuilder icon_builder; g_return_val_if_fail (MESSAGING_MENU_IS_MESSAGE (msg), NULL); serialized_icon = msg->icon ? g_icon_serialize (msg->icon) : NULL; g_variant_builder_init (&icon_builder, G_VARIANT_TYPE ("av")); if (serialized_icon) { g_variant_builder_add (&icon_builder, "v", serialized_icon); g_variant_unref (serialized_icon); } g_variant_builder_init (&builder, G_VARIANT_TYPE ("(savsssxaa{sv}b)")); g_variant_builder_add (&builder, "s", msg->id); g_variant_builder_add (&builder, "av", &icon_builder); g_variant_builder_add (&builder, "s", msg->title ? msg->title : ""); g_variant_builder_add (&builder, "s", msg->subtitle ? msg->subtitle : ""); g_variant_builder_add (&builder, "s", msg->body ? msg->body : ""); g_variant_builder_add (&builder, "x", msg->time); g_variant_builder_open (&builder, G_VARIANT_TYPE ("aa{sv}")); for (it = msg->actions; it; it = it->next) g_variant_builder_add_value (&builder, action_to_variant (it->data)); g_variant_builder_close (&builder); g_variant_builder_add (&builder, "b", msg->draws_attention); return g_variant_builder_end (&builder); } indicator-messages-13.10.1+14.04.20140410/libmessaging-menu/messaging-menu.h0000644000015301777760000000146612321504521026527 0ustar pbusernogroup00000000000000/* * Copyright 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License version 3, as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranties of * MERCHANTABILITY, SATISFACTORY QUALITY, 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, see . * * Authors: * Lars Uebernickel */ #ifndef __messaging_menu_h__ #define __messaging_menu_h__ #include "messaging-menu-app.h" #endif indicator-messages-13.10.1+14.04.20140410/configure.ac0000644000015301777760000001213312321504521022310 0ustar pbusernogroup00000000000000 AC_INIT(indicator-messages, 12.10.5) AC_PREREQ(2.62) AM_CONFIG_HEADER(config.h) AM_INIT_AUTOMAKE([check-news]) AM_MAINTAINER_MODE IT_PROG_INTLTOOL([0.35.0]) AC_ISC_POSIX AC_PROG_CC AM_PROG_CC_C_O AC_STDC_HEADERS AC_DISABLE_STATIC AC_PROG_LIBTOOL AC_SUBST(VERSION) AC_CONFIG_MACRO_DIR([m4]) m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) AC_ARG_ENABLE([deprecations], [AS_HELP_STRING([--enable-deprecations], [allow deprecated API usage @<:@default=yes@:>@])], [], [enable_deprecations=yes]) AS_IF([test "x$enable_deprecations" = xno], [CFLAGS="$CFLAGS -DG_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -DGSEAL_ENABLE -DGTK_DISABLE_SINGLE_INCLUDES"] ) # the Google Test targets are cpp AC_PROG_CXX ########################### # Dependencies ########################### GIO_UNIX_REQUIRED_VERSION=2.33.10 GLIB_REQUIRED_VERSION=2.35.4 INTROSPECTION_REQUIRED_VERSION=1.32.0 PKG_CHECK_MODULES(APPLET, gio-unix-2.0 >= $GIO_UNIX_REQUIRED_VERSION glib-2.0 >= $GLIB_REQUIRED_VERSION) PKG_CHECK_MODULES(GIO, gio-unix-2.0 >= $GIO_UNIX_REQUIRED_VERSION) AC_SUBST(APPLET_CFLAGS) AC_SUBST(APPLET_LIBS) GLIB_GSETTINGS GTK_DOC_CHECK([1.18], [--flavour no-tmpl]) GOBJECT_INTROSPECTION_CHECK([$INTROSPECTION_REQUIRED_VERSION]) AC_ARG_WITH([indicator-dir], [AS_HELP_STRING([--with-indicator-dir=DIR], [Indicator directory [default=$datadir/unity/indicators]])], [], [with_indicator_dir=$datadir/unity/indicators]) AC_SUBST([INDICATOR_DIR], [$with_indicator_dir]) ########################### # gcov coverage reporting ########################### m4_include([m4/gcov.m4]) AC_TDD_GCOV AM_CONDITIONAL([HAVE_GCOV], [test "x$ac_cv_check_gcov" = xyes]) AM_CONDITIONAL([HAVE_LCOV], [test "x$ac_cv_check_lcov" = xyes]) AM_CONDITIONAL([HAVE_GCOVR], [test "x$ac_cv_check_gcovr" = xyes]) AC_SUBST(COVERAGE_CFLAGS) AC_SUBST(COVERAGE_CXXFLAGS) AC_SUBST(COVERAGE_LDFLAGS) ########################### # Tests ########################### AC_ARG_ENABLE([tests], [AS_HELP_STRING([--disable-tests], [Disable test scripts and tools (default=auto)])], [enable_tests=${enableval}], [enable_tests=auto]) if test "x$enable_tests" != "xno"; then m4_include([m4/gtest.m4]) CHECK_GTEST 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"]) ########################### # Vala API Generation ########################### AC_ARG_ENABLE([vala], AC_HELP_STRING([--disable-vala], [Disable vala]), [enable_vala=$enableval], [enable_vala=yes]) AS_IF([test "x$enable_vala" != "xno"],[ AM_COND_IF([HAVE_INTROSPECTION],,[ AC_MSG_ERROR([Vala bindings require introspection support, please --enable-introspection]) ]) AC_PATH_PROG([VALA_API_GEN], [vapigen]) ]) AM_CONDITIONAL([HAVE_VALA], [test -n "$VALA_API_GEN"]) ############################## # Custom Junk ############################## AC_DEFUN([AC_DEFINE_PATH], [ test "x$prefix" = xNONE && prefix="$ac_default_prefix" test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' ac_define_path=`eval echo [$]$2` ac_define_path=`eval echo [$]ac_define_path` $1="$ac_define_path" AC_SUBST($1) ifelse($3, , AC_DEFINE_UNQUOTED($1, "$ac_define_path"), AC_DEFINE_UNQUOTED($1, "$ac_define_path", $3)) ]) ########################### # Internationalization ########################### GETTEXT_PACKAGE=indicator-messages AC_SUBST(GETTEXT_PACKAGE) AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [Name of the default get text domain]) AC_DEFINE_PATH(GNOMELOCALEDIR, "${datadir}/locale", [locale directory]) AM_GLIB_GNU_GETTEXT ########################### # Files ########################### AC_OUTPUT([ Makefile src/Makefile common/Makefile data/Makefile data/icons/Makefile data/icons/16x16/Makefile data/icons/16x16/status/Makefile data/icons/16x16/categories/Makefile data/icons/22x22/Makefile data/icons/22x22/status/Makefile data/icons/22x22/categories/Makefile data/icons/24x24/Makefile data/icons/24x24/status/Makefile data/icons/32x32/Makefile data/icons/32x32/status/Makefile data/icons/32x32/categories/Makefile data/icons/48x48/Makefile data/icons/48x48/status/Makefile data/icons/scalable/Makefile data/icons/scalable/status/Makefile data/icons/scalable/categories/Makefile data/upstart/Makefile po/Makefile.in test/Makefile libmessaging-menu/Makefile libmessaging-menu/messaging-menu.pc doc/Makefile doc/reference/Makefile doc/reference/messaging-menu-docs.xml ]) ########################### # Results ########################### AC_MSG_NOTICE([ Messaging Indicator Configuration: Prefix: $prefix Indicator Dir: $INDICATORDIR tests: $enable_tests gcov: $use_gcov introspecion: $enable_introspection Vala bindings: $enable_vala documentation: $enable_gtk_doc ]) indicator-messages-13.10.1+14.04.20140410/data/0000755000015301777760000000000012321504777020750 5ustar pbusernogroup00000000000000indicator-messages-13.10.1+14.04.20140410/data/icons/0000755000015301777760000000000012321504777022063 5ustar pbusernogroup00000000000000indicator-messages-13.10.1+14.04.20140410/data/icons/22x22/0000755000015301777760000000000012321504777022642 5ustar pbusernogroup00000000000000indicator-messages-13.10.1+14.04.20140410/data/icons/22x22/Makefile.am0000644000015301777760000000003412321504521024656 0ustar pbusernogroup00000000000000SUBDIRS = status categories indicator-messages-13.10.1+14.04.20140410/data/icons/22x22/categories/0000755000015301777760000000000012321504777024767 5ustar pbusernogroup00000000000000indicator-messages-13.10.1+14.04.20140410/data/icons/22x22/categories/Makefile.am0000644000015301777760000000020212321504521027000 0ustar pbusernogroup00000000000000 iconsdir = $(datadir)/icons/hicolor/22x22/categories icons_DATA = \ applications-email-panel.png EXTRA_DIST = $(icons_DATA) indicator-messages-13.10.1+14.04.20140410/data/icons/22x22/categories/applications-email-panel.png0000644000015301777760000000174712321504521032341 0ustar pbusernogroup00000000000000‰PNG  IHDRÄ´l;sBIT|dˆ pHYs × ×B(›xtEXtSoftwarewww.inkscape.org›î<dIDAT8µ•Mh\UÇ÷Í›7oÞK‡|4™†Ö¦¡ˆ¸ð+ÔEu¥îÄmR©1W®-¸’ÚdRq§nZBq!.7¢u§²iM5µ¤3“ùê›Iæ½—w‹´µã¼Dþä£r½Qka QI†Òl5äêò¿TZzu¯XAÅI±´téåœë~:7{n ÑªYV(Š0 Çv98RàÚgËAõNù•ùù _Å%ܾ|yáÅT&½|nî-Çk·ÒÕZ¹/hÀ9ÀÈÐ(W—¯øÍzý¥ùù }²Oß_|.a%¯Í¾1—ÝÞîÄBZ^“Zc“éS3©œã|]*-Ní ./N™†ñùìÙ7Í(Ú±7*·c¡:Ò¬­ýJ¥ZfzúL*Í~»PZx<>ãDâ‹33¯G¦iܾs+!Õr¯¹ÍäÄqÖ×ÿÀ÷»œ>5“I›ÉoÞûàwS‚5<4œÿíÖ¦™D("xw;´šwæ±G“ͦ?4Îõ×91õ,)+íÄ‚q@aY¦6Ñ‘f³Z£ÓÙ¦0VàðøÒéTO®ëpófPD:2cÁ» *#ô#666H&##Ã}Ä%•²b¥±¬$ƒƒC»šªÇ×wólÛÆ², c2™Ý’Ã0Œ{ž‡;C©~_ØH(Æ c¬¯ÿŽ“sh¶šxžGà À²Räóy’fÛΑÌ?(x_0@2irlr’¿ÿ‰‰cL=sÓL "ø~ÀÊÊOTª ž?[Éž`€J¥ÌÉ“Ïcçl‚À§DˆÖ€âɧž¦^«Ñn·q]÷~HÏŽ·Û†‡b¥“lw·-ˆh´h´Ï'cgˆtD±‰½S!Ú‰°³6Ùl†0 ÑúPô_hM·»E*•Ü]û')D@kišlmuD4Ân;Ôú~kÔˆh”2ˆ#›J)w¡x1h·==6ZÈþ}“ô}ôZø„a¸£”:lŠHÇTJ€³ººúî–N‹Öû¾*qfFøóÊ/_ƒ@è(A)•Fîåý[0l`¨ˆˆîiôJ)%ÿáuUJ) 'ôOÔ³²ÅOÜIEND®B`‚indicator-messages-13.10.1+14.04.20140410/data/icons/22x22/status/0000755000015301777760000000000012321504777024165 5ustar pbusernogroup00000000000000indicator-messages-13.10.1+14.04.20140410/data/icons/22x22/status/Makefile.am0000644000015301777760000000022612321504521026204 0ustar pbusernogroup00000000000000 iconsdir = $(datadir)/icons/hicolor/22x22/status icons_DATA = \ indicator-messages.png \ indicator-messages-new.png EXTRA_DIST = $(icons_DATA) indicator-messages-13.10.1+14.04.20140410/data/icons/22x22/status/indicator-messages.png0000644000015301777760000000160412321504521030440 0ustar pbusernogroup00000000000000‰PNG  IHDRÄ´l;sBIT|dˆ pHYs × ×B(›xtEXtSoftwarewww.inkscape.org›î<IDAT8í•M‹E€ŸúèêꌻÙqvÜ3;M ‹¢IˆzQÿ„ˆW/‚ b4o žD<gws ÉL\Aã)jd?:®™™žîªòг½3‹'eo¾ôK×[t?ý~V‹!ò@¨ ÖÞçEcÌå<ÏÛÿ ¦£ßŠ"íü›o­jcÌåW^~µÛhÌ㽟z¸¬A „@“6վǖÍÍ¥+Ÿ]ùxTäyÞŽcËúú!ðÞã½Ã{‡sçöÛEQBÀË­Û·I’Þ»GÞ}ïm[åØZËìáÃܸy½‚—€=èž]~@J‰µ 7n^gvf›*Ò ,¥¤9ߤÓ鲺ÖCk”ªò|è½Cëˆ$9ÄÚµZÔ®TNMu…”’V«ÅÑ£]z«W‰¢­õÐ9‡11Ö&¬®õXlµX\\(¡ûÁ»3R¸%%KKK´tøº÷ÆÄák“ Úl6ii£”¢pÅTÑÇ—Õ-Š¢„+E£Q'©%ôV®b­en®ÎÜ\kÖ®­ÅF­K¨rw’uÕVœË Ã>[[¼pö%îþz—/¾ü¥ô¸[§OâñÇŽóíwß ÂÆÉt L®`˜eÜOSN>s†,r(±œ;{®zI‚4M9}ò ·Ö¿Ç×<‘1Lž:rÈFÙpÀò‰' ú †}„H)J"”@HA€g;Ýæ©å§É‹‚l˜ý³Ç!òQN·sŒÍtƒl8 Œ÷ ¡ô&ò*Cÿó¯”cÝ'øéÎÓ`!„¸xéÂïúÚv—Ñ(c¦6ËLmv"°0uÛ·d”gœ8¾Lz?E±uéâ^jggçõO>ýøC)å¼sŽ#J)œóÛiºýƽ{(1‘’è¹çŸ}h0¨"/TžçÚ9§œ÷*x/CU=„^Hé•”N)å”ÖΘ¨¸óó/ý~¿Ÿ¹˜Ì‹(ÇFj¬rŸîf!pê_uÏÿ¿¦]ù£G«éšý)·IEND®B`‚indicator-messages-13.10.1+14.04.20140410/data/icons/22x22/status/indicator-messages-new.png0000644000015301777760000000202512321504521031225 0ustar pbusernogroup00000000000000‰PNG  IHDRÄ´l;bKGDÿÿÿ ½§“ pHYs × ×B(›xtIME×4Èð|¢IDAT8˽•KlU†¿{ç:¶ã¸±c;ïØÍƒ4Zºé UÐ*R…P7ˆ=YÀŽ5 ¶TBHˆJ°@B‰TTE¨”.X²BJÜš€JAêÄvl&{‡…ȉšP ‰#ý‹™9óÝ3ÿœs¯â)®åÏ ~ B€ ÊŠ Öbñ¥êÁ;ê) ý )`d $œA¥bÈ® TAAmK±øò€ù÷J%2äA΂ 9V^ˆäf*ÀŸ@ˆØµóv,¾\2§@C­Ïg\_)©‚\p­\JÎÕQ*B© ^ˆäf¶€ Ú6À¶kùû§Uky*c? ÜìùI”Š(€ä\YÊ’#Àp)’›û(pãý/[ŠÏ]ÏM¢Q‡LºÌBþ#dàk’}×кëÄ*Üæ*µ‡³”º.1<´óÐZ>[|ãÍDO¬ ðÿ"–‚,öú«¨”{êO®=œ¥+ûÅ‚{}x¨ø¥ð\/e,Ãra¥"B Aà"Ò6ï.z<|ÿZˆD£†Ãa2é4÷~¸‡Ö0ˆ(‚@ɽ޽þ”ŸÞ['œÍ£t~ vÁJ)R©4“|sûÆDQºèFèiåèøÉ^¨ÇuC€Ú>‹J)™œ|†Ûwî2ýhF$Õ^<„HRAQ*(¿ØAD© ¶Ý °u¤Ý<ßEkÍèÈ®çr统¹¶0ŠÈ¡±·)ZƒÉå—ÊjËÆÜ[ƨ6·\bñeÇtVìy–±èëK°SÊðýý߸òâÆ„O¾‹ÈcvvÇ!<|ËJàû=2„ ?Oµ¶Ã‘‘Ï÷@ ^ß§\ÞåÊå«lnmòÕ­oɤ‹D£c,Ÿlö"‰ÞÛ‹D#i´5€ÁqÎp J+¤’H%QZál8„á,¹H:@q2 ðý7C¤5:R¸NÛg8 „8YÑ$IçÍ뇮ë~¿ïaR­ÔÏ„áŒáh€çyü:ý‰RªüüÙ‹ë;h›[]lË¥^ ˆböN8;iF@©XÂêþüÇúr´~gÛõAÈîî>†®c[†iÐéøRrxØHº{«:ð `§;tÍoÚ;kÁêê&q¶ÎÎÞ>Žmc[¾çÒÑmtÃacåvè'p j?–(p+æÙa}bv>½¾±­žœ¶‘¾@¸Â4‡ñòßúú_kà+à;ÀS"=ÜȆßÎŒ>™äÇfÕ %-ýX˜ÛjüæEö¹¾¾ŽXè’€+À[ÀU Üwx ÜéÛþ0è?eÉE ÒTtû 7ØÆß›v—W7BIEND®B`‚indicator-messages-13.10.1+14.04.20140410/data/icons/16x16/categories/applications-email-panel.png0000644000015301777760000000140312321504521032334 0ustar pbusernogroup00000000000000‰PNG  IHDRóÿasBIT|dˆ pHYs × ×B(›xtEXtSoftwarewww.inkscape.org›î<€IDAT8u“KoRAÅ÷ÎpáÊ-´ByU 6¶¦šô øX˜øÔúˆ¸vG0|‚ŸÁ×J«õ´Fw‹ªqabµÚÔŠ`!éã>`ÆEÑ€Õ³™ÉdÎÉ™sæoh­éGµV™nÓ@¨€[¥bù-Áè¨Ö*“–eÍŸ?;N$G!2‚N@³Ùðæ?ÚvÝ3¥bùõ?ªµÊ!)åÂõk7†AÇêu:ÝBHÒÉ ¦)ÔÝ{wZžçž.ËKÕZå âÅÕ+×G¤ë߾üí”±ì8ZiuïþÝ ðO•Šå÷ÂŽZ9Ó4ç/_º2‰„GV×ö’Úí œhܘ™™ ¿}÷æìËW/ž8~²iOgÏ]Ž:Ñý_×VÐ †êîxüXo⻊åË„,K\˜½”0Ms¡Z«˜¦”rtlì@rm})$¡…’íM—æ÷¶åptúS““d³YÞ,-‘Ne„mÛ6‘@ l… ü Ð&‰Ä~ ãÃØväÇÙ‡ÕUQ@Éßan4Zx^@&%‹aY¡=9H)qgðì÷&;–åûzN7 ÝnÑn·ñ}S˜Ø›x“É䘚:B>_Ã`qq‘X,Ž» Æ€­5ÉD‚‰‰ÃA@WuRP(ÈçYùº‚3Å0À`·®­Í-ŽçÙq·QZ£•B)…Ò €\&G«ý’齸Û.©T ß÷ÑôÈZ£uOD)|å±múçOêÞ0$GSý黤Ѻ÷½z«ah­ @Ën·û`îÉÛCÎОÚþ‡­­M<ß{^*–½_ÿ¿ †³IEND®B`‚indicator-messages-13.10.1+14.04.20140410/data/icons/16x16/status/0000755000015301777760000000000012321504777024173 5ustar pbusernogroup00000000000000indicator-messages-13.10.1+14.04.20140410/data/icons/16x16/status/Makefile.am0000644000015301777760000000026112321504521026211 0ustar pbusernogroup00000000000000 iconsdir = $(datadir)/icons/hicolor/16x16/status icons_DATA = \ application-running.png \ indicator-messages.png \ indicator-messages-new.png EXTRA_DIST = $(icons_DATA) indicator-messages-13.10.1+14.04.20140410/data/icons/16x16/status/indicator-messages.png0000644000015301777760000000115112321504521030443 0ustar pbusernogroup00000000000000‰PNG  IHDRóÿasBIT|dˆ pHYs × ×B(›xtEXtSoftwarewww.inkscape.org›î<æIDAT8Å“ÍjSA…¿ù»÷¦¿¶YhrÁU©Ñ… (AÁú"øBQ_ÀÖ‚®E,I[Å—«/ 馥4ͽóç"5í²Ò…†™Í™9ç›cä<’çrúå«¥ûÚèekmã_ŒÆ˜mgÝcc|÷ðÁ£Z^ÏñÞ#å Ô Z$ÆÓëxlNèvw[+«¯ßJç]m|lœÏ_>¡”"„€µ%Ö–”eIQô)Š>ýþ!ŒIØúþ c ιº”R2:6J£Þ`}³R !Î9œ³ÃYkMšft6ÚøàI³ )墂F³A^o²¾ÙƘ¥Î9¼w$IJ–ÐÙhS»T#¯×‘BžÜBŒ ”¢ÙlP­ViwÖȲ ˜œœ¢R¡ÝYczzŠ<ÏQJðÐyï(Š>>8®_›çÃÇ÷€8f¹yãÛ¿~RÚ>R‰Á©Ã ˆôz=v»¿¹sû.GG‡,Ü[RB$)33-¶~|%‰±zºBÄZËÜì<ûeb8PÚ‚½ý.s³óˆ„AcÌN¯wxñr³EiKÒ¬2ŒÇ°À‰J[p¥u•½½.Zëí½_|³º²¬”œrÎéj­ñ>tC‹"ÆÈÒ‹çHÏä>Qñôɳ(þûoüwå.&Î&IEND®B`‚indicator-messages-13.10.1+14.04.20140410/data/icons/16x16/status/application-running.png0000644000015301777760000000111212321504521030640 0ustar pbusernogroup00000000000000‰PNG  IHDRóÿasBIT|dˆ pHYs|4k¡tEXtSoftwarewww.inkscape.org›î<tEXtAuthorAndreas Nilsson+ïä£tEXtCreation TimeAugust 2006ð{ tEXtSourcehttp://www.gnome.org… CUYIDAT8¥Ó¿KBQðïñe" …ýÂ"R"0hphq*hk¨hhh Z úZilh(ˆ Ht‰¶°¶ŠF[ú¯¡!±0ŸÏ§ïÝ×½-¯1ä;œá|8‡{ !ÐJØZª.‚Á}{K@nP[ ­Fÿ @‚s|l82½~£¥˜Ô< ¯1©«Ç³8ÓÏ.ûf£MBEÄËíM¼×£s;CMÜúRƒq´;]c~ß•awªa ¨3è† Ý`ÐJшw 7î›þÚÊEÑ éæo.‘PÕ\öø9±yßÀ­¥$ÀLö³°õpÞ«5B `#7ŠrNɇã‘óZÅ@•UfE5õþ*/?%6’Dd'"ª ‘³’CùÈÜÈ·'+/ÛiÝ:‰ÈQoÎÔ·3ù.yPH§@ ˜¾¬W5¨òœ­–ÚæõÎý¬ð‚ØWÔÛIEND®B`‚indicator-messages-13.10.1+14.04.20140410/data/icons/16x16/status/indicator-messages-new.png0000644000015301777760000000133112321504521031232 0ustar pbusernogroup00000000000000‰PNG  IHDRóÿabKGDÿÿÿ ½§“ pHYs × ×B(›xtIME×;PàòfIDAT8Ë•’ÍoLaÅϽwÜ;®I;ÓNSF;´E?ƒÄw–Hì$,jaã?Ø b%Ä’ˆ éa+ˆˆ:£"Åh$>2ÓVÍ×ýx‹)Z‰³|òœsž÷œWXÕ…Ñ,èРéP´\žø©âôÏ=Yš<2]ººQzuÀË=æ@nú©â g çQU͉è7ÐÍÒ«]éá:"•‚ìóòƒ®êÂpÂO¯Êä6Ð#RáÊÏYÛà3µíí :§³Åô/Ž—ûÓ}Ky ƒ{o Œþqô:(OrKÎ]8wЮ‡QØžïýHnÍgF2¤‡CDœå2¦RÂ̶§Ž‰ÃkãÇO´g;³Á}Ô<§:=AÐ<Í ÷ "çÇÅÖŵä6Ë“ñ\—;woc[>`ã­;Juú,jf—tŸŸÁÍQ­zŽeY+}Ÿ¾¾~<šÄ²Rˆ¤Z[©eŸ ¤ùô%‹ "¬ÍåÈvnåùËØVwkI¨Ö©„JA0ñ×ß²š÷¥Üâ?P°›5¹ff¶RœzÌÐà)*Y¬k ™›êÀí=‰åì§RyÝPU¢8¢Ù¨Sot³¾÷0/^Þb• ×]À)×ioó‰:7’Hdh†»q“‡€ó‹(µêwfçgÙ³s/µZÏëAä –¼*ضGÆßÀ›·.Éä©ÅxZF‰cÃèÐf¾-Ìcâ$²ƒX··ª‹ ÂЦÞ•¦Q5-'á”ã8êèY›' ’^òWPúWöJ4YŸï§V¯á$œ²cŒŒ_º|ñzGíüÛ™3Èøz< "ð IEND®B`‚indicator-messages-13.10.1+14.04.20140410/data/icons/32x32/0000755000015301777760000000000012321504777022644 5ustar pbusernogroup00000000000000indicator-messages-13.10.1+14.04.20140410/data/icons/32x32/Makefile.am0000644000015301777760000000003412321504521024660 0ustar pbusernogroup00000000000000SUBDIRS = status categories indicator-messages-13.10.1+14.04.20140410/data/icons/32x32/categories/0000755000015301777760000000000012321504777024771 5ustar pbusernogroup00000000000000indicator-messages-13.10.1+14.04.20140410/data/icons/32x32/categories/Makefile.am0000644000015301777760000000024112321504521027005 0ustar pbusernogroup00000000000000 iconsdir = $(datadir)/icons/hicolor/32x32/categories icons_DATA = \ applications-email-panel.png \ applications-chat-panel.png EXTRA_DIST = $(icons_DATA) indicator-messages-13.10.1+14.04.20140410/data/icons/32x32/categories/applications-chat-panel.png0000644000015301777760000000344712321504521032172 0ustar pbusernogroup00000000000000‰PNG  IHDR szzôsBIT|dˆ pHYs × ×B(›xtEXtSoftwarewww.inkscape.org›î<¤IDATX…­–[l×ÇÿçÌ™ËîÌ®½›¬/k›K\“€ªJ…D•LzQÚ$´•Z©RŸúÒò0C±Á½ŒéF[ ýM‘fƒ‰$î܉«ñ‰ñÌÒRbÚuÝïô÷ \ý\^>{…iìG½½{íŽöPª•ƒ€@A…ÿ7¦Î_x/+¥üÙÁŸö¿ö¹üzøðÀÑg¾õ¬cš&¡`Œ1MÓ@…”RJ!J%ñÆñ×3®ëv÷÷ ü§^nú ñ¡Ø`¥ôµž=½Ž¦Q!@@!š¦1J5€R¶í`÷®¿®ë'†bƒæº4Mضu›Õ BQ@AJ)%¼J*Á±yÓ&ÒijðýõPmO4Ú¦ ! ”*‡¬”[Î]ÁQúM FM›6Ûº®ï«—ŸÕ{9Ô(¥] Á 8ç`ŒAÊñÒŒUåê=÷®¡ÆH÷gÐa'„^b)„ QJeùUïK•±m.w7®`Úu]Æ9‡RBxKΧåf$•O#„¬¬ˆôrŒ±©zu{ ¿o€k”N¤R)HYú®œór¸•p]ïÊË=QNÜ]€|fRŽÌÇçyi ®ÔÆ ç¥ß(ÜšžÊ‹Å³ëâðØÕ±B.—!¤FØuÝJTÃÀÌ쌚™™IL\Ÿ|}]ý}·_}Tx;Ÿ”¢æT¸®‹‹\ÿúç¥þø‡?g×ðÒË/uضïy)9ýöd2Y†QÞ‚IeBaâwîàäéSȤ3ظyã;VW£® ~‰2ýݯîûz ô£±07?ƒ¶¶v475£±¡~¿étKÉ$¦¦oaqñ.}¤ =†É“¹ÅÄü»©Dnÿ¡C‡Šp8vx§í³Nîö»v("ÓÓS˜ŸŸÇÜ܇pø‘òVK`Òéed2ÁA)…a˜p ‡ÃhiiçEìÛû5Ÿ”ò©k×Ç_Ð÷©’éÄOßòx8 #—Ë‚R ]ghnn¦1øý>,/gP(ä!¥!Œiðùühll@4c B yìÞÕc}2>þüðð¯^=xðç7ê9ò‹FM³¹³ûi_>_[1]×FÑØÂòò2ŠÅ„ „À²L8N€Sñ àœÃ²,ôìî1F.œ{À7«s®êÐ"7¼ýËÛMÆ8ç«õ,˜‚@ÀA{{:;;ÑÕÕ…-[ºÐѱ U™Te…är9<ñÄVÍ2¬Ý±ØàöºŒiÝmmí†×d 5 ½ðÀAÅ<+ö¨uÉm[·éŠ¢·.ù¢g¿Éd¦iÖ$­(%ö H–¡V@…T*¥8wÑÚڦ뚱¯.€ËÝ >ŸBpܾ}Žã¬)¼âý¢bÁ¥çª&LÓÄìì8w‡¡ Ÿ¼/!„Rª¥òù––’ðùü«„½ÓÐJˆŠý®®BioˆÇç‘ÉdK¹@䚤dôwÝˉÄ] ´¶¶Ô$«õµg€µ` ÃÀÜܲ٠ Ô4!D[«{zjêɉ 7 ƒR­¦œ÷ƒ¸¿xé~¿¶í`üú¸ÈdrWQµü«(ãøñïüwìJŽPÀ²¬5fo¬¾¿7"‘,ËÄå+ò ïü €V®x € âñxztôâoN:YÛv ë(¥åÕζtþ«}VúöLÓB0„m;9./¼yæÌÙ›”*¯Sv@ÀâßÿöÖi˲X6›yá©'¿b´µ·³` Ó´*çÀµ†·Y)¥ÏçJ%199Áÿ}å²¼yãæ_^ùÝï À­ô^µB@@pÇŽ›ŸÞÕýí––æ^шRð)¥4<`(¥¥ZJÞÇãï\|ÿÒ›£££XàzXeÇå5˜t”šsí)?x(”*ËpU%úÑ^çVà’¢IEND®B`‚indicator-messages-13.10.1+14.04.20140410/data/icons/32x32/categories/applications-email-panel.png0000644000015301777760000000323312321504521032333 0ustar pbusernogroup00000000000000‰PNG  IHDR szzôsBIT|dˆ pHYs × ×B(›xtEXtSoftwarewww.inkscape.org›î<IDATX…Å—_l[WÇ?çþsçÆŽ'qºtIÚTIZ-£]6mÚ Ú2´•­CÕ’Ž=!!U©BB xªx€…& B”x@ñ/oH[ÛUÝ`í^Vhº¦ilÇñûúþçÁqþÍv˜ÄïøXò=Ççóýýι÷÷»Â÷}þŸ¦ìõæg¿¥ªÊIÈuܸ뺲,dE^ˆ˶ÿòÖw¾ÿëÝ®'vK—.×üóÈÈá©cÇŽk¡öÁ`UÕ°èP.—¸ùÁMëÎ;ï¨r`úܹsæç"àòåËjÉÈ¿3ùÄ“Ï>ýÔ3j2À4«ØŽ…ã8(ŠŠ¦j´±î>nܸî\½þÞßõöÈKgÏžµÿ'W®\‘—>ýëÄÄÄ _|î„zoñߘfµé|MÕ:pˆ÷®½kß¼yãoû‡NMOO»Íæ·<çÏŸ—ôpûŸÆFÇŸÿÒs'ÔO,´„X¶Å½Å»<óô³ªišS·o}ô`hè©Ôb-¡‡ÛðàÁ—_œú²¶øðFµÒ^7ÓªrÿÁÏŸ˜Ò޾:qöwÍæ60÷³ŸüæÀÀÀ鯼üj`iy‘r¥¼+xÝŒj…Ň÷xéÅ“Á¡á™ùŸÎþj׿.Î^Š÷Æß|íÔéÀrr‰b¹°'xÝÊ•K‰ûœzåµÀþý|}îâìÜŽæægßîŽÅ¾ñúéé`j5I¾˜Û;Ù‡R±ÌÒý¹|–åÔCNõõ¶ÞžÞoÎ]|û‡MÌ^øñ‘ȹ3Ó_ ®æÒds«{⺮K.“çÁý=ÊÐà0…\‰|!ËÊjŠ™é7‚Ñè¾ï^˜ÿÑ[ Ȳøö™™7‚…bŽlvI’$Y’‘åzW¶tEVpt*K:‘exh„©¦fpðQJ…2BHdó²ù gfÞlBZ°å6t¯3l'¹²Œ¢ªDýCýÀ÷} ù"™t–p8̱Ç ¶á8†Q;°ªª10p€ªa ë!r…,½±8®ãu6 +rI Š¢P@‰ : p]‡L:K6“cppˆñÑ£H’„ãXT«Æ–-±m‹ÁÁG¹þþûtuE¶p à#@QT|ß[ƒ×èÕŠA2™Æ2-ÆÆÆ8zä1ÀÇq¬§aÃEAU<×C hœF„˜†I{¨€l6Kb9E¸3ÌøØ8mm<ÏÝ\7DZåîÂ]b±îÏ Ü†Gº®óÉ'w¨T †‡†9~ì8ªªàºŽÓ2·|Æ|ßGÓ4ŒªA‡Þ±Îi" >.è‹÷‘J$éìÔñ<Ótö®[±X"µ’âСC Ç›&#]ï@ïèàŸýƒ…B ç¹®‹,Ë Ç2™ Ùl†#GâzbëŠHÀã_àÚõ«ôööî “Éd(–ŠX–…e™xž‡$IhZMÓÐ;t¢Ñ(ÉTè09ù¶ÓÅÕkï’L,éŠ2ñØ¡PEQ‘e×u°m‡|!LJ~@"ùIR˜œœl ß•$Ÿþx?‘H”‘‘Ã8®ƒçºx¾‡m; Š"ÓëáäÉW¸}û¦i"+­²ý¬¬¤‰÷ï'ï§\)ây¾ï7슢0>~„åÄ2镺c±Ö¾í/‹´imôõöQ©”q·Ã·5˶ÈdÓtïÛG0ØA¹Tj¹þ6[«&Ó²‰*Õ ¾_ƒ{M¼ßÜ󅱨>|,kûCkƒÓ4žçá˜6ñ¾> ÓÀ÷Öoþí½P,Ðí¬Öî–#°Ù£bëéÁ´­5¨·És¯u6µ²Q¦£³ƒr©Ü³õ®T«U"Ñ(¶c­_ó|íç¬vy|› Ó4 ”Ë%ˆmU°!„æùž‚N]Çw]|¯¶ßëÞÖuú‚ZÞ¨5IÔ —zñ¢¬*Š¢¢®½´È’D{0´¶½®,„xD¡lŽ@Ì´¬B±XÐ#á¨ÚpÃ>+•Š®Q5+@?àoÙ‚…-üö¿üù÷$YÚóKënÍu]ëã[ÿ‘ZJ4×_Í„2Ð ôaà¿(‡w´`) áû~á?o1CºRç°¶IEND®B`‚indicator-messages-13.10.1+14.04.20140410/data/icons/32x32/status/0000755000015301777760000000000012321504777024167 5ustar pbusernogroup00000000000000indicator-messages-13.10.1+14.04.20140410/data/icons/32x32/status/Makefile.am0000644000015301777760000000026112321504521026205 0ustar pbusernogroup00000000000000 iconsdir = $(datadir)/icons/hicolor/32x32/status icons_DATA = \ application-running.png \ indicator-messages.png \ indicator-messages-new.png EXTRA_DIST = $(icons_DATA) indicator-messages-13.10.1+14.04.20140410/data/icons/32x32/status/indicator-messages.png0000644000015301777760000000222012321504521030435 0ustar pbusernogroup00000000000000‰PNG  IHDR szzôsBIT|dˆ pHYs × ×B(›xtEXtSoftwarewww.inkscape.org›î< IDATX…í—IoEǯ«{–žÅŽãÁV"'J@\X„8˜'¾ 76!ñøˆ !.ÀÍWq @("B"‰mÅVâØŽdg¼Ì’Yº»ŠCï3c#¡X9Ò¼™×]=óÿ×{ÿW¯FŒ1<Ía=Uôgžl€¥¥%µ¹}ÿÇÁ`ðþIŠˆQÊþüã?ý"!pïÞíF¡T{ç“>CDF¾b0áÇß½ÀDsɽÌ\æ^·Û‘ïøî %à–ËZ,A)†Á˜ȘŒéÑ{c :ãÇ÷uü¼ÑX–…ëÖ0¬2!ÐôMà‡à–e!ñjÓ¤B²¢˜ð-ñMäcÒgt`ðÃ\|s"TÊb¿ç b#ÄL=ò^&k£ L'„îãnvYã@˜ž>ÅÖöÖQ?óŸ†RŠæ£&¥Rqln¬ E„F£Áúú:Q<0©72ÌDÇ.ðpû!n¥*3¬úDoi¬®«®z_oéÎ:€¬$nRŒ1¸üŽÖU:V_ó²¡k¤?«Évɵ`ÌËO´4Ü³ØÆžr ħ¡ÈTÜÖf½fퟬï¸oÜwe‡ß),C&}ÁÉVk‡±¢lúHÏ£ŠL’‘ „Ä„JhµfÚ…£Ó™ÍåÍÒJä€Ûû …¤pÊÁFƒAŸßïñøß,Øûï¤+ž@Ù¡Eëþ5·°¾1:gïÍD<5@’EHxxîÕÍp¨wÞÞgÏT<%Àv_G„=à\Yý’Ä_ö"žào#â9Yq,;HŠÒ¹81¸²Wñ”ñÐñ”¨$9ÝÞAÄeÇäÀÆ~ˆ©|@­€AÇ!´)<ÏÛ¹¯Îýa"ÒGD{rÁmˆˆÀ1Æ ×óøÖ¼>·ëéü»[X˜*`R³@‰HŸ)LB ˆˆ g`às9\A¯óîòÇ!»*JˆY¢fTMODƘœ€:8~/-‰®ùëËÓϾ(PßåU1M8>Baiœ÷â+À´d‘ÈTÀýí•óókGÜ;Le*„Œ­J(ñãw+”àõ±6ê°5[-9Äʯµ@kƒ—QÑt»”lqÛˆk‘ÁSÒRÝ @®âÛ8E9-Vp^IEND®B`‚indicator-messages-13.10.1+14.04.20140410/data/icons/32x32/status/indicator-messages-new.png0000644000015301777760000000304712321504521031234 0ustar pbusernogroup00000000000000‰PNG  IHDR szzôsBIT|dˆ pHYs × ×B(›xtEXtSoftwarewww.inkscape.org›î<¤IDATX…½—Kl[dž¿™K^‘ERÔƒ-ǯ0rVHà¸YÝtÕ]ÑnŠ"›.‹EÝw×M @€n³JRhQ5ÒE‹ IåÚ5ìú…Ä×Ü9'‹{/EJ”XFÏÅá ïcþþsî™;FU9®õº›B`È0F@¿PÜò³ž5Ç%ÐënÎUÐ PæAÃdø°<s¿PÜÚ{jzÝM ,ƒV:è*°, К`¾n‚ù¢PÜ’tœÌ¡Ç¶ Z=¬ƒ®Åç(eßn8÷»OÑ~hró æ½cˆe×j~.nuX 2ßYφ?;gì™ÆhðëûÀ.ð%°&¥×ýV³P¼Ú‚'A’puÐèès çÓœÌÞ[²ö,  ú?BüÖ˜Ïû`nƒ¹ 昿Š[~LàÕ×~ûväÜ˪jG ›(•º,U[Tc¯T:T™Ëý„løƒñ½"÷_ÇþÊînÈîn‰æn‘ðO/]úø‡…âÕæ8‘s/ÿò¿2Ö ›¸¯-Tî z Õÿ‘É\›S=š€ÊM  䀑0;‡ $vâÄ·ïüïTOò ˜P ®+E0'ÀŽ&€CdÕ"0ÏÈefH@Œ5¬¯Ÿâ?7®£ñéä]Pⵦ, ”Q]}fÝ%Š® rwbÜ¢+ˆ– ý^NS‡*aZæÂZíŸ|òO^xþ"‘xTUƒj ô!è2°‡¹ËxÿG|ôAB¬]ÅßG|‘DVÀ,³ý`W ūьÄr«¢J¥R¡R©òþN6Ž ªæ]GYAYC¤L¿ÿ.ÎÝGõ,°@åév»ô{`0¼‡—:Þ¯¢\`¯—#NPQETP‰ã__[#Îqù/f.̆!AØU”g“`Ncì9¬md¾A«]c§YE9êY¼œÂû“8¿lLMù@UAŒ‰CaËÐh<Ûàƒß¿Ç¥K/±¼´Dæ°ö9TëxñÛ´ÚŸqëÖǬŸJÞŠÔ•ƒ $³?@‹§ÙÚa­^§ßëÏ$aMlAªÀh8$Ÿ/I„÷>^“™§*ˆJ²j&×&Á§B{w¯M©\¹ˆ4ÆkŒ1â´ c|ÅÚQÁ$y°_‚“_ÝogI? ¾ßdÃ,"Ì.“$bL3Q÷'Û—/-ÊûE:-`éšq0ÑRïÓ%•S2É<@ƒ)Ηf?=¡BÚT&þŸªsX±¸Æ@¿×KG“Iîçü;o¾õƃþÔlèÜÛ€jˆC0Çþ– &…šî?©éD«LlÛÒï,K,ÉÌl) ÈÔ¾Àó4fûõ &@½9=®ý?$¬}Q7¸vgçIEND®B`‚indicator-messages-13.10.1+14.04.20140410/data/icons/48x48/0000755000015301777760000000000012321504777022662 5ustar pbusernogroup00000000000000indicator-messages-13.10.1+14.04.20140410/data/icons/48x48/Makefile.am0000644000015301777760000000002112321504521024672 0ustar pbusernogroup00000000000000SUBDIRS = status indicator-messages-13.10.1+14.04.20140410/data/icons/48x48/status/0000755000015301777760000000000012321504777024205 5ustar pbusernogroup00000000000000indicator-messages-13.10.1+14.04.20140410/data/icons/48x48/status/Makefile.am0000644000015301777760000000026112321504521026223 0ustar pbusernogroup00000000000000 iconsdir = $(datadir)/icons/hicolor/48x48/status icons_DATA = \ application-running.png \ indicator-messages.png \ indicator-messages-new.png EXTRA_DIST = $(icons_DATA) indicator-messages-13.10.1+14.04.20140410/data/icons/48x48/status/indicator-messages.png0000644000015301777760000000311112321504521030453 0ustar pbusernogroup00000000000000‰PNG  IHDR00Wù‡sBIT|dˆ pHYs × ×B(›xtEXtSoftwarewww.inkscape.org›î<ÆIDAThí˜ßoÅÇ?³³{÷î½×±Û±H¶“ŠÚTêß(õÿ(•úÎRß*„@üyAʼ P[©jT€J+ بÓV´vâ„ì½ûcûkîÞ_Nµ,ùX»{göÌÌ÷{Ιsf­D„ƒ,Î~xX9$°ßrH`¿åÀ~Ë!ý–OÀõâÅŸÂo6Ï ²,"ê¡V»q¢”…|õâ_=ûìso×ß$à7›ç~ýÌoV<Ï›ˆNJ\RÁh‹Ý]ܪ»ô÷Xm†÷VΟå°ºg‚,{žGjÒÚ‹° "’a+[WÞfH_ý"ŸgØø¹£ójyΑ¢(RJ)”m´¼Q•’ìf5ëWXÆ,”ˆ •ߤ>A¿ÍˆãxhÜÄÆŒâ(ÎHäJ¡T¶p±xÕRÙŸR}}Òáà‡JÞŸ$)"cÌPµ‘p”CØ šA3ë,b³X8·\ÙbåQø&©¥IB·×Í 2㤅:·woÓ Ãɨ~(Q`Rûwiú±ª{ªsssܸqƒ°{;KØòƒ~׸yó&N{¢êd’Å̉'ùú«¯éõ¢<9J¾óª«ÌHCçÛ¬9š­ë[=:ÚžÐP°ºzš«W¯ÄIžæ,Ö;5ö]5år|.žÛàÚæ Œ ûû!П«µv8sæ Ÿ\üc*@U-¨– ~ê1Áo4¹tù"‹Ç—ЮÀñ@Ê%‚ƒ!VWNó·?T^¨°ˆHbô?ú«t& E+hó÷|ÈÂâAô)dÆqbDL>QFbzf†“'OñÞûpm-d¤¤”7,oåÆQJÑjuxÿƒ÷˜eúÈ‘ÒmEUž${¡ ¼ALÖaqa‘ù¹EÞ½ðZë2W÷ņZä ¸®ËTûþú.SSSÌÏÏ£”²<µ·¼6>„,@™õ ÆÆŽv8qò8»»·ùÃç6ðý&®ë¢µƒR(…äEN+íj Ÿ©Î4ßâÍ·ÞàÖ­––²¸¯BÏÞè㉌­Äö!¬ª†Õ„W®|Î?IE¼öú«<úèÏ8sú§ø~¿¡qã8cHÓ”$Mè†!—._äÚ×8ûäYš~À¥O?fmm;ÚJONpÄX™ PY²8Clnn°¶¶N´ð<—§Ÿþ%›Wùó_þÄöÎQÔ#Žbâ$Æs=¼†‹×ð™™žáØ±cß÷{ïíììç2Òr ÔÊÃËÍÃËÍÃËo€öþÈ–¥©ߌó_[Dö/…L5ø £ÉÐÎu„?)„‹ÐØ¿o»±zUó—má“_ê-µ„h¡öîÚ¢·=¾æ½¶pä|Ûž# õE(ÇPlÏmÛ¬w?±ñjÔ¯®ãxK½åD À`fòøkt›;7hÏnÛÔÊ+7:ûNtÖ[б 8·Ü¹¼Ʀ±fu‹²kG÷:I—k GvÖÕб xÞ3ØŒc8ž‚®´{Gï#ºú¹ýµÈÁºú X…ûœc‰9ä!a÷®^£¹Y?ÝÑr ‚~,º^Ói¤¬^xþi½¥¥ù“ŽþÈwt𬨡‹š¥˜1sHÌd°}k—±nÝš7ÛÒC¿ôì9Ò˜¡bXå¿[Ù⓺žlÕ;;Öï´~oí;¶6A?jB^r±I Ö¯U»»7µËŠ|£3|¬§fC„‡È³ ›qL$Óxlå ¥··kåjGøÄ¾+"Xñ2Î1™Ê@Ó5zfkw“ªªç[Ã'Þ©VÐÀ†Ð‚ã1?¹ÉèÝÖe¬h4¾më¯FÐñUh±Ï¿03dòÝOm6V>Úüa{8r¶çൠϲ("MÏXHL¥Àû/'€@óûäÌ‘!CŠ„&MA.gspZ}o¦1 T¡ ØŒ3·®,çó¿/%¯©2 UÆè1Óœ³~Øh¥÷ÅúÈ J¬@¥²rš‚‘¡Q‹ÙöÑ዇ë2ˆŸ4ê!²ŒÇ,Øì­¡ÁsUúù"€ & "4é!X³svâîÄgÔ7<8p­&CB²DhÔC˜žœÊ$“É„ ¼<2xh¨fC„TŠ ÈtMÆD,nš¦uÓæxuäÂád@Ž~KYU‘¡+b£Ñ¹Ù9ëGCϼ¸Tò@CHSeÈ`»5 ¶ýÍí ‡>ÔN€ªèš;—ÅX4n1Æ>¾xøtÐr",ú^ˆ0BȦ-Æf ùôë·Î‘ì4‰ˆ–ìá—XpHDÐ5©ätn:™LfSñÑ+§þ 9‡ºI91gŸ`œWšIÕS¶NO†0uÈ’]U051‘NNMÝš½uý¥è•S·ù†¢­êÙªT"R‰H º:÷UÀ¹€ì„“Ý!™p75³¦u-þÇ™w3±?³Ž¤WÈíqwk;[ïÏDDvP)5„$¼ …|ј™K›ß\‰|Štš0ß³RQ†…ÂäÙzCr"â<€©K Ï b£cVÁšýìÎ¥£§±°:nsE]YîÃ=J´ºðÞsN°²©{o_þâ’#Ë<¹#íâö>ÇÂjð2­fJð ¢`&öŽ_þê&æ{”…ðVË ä7ÜU)Tžw”P©\~òË|eÞó¼ðÍÝóþk]Eí¿Q}x×ý$Ž9ŽHu 7Ç™#ž ,Õê)¦¦ž#ŠÞüë‰Ë¬­]üáÄ×F@ÑCžç‘Ú¾T¬PŠª¢(ªú¼®ç?]AXšˆ\Âóº*ø>*8æIøŒ)!¢{Eœ[€W{[í`Q €ˆàˆ "Ý#’•¬è™HV• $@ „´[¢úÞµ¿ƒµçˆÅ˜´>Hs³ÖbÕGq:/ˆô€ëþd¥C²X§˜‚Ö^¦~-'tuK’Iâ_B£V'eãš 8â¶BZ­v—DXN¦ƒ¬—P¿y…⣔±öèά½4I­øØÔˆ ¸md­V«¬®­Ò ÃQM‡˜‡j­UTöŒíx‡“Úq*P!Š]äýh4\¹r…°µ<Ó—}‡/HJÀÊ8J ÕIЃÝ{u…$yk_+ÔµPm`m¨n•©TFÏĪ€pàÀ,.¼Ì¡Cóx¾—AÎÒÏvÙÎHæ º‘÷PÖ-T}’øYÒäw¤éÓÀDÖÒ™Â1_ MCR;…µ —ßjßO{…?‡†ÀÂÂaΞ=C'yš,p(ÜÑI£ErPFí,ª T§±¶ÆVøS¢øu¬Îaµ‚j…ÍÍM¶¶~C«ý©!µSÀQ¶¶ÊWÅ7 ™ãpäÈþþÒ >öÑOd1\ù~Yi~Ör/è<ˆ¢ê"(uÐMŒ“²¼Ò$jXÇÚqR;Iœ,€Ü<ó¿èNPùQ„ X˜?ÌŸÿò'>ý©Ï j ³nw땬ÆFmäUD«ë¸^Ì¥Kÿbbâv J’–±¶F”%Ij¨,®dùWÈâ )Ôêufgoå|ž»ïþ,6M ²a;ڵРÕlf¶V±VqŒÃÙý¬­­ò«_?çú”Je\×ÅDrŸã|¿ÄxµFPãç¿ø++Mfff0®)HO †{`¸„ ³Î;?sæŸÜ{Ï}DQÄOžú1G~„#‡o£T*Sò Žcpk-iš’¤ ­0ää©—xùÂËÜßý”K'OÿÅÅ%ŠjÛöäˆïð †\2Ý‘ì¬Ο?ÇââA0†ç¹<øàCœ;–g~ÿ[–›M¢¨MÅÄIŒçzx¾‹ç—¨×êLMMñÀý`ŒÁx†;ŽÝÅ…WÎshþýÅ`„ A¬‚æió‹¹õÖƒŒcÄqŒ1,-ciqi[zW]b÷Õ…­-|¯ÄÂüa.ýçMff¦ûÚEx-Aœ°ZÔ*o¿õ6ɽT*â$Êÿëûày/ð>€*ívˆëöOϰüÞ»}£¯Cã`´„¬ÍƒÖVW *Õ Iv_GtF¬«ßäà¼ÒŽÛ¸žK½¶‡µõuª•J1û¾?‡†!Žc¨ŒWIÒÎ’¤÷;´{<ßYJªJGÏ”°E©ìÀ,Xµ$QBš¤TÇ«¤ißzª<Û Èl{¥w+ÚŸuÒ4Æó]ÔZ’8Ƙgá‘ÂVH†´£ˆ± L† &Ó—~à “•ÛuIœ¥Þv»õþ´Z!a¸‰ëú´Zí!-‹ÙB{ê¶×Qùq®vwî*ÖuzIã„VN@D<ÕÞm\Éf«¾ýÄ·..7—A¶kÚéŹê½Ú’ ÌÍå&Æq.S"ÒB TUí÷€O¶}*Ÿ;sî›jíc©µvÀ~ÝL˧OýãQ ³µd¯*’7s"RÊdd¼ü†aú°ÌÏKJö £l[ªšÂˆ×빤:i`ädžÁ ™z-`õ*`wéÇÿÏnøod7 ì¶Ý$°Ûv“ÀnÛ Oà¿R}÷Q,@q¡IEND®B`‚indicator-messages-13.10.1+14.04.20140410/data/icons/scalable/0000755000015301777760000000000012321504777023631 5ustar pbusernogroup00000000000000indicator-messages-13.10.1+14.04.20140410/data/icons/scalable/Makefile.am0000644000015301777760000000003412321504521025645 0ustar pbusernogroup00000000000000SUBDIRS = status categories indicator-messages-13.10.1+14.04.20140410/data/icons/scalable/categories/0000755000015301777760000000000012321504777025756 5ustar pbusernogroup00000000000000indicator-messages-13.10.1+14.04.20140410/data/icons/scalable/categories/Makefile.am0000644000015301777760000000024412321504521027775 0ustar pbusernogroup00000000000000 iconsdir = $(datadir)/icons/hicolor/scalable/categories icons_DATA = \ applications-email-panel.svg \ applications-chat-panel.svg EXTRA_DIST = $(icons_DATA) indicator-messages-13.10.1+14.04.20140410/data/icons/scalable/categories/applications-chat-panel.svg0000644000015301777760000003400412321504521033163 0ustar pbusernogroup00000000000000 image/svg+xml Person Jakub Steiner http://jimmac.musichall.cz user person ././@LongLink0000000000000000000000000000014600000000000011216 Lustar 00000000000000indicator-messages-13.10.1+14.04.20140410/data/icons/scalable/categories/applications-email-panel.svgindicator-messages-13.10.1+14.04.20140410/data/icons/scalable/categories/applications-email-panel.sv0000644000015301777760000005012212321504521033163 0ustar pbusernogroup00000000000000 image/svg+xml Mail Emblem 2005-02-19 Lapo Calamandrei Mail emblem Jakub Steiner Andreas Nilsson mail message e-mail Lapo Calamandrei, Andreas Nilsson, Novell Inc. indicator-messages-13.10.1+14.04.20140410/data/icons/scalable/status/0000755000015301777760000000000012321504777025154 5ustar pbusernogroup00000000000000indicator-messages-13.10.1+14.04.20140410/data/icons/scalable/status/Makefile.am0000644000015301777760000000026412321504521027175 0ustar pbusernogroup00000000000000 iconsdir = $(datadir)/icons/hicolor/scalable/status icons_DATA = \ application-running.svg \ indicator-messages.svg \ indicator-messages-new.svg EXTRA_DIST = $(icons_DATA) indicator-messages-13.10.1+14.04.20140410/data/icons/scalable/status/indicator-messages.svg0000644000015301777760000004336412321504521031453 0ustar pbusernogroup00000000000000 image/svg+xml Jakub Steiner Andreas Nilsson http://jimmac.musichall.cz indicator-messages-13.10.1+14.04.20140410/data/icons/scalable/status/application-running.svg0000644000015301777760000001473112321504521031647 0ustar pbusernogroup00000000000000 image/svg+xml August 2006 Andreas Nilsson Jakub Steiner http://www.gnome.org next arrow go indicator-messages-13.10.1+14.04.20140410/data/icons/scalable/status/indicator-messages-new.svg0000644000015301777760000004462712321504521032245 0ustar pbusernogroup00000000000000 image/svg+xml Lapo Calamandrei Mail stuff indicator-messages-13.10.1+14.04.20140410/data/icons/24x24/0000755000015301777760000000000012321504777022646 5ustar pbusernogroup00000000000000indicator-messages-13.10.1+14.04.20140410/data/icons/24x24/Makefile.am0000644000015301777760000000002112321504521024656 0ustar pbusernogroup00000000000000SUBDIRS = status indicator-messages-13.10.1+14.04.20140410/data/icons/24x24/status/0000755000015301777760000000000012321504777024171 5ustar pbusernogroup00000000000000indicator-messages-13.10.1+14.04.20140410/data/icons/24x24/status/Makefile.am0000644000015301777760000000026112321504521026207 0ustar pbusernogroup00000000000000 iconsdir = $(datadir)/icons/hicolor/24x24/status icons_DATA = \ application-running.png \ indicator-messages.png \ indicator-messages-new.png EXTRA_DIST = $(icons_DATA) indicator-messages-13.10.1+14.04.20140410/data/icons/24x24/status/indicator-messages.png0000644000015301777760000000160612321504521030446 0ustar pbusernogroup00000000000000‰PNG  IHDRàw=øsRGB®ÎébKGDÿÿÿ ½§“ pHYs × ×B(›xtIMEØ*ÙIDATHÇí”KoUÇ÷1wfj’Æ8&1u\CK ­ ì«_!¶lX J|!ÄU ¨X!Ä‚â$]Uí@‰– AY(ÊcJ¨íñÜ‹±];iXÀ=š£¹wF÷ÿ»çžsܳÿÚÄhðÖ;oÈÉû=–=J¯×¥×ï"„@JT¡B ‚<ÛÙ6-?Na-y?ÿûBƒ‚vë›Ùy¿GÝäÊÝ…@ P>å‘üñgÆ‘ö#üxý‡}BkýÛíîíf«Ùf0È™©Ì2S™ÊÐäk×A‘sìè2Ù­ !ÄÖ{ï¾ï'jggçå?ùè)å¼sî5:¥Îùí,Û~åæÍßÕT7¢§ž~ò¾^¯§laUQÚ9§œ÷*x/C㜠!¼Ò+)RÊ)­1‘½þÓÏÝn·›àÅ>-\jèr—N'pî‡~ÏþGöéJŸC°§ÆIEND®B`‚indicator-messages-13.10.1+14.04.20140410/data/icons/24x24/status/application-running.png0000644000015301777760000000140612321504521030644 0ustar pbusernogroup00000000000000‰PNG  IHDRàw=øsBIT|dˆ pHYsììu85tEXtSoftwarewww.inkscape.org›î<tEXtAuthorAndreas Nilsson+ïä£tEXtCreation TimeAugust 2006ð{ tEXtSourcehttp://www.gnome.org… CUIDATH‰ÝÖ¿kaðïs¹\ü‘jMAÚRBÅx©R²tqóEE:ùˆƒ]¬Äè[D]\Ô­¬\,¸¸ˆS¡E¥Ô©i.=“ó’»çqȉg xis‹/¼ÜËÝñ|xÞ÷Þç=„Ù”P£ÿŸÀÞù±P¾ÞÄÔÁ wòá»w¹#™ý—2c÷§éÜ“HÇ‘BÙÖJŽt/‡æâ\°…²­¤RƒGzÒÉ×ÉãùþŽìÛx%ÓFß@ÿ°>40¿ïä­LGá?w¶Y­£»'±'¥'Ÿ¥Oß>³i€[TËvÛÖÕ«ëÉC£“W6 ˆ+u‡AÚ–„ž¼~àìÔ½ €Ú|Ãü^uj†0@'€B„(¹`á8årŠd³Ü6À®ˆDäwÞ ¢àÔŠ«EãîÂÌåì†3àå;ª*¨UÍcݸº83þ0hð–€Û´ÊZDAÅ(-YëöÅÅÙñWío 0‹üZyM%Åoï*VùÔ‡Ù‰÷íZ—І¬€‹…¯ók oŽ}|zm…ˆT"Rˆhcˆ¢ÌLÄücõó§¹åç“翼}ÝvØ ND1 (ù§( @«V¬­fiíñÒÜÄ 1Û0€€ºw!¢Ú¿Ît?ÀتÙå7§}Ï\4>Vdz×%Èù_òÒV½Ac ÉÄõ@Ñ›0ÚOY³ß—EÑÑIEND®B`‚indicator-messages-13.10.1+14.04.20140410/data/icons/24x24/status/indicator-messages-new.png0000644000015301777760000000203712321504521031234 0ustar pbusernogroup00000000000000‰PNG  IHDRàw=øbKGDùC» pHYs Ö Öoyœ¿IDATHÇÝ•=l[U€¿ûÞslçÅÛùÝüæ§V.P­"U u©ØÉ3+•¢ HH ±AEU„JéÀÈ€b7& ’híØŽÍ‹Ÿý~ƒdœ„!Žt†{ï¹ç;?÷èÂ,êq ­jæâ &PµiFÖ*ÿ`U3à q`d $ œ@ÅMdÏ* ò ¶53’Ýnß5/r‰ƒÌ“ cöýõBéÅo€2ðBVõ´eF²ÅG¬j&Ð, Ó"xJIäŒ}ý\l©†R!Š9õL(½° láVQ,«š¹cFÖœGe`6k.Sõ_rïµ7¾¥B ¶T’ÒÝØ0œ ¥—ÞJ@øµÓƒ«o]}^W|ä¸N´½Û$%V2ï"#Ÿº„¦õÓØ zo‘bßùÇÇ o›‘ìw 4M>\}ù•è€9€ˆà{¿ãûkø~ këETÜùÛt«÷éK]!Ÿs.å?ÐÚ‡®ãÆ Ý ›Ë¢”BDðÅÇ÷DšŽõ×;ð^ñ¼»Í@•x~¸Ý_­Û( ’L$¸ýõm4M D¾¯J¿„µõ&â—Žìo,LePZž¯”RÄã fgføüÆu #ŒÒú~„¦9¾F* Dpœ ˆJ)FFG™}‚7o0†Ñ´"ñVDjsŠbNá{ù.£(•IJúváˆ9p=MÓ˜œ˜Àqn~ù=—V&Ù'0õÅ\óá…ÒÀ¡¼1Ü,oúU| b¨ vvÌHÖ>\×@7t††¢ŠI¾ºóžÃ0gß@ä!…½Ÿ1 !8~]âyø2† >M¥Zèøü+Áõ\¨Õ(•ö¸pþ";»;|zý ’‰<áðºG*u–è Éƒ‡y¡š>‚ë?‰©e€[GÁs]ìFÊ~™3™³Ø¶Ùæâs—(£(¢ÔµšÇøø ›[y‚áÄžgÜS"°ë6¶m³0¿ÌAí€FÃÕøB‘P®§æŸâÇÍu|¯Nï”ч™“sä h8uD¤yIiy¤¨ "Tªeæçùa3whÛ€€aE×s‡R“Ó8NƒÁÁX§3½aÉ«zÃæÔÜ2†¡i}F *UkõÚµw>ð|o!º¦ï—­êj{Ýý£i­Œ @ïR­¥ªË^Zê·ÔëR·¥~/ WT—ããÝá)Üí£ÞXãŸZIEND®B`‚indicator-messages-13.10.1+14.04.20140410/data/Makefile.am0000644000015301777760000000131712321504521022771 0ustar pbusernogroup00000000000000SUBDIRS = icons upstart xdg_autostartdir = /etc/xdg/autostart xdg_autostart_DATA = indicator-messages.desktop %.desktop: %.desktop.in $(AM_V_GEN) sed -e "s|\@pkglibexecdir\@|$(pkglibexecdir)|" $< > $@ upstart_jobsdir = $(datadir)/upstart/sessions/ upstart_jobs_DATA = indicator-messages.conf %.conf: %.conf.in $(AM_V_GEN) sed -e "s|\@pkglibexecdir\@|$(pkglibexecdir)|" $< > $@ gsettings_SCHEMAS = com.canonical.indicator.messages.gschema.xml @GSETTINGS_RULES@ indicatordir = $(INDICATOR_DIR) dist_indicator_DATA = com.canonical.indicator.messages EXTRA_DIST = \ indicator-messages.desktop.in \ indicator-messages.conf.in \ $(gsettings_SCHEMAS) CLEANFILES = \ $(xdg_autostart_DATA) \ $(upstart_jobs_DATA) indicator-messages-13.10.1+14.04.20140410/data/upstart/0000755000015301777760000000000012321504777022452 5ustar pbusernogroup00000000000000indicator-messages-13.10.1+14.04.20140410/data/upstart/Makefile.am0000644000015301777760000000043012321504521024466 0ustar pbusernogroup00000000000000 xdg_autostartdir = $(datadir)/upstart/xdg/autostart xdg_autostart_DATA = indicator-messages.desktop %.desktop: %.desktop.in $(AM_V_GEN) sed -e "s|\@pkglibexecdir\@|$(pkglibexecdir)|" $< > $@ EXTRA_DIST = \ indicator-messages.desktop.in CLEANFILES = \ $(xdg_autostart_DATA) indicator-messages-13.10.1+14.04.20140410/data/upstart/indicator-messages.desktop.in0000644000015301777760000000025212321504521030215 0ustar pbusernogroup00000000000000[Desktop Entry] Type=Application Name=Indicator Messages Exec=@pkglibexecdir@/indicator-messages-service StartupNotify=false Terminal=false OnlyShowIn=Unity; Hidden=true indicator-messages-13.10.1+14.04.20140410/data/indicator-messages.conf.in0000644000015301777760000000031012321504521025762 0ustar pbusernogroup00000000000000description "Indicator Messages Service" start on indicator-services-start stop on desktop-end or indicator-services-end respawn respawn limit 2 10 exec @pkglibexecdir@/indicator-messages-service indicator-messages-13.10.1+14.04.20140410/data/com.canonical.indicator.messages0000644000015301777760000000044612321504521027147 0ustar pbusernogroup00000000000000[Indicator Service] Name=indicator-messages ObjectPath=/com/canonical/indicator/messages Position=50 [desktop] ObjectPath=/com/canonical/indicator/messages/desktop [phone] ObjectPath=/com/canonical/indicator/messages/phone [phone_greeter] ObjectPath=/com/canonical/indicator/messages/phone indicator-messages-13.10.1+14.04.20140410/data/com.canonical.indicator.messages.gschema.xml0000644000015301777760000000073312321504521031353 0ustar pbusernogroup00000000000000 List of applications that are shown in the messaging menu Applications corresponding to the desktop file ids in this list are shown in the messaging menu. [] indicator-messages-13.10.1+14.04.20140410/data/indicator-messages.desktop.in0000644000015301777760000000032312321504521026512 0ustar pbusernogroup00000000000000[Desktop Entry] Type=Application Name=Indicator Messages Exec=@pkglibexecdir@/indicator-messages-service StartupNotify=false Terminal=false OnlyShowIn=Unity;GNOME; AutostartCondition=GNOME3 unless-session gnome indicator-messages-13.10.1+14.04.20140410/NEWS0000644000015301777760000000247212321504521020526 0ustar pbusernogroup00000000000000 12.10.5 * fix crash caused by GError not being cleared (lp #1064314) * fix crash when registering an app that was previously unregistered (lp #1065169) * remove the icon if NULL is passed to source_set_icon (lp #1070421) * call gtk-update-icon-cache (lp #1060618) 12.10.4 * specify fallback icons for the ones with status emblem (lp #1056595) * make icon size consistent with the other indicators (lp #1055966) * libmessaging-menu: fix crash when receiving a invalid desktop id (lp #1058386) 12.10.3 * hide indicator when no application shows in the menu (lp #661059) * remove apps as soon as they are uninstalled (lp #864545) * make generated .gir compatible with vala (lp #104496) * draw counts as lozenges (lp #1046331) * show separators (lp #1048245) * show chat presence in the panel (lp #859905) * improve documentation 12.10.2 * libmessaging-menu: - expand source documentation and add gtk-doc to the build system - added new API: messaging_menu_app_set_source_{label,icon} - fix bug: only one MessagingMenuApp was exported to the messaging menu 12.10.1 * presence icons are shown again * the icon is changed when a source draws attention * the time in source menu items is always kep current * fixed all g-ir-scanner warnings * libmessaging-menu now removes sources when they are activated * fixed several bugs indicator-messages-13.10.1+14.04.20140410/po/0000755000015301777760000000000012321504777020455 5ustar pbusernogroup00000000000000indicator-messages-13.10.1+14.04.20140410/po/POTFILES.in0000644000015301777760000000043712321504521022221 0ustar pbusernogroup00000000000000[encoding: UTF-8] test/indicator-messages-service-activate.c src/im-phone-menu.c src/messages-service.c src/im-desktop-menu.c src/im-menu.c src/im-application-list.c src/gsettingsstrv.c src/gactionmuxer.c libmessaging-menu/messaging-menu-message.c libmessaging-menu/messaging-menu-app.c indicator-messages-13.10.1+14.04.20140410/doc/0000755000015301777760000000000012321504777020604 5ustar pbusernogroup00000000000000indicator-messages-13.10.1+14.04.20140410/doc/reference/0000755000015301777760000000000012321504777022542 5ustar pbusernogroup00000000000000indicator-messages-13.10.1+14.04.20140410/doc/reference/Makefile.am0000644000015301777760000000104412321504521024560 0ustar pbusernogroup00000000000000DOC_MODULE = messaging-menu DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.xml DOC_SOURCE_DIR = $(top_srcdir)/libmessaging-menu MKDB_OPTIONS=--xml-mode --output-format=xml # Used for dependencies. The docs will be rebuilt if any of these change. HFILE_GLOB = $(top_srcdir)/libmessaging-menu/*.h CFILE_GLOB = $(top_srcdir)/libmessaging-menu/*.c IGNORE_HFILES= \ indicator-messages-service.h INCLUDES=-I$(top_srcdir)/libmessaging-menu $(GIO_CFLAGS) GTKDOC_LIBS=$(top_builddir)/libmessaging-menu/libmessaging-menu.la include $(top_srcdir)/gtk-doc.make indicator-messages-13.10.1+14.04.20140410/doc/reference/messaging-menu-docs.xml.in0000644000015301777760000000253512321504521027526 0ustar pbusernogroup00000000000000 ]> Messaging Menu Reference Manual Messaging Menu Reference Manual for libmessaging-menu &version; 2012 Canonical Ltd. API Reference Object Hierarchy API Index Index of deprecated API indicator-messages-13.10.1+14.04.20140410/doc/Makefile.am0000644000015301777760000000002412321504521022617 0ustar pbusernogroup00000000000000SUBDIRS = reference indicator-messages-13.10.1+14.04.20140410/ChangeLog0000644000015301777760000000003112321504521021566 0ustar pbusernogroup00000000000000# Generated by Makefile indicator-messages-13.10.1+14.04.20140410/autogen.sh0000755000015301777760000000024712321504521022026 0ustar pbusernogroup00000000000000#!/bin/sh PKG_NAME="indicator-messages" which gnome-autogen.sh || { echo "You need gnome-common from GNOME SVN" exit 1 } USE_GNOME2_MACROS=1 \ . gnome-autogen.sh indicator-messages-13.10.1+14.04.20140410/MERGE-REVIEW0000644000015301777760000000142012321504521021600 0ustar pbusernogroup00000000000000 This documents the expections that the project has on what both submitters and reviewers should ensure that they've done for a merge into the project. == Submitter Responsibilities == * Ensure the project compiles and the test suite executes without error * Ensure that non-obvious code has comments explaining it * If the change works on specific profiles, please include those in the merge description. == Reviewer Responsibilities == * Did the Jenkins build compile? Pass? Run unit tests successfully? * Are there appropriate tests to cover any new functionality? * If the description says this effects the phone profile: * Run tests indicator-messages/unity8* * If the description says this effects the desktop profile: * Run tests indicator-messages/unity7* indicator-messages-13.10.1+14.04.20140410/src/0000755000015301777760000000000012321504777020626 5ustar pbusernogroup00000000000000indicator-messages-13.10.1+14.04.20140410/src/messages-service.c0000644000015301777760000002005012321504537024226 0ustar pbusernogroup00000000000000/* An indicator to show information that is in messaging applications that the user is using. Copyright 2012 Canonical Ltd. Authors: Ted Gould Lars Uebernickel This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 3, as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, SATISFACTORY QUALITY, 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, see . */ #include #include #include #include #include #include "dbus-data.h" #include "gsettingsstrv.h" #include "indicator-messages-service.h" #include "indicator-messages-application.h" #include "im-phone-menu.h" #include "im-desktop-menu.h" #include "im-application-list.h" #define NUM_STATUSES 5 static ImApplicationList *applications; static IndicatorMessagesService *messages_service; static GHashTable *menus; static GSettings *settings; enum { DBUS_ERROR_BAD_DESKTOP_FILE, }; G_DEFINE_QUARK(indicator_messages_dbus_error, dbus_error); static gboolean register_application (IndicatorMessagesService *service, GDBusMethodInvocation *invocation, const gchar *desktop_id, const gchar *menu_path, gpointer user_data) { GDBusConnection *bus; const gchar *sender; if (!im_application_list_add (applications, desktop_id)) { g_dbus_method_invocation_return_error(invocation, dbus_error_quark(), DBUS_ERROR_BAD_DESKTOP_FILE, "Unable to find or parse desktop file for application '%s'", desktop_id); return TRUE; } bus = g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (service)); sender = g_dbus_method_invocation_get_sender (invocation); im_application_list_set_remote (applications, desktop_id, bus, sender, menu_path); g_settings_strv_append_unique (settings, "applications", desktop_id); indicator_messages_service_complete_register_application (service, invocation); return TRUE; } static gboolean unregister_application (IndicatorMessagesService *service, GDBusMethodInvocation *invocation, const gchar *desktop_id, gpointer user_data) { im_application_list_remove (applications, desktop_id); g_settings_strv_remove (settings, "applications", desktop_id); indicator_messages_service_complete_unregister_application (service, invocation); return TRUE; } static gboolean set_status (IndicatorMessagesService *service, GDBusMethodInvocation *invocation, const gchar *desktop_id, const gchar *status_str, gpointer user_data) { GDesktopAppInfo *appinfo; const gchar *id; g_return_val_if_fail (g_str_equal (status_str, "available") || g_str_equal (status_str, "away")|| g_str_equal (status_str, "busy") || g_str_equal (status_str, "invisible") || g_str_equal (status_str, "offline"), FALSE); appinfo = g_desktop_app_info_new (desktop_id); if (!appinfo) { g_warning ("could not set status for '%s', there's no desktop file with that id", desktop_id); return TRUE; } id = g_app_info_get_id (G_APP_INFO (appinfo)); im_application_list_set_status(applications, id, status_str); indicator_messages_service_complete_set_status (service, invocation); g_object_unref (appinfo); return TRUE; } static gboolean app_stopped (IndicatorMessagesService *service, GDBusMethodInvocation *invocation, const gchar *desktop_id, gpointer user_data) { GDesktopAppInfo *appinfo; const gchar *id; appinfo = g_desktop_app_info_new (desktop_id); if (!appinfo) return TRUE; id = g_app_info_get_id (G_APP_INFO (appinfo)); im_application_list_set_remote (applications, id, NULL, NULL, NULL); indicator_messages_service_complete_application_stopped_running (service, invocation); g_object_unref (appinfo); return TRUE; } /* The status has been set by the user, let's tell the world! */ static void status_set_by_user (ImApplicationList * list, const gchar * status, gpointer user_data) { indicator_messages_service_emit_status_changed(messages_service, status); return; } static void on_bus_acquired (GDBusConnection *bus, const gchar *name, gpointer user_data) { GError *error = NULL; GHashTableIter it; const gchar *profile; ImMenu *menu; /* Register some errors */ g_dbus_error_register_error (dbus_error_quark(), DBUS_ERROR_BAD_DESKTOP_FILE, "BadDesktopFile"); g_dbus_connection_export_action_group (bus, INDICATOR_MESSAGES_DBUS_OBJECT, im_application_list_get_action_group (applications), &error); if (error) { g_warning ("unable to export action group on dbus: %s", error->message); g_error_free (error); return; } g_hash_table_iter_init (&it, menus); while (g_hash_table_iter_next (&it, (gpointer *) &profile, (gpointer *) &menu)) { gchar *object_path; object_path = g_strconcat (INDICATOR_MESSAGES_DBUS_OBJECT, "/", profile, NULL); if (!im_menu_export (menu, bus, object_path, &error)) { g_warning ("unable to export menu for profile '%s': %s", profile, error->message); g_clear_error (&error); } g_free (object_path); } g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (messages_service), bus, INDICATOR_MESSAGES_DBUS_SERVICE_OBJECT, &error); if (error) { g_warning ("unable to export messages service on dbus: %s", error->message); g_error_free (error); return; } } static void on_name_lost (GDBusConnection *bus, const gchar *name, gpointer user_data) { GMainLoop *mainloop = user_data; g_main_loop_quit (mainloop); } static gboolean sig_term_handler (gpointer user_data) { GMainLoop *mainloop = user_data; g_main_loop_quit (mainloop); return FALSE; } int main (int argc, char ** argv) { GMainLoop * mainloop = NULL; GBusNameOwnerFlags flags; /* Glib init */ #if G_ENCODE_VERSION(GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION) <= GLIB_VERSION_2_34 g_type_init(); #endif mainloop = g_main_loop_new (NULL, FALSE); /* Setting up i18n and gettext. Apparently, we need all of these. */ setlocale (LC_ALL, ""); bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR); textdomain (GETTEXT_PACKAGE); /* Bring up the service DBus interface */ messages_service = indicator_messages_service_skeleton_new (); flags = G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT; if (argc >= 2 && g_str_equal (argv[1], "--replace")) flags |= G_BUS_NAME_OWNER_FLAGS_REPLACE; g_bus_own_name (G_BUS_TYPE_SESSION, "com.canonical.indicator.messages", flags, on_bus_acquired, NULL, on_name_lost, mainloop, NULL); g_signal_connect (messages_service, "handle-register-application", G_CALLBACK (register_application), NULL); g_signal_connect (messages_service, "handle-unregister-application", G_CALLBACK (unregister_application), NULL); g_signal_connect (messages_service, "handle-set-status", G_CALLBACK (set_status), NULL); g_signal_connect (messages_service, "handle-application-stopped-running", G_CALLBACK (app_stopped), NULL); applications = im_application_list_new (); g_signal_connect (applications, "status-set", G_CALLBACK (status_set_by_user), NULL); settings = g_settings_new ("com.canonical.indicator.messages"); { gchar **app_ids; gchar **id; app_ids = g_settings_get_strv (settings, "applications"); for (id = app_ids; *id; id++) im_application_list_add (applications, *id); g_strfreev (app_ids); } menus = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, g_object_unref); g_hash_table_insert (menus, "phone", im_phone_menu_new (applications)); g_hash_table_insert (menus, "desktop", im_desktop_menu_new (applications)); g_unix_signal_add(SIGTERM, sig_term_handler, mainloop); g_main_loop_run(mainloop); /* Clean up */ g_hash_table_unref (menus); g_object_unref (messages_service); g_object_unref (settings); g_object_unref (applications); return 0; } indicator-messages-13.10.1+14.04.20140410/src/gactionmuxer.c0000644000015301777760000004023112321504521023462 0ustar pbusernogroup00000000000000/* * Copyright 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License version 3, as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranties of * MERCHANTABILITY, SATISFACTORY QUALITY, 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, see . * * Authors: * Lars Uebernickel * Ryan Lortie */ #include "gactionmuxer.h" #include /* * SECTION:gactionmuxer * @short_description: Aggregate several action groups * * #GActionMuxer is a #GActionGroup that is capable of containing other * #GActionGroup instances. * * The typical use is aggregating all of the actions applicable to a * particular context into a single action group, with namespacing. * * Consider the case of two action groups -- one containing actions * applicable to an entire application (such as 'quit') and one * containing actions applicable to a particular window in the * application (such as 'fullscreen'). * * In this case, each of these action groups could be added to a * #GActionMuxer with the prefixes "app" and "win", respectively. This * would expose the actions as "app.quit" and "win.fullscreen" on the * #GActionGroup interface presented by the #GActionMuxer. * * Activations and state change requests on the #GActionMuxer are wired * through to the underlying action group in the expected way. */ typedef GObjectClass GActionMuxerClass; struct _GActionMuxer { GObject parent; GActionGroup *global_actions; GHashTable *groups; /* prefix -> subgroup */ GHashTable *reverse; /* subgroup -> prefix */ }; static void g_action_muxer_group_init (GActionGroupInterface *iface); static void g_action_muxer_dispose (GObject *object); static void g_action_muxer_finalize (GObject *object); static void g_action_muxer_disconnect_group (GActionMuxer *muxer, GActionGroup *subgroup); static gchar ** g_action_muxer_list_actions (GActionGroup *group); static void g_action_muxer_activate_action (GActionGroup *group, const gchar *action_name, GVariant *parameter); static void g_action_muxer_change_action_state (GActionGroup *group, const gchar *action_name, GVariant *value); static gboolean g_action_muxer_query_action (GActionGroup *group, const gchar *action_name, gboolean *enabled, const GVariantType **parameter_type, const GVariantType **state_type, GVariant **state_hint, GVariant **state); static void g_action_muxer_action_added (GActionGroup *group, gchar *action_name, gpointer user_data); static void g_action_muxer_action_removed (GActionGroup *group, gchar *action_name, gpointer user_data); static void g_action_muxer_action_state_changed (GActionGroup *group, gchar *action_name, GVariant *value, gpointer user_data); static void g_action_muxer_action_enabled_changed (GActionGroup *group, gchar *action_name, gboolean enabled, gpointer user_data); G_DEFINE_TYPE_WITH_CODE (GActionMuxer, g_action_muxer, G_TYPE_OBJECT, G_IMPLEMENT_INTERFACE (G_TYPE_ACTION_GROUP, g_action_muxer_group_init)); static void g_action_muxer_class_init (GObjectClass *klass) { klass->dispose = g_action_muxer_dispose; klass->finalize = g_action_muxer_finalize; } static void g_action_muxer_init (GActionMuxer *muxer) { muxer->global_actions = NULL; muxer->groups = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref); muxer->reverse = g_hash_table_new (g_direct_hash, g_direct_equal); } static void g_action_muxer_group_init (GActionGroupInterface *iface) { iface->list_actions = g_action_muxer_list_actions; iface->activate_action = g_action_muxer_activate_action; iface->change_action_state = g_action_muxer_change_action_state; iface->query_action = g_action_muxer_query_action; } static void g_action_muxer_dispose (GObject *object) { GActionMuxer *muxer = G_ACTION_MUXER (object); GHashTableIter it; GActionGroup *subgroup; if (muxer->global_actions) { g_action_muxer_disconnect_group (muxer, muxer->global_actions); g_clear_object (&muxer->global_actions); } g_hash_table_iter_init (&it, muxer->groups); while (g_hash_table_iter_next (&it, NULL, (gpointer *) &subgroup)) g_action_muxer_disconnect_group (muxer, subgroup); g_hash_table_remove_all (muxer->groups); g_hash_table_remove_all (muxer->reverse); } static void g_action_muxer_finalize (GObject *object) { GActionMuxer *muxer = G_ACTION_MUXER (object); g_hash_table_unref (muxer->groups); g_hash_table_unref (muxer->reverse); G_OBJECT_CLASS (g_action_muxer_parent_class)->finalize (object); } static GActionGroup * g_action_muxer_lookup_group (GActionMuxer *muxer, const gchar *full_name, const gchar **action_name) { const gchar *sep; GActionGroup *group; sep = strchr (full_name, '.'); if (sep) { gchar *prefix; prefix = g_strndup (full_name, sep - full_name); group = g_hash_table_lookup (muxer->groups, prefix); g_free (prefix); if (action_name) *action_name = sep + 1; } else { group = muxer->global_actions; if (action_name) *action_name = full_name; } return group; } static gchar * g_action_muxer_lookup_full_name (GActionMuxer *muxer, GActionGroup *subgroup, const gchar *action_name) { gpointer prefix; if (subgroup == muxer->global_actions) return g_strdup (action_name); if (g_hash_table_lookup_extended (muxer->reverse, subgroup, NULL, &prefix)) return g_strdup_printf ("%s.%s", (gchar *) prefix, action_name); return NULL; } static void g_action_muxer_disconnect_group (GActionMuxer *muxer, GActionGroup *subgroup) { gchar **actions; gchar **action; actions = g_action_group_list_actions (subgroup); for (action = actions; *action; action++) g_action_muxer_action_removed (subgroup, *action, muxer); g_strfreev (actions); g_signal_handlers_disconnect_by_func (subgroup, g_action_muxer_action_added, muxer); g_signal_handlers_disconnect_by_func (subgroup, g_action_muxer_action_removed, muxer); g_signal_handlers_disconnect_by_func (subgroup, g_action_muxer_action_enabled_changed, muxer); g_signal_handlers_disconnect_by_func (subgroup, g_action_muxer_action_state_changed, muxer); } static gchar ** g_action_muxer_list_actions (GActionGroup *group) { GActionMuxer *muxer = G_ACTION_MUXER (group); GHashTableIter it; GArray *all_actions; gchar *prefix; GActionGroup *subgroup; gchar **actions; gchar **a; all_actions = g_array_sized_new (TRUE, FALSE, sizeof (gchar *), 8); if (muxer->global_actions) { actions = g_action_group_list_actions (muxer->global_actions); for (a = actions; *a; a++) { gchar *name = g_strdup (*a); g_array_append_val (all_actions, name); } g_strfreev (actions); } g_hash_table_iter_init (&it, muxer->groups); while (g_hash_table_iter_next (&it, (gpointer *) &prefix, (gpointer *) &subgroup)) { actions = g_action_group_list_actions (subgroup); for (a = actions; *a; a++) { gchar *full_name = g_strdup_printf ("%s.%s", prefix, *a); g_array_append_val (all_actions, full_name); } g_strfreev (actions); } return (gchar **) g_array_free (all_actions, FALSE); } static void g_action_muxer_activate_action (GActionGroup *group, const gchar *action_name, GVariant *parameter) { GActionMuxer *muxer = G_ACTION_MUXER (group); GActionGroup *subgroup; const gchar *action; g_return_if_fail (action_name != NULL); subgroup = g_action_muxer_lookup_group (muxer, action_name, &action); if (subgroup) g_action_group_activate_action (subgroup, action, parameter); } static void g_action_muxer_change_action_state (GActionGroup *group, const gchar *action_name, GVariant *value) { GActionMuxer *muxer = G_ACTION_MUXER (group); GActionGroup *subgroup; const gchar *action; g_return_if_fail (action_name != NULL); subgroup = g_action_muxer_lookup_group (muxer, action_name, &action); if (subgroup) g_action_group_change_action_state (subgroup, action, value); } static gboolean g_action_muxer_query_action (GActionGroup *group, const gchar *action_name, gboolean *enabled, const GVariantType **parameter_type, const GVariantType **state_type, GVariant **state_hint, GVariant **state) { GActionMuxer *muxer = G_ACTION_MUXER (group); GActionGroup *subgroup; const gchar *action; g_return_val_if_fail (action_name != NULL, FALSE); subgroup = g_action_muxer_lookup_group (muxer, action_name, &action); if (!subgroup) return FALSE; return g_action_group_query_action (subgroup, action, enabled, parameter_type, state_type, state_hint, state); } static void g_action_muxer_action_added (GActionGroup *group, gchar *action_name, gpointer user_data) { GActionMuxer *muxer = user_data; gchar *full_name; full_name = g_action_muxer_lookup_full_name (muxer, group, action_name); if (full_name) { g_action_group_action_added (G_ACTION_GROUP (muxer), full_name); g_free (full_name); } } static void g_action_muxer_action_removed (GActionGroup *group, gchar *action_name, gpointer user_data) { GActionMuxer *muxer = user_data; gchar *full_name; full_name = g_action_muxer_lookup_full_name (muxer, group, action_name); if (full_name) { g_action_group_action_removed (G_ACTION_GROUP (muxer), full_name); g_free (full_name); } } static void g_action_muxer_action_state_changed (GActionGroup *group, gchar *action_name, GVariant *value, gpointer user_data) { GActionMuxer *muxer = user_data; gchar *full_name; full_name = g_action_muxer_lookup_full_name (muxer, group, action_name); if (full_name) { g_action_group_action_state_changed (G_ACTION_GROUP (muxer), full_name, value); g_free (full_name); } } static void g_action_muxer_action_enabled_changed (GActionGroup *group, gchar *action_name, gboolean enabled, gpointer user_data) { GActionMuxer *muxer = user_data; gchar *full_name; full_name = g_action_muxer_lookup_full_name (muxer, group, action_name); if (full_name) { g_action_group_action_enabled_changed (G_ACTION_GROUP (muxer), full_name, enabled); g_free (full_name); } } /* * g_action_muxer_new: * * Creates a new #GActionMuxer. */ GActionMuxer * g_action_muxer_new (void) { return g_object_new (G_TYPE_ACTION_MUXER, NULL); } /* * g_action_muxer_insert: * @muxer: a #GActionMuxer * @prefix: (allow-none): the prefix string for the action group, or NULL * @group: (allow-none): a #GActionGroup, or NULL * * Adds the actions in @group to the list of actions provided by @muxer. * @prefix is prefixed to each action name, such that for each action * x in @group, there is an equivalent action * @prefix.x in @muxer. * * For example, if @prefix is "app" and @group contains an * action called "quit", then @muxer will now contain an * action called "app.quit". * * If @prefix is NULL, the actions in @group will be added * to @muxer without prefix. * * If @group is NULL, this function has the same effect as * calling g_action_muxer_remove() with @prefix. * * There may only be one group per prefix (including the * NULL-prefix). If a group has been added with @prefix in * a previous call to this function, it will be removed. * * @prefix must not contain a dot ('.'). */ void g_action_muxer_insert (GActionMuxer *muxer, const gchar *prefix, GActionGroup *group) { gchar *prefix_copy; gchar **actions; gchar **action; g_return_if_fail (G_IS_ACTION_MUXER (muxer)); g_return_if_fail (group == NULL || G_IS_ACTION_GROUP (group)); g_action_muxer_remove (muxer, prefix); if (group == NULL) return; if (prefix) { prefix_copy = g_strdup (prefix); g_hash_table_insert (muxer->groups, prefix_copy, g_object_ref (group)); g_hash_table_insert (muxer->reverse, group, prefix_copy); } else muxer->global_actions = g_object_ref (group); actions = g_action_group_list_actions (group); for (action = actions; *action; action++) g_action_muxer_action_added (group, *action, muxer); g_strfreev (actions); g_signal_connect (group, "action-added", G_CALLBACK (g_action_muxer_action_added), muxer); g_signal_connect (group, "action-removed", G_CALLBACK (g_action_muxer_action_removed), muxer); g_signal_connect (group, "action-enabled-changed", G_CALLBACK (g_action_muxer_action_enabled_changed), muxer); g_signal_connect (group, "action-state-changed", G_CALLBACK (g_action_muxer_action_state_changed), muxer); } /* * g_action_muxer_remove: * @muxer: a #GActionMuxer * @prefix: (allow-none): the prefix of the action group to remove, or NULL * * Removes a #GActionGroup from the #GActionMuxer. */ void g_action_muxer_remove (GActionMuxer *muxer, const gchar *prefix) { GActionGroup *subgroup; g_return_if_fail (G_IS_ACTION_MUXER (muxer)); subgroup = prefix ? g_hash_table_lookup (muxer->groups, prefix) : muxer->global_actions; if (!subgroup) return; g_action_muxer_disconnect_group (muxer, subgroup); if (prefix) { g_hash_table_remove (muxer->groups, prefix); g_hash_table_remove (muxer->reverse, subgroup); } else g_clear_object (&muxer->global_actions); } GActionGroup * g_action_muxer_get_group (GActionMuxer *muxer, const gchar *prefix) { g_return_val_if_fail (G_IS_ACTION_MUXER (muxer), NULL); return prefix ? g_hash_table_lookup (muxer->groups, prefix) : muxer->global_actions; } indicator-messages-13.10.1+14.04.20140410/src/indicator-desktop-shortcuts.c0000644000015301777760000005136712321504521026450 0ustar pbusernogroup00000000000000/* A small file to parse through the actions that are available in the desktop file and making those easily usable. Copyright 2010 Canonical Ltd. Authors: Ted Gould This library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 3.0 as published by the Free Software Foundation. This library 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 version 3.0 for more details. You should have received a copy of the GNU General Public License along with this library. If not, see . */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "indicator-desktop-shortcuts.h" #define ACTIONS_KEY "Actions" #define ACTION_GROUP_PREFIX "Desktop Action" #define OLD_GROUP_SUFFIX "Shortcut Group" #define OLD_SHORTCUTS_KEY "X-Ayatana-Desktop-Shortcuts" #define OLD_ENVIRON_KEY "TargetEnvironment" #define PROP_DESKTOP_FILE_S "desktop-file" #define PROP_IDENTITY_S "identity" typedef enum _actions_t actions_t; enum _actions_t { ACTIONS_NONE, ACTIONS_XAYATANA, ACTIONS_DESKTOP_SPEC }; typedef struct _IndicatorDesktopShortcutsPrivate IndicatorDesktopShortcutsPrivate; struct _IndicatorDesktopShortcutsPrivate { actions_t actions; GKeyFile * keyfile; gchar * identity; GArray * nicks; gchar * domain; }; enum { PROP_0, PROP_DESKTOP_FILE, PROP_IDENTITY }; #define INDICATOR_DESKTOP_SHORTCUTS_GET_PRIVATE(o) \ (G_TYPE_INSTANCE_GET_PRIVATE ((o), INDICATOR_TYPE_DESKTOP_SHORTCUTS, IndicatorDesktopShortcutsPrivate)) static void indicator_desktop_shortcuts_class_init (IndicatorDesktopShortcutsClass *klass); static void indicator_desktop_shortcuts_init (IndicatorDesktopShortcuts *self); static void indicator_desktop_shortcuts_dispose (GObject *object); static void indicator_desktop_shortcuts_finalize (GObject *object); static void set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec); static void get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec); static void parse_keyfile (IndicatorDesktopShortcuts * ids); static gboolean should_show (GKeyFile * keyfile, const gchar * group, const gchar * identity, gboolean should_have_target); G_DEFINE_TYPE (IndicatorDesktopShortcuts, indicator_desktop_shortcuts, G_TYPE_OBJECT); /* Build up the class */ static void indicator_desktop_shortcuts_class_init (IndicatorDesktopShortcutsClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); g_type_class_add_private (klass, sizeof (IndicatorDesktopShortcutsPrivate)); object_class->dispose = indicator_desktop_shortcuts_dispose; object_class->finalize = indicator_desktop_shortcuts_finalize; /* Property funcs */ object_class->set_property = set_property; object_class->get_property = get_property; g_object_class_install_property(object_class, PROP_DESKTOP_FILE, g_param_spec_string(PROP_DESKTOP_FILE_S, "The path of the desktop file to read", "A path to a desktop file that we'll look for shortcuts in.", NULL, G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property(object_class, PROP_IDENTITY, g_param_spec_string(PROP_IDENTITY_S, "The string that represents the identity that we're acting as.", "Used to process ShowIn and NotShownIn fields of the desktop shortcust to get the proper list.", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT_ONLY)); return; } /* Initialize instance data */ static void indicator_desktop_shortcuts_init (IndicatorDesktopShortcuts *self) { IndicatorDesktopShortcutsPrivate * priv = INDICATOR_DESKTOP_SHORTCUTS_GET_PRIVATE(self); priv->keyfile = NULL; priv->identity = NULL; priv->domain = NULL; priv->nicks = g_array_new(TRUE, TRUE, sizeof(gchar *)); priv->actions = ACTIONS_NONE; return; } /* Clear object references */ static void indicator_desktop_shortcuts_dispose (GObject *object) { IndicatorDesktopShortcutsPrivate * priv = INDICATOR_DESKTOP_SHORTCUTS_GET_PRIVATE(object); if (priv->keyfile) { g_key_file_free(priv->keyfile); priv->keyfile = NULL; } G_OBJECT_CLASS (indicator_desktop_shortcuts_parent_class)->dispose (object); return; } /* Free all memory */ static void indicator_desktop_shortcuts_finalize (GObject *object) { IndicatorDesktopShortcutsPrivate * priv = INDICATOR_DESKTOP_SHORTCUTS_GET_PRIVATE(object); if (priv->identity != NULL) { g_free(priv->identity); priv->identity = NULL; } if (priv->domain != NULL) { g_free(priv->domain); priv->domain = NULL; } if (priv->nicks != NULL) { gint i; for (i = 0; i < priv->nicks->len; i++) { gchar * nick = g_array_index(priv->nicks, gchar *, i); g_free(nick); } g_array_free(priv->nicks, TRUE); priv->nicks = NULL; } G_OBJECT_CLASS (indicator_desktop_shortcuts_parent_class)->finalize (object); return; } /* Sets one of the two properties we have, only at construction though */ static void set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec) { g_return_if_fail(INDICATOR_IS_DESKTOP_SHORTCUTS(object)); IndicatorDesktopShortcutsPrivate * priv = INDICATOR_DESKTOP_SHORTCUTS_GET_PRIVATE(object); switch(prop_id) { case PROP_DESKTOP_FILE: { if (priv->keyfile != NULL) { g_key_file_free(priv->keyfile); priv->keyfile = NULL; priv->actions = ACTIONS_NONE; } GError * error = NULL; GKeyFile * keyfile = g_key_file_new(); g_key_file_load_from_file(keyfile, g_value_get_string(value), G_KEY_FILE_NONE, &error); if (error != NULL) { g_warning("Unable to load keyfile from file '%s': %s", g_value_get_string(value), error->message); g_error_free(error); g_key_file_free(keyfile); break; } /* Always prefer the desktop spec if we can get it */ if (priv->actions == ACTIONS_NONE && g_key_file_has_key(keyfile, G_KEY_FILE_DESKTOP_GROUP, ACTIONS_KEY, NULL)) { priv->actions = ACTIONS_DESKTOP_SPEC; } /* But fallback if we can't */ if (priv->actions == ACTIONS_NONE && g_key_file_has_key(keyfile, G_KEY_FILE_DESKTOP_GROUP, OLD_SHORTCUTS_KEY, NULL)) { priv->actions = ACTIONS_XAYATANA; g_warning("Desktop file '%s' is using a deprecated format for its actions that will be dropped soon.", g_value_get_string(value)); } if (priv->actions == ACTIONS_NONE) { g_key_file_free(keyfile); break; } priv->keyfile = keyfile; parse_keyfile(INDICATOR_DESKTOP_SHORTCUTS(object)); break; } case PROP_IDENTITY: if (priv->identity != NULL) { g_warning("Identity already set to '%s' and trying to set it to '%s'.", priv->identity, g_value_get_string(value)); return; } priv->identity = g_value_dup_string(value); parse_keyfile(INDICATOR_DESKTOP_SHORTCUTS(object)); break; /* *********************** */ default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } return; } /* Gets either the desktop file our the identity. */ static void get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec) { g_return_if_fail(INDICATOR_IS_DESKTOP_SHORTCUTS(object)); IndicatorDesktopShortcutsPrivate * priv = INDICATOR_DESKTOP_SHORTCUTS_GET_PRIVATE(object); switch(prop_id) { case PROP_IDENTITY: g_value_set_string(value, priv->identity); break; /* *********************** */ default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } return; } /* Checks to see if we can, and if we can it goes through and parses the keyfile entries. */ static void parse_keyfile (IndicatorDesktopShortcuts * ids) { IndicatorDesktopShortcutsPrivate * priv = INDICATOR_DESKTOP_SHORTCUTS_GET_PRIVATE(ids); if (priv->keyfile == NULL) { return; } if (priv->identity == NULL) { return; } /* Remove a previous translation domain if we had one from a previously parsed file. */ if (priv->domain != NULL) { g_free(priv->domain); priv->domain = NULL; } /* Check to see if there is a custom translation domain that we should take into account. */ if (priv->domain == NULL && g_key_file_has_key(priv->keyfile, G_KEY_FILE_DESKTOP_GROUP, "X-GNOME-Gettext-Domain", NULL)) { priv->domain = g_key_file_get_string(priv->keyfile, G_KEY_FILE_DESKTOP_GROUP, "X-GNOME-Gettext-Domain", NULL); } if (priv->domain == NULL && g_key_file_has_key(priv->keyfile, G_KEY_FILE_DESKTOP_GROUP, "X-Ubuntu-Gettext-Domain", NULL)) { priv->domain = g_key_file_get_string(priv->keyfile, G_KEY_FILE_DESKTOP_GROUP, "X-Ubuntu-Gettext-Domain", NULL); } /* We need to figure out what we're looking for and what we want to look for in the rest of the file */ const gchar * list_name = NULL; const gchar * group_format = NULL; gboolean should_have_target = FALSE; switch (priv->actions) { case ACTIONS_NONE: /* None, let's just get outta here */ return; case ACTIONS_XAYATANA: list_name = OLD_SHORTCUTS_KEY; group_format = "%s " OLD_GROUP_SUFFIX; should_have_target = TRUE; break; case ACTIONS_DESKTOP_SPEC: list_name = ACTIONS_KEY; group_format = ACTION_GROUP_PREFIX " %s"; should_have_target = FALSE; break; default: g_assert_not_reached(); return; } /* Okay, we've got everything we need. Let's get it on! */ gint i; gsize num_nicks = 0; gchar ** nicks = g_key_file_get_string_list(priv->keyfile, G_KEY_FILE_DESKTOP_GROUP, list_name, &num_nicks, NULL); /* If there is an error from get_string_list num_nicks should still be zero, so this loop will drop out. */ for (i = 0; i < num_nicks; i++) { /* g_debug("Looking at group nick %s", nicks[i]); */ gchar * groupname = g_strdup_printf(group_format, nicks[i]); if (!g_key_file_has_group(priv->keyfile, groupname)) { g_warning("Unable to find group '%s'", groupname); g_free(groupname); continue; } if (!should_show(priv->keyfile, G_KEY_FILE_DESKTOP_GROUP, priv->identity, FALSE)) { g_free(groupname); continue; } if (!should_show(priv->keyfile, groupname, priv->identity, should_have_target)) { g_free(groupname); continue; } gchar * nickalloc = g_strdup(nicks[i]); g_array_append_val(priv->nicks, nickalloc); g_free(groupname); } if (nicks != NULL) { g_strfreev(nicks); } return; } /* Checks the ONLY_SHOW_IN and NOT_SHOW_IN keys for a group to see if we should be showing ourselves. */ static gboolean should_show (GKeyFile * keyfile, const gchar * group, const gchar * identity, gboolean should_have_target) { if (should_have_target && g_key_file_has_key(keyfile, group, OLD_ENVIRON_KEY, NULL)) { /* If we've got this key, we're going to return here and not process the deprecated keys. */ gint j; gsize num_env = 0; gchar ** envs = g_key_file_get_string_list(keyfile, group, OLD_ENVIRON_KEY, &num_env, NULL); for (j = 0; j < num_env; j++) { if (g_strcmp0(envs[j], identity) == 0) { break; } } if (envs != NULL) { g_strfreev(envs); } if (j == num_env) { return FALSE; } return TRUE; } /* If there is a list of OnlyShowIn entries we need to check to see if we're in that list. If not, we drop this nick */ if (g_key_file_has_key(keyfile, group, G_KEY_FILE_DESKTOP_KEY_ONLY_SHOW_IN, NULL)) { gint j; gsize num_only = 0; gchar ** onlies = g_key_file_get_string_list(keyfile, group, G_KEY_FILE_DESKTOP_KEY_ONLY_SHOW_IN, &num_only, NULL); for (j = 0; j < num_only; j++) { if (g_strcmp0(onlies[j], identity) == 0) { break; } } if (onlies != NULL) { g_strfreev(onlies); } if (j == num_only) { return FALSE; } } /* If there is a NotShowIn entry we need to make sure that we're not in that list. If we are, we need to drop out. */ if (g_key_file_has_key(keyfile, group, G_KEY_FILE_DESKTOP_KEY_NOT_SHOW_IN, NULL)) { gint j; gsize num_not = 0; gchar ** nots = g_key_file_get_string_list(keyfile, group, G_KEY_FILE_DESKTOP_KEY_NOT_SHOW_IN, &num_not, NULL); for (j = 0; j < num_not; j++) { if (g_strcmp0(nots[j], identity) == 0) { break; } } if (nots != NULL) { g_strfreev(nots); } if (j != num_not) { return FALSE; } } return TRUE; } /* Looks through the nicks to see if this one is in the list, and thus valid to use. */ static gboolean is_valid_nick (gchar ** list, const gchar * nick) { if (*list == NULL) return FALSE; /* g_debug("Checking Nick: %s", list[0]); */ if (g_strcmp0(list[0], nick) == 0) return TRUE; return is_valid_nick(&list[1], nick); } /* API */ /** indicator_desktop_shortcuts_new: @file: The desktop file that would be opened to find the actions. @identity: This is a string that represents the identity that should be used in searching those actions. It relates to the ShowIn and NotShownIn properties. This function creates the basic object. It involves opening the file and parsing it. It could potentially block on IO. At the end of the day you'll have a fully functional object. Return value: A new #IndicatorDesktopShortcuts object. */ IndicatorDesktopShortcuts * indicator_desktop_shortcuts_new (const gchar * file, const gchar * identity) { GObject * obj = g_object_new(INDICATOR_TYPE_DESKTOP_SHORTCUTS, PROP_DESKTOP_FILE_S, file, PROP_IDENTITY_S, identity, NULL); return INDICATOR_DESKTOP_SHORTCUTS(obj); } /** indicator_desktop_shortcuts_get_nicks: @ids: The #IndicatorDesktopShortcuts object to look in Give you the list of commands that are available for this desktop file given the identity that was passed in at creation. This will filter out the various items in the desktop file. These nicks can then be used as keys for working with the desktop file. Return value: A #NULL terminated list of strings. This memory is managed by the @ids object. */ const gchar ** indicator_desktop_shortcuts_get_nicks (IndicatorDesktopShortcuts * ids) { g_return_val_if_fail(INDICATOR_IS_DESKTOP_SHORTCUTS(ids), NULL); IndicatorDesktopShortcutsPrivate * priv = INDICATOR_DESKTOP_SHORTCUTS_GET_PRIVATE(ids); return (const gchar **)priv->nicks->data; } /** indicator_desktop_shortcuts_nick_get_name: @ids: The #IndicatorDesktopShortcuts object to look in @nick: Which command that we're referencing. This function looks in a desktop file for a nick to find the user visible name for that shortcut. The @nick parameter should be gotten from #indicator_desktop_shortcuts_get_nicks though it's not required that the exact memory location be the same. Return value: A user visible string for the shortcut or #NULL on error. */ gchar * indicator_desktop_shortcuts_nick_get_name (IndicatorDesktopShortcuts * ids, const gchar * nick) { g_return_val_if_fail(INDICATOR_IS_DESKTOP_SHORTCUTS(ids), NULL); IndicatorDesktopShortcutsPrivate * priv = INDICATOR_DESKTOP_SHORTCUTS_GET_PRIVATE(ids); g_return_val_if_fail(priv->actions != ACTIONS_NONE, NULL); g_return_val_if_fail(priv->keyfile != NULL, NULL); g_return_val_if_fail(is_valid_nick((gchar **)priv->nicks->data, nick), NULL); const gchar * group_format = NULL; switch (priv->actions) { case ACTIONS_XAYATANA: group_format = "%s " OLD_GROUP_SUFFIX; break; case ACTIONS_DESKTOP_SPEC: group_format = ACTION_GROUP_PREFIX " %s"; break; default: g_assert_not_reached(); return NULL; } gchar * groupheader = g_strdup_printf(group_format, nick); if (!g_key_file_has_group(priv->keyfile, groupheader)) { g_warning("The group for nick '%s' doesn't exist anymore.", nick); g_free(groupheader); return NULL; } if (!g_key_file_has_key(priv->keyfile, groupheader, G_KEY_FILE_DESKTOP_KEY_NAME, NULL)) { g_warning("No name available for nick '%s'", nick); g_free(groupheader); return NULL; } gchar * name = NULL; gchar * keyvalue = g_key_file_get_string(priv->keyfile, groupheader, G_KEY_FILE_DESKTOP_KEY_NAME, NULL); gchar * localeval = g_key_file_get_locale_string(priv->keyfile, groupheader, G_KEY_FILE_DESKTOP_KEY_NAME, NULL, NULL); g_free(groupheader); if (priv->domain != NULL && g_strcmp0(keyvalue, localeval) == 0) { name = g_strdup(g_dgettext(priv->domain, keyvalue)); g_free(localeval); } else { name = localeval; } g_free(keyvalue); return name; } /** indicator_desktop_shortcuts_nick_exec_with_context: @ids: The #IndicatorDesktopShortcuts object to look in @nick: Which command that we're referencing. @launch_context: The #GAppLaunchContext to use for launching the shortcut Here we take a @nick and try and execute the action that is associated with it. The @nick parameter should be gotten from #indicator_desktop_shortcuts_get_nicks though it's not required that the exact memory location be the same. Return value: #TRUE on success or #FALSE on error. */ gboolean indicator_desktop_shortcuts_nick_exec_with_context (IndicatorDesktopShortcuts * ids, const gchar * nick, GAppLaunchContext * launch_context) { GError * error = NULL; g_return_val_if_fail(INDICATOR_IS_DESKTOP_SHORTCUTS(ids), FALSE); IndicatorDesktopShortcutsPrivate * priv = INDICATOR_DESKTOP_SHORTCUTS_GET_PRIVATE(ids); g_return_val_if_fail(priv->actions != ACTIONS_NONE, FALSE); g_return_val_if_fail(priv->keyfile != NULL, FALSE); g_return_val_if_fail(is_valid_nick((gchar **)priv->nicks->data, nick), FALSE); const gchar * group_format = NULL; switch (priv->actions) { case ACTIONS_XAYATANA: group_format = "%s " OLD_GROUP_SUFFIX; break; case ACTIONS_DESKTOP_SPEC: group_format = ACTION_GROUP_PREFIX " %s"; break; default: g_assert_not_reached(); return FALSE; } gchar * groupheader = g_strdup_printf(group_format, nick); if (!g_key_file_has_group(priv->keyfile, groupheader)) { g_warning("The group for nick '%s' doesn't exist anymore.", nick); g_free(groupheader); return FALSE; } if (!g_key_file_has_key(priv->keyfile, groupheader, G_KEY_FILE_DESKTOP_KEY_NAME, NULL)) { g_warning("No name available for nick '%s'", nick); g_free(groupheader); return FALSE; } if (!g_key_file_has_key(priv->keyfile, groupheader, G_KEY_FILE_DESKTOP_KEY_EXEC, NULL)) { g_warning("No exec available for nick '%s'", nick); g_free(groupheader); return FALSE; } /* Grab the name and the exec entries out of our current group */ gchar * name = g_key_file_get_locale_string(priv->keyfile, groupheader, G_KEY_FILE_DESKTOP_KEY_NAME, NULL, NULL); gchar * exec = g_key_file_get_locale_string(priv->keyfile, groupheader, G_KEY_FILE_DESKTOP_KEY_EXEC, NULL, NULL); g_free(groupheader); GAppInfoCreateFlags flags = G_APP_INFO_CREATE_NONE; if (launch_context) { flags |= G_APP_INFO_CREATE_SUPPORTS_STARTUP_NOTIFICATION; } GAppInfo * appinfo = g_app_info_create_from_commandline(exec, name, flags, &error); g_free(name); g_free(exec); if (error != NULL) { g_warning("Unable to build Command line App info: %s", error->message); g_error_free(error); return FALSE; } if (appinfo == NULL) { g_warning("Unable to build Command line App info (unknown)"); return FALSE; } gboolean launched = g_app_info_launch(appinfo, NULL, launch_context, &error); if (error != NULL) { g_warning("Unable to launch file from nick '%s': %s", nick, error->message); g_clear_error(&error); } g_object_unref(appinfo); return launched; } /** indicator_desktop_shortcuts_nick_exec: @ids: The #IndicatorDesktopShortcuts object to look in @nick: Which command that we're referencing. Here we take a @nick and try and execute the action that is associated with it. The @nick parameter should be gotten from #indicator_desktop_shortcuts_get_nicks though it's not required that the exact memory location be the same. This function is deprecated and shouldn't be used in newly written code. Return value: #TRUE on success or #FALSE on error. */ gboolean indicator_desktop_shortcuts_nick_exec (IndicatorDesktopShortcuts * ids, const gchar * nick) { return indicator_desktop_shortcuts_nick_exec_with_context (ids, nick, NULL); } indicator-messages-13.10.1+14.04.20140410/src/im-phone-menu.c0000644000015301777760000002405112321504521023435 0ustar pbusernogroup00000000000000/* * Copyright 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License version 3, as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranties of * MERCHANTABILITY, SATISFACTORY QUALITY, 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, see . * * Authors: * Lars Uebernickel */ #include "im-phone-menu.h" #include #include typedef ImMenuClass ImPhoneMenuClass; struct _ImPhoneMenu { ImMenu parent; GMenu *message_section; GMenu *source_section; GMenu *clear_section; }; G_DEFINE_TYPE (ImPhoneMenu, im_phone_menu, IM_TYPE_MENU); typedef void (*ImMenuForeachFunc) (GMenuModel *menu, gint pos); static void im_phone_menu_foreach_item_with_action (GMenuModel *menu, const gchar *action, ImMenuForeachFunc func) { gint n_items; gint i; n_items = g_menu_model_get_n_items (menu); for (i = 0; i < n_items; i++) { gchar *item_action; g_menu_model_get_item_attribute (menu, i, G_MENU_ATTRIBUTE_ACTION, "s", &item_action); if (g_str_equal (action, item_action)) func (menu, i); g_free (item_action); } } static void im_phone_menu_update_clear_section (ImPhoneMenu *menu) { gboolean is_shown; gboolean should_be_shown; is_shown = g_menu_model_get_n_items (G_MENU_MODEL (menu->clear_section)) > 0; should_be_shown = (g_menu_model_get_n_items (G_MENU_MODEL (menu->message_section)) + g_menu_model_get_n_items (G_MENU_MODEL (menu->source_section))) > 0; if (!is_shown && should_be_shown) { GMenuItem *item; item = g_menu_item_new (_("Clear All"), "remove-all"); g_menu_item_set_attribute (item, "x-canonical-type", "s", "com.canonical.indicator.button"); g_menu_append_item (menu->clear_section, item); g_object_unref (item); } else if (is_shown && !should_be_shown) { g_menu_remove (menu->clear_section, 0); } } static void im_phone_menu_constructed (GObject *object) { ImPhoneMenu *menu = IM_PHONE_MENU (object); ImApplicationList *applist; im_menu_append_section (IM_MENU (menu), G_MENU_MODEL (menu->message_section)); im_menu_append_section (IM_MENU (menu), G_MENU_MODEL (menu->source_section)); im_menu_append_section (IM_MENU (menu), G_MENU_MODEL (menu->clear_section)); applist = im_menu_get_application_list (IM_MENU (menu)); g_signal_connect_swapped (applist, "message-added", G_CALLBACK (im_phone_menu_add_message), menu); g_signal_connect_swapped (applist, "message-removed", G_CALLBACK (im_phone_menu_remove_message), menu); g_signal_connect_swapped (applist, "app-stopped", G_CALLBACK (im_phone_menu_remove_application), menu); g_signal_connect_swapped (applist, "remove-all", G_CALLBACK (im_phone_menu_remove_all), menu); G_OBJECT_CLASS (im_phone_menu_parent_class)->constructed (object); } static void im_phone_menu_dispose (GObject *object) { ImPhoneMenu *menu = IM_PHONE_MENU (object); g_clear_object (&menu->message_section); g_clear_object (&menu->source_section); g_clear_object (&menu->clear_section); G_OBJECT_CLASS (im_phone_menu_parent_class)->dispose (object); } static void im_phone_menu_finalize (GObject *object) { G_OBJECT_CLASS (im_phone_menu_parent_class)->finalize (object); } static void im_phone_menu_class_init (ImPhoneMenuClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); object_class->constructed = im_phone_menu_constructed; object_class->dispose = im_phone_menu_dispose; object_class->finalize = im_phone_menu_finalize; } static void im_phone_menu_init (ImPhoneMenu *menu) { menu->message_section = g_menu_new (); menu->source_section = g_menu_new (); menu->clear_section = g_menu_new (); } ImPhoneMenu * im_phone_menu_new (ImApplicationList *applist) { g_return_val_if_fail (IM_IS_APPLICATION_LIST (applist), NULL); return g_object_new (IM_TYPE_PHONE_MENU, "application-list", applist, NULL); } static gint64 im_phone_menu_get_message_time (GMenuModel *model, gint i) { gint64 time; g_menu_model_get_item_attribute (model, i, "x-canonical-time", "x", &time); return time; } void im_phone_menu_add_message (ImPhoneMenu *menu, const gchar *app_id, GIcon *app_icon, const gchar *id, GVariant *serialized_icon, const gchar *title, const gchar *subtitle, const gchar *body, GVariant *actions, gint64 time) { GMenuItem *item; gchar *action_name; gint n_messages; gint pos; GVariant *serialized_app_icon; g_return_if_fail (IM_IS_PHONE_MENU (menu)); g_return_if_fail (app_id); action_name = g_strconcat (app_id, ".msg.", id, NULL); item = g_menu_item_new (title, NULL); g_menu_item_set_action_and_target_value (item, action_name, g_variant_new_boolean (TRUE)); g_menu_item_set_attribute (item, "x-canonical-type", "s", "com.canonical.indicator.messages.messageitem"); g_menu_item_set_attribute (item, "x-canonical-message-id", "s", id); g_menu_item_set_attribute (item, "x-canonical-subtitle", "s", subtitle); g_menu_item_set_attribute (item, "x-canonical-text", "s", body); g_menu_item_set_attribute (item, "x-canonical-time", "x", time); if (serialized_icon) g_menu_item_set_attribute_value (item, "icon", serialized_icon); if (app_icon && (serialized_app_icon = g_icon_serialize (app_icon))) { g_menu_item_set_attribute_value (item, "x-canonical-app-icon", serialized_app_icon); g_variant_unref (serialized_app_icon); } if (actions) g_menu_item_set_attribute (item, "x-canonical-message-actions", "v", actions); n_messages = g_menu_model_get_n_items (G_MENU_MODEL (menu->message_section)); pos = 0; while (pos < n_messages && time < im_phone_menu_get_message_time (G_MENU_MODEL (menu->message_section), pos)) pos++; g_menu_insert_item (menu->message_section, pos, item); im_phone_menu_update_clear_section (menu); g_free (action_name); g_object_unref (item); } void im_phone_menu_remove_message (ImPhoneMenu *menu, const gchar *app_id, const gchar *id) { gchar *action_name; g_return_if_fail (IM_IS_PHONE_MENU (menu)); g_return_if_fail (app_id != NULL); action_name = g_strconcat (app_id, ".msg.", id, NULL); im_phone_menu_foreach_item_with_action (G_MENU_MODEL (menu->message_section), action_name, (ImMenuForeachFunc) g_menu_remove); im_phone_menu_update_clear_section (menu); g_free (action_name); } void im_phone_menu_add_source (ImPhoneMenu *menu, const gchar *app_id, const gchar *id, const gchar *label, const gchar *iconstr) { GMenuItem *item; gchar *action_name; g_return_if_fail (IM_IS_PHONE_MENU (menu)); g_return_if_fail (app_id != NULL); action_name = g_strconcat (app_id, ".src.", id, NULL); item = g_menu_item_new (label, NULL); g_menu_item_set_action_and_target_value (item, action_name, g_variant_new_boolean (TRUE)); g_menu_item_set_attribute (item, "x-canonical-type", "s", "com.canonical.indicator.messages.sourceitem"); if (iconstr) g_menu_item_set_attribute (item, "x-canonical-icon", "s", iconstr); g_menu_prepend_item (menu->source_section, item); g_free (action_name); g_object_unref (item); } void im_phone_menu_remove_source (ImPhoneMenu *menu, const gchar *app_id, const gchar *id) { gchar *action_name; g_return_if_fail (IM_IS_PHONE_MENU (menu)); g_return_if_fail (app_id != NULL); action_name = g_strconcat (app_id, ".src.", id, NULL); im_phone_menu_foreach_item_with_action (G_MENU_MODEL (menu->source_section), action_name, (ImMenuForeachFunc) g_menu_remove); g_free (action_name); } static void im_phone_menu_remove_all_for_app (GMenu *menu, const gchar *app_id) { gchar *prefix; gint n_items; gint i = 0; prefix = g_strconcat (app_id, ".", NULL); n_items = g_menu_model_get_n_items (G_MENU_MODEL (menu)); while (i < n_items) { gchar *action; g_menu_model_get_item_attribute (G_MENU_MODEL (menu), i, G_MENU_ATTRIBUTE_ACTION, "s", &action); if (g_str_has_prefix (action, prefix)) { g_menu_remove (menu, i); n_items--; } else { i++; } g_free (action); } g_free (prefix); } void im_phone_menu_remove_application (ImPhoneMenu *menu, const gchar *app_id) { g_return_if_fail (IM_IS_PHONE_MENU (menu)); g_return_if_fail (app_id != NULL); im_phone_menu_remove_all_for_app (menu->source_section, app_id); im_phone_menu_remove_all_for_app (menu->message_section, app_id); im_phone_menu_update_clear_section (menu); } void im_phone_menu_remove_all (ImPhoneMenu *menu) { g_return_if_fail (IM_IS_PHONE_MENU (menu)); while (g_menu_model_get_n_items (G_MENU_MODEL (menu->message_section))) g_menu_remove (menu->message_section, 0); while (g_menu_model_get_n_items (G_MENU_MODEL (menu->source_section))) g_menu_remove (menu->source_section, 0); im_phone_menu_update_clear_section (menu); } indicator-messages-13.10.1+14.04.20140410/src/gactionmuxer.h0000644000015301777760000000323412321504521023471 0ustar pbusernogroup00000000000000/* * Copyright 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License version 3, as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranties of * MERCHANTABILITY, SATISFACTORY QUALITY, 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, see . * * Authors: * Lars Uebernickel * Ryan Lortie */ #ifndef __G_ACTION_MUXER_H__ #define __G_ACTION_MUXER_H__ #include #define G_TYPE_ACTION_MUXER (g_action_muxer_get_type ()) #define G_ACTION_MUXER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_ACTION_MUXER, GActionMuxer)) #define G_IS_ACTION_MUXER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_ACTION_MUXER)) typedef struct _GActionMuxer GActionMuxer; GType g_action_muxer_get_type (void) G_GNUC_CONST; GActionMuxer * g_action_muxer_new (void); void g_action_muxer_insert (GActionMuxer *muxer, const gchar *prefix, GActionGroup *group); void g_action_muxer_remove (GActionMuxer *muxer, const gchar *prefix); GActionGroup * g_action_muxer_get_group (GActionMuxer *muxer, const gchar *prefix); #endif indicator-messages-13.10.1+14.04.20140410/src/im-menu.c0000644000015301777760000001420312321504521022324 0ustar pbusernogroup00000000000000/* * Copyright 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License version 3, as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranties of * MERCHANTABILITY, SATISFACTORY QUALITY, 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, see . * * Authors: * Lars Uebernickel */ #include "im-menu.h" struct _ImMenuPrivate { GMenu *toplevel_menu; GMenu *menu; ImApplicationList *applist; }; G_DEFINE_TYPE_WITH_PRIVATE (ImMenu, im_menu, G_TYPE_OBJECT) enum { PROP_0, PROP_APPLICATION_LIST, NUM_PROPERTIES }; static void im_menu_finalize (GObject *object) { ImMenuPrivate *priv = im_menu_get_instance_private (IM_MENU (object)); g_object_unref (priv->toplevel_menu); g_object_unref (priv->menu); g_object_unref (priv->applist); G_OBJECT_CLASS (im_menu_parent_class)->finalize (object); } static void im_menu_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) { ImMenuPrivate *priv = im_menu_get_instance_private (IM_MENU (object)); switch (property_id) { case PROP_APPLICATION_LIST: g_value_set_object (value, priv->applist); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); } } static void im_menu_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) { ImMenuPrivate *priv = im_menu_get_instance_private (IM_MENU (object)); switch (property_id) { case PROP_APPLICATION_LIST: /* construct only */ priv->applist = g_value_dup_object (value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); } } static void im_menu_class_init (ImMenuClass *class) { GObjectClass *object_class = G_OBJECT_CLASS (class); object_class->finalize = im_menu_finalize; object_class->get_property = im_menu_get_property; object_class->set_property = im_menu_set_property; g_object_class_install_property (object_class, PROP_APPLICATION_LIST, g_param_spec_object ("application-list", "", "", IM_TYPE_APPLICATION_LIST, G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); } static void im_menu_init (ImMenu *menu) { ImMenuPrivate *priv = im_menu_get_instance_private (menu); GMenuItem *root; priv->toplevel_menu = g_menu_new (); priv->menu = g_menu_new (); root = g_menu_item_new (NULL, "indicator.messages"); g_menu_item_set_attribute (root, "x-canonical-type", "s", "com.canonical.indicator.root"); g_menu_item_set_attribute (root, "action-namespace", "s", "indicator"); g_menu_item_set_submenu (root, G_MENU_MODEL (priv->menu)); g_menu_append_item (priv->toplevel_menu, root); g_object_unref (root); } ImApplicationList * im_menu_get_application_list (ImMenu *menu) { ImMenuPrivate *priv; g_return_val_if_fail (IM_IS_MENU (menu), FALSE); priv = im_menu_get_instance_private (menu); return priv->applist; } gboolean im_menu_export (ImMenu *menu, GDBusConnection *connection, const gchar *object_path, GError **error) { ImMenuPrivate *priv; g_return_val_if_fail (IM_IS_MENU (menu), FALSE); priv = im_menu_get_instance_private (menu); return g_dbus_connection_export_menu_model (connection, object_path, G_MENU_MODEL (priv->toplevel_menu), error) > 0; } void im_menu_prepend_section (ImMenu *menu, GMenuModel *section) { ImMenuPrivate *priv; g_return_if_fail (IM_IS_MENU (menu)); g_return_if_fail (G_IS_MENU_MODEL (section)); priv = im_menu_get_instance_private (menu); g_menu_prepend_section (priv->menu, NULL, section); } void im_menu_append_section (ImMenu *menu, GMenuModel *section) { ImMenuPrivate *priv; g_return_if_fail (IM_IS_MENU (menu)); g_return_if_fail (G_IS_MENU_MODEL (section)); priv = im_menu_get_instance_private (menu); g_menu_append_section (priv->menu, NULL, section); } /* * Inserts @item into @menu by comparing its * "x-messaging-menu-sort-string" with those found in existing menu * items between positions @first and @last. * * If @last is negative, it is counted from the end of @menu. */ void im_menu_insert_item_sorted (ImMenu *menu, GMenuItem *item, gint first, gint last) { ImMenuPrivate *priv; gint position = first; gchar *sort_string; g_return_if_fail (IM_IS_MENU (menu)); g_return_if_fail (G_IS_MENU_ITEM (item)); priv = im_menu_get_instance_private (menu); if (last < 0) last = g_menu_model_get_n_items (G_MENU_MODEL (priv->menu)) + last; g_return_if_fail (first <= last); if (g_menu_item_get_attribute (item, "x-messaging-menu-sort-string", "s", &sort_string)) { while (position < last) { gchar *item_sort; if (g_menu_model_get_item_attribute(G_MENU_MODEL(priv->menu), position, "x-messaging-menu-sort-string", "s", &item_sort)) { gint cmp; cmp = g_utf8_collate(sort_string, item_sort); g_free (item_sort); if (cmp < 0) break; } position++; } } g_menu_insert_item (priv->menu, position, item); } indicator-messages-13.10.1+14.04.20140410/src/Makefile.am0000644000015301777760000000160712321504521022651 0ustar pbusernogroup00000000000000 EXTRA_DIST = pkglibexec_PROGRAMS = indicator-messages-service indicator_messages_service_SOURCES = \ messages-service.c \ dbus-data.h \ gactionmuxer.c \ gactionmuxer.h \ gsettingsstrv.c \ gsettingsstrv.h \ im-menu.c \ im-menu.h \ im-phone-menu.c \ im-phone-menu.h \ im-desktop-menu.c \ im-desktop-menu.h \ im-application-list.c \ im-application-list.h \ indicator-desktop-shortcuts.c \ indicator-desktop-shortcuts.h indicator_messages_service_CFLAGS = \ $(APPLET_CFLAGS) \ $(COVERAGE_CFLAGS) \ -I$(top_builddir)/common \ -Wall \ -Wl,-Bsymbolic-functions \ -Wl,-z,defs \ -Wl,--as-needed \ -Werror -Wno-error=deprecated-declarations \ -DG_LOG_DOMAIN=\"Indicator-Messages\" indicator_messages_service_LDADD = \ $(top_builddir)/common/libmessaging-common.la \ $(APPLET_LIBS) indicator_messages_service_LDFLAGS = \ $(COVERAGE_LDFLAGS) EXTRA_DIST += \ messages-service.xml indicator-messages-13.10.1+14.04.20140410/src/gsettingsstrv.c0000644000015301777760000000547612321504521023717 0ustar pbusernogroup00000000000000/* * Copyright 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License version 3, as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranties of * MERCHANTABILITY, SATISFACTORY QUALITY, 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, see . * * Authors: * Lars Uebernickel */ #include "gsettingsstrv.h" /** * g_settings_strv_append_unique: * @settings: a #GSettings object * @key: the key at which @settings contains a string array * @item: the string to append * * Appends @item to the string array at @key if that string array doesn't * contain @item yet. * * Returns: TRUE if @item was added to the list, FALSE if it already existed. */ gboolean g_settings_strv_append_unique (GSettings *settings, const gchar *key, const gchar *item) { gchar **strv; gchar **it; gboolean add = TRUE; g_return_val_if_fail (G_IS_SETTINGS (settings), FALSE); g_return_val_if_fail (key != NULL, FALSE); g_return_val_if_fail (item != NULL, FALSE); strv = g_settings_get_strv (settings, key); for (it = strv; *it; it++) { if (g_str_equal (*it, item)) { add = FALSE; break; } } if (add) { GVariantBuilder builder; g_variant_builder_init (&builder, G_VARIANT_TYPE ("as")); for (it = strv; *it; it++) g_variant_builder_add (&builder, "s", *it); g_variant_builder_add (&builder, "s", item); g_settings_set_value (settings, key, g_variant_builder_end (&builder)); } g_strfreev (strv); return add; } /** * g_settings_strv_remove: * @settings: a #GSettings object * @key: the key at which @settings contains a string array * @item: the string to remove * * Removes all occurences of @item in @key. */ void g_settings_strv_remove (GSettings *settings, const gchar *key, const gchar *item) { gchar **strv; gchar **it; GVariantBuilder builder; g_return_if_fail (G_IS_SETTINGS (settings)); g_return_if_fail (key != NULL); g_return_if_fail (item != NULL); strv = g_settings_get_strv (settings, key); g_variant_builder_init (&builder, (GVariantType *)"as"); for (it = strv; *it; it++) { if (!g_str_equal (*it, item)) g_variant_builder_add (&builder, "s", *it); } g_settings_set_value (settings, key, g_variant_builder_end (&builder)); g_strfreev (strv); } indicator-messages-13.10.1+14.04.20140410/src/dbus-data.h0000644000015301777760000000211412321504521022624 0ustar pbusernogroup00000000000000/* * Copyright 2012-2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License version 3, as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranties of * MERCHANTABILITY, SATISFACTORY QUALITY, 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, see . */ #ifndef __DBUS_DATA_H__ #define __DBUS_DATA_H__ 1 #define INDICATOR_MESSAGES_DBUS_NAME "com.canonical.indicator.messages" #define INDICATOR_MESSAGES_DBUS_OBJECT "/com/canonical/indicator/messages" #define INDICATOR_MESSAGES_DBUS_SERVICE_OBJECT "/com/canonical/indicator/messages/service" #define INDICATOR_MESSAGES_DBUS_SERVICE_INTERFACE "com.canonical.indicator.messages.service" #endif /* __DBUS_DATA_H__ */ indicator-messages-13.10.1+14.04.20140410/src/im-desktop-menu.c0000644000015301777760000003210712321504521023776 0ustar pbusernogroup00000000000000/* * Copyright 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License version 3, as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranties of * MERCHANTABILITY, SATISFACTORY QUALITY, 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, see . * * Authors: * Lars Uebernickel */ #include "im-desktop-menu.h" #include "indicator-desktop-shortcuts.h" #include typedef ImMenuClass ImDesktopMenuClass; struct _ImDesktopMenu { ImMenu parent; gboolean status_section_visible; GMenu *default_chat_client_section; GMenu *default_mail_client_section; GHashTable *source_sections; }; G_DEFINE_TYPE (ImDesktopMenu, im_desktop_menu, IM_TYPE_MENU); static void menu_append_status (GMenu *menu, const gchar *label, const gchar *detailed_action, const gchar *icon_name) { GMenuItem *item; GIcon *icon; icon = g_themed_icon_new (icon_name); item = g_menu_item_new (label, detailed_action); g_menu_item_set_icon (item, icon); g_menu_append_item (menu, item); g_object_unref (icon); g_object_unref (item); } static void im_desktop_menu_show_chat_section (ImDesktopMenu *menu) { GMenu *status_section; if (menu->status_section_visible) return; status_section = g_menu_new (); menu_append_status (status_section, _("Available"), "indicator.status::available", "user-available"); menu_append_status (status_section, _("Away"), "indicator.status::away", "user-away"); menu_append_status (status_section, _("Busy"), "indicator.status::busy", "user-busy"); menu_append_status (status_section, _("Invisible"), "indicator.status::invisible", "user-invisible"); menu_append_status (status_section, _("Offline"), "indicator.status::offline", "user-offline"); im_menu_prepend_section (IM_MENU (menu), G_MENU_MODEL (status_section)); menu->status_section_visible = TRUE; g_object_unref (status_section); } static gboolean g_app_info_is_default_for_uri_scheme (GAppInfo *info, const gchar *uri_scheme) { GAppInfo *default_info; gboolean is_default; default_info = g_app_info_get_default_for_uri_scheme (uri_scheme); is_default = g_app_info_equal (info, default_info); g_object_unref (default_info); return is_default; } static void im_desktop_menu_app_added (ImApplicationList *applist, const gchar *app_id, GDesktopAppInfo *app_info, gpointer user_data) { ImDesktopMenu *menu = user_data; GMenu *section; GMenu *app_section; GMenu *source_section; gchar *namespace; GMenuItem *item; app_section = g_menu_new (); /* application launcher */ { GMenuItem *item; GVariant *icon; item = g_menu_item_new (g_app_info_get_name (G_APP_INFO (app_info)), "launch"); g_menu_item_set_attribute (item, "x-canonical-type", "s", "com.canonical.application"); icon = g_icon_serialize (g_app_info_get_icon (G_APP_INFO (app_info))); if (icon) { g_menu_item_set_attribute_value (item, "icon", icon); g_variant_unref (icon); } g_menu_append_item (app_section, item); g_object_unref (item); } /* application actions */ { const gchar * filename = NULL; IndicatorDesktopShortcuts * shortcuts = NULL; const gchar ** nicks = {NULL}; filename = g_desktop_app_info_get_filename(app_info); if (filename != NULL) shortcuts = indicator_desktop_shortcuts_new(filename, "Messaging Menu"); if (shortcuts != NULL) for (nicks = indicator_desktop_shortcuts_get_nicks(shortcuts); *nicks; nicks++) { GMenuItem *item; gchar *label; label = indicator_desktop_shortcuts_nick_get_name (shortcuts, *nicks); item = g_menu_item_new (label, *nicks); g_menu_item_set_attribute (item, "x-canonical-type", "s", "com.canonical.application"); g_menu_append_item (app_section, item); g_free (label); g_object_unref (item); } g_clear_object(&shortcuts); } if (g_desktop_app_info_get_boolean (app_info, "X-MessagingMenu-UsesChatSection")) im_desktop_menu_show_chat_section (menu); source_section = g_menu_new (); section = g_menu_new (); g_menu_append_section (section, NULL, G_MENU_MODEL (app_section)); g_menu_append_section (section, NULL, G_MENU_MODEL (source_section)); item = g_menu_item_new_section (NULL, G_MENU_MODEL (section)); namespace = g_strconcat ("indicator.", app_id, NULL); g_menu_item_set_attribute (item, "action-namespace", "s", namespace); /* The default chat client is not stored anywhere, so let's hardcode empathy. */ if (g_str_equal (app_id, "empathy")) { g_menu_remove_all (menu->default_chat_client_section); g_menu_append_item (menu->default_chat_client_section, item); } else if (g_app_info_is_default_for_uri_scheme (G_APP_INFO (app_info), "mailto")) { g_menu_remove_all (menu->default_mail_client_section); g_menu_append_item (menu->default_mail_client_section, item); } else { g_menu_item_set_attribute (item, "x-messaging-menu-sort-string", "s", g_app_info_get_name(G_APP_INFO(app_info))); im_menu_insert_item_sorted (IM_MENU (menu), item, menu->status_section_visible ? 3 : 2, -1); } g_hash_table_insert (menu->source_sections, g_strdup (app_id), source_section); g_free (namespace); g_object_unref (item); g_object_unref (section); g_object_unref (app_section); } static void im_desktop_menu_source_section_insert_source (GMenu *source_section, const gchar *source_id, const gchar *label, GVariant *serialized_icon, gint pos) { GMenuItem *item; gchar *action; action = g_strconcat ("src.", source_id, NULL); item = g_menu_item_new (label, NULL); g_menu_item_set_action_and_target_value (item, action, NULL); g_menu_item_set_attribute (item, "x-canonical-type", "s", "com.canonical.indicator.messages.source"); if (serialized_icon) g_menu_item_set_attribute_value (item, "icon", serialized_icon); if (pos >= 0) g_menu_insert_item (source_section, pos, item); else g_menu_append_item (source_section, item); g_free (action); g_object_unref (item); } static gint im_desktop_menu_source_section_find_source (GMenu *source_section, const gchar *source_id) { gint n_items; gchar *action; gint i; n_items = g_menu_model_get_n_items (G_MENU_MODEL (source_section)); action = g_strconcat ("src.", source_id, NULL); for (i = 0; i < n_items; i++) { gchar *item_action; if (g_menu_model_get_item_attribute (G_MENU_MODEL (source_section), i, "action", "s", &item_action)) { gboolean equal; equal = g_str_equal (action, item_action); g_free (item_action); if (equal) break; } } g_free (action); return i < n_items ? i : -1; } static void im_desktop_menu_source_added (ImApplicationList *applist, const gchar *app_id, const gchar *source_id, const gchar *label, GVariant *serialized_icon, gboolean visible, gpointer user_data) { ImDesktopMenu *menu = user_data; GMenu *source_section; source_section = g_hash_table_lookup (menu->source_sections, app_id); g_return_if_fail (source_section != NULL); if (visible) im_desktop_menu_source_section_insert_source (source_section, source_id, label, serialized_icon, -1); } static void im_desktop_menu_source_removed (ImApplicationList *applist, const gchar *app_id, const gchar *source_id, gpointer user_data) { ImDesktopMenu *menu = user_data; GMenu *source_section; gint pos; source_section = g_hash_table_lookup (menu->source_sections, app_id); g_return_if_fail (source_section != NULL); pos = im_desktop_menu_source_section_find_source (source_section, source_id); if (pos >= 0) g_menu_remove (source_section, pos); } static void im_desktop_menu_source_changed (ImApplicationList *applist, const gchar *app_id, const gchar *source_id, const gchar *label, GVariant *serialized_icon, gboolean visible, gpointer user_data) { ImDesktopMenu *menu = user_data; GMenu *section; gint pos; section = g_hash_table_lookup (menu->source_sections, app_id); g_return_if_fail (section != NULL); pos = im_desktop_menu_source_section_find_source (section, source_id); if (pos >= 0) g_menu_remove (section, pos); if (visible) im_desktop_menu_source_section_insert_source (section, source_id, label, serialized_icon, pos); } static void im_desktop_menu_remove_all (ImApplicationList *applist, gpointer user_data) { ImDesktopMenu *menu = user_data; GHashTableIter it; GMenu *section; g_hash_table_iter_init (&it, menu->source_sections); while (g_hash_table_iter_next (&it, NULL, (gpointer *) §ion)) { while (g_menu_model_get_n_items (G_MENU_MODEL (section)) > 0) g_menu_remove (section, 0); } } static void im_desktop_menu_app_stopped (ImApplicationList *applist, const gchar *app_id, gpointer user_data) { ImDesktopMenu *menu = user_data; GMenu *section; section = g_hash_table_lookup (menu->source_sections, app_id); g_return_if_fail (section != NULL); while (g_menu_model_get_n_items (G_MENU_MODEL (section)) > 0) g_menu_remove (section, 0); } static void im_desktop_menu_constructed (GObject *object) { ImDesktopMenu *menu = IM_DESKTOP_MENU (object); ImApplicationList *applist; menu->default_chat_client_section = g_menu_new (); im_menu_append_section (IM_MENU (menu), G_MENU_MODEL (menu->default_chat_client_section)); menu->default_mail_client_section = g_menu_new (); im_menu_append_section (IM_MENU (menu), G_MENU_MODEL (menu->default_mail_client_section)); { GMenu *clear_section; clear_section = g_menu_new (); g_menu_append (clear_section, _("Clear"), "indicator.remove-all"); im_menu_append_section (IM_MENU (menu), G_MENU_MODEL (clear_section)); g_object_unref (clear_section); } applist = im_menu_get_application_list (IM_MENU (menu)); { GList *apps; GList *it; apps = im_application_list_get_applications (applist); for (it = apps; it != NULL; it = it->next) { const gchar *id = it->data; im_desktop_menu_app_added (applist, id, im_application_list_get_application (applist, id), menu); } g_list_free (apps); } g_signal_connect (applist, "app-added", G_CALLBACK (im_desktop_menu_app_added), menu); g_signal_connect (applist, "source-added", G_CALLBACK (im_desktop_menu_source_added), menu); g_signal_connect (applist, "source-removed", G_CALLBACK (im_desktop_menu_source_removed), menu); g_signal_connect (applist, "source-changed", G_CALLBACK (im_desktop_menu_source_changed), menu); g_signal_connect (applist, "remove-all", G_CALLBACK (im_desktop_menu_remove_all), menu); g_signal_connect (applist, "app-stopped", G_CALLBACK (im_desktop_menu_app_stopped), menu); G_OBJECT_CLASS (im_desktop_menu_parent_class)->constructed (object); } static void im_desktop_menu_finalize (GObject *object) { ImDesktopMenu *menu = IM_DESKTOP_MENU (object); g_hash_table_unref (menu->source_sections); G_OBJECT_CLASS (im_desktop_menu_parent_class)->finalize (object); } static void im_desktop_menu_class_init (ImDesktopMenuClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); object_class->constructed = im_desktop_menu_constructed; object_class->finalize = im_desktop_menu_finalize; } static void im_desktop_menu_init (ImDesktopMenu *menu) { menu->source_sections = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref); } ImDesktopMenu * im_desktop_menu_new (ImApplicationList *applist) { g_return_val_if_fail (IM_IS_APPLICATION_LIST (applist), NULL); return g_object_new (IM_TYPE_DESKTOP_MENU, "application-list", applist, NULL); } indicator-messages-13.10.1+14.04.20140410/src/im-desktop-menu.h0000644000015301777760000000242412321504521024002 0ustar pbusernogroup00000000000000/* * Copyright 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License version 3, as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranties of * MERCHANTABILITY, SATISFACTORY QUALITY, 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, see . * * Authors: * Lars Uebernickel */ #ifndef __IM_DESKTOP_MENU_H__ #define __IM_DESKTOP_MENU_H__ #include "im-menu.h" #define IM_TYPE_DESKTOP_MENU (im_desktop_menu_get_type ()) #define IM_DESKTOP_MENU(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), IM_TYPE_DESKTOP_MENU, ImDesktopMenu)) #define IM_IS_DESKTOP_MENU(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IM_TYPE_DESKTOP_MENU)) typedef struct _ImDesktopMenu ImDesktopMenu; GType im_desktop_menu_get_type (void); ImDesktopMenu * im_desktop_menu_new (ImApplicationList *applist); #endif indicator-messages-13.10.1+14.04.20140410/src/gsettingsstrv.h0000644000015301777760000000231712321504521023713 0ustar pbusernogroup00000000000000/* * Copyright 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License version 3, as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranties of * MERCHANTABILITY, SATISFACTORY QUALITY, 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, see . * * Authors: * Lars Uebernickel */ #ifndef __G_SETTINGS_STRV_H__ #define __G_SETTINGS_STRV_H__ #include gboolean g_settings_strv_append_unique (GSettings *settings, const gchar *key, const gchar *item); void g_settings_strv_remove (GSettings *settings, const gchar *key, const gchar *item); #endif indicator-messages-13.10.1+14.04.20140410/src/im-application-list.c0000644000015301777760000012364212321504537024653 0ustar pbusernogroup00000000000000/* * Copyright 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License version 3, as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranties of * MERCHANTABILITY, SATISFACTORY QUALITY, 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, see . * * Authors: * Lars Uebernickel */ #include "im-application-list.h" #include "indicator-messages-application.h" #include "gactionmuxer.h" #include "indicator-desktop-shortcuts.h" #include #include #include "glib/gi18n.h" typedef GObjectClass ImApplicationListClass; struct _ImApplicationList { GObject parent; GHashTable *applications; GActionMuxer *muxer; GSimpleActionGroup * globalactions; GSimpleAction * statusaction; GHashTable *app_status; }; G_DEFINE_TYPE (ImApplicationList, im_application_list, G_TYPE_OBJECT); G_DEFINE_QUARK (draws_attention, message_action_draws_attention); enum { SOURCE_ADDED, SOURCE_CHANGED, SOURCE_REMOVED, MESSAGE_ADDED, MESSAGE_REMOVED, APP_ADDED, APP_STOPPED, REMOVE_ALL, STATUS_SET, N_SIGNALS }; static guint signals[N_SIGNALS]; typedef struct { ImApplicationList *list; GDesktopAppInfo *info; gchar *id; IndicatorMessagesApplication *proxy; GActionMuxer *muxer; GSimpleActionGroup *source_actions; GSimpleActionGroup *message_actions; GActionMuxer *message_sub_actions; GCancellable *cancellable; gboolean draws_attention; IndicatorDesktopShortcuts * shortcuts; } Application; /* Prototypes */ static void status_activated (GSimpleAction * action, GVariant * param, gpointer user_data); static void application_free (gpointer data) { Application *app = data; if (!app) return; g_object_unref (app->info); g_free (app->id); if (app->cancellable) { g_cancellable_cancel (app->cancellable); g_clear_object (&app->cancellable); } if (app->proxy) g_object_unref (app->proxy); if (app->muxer) { g_object_unref (app->muxer); g_object_unref (app->source_actions); g_object_unref (app->message_actions); g_object_unref (app->message_sub_actions); } g_clear_object (&app->shortcuts); g_slice_free (Application, app); } /* Check to see if we have actions by getting the full list of names and see if there is one. Not exactly efficient :-/ */ static gboolean _g_action_group_has_actions (GActionGroup * ag) { gchar ** list = NULL; gboolean retval = FALSE; list = g_action_group_list_actions(ag); retval = (list[0] != NULL); g_strfreev(list); return retval; } /* Check to see if either of our action groups has any actions, if so return TRUE so we get chosen! */ static gboolean application_has_items (gpointer key, gpointer value, gpointer user_data) { Application *app = value; return _g_action_group_has_actions(G_ACTION_GROUP(app->source_actions)) || _g_action_group_has_actions(G_ACTION_GROUP(app->message_actions)); } static gboolean application_draws_attention (gpointer key, gpointer value, gpointer user_data) { Application *app = value; return app->draws_attention; } static void im_application_list_update_root_action (ImApplicationList *list) { const gchar *base_icon_name; const gchar *accessible_name; gchar *icon_name; GIcon * icon; GVariant *serialized_icon; GVariantBuilder builder; GVariant *state; guint n_applications; /* Figure out what type of icon we should be drawing */ if (g_hash_table_find (list->applications, application_draws_attention, NULL)) { base_icon_name = "indicator-messages-new-%s"; accessible_name = _("New Messages"); } else { base_icon_name = "indicator-messages-%s"; accessible_name = _("Messages"); } /* Include the IM state in the icon */ state = g_action_group_get_action_state(G_ACTION_GROUP(list->globalactions), "status"); icon_name = g_strdup_printf(base_icon_name, g_variant_get_string(state, NULL)); g_variant_unref(state); /* Build up the dictionary of values for the state */ g_variant_builder_init(&builder, G_VARIANT_TYPE_DICTIONARY); /* icon */ icon = g_themed_icon_new_with_default_fallbacks(icon_name); g_free(icon_name); if ((serialized_icon = g_icon_serialize(icon))) { g_variant_builder_add (&builder, "{sv}", "icon", serialized_icon); g_variant_unref (serialized_icon); } g_object_unref(icon); /* title */ g_variant_builder_add (&builder, "{sv}", "title", g_variant_new_string (_("Incoming"))); /* accessible description */ g_variant_builder_open(&builder, G_VARIANT_TYPE_DICT_ENTRY); g_variant_builder_add_value(&builder, g_variant_new_string("accessible-desc")); g_variant_builder_add_value(&builder, g_variant_new_variant(g_variant_new_string(accessible_name))); g_variant_builder_close(&builder); /* visibility */ n_applications = g_hash_table_size (list->applications); g_variant_builder_add (&builder, "{sv}", "visible", g_variant_new_boolean (n_applications > 0)); /* Set the state */ g_action_group_change_action_state (G_ACTION_GROUP(list->globalactions), "messages", g_variant_builder_end(&builder)); GAction * remove_action = g_action_map_lookup_action (G_ACTION_MAP (list->globalactions), "remove-all"); if (g_hash_table_find (list->applications, application_has_items, NULL)) { g_debug("Enabling remove-all"); g_simple_action_set_enabled(G_SIMPLE_ACTION(remove_action), TRUE); } else { g_debug("Disabling remove-all"); g_simple_action_set_enabled(G_SIMPLE_ACTION(remove_action), FALSE); } } /* Check a source action to see if it draws */ static gboolean app_source_action_check_draw (Application * app, const gchar * action_name) { GVariant *state; guint32 count; gint64 time; const gchar *string; gboolean draws_attention; state = g_action_group_get_action_state (G_ACTION_GROUP(app->source_actions), action_name); if (state == NULL) return FALSE; g_variant_get (state, "(ux&sb)", &count, &time, &string, &draws_attention); /* invisible sources do not draw attention */ if (count == 0 && time == 0 && (string == NULL || string[0] == '\0')) draws_attention = FALSE; g_variant_unref(state); return draws_attention; } /* Check a message action to see if it draws */ static gboolean app_message_action_check_draw (Application * app, const gchar * action_name) { GAction * action = NULL; action = g_action_map_lookup_action (G_ACTION_MAP (app->message_actions), action_name); return GPOINTER_TO_INT(g_object_get_qdata(G_OBJECT(action), message_action_draws_attention_quark())); } /* Regenerate the draw attention flag based on the sources and messages * that we have in the action groups. * * Returns TRUE if app->draws_attention has changed */ static gboolean application_update_draws_attention (Application * app) { gchar **source_actions = NULL; gchar **message_actions = NULL; gchar **it; gboolean was_drawing_attention = app->draws_attention; app->draws_attention = FALSE; source_actions = g_action_group_list_actions (G_ACTION_GROUP (app->source_actions)); for (it = source_actions; *it && !app->draws_attention; it++) app->draws_attention = app_source_action_check_draw (app, *it); message_actions = g_action_group_list_actions (G_ACTION_GROUP (app->message_actions)); for (it = message_actions; *it && !app->draws_attention; it++) app->draws_attention = app_message_action_check_draw (app, *it); g_strfreev (source_actions); g_strfreev (message_actions); return was_drawing_attention != app->draws_attention; } /* Remove a source from an application, signal up and update the status of the draws attention flag. */ static void im_application_list_source_removed (Application *app, const gchar *id) { g_action_map_remove_action (G_ACTION_MAP(app->source_actions), id); g_signal_emit (app->list, signals[SOURCE_REMOVED], 0, app->id, id); if (application_update_draws_attention(app)) im_application_list_update_root_action (app->list); } static void im_application_list_source_activated (GSimpleAction *action, GVariant *parameter, gpointer user_data) { Application *app = user_data; const gchar *source_id; source_id = g_action_get_name (G_ACTION (action)); if (g_variant_get_boolean (parameter)) { indicator_messages_application_call_activate_source (app->proxy, source_id, app->cancellable, NULL, NULL); } else { const gchar *sources[] = { source_id, NULL }; const gchar *messages[] = { NULL }; indicator_messages_application_call_dismiss (app->proxy, sources, messages, app->cancellable, NULL, NULL); } im_application_list_source_removed (app, source_id); } static void im_application_list_message_removed (Application *app, const gchar *id) { g_action_map_remove_action (G_ACTION_MAP(app->message_actions), id); g_action_muxer_remove (app->message_sub_actions, id); if (application_update_draws_attention(app)) im_application_list_update_root_action (app->list); g_signal_emit (app->list, signals[MESSAGE_REMOVED], 0, app->id, id); } static void im_application_list_message_activated (GSimpleAction *action, GVariant *parameter, gpointer user_data) { Application *app = user_data; const gchar *message_id; message_id = g_action_get_name (G_ACTION (action)); if (g_variant_get_boolean (parameter)) { indicator_messages_application_call_activate_message (app->proxy, message_id, "", g_variant_new_array (G_VARIANT_TYPE_VARIANT, NULL, 0), app->cancellable, NULL, NULL); } else { const gchar *sources[] = { NULL }; const gchar *messages[] = { message_id, NULL }; indicator_messages_application_call_dismiss (app->proxy, sources, messages, app->cancellable, NULL, NULL); } im_application_list_message_removed (app, message_id); } static void im_application_list_sub_message_activated (GSimpleAction *action, GVariant *parameter, gpointer user_data) { Application *app = user_data; const gchar *message_id; const gchar *action_id; GVariantBuilder builder; message_id = g_object_get_data (G_OBJECT (action), "message"); action_id = g_action_get_name (G_ACTION (action)); g_variant_builder_init (&builder, G_VARIANT_TYPE ("av")); if (parameter) g_variant_builder_add (&builder, "v", parameter); indicator_messages_application_call_activate_message (app->proxy, message_id, action_id, g_variant_builder_end (&builder), app->cancellable, NULL, NULL); im_application_list_message_removed (app, message_id); } static void im_application_list_remove_all (GSimpleAction *action, GVariant *parameter, gpointer user_data) { ImApplicationList *list = user_data; GHashTableIter iter; Application *app; g_signal_emit (list, signals[REMOVE_ALL], 0); g_hash_table_iter_init (&iter, list->applications); while (g_hash_table_iter_next (&iter, NULL, (gpointer *) &app)) { gchar **source_actions; gchar **message_actions; gchar **it; app->draws_attention = FALSE; source_actions = g_action_group_list_actions (G_ACTION_GROUP (app->source_actions)); for (it = source_actions; *it; it++) im_application_list_source_removed (app, *it); message_actions = g_action_group_list_actions (G_ACTION_GROUP (app->message_actions)); for (it = message_actions; *it; it++) im_application_list_message_removed (app, *it); if (app->proxy != NULL) /* If it is remote, we tell the app we've cleared */ { indicator_messages_application_call_dismiss (app->proxy, (const gchar * const *) source_actions, (const gchar * const *) message_actions, app->cancellable, NULL, NULL); } g_strfreev (source_actions); g_strfreev (message_actions); } im_application_list_update_root_action (list); } static void im_application_list_dispose (GObject *object) { ImApplicationList *list = IM_APPLICATION_LIST (object); g_clear_object (&list->statusaction); g_clear_object (&list->globalactions); g_clear_pointer (&list->app_status, g_hash_table_unref); g_clear_pointer (&list->applications, g_hash_table_unref); g_clear_object (&list->muxer); G_OBJECT_CLASS (im_application_list_parent_class)->dispose (object); } static void im_application_list_finalize (GObject *object) { G_OBJECT_CLASS (im_application_list_parent_class)->finalize (object); } static void im_application_list_class_init (ImApplicationListClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); object_class->dispose = im_application_list_dispose; object_class->finalize = im_application_list_finalize; signals[SOURCE_ADDED] = g_signal_new ("source-added", IM_TYPE_APPLICATION_LIST, G_SIGNAL_RUN_FIRST, 0, NULL, NULL, g_cclosure_marshal_generic, G_TYPE_NONE, 5, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_VARIANT, G_TYPE_BOOLEAN); signals[SOURCE_CHANGED] = g_signal_new ("source-changed", IM_TYPE_APPLICATION_LIST, G_SIGNAL_RUN_FIRST, 0, NULL, NULL, g_cclosure_marshal_generic, G_TYPE_NONE, 5, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_VARIANT, G_TYPE_BOOLEAN); signals[SOURCE_REMOVED] = g_signal_new ("source-removed", IM_TYPE_APPLICATION_LIST, G_SIGNAL_RUN_FIRST, 0, NULL, NULL, g_cclosure_marshal_generic, G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_STRING); signals[MESSAGE_ADDED] = g_signal_new ("message-added", IM_TYPE_APPLICATION_LIST, G_SIGNAL_RUN_FIRST, 0, NULL, NULL, g_cclosure_marshal_generic, G_TYPE_NONE, 10, G_TYPE_STRING, G_TYPE_ICON, G_TYPE_STRING, G_TYPE_VARIANT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_VARIANT, G_TYPE_INT64, G_TYPE_BOOLEAN); signals[MESSAGE_REMOVED] = g_signal_new ("message-removed", IM_TYPE_APPLICATION_LIST, G_SIGNAL_RUN_FIRST, 0, NULL, NULL, g_cclosure_marshal_generic, G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_STRING); signals[APP_ADDED] = g_signal_new ("app-added", IM_TYPE_APPLICATION_LIST, G_SIGNAL_RUN_FIRST, 0, NULL, NULL, g_cclosure_marshal_generic, G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_DESKTOP_APP_INFO); signals[APP_STOPPED] = g_signal_new ("app-stopped", IM_TYPE_APPLICATION_LIST, G_SIGNAL_RUN_FIRST, 0, NULL, NULL, g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING); signals[REMOVE_ALL] = g_signal_new ("remove-all", IM_TYPE_APPLICATION_LIST, G_SIGNAL_RUN_FIRST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); signals[STATUS_SET] = g_signal_new ("status-set", IM_TYPE_APPLICATION_LIST, G_SIGNAL_RUN_FIRST, 0, NULL, NULL, g_cclosure_marshal_generic, G_TYPE_NONE, 1, G_TYPE_STRING); } static void im_application_list_init (ImApplicationList *list) { const GActionEntry action_entries[] = { { "remove-all", im_application_list_remove_all } }; list->applications = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, application_free); list->app_status = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free); list->globalactions = g_simple_action_group_new (); { GSimpleAction * messages = g_simple_action_new_stateful("messages", NULL, g_variant_new_array(G_VARIANT_TYPE("{sv}"), NULL, 0)); g_action_map_add_action(G_ACTION_MAP(list->globalactions), G_ACTION(messages)); } g_action_map_add_action_entries (G_ACTION_MAP (list->globalactions), action_entries, G_N_ELEMENTS (action_entries), list); list->statusaction = g_simple_action_new_stateful("status", G_VARIANT_TYPE_STRING, g_variant_new_string("offline")); g_signal_connect(list->statusaction, "activate", G_CALLBACK(status_activated), list); g_action_map_add_action(G_ACTION_MAP(list->globalactions), G_ACTION(list->statusaction)); list->muxer = g_action_muxer_new (); g_action_muxer_insert (list->muxer, NULL, G_ACTION_GROUP (list->globalactions)); im_application_list_update_root_action (list); } ImApplicationList * im_application_list_new (void) { return g_object_new (IM_TYPE_APPLICATION_LIST, NULL); } static gchar * im_application_list_canonical_id (const gchar *id) { gchar *str; gchar *p; int len; len = strlen (id); if (g_str_has_suffix (id, ".desktop")) len -= 8; str = g_strndup (id, len); for (p = str; *p; p++) { if (*p == '.') *p = '_'; } return str; } static Application * im_application_list_lookup (ImApplicationList *list, const gchar *desktop_id) { gchar *id; Application *app; id = im_application_list_canonical_id (desktop_id); app = g_hash_table_lookup (list->applications, id); g_free (id); return app; } void im_application_list_activate_launch (GSimpleAction *action, GVariant *parameter, gpointer user_data) { Application *app = user_data; GError *error = NULL; if (!g_app_info_launch (G_APP_INFO (app->info), NULL, NULL, &error)) { g_warning ("unable to launch application: %s", error->message); g_error_free (error); } } void im_application_list_activate_app_action (GSimpleAction *action, GVariant *parameter, gpointer user_data) { Application *app = user_data; indicator_desktop_shortcuts_nick_exec_with_context (app->shortcuts, g_action_get_name (G_ACTION (action)), NULL); } gboolean im_application_list_add (ImApplicationList *list, const gchar *desktop_id) { GDesktopAppInfo *info; Application *app; const gchar *id; GSimpleActionGroup *actions; GSimpleAction *launch_action; IndicatorDesktopShortcuts * shortcuts = NULL; g_return_val_if_fail (IM_IS_APPLICATION_LIST (list), FALSE); g_return_val_if_fail (desktop_id != NULL, FALSE); if (im_application_list_lookup (list, desktop_id)) return TRUE; info = g_desktop_app_info_new (desktop_id); if (!info) { g_warning ("an application with id '%s' is not installed", desktop_id); return FALSE; } id = g_app_info_get_id (G_APP_INFO (info)); g_return_val_if_fail (id != NULL, FALSE); { const char * filename = g_desktop_app_info_get_filename(info); if (filename != NULL) shortcuts = indicator_desktop_shortcuts_new(filename, "Messaging Menu"); } app = g_slice_new0 (Application); app->info = info; app->id = im_application_list_canonical_id (id); app->list = list; app->muxer = g_action_muxer_new (); app->source_actions = g_simple_action_group_new (); app->message_actions = g_simple_action_group_new (); app->message_sub_actions = g_action_muxer_new (); app->draws_attention = FALSE; app->shortcuts = shortcuts; actions = g_simple_action_group_new (); launch_action = g_simple_action_new_stateful ("launch", NULL, g_variant_new_boolean (FALSE)); g_signal_connect (launch_action, "activate", G_CALLBACK (im_application_list_activate_launch), app); g_action_map_add_action (G_ACTION_MAP (actions), G_ACTION (launch_action)); if (app->shortcuts != NULL) { const gchar ** nicks; for (nicks = indicator_desktop_shortcuts_get_nicks (app->shortcuts); *nicks; nicks++) { GSimpleAction *action; action = g_simple_action_new (*nicks, NULL); g_signal_connect (action, "activate", G_CALLBACK (im_application_list_activate_app_action), app); g_action_map_add_action (G_ACTION_MAP (actions), G_ACTION (action)); g_object_unref (action); } } g_action_muxer_insert (app->muxer, NULL, G_ACTION_GROUP (actions)); g_action_muxer_insert (app->muxer, "src", G_ACTION_GROUP (app->source_actions)); g_action_muxer_insert (app->muxer, "msg", G_ACTION_GROUP (app->message_actions)); g_action_muxer_insert (app->muxer, "msg-actions", G_ACTION_GROUP (app->message_sub_actions)); g_hash_table_insert (list->applications, (gpointer) app->id, app); g_action_muxer_insert (list->muxer, app->id, G_ACTION_GROUP (app->muxer)); im_application_list_update_root_action (list); g_signal_emit (app->list, signals[APP_ADDED], 0, app->id, app->info); g_object_unref (launch_action); g_object_unref (actions); return TRUE; } void im_application_list_remove (ImApplicationList *list, const gchar *id) { Application *app; g_return_if_fail (IM_IS_APPLICATION_LIST (list)); app = im_application_list_lookup (list, id); if (app) { if (app->proxy || app->cancellable) g_signal_emit (app->list, signals[APP_STOPPED], 0, app->id); g_hash_table_remove (list->applications, id); g_action_muxer_remove (list->muxer, id); im_application_list_update_root_action (list); } } static void im_application_list_source_added (Application *app, guint position, GVariant *source) { const gchar *id; const gchar *label; GVariant *maybe_serialized_icon; guint32 count; gint64 time; const gchar *string; gboolean draws_attention; gboolean visible; GVariant *serialized_icon = NULL; GVariant *state; GSimpleAction *action; g_variant_get (source, "(&s&s@avux&sb)", &id, &label, &maybe_serialized_icon, &count, &time, &string, &draws_attention); if (g_variant_n_children (maybe_serialized_icon) == 1) g_variant_get_child (maybe_serialized_icon, 0, "v", &serialized_icon); visible = count > 0 || time != 0 || (string != NULL && string[0] != '\0'); state = g_variant_new ("(uxsb)", count, time, string, draws_attention); action = g_simple_action_new_stateful (id, G_VARIANT_TYPE_BOOLEAN, state); g_signal_connect (action, "activate", G_CALLBACK (im_application_list_source_activated), app); g_action_map_add_action (G_ACTION_MAP(app->source_actions), G_ACTION (action)); g_signal_emit (app->list, signals[SOURCE_ADDED], 0, app->id, id, label, serialized_icon, visible); if (visible && draws_attention && app->draws_attention == FALSE) { app->draws_attention = TRUE; im_application_list_update_root_action (app->list); } g_object_unref (action); if (serialized_icon) g_variant_unref (serialized_icon); g_variant_unref (maybe_serialized_icon); } static void im_application_list_source_changed (Application *app, GVariant *source) { const gchar *id; const gchar *label; GVariant *maybe_serialized_icon; guint32 count; gint64 time; const gchar *string; gboolean draws_attention; GVariant *serialized_icon = NULL; gboolean visible; g_variant_get (source, "(&s&s@avux&sb)", &id, &label, &maybe_serialized_icon, &count, &time, &string, &draws_attention); if (g_variant_n_children (maybe_serialized_icon) == 1) g_variant_get_child (maybe_serialized_icon, 0, "v", &serialized_icon); g_action_group_change_action_state (G_ACTION_GROUP (app->source_actions), id, g_variant_new ("(uxsb)", count, time, string, draws_attention)); visible = count > 0 || time != 0 || (string != NULL && string[0] != '\0'); g_signal_emit (app->list, signals[SOURCE_CHANGED], 0, app->id, id, label, serialized_icon, visible); if (application_update_draws_attention (app)) im_application_list_update_root_action (app->list); if (serialized_icon) g_variant_unref (serialized_icon); g_variant_unref (maybe_serialized_icon); } static void im_application_list_sources_listed (GObject *source_object, GAsyncResult *result, gpointer user_data) { Application *app = user_data; GVariant *sources; GError *error = NULL; if (indicator_messages_application_call_list_sources_finish (app->proxy, &sources, result, &error)) { GVariantIter iter; GVariant *source; guint i = 0; g_variant_iter_init (&iter, sources); while ((source = g_variant_iter_next_value (&iter))) { im_application_list_source_added (app, i++, source); g_variant_unref (source); } g_variant_unref (sources); } else { g_warning ("could not fetch the list of sources: %s", error->message); g_error_free (error); } } static GIcon * get_symbolic_app_icon (GAppInfo *info) { GIcon *icon; const gchar * const *names; gchar *symbolic_name; GIcon *symbolic_icon; icon = g_app_info_get_icon (info); if (icon == NULL) return NULL; if (!G_IS_THEMED_ICON (icon)) return g_object_ref (icon); names = g_themed_icon_get_names (G_THEMED_ICON (icon)); if (!names || !names[0]) return g_object_ref (icon); symbolic_name = g_strconcat (names[0], "-symbolic", NULL); symbolic_icon = g_themed_icon_new_from_names ((gchar **) names, -1); g_themed_icon_prepend_name (G_THEMED_ICON (symbolic_icon), symbolic_name); g_free (symbolic_name); return symbolic_icon; } static void im_application_list_message_added (Application *app, GVariant *message) { const gchar *id; GVariant *maybe_serialized_icon; const gchar *title; const gchar *subtitle; const gchar *body; gint64 time; GVariantIter *action_iter; gboolean draws_attention; GVariant *serialized_icon = NULL; GSimpleAction *action; GIcon *app_icon; GVariant *actions = NULL; g_variant_get (message, "(&s@av&s&s&sxaa{sv}b)", &id, &maybe_serialized_icon, &title, &subtitle, &body, &time, &action_iter, &draws_attention); if (g_variant_n_children (maybe_serialized_icon) == 1) g_variant_get_child (maybe_serialized_icon, 0, "v", &serialized_icon); action = g_simple_action_new (id, G_VARIANT_TYPE_BOOLEAN); g_object_set_qdata(G_OBJECT(action), message_action_draws_attention_quark(), GINT_TO_POINTER(draws_attention)); g_signal_connect (action, "activate", G_CALLBACK (im_application_list_message_activated), app); g_action_map_add_action (G_ACTION_MAP(app->message_actions), G_ACTION (action)); { GVariant *entry; GSimpleActionGroup *action_group; GVariantBuilder actions_builder; g_variant_builder_init (&actions_builder, G_VARIANT_TYPE ("aa{sv}")); action_group = g_simple_action_group_new (); while ((entry = g_variant_iter_next_value (action_iter))) { const gchar *name; GSimpleAction *action; GVariant *label; const gchar *type = NULL; GVariant *hint; GVariantBuilder dict_builder; gchar *prefixed_name; if (!g_variant_lookup (entry, "name", "&s", &name)) { g_warning ("action dictionary for message '%s' is missing 'name' key", id); continue; } label = g_variant_lookup_value (entry, "label", G_VARIANT_TYPE_STRING); g_variant_lookup (entry, "parameter-type", "&g", &type); hint = g_variant_lookup_value (entry, "parameter-hint", NULL); action = g_simple_action_new (name, type ? G_VARIANT_TYPE (type) : NULL); g_object_set_data_full (G_OBJECT (action), "message", g_strdup (id), g_free); g_signal_connect (action, "activate", G_CALLBACK (im_application_list_sub_message_activated), app); g_action_map_add_action (G_ACTION_MAP(action_group), G_ACTION (action)); g_variant_builder_init (&dict_builder, G_VARIANT_TYPE ("a{sv}")); prefixed_name = g_strjoin (".", app->id, "msg-actions", id, name, NULL); g_variant_builder_add (&dict_builder, "{sv}", "name", g_variant_new_string (prefixed_name)); if (label) { g_variant_builder_add (&dict_builder, "{sv}", "label", label); g_variant_unref (label); } if (type) g_variant_builder_add (&dict_builder, "{sv}", "parameter-type", g_variant_new_string (type)); if (hint) { g_variant_builder_add (&dict_builder, "{sv}", "parameter-hint", hint); g_variant_unref (hint); } g_variant_builder_add (&actions_builder, "a{sv}", &dict_builder); g_object_unref (action); g_variant_unref (entry); g_free (prefixed_name); } g_action_muxer_insert (app->message_sub_actions, id, G_ACTION_GROUP (action_group)); actions = g_variant_builder_end (&actions_builder); g_object_unref (action_group); } if (draws_attention && !app->draws_attention) { app->draws_attention = TRUE; im_application_list_update_root_action (app->list); } app_icon = get_symbolic_app_icon (G_APP_INFO (app->info)); g_signal_emit (app->list, signals[MESSAGE_ADDED], 0, app->id, app_icon, id, serialized_icon, title, subtitle, body, actions, time, draws_attention); g_variant_iter_free (action_iter); g_object_unref (action); if (serialized_icon) g_variant_unref (serialized_icon); g_variant_unref (maybe_serialized_icon); g_object_unref (app_icon); } static void im_application_list_messages_listed (GObject *source_object, GAsyncResult *result, gpointer user_data) { Application *app = user_data; GVariant *messages; GError *error = NULL; if (indicator_messages_application_call_list_messages_finish (app->proxy, &messages, result, &error)) { GVariantIter iter; GVariant *message; g_variant_iter_init (&iter, messages); while ((message = g_variant_iter_next_value (&iter))) { im_application_list_message_added (app, message); g_variant_unref (message); } g_variant_unref (messages); } else { g_warning ("could not fetch the list of messages: %s", error->message); g_error_free (error); } } static void im_application_list_unset_remote (Application *app) { gboolean was_running; was_running = app->proxy || app->cancellable; if (app->cancellable) { g_cancellable_cancel (app->cancellable); g_clear_object (&app->cancellable); } g_clear_object (&app->proxy); /* clear actions by creating a new action group and overriding it in * the muxer */ g_object_unref (app->source_actions); g_object_unref (app->message_actions); g_object_unref (app->message_sub_actions); app->source_actions = g_simple_action_group_new (); app->message_actions = g_simple_action_group_new (); app->message_sub_actions = g_action_muxer_new (); g_action_muxer_insert (app->muxer, "src", G_ACTION_GROUP (app->source_actions)); g_action_muxer_insert (app->muxer, "msg", G_ACTION_GROUP (app->message_actions)); g_action_muxer_insert (app->muxer, "msg-actions", G_ACTION_GROUP (app->message_sub_actions)); app->draws_attention = FALSE; im_application_list_update_root_action (app->list); g_action_group_change_action_state (G_ACTION_GROUP (app->muxer), "launch", g_variant_new_boolean (FALSE)); if (was_running) g_signal_emit (app->list, signals[APP_STOPPED], 0, app->id); } static void im_application_list_app_vanished (GDBusConnection *connection, const gchar *name, gpointer user_data) { Application *app = user_data; im_application_list_unset_remote (app); } static void im_application_list_proxy_created (GObject *source_object, GAsyncResult *result, gpointer user_data) { Application *app = user_data; GError *error = NULL; app->proxy = indicator_messages_application_proxy_new_finish (result, &error); if (!app->proxy) { if (error->code != G_IO_ERROR_CANCELLED) g_warning ("could not create application proxy: %s", error->message); g_error_free (error); return; } indicator_messages_application_call_list_sources (app->proxy, app->cancellable, im_application_list_sources_listed, app); indicator_messages_application_call_list_messages (app->proxy, app->cancellable, im_application_list_messages_listed, app); g_signal_connect_swapped (app->proxy, "source-added", G_CALLBACK (im_application_list_source_added), app); g_signal_connect_swapped (app->proxy, "source-changed", G_CALLBACK (im_application_list_source_changed), app); g_signal_connect_swapped (app->proxy, "source-removed", G_CALLBACK (im_application_list_source_removed), app); g_signal_connect_swapped (app->proxy, "message-added", G_CALLBACK (im_application_list_message_added), app); g_signal_connect_swapped (app->proxy, "message-removed", G_CALLBACK (im_application_list_message_removed), app); g_action_group_change_action_state (G_ACTION_GROUP (app->muxer), "launch", g_variant_new_boolean (TRUE)); g_bus_watch_name_on_connection (g_dbus_proxy_get_connection (G_DBUS_PROXY (app->proxy)), g_dbus_proxy_get_name (G_DBUS_PROXY (app->proxy)), G_BUS_NAME_WATCHER_FLAGS_NONE, NULL, im_application_list_app_vanished, app, NULL); } void im_application_list_set_remote (ImApplicationList *list, const gchar *id, GDBusConnection *connection, const gchar *unique_bus_name, const gchar *object_path) { Application *app; g_return_if_fail (IM_IS_APPLICATION_LIST (list)); app = im_application_list_lookup (list, id); if (!app) { g_warning ("'%s' is not a registered application", id); return; } if (!connection && !unique_bus_name && !object_path) { im_application_list_unset_remote (app); return; } if (app->cancellable) { gchar *name_owner = NULL; if (app->proxy) name_owner = g_dbus_proxy_get_name_owner (G_DBUS_PROXY (app->proxy)); if (g_strcmp0 (name_owner, unique_bus_name) != 0) { g_warning ("replacing '%s' at %s with %s", id, name_owner, unique_bus_name); im_application_list_unset_remote (app); } g_free (name_owner); } app->cancellable = g_cancellable_new (); indicator_messages_application_proxy_new (connection, G_DBUS_PROXY_FLAGS_NONE, unique_bus_name, object_path, app->cancellable, im_application_list_proxy_created, app); } GActionGroup * im_application_list_get_action_group (ImApplicationList *list) { g_return_val_if_fail (IM_IS_APPLICATION_LIST (list), NULL); return G_ACTION_GROUP (list->muxer); } GList * im_application_list_get_applications (ImApplicationList *list) { g_return_val_if_fail (IM_IS_APPLICATION_LIST (list), NULL); return g_hash_table_get_keys (list->applications); } GDesktopAppInfo * im_application_list_get_application (ImApplicationList *list, const gchar *id) { Application *app; g_return_val_if_fail (IM_IS_APPLICATION_LIST (list), NULL); app = g_hash_table_lookup (list->applications, id); return app ? app->info : NULL; } static void status_activated (GSimpleAction * action, GVariant * param, gpointer user_data) { g_return_if_fail (IM_IS_APPLICATION_LIST(user_data)); ImApplicationList * list = IM_APPLICATION_LIST(user_data); const gchar * status = g_variant_get_string(param, NULL); g_simple_action_set_state(action, param); GList * appshash = g_hash_table_get_keys(list->app_status); GList * appsfree = g_list_copy_deep(appshash, (GCopyFunc)g_strdup, NULL); GList * app; for (app = appsfree; app != NULL; app = g_list_next(app)) { g_hash_table_insert(list->app_status, app->data, g_strdup(status)); } g_list_free(appshash); g_list_free(appsfree); g_signal_emit (list, signals[STATUS_SET], 0, status); im_application_list_update_root_action(list); return; } #define STATUS_ID_OFFLINE (G_N_ELEMENTS(status_ids) - 1) static const gchar *status_ids[] = { "available", "away", "busy", "invisible", "offline" }; static guint status2val (const gchar * string) { if (string == NULL) return STATUS_ID_OFFLINE; guint i; for (i = 0; i < G_N_ELEMENTS(status_ids); i++) { if (g_strcmp0(status_ids[i], string) == 0) { break; } } if (i > STATUS_ID_OFFLINE) i = STATUS_ID_OFFLINE; return i; } void im_application_list_set_status (ImApplicationList * list, const gchar * id, const gchar *status) { g_return_if_fail (IM_IS_APPLICATION_LIST (list)); g_hash_table_insert(list->app_status, im_application_list_canonical_id(id), g_strdup(status)); guint final_status = STATUS_ID_OFFLINE; GList * statuses = g_hash_table_get_values(list->app_status); GList * statusentry; for (statusentry = statuses; statusentry != NULL; statusentry = g_list_next(statusentry)) { guint statusval = status2val((gchar *)statusentry->data); final_status = MIN(final_status, statusval); } g_list_free(statuses); g_simple_action_set_state(list->statusaction, g_variant_new_string(status_ids[final_status])); im_application_list_update_root_action(list); return; } indicator-messages-13.10.1+14.04.20140410/src/im-menu.h0000644000015301777760000000550512321504521022336 0ustar pbusernogroup00000000000000/* * Copyright 2013 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License version 3, as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranties of * MERCHANTABILITY, SATISFACTORY QUALITY, 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, see . * * Authors: * Lars Uebernickel */ #ifndef __IM_MENU_H__ #define __IM_MENU_H__ #include #include "im-application-list.h" #define IM_TYPE_MENU (im_menu_get_type ()) #define IM_MENU(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), IM_TYPE_MENU, ImMenu)) #define IM_MENU_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), IM_TYPE_MENU, ImMenuClass)) #define IM_IS_MENU(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IM_TYPE_MENU)) #define IM_IS_MENU_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), IM_TYPE_MENU)) #define IM_MENU_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), IM_TYPE_MENU, ImMenuClass)) typedef struct _ImMenuClass ImMenuClass; typedef struct _ImMenu ImMenu; typedef struct _ImMenuPrivate ImMenuPrivate; struct _ImMenuClass { GObjectClass parent_class; }; struct _ImMenu { GObject parent_instance; }; GType im_menu_get_type (void) G_GNUC_CONST; ImApplicationList * im_menu_get_application_list (ImMenu *menu); gboolean im_menu_export (ImMenu *menu, GDBusConnection *connection, const gchar *object_path, GError **error); void im_menu_prepend_section (ImMenu *menu, GMenuModel *section); void im_menu_append_section (ImMenu *menu, GMenuModel *section); void im_menu_insert_item_sorted (ImMenu *menu, GMenuItem *item, gint first, gint last); #endif indicator-messages-13.10.1+14.04.20140410/src/im-application-list.h0000644000015301777760000000622112321504521024642 0ustar pbusernogroup00000000000000/* * Copyright 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License version 3, as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranties of * MERCHANTABILITY, SATISFACTORY QUALITY, 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, see . * * Authors: * Lars Uebernickel */ #ifndef __IM_APPLICATION_LIST_H__ #define __IM_APPLICATION_LIST_H__ #include #include #define IM_TYPE_APPLICATION_LIST (im_application_list_get_type ()) #define IM_APPLICATION_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), IM_TYPE_APPLICATION_LIST, ImApplicationList)) #define IM_APPLICATION_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), IM_TYPE_APPLICATION_LIST, ImApplicationListClass)) #define IM_IS_APPLICATION_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IM_TYPE_APPLICATION_LIST)) #define IM_IS_APPLICATION_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), IM_TYPE_APPLICATION_LIST)) #define IM_APPLICATION_LIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), IM_TYPE_APPLICATION_LIST, ImApplicationListClass)) typedef struct _ImApplicationList ImApplicationList; GType im_application_list_get_type (void); ImApplicationList * im_application_list_new (void); gboolean im_application_list_add (ImApplicationList *list, const gchar *desktop_id); void im_application_list_remove (ImApplicationList *list, const gchar *id); void im_application_list_set_remote (ImApplicationList *list, const gchar *id, GDBusConnection *connection, const gchar *unique_bus_name, const gchar *object_path); GActionGroup * im_application_list_get_action_group (ImApplicationList *list); GList * im_application_list_get_applications (ImApplicationList *list); GDesktopAppInfo * im_application_list_get_application (ImApplicationList *list, const gchar *id); void im_application_list_set_status (ImApplicationList *list, const gchar *id, const gchar *status); #endif indicator-messages-13.10.1+14.04.20140410/src/im-phone-menu.h0000644000015301777760000000705112321504521023443 0ustar pbusernogroup00000000000000/* * Copyright 2012 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License version 3, as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranties of * MERCHANTABILITY, SATISFACTORY QUALITY, 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, see . * * Authors: * Lars Uebernickel */ #ifndef __IM_PHONE_MENU_H__ #define __IM_PHONE_MENU_H__ #include "im-menu.h" #define IM_TYPE_PHONE_MENU (im_phone_menu_get_type ()) #define IM_PHONE_MENU(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), IM_TYPE_PHONE_MENU, ImPhoneMenu)) #define IM_PHONE_MENU_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), IM_TYPE_PHONE_MENU, ImPhoneMenuClass)) #define IM_IS_PHONE_MENU(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IM_TYPE_PHONE_MENU)) #define IM_IS_PHONE_MENU_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), IM_TYPE_PHONE_MENU)) #define IM_PHONE_MENU_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), IM_TYPE_PHONE_MENU, ImPhoneMenuClass)) typedef struct _ImPhoneMenu ImPhoneMenu; GType im_phone_menu_get_type (void); ImPhoneMenu * im_phone_menu_new (ImApplicationList *applist); void im_phone_menu_add_message (ImPhoneMenu *menu, const gchar *app_id, GIcon *app_icon, const gchar *id, GVariant *serialized_icon, const gchar *title, const gchar *subtitle, const gchar *body, GVariant *actions, gint64 time); void im_phone_menu_remove_message (ImPhoneMenu *menu, const gchar *app_id, const gchar *id); void im_phone_menu_add_source (ImPhoneMenu *menu, const gchar *app_id, const gchar *id, const gchar *label, const gchar *iconstr); void im_phone_menu_remove_source (ImPhoneMenu *menu, const gchar *app_id, const gchar *id); void im_phone_menu_remove_application (ImPhoneMenu *menu, const gchar *app_id); void im_phone_menu_remove_all (ImPhoneMenu *menu); #endif indicator-messages-13.10.1+14.04.20140410/src/indicator-desktop-shortcuts.h0000644000015301777760000000674612321504521026456 0ustar pbusernogroup00000000000000/* A small file to parse through the actions that are available in the desktop file and making those easily usable. Copyright 2010 Canonical Ltd. Authors: Ted Gould This library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 3.0 as published by the Free Software Foundation. This library 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 version 3.0 for more details. You should have received a copy of the GNU General Public License along with this library. If not, see . */ #ifndef __INDICATOR_DESKTOP_SHORTCUTS_H__ #define __INDICATOR_DESKTOP_SHORTCUTS_H__ #include #include #include G_BEGIN_DECLS #define INDICATOR_TYPE_DESKTOP_SHORTCUTS (indicator_desktop_shortcuts_get_type ()) #define INDICATOR_DESKTOP_SHORTCUTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), INDICATOR_TYPE_DESKTOP_SHORTCUTS, IndicatorDesktopShortcuts)) #define INDICATOR_DESKTOP_SHORTCUTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), INDICATOR_TYPE_DESKTOP_SHORTCUTS, IndicatorDesktopShortcutsClass)) #define INDICATOR_IS_DESKTOP_SHORTCUTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), INDICATOR_TYPE_DESKTOP_SHORTCUTS)) #define INDICATOR_IS_DESKTOP_SHORTCUTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), INDICATOR_TYPE_DESKTOP_SHORTCUTS)) #define INDICATOR_DESKTOP_SHORTCUTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), INDICATOR_TYPE_DESKTOP_SHORTCUTS, IndicatorDesktopShortcutsClass)) typedef struct _IndicatorDesktopShortcuts IndicatorDesktopShortcuts; typedef struct _IndicatorDesktopShortcutsClass IndicatorDesktopShortcutsClass; /** IndicatorDesktopShortcutsClass: @parent_class: Space for #GObjectClass The vtable for our precious #IndicatorDesktopShortcutsClass. */ struct _IndicatorDesktopShortcutsClass { GObjectClass parent_class; }; /** IndicatorDesktopShortcuts: @parent: The parent data from #GObject The public data for an instance of the class #IndicatorDesktopShortcuts. */ struct _IndicatorDesktopShortcuts { GObject parent; }; GType indicator_desktop_shortcuts_get_type (void); IndicatorDesktopShortcuts * indicator_desktop_shortcuts_new (const gchar * file, const gchar * identity); const gchar ** indicator_desktop_shortcuts_get_nicks (IndicatorDesktopShortcuts * ids); gchar * indicator_desktop_shortcuts_nick_get_name (IndicatorDesktopShortcuts * ids, const gchar * nick); gboolean indicator_desktop_shortcuts_nick_exec_with_context (IndicatorDesktopShortcuts * ids, const gchar * nick, GAppLaunchContext * launch_context); GLIB_DEPRECATED_FOR(indicator_desktop_shortcuts_nick_exec_with_context) gboolean indicator_desktop_shortcuts_nick_exec (IndicatorDesktopShortcuts * ids, const gchar * nick); G_END_DECLS #endif indicator-messages-13.10.1+14.04.20140410/m4/0000755000015301777760000000000012321504777020357 5ustar pbusernogroup00000000000000indicator-messages-13.10.1+14.04.20140410/m4/gcov.m40000644000015301777760000000471212321504521021546 0ustar pbusernogroup00000000000000# Checks for existence of coverage tools: # * gcov # * lcov # * genhtml # * gcovr # # Sets ac_cv_check_gcov to yes if tooling is present # and reports the executables to the variables LCOV, GCOVR and GENHTML. AC_DEFUN([AC_TDD_GCOV], [ AC_ARG_ENABLE(gcov, AS_HELP_STRING([--enable-gcov], [enable coverage testing with gcov]), [use_gcov=$enableval], [use_gcov=no]) if test "x$use_gcov" = "xyes"; then # we need gcc: if test "$GCC" != "yes"; then AC_MSG_ERROR([GCC is required for --enable-gcov]) fi # Check if ccache is being used AC_CHECK_PROG(SHTOOL, shtool, shtool) case `$SHTOOL path $CC` in *ccache*[)] gcc_ccache=yes;; *[)] gcc_ccache=no;; esac if test "$gcc_ccache" = "yes" && (test -z "$CCACHE_DISABLE" || test "$CCACHE_DISABLE" != "1"); then AC_MSG_ERROR([ccache must be disabled when --enable-gcov option is used. You can disable ccache by setting environment variable CCACHE_DISABLE=1.]) fi lcov_version_list="1.6 1.7 1.8 1.9 1.10" AC_CHECK_PROG(LCOV, lcov, lcov) AC_CHECK_PROG(GENHTML, genhtml, genhtml) if test "$LCOV"; then AC_CACHE_CHECK([for lcov version], glib_cv_lcov_version, [ glib_cv_lcov_version=invalid lcov_version=`$LCOV -v 2>/dev/null | $SED -e 's/^.* //'` for lcov_check_version in $lcov_version_list; do if test "$lcov_version" = "$lcov_check_version"; then glib_cv_lcov_version="$lcov_check_version (ok)" fi done ]) else lcov_msg="To enable code coverage reporting you must have one of the following lcov versions installed: $lcov_version_list" AC_MSG_ERROR([$lcov_msg]) fi case $glib_cv_lcov_version in ""|invalid[)] lcov_msg="You must have one of the following versions of lcov: $lcov_version_list (found: $lcov_version)." AC_MSG_ERROR([$lcov_msg]) LCOV="exit 0;" ;; esac if test -z "$GENHTML"; then AC_MSG_ERROR([Could not find genhtml from the lcov package]) fi ac_cv_check_gcov=yes ac_cv_check_lcov=yes # Remove all optimization flags from CFLAGS changequote({,}) CFLAGS=`echo "$CFLAGS" | $SED -e 's/-O[0-9]*//g'` changequote([,]) # Add the special gcc flags COVERAGE_CFLAGS="-O0 -fprofile-arcs -ftest-coverage" COVERAGE_CXXFLAGS="-O0 -fprofile-arcs -ftest-coverage" COVERAGE_LDFLAGS="-lgcov" # Check availability of gcovr AC_CHECK_PROG(GCOVR, gcovr, gcovr) if test -z "$GCOVR"; then ac_cv_check_gcovr=no else ac_cv_check_gcovr=yes fi fi ]) # AC_TDD_GCOV indicator-messages-13.10.1+14.04.20140410/m4/ax_python_module.m40000644000015301777760000000232712321504521024166 0ustar pbusernogroup00000000000000# =========================================================================== # 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 # # 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 ]) indicator-messages-13.10.1+14.04.20140410/m4/gtest.m40000644000015301777760000000477112321504521021743 0ustar pbusernogroup00000000000000# Copyright (C) 2012 Canonical, Ltd. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice (including the next # paragraph) shall be included in all copies or substantial portions of the # Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. # Checks whether the gtest source is available on the system. Allows for # adjusting the include and source path. Sets have_gtest=yes if the source is # present. Sets GTEST_CPPFLAGS and GTEST_SOURCE to the preprocessor flags and # source location respectively. AC_DEFUN([CHECK_GTEST], [ AC_ARG_WITH([gtest-include-path], [AS_HELP_STRING([--with-gtest-include-path], [location of the Google test headers])], [GTEST_CPPFLAGS="-I$withval"]) AC_ARG_WITH([gtest-source-path], [AS_HELP_STRING([--with-gtest-source-path], [location of the Google test sources, defaults to /usr/src/gtest])], [GTEST_SOURCE="$withval"], [GTEST_SOURCE="/usr/src/gtest"]) GTEST_CPPFLAGS="$GTEST_CPPFLAGS -I$GTEST_SOURCE" AC_LANG_PUSH([C++]) tmp_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $GTEST_CPPFLAGS" AC_CHECK_HEADER([gtest/gtest.h]) CPPFLAGS="$tmp_CPPFLAGS" AC_LANG_POP AC_CHECK_FILES([$GTEST_SOURCE/src/gtest-all.cc] [$GTEST_SOURCE/src/gtest_main.cc], [have_gtest_source=yes], [have_gtest_source=no]) AS_IF([test "x$ac_cv_header_gtest_gtest_h" = xyes -a \ "x$have_gtest_source" = xyes], [have_gtest=yes] [AC_SUBST(GTEST_CPPFLAGS)] [AC_SUBST(GTEST_SOURCE)], [have_gtest=no]) ]) # CHECK_GTEST indicator-messages-13.10.1+14.04.20140410/AUTHORS0000644000015301777760000000003112321504521021064 0ustar pbusernogroup00000000000000# Generated by Makefile indicator-messages-13.10.1+14.04.20140410/README0000644000015301777760000000000012321504521020670 0ustar pbusernogroup00000000000000indicator-messages-13.10.1+14.04.20140410/common/0000755000015301777760000000000012321504777021327 5ustar pbusernogroup00000000000000indicator-messages-13.10.1+14.04.20140410/common/Makefile.am0000644000015301777760000000202012321504521023340 0ustar pbusernogroup00000000000000 noinst_LTLIBRARIES = libmessaging-common.la indicator-messages-service.c: com.canonical.indicator.messages.service.xml $(AM_V_GEN) gdbus-codegen \ --interface-prefix com.canonical.indicator.messages. \ --generate-c-code indicator-messages-service \ --c-namespace IndicatorMessages \ $^ indicator-messages-service.h: indicator-messages-service.c indicator-messages-application.c: com.canonical.indicator.messages.application.xml $(AM_V_GEN) gdbus-codegen \ --interface-prefix com.canonical.indicator.messages. \ --generate-c-code indicator-messages-application \ --c-namespace IndicatorMessages \ $^ indicator-messages-application.h: indicator-messages-application.c BUILT_SOURCES = \ indicator-messages-service.c \ indicator-messages-service.h \ indicator-messages-application.c \ indicator-messages-application.h libmessaging_common_la_SOURCES = \ $(BUILT_SOURCES) libmessaging_common_la_CFLAGS = $(GIO_CFLAGS) libmessaging_common_la_LIBADD = $(GIO_LIBS) CLEANFILES = $(BUILT_SOURCES) indicator-messages-13.10.1+14.04.20140410/common/com.canonical.indicator.messages.application.xml0000644000015301777760000000264012321504521032625 0ustar pbusernogroup00000000000000 indicator-messages-13.10.1+14.04.20140410/common/com.canonical.indicator.messages.service.xml0000644000015301777760000000136512321504521031765 0ustar pbusernogroup00000000000000