[brasero] Don't add the same file twice
- From: Philippe Rouquier <philippr src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [brasero] Don't add the same file twice
- Date: Mon, 31 Aug 2009 13:33:17 +0000 (UTC)
commit fbff4873c306d4062361a4c41ba06f3aab0f1928
Author: Philippe Rouquier <bonfire-app wanadoo fr>
Date: Mon Aug 31 15:10:47 2009 +0200
Don't add the same file twice
It can happen that a GtkFileChooserDialog triggers both activated and response callbacks adding the file twice.
That happens when the first callback (because of an error, ...) calls gtk_dialog_run ().
src/brasero-project.c | 18 ++++++++++++------
1 files changed, 12 insertions(+), 6 deletions(-)
---
diff --git a/src/brasero-project.c b/src/brasero-project.c
index 3de85d9..2aa4b88 100644
--- a/src/brasero-project.c
+++ b/src/brasero-project.c
@@ -1906,7 +1906,13 @@ brasero_project_file_chooser_activated_cb (GtkWidget *chooser,
GSList *uris;
GSList *iter;
+ if (!project->priv->chooser)
+ return;
+
+ project->priv->chooser = NULL;
uris = gtk_file_chooser_get_uris (GTK_FILE_CHOOSER (chooser));
+ gtk_widget_destroy (GTK_WIDGET (chooser));
+
for (iter = uris; iter; iter = iter->next) {
gchar *uri;
@@ -1915,9 +1921,6 @@ brasero_project_file_chooser_activated_cb (GtkWidget *chooser,
}
g_slist_foreach (uris, (GFunc) g_free, NULL);
g_slist_free (uris);
-
- gtk_widget_destroy (GTK_WIDGET (project->priv->chooser));
- project->priv->chooser = NULL;
}
static void
@@ -1928,13 +1931,19 @@ brasero_project_file_chooser_response_cb (GtkWidget *chooser,
GSList *uris;
GSList *iter;
+ if (!project->priv->chooser)
+ return;
+
if (response != BRASERO_RESPONSE_ADD) {
gtk_widget_destroy (chooser);
project->priv->chooser = NULL;
return;
}
+ project->priv->chooser = NULL;
uris = gtk_file_chooser_get_uris (GTK_FILE_CHOOSER (chooser));
+ gtk_widget_destroy (GTK_WIDGET (chooser));
+
for (iter = uris; iter; iter = iter->next) {
gchar *uri;
@@ -1943,9 +1952,6 @@ brasero_project_file_chooser_response_cb (GtkWidget *chooser,
}
g_slist_foreach (uris, (GFunc) g_free, NULL);
g_slist_free (uris);
-
- gtk_widget_destroy (GTK_WIDGET (project->priv->chooser));
- project->priv->chooser = NULL;
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]