Commit 17700611 authored by Philippe Rouquier's avatar Philippe Rouquier

Fix #581532 - Image Burning Setup dialog needs counter (second part)

This change introduces a second button in the option dialogs to burn "Several Copies".
parent 0f8e8f9c
......@@ -1831,7 +1831,7 @@ brasero_burn_dialog_notify_copy_finished (BraseroBurnDialog *dialog,
if (!GTK_WIDGET_VISIBLE (dialog))
gtk_widget_show (GTK_WIDGET (dialog));
main_message = g_strdup_printf (_("Copy #%i has been burned successfully."), ++ priv->num_copies);
main_message = g_strdup_printf (_("Copy #%i has been burned successfully."), priv->num_copies ++);
message = brasero_burn_dialog_create_message (dialog,
GTK_MESSAGE_INFO,
GTK_BUTTONS_CANCEL,
......@@ -1902,8 +1902,8 @@ brasero_burn_dialog_notify_success (BraseroBurnDialog *dialog)
* - we wrote a merged session
* - we were not already asked for a series of copy */
if (!priv->num_copies
&& !brasero_burn_session_is_dest_file (priv->session)
&&!(brasero_burn_session_get_flags (priv->session) & BRASERO_BURN_FLAG_MERGE)) {
&& !brasero_burn_session_is_dest_file (priv->session)
&& !(brasero_burn_session_get_flags (priv->session) & BRASERO_BURN_FLAG_MERGE)) {
/* Useful button but it shouldn't be used for images */
make_another = gtk_dialog_add_button (GTK_DIALOG (dialog),
_("Make _More Copies"),
......@@ -2021,9 +2021,11 @@ brasero_burn_dialog_end_session (BraseroBurnDialog *dialog,
}
else if (priv->num_copies) {
retry = brasero_burn_dialog_notify_copy_finished (dialog, error);
if (!retry)
brasero_burn_dialog_notify_success (dialog);
}
else {
/* see if an image was created. If so, add it to GtkRecent */
/* see if an image was created. If so, add it to GtkRecent. */
if (brasero_burn_session_is_dest_file (priv->session)) {
GSList *tracks;
......@@ -2037,7 +2039,7 @@ brasero_burn_dialog_end_session (BraseroBurnDialog *dialog,
}
retry = brasero_burn_dialog_notify_success (dialog);
priv->num_copies = retry;
priv->num_copies = retry * 2;
}
if (priv->burn) {
......@@ -2269,18 +2271,9 @@ brasero_burn_dialog_wait_for_ready_state (BraseroBurnDialog *dialog)
return (result == BRASERO_BURN_OK);
}
/**
* brasero_burn_dialog_run:
* @dialog: a #BraseroBurnDialog
* @session: a #BraseroBurnSession
*
* Start burning the contents of @session.
*
* Return value: a #gboolean. TRUE if the operation was successfully carried out, FALSE otherwise.
**/
gboolean
brasero_burn_dialog_run (BraseroBurnDialog *dialog,
BraseroBurnSession *session)
static gboolean
brasero_burn_dialog_run_real (BraseroBurnDialog *dialog,
BraseroBurnSession *session)
{
BraseroBurnResult result;
BraseroBurnDialogPrivate *priv;
......@@ -2341,6 +2334,55 @@ brasero_burn_dialog_run (BraseroBurnDialog *dialog,
return (result == BRASERO_BURN_OK);
}
/**
* brasero_burn_dialog_run_multi:
* @dialog: a #BraseroBurnDialog
* @session: a #BraseroBurnSession
*
* Start burning the contents of @session. Once a disc is burnt, a dialog
* will be shown to the user and wait for a new insertion before starting to burn
* again.
*
* Return value: a #gboolean. TRUE if the operation was successfully carried out, FALSE otherwise.
**/
gboolean
brasero_burn_dialog_run_multi (BraseroBurnDialog *dialog,
BraseroBurnSession *session)
{
BraseroBurnResult result;
BraseroBurnDialogPrivate *priv;
priv = BRASERO_BURN_DIALOG_PRIVATE (dialog);
priv->num_copies = 1;
result = brasero_burn_dialog_run_real (dialog, session);
return (result == BRASERO_BURN_OK);
}
/**
* brasero_burn_dialog_run:
* @dialog: a #BraseroBurnDialog
* @session: a #BraseroBurnSession
*
* Start burning the contents of @session.
*
* Return value: a #gboolean. TRUE if the operation was successfully carried out, FALSE otherwise.
**/
gboolean
brasero_burn_dialog_run (BraseroBurnDialog *dialog,
BraseroBurnSession *session)
{
BraseroBurnResult result;
BraseroBurnDialogPrivate *priv;
priv = BRASERO_BURN_DIALOG_PRIVATE (dialog);
priv->num_copies = 0;
result = brasero_burn_dialog_run_real (dialog, session);
return (result == BRASERO_BURN_OK);
}
static gboolean
brasero_burn_dialog_cancel_dialog (BraseroBurnDialog *toplevel)
{
......
......@@ -62,6 +62,11 @@ GtkWidget *brasero_burn_dialog_new (void);
gboolean
brasero_burn_dialog_run (BraseroBurnDialog *dialog,
BraseroBurnSession *session);
gboolean
brasero_burn_dialog_run_multi (BraseroBurnDialog *dialog,
BraseroBurnSession *session);
gboolean
brasero_burn_dialog_cancel (BraseroBurnDialog *dialog,
gboolean force_cancellation);
......
......@@ -80,6 +80,9 @@ struct _BraseroBurnOptionsPrivate
GtkWidget *options_placeholder;
GtkWidget *button;
GtkWidget *burn;
GtkWidget *burn_multi;
guint not_ready_id;
GtkWidget *status_dialog;
......@@ -164,30 +167,6 @@ brasero_burn_options_add_options (BraseroBurnOptions *self,
gtk_widget_show (priv->options);
}
static GtkWidget *
brasero_burn_options_add_burn_button (BraseroBurnOptions *self,
const gchar *text,
const gchar *icon)
{
BraseroBurnOptionsPrivate *priv;
priv = BRASERO_BURN_OPTIONS_PRIVATE (self);
if (priv->button) {
gtk_widget_destroy (priv->button);
priv->button = NULL;
}
priv->button = gtk_dialog_add_button (GTK_DIALOG (self),
text,
GTK_RESPONSE_OK);
gtk_button_set_image (GTK_BUTTON (priv->button),
gtk_image_new_from_icon_name (icon,
GTK_ICON_SIZE_BUTTON));
return priv->button;
}
static void
brasero_burn_options_set_type_shown (BraseroBurnOptions *self,
BraseroMediaType type)
......@@ -305,6 +284,66 @@ brasero_burn_options_not_ready_dialog_shown_cb (GtkWidget *widget,
}
}
static void
brasero_burn_options_setup_buttons (BraseroBurnOptions *self)
{
BraseroBurnOptionsPrivate *priv;
BraseroTrackType *type;
gchar *label_m = "";
gchar *label;
gchar *icon;
priv = BRASERO_BURN_OPTIONS_PRIVATE (self);
/* add the new widgets */
type = brasero_track_type_new ();
brasero_burn_session_get_input_type (BRASERO_BURN_SESSION (priv->session), type);
if (brasero_burn_session_is_dest_file (BRASERO_BURN_SESSION (priv->session))) {
label = _("Create _Image");
icon = "iso-image-new";
}
else if (brasero_track_type_get_has_medium (type)) {
/* Translators: This is a verb, an action */
label = _("_Copy");
icon = "media-optical-copy";
label_m = _("Make _Several Copies");
}
else {
/* Translators: This is a verb, an action */
label = _("_Burn");
icon = "media-optical-burn";
label_m = _("Burn _Several Copies");
}
if (priv->burn_multi)
gtk_button_set_label (GTK_BUTTON (priv->burn_multi), label_m);
else
priv->burn_multi = gtk_dialog_add_button (GTK_DIALOG (self),
label_m,
GTK_RESPONSE_ACCEPT);
if (brasero_burn_session_is_dest_file (BRASERO_BURN_SESSION (priv->session)))
gtk_widget_hide (priv->burn_multi);
else
gtk_widget_show (priv->burn_multi);
if (priv->burn)
gtk_button_set_label (GTK_BUTTON (priv->burn), label);
else
priv->burn = gtk_dialog_add_button (GTK_DIALOG (self),
label,
GTK_RESPONSE_OK);
gtk_button_set_image (GTK_BUTTON (priv->burn), gtk_image_new_from_icon_name (icon, GTK_ICON_SIZE_BUTTON));
gtk_widget_set_sensitive (priv->burn, priv->is_valid);
gtk_widget_set_sensitive (priv->burn_multi, priv->is_valid);
brasero_track_type_free (type);
}
static void
brasero_burn_options_update_valid (BraseroBurnOptions *self)
{
......@@ -316,7 +355,8 @@ brasero_burn_options_update_valid (BraseroBurnOptions *self)
valid = brasero_session_cfg_get_error (priv->session);
priv->is_valid = BRASERO_SESSION_IS_VALID (valid);
gtk_widget_set_sensitive (priv->button, priv->is_valid);
brasero_burn_options_setup_buttons (self);
gtk_widget_set_sensitive (priv->options, priv->is_valid);
gtk_widget_set_sensitive (priv->properties, priv->is_valid);
......@@ -559,9 +599,9 @@ static void
brasero_burn_options_build_contents (BraseroBurnOptions *object)
{
BraseroBurnOptionsPrivate *priv;
GtkWidget *content_area;
GtkWidget *selection;
GtkWidget *alignment;
GtkWidget *content_area;
gchar *string;
priv = BRASERO_BURN_OPTIONS_PRIVATE (object);
......@@ -575,15 +615,8 @@ brasero_burn_options_build_contents (BraseroBurnOptions *object)
/* Create a cancel button */
gtk_dialog_add_button (GTK_DIALOG (object),
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
/* Create a default Burn button */
priv->button = gtk_dialog_add_button (GTK_DIALOG (object),
_("_Burn"),
GTK_RESPONSE_OK);
gtk_button_set_image (GTK_BUTTON (priv->button),
gtk_image_new_from_icon_name ("media-optical-burn",
GTK_ICON_SIZE_BUTTON));
GTK_STOCK_CANCEL,
GTK_RESPONSE_CANCEL);
/* Create an upper box for sources */
priv->source_placeholder = gtk_alignment_new (0.0, 0.5, 1.0, 1.0);
......@@ -704,9 +737,6 @@ brasero_burn_options_setup_audio (BraseroBurnOptions *self)
priv->has_audio = TRUE;
gtk_window_set_title (GTK_WINDOW (self), _("Disc Burning Setup"));
brasero_burn_options_add_burn_button (self,
_("_Burn"),
"media-optical-burn");
brasero_burn_options_set_type_shown (BRASERO_BURN_OPTIONS (self),
BRASERO_MEDIA_TYPE_WRITABLE|
BRASERO_MEDIA_TYPE_FILE);
......@@ -725,9 +755,6 @@ brasero_burn_options_setup_video (BraseroBurnOptions *self)
priv->has_video = TRUE;
gtk_window_set_title (GTK_WINDOW (self), _("Disc Burning Setup"));
brasero_burn_options_add_burn_button (self,
_("_Burn"),
"media-optical-burn");
brasero_burn_options_set_type_shown (BRASERO_BURN_OPTIONS (self),
BRASERO_MEDIA_TYPE_WRITABLE|
BRASERO_MEDIA_TYPE_FILE);
......@@ -848,9 +875,6 @@ brasero_burn_options_setup_data (BraseroBurnOptions *self)
priv->has_data = TRUE;
gtk_window_set_title (GTK_WINDOW (self), _("Disc Burning Setup"));
brasero_burn_options_add_burn_button (self,
_("_Burn"),
"media-optical-burn");
brasero_burn_options_set_type_shown (BRASERO_BURN_OPTIONS (self),
BRASERO_MEDIA_TYPE_WRITABLE|
BRASERO_MEDIA_TYPE_FILE);
......@@ -869,9 +893,6 @@ brasero_burn_options_setup_image (BraseroBurnOptions *self)
priv->has_image = TRUE;
gtk_window_set_title (GTK_WINDOW (self), _("Image Burning Setup"));
brasero_burn_options_add_burn_button (self,
_("_Burn"),
"media-optical-burn");
brasero_burn_options_set_type_shown (self, BRASERO_MEDIA_TYPE_WRITABLE);
/* Image properties */
......@@ -900,9 +921,6 @@ brasero_burn_options_setup_disc (BraseroBurnOptions *self)
priv->has_disc = TRUE;
gtk_window_set_title (GTK_WINDOW (self), _("Copy CD/DVD"));
brasero_burn_options_add_burn_button (self,
_("_Copy"),
"media-optical-copy");
/* take care of source media */
source = brasero_src_selection_new (BRASERO_BURN_SESSION (priv->session));
......@@ -960,6 +978,8 @@ brasero_burn_options_setup (BraseroBurnOptions *self)
brasero_burn_options_setup_audio (self);
}
brasero_track_type_free (type);
brasero_burn_options_setup_buttons (self);
}
static void
......
......@@ -111,7 +111,7 @@ launch_brasero_on_window_session (BraseroSessionCfg *session,
GtkWidget *options,
GtkWindow *window)
{
const gchar *icon_name;
const gchar *icon_name;
GtkWidget *dialog;
GtkResponseType result;
......@@ -136,7 +136,8 @@ launch_brasero_on_window_session (BraseroSessionCfg *session,
result = gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
if (result != GTK_RESPONSE_OK)
if (result != GTK_RESPONSE_OK
&& result != GTK_RESPONSE_ACCEPT)
return;
/* now run burn dialog */
......@@ -151,8 +152,13 @@ launch_brasero_on_window_session (BraseroSessionCfg *session,
gtk_widget_show (dialog);
gtk_window_present (GTK_WINDOW (dialog));
brasero_burn_dialog_run (BRASERO_BURN_DIALOG (dialog),
BRASERO_BURN_SESSION (session));
if (result == GTK_RESPONSE_OK)
brasero_burn_dialog_run (BRASERO_BURN_DIALOG (dialog),
BRASERO_BURN_SESSION (session));
else
brasero_burn_dialog_run_multi (BRASERO_BURN_DIALOG (dialog),
BRASERO_BURN_SESSION (session));
gtk_widget_destroy (dialog);
}
......
......@@ -518,7 +518,8 @@ brasero_app_set_parent (BraseroApp *app,
gboolean
brasero_app_burn (BraseroApp *app,
BraseroBurnSession *session)
BraseroBurnSession *session,
gboolean multi)
{
gboolean success;
GtkWidget *dialog;
......@@ -533,7 +534,12 @@ brasero_app_burn (BraseroApp *app,
priv->burn_dialog = dialog;
brasero_app_set_toplevel (app, GTK_WINDOW (dialog));
success = brasero_burn_dialog_run (BRASERO_BURN_DIALOG (dialog), session);
if (!multi)
success = brasero_burn_dialog_run (BRASERO_BURN_DIALOG (dialog),
BRASERO_BURN_SESSION (session));
else
success = brasero_burn_dialog_run_multi (BRASERO_BURN_DIALOG (dialog),
BRASERO_BURN_SESSION (session));
priv->burn_dialog = NULL;
/* The destruction of the dialog will bring the main window forward */
......@@ -546,17 +552,24 @@ brasero_app_burn_options (BraseroApp *app,
BraseroSessionCfg *session)
{
GtkWidget *dialog;
GtkResponseType result;
GtkResponseType answer;
dialog = brasero_burn_options_new (session);
brasero_app_set_toplevel (app, GTK_WINDOW (dialog));
gtk_window_set_icon_name (GTK_WINDOW (dialog), "brasero");
result = gtk_dialog_run (GTK_DIALOG (dialog));
answer = gtk_dialog_run (GTK_DIALOG (dialog));
/* The destruction of the dialog will bring the main window forward */
gtk_widget_destroy (dialog);
return (result == GTK_RESPONSE_OK);
if (answer == GTK_RESPONSE_OK)
return BRASERO_BURN_OK;
if (answer == GTK_RESPONSE_ACCEPT)
return BRASERO_BURN_RETRY;
return BRASERO_BURN_CANCEL;
}
static void
......@@ -602,10 +615,15 @@ brasero_app_session_burn (BraseroApp *app,
return;
}
brasero_app_burn (app, BRASERO_BURN_SESSION (session));
brasero_app_burn (app, BRASERO_BURN_SESSION (session), FALSE);
}
else {
BraseroBurnResult result;
result = brasero_app_burn_options (app, session);
if (result == BRASERO_BURN_OK || result == BRASERO_BURN_RETRY)
brasero_app_burn (app, BRASERO_BURN_SESSION (session), (result == BRASERO_BURN_RETRY));
}
else if (brasero_app_burn_options (app, session))
brasero_app_burn (app, BRASERO_BURN_SESSION (session));
}
void
......
......@@ -88,7 +88,8 @@ brasero_app_alert (BraseroApp *app,
gboolean
brasero_app_burn (BraseroApp *app,
BraseroBurnSession *session);
BraseroBurnSession *session,
gboolean multi);
gboolean
brasero_app_burn_options (BraseroApp *app,
......
......@@ -1458,7 +1458,7 @@ brasero_project_setup_session (BraseroProject *project,
}
}
static gboolean
static BraseroBurnResult
brasero_project_drive_properties (BraseroProject *project)
{
BraseroTrackType *track_type;
......@@ -1489,6 +1489,10 @@ brasero_project_drive_properties (BraseroProject *project)
NULL);
g_free (header);
gtk_dialog_add_button (GTK_DIALOG (dialog),
_("Burn _Several Copies"),
GTK_RESPONSE_ACCEPT);
button = brasero_utils_make_button (_("_Burn"),
NULL,
"media-optical-burn",
......@@ -1529,7 +1533,13 @@ brasero_project_drive_properties (BraseroProject *project)
answer = gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
return (answer == GTK_RESPONSE_OK);
if (answer == GTK_RESPONSE_OK)
return BRASERO_BURN_OK;
if (answer == GTK_RESPONSE_ACCEPT)
return BRASERO_BURN_RETRY;
return BRASERO_BURN_CANCEL;
}
static gboolean
......@@ -1547,18 +1557,14 @@ brasero_project_image_properties (BraseroProject *project)
gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog), TRUE);
gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER_ON_PARENT);
gtk_dialog_add_button (GTK_DIALOG (dialog), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
gtk_dialog_add_button (GTK_DIALOG (dialog),
GTK_STOCK_CANCEL,
GTK_RESPONSE_CANCEL);
button = brasero_utils_make_button (_("_Burn"),
NULL,
"media-optical-burn",
GTK_ICON_SIZE_BUTTON);
gtk_widget_show (button);
gtk_dialog_add_action_widget (GTK_DIALOG (dialog),
button,
GTK_RESPONSE_OK);
gtk_widget_set_can_default (button, TRUE);
button = gtk_dialog_add_button (GTK_DIALOG (dialog),
_("Create _Image"),
GTK_RESPONSE_OK);
gtk_button_set_image (GTK_BUTTON (button), gtk_image_new_from_icon_name ("iso-image-new", GTK_ICON_SIZE_BUTTON));
brasero_image_properties_set_session (BRASERO_IMAGE_PROPERTIES (dialog), project->priv->session);
......@@ -1586,13 +1592,13 @@ brasero_project_image_properties (BraseroProject *project)
answer = gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
return (answer == GTK_RESPONSE_OK);
return (answer == GTK_RESPONSE_OK) ? BRASERO_BURN_OK:BRASERO_BURN_ERR;
}
void
brasero_project_burn (BraseroProject *project)
{
gboolean res = FALSE;
BraseroBurnResult res;
BraseroDisc *current_disc;
/* Check that we are ready */
......@@ -1608,7 +1614,7 @@ brasero_project_burn (BraseroProject *project)
else
res = brasero_project_image_properties (project);
if (!res)
if (res != BRASERO_BURN_OK && res != BRASERO_BURN_RETRY)
return;
project->priv->is_burning = 1;
......@@ -1626,8 +1632,9 @@ brasero_project_burn (BraseroProject *project)
brasero_uri_container_uri_selected (BRASERO_URI_CONTAINER (project));
/* now setup the burn dialog */
if (brasero_app_burn (brasero_app_get_default (), BRASERO_BURN_SESSION (project->priv->session)))
project->priv->burnt = TRUE;
project->priv->burnt = brasero_app_burn (brasero_app_get_default (),
BRASERO_BURN_SESSION (project->priv->session),
res == BRASERO_BURN_RETRY);
/* empty the stack of temporary tracks */
while (brasero_burn_session_pop_tracks (BRASERO_BURN_SESSION (project->priv->session)) == BRASERO_BURN_RETRY);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment