]> git.0d.be Git - empathy.git/blobdiff - libempathy-gtk/empathy-local-xmpp-assistant-widget.c
Updated Kannada translation
[empathy.git] / libempathy-gtk / empathy-local-xmpp-assistant-widget.c
index f7b18863a4e2521cd1b938dfc80116439833ccee..6ee8711a3278d306b27cb34dcdf4db51683bcab5 100644 (file)
 #include "empathy-local-xmpp-assistant-widget.h"
 
 #include <glib/gi18n-lib.h>
+#include <tp-account-widgets/tpaw-account-widget.h>
+#include <tp-account-widgets/tpaw-pixbuf-utils.h>
+#include <tp-account-widgets/tpaw-utils.h>
 
-#include <libempathy/empathy-utils.h>
-
-#include <libempathy-gtk/empathy-account-widget.h>
-#include <libempathy-gtk/empathy-ui-utils.h>
+#include "empathy-ui-utils.h"
+#include "empathy-utils.h"
 
 #define DEBUG_FLAG EMPATHY_DEBUG_ACCOUNT
-#include <libempathy/empathy-debug.h>
+#include "empathy-debug.h"
 
 G_DEFINE_TYPE (EmpathyLocalXmppAssistantWidget,
     empathy_local_xmpp_assistant_widget, GTK_TYPE_GRID)
@@ -43,7 +44,7 @@ static gulong signals[LAST_SIGNAL] = { 0, };
 
 struct _EmpathyLocalXmppAssistantWidgetPrivate
 {
-  EmpathyAccountSettings  *settings;
+  TpawAccountSettings  *settings;
 };
 
 static void
@@ -55,7 +56,7 @@ empathy_local_xmpp_assistant_widget_init (EmpathyLocalXmppAssistantWidget *self)
 }
 
 static void
-handle_apply_cb (EmpathyAccountWidget *widget_object,
+handle_apply_cb (TpawAccountWidget *widget_object,
     gboolean is_valid,
     EmpathyLocalXmppAssistantWidget *self)
 {
@@ -69,7 +70,7 @@ empathy_local_xmpp_assistant_widget_constructed (GObject *object)
     object;
   GtkWidget *w;
   GdkPixbuf *pix;
-  EmpathyAccountWidget *account_widget;
+  TpawAccountWidget *account_widget;
   gchar *markup;
 
   G_OBJECT_CLASS (empathy_local_xmpp_assistant_widget_parent_class)->
@@ -87,19 +88,22 @@ empathy_local_xmpp_assistant_widget_constructed (GObject *object)
   gtk_grid_attach (GTK_GRID (self), w, 0, 0, 1, 1);
   gtk_widget_show (w);
 
-  pix = empathy_pixbuf_from_icon_name_sized ("im-local-xmpp", 48);
-  w = gtk_image_new_from_pixbuf (pix);
-  gtk_grid_attach (GTK_GRID (self), w, 1, 0, 1, 1);
-  gtk_widget_show (w);
+  pix = tpaw_pixbuf_from_icon_name_sized ("im-local-xmpp", 48);
+  if (pix != NULL)
+    {
+      w = gtk_image_new_from_pixbuf (pix);
+      gtk_grid_attach (GTK_GRID (self), w, 1, 0, 1, 1);
+      gtk_widget_show (w);
 
-  g_object_unref (pix);
+      g_object_unref (pix);
+    }
 
-  self->priv->settings = empathy_account_settings_new ("salut", "local-xmpp",
+  self->priv->settings = tpaw_account_settings_new ("salut", "local-xmpp",
       NULL, _("People nearby"));
 
-  account_widget = empathy_account_widget_new_for_protocol (
-      self->priv->settings, TRUE);
-  empathy_account_widget_hide_buttons (account_widget);
+  account_widget = tpaw_account_widget_new_for_protocol (
+      self->priv->settings, NULL, TRUE);
+  tpaw_account_widget_hide_buttons (account_widget);
 
   g_signal_connect (account_widget, "handle-apply",
       G_CALLBACK (handle_apply_cb), self);
@@ -179,7 +183,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);
 }
@@ -189,11 +193,11 @@ apply_account_cb (GObject *source,
     GAsyncResult *result,
     gpointer user_data)
 {
-  EmpathyAccountSettings *settings = EMPATHY_ACCOUNT_SETTINGS (source);
+  TpawAccountSettings *settings = TPAW_ACCOUNT_SETTINGS (source);
   TpAccount *account;
   GError *error = NULL;
 
-  if (!empathy_account_settings_apply_finish (settings, result, NULL, &error))
+  if (!tpaw_account_settings_apply_finish (settings, result, NULL, &error))
     {
       DEBUG ("Failed to create account: %s", error->message);
       g_error_free (error);
@@ -201,7 +205,7 @@ apply_account_cb (GObject *source,
     }
 
   /* enable the newly created account */
-  account = empathy_account_settings_get_account (settings);
+  account = tpaw_account_settings_get_account (settings);
   tp_account_set_enabled_async (account, TRUE, account_enabled_cb, NULL);
 }
 
@@ -209,7 +213,7 @@ void
 empathy_local_xmpp_assistant_widget_create_account (
     EmpathyLocalXmppAssistantWidget *self)
 {
-  empathy_account_settings_apply_async (self->priv->settings,
+  tpaw_account_settings_apply_async (self->priv->settings,
       apply_account_cb, NULL);
 }
 
@@ -220,20 +224,20 @@ empathy_local_xmpp_assistant_widget_should_create_account (
   gboolean salut_created = FALSE;
   GList *accounts, *l;
 
-  accounts = tp_account_manager_get_valid_accounts (manager);
+  accounts = tp_account_manager_dup_valid_accounts (manager);
 
   for (l = accounts; l != NULL;  l = g_list_next (l))
     {
       TpAccount *account = TP_ACCOUNT (l->data);
 
-      if (!tp_strdiff (tp_account_get_protocol (account), "local-xmpp"))
+      if (!tp_strdiff (tp_account_get_protocol_name (account), "local-xmpp"))
         {
           salut_created = TRUE;
           break;
         }
     }
 
-  g_list_free (accounts);
+  g_list_free_full (accounts, g_object_unref);
 
   return !salut_created;
 }
@@ -242,5 +246,5 @@ gboolean
 empathy_local_xmpp_assistant_widget_is_valid (
         EmpathyLocalXmppAssistantWidget *self)
 {
-  return empathy_account_settings_is_valid (self->priv->settings);
+  return tpaw_account_settings_is_valid (self->priv->settings);
 }