[brasero] Add another filter to get CDs only to prevent DVD from showing up in audio projects
- From: Philippe Rouquier <philippr src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [brasero] Add another filter to get CDs only to prevent DVD from showing up in audio projects
- Date: Mon, 7 Sep 2009 14:21:20 +0000 (UTC)
commit 3767567f6a2d80265617a5eb2d4dc35ca91775cf
Author: Philippe Rouquier <bonfire-app wanadoo fr>
Date: Sun Sep 6 15:13:16 2009 +0200
Add another filter to get CDs only to prevent DVD from showing up in audio projects
libbrasero-media/brasero-medium-monitor.c | 79 +++++++++++++++++++++++----
libbrasero-media/brasero-medium-monitor.h | 8 +++-
libbrasero-media/brasero-medium-selection.c | 54 +++++++++++++++----
src/brasero-project.c | 3 +-
4 files changed, 121 insertions(+), 23 deletions(-)
---
diff --git a/libbrasero-media/brasero-medium-monitor.c b/libbrasero-media/brasero-medium-monitor.c
index 4bfe9dd..5de9192 100644
--- a/libbrasero-media/brasero-medium-monitor.c
+++ b/libbrasero-media/brasero-medium-monitor.c
@@ -237,41 +237,98 @@ brasero_medium_monitor_get_media (BraseroMediumMonitor *monitor,
if (!medium)
continue;
- if ((type & BRASERO_MEDIA_TYPE_ANY_IN_BURNER)
- && (brasero_drive_can_write (drive))) {
+ if ((type & BRASERO_MEDIA_TYPE_CD) == type
+ && (brasero_medium_get_status (medium) & BRASERO_MEDIUM_CD)) {
+ /* If used alone, returns all CDs */
list = g_slist_prepend (list, medium);
g_object_ref (medium);
continue;
}
+ if ((type & BRASERO_MEDIA_TYPE_ANY_IN_BURNER)
+ && (brasero_drive_can_write (drive))) {
+ if ((type & BRASERO_MEDIA_TYPE_CD)) {
+ if ((brasero_medium_get_status (medium) & BRASERO_MEDIUM_CD)) {
+ list = g_slist_prepend (list, medium);
+ g_object_ref (medium);
+ continue;
+ }
+ }
+ else {
+ list = g_slist_prepend (list, medium);
+ g_object_ref (medium);
+ continue;
+ }
+ continue;
+ }
+
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);
+ if ((type & BRASERO_MEDIA_TYPE_CD)) {
+ if ((brasero_medium_get_status (medium) & BRASERO_MEDIUM_CD)) {
+ list = g_slist_prepend (list, medium);
+ g_object_ref (medium);
+ continue;
+ }
+ }
+ else {
+ list = g_slist_prepend (list, medium);
+ g_object_ref (medium);
+ continue;
+ }
continue;
}
if ((type & BRASERO_MEDIA_TYPE_DATA)
&& !(brasero_medium_get_status (medium) & BRASERO_MEDIUM_FILE)
&& (brasero_medium_get_status (medium) & BRASERO_MEDIUM_HAS_DATA)) {
- list = g_slist_prepend (list, medium);
- g_object_ref (medium);
+ if ((type & BRASERO_MEDIA_TYPE_CD)) {
+ if ((brasero_medium_get_status (medium) & BRASERO_MEDIUM_CD)) {
+ list = g_slist_prepend (list, medium);
+ g_object_ref (medium);
+ continue;
+ }
+ }
+ else {
+ list = g_slist_prepend (list, medium);
+ g_object_ref (medium);
+ continue;
+ }
continue;
}
if (type & BRASERO_MEDIA_TYPE_WRITABLE) {
if (brasero_medium_can_be_written (medium)) {
- list = g_slist_prepend (list, medium);
- g_object_ref (medium);
- continue;
+ if ((type & BRASERO_MEDIA_TYPE_CD)) {
+ if ((brasero_medium_get_status (medium) & BRASERO_MEDIUM_CD)) {
+ list = g_slist_prepend (list, medium);
+ g_object_ref (medium);
+ continue;
+ }
+ }
+ else {
+ list = g_slist_prepend (list, medium);
+ g_object_ref (medium);
+ continue;
+ }
}
}
if (type & BRASERO_MEDIA_TYPE_REWRITABLE) {
if (brasero_medium_can_be_rewritten (medium)) {
- list = g_slist_prepend (list, medium);
- g_object_ref (medium);
+ if ((type & BRASERO_MEDIA_TYPE_CD)) {
+ if ((brasero_medium_get_status (medium) & BRASERO_MEDIUM_CD)) {
+ list = g_slist_prepend (list, medium);
+ g_object_ref (medium);
+ continue;
+ }
+ }
+ else {
+ list = g_slist_prepend (list, medium);
+ g_object_ref (medium);
+ continue;
+ }
continue;
}
}
diff --git a/libbrasero-media/brasero-medium-monitor.h b/libbrasero-media/brasero-medium-monitor.h
index d665a3e..b4e5454 100644
--- a/libbrasero-media/brasero-medium-monitor.h
+++ b/libbrasero-media/brasero-medium-monitor.h
@@ -85,7 +85,13 @@ typedef enum {
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,
+
+ /* If combined with other flags it will filter.
+ * if alone all CDs are returned.
+ * It can't be combined with FILE type. */
+ BRASERO_MEDIA_TYPE_CD = 1 << 6,
+
+ BRASERO_MEDIA_TYPE_ALL_BUT_FILE = 0x7F,
BRASERO_MEDIA_TYPE_ALL = 0xFF
} BraseroMediaType;
diff --git a/libbrasero-media/brasero-medium-selection.c b/libbrasero-media/brasero-medium-selection.c
index a26d66c..7a04f19 100644
--- a/libbrasero-media/brasero-medium-selection.c
+++ b/libbrasero-media/brasero-medium-selection.c
@@ -649,26 +649,60 @@ brasero_medium_selection_medium_added_cb (BraseroMediumMonitor *monitor,
priv = BRASERO_MEDIUM_SELECTION_PRIVATE (self);
drive = brasero_medium_get_drive (medium);
- if ((priv->type & BRASERO_MEDIA_TYPE_ANY_IN_BURNER)
- && (brasero_drive_can_write (drive)))
+ if ((priv->type & BRASERO_MEDIA_TYPE_CD) == priv->type
+ && (brasero_medium_get_status (medium) & BRASERO_MEDIUM_CD))
add = TRUE;
+ if ((priv->type & BRASERO_MEDIA_TYPE_ANY_IN_BURNER)
+ && (brasero_drive_can_write (drive))) {
+ if ((priv->type & BRASERO_MEDIA_TYPE_CD)) {
+ if (brasero_medium_get_status (medium) & BRASERO_MEDIUM_CD)
+ add = TRUE;
+ }
+ else
+ add = TRUE;
+ }
+
if ((priv->type & BRASERO_MEDIA_TYPE_AUDIO)
- && (brasero_medium_get_status (medium) & BRASERO_MEDIUM_HAS_AUDIO))
- add = TRUE;
+ && (brasero_medium_get_status (medium) & BRASERO_MEDIUM_HAS_AUDIO)) {
+ if ((priv->type & BRASERO_MEDIA_TYPE_CD)) {
+ if (brasero_medium_get_status (medium) & BRASERO_MEDIUM_CD)
+ add = TRUE;
+ }
+ else
+ add = TRUE;
+ }
if ((priv->type & BRASERO_MEDIA_TYPE_DATA)
- && (brasero_medium_get_status (medium) & BRASERO_MEDIUM_HAS_DATA))
- add = TRUE;
+ && (brasero_medium_get_status (medium) & BRASERO_MEDIUM_HAS_DATA)) {
+ if ((priv->type & BRASERO_MEDIA_TYPE_CD)) {
+ if (brasero_medium_get_status (medium) & BRASERO_MEDIUM_CD)
+ add = TRUE;
+ }
+ else
+ add = TRUE;
+ }
if (priv->type & BRASERO_MEDIA_TYPE_WRITABLE) {
- if (brasero_medium_can_be_written (medium))
- add = TRUE;
+ if (brasero_medium_can_be_written (medium)) {
+ if ((priv->type & BRASERO_MEDIA_TYPE_CD)) {
+ if (brasero_medium_get_status (medium) & BRASERO_MEDIUM_CD)
+ add = TRUE;
+ }
+ else
+ add = TRUE;
+ }
}
if (priv->type & BRASERO_MEDIA_TYPE_REWRITABLE) {
- if (brasero_medium_can_be_rewritten (medium))
- add = TRUE;
+ if (brasero_medium_can_be_rewritten (medium)) {
+ if ((priv->type & BRASERO_MEDIA_TYPE_CD)) {
+ if (brasero_medium_get_status (medium) & BRASERO_MEDIUM_CD)
+ add = TRUE;
+ }
+ else
+ add = TRUE;
+ }
}
model = gtk_combo_box_get_model (GTK_COMBO_BOX (self));
diff --git a/src/brasero-project.c b/src/brasero-project.c
index 578cf31..825fe72 100644
--- a/src/brasero-project.c
+++ b/src/brasero-project.c
@@ -1651,7 +1651,8 @@ brasero_project_switch (BraseroProject *project, BraseroProjectType type)
project->priv->current = BRASERO_DISC (project->priv->audio);
gtk_notebook_set_current_page (GTK_NOTEBOOK (project->priv->discs), 0);
brasero_medium_selection_show_media_type (BRASERO_MEDIUM_SELECTION (project->priv->selection),
- BRASERO_MEDIA_TYPE_WRITABLE);
+ BRASERO_MEDIA_TYPE_WRITABLE|
+ BRASERO_MEDIA_TYPE_CD);
}
else if (type == BRASERO_PROJECT_TYPE_DATA) {
project->priv->current = BRASERO_DISC (project->priv->data);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]