brasero r1419 - in trunk: . src



Author: philippr
Date: Sat Oct 25 09:15:23 2008
New Revision: 1419
URL: http://svn.gnome.org/viewvc/brasero?rev=1419&view=rev

Log:
	Fix #556724 â Brasero main GUI appears after closing the dialog when opening an ISO file using Nautilus

	* src/brasero-data-disc.c (brasero_data_disc_switch_to_image):
	* src/brasero-project-manager.c
	(brasero_project_manager_burn_iso_dialog),
	(brasero_project_manager_copy_disc),
	(brasero_project_manager_switch),
	(brasero_project_manager_type_changed_cb),
	(brasero_project_manager_new_empty_prj_cb),
	(brasero_project_manager_new_audio_prj_cb),
	(brasero_project_manager_new_data_prj_cb),
	(brasero_project_manager_new_video_prj_cb),
	(brasero_project_manager_new_copy_prj_cb),
	(brasero_project_manager_new_iso_prj_cb),
	(brasero_project_manager_audio), (brasero_project_manager_data),
	(brasero_project_manager_video), (brasero_project_manager_copy),
	(brasero_project_manager_iso), (brasero_project_manager_open_cb),
	(brasero_project_manager_recent_clicked_cb),
	(brasero_project_manager_set_oneshot):
	* src/brasero-project-manager.h:
	* src/main.c (brasero_app_parse_options):


Modified:
   trunk/ChangeLog
   trunk/src/brasero-data-disc.c
   trunk/src/brasero-project-manager.c
   trunk/src/brasero-project-manager.h
   trunk/src/main.c

Modified: trunk/src/brasero-data-disc.c
==============================================================================
--- trunk/src/brasero-data-disc.c	(original)
+++ trunk/src/brasero-data-disc.c	Sat Oct 25 09:15:23 2008
@@ -784,7 +784,8 @@
 
 	/* Tell project manager to switch */
 	manager = brasero_app_get_project_manager (BRASERO_APP (toplevel));
-	brasero_project_manager_iso (BRASERO_PROJECT_MANAGER (manager), callback_data->uri);
+	brasero_project_manager_iso (BRASERO_PROJECT_MANAGER (manager),
+				     callback_data->uri);
 
 	return FALSE;
 }

Modified: trunk/src/brasero-project-manager.c
==============================================================================
--- trunk/src/brasero-project-manager.c	(original)
+++ trunk/src/brasero-project-manager.c	Sat Oct 25 09:15:23 2008
@@ -182,6 +182,8 @@
 	guint status_ctx;
 
 	GtkActionGroup *action_group;
+
+	guint oneshot:1;
 };
 
 #define BRASERO_PROJECT_MANAGER_CONNECT_CHANGED(manager, container)		\
@@ -576,17 +578,30 @@
 	result = gtk_dialog_run (GTK_DIALOG (dialog));
 	if (result != GTK_RESPONSE_OK) {
 		gtk_widget_destroy (dialog);
+
+		/* Here we may have to close brasero altogether */
+		if (manager->priv->oneshot) {
+			GtkWidget *toplevel;
+
+			toplevel = gtk_widget_get_toplevel (GTK_WIDGET (manager));
+			gtk_widget_destroy (toplevel);
+		}
 		return;
 	}
 
 	session = brasero_burn_options_get_session (BRASERO_BURN_OPTIONS (dialog));
 	gtk_widget_destroy (dialog);
 
-	if (!session)
-		return;
-
 	brasero_project_manager_burn (manager, session);
 	g_object_unref (session);
+
+	/* Here we may have to close brasero altogether */
+	if (manager->priv->oneshot) {
+		GtkWidget *toplevel;
+
+		toplevel = gtk_widget_get_toplevel (GTK_WIDGET (manager));
+		gtk_widget_destroy (toplevel);
+	}
 }
 
 static void
@@ -622,6 +637,15 @@
 	result = gtk_dialog_run (GTK_DIALOG (dialog));
 	if (result != GTK_RESPONSE_OK) {
 		gtk_widget_destroy (dialog);
+
+		/* Here we may have to close brasero altogether */
+		if (manager->priv->oneshot) {
+			GtkWidget *toplevel;
+
+			toplevel = gtk_widget_get_toplevel (GTK_WIDGET (manager));
+			gtk_widget_destroy (toplevel);
+		}
+
 		return;
 	}
 
@@ -630,6 +654,14 @@
 
 	brasero_project_manager_burn (manager, session);
 	g_object_unref (session);
+
+	/* Here we may have to close brasero altogether */
+	if (manager->priv->oneshot) {
+		GtkWidget *toplevel;
+
+		toplevel = gtk_widget_get_toplevel (GTK_WIDGET (manager));
+		gtk_widget_destroy (toplevel);
+	}
 }
 
 static void
@@ -642,14 +674,21 @@
 	GtkWidget *toplevel;
 	GtkAction *action;
 
-	if ((manager->priv->type == BRASERO_PROJECT_TYPE_AUDIO
-	||   manager->priv->type == BRASERO_PROJECT_TYPE_DATA
-	||   manager->priv->type == BRASERO_PROJECT_TYPE_VIDEO)
-	&&  !brasero_project_confirm_switch (BRASERO_PROJECT (manager->priv->project)))
-		return;
-
 	toplevel = gtk_widget_get_toplevel (GTK_WIDGET (manager));
 
+	if (manager->priv->type == BRASERO_PROJECT_TYPE_AUDIO
+	||  manager->priv->type == BRASERO_PROJECT_TYPE_DATA
+	||  manager->priv->type == BRASERO_PROJECT_TYPE_VIDEO) {
+		if (!brasero_project_confirm_switch (BRASERO_PROJECT (manager->priv->project)))
+			return;
+
+		if (manager->priv->oneshot) {
+			/* Here we may have to close brasero altogether */
+			gtk_widget_destroy (toplevel);
+			return;
+		}
+	}
+
 	if (manager->priv->status_ctx) {
 		GtkWidget *status;
 
@@ -743,47 +782,55 @@
 					 BraseroProjectType type,
 					 BraseroProjectManager *manager)
 {
+	manager->priv->oneshot = FALSE;
 	brasero_project_manager_switch (manager, type, NULL, NULL, TRUE);
 }
 
 static void
 brasero_project_manager_new_empty_prj_cb (GtkAction *action, BraseroProjectManager *manager)
 {
+	manager->priv->oneshot = FALSE;
 	brasero_project_manager_switch (manager, BRASERO_PROJECT_TYPE_INVALID, NULL, NULL, TRUE);
 }
 
 static void
 brasero_project_manager_new_audio_prj_cb (GtkAction *action, BraseroProjectManager *manager)
 {
+	manager->priv->oneshot = FALSE;
 	brasero_project_manager_switch (manager, BRASERO_PROJECT_TYPE_AUDIO, NULL, NULL, TRUE);
 }
 
 static void
 brasero_project_manager_new_data_prj_cb (GtkAction *action, BraseroProjectManager *manager)
 {
+	manager->priv->oneshot = FALSE;
 	brasero_project_manager_switch (manager, BRASERO_PROJECT_TYPE_DATA, NULL, NULL, TRUE);
 }
 
 static void
 brasero_project_manager_new_video_prj_cb (GtkAction *action, BraseroProjectManager *manager)
 {
+	manager->priv->oneshot = FALSE;
 	brasero_project_manager_switch (manager, BRASERO_PROJECT_TYPE_VIDEO, NULL, NULL, TRUE);
 }
 
 static void
 brasero_project_manager_new_copy_prj_cb (GtkAction *action, BraseroProjectManager *manager)
 {
+	manager->priv->oneshot = FALSE;
 	brasero_project_manager_switch (manager, BRASERO_PROJECT_TYPE_COPY, NULL, NULL, TRUE);
 }
 
 static void
 brasero_project_manager_new_iso_prj_cb (GtkAction *action, BraseroProjectManager *manager)
 {
+	manager->priv->oneshot = FALSE;
 	brasero_project_manager_switch (manager, BRASERO_PROJECT_TYPE_ISO, NULL, NULL, TRUE);
 }
 
 void
-brasero_project_manager_audio (BraseroProjectManager *manager, GSList *uris)
+brasero_project_manager_audio (BraseroProjectManager *manager,
+			       GSList *uris)
 {
 	brasero_project_manager_switch (manager,
 					BRASERO_PROJECT_TYPE_AUDIO,
@@ -793,7 +840,8 @@
 }
 
 void
-brasero_project_manager_data (BraseroProjectManager *manager, GSList *uris)
+brasero_project_manager_data (BraseroProjectManager *manager,
+			      GSList *uris)
 {
 	brasero_project_manager_switch (manager,
 					BRASERO_PROJECT_TYPE_DATA,
@@ -803,7 +851,8 @@
 }
 
 void
-brasero_project_manager_video (BraseroProjectManager *manager, GSList *uris)
+brasero_project_manager_video (BraseroProjectManager *manager,
+			       GSList *uris)
 {
 	brasero_project_manager_switch (manager,
 					BRASERO_PROJECT_TYPE_VIDEO,
@@ -816,13 +865,22 @@
 brasero_project_manager_copy (BraseroProjectManager *manager,
 			      const gchar *device)
 {
-	brasero_project_manager_switch (manager, BRASERO_PROJECT_TYPE_COPY, NULL, device, TRUE);
+	brasero_project_manager_switch (manager,
+					BRASERO_PROJECT_TYPE_COPY,
+					NULL,
+					device,
+					TRUE);
 }
 
 void
-brasero_project_manager_iso (BraseroProjectManager *manager, const gchar *uri)
+brasero_project_manager_iso (BraseroProjectManager *manager,
+			     const gchar *uri)
 {
-	brasero_project_manager_switch (manager, BRASERO_PROJECT_TYPE_ISO, NULL, uri, TRUE);
+	brasero_project_manager_switch (manager,
+					BRASERO_PROJECT_TYPE_ISO,
+					NULL,
+					uri,
+					TRUE);
 }
 
 BraseroProjectType
@@ -1038,6 +1096,7 @@
 	uri = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (chooser));
 	gtk_widget_destroy (chooser);
 
+	manager->priv->oneshot = FALSE;
 	type = brasero_project_manager_open_uri (manager, uri);
 	g_free (uri);
 }
@@ -1047,10 +1106,18 @@
 					   const gchar *uri,
 					   BraseroProjectManager *manager)
 {
+	manager->priv->oneshot = FALSE;
 	brasero_project_manager_open_uri (manager, uri);
 }
 
 void
+brasero_project_manager_set_oneshot (BraseroProjectManager *manager,
+				     gboolean oneshot)
+{
+	manager->priv->oneshot = oneshot;
+}
+
+void
 brasero_project_manager_empty (BraseroProjectManager *manager)
 {
 	brasero_project_manager_switch (manager, BRASERO_PROJECT_TYPE_INVALID, NULL, NULL, TRUE);

Modified: trunk/src/brasero-project-manager.h
==============================================================================
--- trunk/src/brasero-project-manager.h	(original)
+++ trunk/src/brasero-project-manager.h	Sat Oct 25 09:15:23 2008
@@ -60,22 +60,32 @@
 GtkWidget *brasero_project_manager_new ();
 
 void
-brasero_project_manager_audio (BraseroProjectManager *manager, GSList *uris);
+brasero_project_manager_set_oneshot (BraseroProjectManager *manager,
+				     gboolean oneshot);
+
+void
+brasero_project_manager_audio (BraseroProjectManager *manager,
+			       GSList *uris);
 void
-brasero_project_manager_data (BraseroProjectManager *manager, GSList *uris);
+brasero_project_manager_data (BraseroProjectManager *manager,
+			      GSList *uris);
 void
-brasero_project_manager_video (BraseroProjectManager *manager, GSList *uris);
+brasero_project_manager_video (BraseroProjectManager *manager,
+			       GSList *uris);
 void
 brasero_project_manager_copy (BraseroProjectManager *manager,
 			      const gchar *device);
 void
-brasero_project_manager_iso (BraseroProjectManager *manager, const gchar *uri);
+brasero_project_manager_iso (BraseroProjectManager *manager,
+			     const gchar *uri);
 
 BraseroProjectType
-brasero_project_manager_open_playlist (BraseroProjectManager *manager, const gchar *uri);
+brasero_project_manager_open_playlist (BraseroProjectManager *manager,
+				       const gchar *uri);
 
 BraseroProjectType
-brasero_project_manager_open_project (BraseroProjectManager *manager, const gchar *uri);
+brasero_project_manager_open_project (BraseroProjectManager *manager,
+				      const gchar *uri);
 
 BraseroProjectType
 brasero_project_manager_open_by_mime (BraseroProjectManager *manager,

Modified: trunk/src/main.c
==============================================================================
--- trunk/src/main.c	(original)
+++ trunk/src/main.c	Sat Oct 25 09:15:23 2008
@@ -214,18 +214,22 @@
 			device = files [0];
 		
 		/* this can't combine with any other options */
+		brasero_project_manager_set_oneshot (BRASERO_PROJECT_MANAGER (manager), TRUE);
 		brasero_project_manager_copy (BRASERO_PROJECT_MANAGER (manager), device);
 	}
 	else if (iso_uri) {
+		brasero_project_manager_set_oneshot (BRASERO_PROJECT_MANAGER (manager), TRUE);
 		BRASERO_PROJECT_OPEN_URI (manager, brasero_project_manager_iso, iso_uri);
 	}
 	else if (project_uri) {
+		brasero_project_manager_set_oneshot (BRASERO_PROJECT_MANAGER (manager), TRUE);
 		BRASERO_PROJECT_OPEN_URI (manager, brasero_project_manager_open_project, project_uri);
 	}
 
 #ifdef BUILD_PLAYLIST
 
 	else if (playlist_uri) {
+		brasero_project_manager_set_oneshot (BRASERO_PROJECT_MANAGER (manager), TRUE);
 		BRASERO_PROJECT_OPEN_URI (manager, brasero_project_manager_open_playlist, playlist_uri);
 	}
 
@@ -260,18 +264,25 @@
 
 		/* reverse to keep the order of files */
 		list = g_slist_reverse (list);
+		brasero_project_manager_set_oneshot (BRASERO_PROJECT_MANAGER (manager), TRUE);
 		brasero_project_manager_data (BRASERO_PROJECT_MANAGER (manager), list);
 		g_slist_free (list);
 	}
 	else if (files) {
-		BraseroProjectType type;
+		if (g_strv_length (files) == 1) {
+			BraseroProjectType type;
 
-	    	if (g_strv_length (files) > 1)
-			BRASERO_PROJECT_OPEN_LIST (manager, brasero_project_manager_data, files);
+			brasero_project_manager_set_oneshot (BRASERO_PROJECT_MANAGER (manager), TRUE);
+			type = brasero_project_manager_open_uri (BRASERO_PROJECT_MANAGER (manager), files [0]);
 
-		type = brasero_project_manager_open_uri (BRASERO_PROJECT_MANAGER (manager), files [0]);
-		if (type == BRASERO_PROJECT_TYPE_INVALID)
+			/* Fallback if it hasn't got a suitable URI */
+			if (type == BRASERO_PROJECT_TYPE_INVALID)
+				BRASERO_PROJECT_OPEN_LIST (manager, brasero_project_manager_data, files);
+		}
+		else {
+			brasero_project_manager_set_oneshot (BRASERO_PROJECT_MANAGER (manager), TRUE);
 			BRASERO_PROJECT_OPEN_LIST (manager, brasero_project_manager_data, files);
+		}
 	}
 	else {
 		brasero_project_manager_empty (BRASERO_PROJECT_MANAGER (manager));



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]