]> git.0d.be Git - empathy.git/commitdiff
tpaw-utils: move empathy_connect_new_account to tp-aw and rename it
authorMarco Barisione <marco.barisione@collabora.co.uk>
Mon, 6 May 2013 13:02:09 +0000 (14:02 +0100)
committerMarco Barisione <marco.barisione@collabora.co.uk>
Tue, 20 Aug 2013 10:03:05 +0000 (11:03 +0100)
This commit also changes the licence of the moved code (all copyrighted
by Collabora Ltd.) from GPL to LGPL.

https://bugzilla.gnome.org/show_bug.cgi?id=699492

libempathy-gtk/empathy-local-xmpp-assistant-widget.c
libempathy/empathy-utils.c
libempathy/empathy-utils.h
src/empathy-accounts-dialog.c
src/empathy-import-widget.c
tp-account-widgets/tpaw-account-widget.c
tp-account-widgets/tpaw-utils.c
tp-account-widgets/tpaw-utils.h

index 04275282aadf2ca3c2a49bb90cfb42eb8eb68cd5..971ad5e9628d716b69b0005d53924a13271f15a2 100644 (file)
@@ -23,6 +23,7 @@
 
 #include <glib/gi18n-lib.h>
 #include <tp-account-widgets/tpaw-account-widget.h>
+#include <tp-account-widgets/tpaw-utils.h>
 
 #include "empathy-ui-utils.h"
 #include "empathy-utils.h"
@@ -181,7 +182,7 @@ account_enabled_cb (GObject *source,
 
   account_mgr = tp_account_manager_dup ();
 
-  empathy_connect_new_account (account, account_mgr);
+  tpaw_connect_new_account (account, account_mgr);
 
   g_object_unref (account_mgr);
 }
index 25624bf002c17100b6e0be7103e21eaf5a4da972..b06edeb0116ba9a6f22736750274cfdfeac3415a 100644 (file)
@@ -564,49 +564,6 @@ empathy_account_manager_get_accounts_connected (gboolean *connecting)
   return out_connected;
 }
 
-/* Change the RequestedPresence of a newly created account to ensure that it
- * is actually connected. */
-void
-empathy_connect_new_account (TpAccount *account,
-    TpAccountManager *account_manager)
-{
-  TpConnectionPresenceType presence;
-  gchar *status, *message;
-
-  /* only force presence if presence was offline, unknown or unset */
-  presence = tp_account_get_requested_presence (account, NULL, NULL);
-  switch (presence)
-    {
-      case TP_CONNECTION_PRESENCE_TYPE_OFFLINE:
-      case TP_CONNECTION_PRESENCE_TYPE_UNKNOWN:
-      case TP_CONNECTION_PRESENCE_TYPE_UNSET:
-        presence = tp_account_manager_get_most_available_presence (
-            account_manager, &status, &message);
-
-        if (presence == TP_CONNECTION_PRESENCE_TYPE_OFFLINE)
-          /* Global presence is offline; we force it so user doesn't have to
-           * manually change the presence to connect his new account. */
-          presence = TP_CONNECTION_PRESENCE_TYPE_AVAILABLE;
-
-        tp_account_request_presence_async (account, presence,
-            status, NULL, NULL, NULL);
-
-        g_free (status);
-        g_free (message);
-        break;
-
-       case TP_CONNECTION_PRESENCE_TYPE_AVAILABLE:
-       case TP_CONNECTION_PRESENCE_TYPE_AWAY:
-       case TP_CONNECTION_PRESENCE_TYPE_EXTENDED_AWAY:
-       case TP_CONNECTION_PRESENCE_TYPE_HIDDEN:
-       case TP_CONNECTION_PRESENCE_TYPE_BUSY:
-       case TP_CONNECTION_PRESENCE_TYPE_ERROR:
-       default:
-        /* do nothing if the presence is not offline */
-        break;
-    }
-}
-
 /* Translate Folks' general presence type to the Tp presence type */
 TpConnectionPresenceType
 empathy_folks_presence_type_to_tp (FolksPresenceType type)
index f002c41cd25d618c994ddaeaef6913fcef0c7766..1a86755c65a1df69d21251464cd93b9202208690 100644 (file)
@@ -75,9 +75,6 @@ GType empathy_type_dbus_ao (void);
 
 gboolean empathy_account_manager_get_accounts_connected (gboolean *connecting);
 
-void empathy_connect_new_account (TpAccount *account,
-    TpAccountManager *account_manager);
-
 TpConnectionPresenceType empathy_folks_presence_type_to_tp (
     FolksPresenceType type);
 gboolean empathy_folks_individual_contains_contact (
index 409a9ce38efee82690de0652fa3ebd094495daf1..bf3934502093d5d34ecb23c9706cfe19b8c444ab 100644 (file)
@@ -29,6 +29,7 @@
 
 #include <glib/gi18n-lib.h>
 #include <tp-account-widgets/tpaw-account-widget.h>
+#include <tp-account-widgets/tpaw-utils.h>
 
 #include "empathy-accounts-common.h"
 #include "empathy-import-dialog.h"
@@ -212,7 +213,7 @@ accounts_dialog_enable_account_cb (GObject *object,
     {
       am = tp_account_manager_dup ();
 
-      empathy_connect_new_account (account, am);
+      tpaw_connect_new_account (account, am);
       g_object_unref (am);
     }
 }
index 0103b6a8f5200b4f36cb49de001ea9ca86418640..400a00629c8cb64d1a797a204cc4c3142eb29c0d 100644 (file)
@@ -26,6 +26,7 @@
 #include "empathy-import-widget.h"
 
 #include <glib/gi18n-lib.h>
+#include <tp-account-widgets/tpaw-utils.h>
 
 #include "empathy-ui-utils.h"
 #include "empathy-utils.h"
@@ -169,7 +170,7 @@ import_widget_create_account_cb (GObject *source,
   if (tp_account_is_enabled (account))
     {
       account_manager = tp_account_manager_dup ();
-      empathy_connect_new_account (account, account_manager);
+      tpaw_connect_new_account (account, account_manager);
       g_object_unref (account_manager);
     }
 
index fcde66f3623c86804c3d4f9343faea55712d25df..e2c8016a6b8447f1dfec6dc593d395ea0fc629ef 100644 (file)
@@ -29,6 +29,7 @@
 
 #include <glib/gi18n-lib.h>
 #include <dbus/dbus-protocol.h>
+#include <tp-account-widgets/tpaw-utils.h>
 
 #include "tpaw-account-widget-irc.h"
 #include "tpaw-account-widget-private.h"
@@ -895,7 +896,7 @@ account_widget_account_enabled_cb (GObject *source_object,
     }
   else
     {
-      empathy_connect_new_account (account, self->priv->account_manager);
+      tpaw_connect_new_account (account, self->priv->account_manager);
     }
 
   g_signal_emit (self, signals[CLOSE], 0, GTK_RESPONSE_APPLY);
index d8bebdac050e5723578ff455102e79be1e2bd71a..8570658c34e661c6eff94eb18e64df7c2bb324e6 100644 (file)
@@ -1,7 +1,8 @@
 /*
- * Copyright (C) 2013 Collabora Ltd.
+ * Copyright (C) 2009-2013 Collabora Ltd.
  *
  * Authors: Marco Barisione <marco.barisione@collabora.co.uk>
+ *          Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
 
 #define DEBUG_FLAG EMPATHY_DEBUG_OTHER
 #include "empathy-debug.h"
+
+/* Change the RequestedPresence of a newly created account to ensure that it
+ * is actually connected. */
+void
+tpaw_connect_new_account (TpAccount *account,
+    TpAccountManager *account_manager)
+{
+  TpConnectionPresenceType presence;
+  gchar *status, *message;
+
+  /* only force presence if presence was offline, unknown or unset */
+  presence = tp_account_get_requested_presence (account, NULL, NULL);
+  switch (presence)
+    {
+      case TP_CONNECTION_PRESENCE_TYPE_OFFLINE:
+      case TP_CONNECTION_PRESENCE_TYPE_UNKNOWN:
+      case TP_CONNECTION_PRESENCE_TYPE_UNSET:
+        presence = tp_account_manager_get_most_available_presence (
+            account_manager, &status, &message);
+
+        if (presence == TP_CONNECTION_PRESENCE_TYPE_OFFLINE)
+          /* Global presence is offline; we force it so user doesn't have to
+           * manually change the presence to connect his new account. */
+          presence = TP_CONNECTION_PRESENCE_TYPE_AVAILABLE;
+
+        tp_account_request_presence_async (account, presence,
+            status, NULL, NULL, NULL);
+
+        g_free (status);
+        g_free (message);
+        break;
+
+       case TP_CONNECTION_PRESENCE_TYPE_AVAILABLE:
+       case TP_CONNECTION_PRESENCE_TYPE_AWAY:
+       case TP_CONNECTION_PRESENCE_TYPE_EXTENDED_AWAY:
+       case TP_CONNECTION_PRESENCE_TYPE_HIDDEN:
+       case TP_CONNECTION_PRESENCE_TYPE_BUSY:
+       case TP_CONNECTION_PRESENCE_TYPE_ERROR:
+       default:
+        /* do nothing if the presence is not offline */
+        break;
+    }
+}
index 8c5dc8cb1a9a3e4ce500bc134c2908192f03538a..55d83d50694e5eb2e7c337fc79a5d64285eb375e 100644 (file)
@@ -1,7 +1,8 @@
 /*
- * Copyright (C) 2013 Collabora Ltd.
+ * Copyright (C) 2009-2013 Collabora Ltd.
  *
  * Authors: Marco Barisione <marco.barisione@collabora.co.uk>
+ *          Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
 #define __TPAW_UTILS_H__
 
 #include <glib.h>
+#include <telepathy-glib/telepathy-glib.h>
 
 G_BEGIN_DECLS
 
+void tpaw_connect_new_account (TpAccount *account,
+    TpAccountManager *account_manager);
+
 G_END_DECLS
 
 #endif /*  __TPAW_UTILS_H__ */