brasero r1563 - in trunk: . src



Author: philippr
Date: Sun Nov 23 14:54:26 2008
New Revision: 1563
URL: http://svn.gnome.org/viewvc/brasero?rev=1563&view=rev

Log:
	Fix #561590 â Flickering \"Project Size Estimation\" dialog

	* src/brasero-app.c (brasero_app_alert):
	* src/brasero-utils.c (brasero_utils_create_message_dialog),
	(brasero_utils_message_dialog):
	* src/brasero-utils.h:
	* src/main.c (brasero_app_parse_options):


Modified:
   trunk/ChangeLog
   trunk/src/brasero-app.c
   trunk/src/brasero-utils.c
   trunk/src/brasero-utils.h
   trunk/src/main.c

Modified: trunk/src/brasero-app.c
==============================================================================
--- trunk/src/brasero-app.c	(original)
+++ trunk/src/brasero-app.c	Sun Nov 23 14:54:26 2008
@@ -225,19 +225,31 @@
 		   const gchar *secondary_message,
 		   GtkMessageType type)
 {
-	BraseroAppPrivate *priv;
 	GtkWidget *parent = NULL;
+	BraseroAppPrivate *priv;
+	GtkWidget *alert;
 
 	priv = BRASERO_APP_PRIVATE (app);
+
+	/* Whatever happens, they need a parent or must be in the taskbar */
 	if (priv->is_running)
 		parent = GTK_WIDGET (app);
-	else
+	else if (priv->toplevel)
 		parent = priv->toplevel;
 
-	brasero_utils_message_dialog (parent,
-				      primary_message,
-				      secondary_message,
-				      type);
+	alert = brasero_utils_create_message_dialog (parent,
+						     primary_message,
+						     secondary_message,
+						     type);
+	gtk_window_set_title (GTK_WINDOW (alert), _("Disc Burner"));
+
+	if (!parent) {
+		gtk_window_set_skip_pager_hint (GTK_WINDOW (alert), FALSE);
+		gtk_window_set_skip_taskbar_hint (GTK_WINDOW (alert), FALSE);
+	}
+
+	gtk_dialog_run (GTK_DIALOG (alert));
+	gtk_widget_destroy (alert);
 }
 
 GtkUIManager *

Modified: trunk/src/brasero-utils.c
==============================================================================
--- trunk/src/brasero-utils.c	(original)
+++ trunk/src/brasero-utils.c	Sun Nov 23 14:54:26 2008
@@ -509,11 +509,11 @@
 	return retval;
 }
 
-void
-brasero_utils_message_dialog (GtkWidget *parent,
-			      const gchar *primary_message,
-			      const gchar *secondary_message,
-			      GtkMessageType type)
+GtkWidget *
+brasero_utils_create_message_dialog (GtkWidget *parent,
+				     const gchar *primary_message,
+				     const gchar *secondary_message,
+				     GtkMessageType type)
 {
 	GtkWidget *message;
 
@@ -531,6 +531,22 @@
 							  "%s.",
 							  secondary_message);
 
+	return message;
+}
+
+void
+brasero_utils_message_dialog (GtkWidget *parent,
+			      const gchar *primary_message,
+			      const gchar *secondary_message,
+			      GtkMessageType type)
+{
+	GtkWidget *message;
+
+	message = brasero_utils_create_message_dialog (parent,
+						       primary_message,
+						       secondary_message,
+						       type);
+
 	gtk_dialog_run (GTK_DIALOG (message));
 	gtk_widget_destroy (message);
 }

Modified: trunk/src/brasero-utils.h
==============================================================================
--- trunk/src/brasero-utils.h	(original)
+++ trunk/src/brasero-utils.h	Sun Nov 23 14:54:26 2008
@@ -109,6 +109,12 @@
 gchar*
 brasero_utils_validate_utf8 (const gchar *name);
 
+GtkWidget *
+brasero_utils_create_message_dialog (GtkWidget *parent,
+				     const gchar *primary_message,
+				     const gchar *secondary_message,
+				     GtkMessageType type);
+
 void
 brasero_utils_message_dialog (GtkWidget *parent,
 			      const gchar *primary_message,

Modified: trunk/src/main.c
==============================================================================
--- trunk/src/main.c	(original)
+++ trunk/src/main.c	Sun Nov 23 14:54:26 2008
@@ -254,27 +254,86 @@
 		return;
 	}
 	else if (open_ncb) {
+		GFileEnumerator *enumerator;
+		GFileInfo *info = NULL;
+		GError *error = NULL;
 		GSList *list = NULL;
-		gchar **iter;
+		GFile *file;
 
-		list = g_slist_prepend (NULL, "burn:///");
+		/* Here we get the contents from the burn:// URI and add them
+		 * individually to the data project. This is done in case it is
+		 * empty no to start the "Getting Project Size" dialog and then
+		 * show the "Project is empty" dialog. Do this synchronously as:
+		 * - we only want the top nodes which reduces time needed
+		 * - it's always local
+		 * - windows haven't been shown yet
+		 * NOTE: don't use any file specified on the command line. */
+		file = g_file_new_for_uri ("burn://");
+		enumerator = g_file_enumerate_children (file,
+							G_FILE_ATTRIBUTE_STANDARD_NAME,
+							G_FILE_QUERY_INFO_NONE,
+							NULL,
+							&error);
+
+		if (!enumerator) {
+			gchar *string;
+
+			if (error)
+				string = g_strdup_printf (_("An internal error occured (%s)"), error->message);
+			else
+				string = g_strdup (_("An internal error occured"));
+
+			brasero_app_alert (app,
+					   _("Error while loading the project."),
+					   string,
+					   GTK_MESSAGE_ERROR);
 
-		/* in this case we can also add the files from the command line */
-		for (iter = files; iter && *iter; iter ++) {
-			GFile *file;
-			gchar *uri;
+			g_free (string);
+			g_object_unref (file);
+			return;
+		}
+
+		while ((info = g_file_enumerator_next_file (enumerator, NULL, &error)))
+			list = g_slist_prepend (list, g_strconcat ("burn:///", g_file_info_get_name (info), NULL));
+
+		g_object_unref (enumerator);
+		g_object_unref (file);
+
+		if (error) {
+			gchar *string;
 
-			file = g_file_new_for_commandline_arg (*iter);
-			uri = g_file_get_uri (file);
+			if (error)
+				string = g_strdup_printf (_("An internal error occured (%s)"), error->message);
+			else
+				string = g_strdup (_("An internal error occured"));
+
+			brasero_app_alert (app,
+					   _("Error while loading the project."),
+					   string,
+					   GTK_MESSAGE_ERROR);
+
+			g_free (string);
 			g_object_unref (file);
 
-			list = g_slist_prepend (list, file);
+			g_slist_foreach (list, (GFunc) g_free, NULL);
+			g_slist_free (list);
+			return;
+		}
+
+		if (!list) {
+			brasero_app_alert (app,
+					   _("Please add files to the project."),
+					   _("The project is empty"),
+					   GTK_MESSAGE_ERROR);
+			return;
 		}
 
 		/* 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_foreach (list, (GFunc) g_free, NULL);
 		g_slist_free (list);
 		return;
 	}



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