[brasero] Fix a window stacking order problem and a window icon problem



commit 70255cfcbffbc6b439de325bd95d7d2ea02d46a4
Author: Philippe Rouquier <bonfire-app wanadoo fr>
Date:   Mon Nov 9 23:09:36 2009 +0100

    Fix a window stacking order problem and a window icon problem

 libbrasero-burn/brasero-burn-options.c  |   40 ++++++++++++++-
 libbrasero-burn/brasero-status-dialog.c |   85 +++++++++++++++++++++++-------
 2 files changed, 104 insertions(+), 21 deletions(-)
---
diff --git a/libbrasero-burn/brasero-burn-options.c b/libbrasero-burn/brasero-burn-options.c
index d0425d9..a28b6fd 100644
--- a/libbrasero-burn/brasero-burn-options.c
+++ b/libbrasero-burn/brasero-burn-options.c
@@ -257,7 +257,17 @@ brasero_burn_options_not_ready_dialog_cancel_cb (GtkDialog *dialog,
 						 guint response,
 						 gpointer data)
 {
-	gtk_dialog_response (GTK_DIALOG (data), GTK_RESPONSE_CANCEL);
+	BraseroBurnOptionsPrivate *priv;
+
+	priv = BRASERO_BURN_OPTIONS_PRIVATE (data);
+
+	if (priv->not_ready_id) {
+		g_source_remove (priv->not_ready_id);
+		priv->not_ready_id = 0;
+	}
+	gtk_widget_set_sensitive (GTK_WIDGET (data), TRUE);
+	gtk_dialog_response (GTK_DIALOG (data),
+	                     GTK_RESPONSE_CANCEL);
 }
 
 static gboolean
@@ -266,11 +276,30 @@ brasero_burn_options_not_ready_dialog_show_cb (gpointer data)
 	BraseroBurnOptionsPrivate *priv;
 
 	priv = BRASERO_BURN_OPTIONS_PRIVATE (data);
+
+	/* icon should be set by now */
+	gtk_window_set_icon_name (GTK_WINDOW (priv->status_dialog),
+	                          gtk_window_get_icon_name (GTK_WINDOW (data)));
+
+	gtk_widget_show (priv->status_dialog);
 	priv->not_ready_id = 0;
 	return FALSE;
 }
 
 static void
+brasero_burn_options_not_ready_dialog_shown_cb (GtkWidget *widget,
+                                                gpointer data)
+{
+	BraseroBurnOptionsPrivate *priv;
+
+	priv = BRASERO_BURN_OPTIONS_PRIVATE (data);
+	if (priv->not_ready_id) {
+		g_source_remove (priv->not_ready_id);
+		priv->not_ready_id = 0;
+	}
+}
+
+static void
 brasero_burn_options_update_valid (BraseroBurnOptions *self)
 {
 	BraseroBurnOptionsPrivate *priv;
@@ -303,6 +332,15 @@ brasero_burn_options_update_valid (BraseroBurnOptions *self)
 					  G_CALLBACK (brasero_burn_options_not_ready_dialog_cancel_cb),
 					  self);
 
+			g_signal_connect (priv->status_dialog,
+					  "show", 
+					  G_CALLBACK (brasero_burn_options_not_ready_dialog_shown_cb),
+					  self);
+			g_signal_connect (priv->status_dialog,
+					  "user-interaction", 
+					  G_CALLBACK (brasero_burn_options_not_ready_dialog_shown_cb),
+					  self);
+
 			priv->not_ready_id = g_timeout_add_seconds (1,
 								    brasero_burn_options_not_ready_dialog_show_cb,
 								    self);
diff --git a/libbrasero-burn/brasero-status-dialog.c b/libbrasero-burn/brasero-status-dialog.c
index a072e2d..b10da8b 100644
--- a/libbrasero-burn/brasero-status-dialog.c
+++ b/libbrasero-burn/brasero-status-dialog.c
@@ -73,6 +73,11 @@ enum {
 
 G_DEFINE_TYPE (BraseroStatusDialog, brasero_status_dialog, GTK_TYPE_MESSAGE_DIALOG);
 
+enum {
+	USER_INTERACTION,
+	LAST_SIGNAL
+};
+static guint brasero_status_dialog_signals [LAST_SIGNAL] = { 0 };
 
 static void
 brasero_status_dialog_update (BraseroStatusDialog *self,
@@ -187,29 +192,39 @@ brasero_status_dialog_deep_directory_cb (BraseroTrackDataCfg *project,
 	gint answer;
 	gchar *string;
 	GtkWidget *message;
+	GtkWindow *transient_win;
 	BraseroStatusDialogPrivate *priv;
 
 	priv = BRASERO_STATUS_DIALOG_PRIVATE (dialog);
 
-	if (priv->accept_2G_files)
+	if (priv->accept_deep_files)
 		return TRUE;
 
-	if (priv->reject_2G_files)
+	if (priv->reject_deep_files)
 		return FALSE;
 
+	g_signal_emit (dialog,
+	               brasero_status_dialog_signals [USER_INTERACTION],
+	               0);
+
 	gtk_widget_hide (GTK_WIDGET (dialog));
 
 	string = g_strdup_printf (_("Do you really want to add \"%s\" to the selection?"), name);
-	message = gtk_message_dialog_new (GTK_WINDOW (dialog),
-					  GTK_DIALOG_DESTROY_WITH_PARENT|
+	transient_win = gtk_window_get_transient_for (GTK_WINDOW (dialog));
+	message = gtk_message_dialog_new (transient_win,
+	                                  GTK_DIALOG_DESTROY_WITH_PARENT|
 					  GTK_DIALOG_MODAL,
 					  GTK_MESSAGE_WARNING,
 					  GTK_BUTTONS_NONE,
 					  string);
 	g_free (string);
 
-	gtk_window_set_icon_name (GTK_WINDOW (message),
-	                          gtk_window_get_icon_name (GTK_WINDOW (dialog)));
+	if (gtk_window_get_icon_name (GTK_WINDOW (dialog)))
+		gtk_window_set_icon_name (GTK_WINDOW (message),
+					  gtk_window_get_icon_name (GTK_WINDOW (dialog)));
+	else if (transient_win)
+		gtk_window_set_icon_name (GTK_WINDOW (message),
+					  gtk_window_get_icon_name (transient_win));
 
 	gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (message),
 						  _("The children of this directory will have 7 parent directories."
@@ -224,8 +239,8 @@ brasero_status_dialog_deep_directory_cb (BraseroTrackDataCfg *project,
 
 	gtk_widget_show (GTK_WIDGET (dialog));
 
-	priv->accept_2G_files = (answer == GTK_RESPONSE_ACCEPT);
-	priv->reject_2G_files = (answer == GTK_RESPONSE_REJECT);
+	priv->accept_deep_files = (answer == GTK_RESPONSE_ACCEPT);
+	priv->reject_deep_files = (answer == GTK_RESPONSE_REJECT);
 
 	return (answer != GTK_RESPONSE_YES && answer != GTK_RESPONSE_ACCEPT);
 }
@@ -238,30 +253,39 @@ brasero_status_dialog_2G_file_cb (BraseroTrackDataCfg *track,
 	gint answer;
 	gchar *string;
 	GtkWidget *message;
-
+	GtkWindow *transient_win;
 	BraseroStatusDialogPrivate *priv;
 
 	priv = BRASERO_STATUS_DIALOG_PRIVATE (dialog);
 
-	if (priv->accept_deep_files)
+	if (priv->accept_2G_files)
 		return TRUE;
 
-	if (priv->reject_deep_files)
+	if (priv->reject_2G_files)
 		return FALSE;
 
+	g_signal_emit (dialog,
+	               brasero_status_dialog_signals [USER_INTERACTION],
+	               0);
+
 	gtk_widget_hide (GTK_WIDGET (dialog));
 
 	string = g_strdup_printf (_("Do you really want to add \"%s\" to the selection and use the third version of the ISO9660 standard to support it?"), name);
-	message = gtk_message_dialog_new (GTK_WINDOW (dialog),
-					  GTK_DIALOG_DESTROY_WITH_PARENT|
+	transient_win = gtk_window_get_transient_for (GTK_WINDOW (dialog));
+	message = gtk_message_dialog_new (transient_win,
+	                                  GTK_DIALOG_DESTROY_WITH_PARENT|
 					  GTK_DIALOG_MODAL,
 					  GTK_MESSAGE_WARNING,
 					  GTK_BUTTONS_NONE,
 					  string);
 	g_free (string);
 
-	gtk_window_set_icon_name (GTK_WINDOW (message),
-	                          gtk_window_get_icon_name (GTK_WINDOW (dialog)));
+	if (gtk_window_get_icon_name (GTK_WINDOW (dialog)))
+		gtk_window_set_icon_name (GTK_WINDOW (message),
+					  gtk_window_get_icon_name (GTK_WINDOW (dialog)));
+	else if (transient_win)
+		gtk_window_set_icon_name (GTK_WINDOW (message),
+					  gtk_window_get_icon_name (transient_win));
 
 	gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (message),
 						  _("The size of the file is over 2 GiB. Files larger than 2 GiB are not supported by the ISO9660 standard in its first and second versions (the most widespread ones)."
@@ -276,8 +300,8 @@ brasero_status_dialog_2G_file_cb (BraseroTrackDataCfg *track,
 
 	gtk_widget_show (GTK_WIDGET (dialog));
 
-	priv->accept_deep_files = (answer == GTK_RESPONSE_ACCEPT);
-	priv->reject_deep_files = (answer == GTK_RESPONSE_REJECT);
+	priv->accept_2G_files = (answer == GTK_RESPONSE_ACCEPT);
+	priv->reject_2G_files = (answer == GTK_RESPONSE_REJECT);
 
 	return (answer != GTK_RESPONSE_YES && answer != GTK_RESPONSE_ACCEPT);
 }
@@ -287,20 +311,30 @@ brasero_status_dialog_joliet_rename_cb (BraseroTrackData *track,
 					BraseroStatusDialog *dialog)
 {
 	GtkResponseType answer;
+	GtkWindow *transient_win;
 	GtkWidget *message;
 	gchar *secondary;
 
+	g_signal_emit (dialog,
+	               brasero_status_dialog_signals [USER_INTERACTION],
+	               0);
+
 	gtk_widget_hide (GTK_WIDGET (dialog));
 
-	message = gtk_message_dialog_new (GTK_WINDOW (dialog),
+	transient_win = gtk_window_get_transient_for (GTK_WINDOW (dialog));
+	message = gtk_message_dialog_new (transient_win,
 					  GTK_DIALOG_DESTROY_WITH_PARENT|
 					  GTK_DIALOG_MODAL,
 					  GTK_MESSAGE_WARNING,
 					  GTK_BUTTONS_NONE,
 					  _("Should files be renamed to be fully Windows-compatible?"));
 
-	gtk_window_set_icon_name (GTK_WINDOW (message),
-	                          gtk_window_get_icon_name (GTK_WINDOW (dialog)));
+	if (gtk_window_get_icon_name (GTK_WINDOW (dialog)))
+		gtk_window_set_icon_name (GTK_WINDOW (message),
+					  gtk_window_get_icon_name (GTK_WINDOW (dialog)));
+	else if (transient_win)
+		gtk_window_set_icon_name (GTK_WINDOW (message),
+					  gtk_window_get_icon_name (transient_win));
 
 	secondary = g_strdup_printf ("%s\n%s",
 				     _("Some files don't have a suitable name for a fully Windows-compatible CD."),
@@ -508,6 +542,17 @@ brasero_status_dialog_class_init (BraseroStatusDialogClass *klass)
 							      "The session to work with",
 							      BRASERO_TYPE_BURN_SESSION,
 							      G_PARAM_READWRITE|G_PARAM_CONSTRUCT_ONLY));
+
+	brasero_status_dialog_signals [USER_INTERACTION] =
+	    g_signal_new ("user_interaction",
+			  BRASERO_TYPE_STATUS_DIALOG,
+			  G_SIGNAL_RUN_LAST|G_SIGNAL_ACTION|G_SIGNAL_NO_RECURSE,
+			  0,
+			  NULL,
+			  NULL,
+			  g_cclosure_marshal_VOID__VOID,
+			  G_TYPE_NONE,
+			  0);
 }
 
 GtkWidget *



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