brasero r1304 - in trunk: po src
- From: philippr svn gnome org
- To: svn-commits-list gnome org
- Subject: brasero r1304 - in trunk: po src
- Date: Wed, 24 Sep 2008 11:48:16 +0000 (UTC)
Author: philippr
Date: Wed Sep 24 11:48:16 2008
New Revision: 1304
URL: http://svn.gnome.org/viewvc/brasero?rev=1304&view=rev
Log:
Forgotten files
Added:
trunk/src/brasero-burn-options.c
trunk/src/brasero-burn-options.h
Modified:
trunk/po/ChangeLog
Added: trunk/src/brasero-burn-options.c
==============================================================================
--- (empty file)
+++ trunk/src/brasero-burn-options.c Wed Sep 24 11:48:16 2008
@@ -0,0 +1,465 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/*
+ * brasero
+ * Copyright (C) Philippe Rouquier 2008 <bonfire-app wanadoo fr>
+ *
+ * brasero 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 3 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#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 "burn-basics.h"
+#include "burn-session.h"
+#include "burn-caps.h"
+#include "burn-medium.h"
+
+#include "brasero-burn-options.h"
+#include "brasero-session-cfg.h"
+#include "brasero-notify.h"
+#include "brasero-dest-selection.h"
+#include "brasero-utils.h"
+#include "brasero-drive-info.h"
+
+typedef struct _BraseroBurnOptionsPrivate BraseroBurnOptionsPrivate;
+struct _BraseroBurnOptionsPrivate
+{
+ BraseroSessionCfg *session;
+
+ gulong valid_sig;
+
+ GtkWidget *source;
+ GtkWidget *message_input;
+ GtkWidget *selection;
+ GtkWidget *info;
+ GtkWidget *copies_box;
+ GtkWidget *copies_spin;
+ GtkWidget *message_output;
+ GtkWidget *options;
+ GtkWidget *button;
+};
+
+#define BRASERO_BURN_OPTIONS_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), BRASERO_TYPE_BURN_OPTIONS, BraseroBurnOptionsPrivate))
+
+
+
+G_DEFINE_TYPE (BraseroBurnOptions, brasero_burn_options, GTK_TYPE_DIALOG);
+
+void
+brasero_burn_options_add_source (BraseroBurnOptions *self,
+ const gchar *title,
+ ...)
+{
+ va_list vlist;
+ GtkWidget *child;
+ GtkWidget *source;
+ GSList *list = NULL;
+ BraseroBurnOptionsPrivate *priv;
+
+ priv = BRASERO_BURN_OPTIONS_PRIVATE (self);
+
+ priv->message_input = brasero_notify_new ();
+ list = g_slist_prepend (list, priv->message_input);
+
+ va_start (vlist, title);
+ while ((child = va_arg (vlist, GtkWidget *)))
+ list = g_slist_prepend (list, child);
+ va_end (vlist);
+
+ source = brasero_utils_pack_properties_list (title, list);
+ g_slist_free (list);
+
+ gtk_container_add (GTK_CONTAINER (priv->source), source);
+ gtk_widget_show (priv->source);
+}
+
+void
+brasero_burn_options_add_options (BraseroBurnOptions *self,
+ GtkWidget *options)
+{
+ BraseroBurnOptionsPrivate *priv;
+
+ priv = BRASERO_BURN_OPTIONS_PRIVATE (self);
+
+ gtk_container_add (GTK_CONTAINER (priv->options), options);
+ gtk_widget_show (priv->options);
+}
+
+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 = brasero_utils_make_button (text,
+ NULL,
+ icon,
+ GTK_ICON_SIZE_BUTTON);
+ gtk_widget_show (priv->button);
+ gtk_dialog_add_action_widget (GTK_DIALOG (self),
+ priv->button,
+ GTK_RESPONSE_OK);
+ return priv->button;
+}
+
+void
+brasero_burn_options_lock_selection (BraseroBurnOptions *self)
+{
+ BraseroBurnOptionsPrivate *priv;
+
+ priv = BRASERO_BURN_OPTIONS_PRIVATE (self);
+ brasero_drive_selection_lock (BRASERO_DRIVE_SELECTION (priv->selection), TRUE);
+}
+
+void
+brasero_burn_options_set_type_shown (BraseroBurnOptions *self,
+ BraseroMediaType type)
+{
+ BraseroBurnOptionsPrivate *priv;
+
+ priv = BRASERO_BURN_OPTIONS_PRIVATE (self);
+ brasero_drive_selection_set_type_shown (BRASERO_DRIVE_SELECTION (priv->selection), type);
+}
+
+BraseroBurnSession *
+brasero_burn_options_get_session (BraseroBurnOptions *self)
+{
+ BraseroBurnOptionsPrivate *priv;
+
+ priv = BRASERO_BURN_OPTIONS_PRIVATE (self);
+ g_object_ref (priv->session);
+
+ return BRASERO_BURN_SESSION (priv->session);
+}
+
+static void
+brasero_burn_options_copies_num_changed_cb (GtkSpinButton *button,
+ BraseroBurnOptions *self)
+{
+ gint numcopies;
+ BraseroBurnOptionsPrivate *priv;
+
+ priv = BRASERO_BURN_OPTIONS_PRIVATE (self);
+ numcopies = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (priv->copies_spin));
+ brasero_burn_session_set_num_copies (BRASERO_BURN_SESSION (priv->session), numcopies);
+}
+
+static void
+brasero_burn_options_message_response_cb (BraseroDiscMessage *message,
+ GtkResponseType response,
+ BraseroBurnOptions *self)
+{
+ if (response == GTK_RESPONSE_OK) {
+ BraseroBurnOptionsPrivate *priv;
+
+ priv = BRASERO_BURN_OPTIONS_PRIVATE (self);
+ brasero_session_cfg_add_flags (priv->session, BRASERO_BURN_FLAG_OVERBURN);
+ }
+}
+
+static void
+brasero_burn_options_valid_media_cb (BraseroBurnSession *session,
+ BraseroSessionError valid,
+ BraseroBurnOptions *self)
+{
+ BraseroBurnOptionsPrivate *priv;
+ gint numcopies;
+
+ priv = BRASERO_BURN_OPTIONS_PRIVATE (self);
+
+ gtk_widget_set_sensitive (priv->button, valid == BRASERO_SESSION_VALID);
+ gtk_widget_set_sensitive (priv->options, valid == BRASERO_SESSION_VALID);
+
+ if (valid != BRASERO_SESSION_VALID) {
+ gtk_widget_hide (priv->copies_box);
+ gtk_widget_hide (priv->info);
+ }
+ else if (brasero_burn_session_is_dest_file (BRASERO_BURN_SESSION (priv->session))) {
+ gchar *path;
+ BraseroDrive *burner;
+
+ brasero_burn_session_get_output (BRASERO_BURN_SESSION (priv->session),
+ &path,
+ NULL,
+ NULL);
+
+ burner = brasero_burn_session_get_burner (BRASERO_BURN_SESSION (priv->session));
+ brasero_drive_info_set_medium (BRASERO_DRIVE_INFO (priv->info),
+ brasero_drive_get_medium (burner));
+ brasero_drive_info_set_image_path (BRASERO_DRIVE_INFO (priv->info), path);
+ g_free (path);
+
+ gtk_widget_hide (priv->copies_box);
+ gtk_widget_show (priv->info);
+ }
+ else {
+ BraseroDrive *burner;
+
+ numcopies = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (priv->copies_spin));
+ brasero_burn_session_set_num_copies (BRASERO_BURN_SESSION (priv->session), numcopies);
+ gtk_widget_set_sensitive (priv->copies_box, TRUE);
+
+ burner = brasero_burn_session_get_burner (BRASERO_BURN_SESSION (priv->session));
+ brasero_drive_info_set_medium (BRASERO_DRIVE_INFO (priv->info),
+ brasero_drive_get_medium (burner));
+ brasero_drive_info_set_same_src_dest (BRASERO_DRIVE_INFO (priv->info),
+ brasero_burn_session_same_src_dest_drive (BRASERO_BURN_SESSION (priv->session)));
+
+ gtk_widget_show (priv->copies_box);
+ gtk_widget_show (priv->info);
+ }
+
+ if (priv->message_input) {
+ gtk_widget_hide (priv->message_input);
+ brasero_notify_message_remove (BRASERO_NOTIFY (priv->message_input),
+ BRASERO_NOTIFY_CONTEXT_SIZE);
+ }
+
+ brasero_notify_message_remove (BRASERO_NOTIFY (priv->message_output),
+ BRASERO_NOTIFY_CONTEXT_SIZE);
+
+ if (valid == BRASERO_SESSION_INSUFFICIENT_SPACE) {
+ GtkWidget *message;
+
+ message = brasero_notify_message_add (BRASERO_NOTIFY (priv->message_output),
+ _("Please, choose another CD or DVD or insert a new one."),
+ _("The size of the project is too large for the disc even with the overburn option."),
+ -1,
+ BRASERO_NOTIFY_CONTEXT_SIZE);
+ }
+ else if (valid == BRASERO_SESSION_NO_OUTPUT) {
+ GtkWidget *message;
+
+ message = brasero_notify_message_add (BRASERO_NOTIFY (priv->message_output),
+ _("Please, insert a recordable CD or DVD."),
+ _("There is no recordable medium inserted."),
+ -1,
+ BRASERO_NOTIFY_CONTEXT_SIZE);
+ }
+ else if (valid == BRASERO_SESSION_NO_INPUT_MEDIUM) {
+ GtkWidget *message;
+
+ if (priv->message_input) {
+ gtk_widget_show (priv->message_input);
+ message = brasero_notify_message_add (BRASERO_NOTIFY (priv->message_input),
+ _("Please, insert a disc holding data."),
+ _("There is no inserted medium to copy."),
+ -1,
+ BRASERO_NOTIFY_CONTEXT_SIZE);
+ }
+ }
+ else if (valid == BRASERO_SESSION_NO_INPUT_IMAGE) {
+ GtkWidget *message;
+
+ if (priv->message_input) {
+ gtk_widget_show (priv->message_input);
+ message = brasero_notify_message_add (BRASERO_NOTIFY (priv->message_input),
+ _("Please, select an image."),
+ _("There is no selected image."),
+ -1,
+ BRASERO_NOTIFY_CONTEXT_SIZE);
+ }
+ }
+ else if (valid == BRASERO_SESSION_NOT_SUPPORTED) {
+ GtkWidget *message;
+
+ if (priv->message_input) {
+ gtk_widget_show (priv->message_input);
+ message = brasero_notify_message_add (BRASERO_NOTIFY (priv->message_input),
+ _("Please, replace the disc with a recordable CD or DVD."),
+ _("The medium is not writable with the current set of plugins."),
+ -1,
+ BRASERO_NOTIFY_CONTEXT_SIZE);
+ }
+ }
+ else if (valid == BRASERO_SESSION_OVERBURN_NECESSARY) {
+ GtkWidget *message;
+
+ message = brasero_notify_message_add (BRASERO_NOTIFY (priv->message_output),
+ _("Would you like to burn beyond the disc reported capacity?"),
+ _("The size of the project is too large for the disc."
+ "\nNOTE: This option might cause failure."),
+ -1,
+ BRASERO_NOTIFY_CONTEXT_SIZE);
+ brasero_notify_button_add (BRASERO_NOTIFY (priv->message_output),
+ BRASERO_DISC_MESSAGE (message),
+ _("_Overburn"),
+ _("Burn beyond the disc reported capacity"),
+ GTK_RESPONSE_OK);
+
+ g_signal_connect (message,
+ "response",
+ G_CALLBACK (brasero_burn_options_message_response_cb),
+ self);
+ }
+/* else if (valid == BRASERO_SESSION_BLANKING) {
+
+ }
+ else if (valid == BRASERO_SESSION_APPENDING) {
+
+ }
+*/
+ gtk_window_resize (GTK_WINDOW (self), 10, 10);
+}
+
+static void
+brasero_burn_options_init (BraseroBurnOptions *object)
+{
+ BraseroBurnOptionsPrivate *priv;
+ GtkWidget *selection;
+ GtkWidget *button;
+ GtkWidget *label;
+ gchar *string;
+
+ priv = BRASERO_BURN_OPTIONS_PRIVATE (object);
+
+ gtk_dialog_set_has_separator (GTK_DIALOG (object), FALSE);
+
+ /* Create the session */
+ priv->session = brasero_session_cfg_new ();
+ brasero_burn_session_add_flag (BRASERO_BURN_SESSION (priv->session),
+ BRASERO_BURN_FLAG_NOGRACE|
+ BRASERO_BURN_FLAG_CHECK_SIZE|
+ BRASERO_BURN_FLAG_DONT_CLEAN_OUTPUT);
+
+ /* Create a cancel button */
+ button = gtk_button_new_from_stock (GTK_STOCK_CANCEL);
+ gtk_widget_show (button);
+ gtk_dialog_add_action_widget (GTK_DIALOG (object),
+ button,
+ GTK_RESPONSE_CANCEL);
+
+ /* Create a default Burn button */
+ priv->button = brasero_utils_make_button (_("_Burn"),
+ NULL,
+ "media-optical-burn",
+ GTK_ICON_SIZE_BUTTON);
+ gtk_widget_show (priv->button);
+ gtk_dialog_add_action_widget (GTK_DIALOG (object),
+ priv->button,
+ GTK_RESPONSE_OK);
+
+ /* Create an upper box for sources */
+ priv->source = gtk_alignment_new (0.0, 0.5, 1.0, 1.0);
+ gtk_box_pack_start (GTK_BOX (GTK_DIALOG (object)->vbox),
+ priv->source,
+ FALSE,
+ TRUE,
+ 0);
+
+ /* Medium selection box */
+ priv->selection = brasero_dest_selection_new (BRASERO_BURN_SESSION (priv->session));
+ gtk_widget_show (priv->selection);
+
+ /* Medium info */
+ priv->info = brasero_drive_info_new ();
+ gtk_widget_show (priv->info);
+
+ /* Number of copies */
+ priv->copies_box = gtk_hbox_new (FALSE, 0);
+ gtk_widget_show (priv->copies_box);
+
+ label = gtk_label_new (_("Number of copies "));
+ gtk_widget_show (label);
+ gtk_box_pack_start (GTK_BOX (priv->copies_box), label, FALSE, FALSE, 0);
+
+ priv->copies_spin = gtk_spin_button_new_with_range (1.0, 99.0, 1.0);
+ gtk_widget_show (priv->copies_spin);
+ gtk_box_pack_start (GTK_BOX (priv->copies_box), priv->copies_spin, FALSE, FALSE, 0);
+ g_signal_connect (priv->copies_spin,
+ "value-changed",
+ G_CALLBACK (brasero_burn_options_copies_num_changed_cb),
+ object);
+
+ /* Box to display warning messages */
+ priv->message_output = brasero_notify_new ();
+ gtk_widget_show (priv->message_output);
+
+ string = g_strdup_printf ("<b>%s</b>", _("Select a disc to write to"));
+ selection = brasero_utils_pack_properties (string,
+ // priv->message_output,
+ priv->copies_box,
+ priv->info,
+ priv->selection,
+ NULL);
+ g_free (string);
+ gtk_widget_show (selection);
+
+ gtk_box_pack_start (GTK_BOX (GTK_DIALOG (object)->vbox),
+ selection,
+ FALSE,
+ TRUE,
+ 0);
+
+ /* Create a lower box for options */
+ priv->options = gtk_alignment_new (0.0, 0.5, 1.0, 1.0);
+ gtk_box_pack_start (GTK_BOX (GTK_DIALOG (object)->vbox),
+ priv->options,
+ FALSE,
+ TRUE,
+ 0);
+
+ priv->valid_sig = g_signal_connect (priv->session,
+ "is-valid",
+ G_CALLBACK (brasero_burn_options_valid_media_cb),
+ object);
+}
+
+static void
+brasero_burn_options_finalize (GObject *object)
+{
+ BraseroBurnOptionsPrivate *priv;
+
+ priv = BRASERO_BURN_OPTIONS_PRIVATE (object);
+
+ if (priv->valid_sig) {
+ g_signal_handler_disconnect (priv->session,
+ priv->valid_sig);
+ priv->valid_sig = 0;
+ }
+
+ if (priv->session) {
+ g_object_unref (priv->session);
+ priv->session = NULL;
+ }
+
+ G_OBJECT_CLASS (brasero_burn_options_parent_class)->finalize (object);
+}
+
+static void
+brasero_burn_options_class_init (BraseroBurnOptionsClass *klass)
+{
+ GObjectClass* object_class = G_OBJECT_CLASS (klass);
+
+ g_type_class_add_private (klass, sizeof (BraseroBurnOptionsPrivate));
+
+ object_class->finalize = brasero_burn_options_finalize;
+}
+
+
Added: trunk/src/brasero-burn-options.h
==============================================================================
--- (empty file)
+++ trunk/src/brasero-burn-options.h Wed Sep 24 11:48:16 2008
@@ -0,0 +1,78 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/*
+ * brasero
+ * Copyright (C) Philippe Rouquier 2008 <bonfire-app wanadoo fr>
+ *
+ * brasero 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 3 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _BRASERO_BURN_OPTIONS_H_
+#define _BRASERO_BURN_OPTIONS_H_
+
+#include <glib-object.h>
+
+#include <gtk/gtk.h>
+
+#include "burn-medium-monitor.h"
+
+G_BEGIN_DECLS
+
+#define BRASERO_TYPE_BURN_OPTIONS (brasero_burn_options_get_type ())
+#define BRASERO_BURN_OPTIONS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BRASERO_TYPE_BURN_OPTIONS, BraseroBurnOptions))
+#define BRASERO_BURN_OPTIONS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BRASERO_TYPE_BURN_OPTIONS, BraseroBurnOptionsClass))
+#define BRASERO_IS_BURN_OPTIONS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BRASERO_TYPE_BURN_OPTIONS))
+#define BRASERO_IS_BURN_OPTIONS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BRASERO_TYPE_BURN_OPTIONS))
+#define BRASERO_BURN_OPTIONS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BRASERO_TYPE_BURN_OPTIONS, BraseroBurnOptionsClass))
+
+typedef struct _BraseroBurnOptionsClass BraseroBurnOptionsClass;
+typedef struct _BraseroBurnOptions BraseroBurnOptions;
+
+struct _BraseroBurnOptionsClass
+{
+ GtkDialogClass parent_class;
+};
+
+struct _BraseroBurnOptions
+{
+ GtkDialog parent_instance;
+};
+
+GType brasero_burn_options_get_type (void) G_GNUC_CONST;
+
+BraseroBurnSession *
+brasero_burn_options_get_session (BraseroBurnOptions *self);
+
+void
+brasero_burn_options_add_source (BraseroBurnOptions *self,
+ const gchar *title,
+ ...);
+
+void
+brasero_burn_options_add_options (BraseroBurnOptions *self,
+ GtkWidget *options);
+
+GtkWidget *
+brasero_burn_options_add_burn_button (BraseroBurnOptions *self,
+ const gchar *text,
+ const gchar *icon);
+void
+brasero_burn_options_lock_selection (BraseroBurnOptions *self);
+
+void
+brasero_burn_options_set_type_shown (BraseroBurnOptions *self,
+ BraseroMediaType type);
+
+G_END_DECLS
+
+#endif /* _BRASERO_BURN_OPTIONS_H_ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]