]> git.0d.be Git - empathy.git/blobdiff - libempathy-gtk/empathy-new-account-dialog.c
tp-account-widgets: rename all the files from empathy-* to tpaw-*
[empathy.git] / libempathy-gtk / empathy-new-account-dialog.c
index 180cc4198e5e0f4041b4fe85f1af7aa114d7f4ec..eaa8b07edf04236c4cfcac56334b54c6f13b6c98 100644 (file)
 #include "empathy-new-account-dialog.h"
 
 #include <glib/gi18n-lib.h>
+#include <tp-account-widgets/tpaw-account-widget.h>
 
-#define DEBUG_FLAG EMPATHY_DEBUG_ACCOUNT
-#include <libempathy/empathy-debug.h>
+#include "empathy-protocol-chooser.h"
 
-#include <libempathy-gtk/empathy-account-widget.h>
-#include <libempathy-gtk/empathy-protocol-chooser.h>
+#define DEBUG_FLAG EMPATHY_DEBUG_ACCOUNT
+#include "empathy-debug.h"
 
 G_DEFINE_TYPE (EmpathyNewAccountDialog, empathy_new_account_dialog, \
     GTK_TYPE_DIALOG)
@@ -34,7 +34,7 @@ G_DEFINE_TYPE (EmpathyNewAccountDialog, empathy_new_account_dialog, \
 struct _EmpathyNewAccountDialogPrivate
 {
   GtkWidget *chooser;
-  EmpathyAccountWidget *current_account_widget;
+  TpawAccountWidget *current_account_widget;
   GtkWidget *main_vbox;
   GtkWidget *connect_button;
 
@@ -42,18 +42,11 @@ struct _EmpathyNewAccountDialogPrivate
 };
 
 static void
-account_created_cb (EmpathyAccountWidget *widget,
-    TpAccount *account,
-    EmpathyNewAccountDialog *self)
-{
-  gtk_dialog_response (GTK_DIALOG (self), GTK_RESPONSE_OK);
-}
-
-static void
-cancelled_cb (EmpathyAccountWidget *widget,
+close_cb (TpawAccountWidget *widget,
+    GtkResponseType response,
     EmpathyNewAccountDialog *self)
 {
-  gtk_dialog_response (GTK_DIALOG (self), GTK_RESPONSE_CANCEL);
+  gtk_dialog_response (GTK_DIALOG (self), response);
 }
 
 static void
@@ -61,7 +54,7 @@ protocol_changed_cb (GtkComboBox *chooser,
     EmpathyNewAccountDialog *self)
 {
   EmpathyAccountSettings *settings;
-  EmpathyAccountWidget *account_widget;
+  TpawAccountWidget *account_widget;
   gchar *password = NULL, *account = NULL;
 
   settings = empathy_protocol_chooser_create_account_settings (
@@ -73,23 +66,21 @@ protocol_changed_cb (GtkComboBox *chooser,
   /* Save "account" and "password" parameters */
   if (self->priv->settings != NULL)
     {
-      account = g_strdup (empathy_account_settings_get_string (
-            self->priv->settings, "account"));
+      account = empathy_account_settings_dup_string (
+            self->priv->settings, "account");
 
-      password = g_strdup (empathy_account_settings_get_string (
-            self->priv->settings, "password"));
+      password = empathy_account_settings_dup_string (
+            self->priv->settings, "password");
 
       g_object_unref (self->priv->settings);
     }
 
-  account_widget = empathy_account_widget_new_for_protocol (settings, TRUE);
+  account_widget = tpaw_account_widget_new_for_protocol (settings, TRUE);
 
   if (self->priv->current_account_widget != NULL)
     {
       g_signal_handlers_disconnect_by_func (self->priv->current_account_widget,
-          account_created_cb, self);
-      g_signal_handlers_disconnect_by_func (self->priv->current_account_widget,
-          cancelled_cb, self);
+          close_cb, self);
 
       gtk_widget_destroy (GTK_WIDGET (self->priv->current_account_widget));
     }
@@ -98,21 +89,19 @@ protocol_changed_cb (GtkComboBox *chooser,
 
   self->priv->settings = settings;
 
-  g_signal_connect (self->priv->current_account_widget, "account-created",
-      G_CALLBACK (account_created_cb), self);
-  g_signal_connect (self->priv->current_account_widget, "cancelled",
-      G_CALLBACK (cancelled_cb), self);
+  g_signal_connect (self->priv->current_account_widget, "close",
+      G_CALLBACK (close_cb), self);
 
   /* Restore "account" and "password" parameters in the new widget */
   if (account != NULL)
     {
-      empathy_account_widget_set_account_param (account_widget, account);
+      tpaw_account_widget_set_account_param (account_widget, account);
       g_free (account);
     }
 
   if (password != NULL)
     {
-      empathy_account_widget_set_password_param (account_widget, password);
+      tpaw_account_widget_set_password_param (account_widget, password);
       g_free (password);
     }
 
@@ -159,7 +148,7 @@ empathy_new_account_dialog_init (EmpathyNewAccountDialog *self)
   /* trigger show the first account widget */
   protocol_changed_cb (GTK_COMBO_BOX (self->priv->chooser), self);
 
-  gtk_window_set_title (GTK_WINDOW (self), _("Adding new account"));
+  gtk_window_set_title (GTK_WINDOW (self), _("Add new account"));
 }
 
 static void