aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--AUTHORS2
-rw-r--r--ChangeLog106
-rwxr-xr-xconfigure56
-rw-r--r--configure.ac18
-rw-r--r--src/default-applications.c43
-rw-r--r--src/gen-messages-service.xml.c4
-rw-r--r--src/indicator-messages.c27
-rw-r--r--src/messages-service-dbus.c9
-rw-r--r--src/messages-service.c41
-rw-r--r--src/messages-service.xml4
10 files changed, 248 insertions, 62 deletions
diff --git a/AUTHORS b/AUTHORS
index 908c6ee..4c7fee5 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -1,12 +1,14 @@
# Generated by Makefile. Do not edit.
Andrea Cimitan
+ Chris Coulson
cody
David Barth
James Westby
Kees Cook
Ken VanDine
Luke Yelavich
+ Marco Trevisan (Treviño)
Michael Terry
Sebstien Bacher
Ted Gould
diff --git a/ChangeLog b/ChangeLog
index e822218..58ec3a0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,111 @@
# Generated by Makefile. Do not edit.
+2011-08-11 Ted Gould <ted@gould.cx>
+
+ 0.4.93
+
+2011-08-11 Ted Gould <ted@gould.cx>
+
+ Migrating to libindicate 0.6 API
+
+2011-07-22 Ted Gould <ted@gould.cx>
+
+ Add a clear attention menu item and attach it to middle click
+
+2011-07-22 Ted Gould <ted@gould.cx>
+
+ Make sure clear attention stays at the end
+
+2011-07-22 Ted Gould <ted@gould.cx>
+
+ No need to track the last separator as we now have a menu item below it.
+
+2011-07-22 Ted Gould <ted@gould.cx>
+
+ Adding in the clear attention menu item
+
+2011-07-21 Ted Gould <ted@gould.cx>
+
+ Removing the menu item from the indicator
+
+2011-07-21 Ted Gould <ted@gould.cx>
+
+ Responding to clear attention method by clearing the dot
+
+2011-07-21 Ted Gould <ted@gould.cx>
+
+ Switching to calling a method instead of clearing in the indictor.
+
+2011-07-21 Ted Gould <ted@gould.cx>
+
+ Removing Watch method as that's been moved to libindicator (for a while)
+
+2011-07-21 Ted Gould <ted@gould.cx>
+
+ Adding a method to clear the attention
+
+2011-07-21 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ Don't use g_return_if_fail in middle-click cb function
+
+ We don't need an assertion there.
+
+2011-07-21 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ X and Y pointer position aren't supported anymore by libindicator
+
+ Dropping them!
+
+2011-07-19 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ Added a "Clear notifications" menu as well...
+
+2011-07-19 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ Merge with upstream
+
+2011-07-11 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ Reset the un-attention icon on secondary-activate over indicator
+
+ When the messaging menu is in the "attention" state, middle-clicking
+ over the indicator-messages will clear the attention icon.
+
+2011-07-11 Marco Trevisan (Treviño) <mail@3v1n0.net>
+
+ configure.ac: Use the "--with-gtk" option flag.
+
+ Use this flag, as all other projects in unity and indicators land
+
+2011-07-22 Ted Gould <ted@gould.cx>
+
+ Making mail applications based on the default mail client not a hardcoded desktop file.
+
+2011-07-22 Ted Gould <ted@gould.cx>
+
+ Use the G_N_ELEMENTS macro
+
+2011-07-22 Ted Gould <ted@gould.cx>
+
+ Reworking found slightly to make clean up code nicer
+
+2011-07-21 Chris Coulson <chrisccoulson@ubuntu.com>
+
+ Honour the default mail client rather than hardcoding the Mail entry to point to Evolution
+
+2011-07-22 Ted Gould <ted@gould.cx>
+
+ Make sure to insert in the right locations
+
+2011-07-22 Chris Coulson <chrisccoulson@ubuntu.com>
+
+ Make all indicator entries appear after an applications shortcuts
+
+ Currently, indicator_added and resort_menu have different ideas of where they should go.
+ indicator_added puts them before shortcuts, whereas resort_menu will move the shortcuts
+ before them. This leads to a situation where shortcut entries end up inbetween an applications
+ indicator entries (and this happens a lot with Thunderbird)
+
2011-07-14 Ted Gould <ted@gould.cx>
0.4.92
diff --git a/configure b/configure
index 555a524..7f800a8 100755
--- a/configure
+++ b/configure
@@ -799,7 +799,7 @@ with_sysroot
enable_libtool_lock
enable_silent_rules
enable_deprecations
-with_indicator_gtk
+with_gtk
enable_localinstall
'
ac_precious_vars='build_alias
@@ -1466,7 +1466,7 @@ Optional Packages:
--with-gnu-ld assume the C compiler uses GNU ld [default=no]
--with-sysroot=DIR Search for dependent libraries within DIR
(or the compiler's sysroot if not specified).
- --with-indicator-gtk Which version of gtk to use for the indicator
+ --with-gtk Which version of gtk to use for the indicator
[default=3]
Some influential environment variables:
@@ -2758,7 +2758,7 @@ fi
# Define the identity of the package.
PACKAGE=indicator-messages
- VERSION=0.4.92
+ VERSION=0.4.93
cat >>confdefs.h <<_ACEOF
@@ -12794,11 +12794,11 @@ INDICATOR_REQUIRED_VERSION=0.3.19
DBUSMENUGTK_REQUIRED_VERSION=0.3.94
-# Check whether --with-indicator-gtk was given.
-if test "${with_indicator_gtk+set}" = set; then :
- withval=$with_indicator_gtk;
+# Check whether --with-gtk was given.
+if test "${with_gtk+set}" = set; then :
+ withval=$with_gtk;
else
- with_indicator_gtk=3
+ with_gtk=3
fi
@@ -12922,7 +12922,7 @@ $as_echo "no" >&6; }
PKG_CONFIG=""
fi
fi
-if test "x$with_indicator_gtk" = x3; then :
+if test "x$with_gtk" = x3; then :
pkg_failed=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for APPLET" >&5
@@ -12935,12 +12935,12 @@ if test -n "$APPLET_CFLAGS"; then
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gtk+-3.0 >= \$GTK3_REQUIRED_VERSION
gio-unix-2.0 >= \$GIO_UNIX_REQUIRED_VERSION
indicator3-0.4 >= \$INDICATOR_REQUIRED_VERSION
- indicate-0.5 >= \$INDICATE_REQUIRED_VERSION
+ indicate-0.6 >= \$INDICATE_REQUIRED_VERSION
dbusmenu-gtk3-0.4 >= \$DBUSMENUGTK_REQUIRED_VERSION\""; } >&5
($PKG_CONFIG --exists --print-errors "gtk+-3.0 >= $GTK3_REQUIRED_VERSION
gio-unix-2.0 >= $GIO_UNIX_REQUIRED_VERSION
indicator3-0.4 >= $INDICATOR_REQUIRED_VERSION
- indicate-0.5 >= $INDICATE_REQUIRED_VERSION
+ indicate-0.6 >= $INDICATE_REQUIRED_VERSION
dbusmenu-gtk3-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
@@ -12948,7 +12948,7 @@ if test -n "$APPLET_CFLAGS"; then
pkg_cv_APPLET_CFLAGS=`$PKG_CONFIG --cflags "gtk+-3.0 >= $GTK3_REQUIRED_VERSION
gio-unix-2.0 >= $GIO_UNIX_REQUIRED_VERSION
indicator3-0.4 >= $INDICATOR_REQUIRED_VERSION
- indicate-0.5 >= $INDICATE_REQUIRED_VERSION
+ indicate-0.6 >= $INDICATE_REQUIRED_VERSION
dbusmenu-gtk3-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
@@ -12964,12 +12964,12 @@ if test -n "$APPLET_LIBS"; then
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gtk+-3.0 >= \$GTK3_REQUIRED_VERSION
gio-unix-2.0 >= \$GIO_UNIX_REQUIRED_VERSION
indicator3-0.4 >= \$INDICATOR_REQUIRED_VERSION
- indicate-0.5 >= \$INDICATE_REQUIRED_VERSION
+ indicate-0.6 >= \$INDICATE_REQUIRED_VERSION
dbusmenu-gtk3-0.4 >= \$DBUSMENUGTK_REQUIRED_VERSION\""; } >&5
($PKG_CONFIG --exists --print-errors "gtk+-3.0 >= $GTK3_REQUIRED_VERSION
gio-unix-2.0 >= $GIO_UNIX_REQUIRED_VERSION
indicator3-0.4 >= $INDICATOR_REQUIRED_VERSION
- indicate-0.5 >= $INDICATE_REQUIRED_VERSION
+ indicate-0.6 >= $INDICATE_REQUIRED_VERSION
dbusmenu-gtk3-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
@@ -12977,7 +12977,7 @@ if test -n "$APPLET_LIBS"; then
pkg_cv_APPLET_LIBS=`$PKG_CONFIG --libs "gtk+-3.0 >= $GTK3_REQUIRED_VERSION
gio-unix-2.0 >= $GIO_UNIX_REQUIRED_VERSION
indicator3-0.4 >= $INDICATOR_REQUIRED_VERSION
- indicate-0.5 >= $INDICATE_REQUIRED_VERSION
+ indicate-0.6 >= $INDICATE_REQUIRED_VERSION
dbusmenu-gtk3-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
@@ -13002,13 +13002,13 @@ fi
APPLET_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "gtk+-3.0 >= $GTK3_REQUIRED_VERSION
gio-unix-2.0 >= $GIO_UNIX_REQUIRED_VERSION
indicator3-0.4 >= $INDICATOR_REQUIRED_VERSION
- indicate-0.5 >= $INDICATE_REQUIRED_VERSION
+ indicate-0.6 >= $INDICATE_REQUIRED_VERSION
dbusmenu-gtk3-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION" 2>&1`
else
APPLET_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "gtk+-3.0 >= $GTK3_REQUIRED_VERSION
gio-unix-2.0 >= $GIO_UNIX_REQUIRED_VERSION
indicator3-0.4 >= $INDICATOR_REQUIRED_VERSION
- indicate-0.5 >= $INDICATE_REQUIRED_VERSION
+ indicate-0.6 >= $INDICATE_REQUIRED_VERSION
dbusmenu-gtk3-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
@@ -13017,7 +13017,7 @@ fi
as_fn_error $? "Package requirements (gtk+-3.0 >= $GTK3_REQUIRED_VERSION
gio-unix-2.0 >= $GIO_UNIX_REQUIRED_VERSION
indicator3-0.4 >= $INDICATOR_REQUIRED_VERSION
- indicate-0.5 >= $INDICATE_REQUIRED_VERSION
+ indicate-0.6 >= $INDICATE_REQUIRED_VERSION
dbusmenu-gtk3-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION) were not met:
$APPLET_PKG_ERRORS
@@ -13051,7 +13051,7 @@ $as_echo "yes" >&6; }
fi
-elif test "x$with_indicator_gtk" = x2; then :
+elif test "x$with_gtk" = x2; then :
pkg_failed=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for APPLET" >&5
@@ -13064,12 +13064,12 @@ if test -n "$APPLET_CFLAGS"; then
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gtk+-2.0 >= \$GTK_REQUIRED_VERSION
gio-unix-2.0 >= \$GIO_UNIX_REQUIRED_VERSION
indicator-0.4 >= \$INDICATOR_REQUIRED_VERSION
- indicate-0.5 >= \$INDICATE_REQUIRED_VERSION
+ indicate-0.6 >= \$INDICATE_REQUIRED_VERSION
dbusmenu-gtk-0.4 >= \$DBUSMENUGTK_REQUIRED_VERSION\""; } >&5
($PKG_CONFIG --exists --print-errors "gtk+-2.0 >= $GTK_REQUIRED_VERSION
gio-unix-2.0 >= $GIO_UNIX_REQUIRED_VERSION
indicator-0.4 >= $INDICATOR_REQUIRED_VERSION
- indicate-0.5 >= $INDICATE_REQUIRED_VERSION
+ indicate-0.6 >= $INDICATE_REQUIRED_VERSION
dbusmenu-gtk-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
@@ -13077,7 +13077,7 @@ if test -n "$APPLET_CFLAGS"; then
pkg_cv_APPLET_CFLAGS=`$PKG_CONFIG --cflags "gtk+-2.0 >= $GTK_REQUIRED_VERSION
gio-unix-2.0 >= $GIO_UNIX_REQUIRED_VERSION
indicator-0.4 >= $INDICATOR_REQUIRED_VERSION
- indicate-0.5 >= $INDICATE_REQUIRED_VERSION
+ indicate-0.6 >= $INDICATE_REQUIRED_VERSION
dbusmenu-gtk-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
@@ -13093,12 +13093,12 @@ if test -n "$APPLET_LIBS"; then
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gtk+-2.0 >= \$GTK_REQUIRED_VERSION
gio-unix-2.0 >= \$GIO_UNIX_REQUIRED_VERSION
indicator-0.4 >= \$INDICATOR_REQUIRED_VERSION
- indicate-0.5 >= \$INDICATE_REQUIRED_VERSION
+ indicate-0.6 >= \$INDICATE_REQUIRED_VERSION
dbusmenu-gtk-0.4 >= \$DBUSMENUGTK_REQUIRED_VERSION\""; } >&5
($PKG_CONFIG --exists --print-errors "gtk+-2.0 >= $GTK_REQUIRED_VERSION
gio-unix-2.0 >= $GIO_UNIX_REQUIRED_VERSION
indicator-0.4 >= $INDICATOR_REQUIRED_VERSION
- indicate-0.5 >= $INDICATE_REQUIRED_VERSION
+ indicate-0.6 >= $INDICATE_REQUIRED_VERSION
dbusmenu-gtk-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
@@ -13106,7 +13106,7 @@ if test -n "$APPLET_LIBS"; then
pkg_cv_APPLET_LIBS=`$PKG_CONFIG --libs "gtk+-2.0 >= $GTK_REQUIRED_VERSION
gio-unix-2.0 >= $GIO_UNIX_REQUIRED_VERSION
indicator-0.4 >= $INDICATOR_REQUIRED_VERSION
- indicate-0.5 >= $INDICATE_REQUIRED_VERSION
+ indicate-0.6 >= $INDICATE_REQUIRED_VERSION
dbusmenu-gtk-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
@@ -13131,13 +13131,13 @@ fi
APPLET_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "gtk+-2.0 >= $GTK_REQUIRED_VERSION
gio-unix-2.0 >= $GIO_UNIX_REQUIRED_VERSION
indicator-0.4 >= $INDICATOR_REQUIRED_VERSION
- indicate-0.5 >= $INDICATE_REQUIRED_VERSION
+ indicate-0.6 >= $INDICATE_REQUIRED_VERSION
dbusmenu-gtk-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION" 2>&1`
else
APPLET_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "gtk+-2.0 >= $GTK_REQUIRED_VERSION
gio-unix-2.0 >= $GIO_UNIX_REQUIRED_VERSION
indicator-0.4 >= $INDICATOR_REQUIRED_VERSION
- indicate-0.5 >= $INDICATE_REQUIRED_VERSION
+ indicate-0.6 >= $INDICATE_REQUIRED_VERSION
dbusmenu-gtk-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
@@ -13146,7 +13146,7 @@ fi
as_fn_error $? "Package requirements (gtk+-2.0 >= $GTK_REQUIRED_VERSION
gio-unix-2.0 >= $GIO_UNIX_REQUIRED_VERSION
indicator-0.4 >= $INDICATOR_REQUIRED_VERSION
- indicate-0.5 >= $INDICATE_REQUIRED_VERSION
+ indicate-0.6 >= $INDICATE_REQUIRED_VERSION
dbusmenu-gtk-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION) were not met:
$APPLET_PKG_ERRORS
@@ -13600,7 +13600,7 @@ fi
if test "x$with_localinstall" = "xyes"; then
INDICATORDIR="${libdir}/indicators/2/"
INDICATORICONSDIR="${datadir}/libindicate/icons/"
-elif test "x$with_indicator_gtk" = x2; then
+elif test "x$with_gtk" = x2; then
INDICATORDIR=`$PKG_CONFIG --variable=indicatordir indicator-0.4`
INDICATORICONSDIR=`$PKG_CONFIG --variable=iconsdir indicator-0.4`
else
diff --git a/configure.ac b/configure.ac
index 92f5c88..45bccf0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4,7 +4,7 @@ AC_INIT(src/indicator-messages.c)
AC_PREREQ(2.53)
AM_CONFIG_HEADER(config.h)
-AM_INIT_AUTOMAKE(indicator-messages, 0.4.92)
+AM_INIT_AUTOMAKE(indicator-messages, 0.4.93)
AM_MAINTAINER_MODE
@@ -43,24 +43,24 @@ INDICATE_REQUIRED_VERSION=0.4.90
INDICATOR_REQUIRED_VERSION=0.3.19
DBUSMENUGTK_REQUIRED_VERSION=0.3.94
-AC_ARG_WITH([indicator-gtk],
- [AS_HELP_STRING([--with-indicator-gtk],
+AC_ARG_WITH([gtk],
+ [AS_HELP_STRING([--with-gtk],
[Which version of gtk to use for the indicator @<:@default=3@:>@])],
[],
- [with_indicator_gtk=3])
+ [with_gtk=3])
-AS_IF([test "x$with_indicator_gtk" = x3],
+AS_IF([test "x$with_gtk" = x3],
[PKG_CHECK_MODULES(APPLET, gtk+-3.0 >= $GTK3_REQUIRED_VERSION
gio-unix-2.0 >= $GIO_UNIX_REQUIRED_VERSION
indicator3-0.4 >= $INDICATOR_REQUIRED_VERSION
- indicate-0.5 >= $INDICATE_REQUIRED_VERSION
+ indicate-0.6 >= $INDICATE_REQUIRED_VERSION
dbusmenu-gtk3-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION)
],
- [test "x$with_indicator_gtk" = x2],
+ [test "x$with_gtk" = x2],
[PKG_CHECK_MODULES(APPLET, gtk+-2.0 >= $GTK_REQUIRED_VERSION
gio-unix-2.0 >= $GIO_UNIX_REQUIRED_VERSION
indicator-0.4 >= $INDICATOR_REQUIRED_VERSION
- indicate-0.5 >= $INDICATE_REQUIRED_VERSION
+ indicate-0.6 >= $INDICATE_REQUIRED_VERSION
dbusmenu-gtk-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION)
],
[AC_MSG_FAILURE([Value for --with-indicator-gtk was neither 2 nor 3])]
@@ -104,7 +104,7 @@ AC_ARG_ENABLE(localinstall, AS_HELP_STRING([--enable-localinstall], [install all
if test "x$with_localinstall" = "xyes"; then
INDICATORDIR="${libdir}/indicators/2/"
INDICATORICONSDIR="${datadir}/libindicate/icons/"
-elif test "x$with_indicator_gtk" = x2; then
+elif test "x$with_gtk" = x2; then
INDICATORDIR=`$PKG_CONFIG --variable=indicatordir indicator-0.4`
INDICATORICONSDIR=`$PKG_CONFIG --variable=iconsdir indicator-0.4`
else
diff --git a/src/default-applications.c b/src/default-applications.c
index afb5025..0382e4d 100644
--- a/src/default-applications.c
+++ b/src/default-applications.c
@@ -21,20 +21,22 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include <glib.h>
#include <glib/gi18n.h>
+#include <gio/gio.h>
+#include <gio/gdesktopappinfo.h>
#include "default-applications.h"
struct default_db_t {
const gchar * desktop_file;
+ const gchar * uri_scheme;
const gchar * name;
const gchar * setupname;
const gchar * icon;
};
struct default_db_t default_db[] = {
- {"evolution.desktop", N_("Mail"), N_("Set Up Mail..."), "applications-email-panel"},
- {"empathy.desktop", N_("Chat"), N_("Set Up Chat..."), "applications-chat-panel"},
- {"gwibber.desktop", N_("Broadcast"), N_("Set Up Broadcast Account..."), "applications-microblogging-panel"},
- {NULL, NULL}
+ {NULL, "mailto", N_("Mail"), N_("Set Up Mail..."), "applications-email-panel"},
+ {"empathy.desktop", NULL, N_("Chat"), N_("Set Up Chat..."), "applications-chat-panel"},
+ {"gwibber.desktop", NULL, N_("Broadcast"), N_("Set Up Broadcast Account..."), "applications-microblogging-panel"},
};
static struct default_db_t *
@@ -44,17 +46,40 @@ get_default_helper (const gchar * desktop_path)
gchar * basename = g_path_get_basename(desktop_path);
g_return_val_if_fail(basename != NULL, NULL);
+ gboolean found = FALSE;
gint i;
- for (i = 0; default_db[i].desktop_file != NULL; i++) {
- if (g_strcmp0(default_db[i].desktop_file, basename) == 0) {
- break;
+ gint length = G_N_ELEMENTS(default_db);
+ for (i = 0; i < length && !found; i++) {
+ if (default_db[i].desktop_file) {
+ if (g_strcmp0(default_db[i].desktop_file, basename) == 0) {
+ found = TRUE;
+ }
+ } else if (default_db[i].uri_scheme) {
+ GAppInfo *info = g_app_info_get_default_for_uri_scheme(default_db[i].uri_scheme);
+ if (!info) {
+ continue;
+ }
+
+ const gchar * filename = g_desktop_app_info_get_filename(G_DESKTOP_APP_INFO(info));
+ if (!filename) {
+ g_object_unref(info);
+ continue;
+ }
+
+ gchar * default_basename = g_path_get_basename(filename);
+ g_object_unref(info);
+ if (g_strcmp0(default_basename, basename) == 0) {
+ found = TRUE;
+ }
+
+ g_free(default_basename);
}
}
g_free(basename);
- if (default_db[i].desktop_file != NULL) {
- return &default_db[i];
+ if (found) {
+ return &default_db[i - 1];
}
return NULL;
diff --git a/src/gen-messages-service.xml.c b/src/gen-messages-service.xml.c
index 0a1c0d1..4e94dc3 100644
--- a/src/gen-messages-service.xml.c
+++ b/src/gen-messages-service.xml.c
@@ -4,15 +4,13 @@ const char * _messages_service =
" <interface name=\"com.canonical.indicator.messages.service\">\n"
"\n"
"<!-- Methods -->\n"
-" <method name=\"Watch\">\n"
-" <annotation name=\"org.freedesktop.DBus.GLib.Async\" value=\"true\" />\n"
-" </method>\n"
" <method name=\"AttentionRequested\">\n"
" <arg type=\"b\" name=\"dot\" direction=\"out\" />\n"
" </method>\n"
" <method name=\"IconShown\">\n"
" <arg type=\"b\" name=\"hidden\" direction=\"out\" />\n"
" </method>\n"
+" <method name=\"ClearAttention\" />\n"
"\n"
"<!-- Signals -->\n"
" <signal name=\"AttentionChanged\">\n"
diff --git a/src/indicator-messages.c b/src/indicator-messages.c
index bb88c57..82a9315 100644
--- a/src/indicator-messages.c
+++ b/src/indicator-messages.c
@@ -89,7 +89,10 @@ static void indicator_messages_dispose (GObject *object);
static void indicator_messages_finalize (GObject *object);
static GtkImage * get_icon (IndicatorObject * io);
static GtkMenu * get_menu (IndicatorObject * io);
-static const gchar * get_accessible_desc (IndicatorObject * io);
+static void indicator_messages_middle_click (IndicatorObject * io,
+ IndicatorObjectEntry * entry,
+ guint time, gpointer data);
+static const gchar * get_accessible_desc (IndicatorObject * io);
static void connection_change (IndicatorServiceManager * sm,
gboolean connected,
gpointer user_data);
@@ -131,6 +134,7 @@ indicator_messages_class_init (IndicatorMessagesClass *klass)
io_class->get_image = get_icon;
io_class->get_menu = get_menu;
io_class->get_accessible_desc = get_accessible_desc;
+ io_class->secondary_activate = indicator_messages_middle_click;
if (bus_node_info == NULL) {
GError * error = NULL;
@@ -755,3 +759,24 @@ get_accessible_desc (IndicatorObject * io)
{
return accessible_desc;
}
+
+/* Hide the notifications on middle-click over the indicator-messages */
+static void
+indicator_messages_middle_click (IndicatorObject * io, IndicatorObjectEntry * entry,
+ guint time, gpointer data)
+{
+ if (icon_proxy == NULL) {
+ return;
+ }
+
+ g_dbus_proxy_call(icon_proxy,
+ "ClearAttention",
+ NULL, /* params */
+ G_DBUS_CALL_FLAGS_NONE,
+ -1, /* timeout */
+ NULL, /* cancel */
+ NULL,
+ NULL);
+
+ return;
+}
diff --git a/src/messages-service-dbus.c b/src/messages-service-dbus.c
index 6cc33e0..1585ac0 100644
--- a/src/messages-service-dbus.c
+++ b/src/messages-service-dbus.c
@@ -200,7 +200,10 @@ message_service_dbus_new (void)
static void
bus_method_call (GDBusConnection * connection, const gchar * sender, const gchar * path, const gchar * interface, const gchar * method, GVariant * params, GDBusMethodInvocation * invocation, gpointer user_data)
{
- MessageServiceDbusPrivate * priv = MESSAGE_SERVICE_DBUS_GET_PRIVATE(user_data);
+ MessageServiceDbus * ms = MESSAGE_SERVICE_DBUS(user_data);
+ if (ms == NULL) { return; }
+
+ MessageServiceDbusPrivate * priv = MESSAGE_SERVICE_DBUS_GET_PRIVATE(ms);
if (g_strcmp0("AttentionRequested", method) == 0) {
g_dbus_method_invocation_return_value(invocation, g_variant_new("(b)", priv->dot));
@@ -208,6 +211,10 @@ bus_method_call (GDBusConnection * connection, const gchar * sender, const gchar
} else if (g_strcmp0("IconShown", method) == 0) {
g_dbus_method_invocation_return_value(invocation, g_variant_new("(b)", priv->hidden));
return;
+ } else if (g_strcmp0("ClearAttention", method) == 0) {
+ message_service_dbus_set_attention(ms, FALSE);
+ g_dbus_method_invocation_return_value(invocation, NULL);
+ return;
} else {
g_warning("Unknown function call '%s'", method);
}
diff --git a/src/messages-service.c b/src/messages-service.c
index 63549e3..43e79d3 100644
--- a/src/messages-service.c
+++ b/src/messages-service.c
@@ -28,6 +28,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include <libindicate/listener.h>
#include <libindicator/indicator-service.h>
#include <gio/gio.h>
+#include <glib/gi18n.h>
#include <libdbusmenu-glib/client.h>
#include <libdbusmenu-glib/server.h>
@@ -49,6 +50,7 @@ static GList * launcherList = NULL;
static DbusmenuMenuitem * root_menuitem = NULL;
static DbusmenuMenuitem * status_separator = NULL;
+static DbusmenuMenuitem * clear_attention = NULL;
static GMainLoop * mainloop = NULL;
static MessageServiceDbus * dbus_interface = NULL;
@@ -799,6 +801,8 @@ menushell_foreach_cb (DbusmenuMenuitem * data_mi, gpointer data_ms) {
AppMenuItem * appmenu = APP_MENU_ITEM(data_mi);
if (!g_strcmp0(INDICATE_LISTENER_SERVER_DBUS_NAME((IndicateListenerServer*)msl->server), INDICATE_LISTENER_SERVER_DBUS_NAME(app_menu_item_get_server(appmenu)))) {
msl->found = TRUE;
+ /* Return a position at the end of our shortcuts */
+ msl->position += g_list_length(app_menu_item_get_items(appmenu));
} else {
msl->position++;
}
@@ -835,7 +839,6 @@ resort_menu (DbusmenuMenuitem * menushell)
guint position = 0;
GList * serverentry;
GList * launcherentry = launcherList;
- DbusmenuMenuitem * last_separator = NULL;
g_debug("Reordering Menu:");
@@ -872,7 +875,6 @@ resort_menu (DbusmenuMenuitem * menushell)
if (!launcher_menu_item_get_eclipsed(li->menuitem)) {
/* Only clear the visiblity if we're not eclipsed */
dbusmenu_menuitem_property_set_bool(li->separator, DBUSMENU_MENUITEM_PROP_VISIBLE, TRUE);
- last_separator = li->separator;
}
position++;
@@ -928,7 +930,6 @@ resort_menu (DbusmenuMenuitem * menushell)
/* Note, this isn't the last if we can't see it */
} else {
dbusmenu_menuitem_property_set_bool(si->separator, DBUSMENU_MENUITEM_PROP_VISIBLE, TRUE);
- last_separator = si->separator;
}
dbusmenu_menuitem_child_reorder(DBUSMENU_MENUITEM(menushell), DBUSMENU_MENUITEM(si->separator), position);
@@ -960,17 +961,15 @@ resort_menu (DbusmenuMenuitem * menushell)
if (!launcher_menu_item_get_eclipsed(li->menuitem)) {
/* Only clear the visiblity if we're not eclipsed */
dbusmenu_menuitem_property_set_bool(li->separator, DBUSMENU_MENUITEM_PROP_VISIBLE, TRUE);
- last_separator = li->separator;
}
position++;
launcherentry = launcherentry->next;
}
- if (last_separator != NULL) {
- dbusmenu_menuitem_property_set_bool(last_separator, DBUSMENU_MENUITEM_PROP_VISIBLE, FALSE);
- } else {
- g_warning("No last separator on resort");
+ if (clear_attention != NULL) {
+ dbusmenu_menuitem_child_reorder(DBUSMENU_MENUITEM(menushell), clear_attention, position);
+ position++; /* Not needed, but reduce bugs on code tacked on here, compiler will remove */
}
return;
@@ -1439,12 +1438,31 @@ service_shutdown (IndicatorService * service, gpointer user_data)
return;
}
+/* Respond to changing status by updating the icon that
+ is on the panel */
static void
status_update_callback (void)
{
return;
}
+/* The clear attention item has been clicked on, what to do? */
+static void
+clear_attention_activate (DbusmenuMenuitem * mi, guint timestamp, MessageServiceDbus * dbus)
+{
+ message_service_dbus_set_attention(dbus, FALSE);
+ return;
+}
+
+/* Handle an update of the active state to ensure that we're
+ only enabled when we could do something. */
+static void
+clear_attention_handler (MessageServiceDbus * msd, gboolean attention, DbusmenuMenuitem * clearitem)
+{
+ dbusmenu_menuitem_property_set_bool(clearitem, DBUSMENU_MENUITEM_PROP_ENABLED, attention);
+ return;
+}
+
/* Oh, if you don't know what main() is for
we really shouldn't be talking. */
int
@@ -1484,6 +1502,13 @@ main (int argc, char ** argv)
dbusmenu_menuitem_property_set(status_separator, DBUSMENU_MENUITEM_PROP_TYPE, DBUSMENU_CLIENT_TYPES_SEPARATOR);
dbusmenu_menuitem_child_append(root_menuitem, status_separator);
+ /* Add in the clear attention item */
+ clear_attention = dbusmenu_menuitem_new();
+ dbusmenu_menuitem_property_set(clear_attention, DBUSMENU_MENUITEM_PROP_LABEL, _("Clear Attention"));
+ dbusmenu_menuitem_child_append(root_menuitem, clear_attention);
+ g_signal_connect(G_OBJECT(dbus_interface), MESSAGE_SERVICE_DBUS_SIGNAL_ATTENTION_CHANGED, G_CALLBACK(clear_attention_handler), clear_attention);
+ g_signal_connect(G_OBJECT(clear_attention), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(clear_attention_activate), dbus_interface);
+
/* Start up the libindicate listener */
listener = indicate_listener_ref_default();
serverList = NULL;
diff --git a/src/messages-service.xml b/src/messages-service.xml
index 8a592db..d79049e 100644
--- a/src/messages-service.xml
+++ b/src/messages-service.xml
@@ -3,15 +3,13 @@
<interface name="com.canonical.indicator.messages.service">
<!-- Methods -->
- <method name="Watch">
- <annotation name="org.freedesktop.DBus.GLib.Async" value="true" />
- </method>
<method name="AttentionRequested">
<arg type="b" name="dot" direction="out" />
</method>
<method name="IconShown">
<arg type="b" name="hidden" direction="out" />
</method>
+ <method name="ClearAttention" />
<!-- Signals -->
<signal name="AttentionChanged">