Merge back from master
authorSjoerd Simons <sjoerd.simons@collabora.co.uk>
Fri, 21 Aug 2009 16:37:48 +0000 (17:37 +0100)
committerSjoerd Simons <sjoerd.simons@collabora.co.uk>
Fri, 21 Aug 2009 16:37:48 +0000 (17:37 +0100)
21 files changed:
1  2 
configure.ac
data/Makefile.am
libempathy-gtk/empathy-chat.c
libempathy-gtk/empathy-contact-list-view.c
libempathy-gtk/empathy-share-my-desktop.c
libempathy-gtk/empathy-theme-adium.c
libempathy-gtk/empathy-ui-utils.c
libempathy-gtk/empathy-ui-utils.h
libempathy/Makefile.am
libempathy/empathy-call-handler.c
libempathy/empathy-idle.c
libempathy/empathy-idle.h
libempathy/empathy-tp-chat.c
libempathy/empathy-tp-contact-factory.c
libempathy/empathy-tp-contact-list.c
po/POTFILES.in
python/pyempathy/pyempathy.defs
python/pyempathygtk/pyempathygtk.defs
src/empathy-chat-window.c
src/empathy-status-icon.c
src/empathy.c

diff --cc configure.ac
@@@ -29,7 -29,8 +29,7 @@@ GLIB_REQUIRED=2.16.
  GTK_REQUIRED=2.16.0
  GCONF_REQUIRED=1.2.0
  LIBPANELAPPLET_REQUIRED=2.10.0
- TELEPATHY_GLIB_REQUIRED=0.7.31
+ TELEPATHY_GLIB_REQUIRED=0.7.34
 -MISSION_CONTROL_REQUIRED=4.61
  ENCHANT_REQUIRED=1.2.0
  ISO_CODES_REQUIRED=0.35
  LIBNOTIFY_REQUIRED=0.4.4
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
  
  #include <telepathy-glib/dbus.h>
  #include <telepathy-glib/util.h>
 -#include <libmissioncontrol/mc-enum-types.h>
  
 +#include "empathy-account-manager.h"
  #include "empathy-idle.h"
  #include "empathy-utils.h"
+ #include "empathy-connectivity.h"
  
  #define DEBUG_FLAG EMPATHY_DEBUG_OTHER
  #include "empathy-debug.h"
  
  #define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyIdle)
  typedef struct {
 -      MissionControl *mc;
        DBusGProxy     *gs_proxy;
- #ifdef HAVE_NM
-       NMClient       *nm_client;
- #endif
+       EmpathyConnectivity *connectivity;
+       gulong state_change_signal_id;
  
        TpConnectionPresenceType      state;
        gchar          *status;
        TpConnectionPresenceType      flash_state;
        gboolean        auto_away;
-       gboolean        use_nm;
  
        TpConnectionPresenceType      away_saved_state;
-       TpConnectionPresenceType      nm_saved_state;
-       gchar          *nm_saved_status;
+       TpConnectionPresenceType      saved_state;
+       gchar          *saved_status;
  
        gboolean        is_idle;
-       gboolean        nm_connected;
        guint           ext_away_timeout;
 +
 +      EmpathyAccountManager *manager;
  } EmpathyIdlePriv;
  
  typedef enum {
Simple merge
Simple merge
Simple merge
diff --cc po/POTFILES.in
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
diff --cc src/empathy.c
  #include <glib/gi18n.h>
  #include <gtk/gtk.h>
  #include <gdk/gdkx.h>
 +#include <unique/unique.h>
  
  #if HAVE_LIBCHAMPLAIN
- #include <clutter-gtk/gtk-clutter-embed.h>
+ #include <clutter-gtk/clutter-gtk.h>
  #endif
  
  #include <libebook/e-book.h>
  #include <libempathy/empathy-utils.h>
  #include <libempathy/empathy-call-factory.h>
  #include <libempathy/empathy-chatroom-manager.h>
 +#include <libempathy/empathy-account-settings.h>
+ #include <libempathy/empathy-connectivity.h>
  #include <libempathy/empathy-account-manager.h>
 +#include <libempathy/empathy-connection-managers.h>
  #include <libempathy/empathy-debugger.h>
  #include <libempathy/empathy-dispatcher.h>
  #include <libempathy/empathy-dispatch-operation.h>
@@@ -148,92 -146,90 +149,92 @@@ dispatch_cb (EmpathyDispatcher *dispatc
        }
  }
  
--static void
- use_nm_notify_cb (EmpathyConf *conf,
-                 const gchar *key,
-                 gpointer     user_data)
- {
-       EmpathyIdle *idle = user_data;
-       gboolean     use_nm;
-       if (empathy_conf_get_bool (conf, key, &use_nm)) {
-               empathy_idle_set_use_nm (idle, use_nm);
-       }
- }
 -service_ended_cb (MissionControl *mc,
 -                gpointer        user_data)
 +/* Salut account creation */
 +static gboolean
 +should_create_salut_account (void)
  {
 -      DEBUG ("Mission Control stopped");
 +      EmpathyAccountManager *manager;
 +      gboolean salut_created = FALSE;
 +      GList *accounts, *l;
 +
 +      /* Check if we already created a salut account */
 +      empathy_conf_get_bool (empathy_conf_get (),
 +                             EMPATHY_PREFS_SALUT_ACCOUNT_CREATED,
 +                             &salut_created);
 +
 +      if (salut_created)
 +              {
 +                      DEBUG ("Gconf says we already created a salut account once");
 +                      return FALSE;
 +              }
 +
 +      manager = empathy_account_manager_dup_singleton ();
 +      accounts = empathy_account_manager_dup_accounts (manager);
 +
 +      for (l = accounts; l != NULL;  l = g_list_next (l)) {
 +              EmpathyAccount *account = EMPATHY_ACCOUNT (l->data);
 +
 +              if (!tp_strdiff (empathy_account_get_protocol (account), "local-xmpp"))
 +                      salut_created = TRUE;
 +
 +              g_object_unref (account);
 +      }
 +
 +      g_object_unref (manager);
 +
 +      if (salut_created)
 +              {
 +                      DEBUG ("Existing salut account already exists, flagging so in gconf");
 +                      empathy_conf_set_bool (empathy_conf_get (),
 +                              EMPATHY_PREFS_SALUT_ACCOUNT_CREATED,
 +                              TRUE);
 +              }
 +
 +      return !salut_created;
  }
  
  static void
 -operation_error_cb (MissionControl *mc,
 -                  guint           operation_id,
 -                  guint           error_code,
 -                  gpointer        user_data)
 +salut_account_created (GObject *source,
 +      GAsyncResult *result, gpointer user_data)
  {
 -      const gchar *message;
 -
 -      switch (error_code) {
 -      case MC_DISCONNECTED_ERROR:
 -              message = "Disconnected";
 -              break;
 -      case MC_INVALID_HANDLE_ERROR:
 -              message = "Invalid handle";
 -              break;
 -      case MC_NO_MATCHING_CONNECTION_ERROR:
 -              message = "No matching connection";
 -              break;
 -      case MC_INVALID_ACCOUNT_ERROR:
 -              message = "Invalid account";
 -              break;
 -      case MC_PRESENCE_FAILURE_ERROR:
 -              message = "Presence failure";
 -              break;
 -      case MC_NO_ACCOUNTS_ERROR:
 -              message = "No accounts";
 -              break;
 -      case MC_NETWORK_ERROR:
 -              message = "Network error";
 -              break;
 -      case MC_CONTACT_DOES_NOT_SUPPORT_VOICE_ERROR:
 -              message = "Contact does not support voice";
 -              break;
 -      case MC_LOWMEM_ERROR:
 -              message = "Lowmem";
 -              break;
 -      case MC_CHANNEL_REQUEST_GENERIC_ERROR:
 -              message = "Channel request generic error";
 -              break;
 -      case MC_CHANNEL_BANNED_ERROR:
 -              message = "Channel banned";
 -              break;
 -      case MC_CHANNEL_FULL_ERROR:
 -              message = "Channel full";
 -              break;
 -      case MC_CHANNEL_INVITE_ONLY_ERROR:
 -              message = "Channel invite only";
 -              break;
 -      default:
 -              message = "Unknown error code";
 -      }
 +      EmpathyAccountSettings *settings = EMPATHY_ACCOUNT_SETTINGS (source);
 +      EmpathyAccount *account;
 +      GError *error = NULL;
 +
 +      if (!empathy_account_settings_apply_finish (settings, result, &error))
 +              {
 +                      DEBUG ("Failed to create salut account: %s", error->message);
 +                      g_error_free (error);
 +                      return;
 +              }
 +
 +      account = empathy_account_settings_get_account (settings);
  
 -      DEBUG ("Error during operation %d: %s", operation_id, message);
 +      empathy_account_set_enabled (account, TRUE);
 +      empathy_conf_set_bool (empathy_conf_get (),
 +                             EMPATHY_PREFS_SALUT_ACCOUNT_CREATED,
 +                             TRUE);
  }
  
+ static void
+ use_conn_notify_cb (EmpathyConf *conf,
+                   const gchar *key,
+                   gpointer     user_data)
+ {
+       EmpathyConnectivity *connectivity = user_data;
+       gboolean     use_conn;
+       if (empathy_conf_get_bool (conf, key, &use_conn)) {
+               empathy_connectivity_set_use_conn (connectivity, use_conn);
+       }
+ }
  static void
 -create_salut_account (void)
 +create_salut_account_if_needed (EmpathyConnectionManagers *managers)
  {
 -      McProfile  *profile;
 -      McProtocol *protocol;
 -      gboolean    salut_created = FALSE;
 -      EmpathyAccount  *account;
 -      EmpathyAccountManager *account_manager;
 -      GList      *accounts;
 +      EmpathyAccountSettings  *settings;
 +      TpConnectionManager *manager;
 +      const TpConnectionManagerProtocol *protocol;
        EBook      *book;
        EContact   *contact;
        gchar      *nickname = NULL;
@@@ -534,7 -554,9 +535,8 @@@ main (int argc, char *argv[]
        EmpathyCallFactory *call_factory;
        EmpathyFTFactory  *ft_factory;
        GtkWidget         *window;
 -      MissionControl    *mc;
        EmpathyIdle       *idle;
+       EmpathyConnectivity *connectivity;
        gboolean           autoconnect = TRUE;
        gboolean           no_connect = FALSE;
        gboolean           hide_contact_list = FALSE;
  
        empathy_idle_set_state (idle, TP_CONNECTION_PRESENCE_TYPE_OFFLINE);
  
 -      g_object_unref (mc);
        g_object_unref (idle);
+       g_object_unref (connectivity);
        g_object_unref (icon);
 +      g_object_unref (account_manager);
        g_object_unref (log_manager);
        g_object_unref (dispatcher);
        g_object_unref (chatroom_manager);