aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2011-01-19 17:58:48 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2011-08-30 17:39:04 +0800
commitcd4cb2693bf0d46201971720cc9c6e4d70fbb8dc (patch)
tree7bed6a0593675aa7dc626716bb5ee39d5c34ff73 /src
parent30f02dbfe4f41a7307f26e125a0dfbe7c830f65d (diff)
downloadgsoc2013-empathy-cd4cb2693bf0d46201971720cc9c6e4d70fbb8dc.tar
gsoc2013-empathy-cd4cb2693bf0d46201971720cc9c6e4d70fbb8dc.tar.gz
gsoc2013-empathy-cd4cb2693bf0d46201971720cc9c6e4d70fbb8dc.tar.bz2
gsoc2013-empathy-cd4cb2693bf0d46201971720cc9c6e4d70fbb8dc.tar.lz
gsoc2013-empathy-cd4cb2693bf0d46201971720cc9c6e4d70fbb8dc.tar.xz
gsoc2013-empathy-cd4cb2693bf0d46201971720cc9c6e4d70fbb8dc.tar.zst
gsoc2013-empathy-cd4cb2693bf0d46201971720cc9c6e4d70fbb8dc.zip
don't create the status icon if GNOME Shell is running
https://bugzilla.gnome.org/show_bug.cgi?id=631944
Diffstat (limited to 'src')
-rw-r--r--src/empathy.c50
1 files changed, 48 insertions, 2 deletions
diff --git a/src/empathy.c b/src/empathy.c
index 3506319fa..ea0db5182 100644
--- a/src/empathy.c
+++ b/src/empathy.c
@@ -61,6 +61,7 @@
#include <libempathy-gtk/empathy-ui-utils.h>
#include <libempathy-gtk/empathy-location-manager.h>
+#include <libempathy-gtk/empathy-notify-manager.h>
#include "empathy-main-window.h"
#include "empathy-accounts-common.h"
@@ -239,6 +240,43 @@ empathy_app_local_command_line (GApplication *app,
gchar ***arguments,
gint *exit_status);
+#define GNOME_SHELL_BUS_NAME "org.gnome.Shell"
+
+static void
+list_names_cb (TpDBusDaemon *bus_daemon,
+ const gchar * const *names,
+ const GError *error,
+ gpointer user_data,
+ GObject *weak_object)
+{
+ EmpathyApp *self = (EmpathyApp *) weak_object;
+ gboolean shell_running = FALSE;
+ guint i;
+
+ if (error != NULL)
+ goto out;
+
+ for (i = 0; names[i] != NULL; i++)
+ {
+ if (!tp_strdiff (names[i], GNOME_SHELL_BUS_NAME))
+ {
+ shell_running = TRUE;
+ break;
+ }
+ }
+
+out:
+ if (shell_running)
+ {
+ DEBUG ("GNOMES Shell is running, don't create status icon");
+ }
+ else
+ {
+ self->icon = empathy_status_icon_new (GTK_WINDOW (self->window),
+ self->start_hidden);
+ }
+}
+
static int
empathy_app_command_line (GApplication *app,
GApplicationCommandLine *cmdline)
@@ -263,6 +301,7 @@ empathy_app_command_line (GApplication *app,
if (!self->activated)
{
GError *error = NULL;
+ TpDBusDaemon *dbus;
/* Create the FT factory */
self->ft_factory = empathy_ft_factory_dup_singleton ();
@@ -283,8 +322,15 @@ empathy_app_command_line (GApplication *app,
/* Setting up UI */
self->window = empathy_main_window_dup ();
- self->icon = empathy_status_icon_new (GTK_WINDOW (self->window),
- self->start_hidden);
+
+ /* check if Shell is running */
+ dbus = tp_dbus_daemon_dup (&error);
+ g_assert_no_error (error);
+
+ tp_dbus_daemon_list_names (dbus, -1, list_names_cb,
+ self, NULL, G_OBJECT (self));
+
+ g_object_unref (dbus);
self->notifications_approver =
empathy_notifications_approver_dup_singleton ();