]> git.0d.be Git - empathy.git/blobdiff - libempathy-gtk/empathy-contact-widget.c
de.po: Updated German translation
[empathy.git] / libempathy-gtk / empathy-contact-widget.c
index 25fc275f43a55a40d95bf21f3f8dbaf9265502b6..07058e4bcbc0e4dd6fdfbf4e6beb1c09a78abe4b 100644 (file)
@@ -26,7 +26,7 @@
 
 #include <gtk/gtk.h>
 #include <glade/glade.h>
-#include <glib/gi18n.h>
+#include <glib/gi18n-lib.h>
 
 #include <libmissioncontrol/mc-account.h>
 #include <telepathy-glib/util.h>
@@ -105,8 +105,6 @@ static void contact_widget_contact_update (EmpathyContactWidget *information);
 static void contact_widget_change_contact (EmpathyContactWidget *information);
 static void contact_widget_avatar_changed_cb (EmpathyAvatarChooser *chooser,
     EmpathyContactWidget *information);
-static void contact_widget_update_avatar_chooser_account (
-    EmpathyContactWidget *information);
 static void contact_widget_account_changed_cb (GtkComboBox *widget,
     EmpathyContactWidget *information);
 static gboolean contact_widget_id_focus_out_cb (GtkWidget *widget,
@@ -164,7 +162,7 @@ empathy_contact_widget_new (EmpathyContact *contact,
 
   information = g_slice_new0 (EmpathyContactWidget);
   information->flags = flags;
-  information->factory = empathy_contact_factory_new ();
+  information->factory = empathy_contact_factory_dup_singleton ();
 
   filename = empathy_file_lookup ("empathy-contact-widget.glade",
       "libempathy-gtk");
@@ -494,6 +492,16 @@ widget_avatar_button_press_event_cb (GtkWidget *widget,
   return FALSE;
 }
 
+static void
+update_avatar_chooser_account_cb (EmpathyAccountChooser *account_chooser,
+                                  EmpathyAvatarChooser *avatar_chooser)
+{
+  McAccount *account;
+
+  account = empathy_account_chooser_get_account (account_chooser);
+  g_object_set (avatar_chooser, "account", account, NULL);
+}
+
 static void
 contact_widget_contact_setup (EmpathyContactWidget *information)
 {
@@ -505,7 +513,6 @@ contact_widget_contact_setup (EmpathyContactWidget *information)
       g_signal_connect (information->widget_account, "changed",
             G_CALLBACK (contact_widget_account_changed_cb),
             information);
-      contact_widget_update_avatar_chooser_account (information);
     }
   else
     {
@@ -527,6 +534,15 @@ contact_widget_contact_setup (EmpathyContactWidget *information)
       g_signal_connect (information->widget_avatar, "changed",
             G_CALLBACK (contact_widget_avatar_changed_cb),
             information);
+      if (information->flags & EMPATHY_CONTACT_WIDGET_EDIT_ACCOUNT)
+        {
+          g_signal_connect (information->widget_account, "changed",
+              G_CALLBACK (update_avatar_chooser_account_cb),
+              information->widget_avatar);
+          update_avatar_chooser_account_cb (
+              EMPATHY_ACCOUNT_CHOOSER (information->widget_account),
+              EMPATHY_AVATAR_CHOOSER (information->widget_avatar));
+        }
     }
   else
     {
@@ -687,7 +703,7 @@ contact_widget_change_contact (EmpathyContactWidget *information)
       const gchar *id;
 
       id = gtk_entry_get_text (GTK_ENTRY (information->widget_id));
-      if (G_STR_EMPTY (id))
+      if (EMP_STR_EMPTY (id))
           return;
 
       contact = empathy_contact_factory_get_from_id (information->factory,
@@ -730,29 +746,10 @@ contact_widget_avatar_changed_cb (EmpathyAvatarChooser *chooser,
     }
 }
 
-static void
-contact_widget_update_avatar_chooser_account (EmpathyContactWidget *information)
-{
-  McAccount *account;
-  EmpathyAccountChooser *account_chooser;
-
-  g_assert (EMPATHY_IS_ACCOUNT_CHOOSER (information->widget_account));
-  account_chooser = EMPATHY_ACCOUNT_CHOOSER (information->widget_account);
-
-  if (information->flags & EMPATHY_CONTACT_WIDGET_EDIT_AVATAR)
-    {
-      g_assert (EMPATHY_IS_AVATAR_CHOOSER (information->widget_avatar));
-
-      account = empathy_account_chooser_get_account (account_chooser);
-      g_object_set (information->widget_avatar, "account", account, NULL);
-    }
-}
-
 static void
 contact_widget_account_changed_cb (GtkComboBox *widget,
                                    EmpathyContactWidget *information)
 {
-  contact_widget_update_avatar_chooser_account (information);
   contact_widget_change_contact (information);
 }
 
@@ -831,7 +828,7 @@ contact_widget_groups_setup (EmpathyContactWidget *information)
 {
   if (information->flags & EMPATHY_CONTACT_WIDGET_EDIT_GROUPS)
     {
-      information->manager = empathy_contact_manager_new ();
+      information->manager = empathy_contact_manager_dup_singleton ();
       contact_widget_model_setup (information);
     }
 }
@@ -982,7 +979,7 @@ contact_widget_model_find_name (EmpathyContactWidget *information,
   GtkTreeModel *model;
   FindName data;
 
-  if (G_STR_EMPTY (name))
+  if (EMP_STR_EMPTY (name))
       return FALSE;
 
   data.information = information;
@@ -1094,7 +1091,7 @@ contact_widget_entry_group_changed_cb (GtkEditable *editable,
       gtk_widget_set_sensitive (GTK_WIDGET (information->button_group), FALSE);
   else
       gtk_widget_set_sensitive (GTK_WIDGET (information->button_group),
-          !G_STR_EMPTY (group));
+          !EMP_STR_EMPTY (group));
 }
 
 static void