]> git.0d.be Git - empathy.git/commitdiff
contact-selector-dialog: add a selected-account property
authorDanielle Madeley <danielle.madeley@collabora.co.uk>
Wed, 13 Apr 2011 06:23:41 +0000 (16:23 +1000)
committerDanielle Madeley <danielle.madeley@collabora.co.uk>
Thu, 5 May 2011 06:31:27 +0000 (16:31 +1000)
libempathy-gtk/empathy-contact-selector-dialog.c

index d5e533aeb21cc9580305e0743dcf1cd83a6ef6a5..a4747b488bcbab72872c910a218d26aa1f28b2d8 100644 (file)
@@ -66,7 +66,8 @@ struct _EmpathyContactSelectorDialogPriv {
 enum {
   PROP_0,
   PROP_SHOW_ACCOUNT_CHOOSER,
-  PROP_FILTER_ACCOUNT
+  PROP_FILTER_ACCOUNT,
+  PROP_SELECTED_ACCOUNT
 };
 
 enum {
@@ -151,6 +152,8 @@ contact_selector_dialog_account_changed_cb (GtkWidget *widget,
       g_object_unref (contact);
       members = g_list_delete_link (members, members);
   }
+
+  g_object_notify (G_OBJECT (dialog), "selected-account");
 }
 
 static gboolean
@@ -375,6 +378,7 @@ empathy_contact_selector_dialog_get_property (GObject *self,
     GParamSpec *pspec)
 {
   EmpathyContactSelectorDialog *dialog = EMPATHY_CONTACT_SELECTOR_DIALOG (self);
+  EmpathyContactSelectorDialogPriv *priv = GET_PRIV (dialog);
 
   switch (prop_id)
     {
@@ -388,6 +392,11 @@ empathy_contact_selector_dialog_get_property (GObject *self,
             empathy_contact_selector_dialog_get_filter_account (dialog));
         break;
 
+      case PROP_SELECTED_ACCOUNT:
+        g_value_set_object (value, empathy_account_chooser_get_account (
+              EMPATHY_ACCOUNT_CHOOSER (priv->account_chooser)));
+        break;
+
       default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID (self, prop_id, pspec);
         break;
@@ -401,6 +410,7 @@ empathy_contact_selector_dialog_set_property (GObject *self,
     GParamSpec *pspec)
 {
   EmpathyContactSelectorDialog *dialog = EMPATHY_CONTACT_SELECTOR_DIALOG (self);
+  EmpathyContactSelectorDialogPriv *priv = GET_PRIV (dialog);
 
   switch (prop_id)
     {
@@ -414,6 +424,12 @@ empathy_contact_selector_dialog_set_property (GObject *self,
             g_value_get_object (value));
         break;
 
+      case PROP_SELECTED_ACCOUNT:
+        empathy_account_chooser_set_account (
+            EMPATHY_ACCOUNT_CHOOSER (priv->account_chooser),
+            g_value_get_object (value));
+        break;
+
       default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID (self, prop_id, pspec);
         break;
@@ -490,6 +506,13 @@ empathy_contact_selector_dialog_class_init (
         "account are displayed",
         TP_TYPE_ACCOUNT,
         G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+  g_object_class_install_property (object_class, PROP_SELECTED_ACCOUNT,
+      g_param_spec_object ("selected-account",
+        "Selected Account",
+        "Current account selected in the account-chooser",
+        TP_TYPE_ACCOUNT,
+        G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 }
 
 const gchar *