]> git.0d.be Git - empathy.git/blobdiff - libempathy-gtk/empathy-avatar-chooser.c
de.po: Updated German translation
[empathy.git] / libempathy-gtk / empathy-avatar-chooser.c
index 403dcb9ae69a819e2509f6a32aaaa66ef236fd39..5d1c90fcba2b3c10886b48582d39a0ab630fba5e 100644 (file)
@@ -25,7 +25,7 @@
 
 #include <string.h>
 
-#include <glib/gi18n.h>
+#include <glib/gi18n-lib.h>
 #include <gtk/gtk.h>
 #include <gio/gio.h>
 
@@ -48,6 +48,7 @@ typedef struct {
        EmpathyContactFactory   *contact_factory;
        McAccount               *account;
        EmpathyTpContactFactory *tp_contact_factory;
+       GtkFileChooser          *chooser_dialog;
 
        gulong ready_handler_id;
 
@@ -213,7 +214,7 @@ empathy_avatar_chooser_init (EmpathyAvatarChooser *chooser)
                          G_CALLBACK (avatar_chooser_clicked_cb),
                          chooser);
 
-       priv->contact_factory = empathy_contact_factory_new ();
+       priv->contact_factory = empathy_contact_factory_dup_singleton ();
 
        empathy_avatar_chooser_set (chooser, NULL);
 }
@@ -412,7 +413,7 @@ avatar_chooser_maybe_convert_and_scale (EmpathyAvatarChooser *chooser,
 {
        EmpathyAvatarChooserPriv *priv = GET_PRIV (chooser);
        EmpathyTpContactFactory  *tp_cf = priv->tp_contact_factory;
-       gint                      max_width = 0, max_height = 0, max_size = 0;
+       guint                     max_width = 0, max_height = 0, max_size = 0;
        gchar                   **mime_types = NULL;
        gboolean                  needs_conversion = FALSE;
        gint                      width, height;
@@ -485,7 +486,7 @@ avatar_chooser_maybe_convert_and_scale (EmpathyAvatarChooser *chooser,
         * try with a lower factor. */
        if (max_size > 0 && avatar->len > max_size && !needs_conversion) {
                DEBUG ("Image data (%"G_GSIZE_FORMAT" bytes) is too big "
-                      "(max is %"G_GSIZE_FORMAT" bytes), conversion needed.",
+                      "(max is %u bytes), conversion needed.",
                       avatar->len, max_size);
 
                factor = 0.5;
@@ -897,6 +898,8 @@ avatar_chooser_response_cb (GtkWidget            *widget,
 {
        EmpathyAvatarChooserPriv *priv = GET_PRIV (chooser);
 
+       priv->chooser_dialog = NULL;
+
        if (response == GTK_RESPONSE_CANCEL) {
                goto out;
        }
@@ -942,8 +945,14 @@ avatar_chooser_clicked_cb (GtkWidget            *button,
        const gchar    *default_dir = DEFAULT_DIR;
        const gchar    *pics_dir;
        GtkFileFilter  *filter;
+       EmpathyAvatarChooserPriv *priv = GET_PRIV (chooser);
+
+       if (priv->chooser_dialog) {
+               gtk_window_present (GTK_WINDOW (priv->chooser_dialog));
+               return;
+       }
 
-       chooser_dialog = GTK_FILE_CHOOSER (
+       priv->chooser_dialog = GTK_FILE_CHOOSER (
                gtk_file_chooser_dialog_new (_("Select Your Avatar Image"),
                                             empathy_get_toplevel_window (GTK_WIDGET (chooser)),
                                             GTK_FILE_CHOOSER_ACTION_OPEN,
@@ -954,6 +963,8 @@ avatar_chooser_clicked_cb (GtkWidget            *button,
                                             GTK_STOCK_OPEN,
                                             GTK_RESPONSE_OK,
                                             NULL));
+       chooser_dialog = priv->chooser_dialog;
+       gtk_window_set_destroy_with_parent (GTK_WINDOW (chooser_dialog), TRUE);
 
        /* Get special dirs */
        empathy_conf_get_string (empathy_conf_get (),