brasero r1719 - in trunk: . brasero-media nautilus src
- From: philippr svn gnome org
- To: svn-commits-list gnome org
- Subject: brasero r1719 - in trunk: . brasero-media nautilus src
- Date: Sat, 10 Jan 2009 13:03:24 +0000 (UTC)
Author: philippr
Date: Sat Jan 10 13:03:24 2009
New Revision: 1719
URL: http://svn.gnome.org/viewvc/brasero?rev=1719&view=rev
Log:
2009-01-10 Philippe Rouquier <ykw localhost localdomain>
Patch to update library to meet sound-juicer patch requirements
Adds a library initialization function
Adds a new widget to select a BraseroDrive
Improves slightly documentation here and there
Fixes a few bugs and glitches
* brasero-media/Makefile.am:
* brasero-media/brasero-drive-selection.c
(brasero_drive_selection_class_init),
(brasero_drive_selection_set_drive_internal), (combo_changed),
(selection_update_sensitivity), (get_iter_for_drive),
(selection_append_drive), (selection_remove_drive),
(populate_model), (drive_connected_cb), (drive_disconnected_cb),
(brasero_drive_selection_init), (brasero_drive_selection_finalize),
(brasero_drive_selection_new), (repopulate_model),
(brasero_drive_selection_show_type),
(brasero_drive_selection_set_property),
(brasero_drive_selection_get_property),
(brasero_drive_selection_set_active),
(brasero_drive_selection_get_active):
* brasero-media/brasero-drive-selection.h:
* brasero-media/brasero-medium-selection.c
(brasero_medium_selection_set_active),
(brasero_medium_selection_set_device),
(brasero_medium_selection_get_active),
(brasero_medium_selection_get_device),
(brasero_medium_selection_show_media_type),
(brasero_medium_selection_get_media_num),
(brasero_medium_selection_medium_added_cb),
(brasero_medium_selection_set_property),
(brasero_medium_selection_get_property),
(brasero_medium_selection_class_init):
* brasero-media/brasero-medium-selection.h:
* brasero-media/burn-drive.h:
* brasero-media/burn-media.c (brasero_media_quark),
(brasero_media_library_start), (brasero_media_library_stop):
* brasero-media/burn-media.h:
* brasero-media/burn-medium-monitor.c
(brasero_medium_monitor_get_drives),
(brasero_medium_monitor_get_media),
(brasero_medium_monitor_inserted_cb),
(brasero_medium_monitor_removed_cb),
(brasero_medium_monitor_class_init),
(brasero_medium_monitor_get_default):
* brasero-media/burn-medium-monitor.h:
* nautilus/Makefile.am:
* src/brasero-burn-options.c (brasero_burn_options_set_type_shown),
(brasero_burn_options_update_no_medium_warning):
* src/brasero-dest-selection.c (brasero_dest_selection_init):
* src/brasero-disc-copy-dialog.c (brasero_disc_copy_dialog_init):
* src/brasero-src-selection.c (brasero_src_selection_init):
* src/brasero-sum-dialog.c (brasero_sum_dialog_init):
* src/brasero-tool-dialog.c
(brasero_tool_dialog_set_medium_type_shown),
(brasero_tool_dialog_init):
Added:
trunk/brasero-media/brasero-drive-selection.c
trunk/brasero-media/brasero-drive-selection.h
Modified:
trunk/ChangeLog
trunk/brasero-media/Makefile.am
trunk/brasero-media/brasero-medium-selection.c
trunk/brasero-media/brasero-medium-selection.h
trunk/brasero-media/burn-drive.h
trunk/brasero-media/burn-media.c
trunk/brasero-media/burn-media.h
trunk/brasero-media/burn-medium-monitor.c
trunk/brasero-media/burn-medium-monitor.h
trunk/nautilus/Makefile.am
trunk/src/brasero-burn-options.c
trunk/src/brasero-dest-selection.c
trunk/src/brasero-disc-copy-dialog.c
trunk/src/brasero-src-selection.c
trunk/src/brasero-sum-dialog.c
trunk/src/brasero-tool-dialog.c
Modified: trunk/brasero-media/Makefile.am
==============================================================================
--- trunk/brasero-media/Makefile.am (original)
+++ trunk/brasero-media/Makefile.am Sat Jan 10 13:03:24 2009
@@ -35,7 +35,8 @@
burn-units.h \
burn-medium.h \
burn-volume-obj.h \
- brasero-medium-selection.h
+ brasero-medium-selection.h \
+ brasero-drive-selection.h
libbrasero_media_la_LIBADD = \
$(BRASERO_GLIB_LIBS) \
@@ -122,7 +123,9 @@
burn-volume-obj.c \
burn-drive.c \
brasero-medium-selection.c \
- burn-units.c
+ burn-units.c \
+ brasero-drive-selection.c \
+ brasero-drive-selection.h
# FreeBSD's SCSI CAM interface
if HAVE_CAM_LIB_H
Added: trunk/brasero-media/brasero-drive-selection.c
==============================================================================
--- (empty file)
+++ trunk/brasero-media/brasero-drive-selection.c Sat Jan 10 13:03:24 2009
@@ -0,0 +1,517 @@
+/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8; tab-width: 8 -*-
+ *
+ * brasero-drive-selection.c
+ *
+ * Copyright (C) 2002-2004 Bastien Nocera <hadess hadess net>
+ * Copyright (C) 2005-2006 William Jon McCann <mccann jhu edu>
+ * Copyright (C) 2009 Philippe Rouquier <bonfire-app wanadoo fr>
+ *
+ * This program 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.
+ *
+ * This program 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Authors: Bastien Nocera <hadess hadess net>
+ * William Jon McCann <mccann jhu edu>
+ *
+ */
+
+#include "config.h"
+
+#include <string.h>
+
+#include <glib.h>
+#include <glib/gi18n.h>
+#include <gtk/gtk.h>
+
+#include "brasero-drive-selection.h"
+#include "burn-medium-monitor.h"
+
+/* Signals */
+enum {
+ DRIVE_CHANGED,
+ LAST_SIGNAL
+};
+
+/* Arguments */
+enum {
+ PROP_0,
+ PROP_DRIVE,
+ PROP_DRIVE_TYPE,
+ PROP_RECORDERS_ONLY,
+};
+
+enum {
+ DISPLAY_NAME_COLUMN,
+ DRIVE_COLUMN,
+ N_COLUMNS
+};
+
+#define BRASERO_DRIVE_SELECTION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), BRASERO_TYPE_DRIVE_SELECTION, BraseroDriveSelectionPrivate))
+
+typedef struct BraseroDriveSelectionPrivate BraseroDriveSelectionPrivate;
+
+struct BraseroDriveSelectionPrivate {
+ BraseroMediumMonitor *monitor;
+
+ BraseroDrive *selected_drive;
+ BraseroDriveType type;
+};
+
+#define BRASERO_DRIVE_SELECTION_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), BRASERO_TYPE_DRIVE_SELECTION, BraseroDriveSelectionPrivate))
+
+static void brasero_drive_selection_init (BraseroDriveSelection *selection);
+
+static void brasero_drive_selection_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static void brasero_drive_selection_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec);
+
+static void brasero_drive_selection_finalize (GObject *object);
+
+static int brasero_drive_selection_table_signals [LAST_SIGNAL] = { 0 };
+
+G_DEFINE_TYPE (BraseroDriveSelection, brasero_drive_selection, GTK_TYPE_COMBO_BOX);
+
+static void
+brasero_drive_selection_class_init (BraseroDriveSelectionClass *klass)
+{
+ GObjectClass *object_class;
+ GtkWidgetClass *widget_class;
+
+ object_class = (GObjectClass *) klass;
+ widget_class = (GtkWidgetClass *) klass;
+
+ /* GObject */
+ object_class->set_property = brasero_drive_selection_set_property;
+ object_class->get_property = brasero_drive_selection_get_property;
+ object_class->finalize = brasero_drive_selection_finalize;
+
+ g_type_class_add_private (klass, sizeof (BraseroDriveSelectionPrivate));
+
+ /* Properties */
+ g_object_class_install_property (object_class,
+ PROP_DRIVE,
+ g_param_spec_object ("drive",
+ _("Drive"),
+ NULL,
+ BRASERO_TYPE_DRIVE,
+ G_PARAM_READWRITE));
+ g_object_class_install_property (object_class, PROP_DRIVE_TYPE,
+ g_param_spec_uint ("drive-type", NULL, NULL,
+ 0, 255, BRASERO_DRIVE_TYPE_ALL_BUT_FILE,
+ G_PARAM_READWRITE));
+
+ /* Signals */
+ brasero_drive_selection_table_signals [DRIVE_CHANGED] =
+ g_signal_new ("drive-changed",
+ G_TYPE_FROM_CLASS (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (BraseroDriveSelectionClass,
+ drive_changed),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__OBJECT,
+ G_TYPE_NONE, 1,
+ BRASERO_TYPE_DRIVE);
+}
+
+static void
+brasero_drive_selection_set_drive_internal (BraseroDriveSelection *selection,
+ BraseroDrive *drive)
+{
+ BraseroDriveSelectionPrivate *priv;
+
+ priv = BRASERO_DRIVE_SELECTION_PRIVATE (selection);
+ priv->selected_drive = g_object_ref (drive);
+
+ g_signal_emit (G_OBJECT (selection),
+ brasero_drive_selection_table_signals [DRIVE_CHANGED],
+ 0, drive);
+
+ g_object_notify (G_OBJECT (selection), "drive");
+}
+
+static void
+combo_changed (GtkComboBox *combo,
+ BraseroDriveSelection *selection)
+{
+ BraseroDrive *drive;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+
+ if (! gtk_combo_box_get_active_iter (GTK_COMBO_BOX (selection), &iter)) {
+ return;
+ }
+
+ model = gtk_combo_box_get_model (GTK_COMBO_BOX (selection));
+ gtk_tree_model_get (model, &iter, DRIVE_COLUMN, &drive, -1);
+
+ if (drive == NULL) {
+ return;
+ }
+
+ brasero_drive_selection_set_drive_internal (selection, drive);
+}
+
+static void
+selection_update_sensitivity (BraseroDriveSelection *selection)
+{
+ GtkTreeModel *model;
+ int num_drives;
+
+ model = gtk_combo_box_get_model (GTK_COMBO_BOX (selection));
+ num_drives = gtk_tree_model_iter_n_children (model, NULL);
+
+ gtk_widget_set_sensitive (GTK_WIDGET (selection), (num_drives > 0));
+}
+
+static gboolean
+get_iter_for_drive (BraseroDriveSelection *selection,
+ BraseroDrive *drive,
+ GtkTreeIter *iter)
+{
+ GtkTreeModel *model;
+ gboolean found;
+
+ found = FALSE;
+
+ model = gtk_combo_box_get_model (GTK_COMBO_BOX (selection));
+ if (! gtk_tree_model_get_iter_first (model, iter)) {
+ goto out;
+ }
+
+ do {
+ BraseroDrive *drive2;
+
+ gtk_tree_model_get (model, iter, DRIVE_COLUMN, &drive2, -1);
+
+ if (drive == drive2) {
+ found = TRUE;
+ break;
+ }
+
+ } while (gtk_tree_model_iter_next (model, iter));
+ out:
+ return found;
+}
+
+static void
+selection_append_drive (BraseroDriveSelection *selection,
+ BraseroDrive *drive)
+{
+ char *display_name;
+ GtkTreeIter iter;
+ GtkTreeModel *model;
+
+ display_name = brasero_drive_get_display_name (drive);
+
+ model = gtk_combo_box_get_model (GTK_COMBO_BOX (selection));
+ gtk_list_store_append (GTK_LIST_STORE (model), &iter);
+ gtk_list_store_set (GTK_LIST_STORE (model), &iter,
+ DISPLAY_NAME_COLUMN, display_name ? display_name : _("Unnamed CD/DVD Drive"),
+ DRIVE_COLUMN, drive,
+ -1);
+
+ g_free (display_name);
+}
+
+static void
+selection_remove_drive (BraseroDriveSelection *selection,
+ BraseroDrive *drive)
+{
+ gboolean found;
+ GtkTreeIter iter;
+ GtkTreeModel *model;
+ BraseroDriveSelectionPrivate *priv;
+
+ priv = BRASERO_DRIVE_SELECTION_PRIVATE (selection);
+ found = get_iter_for_drive (selection, drive, &iter);
+ if (! found) {
+ return;
+ }
+
+ model = gtk_combo_box_get_model (GTK_COMBO_BOX (selection));
+ gtk_list_store_remove (GTK_LIST_STORE (model), &iter);
+
+ if (priv->selected_drive != NULL
+ && (drive == priv->selected_drive)) {
+ if (gtk_tree_model_get_iter_first (model, &iter)) {
+ gtk_combo_box_set_active_iter (GTK_COMBO_BOX (selection), &iter);
+ }
+ }
+}
+
+static void
+populate_model (BraseroDriveSelection *selection,
+ GtkListStore *store)
+{
+ GSList *drives;
+ BraseroDrive *drive;
+ BraseroMediumMonitor *monitor;
+ BraseroDriveSelectionPrivate *priv;
+
+ priv = BRASERO_DRIVE_SELECTION_PRIVATE (selection);
+ monitor = brasero_medium_monitor_get_default ();
+ drives = brasero_medium_monitor_get_drives (monitor, priv->type);
+ while (drives != NULL) {
+ drive = drives->data;
+
+ selection_append_drive (selection, drive);
+
+ if (drive != NULL) {
+ g_object_unref (drive);
+ }
+ drives = g_slist_delete_link (drives, drives);
+ }
+
+ gtk_combo_box_set_active (GTK_COMBO_BOX (selection), 0);
+}
+
+static void
+drive_connected_cb (BraseroMediumMonitor *monitor,
+ BraseroDrive *drive,
+ BraseroDriveSelection *selection)
+{
+ selection_append_drive (selection, drive);
+
+ selection_update_sensitivity (selection);
+}
+
+static void
+drive_disconnected_cb (BraseroMediumMonitor *monitor,
+ BraseroDrive *drive,
+ BraseroDriveSelection *selection)
+{
+ selection_remove_drive (selection, drive);
+
+ selection_update_sensitivity (selection);
+}
+
+static void
+brasero_drive_selection_init (BraseroDriveSelection *selection)
+{
+ GtkCellRenderer *cell;
+ GtkListStore *store;
+ BraseroDriveSelectionPrivate *priv;
+
+ priv = BRASERO_DRIVE_SELECTION_PRIVATE (selection);
+
+ priv->monitor = brasero_medium_monitor_get_default ();
+
+ g_signal_connect (priv->monitor, "drive-added", G_CALLBACK (drive_connected_cb), selection);
+ g_signal_connect (priv->monitor, "drive-removed", G_CALLBACK (drive_disconnected_cb), selection);
+
+ store = gtk_list_store_new (N_COLUMNS, G_TYPE_STRING, BRASERO_TYPE_DRIVE);
+ gtk_combo_box_set_model (GTK_COMBO_BOX (selection),
+ GTK_TREE_MODEL (store));
+
+ cell = gtk_cell_renderer_text_new ();
+ gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (selection), cell, TRUE);
+ gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (selection), cell,
+ "text", DISPLAY_NAME_COLUMN,
+ NULL);
+
+ populate_model (selection, store);
+
+ selection_update_sensitivity (selection);
+
+ g_signal_connect (G_OBJECT (selection), "changed",
+ G_CALLBACK (combo_changed), selection);
+
+}
+
+static void
+brasero_drive_selection_finalize (GObject *object)
+{
+ BraseroDriveSelection *selection = (BraseroDriveSelection *) object;
+ BraseroDriveSelectionPrivate *priv;
+
+ g_return_if_fail (selection != NULL);
+ g_return_if_fail (BRASERO_IS_DRIVE_SELECTION (selection));
+
+ priv = BRASERO_DRIVE_SELECTION_PRIVATE (selection);
+
+ g_signal_handlers_disconnect_by_func (priv->monitor, G_CALLBACK (drive_connected_cb), selection);
+ g_signal_handlers_disconnect_by_func (priv->monitor, G_CALLBACK (drive_disconnected_cb), selection);
+
+ if (priv->selected_drive != NULL) {
+ g_object_unref (priv->selected_drive);
+ }
+
+ if (G_OBJECT_CLASS (brasero_drive_selection_parent_class)->finalize != NULL) {
+ (* G_OBJECT_CLASS (brasero_drive_selection_parent_class)->finalize) (object);
+ }
+}
+
+/**
+ * brasero_drive_selection_new:
+ *
+ * Create a new drive selector.
+ *
+ * Return value: Newly allocated #BraseroDriveSelection widget
+ **/
+GtkWidget *
+brasero_drive_selection_new (void)
+{
+ GtkWidget *widget;
+
+ widget = GTK_WIDGET
+ (g_object_new (BRASERO_TYPE_DRIVE_SELECTION, NULL));
+
+ return widget;
+}
+
+static void
+repopulate_model (BraseroDriveSelection *selection)
+{
+ GtkTreeModel *model;
+
+ /* block the combo changed signal handler until we're done */
+ g_signal_handlers_block_by_func (G_OBJECT (selection),
+ combo_changed, selection);
+
+ model = gtk_combo_box_get_model (GTK_COMBO_BOX (selection));
+ gtk_list_store_clear (GTK_LIST_STORE (model));
+ populate_model (selection, GTK_LIST_STORE (model));
+
+ g_signal_handlers_unblock_by_func (G_OBJECT (selection),
+ combo_changed, selection);
+
+ /* Force a signal out */
+ combo_changed (GTK_COMBO_BOX (selection), (gpointer) selection);
+}
+
+void
+brasero_drive_selection_show_type (BraseroDriveSelection *selection,
+ BraseroDriveType type)
+{
+ BraseroDriveSelectionPrivate *priv;
+
+ g_return_if_fail (selection != NULL);
+ g_return_if_fail (BRASERO_IS_DRIVE_SELECTION (selection));
+
+ priv = BRASERO_DRIVE_SELECTION_PRIVATE (selection);
+ priv->type = type;
+
+ repopulate_model (selection);
+ selection_update_sensitivity (selection);
+}
+
+static void
+brasero_drive_selection_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ BraseroDriveSelection *selection;
+
+ g_return_if_fail (BRASERO_IS_DRIVE_SELECTION (object));
+
+ selection = BRASERO_DRIVE_SELECTION (object);
+
+ switch (property_id) {
+ case PROP_DRIVE:
+ brasero_drive_selection_set_active (selection, g_value_get_object (value));
+ break;
+ case PROP_DRIVE_TYPE:
+ brasero_drive_selection_show_type (selection, g_value_get_uint (value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ }
+}
+
+static void
+brasero_drive_selection_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ BraseroDriveSelectionPrivate *priv;
+
+ g_return_if_fail (BRASERO_IS_DRIVE_SELECTION (object));
+
+ priv = BRASERO_DRIVE_SELECTION_PRIVATE (object);
+
+ switch (property_id) {
+ case PROP_DRIVE:
+ g_value_set_object (value, priv->selected_drive);
+ break;
+ case PROP_DRIVE_TYPE:
+ g_value_set_uint (value, priv->type);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ }
+}
+
+/**
+ * brasero_drive_selection_set_active:
+ * @selection: #BraseroDriveSelection
+ * @drive: #BraseroDrive
+ *
+ * Set the current selected drive to that which corresponds to the
+ * specified drive.
+ *
+ * Since: 2.14
+ *
+ **/
+void
+brasero_drive_selection_set_active (BraseroDriveSelection *selection,
+ BraseroDrive *drive)
+{
+ GtkTreeIter iter;
+ gboolean found;
+
+ g_return_if_fail (selection != NULL);
+ g_return_if_fail (BRASERO_IS_DRIVE_SELECTION (selection));
+
+ found = get_iter_for_drive (selection, drive, &iter);
+ if (! found) {
+ return;
+ }
+
+ gtk_combo_box_set_active_iter (GTK_COMBO_BOX (selection), &iter);
+}
+
+/**
+ * brasero_drive_selection_get_active:
+ * @selection: #BraseroDriveSelection
+ *
+ * Get the currently selected drive
+ *
+ * Return value: currently selected #BraseroDrive. The drive must be
+ * unreffed using nautilus_burn_drive_unref after use.
+ *
+ * Since: 2.14
+ *
+ **/
+BraseroDrive *
+brasero_drive_selection_get_active (BraseroDriveSelection *selection)
+{
+ BraseroDriveSelectionPrivate *priv;
+
+ g_return_val_if_fail (selection != NULL, NULL);
+ g_return_val_if_fail (BRASERO_IS_DRIVE_SELECTION (selection), NULL);
+
+ priv = BRASERO_DRIVE_SELECTION_PRIVATE (selection);
+ if (priv->selected_drive != NULL) {
+ g_object_ref (priv->selected_drive);
+ }
+
+ return priv->selected_drive;
+}
+
Added: trunk/brasero-media/brasero-drive-selection.h
==============================================================================
--- (empty file)
+++ trunk/brasero-media/brasero-drive-selection.h Sat Jan 10 13:03:24 2009
@@ -0,0 +1,67 @@
+/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8; tab-width: 8 -*-
+ *
+ * brasero-drive-selection.h
+ *
+ * Copyright (C) 2002-2004 Bastien Nocera <hadess hadess net>
+ * Copyright (C) 2005-2006 William Jon McCann <mccann jhu edu>
+ * Copyright (C) 2009 Philippe Rouquier <bonfire-app wanadoo fr>
+ *
+ * This program 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.
+ *
+ * This program 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Authors: Bastien Nocera <hadess hadess net>
+ * William Jon McCann <mccann jhu edu>
+ */
+
+#ifndef _BRASERO_DRIVE_SELECTION_H_
+#define _BRASERO_DRIVE_SELECTION_H_
+
+#include <gtk/gtk.h>
+
+#include <burn-drive.h>
+#include <burn-medium-monitor.h>
+
+G_BEGIN_DECLS
+
+#define BRASERO_TYPE_DRIVE_SELECTION (brasero_drive_selection_get_type ())
+#define BRASERO_DRIVE_SELECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BRASERO_TYPE_DRIVE_SELECTION, BraseroDriveSelection))
+#define BRASERO_DRIVE_SELECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BRASERO_TYPE_DRIVE_SELECTION, BraseroDriveSelectionClass))
+#define BRASERO_IS_DRIVE_SELECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE (obj, BRASERO_TYPE_DRIVE_SELECTION))
+#define BRASERO_IS_DRIVE_SELECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BRASERO_TYPE_DRIVE_SELECTION))
+
+
+typedef struct {
+ GtkComboBox widget;
+} BraseroDriveSelection;
+
+typedef struct {
+ GtkComboBoxClass parent_class;
+
+ void (* drive_changed) (GtkWidget *selection,
+ BraseroDrive *drive);
+} BraseroDriveSelectionClass;
+
+GtkType brasero_drive_selection_get_type (void);
+GtkWidget *brasero_drive_selection_new (void);
+
+void brasero_drive_selection_set_active (BraseroDriveSelection *selection,
+ BraseroDrive *drive);
+BraseroDrive *brasero_drive_selection_get_active (BraseroDriveSelection *selection);
+
+void brasero_drive_selection_show_type (BraseroDriveSelection *drive,
+ BraseroDriveType type);
+
+G_END_DECLS
+
+#endif /* _BRASERO_DRIVE_SELECTION_H_ */
Modified: trunk/brasero-media/brasero-medium-selection.c
==============================================================================
--- trunk/brasero-media/brasero-medium-selection.c (original)
+++ trunk/brasero-media/brasero-medium-selection.c Sat Jan 10 13:03:24 2009
@@ -57,6 +57,12 @@
static guint brasero_medium_selection_signals [LAST_SIGNAL] = { 0 };
enum {
+ PROP_0,
+ PROP_DEVICE,
+ PROP_MEDIA_TYPE
+};
+
+enum {
MEDIUM_COL,
NAME_COL,
ICON_COL,
@@ -222,15 +228,24 @@
brasero_drive_selection_set_tooltip (BRASERO_MEDIUM_SELECTION (box));
}
+/**
+ * brasero_medium_selection_set_active:
+ * @selector: a #BraseroMediumSelection
+ * @medium: a #BraseroMedium to set as the active one in the selector
+ *
+ * Sets the active medium.
+ *
+ * Return value: a #gboolean. TRUE if it succeeded, FALSE otherwise.
+ **/
gboolean
-brasero_medium_selection_set_active (BraseroMediumSelection *self,
+brasero_medium_selection_set_active (BraseroMediumSelection *selector,
BraseroMedium *medium)
{
gboolean result = FALSE;
GtkTreeModel *model;
GtkTreeIter iter;
- model = gtk_combo_box_get_model (GTK_COMBO_BOX (self));
+ model = gtk_combo_box_get_model (GTK_COMBO_BOX (selector));
if (!gtk_tree_model_get_iter_first (model, &iter))
return FALSE;
@@ -245,7 +260,7 @@
if (iter_medium)
g_object_unref (iter_medium);
- gtk_combo_box_set_active_iter (GTK_COMBO_BOX (self), &iter);
+ gtk_combo_box_set_active_iter (GTK_COMBO_BOX (selector), &iter);
result = TRUE;
break;
}
@@ -256,15 +271,55 @@
return result;
}
+/**
+ * brasero_medium_selection_set_device:
+ * @selector: a #BraseroMediumSelection
+ * @device: a #gchar * to set as the active medium in the selector
+ *
+ * Sets the active medium.
+ *
+ * Return value: a #gboolean. TRUE if it succeeded, FALSE otherwise.
+ **/
+gboolean
+brasero_medium_selection_set_device (BraseroMediumSelection *selector,
+ const gchar *device)
+{
+ BraseroMediumMonitor *monitor;
+ BraseroDrive *drive;
+ gboolean res;
+
+ monitor = brasero_medium_monitor_get_default ();
+ drive = brasero_medium_monitor_get_drive (monitor, device);
+ g_object_unref (monitor);
+
+ if (!drive) {
+ g_object_unref (drive);
+ return FALSE;
+ }
+
+ res = brasero_medium_selection_set_active (selector, brasero_drive_get_medium (drive));
+ g_object_unref (drive);
+
+ return res;
+}
+
+/**
+ * brasero_medium_selection_get_active:
+ * @selector: a #BraseroMediumSelection
+ *
+ * Gets the active medium.
+ *
+ * Return value: a #BraseroMedium or NULL. Unref when it is not needed anymore.
+ **/
BraseroMedium *
-brasero_medium_selection_get_active (BraseroMediumSelection *self)
+brasero_medium_selection_get_active (BraseroMediumSelection *selector)
{
BraseroMedium *medium;
GtkTreeModel *model;
GtkTreeIter iter;
- model = gtk_combo_box_get_model (GTK_COMBO_BOX (self));
- if (!gtk_combo_box_get_active_iter (GTK_COMBO_BOX (self), &iter))
+ model = gtk_combo_box_get_model (GTK_COMBO_BOX (selector));
+ if (!gtk_combo_box_get_active_iter (GTK_COMBO_BOX (selector), &iter))
return NULL;
gtk_tree_model_get (model, &iter,
@@ -273,6 +328,26 @@
return medium;
}
+/**
+ * brasero_medium_selection_get_device:
+ * @selector: a #BraseroMediumSelection
+ *
+ * Gets the active medium device.
+ *
+ * Return value: a #char * or NULL.
+ **/
+const gchar *
+brasero_medium_selection_get_device (BraseroMediumSelection *self)
+{
+ BraseroMedium *medium;
+
+ medium = brasero_medium_selection_get_active (self);
+ if (brasero_medium_get_status (medium) & BRASERO_MEDIUM_FILE)
+ return NULL;
+
+ return brasero_drive_get_device (brasero_medium_get_drive (medium));
+}
+
static void
brasero_medium_selection_update_no_disc_entry (BraseroMediumSelection *self,
GtkTreeModel *model,
@@ -321,9 +396,17 @@
brasero_medium_selection_update_no_disc_entry (self, model, &iter);
}
+/**
+ * brasero_medium_selection_show_media_type:
+ * @selector: a #BraseroMediumSelection
+ * @type: a #BraseroMediaType
+ *
+ * Filters and displays media corresponding to @type.
+ *
+ **/
void
-brasero_medium_selection_show_type (BraseroMediumSelection *self,
- BraseroMediaType type)
+brasero_medium_selection_show_media_type (BraseroMediumSelection *selector,
+ BraseroMediaType type)
{
BraseroMediumSelectionPrivate *priv;
BraseroMediumMonitor *monitor;
@@ -332,7 +415,7 @@
GSList *list;
GSList *item;
- priv = BRASERO_MEDIUM_SELECTION_PRIVATE (self);
+ priv = BRASERO_MEDIUM_SELECTION_PRIVATE (selector);
priv->type = type;
@@ -340,7 +423,7 @@
list = brasero_medium_monitor_get_media (monitor, type);
g_object_unref (monitor);
- model = gtk_combo_box_get_model (GTK_COMBO_BOX (self));
+ model = gtk_combo_box_get_model (GTK_COMBO_BOX (selector));
if (gtk_tree_model_get_iter_first (model, &iter)) {
/* First filter */
do {
@@ -363,14 +446,14 @@
if (!node) {
if (gtk_list_store_remove (GTK_LIST_STORE (model), &iter)) {
- g_signal_emit (self,
+ g_signal_emit (selector,
brasero_medium_selection_signals [REMOVED_SIGNAL],
0);
continue;
}
/* no more iter in the tree get out */
- g_signal_emit (self,
+ g_signal_emit (selector,
brasero_medium_selection_signals [REMOVED_SIGNAL],
0);
break;
@@ -390,7 +473,7 @@
medium = item->data;
- medium_name = brasero_medium_selection_get_medium_string (self, medium);
+ medium_name = brasero_medium_selection_get_medium_string (selector, medium);
medium_icon = brasero_volume_get_icon (BRASERO_VOLUME (medium));
gtk_list_store_append (GTK_LIST_STORE (model), &iter);
@@ -400,7 +483,7 @@
ICON_COL, medium_icon,
-1);
g_free (medium_name);
- g_signal_emit (self,
+ g_signal_emit (selector,
brasero_medium_selection_signals [ADDED_SIGNAL],
0);
}
@@ -409,23 +492,32 @@
}
if (!gtk_tree_model_get_iter_first (model, &iter)) {
- brasero_medium_selection_add_no_disc_entry (self);
+ brasero_medium_selection_add_no_disc_entry (selector);
return;
}
- gtk_widget_set_sensitive (GTK_WIDGET (self), TRUE);
- if (gtk_combo_box_get_active (GTK_COMBO_BOX (self)) == -1)
- gtk_combo_box_set_active_iter (GTK_COMBO_BOX (self), &iter);
+ gtk_widget_set_sensitive (GTK_WIDGET (selector), TRUE);
+ if (gtk_combo_box_get_active (GTK_COMBO_BOX (selector)) == -1)
+ gtk_combo_box_set_active_iter (GTK_COMBO_BOX (selector), &iter);
}
+/**
+ * brasero_medium_selection_get_media_num:
+ * @selector: a #BraseroMediumSelection
+ * @type: a #BraseroMediaType
+ *
+ * Returns the number of media being currently displayed and available.
+ *
+ * Return value: a #guint
+ **/
guint
-brasero_medium_selection_get_drive_num (BraseroMediumSelection *self)
+brasero_medium_selection_get_media_num (BraseroMediumSelection *selector)
{
GtkTreeModel *model;
GtkTreeIter iter;
int num = 0;
- model = gtk_combo_box_get_model (GTK_COMBO_BOX (self));
+ model = gtk_combo_box_get_model (GTK_COMBO_BOX (selector));
if (!gtk_tree_model_get_iter_first (model, &iter))
return 0;
@@ -467,8 +559,12 @@
&& (brasero_drive_can_write (drive)))
add = TRUE;
- if ((priv->type & BRASERO_MEDIA_TYPE_READABLE)
- && (brasero_medium_get_status (medium) & (BRASERO_MEDIUM_HAS_AUDIO|BRASERO_MEDIUM_HAS_DATA)))
+ if ((priv->type & BRASERO_MEDIA_TYPE_AUDIO)
+ && (brasero_medium_get_status (medium) & BRASERO_MEDIUM_HAS_AUDIO))
+ add = TRUE;
+
+ if ((priv->type & BRASERO_MEDIA_TYPE_DATA)
+ && (brasero_medium_get_status (medium) & BRASERO_MEDIUM_HAS_DATA))
add = TRUE;
if (priv->type & BRASERO_MEDIA_TYPE_WRITABLE) {
@@ -644,6 +740,60 @@
}
static void
+brasero_medium_selection_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ BraseroMediumSelectionPrivate *priv;
+
+ g_return_if_fail (BRASERO_IS_MEDIUM_SELECTION (object));
+
+ priv = BRASERO_MEDIUM_SELECTION_PRIVATE (object);
+
+ switch (prop_id)
+ {
+ case PROP_DEVICE:
+ brasero_medium_selection_set_device (BRASERO_MEDIUM_SELECTION (object),
+ g_value_get_string (value));
+ break;
+ case PROP_MEDIA_TYPE:
+ brasero_medium_selection_show_media_type (BRASERO_MEDIUM_SELECTION (object),
+ g_value_get_uint (value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+brasero_medium_selection_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ BraseroMediumSelectionPrivate *priv;
+
+ g_return_if_fail (BRASERO_IS_MEDIUM_SELECTION (object));
+
+ priv = BRASERO_MEDIUM_SELECTION_PRIVATE (object);
+
+ switch (prop_id)
+ {
+ case PROP_DEVICE:
+ g_value_set_string (value, brasero_medium_selection_get_device (BRASERO_MEDIUM_SELECTION (object)));
+ break;
+ case PROP_MEDIA_TYPE:
+ g_value_set_uint (value, priv->type);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
brasero_medium_selection_class_init (BraseroMediumSelectionClass *klass)
{
GObjectClass* object_class = G_OBJECT_CLASS (klass);
@@ -652,9 +802,21 @@
g_type_class_add_private (klass, sizeof (BraseroMediumSelectionPrivate));
object_class->finalize = brasero_medium_selection_finalize;
+ object_class->set_property = brasero_medium_selection_set_property;
+ object_class->get_property = brasero_medium_selection_get_property;
combo_class->changed = brasero_medium_selection_changed;
+ g_object_class_install_property (object_class, PROP_DEVICE,
+ g_param_spec_string ("device", NULL, NULL,
+ NULL, G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class, PROP_MEDIA_TYPE,
+ g_param_spec_uint ("media-type", NULL, NULL,
+ 0, BRASERO_MEDIA_TYPE_ALL,
+ BRASERO_MEDIA_TYPE_NONE,
+ G_PARAM_READWRITE));
+
brasero_medium_selection_signals [ADDED_SIGNAL] =
g_signal_new ("medium_added",
BRASERO_TYPE_MEDIUM_SELECTION,
Modified: trunk/brasero-media/brasero-medium-selection.h
==============================================================================
--- trunk/brasero-media/brasero-medium-selection.h (original)
+++ trunk/brasero-media/brasero-medium-selection.h Sat Jan 10 13:03:24 2009
@@ -68,6 +68,18 @@
gboolean
brasero_medium_selection_set_active (BraseroMediumSelection *selection,
BraseroMedium *medium);
+const gchar *
+brasero_medium_selection_get_device (BraseroMediumSelection *self);
+
+gboolean
+brasero_medium_selection_set_device (BraseroMediumSelection *selector,
+ const gchar *device);
+void
+brasero_medium_selection_show_media_type (BraseroMediumSelection *selection,
+ BraseroMediaType type);
+
+guint
+brasero_medium_selection_get_media_num (BraseroMediumSelection *selection);
void
brasero_medium_selection_foreach (BraseroMediumSelection *selection,
@@ -75,13 +87,6 @@
gpointer callback_data);
void
-brasero_medium_selection_show_type (BraseroMediumSelection *selection,
- BraseroMediaType type);
-
-guint
-brasero_medium_selection_get_drive_num (BraseroMediumSelection *selection);
-
-void
brasero_medium_selection_update_media_string (BraseroMediumSelection *selection);
G_END_DECLS
Modified: trunk/brasero-media/burn-drive.h
==============================================================================
--- trunk/brasero-media/burn-drive.h (original)
+++ trunk/brasero-media/burn-drive.h Sat Jan 10 13:03:24 2009
@@ -59,7 +59,6 @@
GObjectClass parent_class;
/* Signals */
-
void (*medium_added) (BraseroDrive *drive,
BraseroMedium *medium);
Modified: trunk/brasero-media/burn-media.c
==============================================================================
--- trunk/brasero-media/burn-media.c (original)
+++ trunk/brasero-media/burn-media.c Sat Jan 10 13:03:24 2009
@@ -360,7 +360,7 @@
static GQuark quark = 0;
if (!quark)
- quark = g_quark_from_static_string ("BraseroBurnError");
+ quark = g_quark_from_static_string ("BraseroMediaError");
return quark;
}
@@ -445,7 +445,7 @@
#define BRASERO_MEDIA_LOG_DOMAIN "BraseroMedia"
-const GOptionGroup *
+GOptionGroup *
brasero_media_get_option_group (void)
{
GOptionGroup *group;
@@ -483,3 +483,47 @@
g_free (format_real);
}
+
+#include <gtk/gtk.h>
+
+#include "burn-medium-monitor.h"
+
+static BraseroMediumMonitor *default_monitor = NULL;
+
+/**
+ * brasero_media_start:
+ *
+ * Initialize the library.
+ *
+ **/
+void
+brasero_media_library_start (void)
+{
+ if (default_monitor)
+ return;
+
+ /* Initialize i18n */
+ bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
+ bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+ textdomain (GETTEXT_PACKAGE);
+
+ /* Initialize icon-theme */
+ gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (),
+ BRASERO_DATADIR "/icons");
+
+ /* Take a reference for the monitoring library */
+ default_monitor = brasero_medium_monitor_get_default ();
+}
+
+/**
+ * brasero_media_stop:
+ *
+ * De-initialize the library.
+ *
+ **/
+void
+brasero_media_library_stop (void)
+{
+ g_object_unref (default_monitor);
+ default_monitor = NULL;
+}
Modified: trunk/brasero-media/burn-media.h
==============================================================================
--- trunk/brasero-media/burn-media.h (original)
+++ trunk/brasero-media/burn-media.h Sat Jan 10 13:03:24 2009
@@ -32,6 +32,16 @@
GQuark brasero_media_quark (void);
#define BRASERO_MEDIA_ERROR brasero_media_quark()
+/**
+ * To start and stop the library
+ */
+
+void
+brasero_media_library_start (void);
+
+void
+brasero_media_library_stop (void);
+
typedef enum {
BRASERO_MEDIA_ERROR_NONE,
BRASERO_MEDIA_ERROR_GENERAL, /******/
@@ -211,7 +221,7 @@
BraseroMedia
brasero_media_capabilities (BraseroMedia media);
-const GOptionGroup *
+GOptionGroup *
brasero_media_get_option_group (void);
/**
Modified: trunk/brasero-media/burn-medium-monitor.c
==============================================================================
--- trunk/brasero-media/burn-medium-monitor.c (original)
+++ trunk/brasero-media/burn-medium-monitor.c Sat Jan 10 13:03:24 2009
@@ -63,6 +63,8 @@
{
MEDIUM_INSERTED,
MEDIUM_REMOVED,
+ DRIVE_ADDED,
+ DRIVE_REMOVED,
LAST_SIGNAL
};
@@ -149,6 +151,53 @@
}
/**
+ * brasero_medium_monitor_get_drives:
+ * @monitor: a #BraseroMediumMonitor
+ * @include_fake: a #BraseroDriveType to tell what type of drives to include in the list
+ *
+ * Obtains the list of available drives.
+ *
+ * Return value: a #GSList or NULL
+ **/
+
+GSList *
+brasero_medium_monitor_get_drives (BraseroMediumMonitor *monitor,
+ BraseroDriveType type)
+{
+ BraseroMediumMonitorPrivate *priv;
+ GSList *drives = NULL;
+ GSList *iter;
+
+ priv = BRASERO_MEDIUM_MONITOR_PRIVATE (monitor);
+
+ for (iter = priv->drives; iter; iter = iter->next) {
+ BraseroDrive *drive;
+
+ drive = iter->data;
+ if (brasero_drive_is_fake (drive)) {
+ if (type & BRASERO_DRIVE_TYPE_FILE)
+ drives = g_slist_prepend (drives, drive);
+
+ continue;
+ }
+
+ if (brasero_drive_can_write (drive)
+ && (type & BRASERO_DRIVE_TYPE_WRITER)) {
+ drives = g_slist_prepend (drives, drive);
+ continue;
+ }
+
+ if (type & BRASERO_DRIVE_TYPE_READER) {
+ drives = g_slist_prepend (drives, drive);
+ continue;
+ }
+ }
+ g_slist_foreach (drives, (GFunc) g_object_ref, NULL);
+
+ return drives;
+}
+
+/**
* brasero_medium_monitor_get_media:
* @monitor: a #BraseroMediumMonitor
* @type: the type of #BraseroMedium that should be in the list
@@ -185,9 +234,17 @@
continue;
}
- if ((type & BRASERO_MEDIA_TYPE_READABLE)
+ if ((type & BRASERO_MEDIA_TYPE_AUDIO)
+ && !(brasero_medium_get_status (medium) & BRASERO_MEDIUM_FILE)
+ && (brasero_medium_get_status (medium) & BRASERO_MEDIUM_HAS_AUDIO)) {
+ list = g_slist_prepend (list, medium);
+ g_object_ref (medium);
+ continue;
+ }
+
+ if ((type & BRASERO_MEDIA_TYPE_DATA)
&& !(brasero_medium_get_status (medium) & BRASERO_MEDIUM_FILE)
- && (brasero_medium_get_status (medium) & (BRASERO_MEDIUM_HAS_AUDIO|BRASERO_MEDIUM_HAS_DATA))) {
+ && (brasero_medium_get_status (medium) & BRASERO_MEDIUM_HAS_DATA)) {
list = g_slist_prepend (list, medium);
g_object_ref (medium);
continue;
@@ -255,12 +312,16 @@
if (!libhal_device_query_capability (ctx, udi, "storage.cdrom", NULL))
return;
- BRASERO_MEDIA_LOG ("New drive inserted");
+ BRASERO_MEDIA_LOG ("New drive added");
priv = BRASERO_MEDIUM_MONITOR_PRIVATE (self);
drive = brasero_drive_new (udi);
priv->drives = g_slist_prepend (priv->drives, drive);
+ g_signal_emit (self,
+ medium_monitor_signals [DRIVE_ADDED],
+ 0,
+ drive);
/* check if a medium is inserted */
if (brasero_drive_get_medium (drive))
@@ -317,6 +378,10 @@
medium);
priv->drives = g_slist_remove (priv->drives, drive);
+ g_signal_emit (self,
+ medium_monitor_signals [DRIVE_REMOVED],
+ 0,
+ drive);
g_object_unref (drive);
}
}
@@ -454,10 +519,54 @@
g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE, 1,
BRASERO_TYPE_MEDIUM);
+
+ /**
+ * BraseroVolumeMonitor::drive-added:
+ * @monitor: the object which received the signal
+ * @medium: the new medium which was added
+ *
+ * This signal gets emitted when a new drive was detected
+ *
+ */
+ medium_monitor_signals[DRIVE_ADDED] =
+ g_signal_new ("drive_added",
+ G_OBJECT_CLASS_TYPE (klass),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_NO_RECURSE,
+ G_STRUCT_OFFSET (BraseroMediumMonitorClass, drive_added),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__OBJECT,
+ G_TYPE_NONE, 1,
+ BRASERO_TYPE_DRIVE);
+
+ /**
+ * BraseroVolumeMonitor::drive-removed:
+ * @monitor: the object which received the signal
+ * @medium: the medium which was removed
+ *
+ * This signal gets emitted when a drive is not longer available
+ *
+ */
+ medium_monitor_signals[DRIVE_REMOVED] =
+ g_signal_new ("drive_removed",
+ G_OBJECT_CLASS_TYPE (klass),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_NO_RECURSE,
+ G_STRUCT_OFFSET (BraseroMediumMonitorClass, drive_removed),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__OBJECT,
+ G_TYPE_NONE, 1,
+ BRASERO_TYPE_DRIVE);
}
static BraseroMediumMonitor *singleton = NULL;
+/**
+ * brasero_medium_monitor_get_default:
+ *
+ * Gets the currently active monitor.
+ *
+ * Return value: a #BraseroMediumMonitor. Unref when it is not needed anymore.
+ **/
+
BraseroMediumMonitor *
brasero_medium_monitor_get_default (void)
{
@@ -466,11 +575,9 @@
return singleton;
}
- /* Initialize i18n */
- bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
- textdomain (GETTEXT_PACKAGE);
-
singleton = g_object_new (BRASERO_TYPE_MEDIUM_MONITOR, NULL);
+
+ /* keep a reference */
+ g_object_ref (singleton);
return singleton;
}
Modified: trunk/brasero-media/burn-medium-monitor.h
==============================================================================
--- trunk/brasero-media/burn-medium-monitor.h (original)
+++ trunk/brasero-media/burn-medium-monitor.h Sat Jan 10 13:03:24 2009
@@ -45,6 +45,11 @@
GObjectClass parent_class;
/* Signals */
+ void (*drive_added) (BraseroMediumMonitor *monitor,
+ BraseroDrive *medium);
+
+ void (*drive_removed) (BraseroMediumMonitor *monitor,
+ BraseroDrive*medium);
void (*medium_added) (BraseroMediumMonitor *monitor,
BraseroMedium *medium);
@@ -66,18 +71,32 @@
typedef enum {
BRASERO_MEDIA_TYPE_NONE = 0,
BRASERO_MEDIA_TYPE_FILE = 1,
- BRASERO_MEDIA_TYPE_READABLE = 1 << 1,
- BRASERO_MEDIA_TYPE_WRITABLE = 1 << 2,
- BRASERO_MEDIA_TYPE_REWRITABLE = 1 << 3,
- BRASERO_MEDIA_TYPE_ANY_IN_BURNER = 1 << 4,
+ BRASERO_MEDIA_TYPE_DATA = 1 << 1,
+ BRASERO_MEDIA_TYPE_AUDIO = 1 << 2,
+ BRASERO_MEDIA_TYPE_WRITABLE = 1 << 3,
+ BRASERO_MEDIA_TYPE_REWRITABLE = 1 << 4,
+ BRASERO_MEDIA_TYPE_ANY_IN_BURNER = 1 << 5,
BRASERO_MEDIA_TYPE_ALL_BUT_FILE = 0xFE,
BRASERO_MEDIA_TYPE_ALL = 0xFF
} BraseroMediaType;
+typedef enum {
+ BRASERO_DRIVE_TYPE_NONE = 0,
+ BRASERO_DRIVE_TYPE_FILE = 1,
+ BRASERO_DRIVE_TYPE_WRITER = 1 << 1,
+ BRASERO_DRIVE_TYPE_READER = 1 << 2,
+ BRASERO_DRIVE_TYPE_ALL_BUT_FILE = 0xFE,
+ BRASERO_DRIVE_TYPE_ALL = 0xFF
+} BraseroDriveType;
+
GSList *
brasero_medium_monitor_get_media (BraseroMediumMonitor *monitor,
BraseroMediaType type);
+GSList *
+brasero_medium_monitor_get_drives (BraseroMediumMonitor *monitor,
+ BraseroDriveType type);
+
BraseroDrive *
brasero_medium_monitor_get_drive (BraseroMediumMonitor *monitor,
const gchar *device);
Modified: trunk/nautilus/Makefile.am
==============================================================================
--- trunk/nautilus/Makefile.am (original)
+++ trunk/nautilus/Makefile.am Sat Jan 10 13:03:24 2009
@@ -15,7 +15,9 @@
-DLIBEXECDIR=\""$(libexecdir)"\" \
-DSHAREDIR=\""$(datadir)"\" \
-DDATADIR=\""$(datadir)/brasero"\" \
- $(DISABLE_DEPRECATED)
+ $(DISABLE_DEPRECATED) \
+ $(BRASERO_HAL_CFLAGS)
+
CLEANFILES = \
$(NULL)
Modified: trunk/src/brasero-burn-options.c
==============================================================================
--- trunk/src/brasero-burn-options.c (original)
+++ trunk/src/brasero-burn-options.c Sat Jan 10 13:03:24 2009
@@ -163,7 +163,7 @@
BraseroBurnOptionsPrivate *priv;
priv = BRASERO_BURN_OPTIONS_PRIVATE (self);
- brasero_medium_selection_show_type (BRASERO_MEDIUM_SELECTION (priv->selection), type);
+ brasero_medium_selection_show_media_type (BRASERO_MEDIUM_SELECTION (priv->selection), type);
}
BraseroBurnSession *
@@ -211,7 +211,7 @@
return;
}
- if (brasero_medium_selection_get_drive_num (BRASERO_MEDIUM_SELECTION (priv->selection)) != 1) {
+ if (brasero_medium_selection_get_media_num (BRASERO_MEDIUM_SELECTION (priv->selection)) != 1) {
brasero_notify_message_remove (BRASERO_NOTIFY (priv->message_output),
BRASERO_BURN_OPTIONS_NO_MEDIUM_WARNING);
return;
Modified: trunk/src/brasero-dest-selection.c
==============================================================================
--- trunk/src/brasero-dest-selection.c (original)
+++ trunk/src/brasero-dest-selection.c Sat Jan 10 13:03:24 2009
@@ -174,8 +174,8 @@
/* Only show media on which we can write and which are in a burner.
* There is one exception though, when we're copying media and when the
* burning device is the same as the dest device. */
- brasero_medium_selection_show_type (BRASERO_MEDIUM_SELECTION (object),
- BRASERO_MEDIA_TYPE_WRITABLE);
+ brasero_medium_selection_show_media_type (BRASERO_MEDIUM_SELECTION (object),
+ BRASERO_MEDIA_TYPE_WRITABLE);
}
static void
Modified: trunk/src/brasero-disc-copy-dialog.c
==============================================================================
--- trunk/src/brasero-disc-copy-dialog.c (original)
+++ trunk/src/brasero-disc-copy-dialog.c Sat Jan 10 13:03:24 2009
@@ -101,8 +101,9 @@
g_free (title_str);
/* only show media with something to be read on them */
- brasero_medium_selection_show_type (BRASERO_MEDIUM_SELECTION (priv->source),
- BRASERO_MEDIA_TYPE_READABLE);
+ brasero_medium_selection_show_media_type (BRASERO_MEDIUM_SELECTION (priv->source),
+ BRASERO_MEDIA_TYPE_AUDIO|
+ BRASERO_MEDIA_TYPE_DATA);
/* This is a special case. When we're copying, someone may want to read
* and burn to the same drive so provided that the drive is a burner
Modified: trunk/src/brasero-src-selection.c
==============================================================================
--- trunk/src/brasero-src-selection.c (original)
+++ trunk/src/brasero-src-selection.c Sat Jan 10 13:03:24 2009
@@ -108,8 +108,9 @@
brasero_src_selection_init (BraseroSrcSelection *object)
{
/* only show media with something to be read on them */
- brasero_medium_selection_show_type (BRASERO_MEDIUM_SELECTION (object),
- BRASERO_MEDIA_TYPE_READABLE);
+ brasero_medium_selection_show_media_type (BRASERO_MEDIUM_SELECTION (object),
+ BRASERO_MEDIA_TYPE_AUDIO|
+ BRASERO_MEDIA_TYPE_DATA);
}
static void
Modified: trunk/src/brasero-sum-dialog.c
==============================================================================
--- trunk/src/brasero-sum-dialog.c (original)
+++ trunk/src/brasero-sum-dialog.c Sat Jan 10 13:03:24 2009
@@ -758,7 +758,8 @@
/* only media with data, no blank medium */
brasero_tool_dialog_set_medium_type_shown (BRASERO_TOOL_DIALOG (obj),
- BRASERO_MEDIA_TYPE_READABLE);
+ BRASERO_MEDIA_TYPE_AUDIO|
+ BRASERO_MEDIA_TYPE_DATA);
medium = brasero_tool_dialog_get_medium (BRASERO_TOOL_DIALOG (obj));
if (medium) {
Modified: trunk/src/brasero-tool-dialog.c
==============================================================================
--- trunk/src/brasero-tool-dialog.c (original)
+++ trunk/src/brasero-tool-dialog.c Sat Jan 10 13:03:24 2009
@@ -301,8 +301,8 @@
brasero_tool_dialog_set_medium_type_shown (BraseroToolDialog *self,
BraseroMediaType media_type)
{
- brasero_medium_selection_show_type (BRASERO_MEDIUM_SELECTION (self->priv->selector),
- media_type);
+ brasero_medium_selection_show_media_type (BRASERO_MEDIUM_SELECTION (self->priv->selector),
+ media_type);
}
BraseroMedium *
@@ -480,10 +480,11 @@
FALSE, FALSE, 0);
g_free (title_str);
- brasero_medium_selection_show_type (BRASERO_MEDIUM_SELECTION (obj->priv->selector),
- BRASERO_MEDIA_TYPE_REWRITABLE|
- BRASERO_MEDIA_TYPE_WRITABLE|
- BRASERO_MEDIA_TYPE_READABLE);
+ brasero_medium_selection_show_media_type (BRASERO_MEDIUM_SELECTION (obj->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),
obj->priv->upper_box,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]