[gnome-panel] Drop telepathy integration and presence API support



commit dd5fd822aea30323f45a574fa111149290c0193d
Author: Balló György <ballogyor gmail com>
Date:   Wed Aug 5 16:02:15 2015 +0200

    Drop telepathy integration and presence API support
    
    https://bugzilla.gnome.org/show_bug.cgi?id=753267

 configure.ac                                       |   12 -
 gnome-panel/Makefile.am                            |    2 -
 gnome-panel/libpanel-util/Makefile.am              |   38 +----
 .../libpanel-util/panel-end-session-dialog.c       |    1 -
 gnome-panel/libpanel-util/panel-session-manager.c  |  124 -----------
 gnome-panel/libpanel-util/panel-session-manager.h  |   16 --
 gnome-panel/panel-addto-dialog.c                   |    4 +-
 gnome-panel/panel-icon-names.h                     |    4 -
 gnome-panel/panel-menu-items.c                     |  220 --------------------
 9 files changed, 3 insertions(+), 418 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 3fbcad9..4dca8b9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -72,7 +72,6 @@ GLIB_REQUIRED=2.36.0
 GTK_REQUIRED=3.15.2
 LIBWNCK_REQUIRED=3.4.6
 LIBGNOME_MENU_REQUIRED=3.7.90
-TELEPATHY_GLIB_REQUIRED=0.14.0
 LIBECAL_REQUIRED=3.5.3
 LIBEDATASERVER_REQUIRED=3.5.3
 CAIRO_REQUIRED=1.0.0
@@ -96,16 +95,6 @@ PKG_CHECK_MODULES(PANEL, gmodule-2.0 >= $GLIB_REQUIRED
 AC_SUBST(PANEL_CFLAGS)
 AC_SUBST(PANEL_LIBS)
 
-AC_ARG_ENABLE(telepathy_glib, AS_HELP_STRING([--enable-telepathy-glib],[Enable telepathy-glib support 
(auto)]),enable_telepathy_glib=$enableval,enable_telepathy_glib=auto)
-if test "x$enable_telepathy_glib" = "xno" ; then
-  HAVE_TELEPATHY_GLIB=no
-else
-  PKG_CHECK_MODULES(TELEPATHY_GLIB, telepathy-glib >= $TELEPATHY_GLIB_REQUIRED, HAVE_TELEPATHY_GLIB=yes, 
HAVE_TELEPATHY_GLIB=no)
-fi
-if test "x$HAVE_TELEPATHY_GLIB" = "xyes" ; then
-    AC_DEFINE(HAVE_TELEPATHY_GLIB, 1, [Defined if telepathy-glib support is enabled])
-fi
-
 PKG_CHECK_MODULES(LIBPANEL_APPLET, gtk+-3.0 >= $GTK_REQUIRED cairo-xlib cairo-gobject gio-2.0 >= 
$GLIB_REQUIRED gio-unix-2.0 >= $GLIB_REQUIRED)
 AC_SUBST(LIBPANEL_APPLET_CFLAGS)
 AC_SUBST(LIBPANEL_APPLET_LIBS)
@@ -293,7 +282,6 @@ echo "
         Use *_DISABLE_DEPRECATED:      ${enable_deprecation_flags}
 
         Evolution-Data-Server support: ${enable_eds}
-        Telepathy-Glib support:        ${HAVE_TELEPATHY_GLIB}
         XRandr support:                ${have_randr}
         Build introspection support:   ${found_introspection}
         Build gtk-doc documentation:   ${enable_gtk_doc}
diff --git a/gnome-panel/Makefile.am b/gnome-panel/Makefile.am
index 01d482e..5b23f09 100644
--- a/gnome-panel/Makefile.am
+++ b/gnome-panel/Makefile.am
@@ -123,7 +123,6 @@ gnome_panel_SOURCES =                       \
 
 gnome_panel_CPPFLAGS =                                 \
        $(AM_CPPFLAGS)                          \
-       $(TELEPATHY_GLIB_CFLAGS)                \
        $(XRANDR_CFLAGS)                        \
        -DPANEL_MODULES_DIR=\"$(modulesdir)\"   \
        -DGMENU_I_KNOW_THIS_IS_UNSTABLE         \
@@ -133,7 +132,6 @@ gnome_panel_LDADD =         \
        $(top_builddir)/gnome-panel/libpanel-applet-private/libpanel-applet-private.la  \
        $(top_builddir)/gnome-panel/libpanel-util/libpanel-util.la                      \
        $(PANEL_LIBS)                                                                   \
-       $(TELEPATHY_GLIB_LIBS)                                                          \
        $(XRANDR_LIBS)                                                                  \
        $(X_LIBS)
 
diff --git a/gnome-panel/libpanel-util/Makefile.am b/gnome-panel/libpanel-util/Makefile.am
index 7b4ae07..544bcdf 100644
--- a/gnome-panel/libpanel-util/Makefile.am
+++ b/gnome-panel/libpanel-util/Makefile.am
@@ -10,14 +10,9 @@ AM_CPPFLAGS =                                                        \
 
 AM_CFLAGS = $(WARN_CFLAGS)
 
-panel_util_enum_headers =      \
-       panel-session-manager.h
-
 BUILT_SOURCES =                        \
        dbus-login1-manager.c \
-       dbus-login1-manager.h \
-       panel-util-types.c      \
-       panel-util-types.h
+       dbus-login1-manager.h
 
 dbus-login1-manager.h:
 dbus-login1-manager.c: org.freedesktop.login1.Manager.xml Makefile.am
@@ -26,34 +21,6 @@ dbus-login1-manager.c: org.freedesktop.login1.Manager.xml Makefile.am
                --generate-c-code dbus-login1-manager \
                $(srcdir)/org.freedesktop.login1.Manager.xml
 
-panel-util-types.c: $(panel_util_enum_headers)
-       $(AM_V_GEN)glib-mkenums \
-                       --fhead "#include <glib-object.h>\n" \
-                       --fhead "#include \"panel-util-types.h\"\n\n" \
-                       --fprod "\n/* enumerations from \"@filename \" */" \
-                       --fprod "\n#include \"@filename \"\n" \
-                       --vhead "static const GEnumValue _ enum_name@_values[] = {" \
-                       --vprod "  { @VALUENAME@, \"@VALUENAME \", \"@valuenick \" }," \
-                       --vtail "  { 0, NULL, NULL }\n};\n\n" \
-                       --vtail "GType\n enum_name@_get_type (void)\n{\n" \
-                       --vtail "  static GType type = 0;\n\n" \
-                       --vtail "  if (!type)\n" \
-                       --vtail "    type = g_enum_register_static (\"@EnumName \", _ 
enum_name@_values);\n\n" \
-                       --vtail "  return type;\n}\n\n" \
-               $(addprefix $(srcdir)/,$(panel_util_enum_headers)) > $  tmp && mv $  tmp $@
-
-panel-util-types.h: $(panel_util_enum_headers)
-       $(AM_V_GEN)glib-mkenums \
-                       --fhead "#ifndef __PANEL_UTIL_TYPES_H__\n" \
-                       --fhead "#define __PANEL_UTIL_TYPES_H__ 1\n\n" \
-                       --fhead "G_BEGIN_DECLS\n\n" \
-                       --ftail "G_END_DECLS\n\n" \
-                       --ftail "#endif /* __PANEL_UTIL_TYPES_H__ */\n" \
-                       --fprod "\n/* --- @filename@ --- */" \
-                       --eprod "#define PANEL_TYPE_ ENUMSHORT@ @enum_name _get_type()\n" \
-                       --eprod "GType @enum_name _get_type (void);\n" \
-               $(addprefix $(srcdir)/,$(panel_util_enum_headers)) > $  tmp && mv $  tmp $@
-
 libpanel_util_la_SOURCES =             \
        $(BUILT_SOURCES)                \
        panel-cleanup.c                 \
@@ -92,7 +59,4 @@ libpanel_util_la_SOURCES =            \
 EXTRA_DIST = \
        org.freedesktop.login1.Manager.xml
 
-CLEANFILES = \
-       $(BUILT_SOURCES)
-
 -include $(top_srcdir)/git.mk
diff --git a/gnome-panel/libpanel-util/panel-end-session-dialog.c 
b/gnome-panel/libpanel-util/panel-end-session-dialog.c
index 85b8dbc..3dc83ca 100644
--- a/gnome-panel/libpanel-util/panel-end-session-dialog.c
+++ b/gnome-panel/libpanel-util/panel-end-session-dialog.c
@@ -25,7 +25,6 @@
 #include "dbus-login1-manager.h"
 #include "panel-cleanup.h"
 #include "panel-end-session-dialog.h"
-#include "panel-util-types.h"
 
 #define END_SESSION_DIALOG_NAME      "org.gnome.Shell"
 #define END_SESSION_DIALOG_PATH      "/org/gnome/SessionManager/EndSessionDialog"
diff --git a/gnome-panel/libpanel-util/panel-session-manager.c 
b/gnome-panel/libpanel-util/panel-session-manager.c
index 9ca5077..1436d85 100644
--- a/gnome-panel/libpanel-util/panel-session-manager.c
+++ b/gnome-panel/libpanel-util/panel-session-manager.c
@@ -23,60 +23,20 @@
 #include <gio/gio.h>
 
 #include "panel-cleanup.h"
-#include "panel-util-types.h"
 
 #include "panel-session-manager.h"
 
 struct _PanelSessionManagerPrivate {
        GDBusProxy *session_proxy;
-       GDBusProxy *presence_proxy;
 };
 
-enum {
-        PRESENCE_CHANGED,
-        LAST_SIGNAL
-};
-
-static guint panel_session_manager_signals[LAST_SIGNAL] = { 0 };
-
 G_DEFINE_TYPE (PanelSessionManager, panel_session_manager, G_TYPE_OBJECT);
 
 static void
-panel_session_manager_presence_on_signal (GDBusProxy          *proxy,
-                                          gchar               *sender_name,
-                                          gchar               *signal_name,
-                                          GVariant            *parameters,
-                                          PanelSessionManager *manager)
-{
-        if (g_strcmp0 (signal_name, "StatusChanged") == 0) {
-                unsigned int status;
-                g_variant_get (parameters, "(u)", &status);
-
-                g_signal_emit (G_OBJECT (manager),
-                               panel_session_manager_signals[PRESENCE_CHANGED],
-                               0, status);
-        }
-}
-
-static void
 panel_session_manager_class_init (PanelSessionManagerClass *klass)
 {
-        GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-
        g_type_class_add_private (klass,
                                  sizeof (PanelSessionManagerPrivate));
-
-        panel_session_manager_signals[PRESENCE_CHANGED] =
-                g_signal_new ("presence-changed",
-                              G_TYPE_FROM_CLASS (gobject_class),
-                              G_SIGNAL_RUN_LAST,
-                              G_STRUCT_OFFSET (PanelSessionManagerClass,
-                                               presence_changed),
-                              NULL,
-                              NULL,
-                              g_cclosure_marshal_VOID__ENUM,
-                              G_TYPE_NONE, 1,
-                              PANEL_TYPE_SESSION_MANAGER_PRESENCE_TYPE);
 }
 
 static void
@@ -102,91 +62,7 @@ panel_session_manager_init (PanelSessionManager *manager)
                g_warning ("Could not connect to session manager: %s",
                           error->message);
                g_error_free (error);
-                return;
-       }
-
-       error = NULL;
-       manager->priv->presence_proxy = g_dbus_proxy_new_for_bus_sync (
-                                               G_BUS_TYPE_SESSION,
-                                               G_DBUS_PROXY_FLAGS_NONE,
-                                               NULL,
-                                               "org.gnome.SessionManager",
-                                               "/org/gnome/SessionManager/Presence",
-                                               "org.gnome.SessionManager.Presence",
-                                               NULL, &error);
-
-       if (error) {
-               g_warning ("Could not connect to session manager: %s",
-                          error->message);
-               g_error_free (error);
-                return;
        }
-
-        g_signal_connect (manager->priv->presence_proxy,
-                          "g-signal",
-                          G_CALLBACK (panel_session_manager_presence_on_signal),
-                          manager);
-}
-
-void
-panel_session_manager_set_presence (PanelSessionManager             *manager,
-                                    PanelSessionManagerPresenceType  presence)
-{
-       GVariant *ret;
-       GError   *error;
-
-       g_return_if_fail (PANEL_IS_SESSION_MANAGER (manager));
-
-       if (!manager->priv->presence_proxy) {
-               g_warning ("Session manager service not available.");
-               return;
-       }
-
-       error = NULL;
-       ret = g_dbus_proxy_call_sync (manager->priv->presence_proxy,
-                                     "SetStatus",
-                                     g_variant_new ("(u)", presence),
-                                     G_DBUS_CALL_FLAGS_NONE,
-                                     -1,
-                                     NULL,
-                                     &error);
-
-       if (ret)
-               g_variant_unref (ret);
-
-       if (error) {
-               g_warning ("Could not ask session manager to change presence: %s",
-                          error->message);
-               g_error_free (error);
-       }
-}
-
-PanelSessionManagerPresenceType
-panel_session_manager_get_presence (PanelSessionManager *manager)
-{
-        GVariant *variant;
-        PanelSessionManagerPresenceType ret;
-
-       g_return_val_if_fail (PANEL_IS_SESSION_MANAGER (manager),
-                              PANEL_SESSION_MANAGER_PRESENCE_AVAILABLE);
-
-       if (!manager->priv->presence_proxy) {
-               g_warning ("Session manager service not available.");
-               return PANEL_SESSION_MANAGER_PRESENCE_AVAILABLE;
-       }
-
-        variant = g_dbus_proxy_get_cached_property (manager->priv->presence_proxy,
-                                                    "status");
-
-        if (!variant) {
-                g_warning ("Could not get presence from session manager.");
-                return PANEL_SESSION_MANAGER_PRESENCE_AVAILABLE;
-        }
-
-        g_variant_get (variant, "u", &ret);
-        g_variant_unref (variant);
-
-        return ret;
 }
 
 static void
diff --git a/gnome-panel/libpanel-util/panel-session-manager.h 
b/gnome-panel/libpanel-util/panel-session-manager.h
index 3cd4bb3..0dcf83d 100644
--- a/gnome-panel/libpanel-util/panel-session-manager.h
+++ b/gnome-panel/libpanel-util/panel-session-manager.h
@@ -45,14 +45,6 @@ typedef enum {
         PANEL_SESSION_MANAGER_LOGOUT_MODE_FORCE
 } PanelSessionManagerLogoutType;
 
-/* Keep in sync with the values defined in gnome-session/gsm-presence.h */
-typedef enum {
-        PANEL_SESSION_MANAGER_PRESENCE_AVAILABLE = 0,
-        PANEL_SESSION_MANAGER_PRESENCE_INVISIBLE,
-        PANEL_SESSION_MANAGER_PRESENCE_BUSY,
-        PANEL_SESSION_MANAGER_PRESENCE_IDLE
-} PanelSessionManagerPresenceType;
-
 struct _PanelSessionManager {
        GObject parent;
 
@@ -62,20 +54,12 @@ struct _PanelSessionManager {
 
 struct _PanelSessionManagerClass {
        GObjectClass parent_class;
-
-        void (* presence_changed)  (PanelSessionManager             *manager,
-                                    PanelSessionManagerPresenceType  presence);
 };
 
 GType panel_session_manager_get_type (void);
 
 PanelSessionManager *panel_session_manager_get (void);
 
-void panel_session_manager_set_presence     (PanelSessionManager             *session,
-                                             PanelSessionManagerPresenceType  presence);
-PanelSessionManagerPresenceType panel_session_manager_get_presence (PanelSessionManager *session);
-
-
 void panel_session_manager_request_logout   (PanelSessionManager           *session,
                                             PanelSessionManagerLogoutType  mode);
 void panel_session_manager_request_shutdown (PanelSessionManager *session);
diff --git a/gnome-panel/panel-addto-dialog.c b/gnome-panel/panel-addto-dialog.c
index 97001af..765a2ba 100644
--- a/gnome-panel/panel-addto-dialog.c
+++ b/gnome-panel/panel-addto-dialog.c
@@ -171,8 +171,8 @@ prepend_internal_applets (GSList *list)
        internal = g_new0 (PanelAddtoItemInfo, 1);
        internal->type = PANEL_ADDTO_USER_MENU;
        internal->name = _("User menu");
-       internal->description = _("Menu to change your settings and your online status");
-       internal->icon = g_themed_icon_new (PANEL_ICON_USER_AVAILABLE);
+       internal->description = _("Menu to change your settings and log out");
+       internal->icon = g_themed_icon_new (PANEL_ICON_COMPUTER);
        internal->action_type = PANEL_ACTION_NONE;
        internal->iid = "USERMENU:NEW";
        internal->static_strings = TRUE;
diff --git a/gnome-panel/panel-icon-names.h b/gnome-panel/panel-icon-names.h
index 23665cc..ea8f4fc 100644
--- a/gnome-panel/panel-icon-names.h
+++ b/gnome-panel/panel-icon-names.h
@@ -36,9 +36,5 @@
 #define PANEL_ICON_THEME               "preferences-desktop-theme"
 #define PANEL_ICON_TRASH               "user-trash"
 #define PANEL_ICON_UNKNOWN             "image-missing"
-#define PANEL_ICON_USER_AVAILABLE      "user-available-symbolic"
-#define PANEL_ICON_USER_BUSY           "user-busy-symbolic"
-#define PANEL_ICON_USER_IDLE           "user-idle-symbolic"
-#define PANEL_ICON_USER_INVISIBLE      "user-invisible-symbolic"
 
 #endif /* PANEL_ICON_NAMES_H */
diff --git a/gnome-panel/panel-menu-items.c b/gnome-panel/panel-menu-items.c
index 6a2b66e..376f581 100644
--- a/gnome-panel/panel-menu-items.c
+++ b/gnome-panel/panel-menu-items.c
@@ -38,10 +38,6 @@
 #include <glib/gi18n.h>
 #include <gio/gio.h>
 
-#ifdef HAVE_TELEPATHY_GLIB
-#include <telepathy-glib/account-manager.h>
-#endif
-
 #include <libpanel-util/panel-error.h>
 #include <libpanel-util/panel-glib.h>
 #include <libpanel-util/panel-gtk.h>
@@ -95,96 +91,8 @@ struct _PanelDesktopMenuItemPrivate {
        GtkWidget   *menu;
        PanelWidget *panel;
        GtkIconSize  icon_size;
-
-#ifdef HAVE_TELEPATHY_GLIB
-       GList            *presence_items;
-       guint             presence_changed_id;
-       TpAccountManager *account_manager;
-#endif
 };
 
-#ifdef HAVE_TELEPATHY_GLIB
-static void
-panel_menu_item_activate_presence (GtkWidget        *menuitem,
-                                  TpAccountManager *account_manager)
-{
-       PanelSessionManagerPresenceType  presence_type;
-       TpConnectionPresenceType         tp_presence_type;
-       const char                      *status;
-       char                            *message;
-
-       presence_type = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (menuitem),
-                                                           "panel-menu-presence"));
-
-       panel_session_manager_set_presence (panel_session_manager_get (),
-                                           presence_type);
-
-       tp_presence_type = tp_account_manager_get_most_available_presence (account_manager,
-                                                                          NULL,
-                                                                          &message);
-
-       if (tp_presence_type == TP_CONNECTION_PRESENCE_TYPE_UNSET ||
-           tp_presence_type == TP_CONNECTION_PRESENCE_TYPE_OFFLINE ||
-           tp_presence_type == TP_CONNECTION_PRESENCE_TYPE_UNKNOWN ||
-           tp_presence_type == TP_CONNECTION_PRESENCE_TYPE_ERROR)
-               goto free_message;
-
-       if (presence_type == PANEL_SESSION_MANAGER_PRESENCE_AVAILABLE) {
-               tp_presence_type = TP_CONNECTION_PRESENCE_TYPE_AVAILABLE;
-               status = "available";
-       } else if (presence_type == PANEL_SESSION_MANAGER_PRESENCE_BUSY) {
-               tp_presence_type = TP_CONNECTION_PRESENCE_TYPE_BUSY;
-               status = "busy";
-       } else
-               goto free_message;
-
-       tp_account_manager_set_all_requested_presences (account_manager,
-                                                       tp_presence_type,
-                                                       status, message);
-
-free_message:
-       g_free (message);
-}
-
-static GtkWidget *
-panel_menu_item_presence_new (TpAccountManager                *account_manager,
-                             PanelSessionManagerPresenceType  presence_type,
-                             const char                      *name,
-                             const char                      *icon,
-                             gboolean                         use_icon)
-{
-       GtkWidget *item;
-
-       if (!account_manager)
-               return NULL;
-
-       item = gtk_check_menu_item_new ();
-       setup_menuitem (item, GTK_ICON_SIZE_INVALID, NULL, name);
-       gtk_check_menu_item_set_draw_as_radio (GTK_CHECK_MENU_ITEM (item), TRUE);
-
-       /* TODO: we need to add an icon at the right of this CheckMenuItem */
-#if 0
-       if (use_icon) {
-               GtkWidget *image;
-               image = gtk_image_new_from_icon_name (icon,
-                                                     panel_menu_icon_get_size ());
-               gtk_container_add (GTK_CONTAINER (item), image);
-       }
-#endif
-
-       g_object_set_data (G_OBJECT (item), "panel-menu-presence",
-                          GINT_TO_POINTER (presence_type));
-
-       g_signal_connect (item, "activate",
-                         G_CALLBACK (panel_menu_item_activate_presence),
-                         account_manager);
-       g_signal_connect (G_OBJECT (item), "button_press_event",
-                         G_CALLBACK (menu_dummy_button_press_event), NULL);
-
-       return item;
-}
-#endif
-
 static void
 activate_uri_on_screen (const char *uri,
                        GdkScreen  *screen)
@@ -1352,39 +1260,9 @@ panel_desktop_menu_item_create_menu (PanelDesktopMenuItem *desktop_item,
 {
        GtkWidget *desktop_menu;
        GtkWidget *item;
-#ifdef HAVE_TELEPATHY_GLIB
-       gboolean   added;
-#endif
 
        desktop_menu = panel_create_menu ();
 
-#ifdef HAVE_TELEPATHY_GLIB
-       desktop_item->priv->account_manager = tp_account_manager_dup ();
-
-       item = panel_menu_item_presence_new (desktop_item->priv->account_manager,
-                                            PANEL_SESSION_MANAGER_PRESENCE_AVAILABLE,
-                                            _("Available"),
-                                            PANEL_ICON_USER_AVAILABLE, TRUE);
-       if (item) {
-               desktop_item->priv->presence_items = g_list_prepend (desktop_item->priv->presence_items, 
item);
-               gtk_menu_shell_append (GTK_MENU_SHELL (desktop_menu), item);
-               added = TRUE;
-       }
-
-       item = panel_menu_item_presence_new (desktop_item->priv->account_manager,
-                                            PANEL_SESSION_MANAGER_PRESENCE_BUSY,
-                                            _("Busy"),
-                                            PANEL_ICON_USER_BUSY, TRUE);
-       if (item) {
-               desktop_item->priv->presence_items = g_list_prepend (desktop_item->priv->presence_items, 
item);
-               gtk_menu_shell_append (GTK_MENU_SHELL (desktop_menu), item);
-               added = TRUE;
-       }
-
-       if (added)
-               add_menu_separator (desktop_menu);
-#endif
-
        /* Do not force the string like in gnome-shell, but just use the one
         * from the .desktop file */
        item = panel_menu_item_desktop_new ("gnome-control-center.desktop",
@@ -1466,20 +1344,6 @@ panel_desktop_menu_item_finalize (GObject *object)
 {
        PanelDesktopMenuItem *menuitem = (PanelDesktopMenuItem *) object;
 
-#ifdef HAVE_TELEPATHY_GLIB
-       g_list_free (menuitem->priv->presence_items);
-       menuitem->priv->presence_items = NULL;
-
-       if (menuitem->priv->presence_changed_id != 0)
-               g_signal_handler_disconnect (panel_session_manager_get (),
-                                            menuitem->priv->presence_changed_id);
-       menuitem->priv->presence_changed_id = 0;
-
-       if (menuitem->priv->account_manager != NULL)
-               g_object_unref (menuitem->priv->account_manager);
-       menuitem->priv->account_manager = NULL;
-#endif
-
        G_OBJECT_CLASS (panel_desktop_menu_item_parent_class)->finalize (object);
 }
 
@@ -1567,12 +1431,6 @@ static void
 panel_desktop_menu_item_init (PanelDesktopMenuItem *menuitem)
 {
        menuitem->priv = PANEL_DESKTOP_MENU_ITEM_GET_PRIVATE (menuitem);
-
-#ifdef HAVE_TELEPATHY_GLIB
-       menuitem->priv->presence_items = NULL;
-       menuitem->priv->presence_changed_id = 0;
-       menuitem->priv->account_manager = NULL;
-#endif
 }
 
 static void
@@ -1640,58 +1498,6 @@ panel_place_menu_item_new (gboolean use_image,
        return GTK_WIDGET (menuitem);
 }
 
-#ifdef HAVE_TELEPATHY_GLIB
-static void
-panel_desktop_menu_item_on_presence_changed (PanelSessionManager             *manager,
-                                            PanelSessionManagerPresenceType  presence_type,
-                                            PanelDesktopMenuItem            *desktop_item)
-{
-       const char *icon;
-       GtkWidget  *image;
-       GList      *l;
-
-       switch (presence_type) {
-       case PANEL_SESSION_MANAGER_PRESENCE_AVAILABLE:
-               icon = PANEL_ICON_USER_AVAILABLE;
-               break;
-        case PANEL_SESSION_MANAGER_PRESENCE_INVISIBLE:
-               icon = PANEL_ICON_USER_INVISIBLE;
-               break;
-        case PANEL_SESSION_MANAGER_PRESENCE_BUSY:
-               icon = PANEL_ICON_USER_BUSY;
-               break;
-       case PANEL_SESSION_MANAGER_PRESENCE_IDLE:
-       default:
-               icon = PANEL_ICON_USER_IDLE;
-               break;
-       }
-
-       image = panel_image_menu_item_get_image (PANEL_IMAGE_MENU_ITEM (desktop_item));
-       /* we only have an image if we are specifically using an icon for this
-        * menu */
-       if (image) {
-               gtk_image_set_from_icon_name (GTK_IMAGE (image),
-                                             icon, desktop_item->priv->icon_size);
-       }
-
-       for (l = desktop_item->priv->presence_items; l != NULL; l = l->next) {
-               PanelSessionManagerPresenceType for_presence;
-               GObject *object = l->data;
-
-               for_presence = GPOINTER_TO_INT (g_object_get_data (object,
-                                                                  "panel-menu-presence"));
-               g_signal_handlers_block_by_func (object,
-                                                panel_menu_item_activate_presence,
-                                                desktop_item->priv->account_manager);
-               gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (object),
-                                               for_presence == presence_type);
-               g_signal_handlers_unblock_by_func (object,
-                                                  panel_menu_item_activate_presence,
-                                                  desktop_item->priv->account_manager);
-       }
-}
-#endif
-
 GtkWidget *
 panel_desktop_menu_item_new (gboolean use_image,
                             gboolean in_menubar,
@@ -1700,18 +1506,11 @@ panel_desktop_menu_item_new (gboolean use_image,
        PanelDesktopMenuItem *menuitem;
        char                 *name;
        const char           *icon_name;
-#ifdef HAVE_TELEPATHY_GLIB
-       PanelSessionManager  *manager;
-#endif
 
        menuitem = g_object_new (PANEL_TYPE_DESKTOP_MENU_ITEM, NULL);
 
        name = panel_util_get_user_name ();
-#ifdef HAVE_TELEPATHY_GLIB
-       icon_name = PANEL_ICON_USER_AVAILABLE;
-#else
        icon_name = PANEL_ICON_COMPUTER;
-#endif
 
        /* if we're in a menubar, we don't want to use setup_* as it changes
         * the size requests and can make the panels bigger than we'd like */
@@ -1741,11 +1540,6 @@ panel_desktop_menu_item_new (gboolean use_image,
                                        name);
        }
 
-#ifdef HAVE_TELEPATHY_GLIB
-       if (use_image)
-               panel_image_menu_item_set_always_show_image (PANEL_IMAGE_MENU_ITEM (menuitem), TRUE);
-#endif
-
        g_free (name);
 
        menuitem->priv->menu = panel_desktop_menu_item_create_menu (menuitem,
@@ -1753,20 +1547,6 @@ panel_desktop_menu_item_new (gboolean use_image,
        gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem),
                                   menuitem->priv->menu);
 
-#ifdef HAVE_TELEPATHY_GLIB
-       manager = panel_session_manager_get ();
-
-       menuitem->priv->presence_changed_id =
-               g_signal_connect (manager,
-                                 "presence-changed",
-                                 G_CALLBACK (panel_desktop_menu_item_on_presence_changed),
-                                 menuitem);
-
-       panel_desktop_menu_item_on_presence_changed (manager,
-                                                    panel_session_manager_get_presence (manager),
-                                                    menuitem);
-#endif
-
        return GTK_WIDGET (menuitem);
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]