aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrederic Peters <fpeters@src.gnome.org>2009-01-12 22:58:31 +0800
committerFrederic Peters <fpeters@src.gnome.org>2009-01-12 22:58:31 +0800
commit438ea15bef19415a62630019fc7e6b4886053973 (patch)
tree2fa9d8fa1b8bb6806ad1a81bcc836f3412271baf
parentcb812330feaf4fbd025beaeaff61eca9758eb5b9 (diff)
downloadgsoc2013-empathy-438ea15bef19415a62630019fc7e6b4886053973.tar
gsoc2013-empathy-438ea15bef19415a62630019fc7e6b4886053973.tar.gz
gsoc2013-empathy-438ea15bef19415a62630019fc7e6b4886053973.tar.bz2
gsoc2013-empathy-438ea15bef19415a62630019fc7e6b4886053973.tar.lz
gsoc2013-empathy-438ea15bef19415a62630019fc7e6b4886053973.tar.xz
gsoc2013-empathy-438ea15bef19415a62630019fc7e6b4886053973.tar.zst
gsoc2013-empathy-438ea15bef19415a62630019fc7e6b4886053973.zip
Reuse, and properly destroy, the avatar file chooser dialog.
Fixes bug #548768 (Frederic Peters) svn path=/trunk/; revision=2225
-rw-r--r--libempathy-gtk/empathy-avatar-chooser.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/libempathy-gtk/empathy-avatar-chooser.c b/libempathy-gtk/empathy-avatar-chooser.c
index 5da81b936..5d1c90fcb 100644
--- a/libempathy-gtk/empathy-avatar-chooser.c
+++ b/libempathy-gtk/empathy-avatar-chooser.c
@@ -48,6 +48,7 @@ typedef struct {
EmpathyContactFactory *contact_factory;
McAccount *account;
EmpathyTpContactFactory *tp_contact_factory;
+ GtkFileChooser *chooser_dialog;
gulong ready_handler_id;
@@ -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 (),