]> git.0d.be Git - empathy.git/commitdiff
connect to signals when account has been created
authorFelix Kaser <f.kaser@gmx.net>
Mon, 28 Dec 2009 12:03:12 +0000 (13:03 +0100)
committerFelix Kaser <f.kaser@gmx.net>
Mon, 11 Jan 2010 14:03:26 +0000 (15:03 +0100)
when a new account is created the signals presence-changed and status-changed of the account are connected to update the treeview icon and status infobar

libempathy-gtk/empathy-account-widget.c
src/empathy-accounts-dialog.c

index 9b82c3f2c146595a22ae0fedabd9b887717e923e..33eb528480477fccc65dd90d1f3a965ad2f3ad29 100644 (file)
@@ -738,7 +738,7 @@ account_widget_applied_cb (GObject *source_object,
 
           tp_account_set_enabled_async (account, TRUE,
               account_widget_account_enabled_cb, widget);
-          g_signal_emit (widget, signals[ACCOUNT_CREATED], 0);
+          g_signal_emit (widget, signals[ACCOUNT_CREATED], 0, account);
         }
       else if (priv->enabled_checkbox != NULL)
         {
@@ -1735,9 +1735,9 @@ empathy_account_widget_class_init (EmpathyAccountWidgetClass *klass)
   signals[ACCOUNT_CREATED] =
       g_signal_new ("account-created", G_TYPE_FROM_CLASS (klass),
           G_SIGNAL_RUN_LAST, 0, NULL, NULL,
-          g_cclosure_marshal_VOID__VOID,
+          g_cclosure_marshal_VOID__POINTER,
           G_TYPE_NONE,
-          0);
+          1, G_TYPE_POINTER);
 
   signals[CANCELLED] =
       g_signal_new ("cancelled", G_TYPE_FROM_CLASS (klass),
index a99c5d3d057a4800b5695d482ade2a45a3231363..edec6008dcb60733f4cfe4e1c36ffbc951986155 100644 (file)
@@ -159,6 +159,20 @@ static void accounts_dialog_add (EmpathyAccountsDialog *dialog,
 static void accounts_dialog_model_set_selected (EmpathyAccountsDialog *dialog,
     EmpathyAccountSettings *settings);
 
+static void accounts_dialog_connection_changed_cb (TpAccount *account,
+    guint old_status,
+    guint current,
+    guint reason,
+    gchar *dbus_error_name,
+    GHashTable *details,
+    EmpathyAccountsDialog *dialog);
+
+static void accounts_dialog_presence_changed_cb (TpAccount *account,
+    guint presence,
+    gchar *status,
+    gchar *status_message,
+    EmpathyAccountsDialog *dialog);
+
 static void
 accounts_dialog_update_name_label (EmpathyAccountsDialog *dialog,
     const gchar *display_name)
@@ -359,6 +373,7 @@ empathy_account_dialog_widget_cancelled_cb (
 
 static void
 empathy_account_dialog_account_created_cb (EmpathyAccountWidget *widget_object,
+    TpAccount *account,
     EmpathyAccountsDialog *dialog)
 {
   gchar *display_name;
@@ -382,6 +397,11 @@ empathy_account_dialog_account_created_cb (EmpathyAccountWidget *widget_object,
   gtk_widget_set_sensitive (priv->button_add, TRUE);
   gtk_widget_set_sensitive (priv->button_import, TRUE);
 
+  empathy_signal_connect_weak (account, "status-changed",
+      G_CALLBACK (accounts_dialog_connection_changed_cb), G_OBJECT (dialog));
+  empathy_signal_connect_weak (account, "presence-changed",
+      G_CALLBACK (accounts_dialog_presence_changed_cb), G_OBJECT (dialog));
+
   if (settings)
     g_object_unref (settings);
 }