[brasero] Forgotten files
- From: Philippe Rouquier <philippr src gnome org>
- To: svn-commits-list gnome org
- Subject: [brasero] Forgotten files
- Date: Sun, 19 Apr 2009 08:07:18 -0400 (EDT)
commit 0baab2eac3ceadec72cefb05c0f20f89bdc580d8
Author: Philippe Rouquier <bonfire-app wanadoo fr>
Date: Sun Apr 19 13:59:07 2009 +0200
Forgotten files
---
libbrasero-burn/brasero-blank-dialog.c | 415 +++++++++++++++++
libbrasero-burn/brasero-status-dialog.c | 264 +++++++++++
libbrasero-burn/brasero-status.c | 143 ++++++
libbrasero-burn/brasero-sum-dialog.c | 740 +++++++++++++++++++++++++++++++
libbrasero-burn/brasero-tool-dialog.c | 587 ++++++++++++++++++++++++
libbrasero-burn/brasero-xfer.c | 438 ++++++++++++++++++
libbrasero-burn/libbrasero-marshal.c | 286 ++++++++++++
7 files changed, 2873 insertions(+), 0 deletions(-)
diff --git a/libbrasero-burn/brasero-blank-dialog.c b/libbrasero-burn/brasero-blank-dialog.c
new file mode 100644
index 0000000..0f9f6fc
--- /dev/null
+++ b/libbrasero-burn/brasero-blank-dialog.c
@@ -0,0 +1,415 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/*
+ * Libbrasero-burn
+ * Copyright (C) Philippe Rouquier 2005-2009 <bonfire-app wanadoo fr>
+ *
+ * Libbrasero-burn is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * The Libbrasero-burn authors hereby grant permission for non-GPL compatible
+ * GStreamer plugins to be used and distributed together with GStreamer
+ * and Libbrasero-burn. This permission is above and beyond the permissions granted
+ * by the GPL license by which Libbrasero-burn is covered. If you modify this code
+ * you may extend this exception to your version of the code, but you are not
+ * obligated to do so. If you do not wish to do so, delete this exception
+ * statement from your version.
+ *
+ * Libbrasero-burn is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to:
+ * The Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <glib.h>
+#include <glib/gi18n-lib.h>
+
+#include <gtk/gtk.h>
+
+#include "brasero-misc.h"
+
+#include "burn-basics.h"
+
+#include "brasero-session.h"
+#include "brasero-burn.h"
+
+#include "burn-plugin-manager.h"
+#include "brasero-tool-dialog.h"
+#include "brasero-tool-dialog-private.h"
+#include "brasero-blank-dialog.h"
+
+G_DEFINE_TYPE (BraseroBlankDialog, brasero_blank_dialog, BRASERO_TYPE_TOOL_DIALOG);
+
+struct BraseroBlankDialogPrivate {
+ BraseroBurnSession *session;
+
+ GtkWidget *fast;
+
+ guint caps_sig;
+ guint output_sig;
+
+ guint fast_saved;
+ guint dummy_saved;
+};
+typedef struct BraseroBlankDialogPrivate BraseroBlankDialogPrivate;
+
+#define BRASERO_BLANK_DIALOG_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), BRASERO_TYPE_BLANK_DIALOG, BraseroBlankDialogPrivate))
+
+static BraseroToolDialogClass *parent_class = NULL;
+
+static guint
+brasero_blank_dialog_set_button (BraseroBurnSession *session,
+ guint saved,
+ GtkWidget *button,
+ BraseroBurnFlag flag,
+ BraseroBurnFlag supported,
+ BraseroBurnFlag compulsory)
+{
+ if (flag & supported) {
+ if (compulsory & flag) {
+ if (GTK_WIDGET_SENSITIVE (button))
+ saved = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
+
+ gtk_widget_set_sensitive (button, FALSE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
+
+ brasero_burn_session_add_flag (session, flag);
+ }
+ else {
+ if (!GTK_WIDGET_SENSITIVE (button)) {
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), saved);
+
+ if (saved)
+ brasero_burn_session_add_flag (session, flag);
+ else
+ brasero_burn_session_remove_flag (session, flag);
+ }
+
+ gtk_widget_set_sensitive (button, TRUE);
+ }
+ }
+ else {
+ if (GTK_WIDGET_SENSITIVE (button))
+ saved = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
+
+ gtk_widget_set_sensitive (button, FALSE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), FALSE);
+
+ brasero_burn_session_remove_flag (session, flag);
+ }
+
+ return saved;
+}
+
+static void
+brasero_blank_dialog_device_opts_setup (BraseroBlankDialog *self)
+{
+ BraseroBurnFlag supported;
+ BraseroBurnFlag compulsory;
+ BraseroBlankDialogPrivate *priv;
+
+ priv = BRASERO_BLANK_DIALOG_PRIVATE (self);
+
+ /* set the options */
+ brasero_burn_session_get_blank_flags (priv->session,
+ &supported,
+ &compulsory);
+
+ priv->fast_saved = brasero_blank_dialog_set_button (priv->session,
+ priv->fast_saved,
+ priv->fast,
+ BRASERO_BURN_FLAG_FAST_BLANK,
+ supported,
+ compulsory);
+
+ /* This must be done afterwards, once the session flags were updated */
+ brasero_tool_dialog_set_valid (BRASERO_TOOL_DIALOG (self),
+ (brasero_burn_session_can_blank (priv->session) == BRASERO_BURN_OK));
+}
+
+static void
+brasero_blank_dialog_caps_changed (BraseroPluginManager *manager,
+ BraseroBlankDialog *dialog)
+{
+ brasero_blank_dialog_device_opts_setup (dialog);
+}
+
+static void
+brasero_blank_dialog_output_changed (BraseroBurnSession *session,
+ BraseroBlankDialog *dialog)
+{
+ brasero_blank_dialog_device_opts_setup (dialog);
+}
+
+static void
+brasero_blank_dialog_fast_toggled (GtkToggleButton *toggle,
+ BraseroBlankDialog *self)
+{
+ BraseroBlankDialogPrivate *priv;
+
+ priv = BRASERO_BLANK_DIALOG_PRIVATE (self);
+ if (gtk_toggle_button_get_active (toggle))
+ brasero_burn_session_add_flag (priv->session, BRASERO_BURN_FLAG_FAST_BLANK);
+ else
+ brasero_burn_session_remove_flag (priv->session, BRASERO_BURN_FLAG_FAST_BLANK);
+}
+
+static void
+brasero_blank_dialog_drive_changed (BraseroToolDialog *dialog,
+ BraseroMedium *medium)
+{
+ BraseroBlankDialogPrivate *priv;
+ BraseroDrive *drive;
+
+ priv = BRASERO_BLANK_DIALOG_PRIVATE (dialog);
+
+ if (medium)
+ drive = brasero_medium_get_drive (medium);
+ else
+ drive = NULL;
+
+ /* it can happen that the drive changed while initializing and that
+ * session hasn't been created yet. */
+ if (priv->session)
+ brasero_burn_session_set_burner (priv->session, drive);
+}
+
+static gboolean
+brasero_blank_dialog_activate (BraseroToolDialog *dialog,
+ BraseroMedium *medium)
+{
+ BraseroBlankDialogPrivate *priv;
+ BraseroBlankDialog *self;
+ BraseroBurnResult result;
+ GError *error = NULL;
+ BraseroBurn *burn;
+
+ self = BRASERO_BLANK_DIALOG (dialog);
+ priv = BRASERO_BLANK_DIALOG_PRIVATE (self);
+
+ burn = brasero_tool_dialog_get_burn (dialog);
+ result = brasero_burn_blank (burn,
+ priv->session,
+ &error);
+
+ /* Tell the user the result of the operation */
+ if (result == BRASERO_BURN_ERR || error) {
+ GtkResponseType answer;
+ GtkWidget *message;
+ GtkWidget *button;
+
+ message = gtk_message_dialog_new (GTK_WINDOW (self),
+ GTK_DIALOG_DESTROY_WITH_PARENT|
+ GTK_DIALOG_MODAL,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_CLOSE,
+ /* Translators: the following string
+ * means there was an error while
+ * blanking. */
+ _("Error while blanking."));
+
+ button = brasero_utils_make_button (_("Blank _Again"),
+ NULL,
+ "media-optical-blank",
+ GTK_ICON_SIZE_BUTTON);
+ gtk_widget_show (button);
+ gtk_dialog_add_action_widget (GTK_DIALOG (message),
+ button,
+ GTK_RESPONSE_OK);
+
+ if (error) {
+ gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (message),
+ "%s.",
+ error->message);
+ g_error_free (error);
+ }
+ else
+ gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (message),
+ _("Unknown error."));
+
+ answer = gtk_dialog_run (GTK_DIALOG (message));
+ gtk_widget_destroy (message);
+
+ if (answer == GTK_RESPONSE_OK) {
+ brasero_blank_dialog_device_opts_setup (self);
+ return FALSE;
+ }
+ }
+ else if (result == BRASERO_BURN_OK) {
+ GtkResponseType answer;
+ GtkWidget *message;
+ GtkWidget *button;
+
+ message = gtk_message_dialog_new (GTK_WINDOW (self),
+ GTK_DIALOG_DESTROY_WITH_PARENT|
+ GTK_DIALOG_MODAL,
+ GTK_MESSAGE_INFO,
+ GTK_BUTTONS_NONE,
+ _("The disc was successfully blanked."));
+
+ gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (message),
+ _("The disc is ready for use."));
+
+ button = brasero_utils_make_button (_("Blank _Again"),
+ NULL,
+ "media-optical-blank",
+ GTK_ICON_SIZE_BUTTON);
+ gtk_widget_show (button);
+ gtk_dialog_add_action_widget (GTK_DIALOG (message),
+ button,
+ GTK_RESPONSE_OK);
+
+ gtk_dialog_add_button (GTK_DIALOG (message),
+ GTK_STOCK_CLOSE,
+ GTK_RESPONSE_CLOSE);
+
+ answer = gtk_dialog_run (GTK_DIALOG (message));
+ gtk_widget_destroy (message);
+
+ if (answer == GTK_RESPONSE_OK) {
+ brasero_blank_dialog_device_opts_setup (self);
+ return FALSE;
+ }
+ }
+ else if (result == BRASERO_BURN_NOT_SUPPORTED) {
+ g_warning ("operation not supported");
+ }
+ else if (result == BRASERO_BURN_NOT_READY) {
+ g_warning ("operation not ready");
+ }
+ else if (result == BRASERO_BURN_NOT_RUNNING) {
+ g_warning ("job not running");
+ }
+ else if (result == BRASERO_BURN_RUNNING) {
+ g_warning ("job running");
+ }
+
+ return TRUE;
+}
+
+static void
+brasero_blank_dialog_finalize (GObject *object)
+{
+ BraseroBlankDialogPrivate *priv;
+
+ priv = BRASERO_BLANK_DIALOG_PRIVATE (object);
+
+ if (priv->caps_sig) {
+ BraseroPluginManager *manager;
+
+ manager = brasero_plugin_manager_get_default ();
+ g_signal_handler_disconnect (manager, priv->caps_sig);
+ priv->caps_sig = 0;
+ }
+
+ if (priv->output_sig) {
+ g_signal_handler_disconnect (priv->session, priv->output_sig);
+ priv->output_sig = 0;
+ }
+
+ if (priv->session) {
+ g_object_unref (priv->session);
+ priv->session = NULL;
+ }
+
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+brasero_blank_dialog_class_init (BraseroBlankDialogClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ BraseroToolDialogClass *tool_dialog_class = BRASERO_TOOL_DIALOG_CLASS (klass);
+
+ g_type_class_add_private (klass, sizeof (BraseroBlankDialogPrivate));
+
+ parent_class = g_type_class_peek_parent (klass);
+
+ object_class->finalize = brasero_blank_dialog_finalize;
+
+ tool_dialog_class->activate = brasero_blank_dialog_activate;
+ tool_dialog_class->medium_changed = brasero_blank_dialog_drive_changed;
+}
+
+static void
+brasero_blank_dialog_init (BraseroBlankDialog *obj)
+{
+ BraseroBlankDialogPrivate *priv;
+ BraseroPluginManager *manager;
+ BraseroMedium *medium;
+ BraseroDrive *drive;
+
+ priv = BRASERO_BLANK_DIALOG_PRIVATE (obj);
+
+ brasero_tool_dialog_set_button (BRASERO_TOOL_DIALOG (obj),
+ /* Translators: This is a verb, an action */
+ _("_Blank"),
+ NULL,
+ "media-optical-blank");
+
+ /* only media that can be rewritten with or without data */
+ brasero_tool_dialog_set_medium_type_shown (BRASERO_TOOL_DIALOG (obj),
+ BRASERO_MEDIA_TYPE_REWRITABLE);
+
+ medium = brasero_tool_dialog_get_medium (BRASERO_TOOL_DIALOG (obj));
+ drive = brasero_medium_get_drive (medium);
+
+ priv->session = brasero_burn_session_new ();
+ brasero_burn_session_set_flags (priv->session,
+ BRASERO_BURN_FLAG_EJECT|
+ BRASERO_BURN_FLAG_NOGRACE);
+ brasero_burn_session_set_burner (priv->session, drive);
+
+ if (medium)
+ g_object_unref (medium);
+
+ priv->output_sig = g_signal_connect (priv->session,
+ "output-changed",
+ G_CALLBACK (brasero_blank_dialog_output_changed),
+ obj);
+
+ manager = brasero_plugin_manager_get_default ();
+ priv->caps_sig = g_signal_connect (manager,
+ "caps-changed",
+ G_CALLBACK (brasero_blank_dialog_caps_changed),
+ obj);
+
+ priv->fast = gtk_check_button_new_with_mnemonic (_("_Fast blanking"));
+ gtk_widget_set_tooltip_text (priv->fast, _("Activate fast blanking by opposition to a longer thorough blanking"));
+ g_signal_connect (priv->fast,
+ "clicked",
+ G_CALLBACK (brasero_blank_dialog_fast_toggled),
+ obj);
+
+ brasero_tool_dialog_pack_options (BRASERO_TOOL_DIALOG (obj),
+ priv->fast,
+ NULL);
+
+ brasero_blank_dialog_device_opts_setup (obj);
+
+ /* if fast blank is supported check it by default */
+ if (GTK_WIDGET_IS_SENSITIVE (priv->fast))
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->fast), TRUE);
+}
+
+BraseroBlankDialog *
+brasero_blank_dialog_new ()
+{
+ BraseroBlankDialog *obj;
+
+ obj = BRASERO_BLANK_DIALOG (g_object_new (BRASERO_TYPE_BLANK_DIALOG,
+ "title", _("Disc Blanking"),
+ NULL));
+ return obj;
+}
diff --git a/libbrasero-burn/brasero-status-dialog.c b/libbrasero-burn/brasero-status-dialog.c
new file mode 100644
index 0000000..52fe517
--- /dev/null
+++ b/libbrasero-burn/brasero-status-dialog.c
@@ -0,0 +1,264 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/*
+ * Libbrasero-burn
+ * Copyright (C) Philippe Rouquier 2005-2009 <bonfire-app wanadoo fr>
+ *
+ * Libbrasero-burn is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * The Libbrasero-burn authors hereby grant permission for non-GPL compatible
+ * GStreamer plugins to be used and distributed together with GStreamer
+ * and Libbrasero-burn. This permission is above and beyond the permissions granted
+ * by the GPL license by which Libbrasero-burn is covered. If you modify this code
+ * you may extend this exception to your version of the code, but you are not
+ * obligated to do so. If you do not wish to do so, delete this exception
+ * statement from your version.
+ *
+ * Libbrasero-burn is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to:
+ * The Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <glib.h>
+#include <glib-object.h>
+#include <glib/gi18n-lib.h>
+
+#include <gtk/gtk.h>
+
+#include "brasero-units.h"
+
+#include "brasero-enums.h"
+#include "brasero-session.h"
+#include "brasero-status-dialog.h"
+
+typedef struct _BraseroStatusDialogPrivate BraseroStatusDialogPrivate;
+struct _BraseroStatusDialogPrivate
+{
+ BraseroBurnSession *session;
+ GtkWidget *progress;
+ GtkWidget *action;
+};
+
+#define BRASERO_STATUS_DIALOG_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), BRASERO_TYPE_STATUS_DIALOG, BraseroStatusDialogPrivate))
+
+G_DEFINE_TYPE (BraseroStatusDialog, brasero_status_dialog, GTK_TYPE_MESSAGE_DIALOG);
+
+
+static void
+brasero_status_dialog_update (BraseroStatusDialog *self,
+ BraseroStatus *status)
+{
+ gchar *string;
+ gchar *size_str;
+ gsize session_bytes;
+ gchar *current_action;
+ BraseroBurnResult res;
+ BraseroTrackType *type;
+ BraseroStatusDialogPrivate *priv;
+
+ priv = BRASERO_STATUS_DIALOG_PRIVATE (self);
+
+ current_action = brasero_status_get_current_action (status);
+ if (current_action) {
+ gchar *string;
+
+ string = g_strdup_printf ("<i>%s</i>", current_action);
+ gtk_label_set_markup (GTK_LABEL (priv->action), string);
+ g_free (string);
+ }
+ else
+ gtk_label_set_markup (GTK_LABEL (priv->action), "");
+
+ g_free (current_action);
+
+ if (brasero_status_get_progress (status) < 0.0)
+ gtk_progress_bar_pulse (GTK_PROGRESS_BAR (priv->progress));
+ else
+ gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (priv->progress),
+ brasero_status_get_progress (status));
+
+ res = brasero_burn_session_get_size (priv->session,
+ NULL,
+ &session_bytes);
+ if (res != BRASERO_BURN_OK)
+ return;
+
+ type = brasero_track_type_new ();
+ brasero_burn_session_get_input_type (priv->session, type);
+
+ if (brasero_track_type_get_has_stream (type))
+ size_str = brasero_units_get_time_string (session_bytes, TRUE, FALSE);
+ /* NOTE: this is perfectly fine as brasero_track_type_get_medium_type ()
+ * will return BRASERO_MEDIUM_NONE if this is not a MEDIUM track type */
+ else if (brasero_track_type_get_medium_type (type) & BRASERO_MEDIUM_HAS_AUDIO)
+ size_str = brasero_units_get_time_string (session_bytes, TRUE, FALSE);
+ else
+ size_str = g_format_size_for_display (session_bytes);
+
+ brasero_track_type_free (type);
+
+ string = g_strdup_printf (_("Project estimated size: %s"), size_str);
+ g_free (size_str);
+
+ gtk_progress_bar_set_text (GTK_PROGRESS_BAR (priv->progress), string);
+ g_free (string);
+}
+
+static gboolean
+brasero_status_dialog_wait_for_ready_state (BraseroStatusDialog *dialog)
+{
+ BraseroStatusDialogPrivate *priv;
+ BraseroBurnResult result;
+ BraseroStatus *status;
+
+ priv = BRASERO_STATUS_DIALOG_PRIVATE (dialog);
+
+ status = brasero_status_new ();
+ result = brasero_burn_session_get_status (priv->session, status);
+
+ if (result != BRASERO_BURN_NOT_READY) {
+ gtk_dialog_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
+ brasero_status_free (status);
+ return FALSE;
+ }
+
+ brasero_status_dialog_update (dialog, status);
+ brasero_status_free (status);
+
+ return TRUE;
+}
+
+BraseroBurnResult
+brasero_status_dialog_wait_for_session (BraseroStatusDialog *dialog,
+ GtkWidget *toplevel,
+ BraseroBurnSession *session)
+{
+ int id;
+ int answer;
+ BraseroStatus *status;
+ BraseroBurnResult result;
+ BraseroStatusDialogPrivate *priv;
+
+ /* Make sure we really need to run this dialog */
+ status = brasero_status_new ();
+ result = brasero_burn_session_get_status (session, status);
+
+ if (result != BRASERO_BURN_NOT_READY) {
+ brasero_status_free (status);
+ return result;
+ }
+
+ if (toplevel) {
+ gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (toplevel));
+ gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER_ON_PARENT);
+ gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
+ }
+
+ priv = BRASERO_STATUS_DIALOG_PRIVATE (dialog);
+ priv->session = g_object_ref (session);
+
+ /* we are not ready to use the track presumably because
+ * data or audio has not finished to explore a directory
+ * or get the metadata of a song or a film */
+
+ brasero_status_dialog_update (dialog, status);
+ brasero_status_free (status);
+
+ id = g_timeout_add (100,
+ (GSourceFunc) brasero_status_dialog_wait_for_ready_state,
+ dialog);
+
+ answer = gtk_dialog_run (GTK_DIALOG (dialog));
+
+ g_source_remove (id);
+
+ priv->session = NULL;
+ g_object_unref (session);
+
+ if (answer == GTK_RESPONSE_OK)
+ return BRASERO_BURN_OK;
+
+ return brasero_burn_session_get_status (session, NULL);
+}
+
+static void
+brasero_status_dialog_init (BraseroStatusDialog *object)
+{
+ BraseroStatusDialogPrivate *priv;
+ GtkWidget *main_box;
+ GtkWidget *box;
+
+ priv = BRASERO_STATUS_DIALOG_PRIVATE (object);
+
+ gtk_dialog_add_button (GTK_DIALOG (object),
+ GTK_STOCK_CANCEL,
+ GTK_RESPONSE_CANCEL);
+
+ box = gtk_vbox_new (FALSE, 4);
+ gtk_widget_show (box);
+ main_box = gtk_dialog_get_content_area (GTK_DIALOG (object));
+ gtk_box_pack_end (GTK_BOX (main_box),
+ box,
+ TRUE,
+ TRUE,
+ 0);
+
+ priv->progress = gtk_progress_bar_new ();
+ gtk_widget_show (priv->progress);
+ gtk_progress_bar_set_text (GTK_PROGRESS_BAR (priv->progress), " ");
+ gtk_box_pack_start (GTK_BOX (box),
+ priv->progress,
+ TRUE,
+ TRUE,
+ 0);
+
+ priv->action = gtk_label_new ("");
+ gtk_widget_show (priv->action);
+ gtk_label_set_use_markup (GTK_LABEL (priv->action), TRUE);
+ gtk_misc_set_alignment (GTK_MISC (priv->action), 0.0, 0.5);
+ gtk_box_pack_start (GTK_BOX (box),
+ priv->action,
+ FALSE,
+ TRUE,
+ 0);
+}
+
+static void
+brasero_status_dialog_finalize (GObject *object)
+{
+ G_OBJECT_CLASS (brasero_status_dialog_parent_class)->finalize (object);
+}
+
+static void
+brasero_status_dialog_class_init (BraseroStatusDialogClass *klass)
+{
+ GObjectClass* object_class = G_OBJECT_CLASS (klass);
+
+ g_type_class_add_private (klass, sizeof (BraseroStatusDialogPrivate));
+
+ object_class->finalize = brasero_status_dialog_finalize;
+}
+
+GtkWidget *
+brasero_status_dialog_new (void)
+{
+ return g_object_new (BRASERO_TYPE_STATUS_DIALOG,
+ "title", _("Project Size Estimation"),
+ "message-type", GTK_MESSAGE_OTHER,
+ "text", _("Please wait until the estimation of the project size is completed."),
+ "secondary-text", _("All files from the project need to be analysed to complete this operation."),
+ NULL);
+}
diff --git a/libbrasero-burn/brasero-status.c b/libbrasero-burn/brasero-status.c
new file mode 100644
index 0000000..e9c3a22
--- /dev/null
+++ b/libbrasero-burn/brasero-status.c
@@ -0,0 +1,143 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/*
+ * Libbrasero-burn
+ * Copyright (C) Philippe Rouquier 2005-2009 <bonfire-app wanadoo fr>
+ *
+ * Libbrasero-burn is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * The Libbrasero-burn authors hereby grant permission for non-GPL compatible
+ * GStreamer plugins to be used and distributed together with GStreamer
+ * and Libbrasero-burn. This permission is above and beyond the permissions granted
+ * by the GPL license by which Libbrasero-burn is covered. If you modify this code
+ * you may extend this exception to your version of the code, but you are not
+ * obligated to do so. If you do not wish to do so, delete this exception
+ * statement from your version.
+ *
+ * Libbrasero-burn is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to:
+ * The Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+
+#include "brasero-status.h"
+
+struct _BraseroStatus {
+ BraseroBurnResult res;
+
+ GError *error;
+ gdouble progress;
+ gchar *current_action;
+};
+
+BraseroStatus *
+brasero_status_new (void)
+{
+ return g_new0 (BraseroStatus, 1);
+}
+
+void
+brasero_status_free (BraseroStatus *status)
+{
+ if (status->error)
+ g_error_free (status->error);
+
+ if (status->current_action)
+ g_free (status->current_action);
+
+ g_free (status);
+}
+
+BraseroBurnResult
+brasero_status_get_result (BraseroStatus *status)
+{
+ g_return_val_if_fail (status != NULL, BRASERO_BURN_ERR);
+ return status->res;
+}
+
+gdouble
+brasero_status_get_progress (BraseroStatus *status)
+{
+ g_return_val_if_fail (status != NULL, -1.0);
+ if (status->res == BRASERO_BURN_OK)
+ return 1.0;
+
+ if (status->res != BRASERO_BURN_NOT_READY)
+ return -1.0;
+
+ return status->progress;
+}
+
+GError *
+brasero_status_get_error (BraseroStatus *status)
+{
+ g_return_val_if_fail (status != NULL, NULL);
+ if (status->res != BRASERO_BURN_ERR)
+ return NULL;
+
+ return g_error_copy (status->error);
+}
+
+gchar *
+brasero_status_get_current_action (BraseroStatus *status)
+{
+ gchar *string;
+
+ g_return_val_if_fail (status != NULL, NULL);
+ if (status->res != BRASERO_BURN_NOT_READY)
+ return NULL;
+
+ string = g_strdup (status->current_action);
+ return string;
+
+}
+
+void
+brasero_status_set_completed (BraseroStatus *status)
+{
+ g_return_if_fail (status != NULL);
+ status->res = BRASERO_BURN_OK;
+ status->progress = 1.0;
+}
+
+void
+brasero_status_set_not_ready (BraseroStatus *status,
+ gdouble progress,
+ const gchar *current_action)
+{
+ g_return_if_fail (status != NULL);
+ status->res = BRASERO_BURN_NOT_READY;
+ status->progress = progress;
+
+ if (status->current_action)
+ g_free (status->current_action);
+ status->current_action = g_strdup (current_action);
+}
+
+void
+brasero_status_set_error (BraseroStatus *status,
+ GError *error)
+{
+ g_return_if_fail (status != NULL);
+
+ status->res = BRASERO_BURN_ERR;
+ status->progress = -1.0;
+
+ if (status->error)
+ g_error_free (status->error);
+ status->error = error;
+}
+
diff --git a/libbrasero-burn/brasero-sum-dialog.c b/libbrasero-burn/brasero-sum-dialog.c
new file mode 100644
index 0000000..138e277
--- /dev/null
+++ b/libbrasero-burn/brasero-sum-dialog.c
@@ -0,0 +1,740 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/*
+ * Libbrasero-burn
+ * Copyright (C) Philippe Rouquier 2005-2009 <bonfire-app wanadoo fr>
+ *
+ * Libbrasero-burn is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * The Libbrasero-burn authors hereby grant permission for non-GPL compatible
+ * GStreamer plugins to be used and distributed together with GStreamer
+ * and Libbrasero-burn. This permission is above and beyond the permissions granted
+ * by the GPL license by which Libbrasero-burn is covered. If you modify this code
+ * you may extend this exception to your version of the code, but you are not
+ * obligated to do so. If you do not wish to do so, delete this exception
+ * statement from your version.
+ *
+ * Libbrasero-burn is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to:
+ * The Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <signal.h>
+#include <string.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <stdio.h>
+
+#include <glib.h>
+#include <glib/gstdio.h>
+#include <glib/gi18n-lib.h>
+
+#include <gtk/gtk.h>
+
+#include "brasero-sum-dialog.h"
+#include "brasero-tool-dialog.h"
+#include "brasero-tool-dialog-private.h"
+
+
+#include "brasero-misc.h"
+#include "brasero-xfer.h"
+
+#include "brasero-drive.h"
+#include "brasero-medium.h"
+#include "brasero-volume.h"
+
+#include "burn-basics.h"
+#include "burn-debug.h"
+
+#include "brasero-tags.h"
+#include "brasero-track-disc.h"
+#include "brasero-burn.h"
+
+G_DEFINE_TYPE (BraseroSumDialog, brasero_sum_dialog, BRASERO_TYPE_TOOL_DIALOG);
+
+typedef struct _BraseroSumDialogPrivate BraseroSumDialogPrivate;
+struct _BraseroSumDialogPrivate {
+ BraseroBurnSession *session;
+
+ GtkWidget *md5_chooser;
+ GtkWidget *md5_check;
+
+ BraseroXferCtx *xfer_ctx;
+ GCancellable *xfer_cancel;
+};
+
+#define BRASERO_SUM_DIALOG_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), BRASERO_TYPE_SUM_DIALOG, BraseroSumDialogPrivate))
+
+static void
+brasero_sum_dialog_md5_toggled (GtkToggleButton *button,
+ BraseroSumDialog *self)
+{
+ BraseroSumDialogPrivate *priv;
+
+ priv = BRASERO_SUM_DIALOG_PRIVATE (self);
+ gtk_widget_set_sensitive (priv->md5_chooser,
+ gtk_toggle_button_get_active (button));
+}
+
+static void
+brasero_sum_dialog_stop (BraseroSumDialog *self)
+{
+ BraseroSumDialogPrivate *priv;
+
+ priv = BRASERO_SUM_DIALOG_PRIVATE (self);
+ if (priv->xfer_cancel)
+ g_cancellable_cancel (priv->xfer_cancel);
+}
+
+static gboolean
+brasero_sum_dialog_message (BraseroSumDialog *self,
+ const gchar *primary_message,
+ const gchar *secondary_message,
+ GtkMessageType type)
+{
+ GtkWidget *button;
+ GtkWidget *message;
+ GtkResponseType answer;
+
+ brasero_tool_dialog_set_progress (BRASERO_TOOL_DIALOG (self),
+ 1.0,
+ 1.0,
+ -1,
+ -1,
+ -1);
+
+ message = gtk_message_dialog_new (GTK_WINDOW (self),
+ GTK_DIALOG_MODAL |
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ type,
+ GTK_BUTTONS_NONE,
+ "%s", primary_message);
+
+ gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (message),
+ "%s.",
+ secondary_message);
+
+ button = brasero_utils_make_button (_("Check _Again"),
+ GTK_STOCK_FIND,
+ NULL,
+ GTK_ICON_SIZE_BUTTON);
+ gtk_widget_show (button);
+ gtk_dialog_add_action_widget (GTK_DIALOG (message),
+ button,
+ GTK_RESPONSE_OK);
+
+ gtk_dialog_add_button (GTK_DIALOG (message),
+ GTK_STOCK_CLOSE,
+ GTK_RESPONSE_CLOSE);
+
+ answer = gtk_dialog_run (GTK_DIALOG (message));
+ gtk_widget_destroy (message);
+
+ if (answer == GTK_RESPONSE_OK)
+ return FALSE;
+
+ return TRUE;
+}
+
+static gboolean
+brasero_sum_dialog_message_error (BraseroSumDialog *self,
+ const GError *error)
+{
+ brasero_tool_dialog_set_action (BRASERO_TOOL_DIALOG (self),
+ BRASERO_BURN_ACTION_NONE,
+ NULL);
+
+ return brasero_sum_dialog_message (self,
+ _("The file integrity check could not be performed."),
+ error ? error->message:_("An unknown error occured"),
+ GTK_MESSAGE_ERROR);
+}
+
+static gboolean
+brasero_sum_dialog_success (BraseroSumDialog *self)
+{
+ brasero_tool_dialog_set_action (BRASERO_TOOL_DIALOG (self),
+ BRASERO_BURN_ACTION_FINISHED,
+ NULL);
+
+ return brasero_sum_dialog_message (self,
+ _("The file integrity was performed successfully."),
+ _("There seems to be no corrupted file on the disc"),
+ GTK_MESSAGE_INFO);
+}
+
+enum {
+ BRASERO_SUM_DIALOG_PATH,
+ BRASERO_SUM_DIALOG_NB_COL
+};
+
+static gboolean
+brasero_sum_dialog_corruption_warning (BraseroSumDialog *self,
+ const gchar **wrong_sums)
+{
+ GtkWidget *tree;
+ GtkWidget *scroll;
+ GtkWidget *button;
+ GtkWidget *message;
+ GtkTreeModel *model;
+ GtkResponseType answer;
+ GtkCellRenderer *renderer;
+ GtkTreeViewColumn *column;
+
+ message = gtk_message_dialog_new_with_markup (GTK_WINDOW (self),
+ GTK_DIALOG_MODAL |
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_NONE,
+ "<b><big>%s</big></b>",
+ _("The following files appear to be corrupted:"));
+
+ gtk_window_set_resizable (GTK_WINDOW (message), TRUE);
+ gtk_widget_set_size_request (GTK_WIDGET (message), 440, 300);
+
+ button = brasero_utils_make_button (_("Check _Again"),
+ GTK_STOCK_FIND,
+ NULL,
+ GTK_ICON_SIZE_BUTTON);
+ gtk_widget_show (button);
+ gtk_dialog_add_action_widget (GTK_DIALOG (message),
+ button,
+ GTK_RESPONSE_OK);
+
+ gtk_dialog_add_button (GTK_DIALOG (message),
+ GTK_STOCK_CLOSE,
+ GTK_RESPONSE_CLOSE);
+
+ /* build a list */
+ model = GTK_TREE_MODEL (gtk_list_store_new (BRASERO_SUM_DIALOG_NB_COL, G_TYPE_STRING));
+ for (; wrong_sums && (*wrong_sums); wrong_sums ++) {
+ const gchar *path;
+ GtkTreeIter tree_iter;
+
+ path = (*wrong_sums);
+ gtk_list_store_append (GTK_LIST_STORE (model), &tree_iter);
+ gtk_list_store_set (GTK_LIST_STORE (model), &tree_iter,
+ BRASERO_SUM_DIALOG_PATH, path,
+ -1);
+ }
+
+ tree = gtk_tree_view_new_with_model (model);
+ gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (tree), TRUE);
+
+ column = gtk_tree_view_column_new ();
+ renderer = gtk_cell_renderer_text_new ();
+ gtk_tree_view_column_pack_start (column, renderer, TRUE);
+ gtk_tree_view_column_add_attribute (column, renderer,
+ "text", BRASERO_SUM_DIALOG_PATH);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (tree), column);
+ gtk_tree_view_column_set_title (column, _("Corrupted Files"));
+
+ scroll = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scroll),
+ GTK_SHADOW_ETCHED_IN);
+
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll),
+ GTK_POLICY_AUTOMATIC,
+ GTK_POLICY_AUTOMATIC);
+ gtk_container_add (GTK_CONTAINER (scroll), tree);
+ gtk_box_pack_start (GTK_BOX (GTK_DIALOG (message)->vbox),
+ scroll,
+ TRUE,
+ TRUE,
+ 0);
+
+ gtk_widget_show_all (scroll);
+
+ answer = gtk_dialog_run (GTK_DIALOG (message));
+ gtk_widget_destroy (message);
+
+ if (answer == GTK_RESPONSE_OK)
+ return FALSE;
+
+ return TRUE;
+}
+
+static gboolean
+brasero_sum_dialog_progress_poll (gpointer user_data)
+{
+ BraseroSumDialogPrivate *priv;
+ BraseroSumDialog *self;
+ gdouble progress = 0.0;
+ gint64 written, total;
+
+ self = BRASERO_SUM_DIALOG (user_data);
+
+ priv = BRASERO_SUM_DIALOG_PRIVATE (self);
+
+ if (!priv->xfer_ctx)
+ return TRUE;
+
+ brasero_xfer_get_progress (priv->xfer_ctx,
+ &written,
+ &total);
+
+ progress = (gdouble) written / (gdouble) total;
+
+ brasero_tool_dialog_set_progress (BRASERO_TOOL_DIALOG (self),
+ progress,
+ -1.0,
+ -1,
+ -1,
+ -1);
+ return TRUE;
+}
+
+static BraseroBurnResult
+brasero_sum_dialog_download (BraseroSumDialog *self,
+ const gchar *src,
+ gchar **retval,
+ GError **error)
+{
+ BraseroSumDialogPrivate *priv;
+ gboolean result;
+ gchar *tmppath;
+ gint id;
+ int fd;
+
+ priv = BRASERO_SUM_DIALOG_PRIVATE (self);
+
+ /* create the temp destination */
+ tmppath = g_strdup_printf ("%s/"BRASERO_BURN_TMP_FILE_NAME,
+ g_get_tmp_dir ());
+ fd = g_mkstemp (tmppath);
+ if (fd < 0) {
+ int errnum = errno;
+
+ g_free (tmppath);
+ g_set_error (error,
+ BRASERO_BURN_ERROR,
+ BRASERO_BURN_ERROR_GENERAL,
+ "%s (%s)",
+ _("A file could not be created at the location specified for temporary files"),
+ g_strerror (errnum));
+
+ return BRASERO_BURN_ERR;
+ }
+ close (fd);
+
+ brasero_tool_dialog_set_action (BRASERO_TOOL_DIALOG (self),
+ BRASERO_BURN_ACTION_FILE_COPY,
+ _("Downloading md5 file"));
+
+ id = g_timeout_add (500,
+ brasero_sum_dialog_progress_poll,
+ self);
+
+ priv->xfer_ctx = brasero_xfer_new ();
+ priv->xfer_cancel = g_cancellable_new ();
+
+ result = brasero_xfer_wait (priv->xfer_ctx,
+ src,
+ tmppath,
+ priv->xfer_cancel,
+ error);
+
+ g_source_remove (id);
+
+ g_object_unref (priv->xfer_cancel);
+ priv->xfer_cancel = NULL;
+
+ brasero_xfer_free (priv->xfer_ctx);
+ priv->xfer_ctx = NULL;
+
+ if (!result) {
+ g_remove (tmppath);
+ g_free (tmppath);
+ return result;
+ }
+
+ *retval = tmppath;
+ return BRASERO_BURN_OK;
+}
+
+static BraseroBurnResult
+brasero_sum_dialog_get_file_checksum (BraseroSumDialog *self,
+ const gchar *file_path,
+ gchar **checksum,
+ GError **error)
+{
+ BraseroBurnResult result;
+ gchar buffer [33];
+ GFile *file_src;
+ gchar *tmppath;
+ gchar *scheme;
+ gchar *uri;
+ gchar *src;
+ FILE *file;
+ int read;
+
+ /* see if this file needs downloading */
+ file_src = g_file_new_for_commandline_arg (file_path);
+ if (!file_src) {
+ g_set_error (error,
+ BRASERO_BURN_ERROR,
+ BRASERO_BURN_ERROR_GENERAL,
+ _("\"%s\" is not a valid URI"),
+ file_path);
+ return BRASERO_BURN_ERR;
+ }
+
+ tmppath = NULL;
+ scheme = g_file_get_uri_scheme (file_src);
+ if (strcmp (scheme, "file")) {
+ uri = g_file_get_uri (file_src);
+ g_object_unref (file_src);
+
+ result = brasero_sum_dialog_download (self,
+ uri,
+ &tmppath,
+ error);
+ if (result != BRASERO_BURN_CANCEL) {
+ g_free (scheme);
+ return result;
+ }
+
+ src = tmppath;
+ }
+ else {
+ src = g_file_get_path (file_src);
+ g_object_unref (file_src);
+ }
+ g_free (scheme);
+
+ /* now get the md5 sum from the file */
+ file = fopen (src, "r");
+ if (!file) {
+ int errsv = errno;
+
+ if (tmppath)
+ g_remove (tmppath);
+
+ g_free (src);
+
+ g_set_error (error,
+ BRASERO_BURN_ERROR,
+ BRASERO_BURN_ERROR_GENERAL,
+ "%s",
+ g_strerror (errsv));
+ return BRASERO_BURN_ERR;
+ }
+
+ read = fread (buffer, 1, sizeof (buffer) - 1, file);
+ if (read)
+ buffer [read] = '\0';
+
+ if (tmppath)
+ g_remove (tmppath);
+
+ g_free (src);
+
+ if (ferror (file)) {
+ g_set_error (error,
+ BRASERO_BURN_ERROR,
+ BRASERO_BURN_ERROR_GENERAL,
+ "%s",
+ g_strerror (errno));
+
+ fclose (file);
+ return BRASERO_BURN_ERR;
+ }
+
+ fclose (file);
+
+ *checksum = strdup (buffer);
+ return BRASERO_BURN_OK;
+}
+
+static BraseroBurnResult
+brasero_sum_dialog_get_disc_checksum (BraseroSumDialog *self,
+ BraseroDrive *drive,
+ gchar *checksum,
+ GError **error)
+{
+ BraseroTrackDisc *track = NULL;
+ BraseroSumDialogPrivate *priv;
+ BraseroBurnResult result;
+ BraseroBurn *burn;
+
+ priv = BRASERO_SUM_DIALOG_PRIVATE (self);
+
+ track = brasero_track_disc_new ();
+ brasero_track_disc_set_drive (track, drive);
+ brasero_track_set_checksum (BRASERO_TRACK (track), BRASERO_CHECKSUM_MD5, checksum);
+ brasero_burn_session_add_track (priv->session, BRASERO_TRACK (track));
+
+ /* It's good practice to unref the track afterwards as we don't need it
+ * anymore. BraseroBurnSession refs it. */
+ g_object_unref (track);
+
+ burn = brasero_tool_dialog_get_burn (BRASERO_TOOL_DIALOG (self));
+ result = brasero_burn_check (burn, priv->session, error);
+
+ return result;
+}
+
+static gboolean
+brasero_sum_dialog_check_md5_file (BraseroSumDialog *self,
+ BraseroMedium *medium)
+{
+ BraseroSumDialogPrivate *priv;
+ BraseroBurnResult result;
+ gchar *file_sum = NULL;
+ GError *error = NULL;
+ gboolean retval;
+ gchar *uri;
+
+ priv = BRASERO_SUM_DIALOG_PRIVATE (self);
+
+ /* get the sum from the file */
+ uri = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (priv->md5_chooser));
+ if (!uri) {
+ retval = brasero_sum_dialog_message (self,
+ _("The file integrity check could not be performed."),
+ error ? error->message:_("No md5 file was given."),
+ GTK_MESSAGE_ERROR);
+ return retval;
+ }
+
+ result = brasero_sum_dialog_get_file_checksum (self, uri, &file_sum, &error);
+ g_free (uri);
+
+ if (result == BRASERO_BURN_CANCEL)
+ return FALSE;
+
+ if (result != BRASERO_BURN_OK) {
+ retval = brasero_sum_dialog_message_error (self, error);
+
+ if (error)
+ g_error_free (error);
+
+ return retval;
+ }
+
+ result = brasero_sum_dialog_get_disc_checksum (self,
+ brasero_medium_get_drive (medium),
+ file_sum,
+ &error);
+ if (result == BRASERO_BURN_CANCEL) {
+ g_free (file_sum);
+ return FALSE;
+ }
+
+ if (result != BRASERO_BURN_OK) {
+ g_free (file_sum);
+
+ retval = brasero_sum_dialog_message_error (self, error);
+
+ if (error)
+ g_error_free (error);
+
+ return retval;
+ }
+
+ return brasero_sum_dialog_success (self);
+}
+
+static gboolean
+brasero_sum_dialog_check_disc_sum (BraseroSumDialog *self,
+ BraseroDrive *drive)
+{
+ BraseroSumDialogPrivate *priv;
+ BraseroBurnResult result;
+ BraseroTrackDisc *track;
+ GError *error = NULL;
+ GValue *value = NULL;
+ BraseroBurn *burn;
+ gboolean retval;
+
+ priv = BRASERO_SUM_DIALOG_PRIVATE (self);
+
+ /* make track */
+ track = brasero_track_disc_new ();
+ brasero_track_disc_set_drive (track, drive);
+ brasero_track_set_checksum (BRASERO_TRACK (track), BRASERO_CHECKSUM_DETECT, NULL);
+ brasero_burn_session_add_track (priv->session, BRASERO_TRACK (track));
+
+ /* no eject at the end (it should be default) */
+ brasero_burn_session_remove_flag (priv->session, BRASERO_BURN_FLAG_EJECT);
+
+ /* It's good practice to unref the track afterwards as we don't need it
+ * anymore. BraseroBurnSession refs it. */
+ g_object_unref (track);
+
+ burn = brasero_tool_dialog_get_burn (BRASERO_TOOL_DIALOG (self));
+ result = brasero_burn_check (burn, priv->session, &error);
+
+ if (result == BRASERO_BURN_CANCEL) {
+ if (error)
+ g_error_free (error);
+
+ return FALSE;
+ }
+
+ if (result == BRASERO_BURN_OK)
+ return brasero_sum_dialog_success (self);
+
+ if (!error || error->code != BRASERO_BURN_ERROR_BAD_CHECKSUM) {
+ retval = brasero_sum_dialog_message_error (self, error);
+
+ if (error)
+ g_error_free (error);
+
+ return retval;
+ }
+
+ g_error_free (error);
+
+ brasero_track_tag_lookup (BRASERO_TRACK (track),
+ BRASERO_TRACK_MEDIUM_WRONG_CHECKSUM_TAG,
+ &value);
+
+ return brasero_sum_dialog_corruption_warning (self, g_value_get_boxed (value));
+}
+
+static gboolean
+brasero_sum_dialog_activate (BraseroToolDialog *dialog,
+ BraseroMedium *medium)
+{
+ gboolean result;
+ BraseroSumDialog *self;
+ BraseroSumDialogPrivate *priv;
+
+ self = BRASERO_SUM_DIALOG (dialog);
+ priv = BRASERO_SUM_DIALOG_PRIVATE (dialog);
+
+ if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->md5_check)))
+ result = brasero_sum_dialog_check_disc_sum (self, brasero_medium_get_drive (medium));
+ else
+ result = brasero_sum_dialog_check_md5_file (self, medium);
+
+ brasero_tool_dialog_set_valid (dialog, TRUE);
+ return result;
+}
+
+static void
+brasero_sum_dialog_drive_changed (BraseroToolDialog *dialog,
+ BraseroMedium *medium)
+{
+ if (medium)
+ brasero_tool_dialog_set_valid (dialog, BRASERO_MEDIUM_VALID (brasero_medium_get_status (medium)));
+ else
+ brasero_tool_dialog_set_valid (dialog, FALSE);
+}
+
+static void
+brasero_sum_dialog_finalize (GObject *object)
+{
+ BraseroSumDialogPrivate *priv;
+
+ priv = BRASERO_SUM_DIALOG_PRIVATE (object);
+
+ brasero_sum_dialog_stop (BRASERO_SUM_DIALOG (object));
+
+ if (priv->session) {
+ g_object_unref (priv->session);
+ priv->session = NULL;
+ }
+
+ G_OBJECT_CLASS (brasero_sum_dialog_parent_class)->finalize (object);
+}
+
+static void
+brasero_sum_dialog_class_init (BraseroSumDialogClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ BraseroToolDialogClass *tool_dialog_class = BRASERO_TOOL_DIALOG_CLASS (klass);
+
+ g_type_class_add_private (klass, sizeof (BraseroSumDialogPrivate));
+
+ brasero_sum_dialog_parent_class = g_type_class_peek_parent (klass);
+ object_class->finalize = brasero_sum_dialog_finalize;
+
+ tool_dialog_class->activate = brasero_sum_dialog_activate;
+ tool_dialog_class->medium_changed = brasero_sum_dialog_drive_changed;
+}
+
+static void
+brasero_sum_dialog_init (BraseroSumDialog *obj)
+{
+ GtkWidget *box;
+ BraseroMedium *medium;
+ BraseroSumDialogPrivate *priv;
+
+ priv = BRASERO_SUM_DIALOG_PRIVATE (obj);
+
+ priv->session = brasero_burn_session_new ();
+
+ box = gtk_vbox_new (FALSE, 6);
+
+ priv->md5_check = gtk_check_button_new_with_mnemonic (_("Use a _md5 file to check the disc"));
+ gtk_widget_set_tooltip_text (priv->md5_check, _("Use an external .md5 file that stores the checksum of a disc"));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->md5_check), FALSE);
+ g_signal_connect (priv->md5_check,
+ "toggled",
+ G_CALLBACK (brasero_sum_dialog_md5_toggled),
+ obj);
+
+ gtk_box_pack_start (GTK_BOX (box),
+ priv->md5_check,
+ TRUE,
+ TRUE,
+ 0);
+
+ priv->md5_chooser = gtk_file_chooser_button_new (_("Open a md5 file"), GTK_FILE_CHOOSER_ACTION_OPEN);
+ gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (priv->md5_chooser), FALSE);
+ gtk_widget_set_sensitive (priv->md5_chooser, FALSE);
+ gtk_box_pack_start (GTK_BOX (box),
+ priv->md5_chooser,
+ TRUE,
+ TRUE,
+ 0);
+
+ gtk_widget_show_all (box);
+ brasero_tool_dialog_pack_options (BRASERO_TOOL_DIALOG (obj),
+ box,
+ NULL);
+
+ brasero_tool_dialog_set_button (BRASERO_TOOL_DIALOG (obj),
+ _("_Check"),
+ GTK_STOCK_FIND,
+ NULL);
+
+ /* only media with data, no blank medium */
+ brasero_tool_dialog_set_medium_type_shown (BRASERO_TOOL_DIALOG (obj),
+ BRASERO_MEDIA_TYPE_AUDIO|
+ BRASERO_MEDIA_TYPE_DATA);
+
+ medium = brasero_tool_dialog_get_medium (BRASERO_TOOL_DIALOG (obj));
+ if (medium) {
+ brasero_tool_dialog_set_valid (BRASERO_TOOL_DIALOG (obj), BRASERO_MEDIUM_VALID (brasero_medium_get_status (medium)));
+ g_object_unref (medium);
+ }
+ else
+ brasero_tool_dialog_set_valid (BRASERO_TOOL_DIALOG (obj), FALSE);
+}
+
+BraseroSumDialog *
+brasero_sum_dialog_new ()
+{
+ BraseroSumDialog *obj;
+
+ obj = BRASERO_SUM_DIALOG (g_object_new (BRASERO_TYPE_SUM_DIALOG, NULL));
+ gtk_window_set_title (GTK_WINDOW (obj), _("Disc Checking"));
+
+ return obj;
+}
diff --git a/libbrasero-burn/brasero-tool-dialog.c b/libbrasero-burn/brasero-tool-dialog.c
new file mode 100644
index 0000000..7b64840
--- /dev/null
+++ b/libbrasero-burn/brasero-tool-dialog.c
@@ -0,0 +1,587 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/*
+ * Libbrasero-burn
+ * Copyright (C) Philippe Rouquier 2005-2009 <bonfire-app wanadoo fr>
+ *
+ * Libbrasero-burn is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * The Libbrasero-burn authors hereby grant permission for non-GPL compatible
+ * GStreamer plugins to be used and distributed together with GStreamer
+ * and Libbrasero-burn. This permission is above and beyond the permissions granted
+ * by the GPL license by which Libbrasero-burn is covered. If you modify this code
+ * you may extend this exception to your version of the code, but you are not
+ * obligated to do so. If you do not wish to do so, delete this exception
+ * statement from your version.
+ *
+ * Libbrasero-burn is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to:
+ * The Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <glib.h>
+#include <glib/gi18n-lib.h>
+
+#include <gtk/gtk.h>
+
+#include "brasero-progress.h"
+#include "brasero-medium-selection.h"
+#include "brasero-tool-dialog.h"
+
+#include "brasero-misc.h"
+
+#include "brasero-session.h"
+#include "brasero-burn.h"
+
+#include "brasero-medium.h"
+#include "brasero-drive.h"
+
+G_DEFINE_TYPE (BraseroToolDialog, brasero_tool_dialog, GTK_TYPE_DIALOG);
+
+typedef struct _BraseroToolDialogPrivate BraseroToolDialogPrivate;
+struct _BraseroToolDialogPrivate {
+ GtkWidget *upper_box;
+ GtkWidget *lower_box;
+ GtkWidget *selector;
+ GtkWidget *progress;
+ GtkWidget *button;
+ GtkWidget *options;
+ GtkWidget *cancel;
+
+ BraseroBurn *burn;
+
+ gboolean running;
+};
+
+#define BRASERO_TOOL_DIALOG_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), BRASERO_TYPE_TOOL_DIALOG, BraseroToolDialogPrivate))
+
+static GtkDialogClass *parent_class = NULL;
+
+static void
+brasero_tool_dialog_media_error (BraseroToolDialog *self)
+{
+ brasero_utils_message_dialog (GTK_WIDGET (self),
+ _("The operation cannot be performed."),
+ _("The disc is not supported"),
+ GTK_MESSAGE_ERROR);
+}
+
+static void
+brasero_tool_dialog_media_busy (BraseroToolDialog *self)
+{
+ gchar *string;
+
+ string = g_strdup_printf ("%s. %s",
+ _("The drive is busy"),
+ _("Make sure another application is not using it"));
+ brasero_utils_message_dialog (GTK_WIDGET (self),
+ _("The operation cannot be performed."),
+ string,
+ GTK_MESSAGE_ERROR);
+ g_free (string);
+}
+
+static void
+brasero_tool_dialog_no_media (BraseroToolDialog *self)
+{
+ brasero_utils_message_dialog (GTK_WIDGET (self),
+ _("The operation cannot be performed."),
+ _("The drive is empty"),
+ GTK_MESSAGE_ERROR);
+}
+
+void
+brasero_tool_dialog_set_progress (BraseroToolDialog *self,
+ gdouble overall_progress,
+ gdouble task_progress,
+ glong remaining,
+ gint size_mb,
+ gint written_mb)
+{
+ BraseroToolDialogPrivate *priv;
+
+ priv = BRASERO_TOOL_DIALOG_PRIVATE (self);
+ brasero_burn_progress_set_status (BRASERO_BURN_PROGRESS (priv->progress),
+ FALSE, /* no need for the media here since speed is not specified */
+ overall_progress,
+ task_progress,
+ remaining,
+ -1,
+ -1,
+ -1);
+}
+
+void
+brasero_tool_dialog_set_action (BraseroToolDialog *self,
+ BraseroBurnAction action,
+ const gchar *string)
+{
+ BraseroToolDialogPrivate *priv;
+
+ priv = BRASERO_TOOL_DIALOG_PRIVATE (self);
+ brasero_burn_progress_set_action (BRASERO_BURN_PROGRESS (priv->progress),
+ action,
+ string);
+}
+
+static void
+brasero_tool_dialog_progress_changed (BraseroBurn *burn,
+ gdouble overall_progress,
+ gdouble progress,
+ glong time_remaining,
+ BraseroToolDialog *self)
+{
+ brasero_tool_dialog_set_progress (self,
+ -1.0,
+ progress,
+ -1,
+ -1,
+ -1);
+}
+
+static void
+brasero_tool_dialog_action_changed (BraseroBurn *burn,
+ BraseroBurnAction action,
+ BraseroToolDialog *self)
+{
+ gchar *string;
+
+ brasero_burn_get_action_string (burn, action, &string);
+ brasero_tool_dialog_set_action (self,
+ action,
+ string);
+ g_free (string);
+}
+
+BraseroBurn *
+brasero_tool_dialog_get_burn (BraseroToolDialog *self)
+{
+ BraseroToolDialogPrivate *priv;
+
+ priv = BRASERO_TOOL_DIALOG_PRIVATE (self);
+
+ if (priv->burn) {
+ brasero_burn_cancel (priv->burn, FALSE);
+ g_object_unref (priv->burn);
+ }
+
+ priv->burn = brasero_burn_new ();
+ g_signal_connect (priv->burn,
+ "progress_changed",
+ G_CALLBACK (brasero_tool_dialog_progress_changed),
+ self);
+ g_signal_connect (priv->burn,
+ "action_changed",
+ G_CALLBACK (brasero_tool_dialog_action_changed),
+ self);
+
+ return priv->burn;
+}
+
+static gboolean
+brasero_tool_dialog_run (BraseroToolDialog *self)
+{
+ BraseroToolDialogPrivate *priv;
+ BraseroToolDialogClass *klass;
+ gboolean close = FALSE;
+ BraseroMedium *medium;
+ BraseroMedia media;
+ GdkCursor *cursor;
+
+ priv = BRASERO_TOOL_DIALOG_PRIVATE (self);
+ medium = brasero_medium_selection_get_active (BRASERO_MEDIUM_SELECTION (priv->selector));
+
+ /* set up */
+ gtk_widget_set_sensitive (priv->upper_box, FALSE);
+ gtk_widget_set_sensitive (priv->lower_box, TRUE);
+ gtk_widget_set_sensitive (GTK_WIDGET (priv->button), FALSE);
+
+ cursor = gdk_cursor_new (GDK_WATCH);
+ gdk_window_set_cursor (GTK_WIDGET (self)->window, cursor);
+ gdk_cursor_unref (cursor);
+
+ gtk_button_set_label (GTK_BUTTON (priv->cancel), GTK_STOCK_CANCEL);
+
+ /* check the contents of the drive */
+ media = brasero_medium_get_status (medium);
+ if (media == BRASERO_MEDIUM_NONE) {
+ brasero_tool_dialog_no_media (self);
+ gtk_widget_set_sensitive (GTK_WIDGET (priv->button), TRUE);
+ goto end;
+ }
+ else if (media == BRASERO_MEDIUM_UNSUPPORTED) {
+ /* error out */
+ gtk_widget_set_sensitive (GTK_WIDGET (priv->button), TRUE);
+ brasero_tool_dialog_media_error (self);
+ goto end;
+ }
+ else if (media == BRASERO_MEDIUM_BUSY) {
+ gtk_widget_set_sensitive (GTK_WIDGET (priv->button), TRUE);
+ brasero_tool_dialog_media_busy (self);
+ goto end;
+ }
+
+ priv->running = TRUE;
+
+ klass = BRASERO_TOOL_DIALOG_GET_CLASS (self);
+ if (klass->activate)
+ close = klass->activate (self, medium);
+
+ priv->running = FALSE;
+
+ if (medium)
+ g_object_unref (medium);
+
+ if (close)
+ return TRUE;
+
+end:
+
+ gdk_window_set_cursor (GTK_WIDGET (self)->window, NULL);
+ gtk_button_set_label (GTK_BUTTON (priv->cancel), GTK_STOCK_CLOSE);
+
+ gtk_widget_set_sensitive (priv->upper_box, TRUE);
+ gtk_widget_set_sensitive (priv->lower_box, FALSE);
+
+ brasero_burn_progress_reset (BRASERO_BURN_PROGRESS (priv->progress));
+
+ return FALSE;
+}
+
+void
+brasero_tool_dialog_pack_options (BraseroToolDialog *self,
+ ...)
+{
+ gchar *title;
+ va_list vlist;
+ GtkWidget *child;
+ GSList *list = NULL;
+ BraseroToolDialogPrivate *priv;
+
+ priv = BRASERO_TOOL_DIALOG_PRIVATE (self);
+
+ va_start (vlist, self);
+ while ((child = va_arg (vlist, GtkWidget *)))
+ list = g_slist_prepend (list, child);
+ va_end (vlist);
+
+ title = g_strdup_printf ("<b>%s</b>", _("Options"));
+ priv->options = brasero_utils_pack_properties_list (title, list);
+ g_free (title);
+
+ g_slist_free (list);
+
+ gtk_widget_show_all (priv->options);
+ gtk_box_pack_start (GTK_BOX (priv->upper_box),
+ priv->options,
+ FALSE,
+ FALSE,
+ 0);
+}
+
+void
+brasero_tool_dialog_set_button (BraseroToolDialog *self,
+ const gchar *text,
+ const gchar *image,
+ const gchar *theme)
+{
+ GtkWidget *button;
+ BraseroToolDialogPrivate *priv;
+
+ priv = BRASERO_TOOL_DIALOG_PRIVATE (self);
+
+ if (priv->button)
+ g_object_unref (priv->button);
+
+ button = brasero_utils_make_button (text,
+ image,
+ theme,
+ GTK_ICON_SIZE_BUTTON);
+ gtk_widget_show_all (button);
+ gtk_dialog_add_action_widget (GTK_DIALOG (self),
+ button,
+ GTK_RESPONSE_OK);
+
+ priv->button = button;
+}
+
+void
+brasero_tool_dialog_set_valid (BraseroToolDialog *self,
+ gboolean valid)
+{
+ BraseroToolDialogPrivate *priv;
+
+ priv = BRASERO_TOOL_DIALOG_PRIVATE (self);
+ gtk_widget_set_sensitive (priv->button, valid);
+}
+
+void
+brasero_tool_dialog_set_medium_type_shown (BraseroToolDialog *self,
+ BraseroMediaType media_type)
+{
+ BraseroToolDialogPrivate *priv;
+
+ priv = BRASERO_TOOL_DIALOG_PRIVATE (self);
+ brasero_medium_selection_show_media_type (BRASERO_MEDIUM_SELECTION (priv->selector),
+ media_type);
+}
+
+BraseroMedium *
+brasero_tool_dialog_get_medium (BraseroToolDialog *self)
+{
+ BraseroToolDialogPrivate *priv;
+
+ priv = BRASERO_TOOL_DIALOG_PRIVATE (self);
+ return brasero_medium_selection_get_active (BRASERO_MEDIUM_SELECTION (priv->selector));
+}
+
+gboolean
+brasero_tool_dialog_set_medium (BraseroToolDialog *self,
+ BraseroMedium *medium)
+{
+ BraseroToolDialogPrivate *priv;
+
+ if (!medium)
+ return FALSE;
+
+ priv = BRASERO_TOOL_DIALOG_PRIVATE (self);
+
+ return brasero_medium_selection_set_active (BRASERO_MEDIUM_SELECTION (priv->selector), medium);
+}
+
+static void
+brasero_tool_dialog_drive_changed_cb (BraseroMediumSelection *selection,
+ BraseroMedium *medium,
+ BraseroToolDialog *self)
+{
+ BraseroToolDialogClass *klass;
+
+ klass = BRASERO_TOOL_DIALOG_GET_CLASS (self);
+ if (klass->medium_changed)
+ klass->medium_changed (self, medium);
+}
+
+static gboolean
+brasero_tool_dialog_cancel_dialog (GtkWidget *toplevel)
+{
+ gint result;
+ GtkWidget *button;
+ GtkWidget *message;
+
+ message = gtk_message_dialog_new (GTK_WINDOW (toplevel),
+ GTK_DIALOG_DESTROY_WITH_PARENT|
+ GTK_DIALOG_MODAL,
+ GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_NONE,
+ _("Do you really want to quit?"));
+
+ gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (message),
+ _("Interrupting the process may make disc unusable."));
+ gtk_dialog_add_buttons (GTK_DIALOG (message),
+ GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+ NULL);
+
+ button = brasero_utils_make_button (_("_Continue"),
+ GTK_STOCK_OK,
+ NULL,
+ GTK_ICON_SIZE_BUTTON);
+ gtk_widget_show_all (button);
+ gtk_dialog_add_action_widget (GTK_DIALOG (message),
+ button, GTK_RESPONSE_OK);
+
+ result = gtk_dialog_run (GTK_DIALOG (message));
+ gtk_widget_destroy (message);
+
+ if (result != GTK_RESPONSE_OK)
+ return TRUE;
+
+ return FALSE;
+}
+
+/**
+ * returns TRUE when cancellation went well
+ * returns FALSE when it couldn't be done
+ */
+
+gboolean
+brasero_tool_dialog_cancel (BraseroToolDialog *self)
+{
+ BraseroToolDialogClass *klass;
+ BraseroToolDialogPrivate *priv;
+
+ klass = BRASERO_TOOL_DIALOG_GET_CLASS (self);
+ if (klass->cancel) {
+ gboolean res;
+
+ res = klass->cancel (self);
+ if (!res)
+ return FALSE;
+ }
+
+ priv = BRASERO_TOOL_DIALOG_PRIVATE (self);
+ if (!priv->burn)
+ return TRUE;
+
+ if (brasero_burn_cancel (priv->burn, TRUE) == BRASERO_BURN_DANGEROUS) {
+ if (!brasero_tool_dialog_cancel_dialog (GTK_WIDGET (self)))
+ return FALSE;
+
+ brasero_burn_cancel (priv->burn, FALSE);
+ }
+
+ return TRUE;
+}
+
+static gboolean
+brasero_tool_dialog_delete (GtkWidget *widget, GdkEventAny *event)
+{
+ BraseroToolDialog *self;
+
+ self = BRASERO_TOOL_DIALOG (widget);
+
+ return (brasero_tool_dialog_cancel (self) != TRUE);
+}
+
+static void
+brasero_tool_dialog_response (GtkDialog *dialog,
+ GtkResponseType response,
+ gpointer NULL_data)
+{
+ if (response == GTK_RESPONSE_CANCEL) {
+ if (!brasero_tool_dialog_cancel (BRASERO_TOOL_DIALOG (dialog)))
+ g_signal_stop_emission_by_name (dialog, "response");
+ }
+ else if (response == GTK_RESPONSE_OK) {
+ if (!brasero_tool_dialog_run (BRASERO_TOOL_DIALOG (dialog)))
+ g_signal_stop_emission_by_name (dialog, "response");
+ }
+}
+
+static void
+brasero_tool_dialog_finalize (GObject *object)
+{
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+brasero_tool_dialog_class_init (BraseroToolDialogClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+ g_type_class_add_private (klass, sizeof (BraseroToolDialogPrivate));
+
+ parent_class = g_type_class_peek_parent(klass);
+ object_class->finalize = brasero_tool_dialog_finalize;
+
+ widget_class->delete_event = brasero_tool_dialog_delete;
+}
+
+static void
+brasero_tool_dialog_init (BraseroToolDialog *obj)
+{
+ GtkWidget *title;
+ gchar *title_str;
+ BraseroToolDialogPrivate *priv;
+
+ priv = BRASERO_TOOL_DIALOG_PRIVATE (obj);
+
+ gtk_dialog_set_has_separator (GTK_DIALOG (obj), FALSE);
+
+ /* upper part */
+ priv->upper_box = gtk_vbox_new (FALSE, 0);
+ gtk_widget_show (GTK_WIDGET (priv->upper_box));
+
+ priv->selector = brasero_medium_selection_new ();
+ gtk_widget_show (GTK_WIDGET (priv->selector));
+
+ title_str = g_strdup_printf ("<b>%s</b>", _("Select a disc"));
+ gtk_box_pack_start (GTK_BOX (priv->upper_box),
+ brasero_utils_pack_properties (title_str,
+ priv->selector,
+ NULL),
+ FALSE, FALSE, 0);
+ g_free (title_str);
+
+ brasero_medium_selection_show_media_type (BRASERO_MEDIUM_SELECTION (priv->selector),
+ BRASERO_MEDIA_TYPE_REWRITABLE|
+ BRASERO_MEDIA_TYPE_WRITABLE|
+ BRASERO_MEDIA_TYPE_AUDIO|
+ BRASERO_MEDIA_TYPE_DATA);
+
+ gtk_box_pack_start (GTK_BOX (GTK_DIALOG (obj)->vbox),
+ priv->upper_box,
+ FALSE,
+ FALSE,
+ 0);
+
+ /* lower part */
+ priv->lower_box = gtk_vbox_new (FALSE, 0);
+ gtk_container_set_border_width (GTK_CONTAINER (priv->lower_box), 12);
+ gtk_widget_set_sensitive (priv->lower_box, FALSE);
+ gtk_widget_show (priv->lower_box);
+
+ title_str = g_strdup_printf ("<b>%s</b>", _("Progress"));
+ title = gtk_label_new (title_str);
+ g_free (title_str);
+
+ gtk_label_set_use_markup (GTK_LABEL (title), TRUE);
+ gtk_misc_set_alignment (GTK_MISC (title), 0.0, 0.5);
+ gtk_misc_set_padding(GTK_MISC (title), 0, 6);
+ gtk_widget_show (title);
+ gtk_box_pack_start (GTK_BOX (priv->lower_box),
+ title,
+ FALSE,
+ FALSE,
+ 0);
+
+ priv->progress = brasero_burn_progress_new ();
+ gtk_widget_show (priv->progress);
+ g_object_set (G_OBJECT (priv->progress),
+ "show-info", FALSE,
+ NULL);
+
+ gtk_box_pack_start (GTK_BOX (priv->lower_box),
+ priv->progress,
+ FALSE,
+ FALSE,
+ 0);
+
+ gtk_box_pack_start (GTK_BOX (GTK_DIALOG (obj)->vbox),
+ priv->lower_box,
+ FALSE,
+ FALSE,
+ 0);
+
+ /* buttons */
+ priv->cancel = gtk_button_new_from_stock (GTK_STOCK_CLOSE);
+ gtk_widget_show (priv->cancel);
+ gtk_dialog_add_action_widget (GTK_DIALOG (obj),
+ priv->cancel,
+ GTK_RESPONSE_CANCEL);
+
+ g_signal_connect (G_OBJECT (priv->selector),
+ "medium-changed",
+ G_CALLBACK (brasero_tool_dialog_drive_changed_cb),
+ obj);
+
+ g_signal_connect (obj,
+ "response",
+ G_CALLBACK (brasero_tool_dialog_response),
+ NULL);
+
+ gtk_window_resize (GTK_WINDOW (obj), 10, 10);
+}
diff --git a/libbrasero-burn/brasero-xfer.c b/libbrasero-burn/brasero-xfer.c
new file mode 100644
index 0000000..7ce56dc
--- /dev/null
+++ b/libbrasero-burn/brasero-xfer.c
@@ -0,0 +1,438 @@
+/***************************************************************************
+ * burn-xfer.c
+ *
+ * Sun Sep 10 08:53:22 2006
+ * Copyright 2006 philippe
+ * <philippe Rouquier Philippe.localdomain>
+ ****************************************************************************/
+
+/*
+ * Libbrasero-media is free software; you can redistribute it and/or modify
+fy
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Brasero is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301, USA
+ */
+
+#include <string.h>
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <errno.h>
+
+#include <glib.h>
+#include <glib/gi18n-lib.h>
+#include <glib/gstdio.h>
+#include <gio/gio.h>
+
+#include "brasero-xfer.h"
+#include "burn-debug.h"
+
+/* FIXME! one way to improve this would be to add auto mounting */
+struct _BraseroXferCtx {
+ goffset total_size;
+
+ goffset bytes_copied;
+ goffset current_bytes_copied;
+};
+
+static void
+brasero_xfer_progress_cb (goffset current_num_bytes,
+ goffset total_num_bytes,
+ gpointer callback_data)
+{
+ BraseroXferCtx *ctx = callback_data;
+ ctx->current_bytes_copied = current_num_bytes;
+}
+
+static gboolean
+brasero_xfer_file_transfer (BraseroXferCtx *ctx,
+ GFile *src,
+ GFile *dest,
+ GCancellable *cancel,
+ GError **error)
+{
+ gboolean result;
+ gchar *name;
+
+ name = g_file_get_basename (src);
+ BRASERO_BURN_LOG ("Downloading %s", name);
+ g_free (name);
+
+ result = g_file_copy (src,
+ dest,
+ G_FILE_COPY_ALL_METADATA,
+ cancel,
+ brasero_xfer_progress_cb,
+ ctx,
+ error);
+
+ return result;
+}
+
+static gboolean
+brasero_xfer_recursive_transfer (BraseroXferCtx *ctx,
+ GFile *src,
+ GFile *dest,
+ GCancellable *cancel,
+ GError **error)
+{
+ gboolean result;
+ GFileInfo *info;
+ GFileEnumerator *enumerator;
+
+ BRASERO_BURN_LOG ("Downloading directory contents");
+ enumerator = g_file_enumerate_children (src,
+ G_FILE_ATTRIBUTE_STANDARD_TYPE ","
+ G_FILE_ATTRIBUTE_STANDARD_NAME ","
+ G_FILE_ATTRIBUTE_STANDARD_SIZE,
+ G_FILE_QUERY_INFO_NONE, /* follow symlinks */
+ cancel,
+ error);
+ if (!enumerator)
+ return FALSE;
+
+ while ((info = g_file_enumerator_next_file (enumerator, cancel, error))) {
+ GFile *dest_child;
+ GFile *src_child;
+
+ src_child = g_file_get_child (src, g_file_info_get_name (info));
+ dest_child = g_file_get_child (dest, g_file_info_get_name (info));
+
+ if (g_file_info_get_file_type (info) == G_FILE_TYPE_DIRECTORY) {
+ gchar *path;
+
+ path = g_file_get_path (dest_child);
+ BRASERO_BURN_LOG ("Creating directory %s", path);
+
+ /* create a directory with the same name and explore it */
+ if (g_mkdir (path, S_IRWXU)) {
+ int errsv = errno;
+ g_set_error (error,
+ BRASERO_BURN_ERROR,
+ BRASERO_BURN_ERROR_GENERAL,
+ _("Directory could not be created (%s)"),
+ g_strerror (errsv));
+ result = FALSE;
+ }
+ else {
+ result = brasero_xfer_recursive_transfer (ctx,
+ src_child,
+ dest_child,
+ cancel,
+ error);
+ }
+
+ g_free (path);
+ }
+ else {
+ result = brasero_xfer_file_transfer (ctx,
+ src_child,
+ dest_child,
+ cancel,
+ error);
+ ctx->bytes_copied += g_file_info_get_size (info);
+ }
+
+ g_object_unref (info);
+ g_object_unref (src_child);
+ g_object_unref (dest_child);
+
+ if (!result)
+ break;
+
+ if (g_cancellable_is_cancelled (cancel))
+ break;
+ }
+
+ g_file_enumerator_close (enumerator, cancel, NULL);
+ g_object_unref (enumerator);
+
+ return result;
+}
+
+static gboolean
+brasero_xfer_get_download_size (BraseroXferCtx *ctx,
+ GFile *src,
+ GCancellable *cancel,
+ GError **error)
+{
+ GFileEnumerator *enumerator;
+ GFileInfo *info;
+
+ enumerator = g_file_enumerate_children (src,
+ G_FILE_ATTRIBUTE_STANDARD_TYPE ","
+ G_FILE_ATTRIBUTE_STANDARD_NAME ","
+ G_FILE_ATTRIBUTE_STANDARD_SIZE,
+ G_FILE_QUERY_INFO_NONE, /* follow symlinks */
+ cancel,
+ error);
+ if (!enumerator)
+ return FALSE;
+
+ while ((info = g_file_enumerator_next_file (enumerator, cancel, error))) {
+ if (g_file_info_get_file_type (info) == G_FILE_TYPE_DIRECTORY) {
+ GFile *child;
+
+ child = g_file_get_child (src, g_file_info_get_name (info));
+ brasero_xfer_get_download_size (ctx, child, cancel, error);
+ g_object_unref (child);
+ }
+ else
+ ctx->total_size += g_file_info_get_size (info);
+
+ g_object_unref (info);
+
+ if (g_cancellable_is_cancelled (cancel))
+ break;
+ }
+
+ g_file_enumerator_close (enumerator, cancel, NULL);
+ g_object_unref (enumerator);
+
+ return TRUE;
+}
+
+gboolean
+brasero_xfer_start (BraseroXferCtx *ctx,
+ GFile *src,
+ GFile *dest,
+ GCancellable *cancel,
+ GError **error)
+{
+ gboolean result;
+ GFileInfo *info;
+
+ bzero (ctx, sizeof (BraseroXferCtx));
+
+ /* First step: get all the total size of what we have to move */
+ info = g_file_query_info (src,
+ G_FILE_ATTRIBUTE_STANDARD_TYPE ","
+ G_FILE_ATTRIBUTE_STANDARD_SIZE,
+ G_FILE_QUERY_INFO_NONE, /* follow symlinks */
+ cancel,
+ error);
+ if (!info)
+ return FALSE;
+
+ if (g_cancellable_is_cancelled (cancel))
+ return FALSE;
+
+ /* Retrieve the size of all the data. */
+ if (g_file_info_get_file_type (info) != G_FILE_TYPE_DIRECTORY) {
+ BRASERO_BURN_LOG ("Downloading file (size = %lli)", g_file_info_get_size (info));
+ ctx->total_size = g_file_info_get_size (info);
+ }
+ else {
+ brasero_xfer_get_download_size (ctx, src, cancel, error);
+ BRASERO_BURN_LOG ("Downloading directory (size = %lli)", ctx->total_size);
+ }
+
+ ctx->bytes_copied = 0;
+
+ /* Step 2: start downloading */
+ if (g_file_info_get_file_type (info) == G_FILE_TYPE_DIRECTORY) {
+ gchar *dest_path;
+
+ dest_path = g_file_get_path (dest);
+
+ /* remove the temporary file that was created */
+ g_remove (dest_path);
+ if (g_mkdir_with_parents (dest_path, S_IRWXU)) {
+ int errsv = errno;
+
+ g_free (dest_path);
+ g_object_unref (info);
+
+ g_set_error (error,
+ BRASERO_BURN_ERROR,
+ BRASERO_BURN_ERROR_GENERAL,
+ _("Directory could not be created (%s)"),
+ g_strerror (errsv));
+ return FALSE;
+ }
+
+ BRASERO_BURN_LOG ("Created directory %s", dest_path);
+ g_free (dest_path);
+
+ result = brasero_xfer_recursive_transfer (ctx, src, dest, cancel, error);
+ }
+ else {
+ g_file_delete (dest, cancel, NULL);
+ result = brasero_xfer_file_transfer (ctx, src, dest, cancel, error);
+ ctx->bytes_copied += g_file_info_get_size (info);
+ }
+
+ g_object_unref (info);
+
+ return result;
+}
+
+typedef struct _BraseroXferThreadData BraseroXferThreadData;
+struct _BraseroXferThreadData
+{
+ BraseroXferCtx *ctx;
+
+ GFile *dest;
+ GFile *source;
+
+ GCancellable *cancel;
+
+ GMainLoop *loop;
+
+ /* These are set in the thread */
+ gboolean result;
+ GError *error;
+};
+
+static gpointer
+brasero_xfer_thread (gpointer callback_data)
+{
+ BraseroXferThreadData *data = data;
+ GError *error = NULL;
+
+ data->result = brasero_xfer_start (data->ctx,
+ data->source,
+ data->dest,
+ data->cancel,
+ &error);
+ data->error = error;
+
+ /* Stop a loop which would be waiting for us */
+ if (g_main_loop_is_running (data->loop))
+ g_main_loop_quit (data->loop);
+
+ g_thread_exit (NULL);
+
+ return NULL;
+}
+
+static void
+brasero_xfer_wait_cancelled_cb (GCancellable *cancel,
+ BraseroXferThreadData *data)
+{
+ /* Now we can safely stop the main loop */
+ if (g_main_loop_is_running (data->loop))
+ g_main_loop_quit (data->loop);
+}
+
+gboolean
+brasero_xfer_wait (BraseroXferCtx *ctx,
+ const gchar *src_uri,
+ const gchar *dest_path,
+ GCancellable *cancel,
+ GError **error)
+{
+ BraseroXferThreadData data = { NULL, };
+ gulong cancel_sig;
+ GThread *thread;
+
+ bzero (ctx, sizeof (BraseroXferCtx));
+
+ cancel_sig = g_signal_connect (cancel,
+ "cancelled",
+ G_CALLBACK (brasero_xfer_wait_cancelled_cb),
+ &data);
+
+ data.ctx = ctx;
+ data.cancel = g_object_ref (cancel);
+ data.source = g_file_new_for_uri (src_uri);
+ data.dest = g_file_new_for_path (dest_path);
+ data.loop = g_main_loop_new (NULL, FALSE);
+
+ thread = g_thread_create (brasero_xfer_thread,
+ &data,
+ TRUE,
+ error);
+ if (!thread) {
+ g_signal_handler_disconnect (cancel, cancel_sig);
+ g_object_unref (cancel);
+
+ g_main_loop_unref (data.loop);
+ g_object_unref (data.source);
+ g_object_unref (data.dest);
+ return FALSE;
+ }
+
+ g_main_loop_run (data.loop);
+
+ /* Join the thread and wait for its end.
+ * NOTE: necessary to free thread data. */
+ g_thread_join (thread);
+
+ /* clean up */
+ g_main_loop_unref (data.loop);
+ data.loop = NULL;
+
+ g_object_unref (data.source);
+ data.source = NULL;
+
+ g_object_unref (data.dest);
+ data.dest = NULL;
+
+ /* Check results */
+ g_signal_handler_disconnect (cancel, cancel_sig);
+ if (g_cancellable_is_cancelled (cancel)) {
+ g_object_unref (cancel);
+
+ if (data.error) {
+ g_error_free (data.error);
+ data.error = NULL;
+ }
+
+ return FALSE;
+ }
+
+ g_object_unref (cancel);
+
+ if (data.error) {
+ BRASERO_BURN_LOG ("Error %s", data.error->message);
+ g_propagate_error (error, data.error);
+ return FALSE;
+ }
+
+ BRASERO_BURN_LOG ("File successfully downloaded to %s", dest_path);
+
+ return data.result;
+}
+
+BraseroXferCtx *
+brasero_xfer_new (void)
+{
+ BraseroXferCtx *ctx;
+
+ ctx = g_new0 (BraseroXferCtx, 1);
+
+ return ctx;
+}
+
+void
+brasero_xfer_free (BraseroXferCtx *ctx)
+{
+ g_free (ctx);
+}
+
+gboolean
+brasero_xfer_get_progress (BraseroXferCtx *ctx,
+ goffset *written,
+ goffset *total)
+{
+ if (written)
+ *written = ctx->current_bytes_copied + ctx->bytes_copied;
+
+ if (total)
+ *total = ctx->total_size;
+
+ return TRUE;
+}
diff --git a/libbrasero-burn/libbrasero-marshal.c b/libbrasero-burn/libbrasero-marshal.c
new file mode 100644
index 0000000..77b3db5
--- /dev/null
+++ b/libbrasero-burn/libbrasero-marshal.c
@@ -0,0 +1,286 @@
+
+#ifndef __brasero_marshal_MARSHAL_H__
+#define __brasero_marshal_MARSHAL_H__
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#ifdef G_ENABLE_DEBUG
+#define g_marshal_value_peek_boolean(v) g_value_get_boolean (v)
+#define g_marshal_value_peek_char(v) g_value_get_char (v)
+#define g_marshal_value_peek_uchar(v) g_value_get_uchar (v)
+#define g_marshal_value_peek_int(v) g_value_get_int (v)
+#define g_marshal_value_peek_uint(v) g_value_get_uint (v)
+#define g_marshal_value_peek_long(v) g_value_get_long (v)
+#define g_marshal_value_peek_ulong(v) g_value_get_ulong (v)
+#define g_marshal_value_peek_int64(v) g_value_get_int64 (v)
+#define g_marshal_value_peek_uint64(v) g_value_get_uint64 (v)
+#define g_marshal_value_peek_enum(v) g_value_get_enum (v)
+#define g_marshal_value_peek_flags(v) g_value_get_flags (v)
+#define g_marshal_value_peek_float(v) g_value_get_float (v)
+#define g_marshal_value_peek_double(v) g_value_get_double (v)
+#define g_marshal_value_peek_string(v) (char*) g_value_get_string (v)
+#define g_marshal_value_peek_param(v) g_value_get_param (v)
+#define g_marshal_value_peek_boxed(v) g_value_get_boxed (v)
+#define g_marshal_value_peek_pointer(v) g_value_get_pointer (v)
+#define g_marshal_value_peek_object(v) g_value_get_object (v)
+#else /* !G_ENABLE_DEBUG */
+/* WARNING: This code accesses GValues directly, which is UNSUPPORTED API.
+ * Do not access GValues directly in your code. Instead, use the
+ * g_value_get_*() functions
+ */
+#define g_marshal_value_peek_boolean(v) (v)->data[0].v_int
+#define g_marshal_value_peek_char(v) (v)->data[0].v_int
+#define g_marshal_value_peek_uchar(v) (v)->data[0].v_uint
+#define g_marshal_value_peek_int(v) (v)->data[0].v_int
+#define g_marshal_value_peek_uint(v) (v)->data[0].v_uint
+#define g_marshal_value_peek_long(v) (v)->data[0].v_long
+#define g_marshal_value_peek_ulong(v) (v)->data[0].v_ulong
+#define g_marshal_value_peek_int64(v) (v)->data[0].v_int64
+#define g_marshal_value_peek_uint64(v) (v)->data[0].v_uint64
+#define g_marshal_value_peek_enum(v) (v)->data[0].v_long
+#define g_marshal_value_peek_flags(v) (v)->data[0].v_ulong
+#define g_marshal_value_peek_float(v) (v)->data[0].v_float
+#define g_marshal_value_peek_double(v) (v)->data[0].v_double
+#define g_marshal_value_peek_string(v) (v)->data[0].v_pointer
+#define g_marshal_value_peek_param(v) (v)->data[0].v_pointer
+#define g_marshal_value_peek_boxed(v) (v)->data[0].v_pointer
+#define g_marshal_value_peek_pointer(v) (v)->data[0].v_pointer
+#define g_marshal_value_peek_object(v) (v)->data[0].v_pointer
+#endif /* !G_ENABLE_DEBUG */
+
+
+/* INT:VOID (./libbrasero-marshal.list:1) */
+extern void brasero_marshal_INT__VOID (GClosure *closure,
+ GValue *return_value,
+ guint n_param_values,
+ const GValue *param_values,
+ gpointer invocation_hint,
+ gpointer marshal_data);
+void
+brasero_marshal_INT__VOID (GClosure *closure,
+ GValue *return_value G_GNUC_UNUSED,
+ guint n_param_values,
+ const GValue *param_values,
+ gpointer invocation_hint G_GNUC_UNUSED,
+ gpointer marshal_data)
+{
+ typedef gint (*GMarshalFunc_INT__VOID) (gpointer data1,
+ gpointer data2);
+ register GMarshalFunc_INT__VOID callback;
+ register GCClosure *cc = (GCClosure*) closure;
+ register gpointer data1, data2;
+ gint v_return;
+
+ g_return_if_fail (return_value != NULL);
+ g_return_if_fail (n_param_values == 1);
+
+ if (G_CCLOSURE_SWAP_DATA (closure))
+ {
+ data1 = closure->data;
+ data2 = g_value_peek_pointer (param_values + 0);
+ }
+ else
+ {
+ data1 = g_value_peek_pointer (param_values + 0);
+ data2 = closure->data;
+ }
+ callback = (GMarshalFunc_INT__VOID) (marshal_data ? marshal_data : cc->callback);
+
+ v_return = callback (data1,
+ data2);
+
+ g_value_set_int (return_value, v_return);
+}
+
+/* INT:INT (./libbrasero-marshal.list:2) */
+extern void brasero_marshal_INT__INT (GClosure *closure,
+ GValue *return_value,
+ guint n_param_values,
+ const GValue *param_values,
+ gpointer invocation_hint,
+ gpointer marshal_data);
+void
+brasero_marshal_INT__INT (GClosure *closure,
+ GValue *return_value G_GNUC_UNUSED,
+ guint n_param_values,
+ const GValue *param_values,
+ gpointer invocation_hint G_GNUC_UNUSED,
+ gpointer marshal_data)
+{
+ typedef gint (*GMarshalFunc_INT__INT) (gpointer data1,
+ gint arg_1,
+ gpointer data2);
+ register GMarshalFunc_INT__INT callback;
+ register GCClosure *cc = (GCClosure*) closure;
+ register gpointer data1, data2;
+ gint v_return;
+
+ g_return_if_fail (return_value != NULL);
+ g_return_if_fail (n_param_values == 2);
+
+ if (G_CCLOSURE_SWAP_DATA (closure))
+ {
+ data1 = closure->data;
+ data2 = g_value_peek_pointer (param_values + 0);
+ }
+ else
+ {
+ data1 = g_value_peek_pointer (param_values + 0);
+ data2 = closure->data;
+ }
+ callback = (GMarshalFunc_INT__INT) (marshal_data ? marshal_data : cc->callback);
+
+ v_return = callback (data1,
+ g_marshal_value_peek_int (param_values + 1),
+ data2);
+
+ g_value_set_int (return_value, v_return);
+}
+
+/* INT:OBJECT,INT,INT (./libbrasero-marshal.list:3) */
+extern void brasero_marshal_INT__OBJECT_INT_INT (GClosure *closure,
+ GValue *return_value,
+ guint n_param_values,
+ const GValue *param_values,
+ gpointer invocation_hint,
+ gpointer marshal_data);
+void
+brasero_marshal_INT__OBJECT_INT_INT (GClosure *closure,
+ GValue *return_value G_GNUC_UNUSED,
+ guint n_param_values,
+ const GValue *param_values,
+ gpointer invocation_hint G_GNUC_UNUSED,
+ gpointer marshal_data)
+{
+ typedef gint (*GMarshalFunc_INT__OBJECT_INT_INT) (gpointer data1,
+ gpointer arg_1,
+ gint arg_2,
+ gint arg_3,
+ gpointer data2);
+ register GMarshalFunc_INT__OBJECT_INT_INT callback;
+ register GCClosure *cc = (GCClosure*) closure;
+ register gpointer data1, data2;
+ gint v_return;
+
+ g_return_if_fail (return_value != NULL);
+ g_return_if_fail (n_param_values == 4);
+
+ if (G_CCLOSURE_SWAP_DATA (closure))
+ {
+ data1 = closure->data;
+ data2 = g_value_peek_pointer (param_values + 0);
+ }
+ else
+ {
+ data1 = g_value_peek_pointer (param_values + 0);
+ data2 = closure->data;
+ }
+ callback = (GMarshalFunc_INT__OBJECT_INT_INT) (marshal_data ? marshal_data : cc->callback);
+
+ v_return = callback (data1,
+ g_marshal_value_peek_object (param_values + 1),
+ g_marshal_value_peek_int (param_values + 2),
+ g_marshal_value_peek_int (param_values + 3),
+ data2);
+
+ g_value_set_int (return_value, v_return);
+}
+
+/* INT:POINTER,BOOLEAN (./libbrasero-marshal.list:4) */
+extern void brasero_marshal_INT__POINTER_BOOLEAN (GClosure *closure,
+ GValue *return_value,
+ guint n_param_values,
+ const GValue *param_values,
+ gpointer invocation_hint,
+ gpointer marshal_data);
+void
+brasero_marshal_INT__POINTER_BOOLEAN (GClosure *closure,
+ GValue *return_value G_GNUC_UNUSED,
+ guint n_param_values,
+ const GValue *param_values,
+ gpointer invocation_hint G_GNUC_UNUSED,
+ gpointer marshal_data)
+{
+ typedef gint (*GMarshalFunc_INT__POINTER_BOOLEAN) (gpointer data1,
+ gpointer arg_1,
+ gboolean arg_2,
+ gpointer data2);
+ register GMarshalFunc_INT__POINTER_BOOLEAN callback;
+ register GCClosure *cc = (GCClosure*) closure;
+ register gpointer data1, data2;
+ gint v_return;
+
+ g_return_if_fail (return_value != NULL);
+ g_return_if_fail (n_param_values == 3);
+
+ if (G_CCLOSURE_SWAP_DATA (closure))
+ {
+ data1 = closure->data;
+ data2 = g_value_peek_pointer (param_values + 0);
+ }
+ else
+ {
+ data1 = g_value_peek_pointer (param_values + 0);
+ data2 = closure->data;
+ }
+ callback = (GMarshalFunc_INT__POINTER_BOOLEAN) (marshal_data ? marshal_data : cc->callback);
+
+ v_return = callback (data1,
+ g_marshal_value_peek_pointer (param_values + 1),
+ g_marshal_value_peek_boolean (param_values + 2),
+ data2);
+
+ g_value_set_int (return_value, v_return);
+}
+
+/* VOID:DOUBLE,DOUBLE,LONG (./libbrasero-marshal.list:5) */
+extern void brasero_marshal_VOID__DOUBLE_DOUBLE_LONG (GClosure *closure,
+ GValue *return_value,
+ guint n_param_values,
+ const GValue *param_values,
+ gpointer invocation_hint,
+ gpointer marshal_data);
+void
+brasero_marshal_VOID__DOUBLE_DOUBLE_LONG (GClosure *closure,
+ GValue *return_value G_GNUC_UNUSED,
+ guint n_param_values,
+ const GValue *param_values,
+ gpointer invocation_hint G_GNUC_UNUSED,
+ gpointer marshal_data)
+{
+ typedef void (*GMarshalFunc_VOID__DOUBLE_DOUBLE_LONG) (gpointer data1,
+ gdouble arg_1,
+ gdouble arg_2,
+ glong arg_3,
+ gpointer data2);
+ register GMarshalFunc_VOID__DOUBLE_DOUBLE_LONG callback;
+ register GCClosure *cc = (GCClosure*) closure;
+ register gpointer data1, data2;
+
+ g_return_if_fail (n_param_values == 4);
+
+ if (G_CCLOSURE_SWAP_DATA (closure))
+ {
+ data1 = closure->data;
+ data2 = g_value_peek_pointer (param_values + 0);
+ }
+ else
+ {
+ data1 = g_value_peek_pointer (param_values + 0);
+ data2 = closure->data;
+ }
+ callback = (GMarshalFunc_VOID__DOUBLE_DOUBLE_LONG) (marshal_data ? marshal_data : cc->callback);
+
+ callback (data1,
+ g_marshal_value_peek_double (param_values + 1),
+ g_marshal_value_peek_double (param_values + 2),
+ g_marshal_value_peek_long (param_values + 3),
+ data2);
+}
+
+G_END_DECLS
+
+#endif /* __brasero_marshal_MARSHAL_H__ */
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]