brasero r1458 - in trunk: . src
- From: philippr svn gnome org
- To: svn-commits-list gnome org
- Subject: brasero r1458 - in trunk: . src
- Date: Sun, 2 Nov 2008 14:32:48 +0000 (UTC)
Author: philippr
Date: Sun Nov 2 14:32:48 2008
New Revision: 1458
URL: http://svn.gnome.org/viewvc/brasero?rev=1458&view=rev
Log:
Some headers cleanup and (small) code reorganization
* src/brasero-session-cfg.c (brasero_session_cfg_get_gconf_key),
(brasero_session_cfg_save_drive_properties),
(brasero_session_cfg_set_drive_properties),
(brasero_session_cfg_update):
* src/brasero-session-cfg.h:
* src/burn-caps.c (brasero_track_type_is_supported):
* src/burn-caps.h:
* src/burn-session.c:
* src/burn-session.h:
* src/burn-track.h:
Modified:
trunk/ChangeLog
trunk/src/brasero-session-cfg.c
trunk/src/brasero-session-cfg.h
trunk/src/burn-caps.c
trunk/src/burn-caps.h
trunk/src/burn-session.c
trunk/src/burn-session.h
trunk/src/burn-track.h
Modified: trunk/src/brasero-session-cfg.c
==============================================================================
--- trunk/src/brasero-session-cfg.c (original)
+++ trunk/src/brasero-session-cfg.c Sun Nov 2 14:32:48 2008
@@ -70,7 +70,93 @@
G_DEFINE_TYPE (BraseroSessionCfg, brasero_session_cfg, BRASERO_TYPE_BURN_SESSION);
-#define BRASERO_DEST_SAVED_FLAGS (BRASERO_DRIVE_PROPERTIES_FLAGS|BRASERO_BURN_FLAG_MULTI)
+#define BRASERO_DEST_SAVED_FLAGS (BRASERO_DRIVE_PROPERTIES_FLAGS|BRASERO_BURN_FLAG_MULTI)
+#define BRASERO_DRIVE_PROPERTIES_KEY "/apps/brasero/drives"
+
+/**
+ * Get a key to save parameters through GConf
+ */
+
+static gchar *
+brasero_session_cfg_get_gconf_key (BraseroSessionCfg *self,
+ const gchar *property)
+{
+ BraseroMedium *medium;
+ BraseroDrive *drive;
+ gchar *display_name;
+ gchar *key = NULL;
+ gchar *disc_type;
+
+ drive = brasero_burn_session_get_burner (BRASERO_BURN_SESSION (self));
+ if (!drive)
+ return NULL;
+
+ medium = brasero_drive_get_medium (drive);
+ if (brasero_medium_get_status (medium) == BRASERO_MEDIUM_NONE)
+ return NULL;
+
+ /* make sure display_name doesn't contain any forbidden characters */
+ display_name = brasero_drive_get_display_name (drive);
+ g_strdelimit (display_name, " +()", '_');
+
+ disc_type = g_strdup (brasero_medium_get_type_string (medium));
+ if (!disc_type) {
+ g_free (display_name);
+ return NULL;
+ }
+
+ g_strdelimit (disc_type, " +()", '_');
+
+ display_name = display_name ? display_name : "";
+ disc_type = disc_type ? disc_type : "";
+
+ switch (brasero_burn_session_get_input_type (BRASERO_BURN_SESSION (self), NULL)) {
+ case BRASERO_TRACK_TYPE_NONE:
+ key = g_strdup_printf ("%s/%s/none_%s/%s",
+ BRASERO_DRIVE_PROPERTIES_KEY,
+ display_name,
+ disc_type,
+ property);
+ break;
+ case BRASERO_TRACK_TYPE_DISC:
+ key = g_strdup_printf ("%s/%s/disc_%s/%s",
+ BRASERO_DRIVE_PROPERTIES_KEY,
+ display_name,
+ disc_type,
+ property);
+ break;
+
+ case BRASERO_TRACK_TYPE_DATA:
+ key = g_strdup_printf ("%s/%s/data_%s/%s",
+ BRASERO_DRIVE_PROPERTIES_KEY,
+ display_name,
+ disc_type,
+ property);
+ break;
+
+ case BRASERO_TRACK_TYPE_IMAGE:
+ key = g_strdup_printf ("%s/%s/image_%s/%s",
+ BRASERO_DRIVE_PROPERTIES_KEY,
+ display_name,
+ disc_type,
+ property);
+ break;
+
+ case BRASERO_TRACK_TYPE_AUDIO:
+ key = g_strdup_printf ("%s/%s/audio_%s/%s",
+ BRASERO_DRIVE_PROPERTIES_KEY,
+ display_name,
+ disc_type,
+ property);
+ break;
+ default:
+ break;
+ }
+
+ g_free (display_name);
+ g_free (disc_type);
+ return key;
+}
BraseroSessionError
brasero_session_cfg_get_error (BraseroSessionCfg *self)
@@ -105,7 +191,7 @@
client = gconf_client_get_default ();
rate = brasero_burn_session_get_rate (BRASERO_BURN_SESSION (self));
- key = brasero_burn_session_get_config_key (BRASERO_BURN_SESSION (self), "speed");
+ key = brasero_session_cfg_get_gconf_key (self, "speed");
if (!key) {
g_object_unref (client);
return;
@@ -114,7 +200,7 @@
gconf_client_set_int (client, key, rate / 1024, NULL);
g_free (key);
- key = brasero_burn_session_get_config_key (BRASERO_BURN_SESSION (self), "flags");
+ key = brasero_session_cfg_get_gconf_key (self, "flags");
if (!key) {
g_object_unref (client);
return;
@@ -267,7 +353,7 @@
/* Update/set the rate */
client = gconf_client_get_default ();
- key = brasero_burn_session_get_config_key (BRASERO_BURN_SESSION (self), "speed");
+ key = brasero_session_cfg_get_gconf_key (self, "speed");
value = gconf_client_get_without_default (client, key, NULL);
g_free (key);
@@ -291,7 +377,7 @@
/* Do the same with the flags.
* NOTE: we only save/load PROPERTIES_FLAGS */
- key = brasero_burn_session_get_config_key (BRASERO_BURN_SESSION (self), "flags");
+ key = brasero_session_cfg_get_gconf_key (self, "flags");
if (!key) {
g_object_unref (client);
return;
@@ -571,7 +657,7 @@
/* This is a special case */
if (source.type == BRASERO_TRACK_TYPE_DISC
&& (source.subtype.media & BRASERO_MEDIUM_PROTECTED)
- && brasero_burn_caps_has_capability (priv->caps, &source) != BRASERO_BURN_OK) {
+ && brasero_track_type_is_supported (&source) != BRASERO_BURN_OK) {
priv->is_valid = BRASERO_SESSION_DISC_PROTECTED;
g_signal_emit (self,
session_cfg_signals [IS_VALID_SIGNAL],
Modified: trunk/src/brasero-session-cfg.h
==============================================================================
--- trunk/src/brasero-session-cfg.h (original)
+++ trunk/src/brasero-session-cfg.h Sun Nov 2 14:32:48 2008
@@ -94,7 +94,7 @@
/**
* This tag (for sessions) is used to set an estimated size, used to determine
- * in the burn option dialog is the selected medium is big enough.
+ * in the burn option dialog if the selected medium is big enough.
*/
#define BRASERO_DATA_TRACK_SIZE_TAG "track::data::estimated_size"
Modified: trunk/src/burn-caps.c
==============================================================================
--- trunk/src/burn-caps.c (original)
+++ trunk/src/burn-caps.c Sun Nov 2 14:32:48 2008
@@ -2222,25 +2222,6 @@
return FALSE;
}
-BraseroBurnResult
-brasero_burn_caps_has_capability (BraseroBurnCaps *self,
- BraseroTrackType *type)
-{
- GSList *iter;
-
- for (iter = self->priv->caps_list; iter; iter = iter->next) {
- BraseroCaps *caps;
-
- caps = iter->data;
-
- if (brasero_caps_is_compatible_type (caps, type)
- && brasero_burn_caps_is_input (self, caps))
- return BRASERO_BURN_OK;
- }
-
- return BRASERO_BURN_ERR;
-}
-
static BraseroPluginIOFlag
brasero_caps_get_flags (BraseroCaps *caps,
BraseroBurnFlag session_flags,
@@ -3817,3 +3798,30 @@
}
}
+
+/**
+ * Declared in burn-track.h
+ * This is to determine whether of not a track type is supported
+ */
+
+BraseroBurnResult
+brasero_track_type_is_supported (BraseroTrackType *type)
+{
+ GSList *iter;
+ BraseroBurnCaps *self;
+
+ self = brasero_burn_caps_get_default ();
+
+ for (iter = self->priv->caps_list; iter; iter = iter->next) {
+ BraseroCaps *caps;
+
+ caps = iter->data;
+
+ if (brasero_caps_is_compatible_type (caps, type)
+ && brasero_burn_caps_is_input (self, caps))
+ return BRASERO_BURN_OK;
+ }
+
+ return BRASERO_BURN_ERR;
+}
+
Modified: trunk/src/burn-caps.h
==============================================================================
--- trunk/src/burn-caps.h (original)
+++ trunk/src/burn-caps.h Sun Nov 2 14:32:48 2008
@@ -99,10 +99,6 @@
*/
BraseroBurnResult
-brasero_burn_caps_has_capability (BraseroBurnCaps *caps,
- BraseroTrackType *type);
-
-BraseroBurnResult
brasero_burn_caps_can_blank (BraseroBurnCaps *caps,
BraseroBurnSession *session);
@@ -124,6 +120,7 @@
BraseroMedia
brasero_burn_caps_get_required_media_type (BraseroBurnCaps *caps,
BraseroBurnSession *session);
+
BraseroImageFormat
brasero_burn_caps_get_default_output_format (BraseroBurnCaps *caps,
BraseroBurnSession *session);
Modified: trunk/src/burn-session.c
==============================================================================
--- trunk/src/burn-session.c (original)
+++ trunk/src/burn-session.c Sun Nov 2 14:32:48 2008
@@ -1501,91 +1501,6 @@
}
/**
- * Misc
- */
-
-gchar *
-brasero_burn_session_get_config_key (BraseroBurnSession *self,
- const gchar *property)
-{
- BraseroMedium *medium;
- BraseroDrive *drive;
- gchar *display_name;
- gchar *key = NULL;
- gchar *disc_type;
-
- drive = brasero_burn_session_get_burner (self);
- if (!drive)
- return NULL;
-
- medium = brasero_drive_get_medium (drive);
- if (brasero_medium_get_status (medium) == BRASERO_MEDIUM_NONE)
- return NULL;
-
- /* make sure display_name doesn't contain any forbidden characters */
- display_name = brasero_drive_get_display_name (drive);
- g_strdelimit (display_name, " +()", '_');
-
- disc_type = g_strdup (brasero_medium_get_type_string (medium));
- if (!disc_type) {
- g_free (display_name);
- return NULL;
- }
-
- g_strdelimit (disc_type, " +()", '_');
-
- display_name = display_name ? display_name : "";
- disc_type = disc_type ? disc_type : "";
-
- switch (brasero_burn_session_get_input_type (self, NULL)) {
- case BRASERO_TRACK_TYPE_NONE:
- key = g_strdup_printf ("%s/%s/none_%s/%s",
- BRASERO_DRIVE_PROPERTIES_KEY,
- display_name,
- disc_type,
- property);
- break;
- case BRASERO_TRACK_TYPE_DISC:
- key = g_strdup_printf ("%s/%s/disc_%s/%s",
- BRASERO_DRIVE_PROPERTIES_KEY,
- display_name,
- disc_type,
- property);
- break;
-
- case BRASERO_TRACK_TYPE_DATA:
- key = g_strdup_printf ("%s/%s/data_%s/%s",
- BRASERO_DRIVE_PROPERTIES_KEY,
- display_name,
- disc_type,
- property);
- break;
-
- case BRASERO_TRACK_TYPE_IMAGE:
- key = g_strdup_printf ("%s/%s/image_%s/%s",
- BRASERO_DRIVE_PROPERTIES_KEY,
- display_name,
- disc_type,
- property);
- break;
-
- case BRASERO_TRACK_TYPE_AUDIO:
- key = g_strdup_printf ("%s/%s/audio_%s/%s",
- BRASERO_DRIVE_PROPERTIES_KEY,
- display_name,
- disc_type,
- property);
- break;
- default:
- break;
- }
-
- g_free (display_name);
- g_free (disc_type);
- return key;
-}
-
-/**
*
*/
Modified: trunk/src/burn-session.h
==============================================================================
--- trunk/src/burn-session.h (original)
+++ trunk/src/burn-session.h Sun Nov 2 14:32:48 2008
@@ -36,7 +36,6 @@
G_BEGIN_DECLS
-#define BRASERO_DRIVE_PROPERTIES_KEY "/apps/brasero/drives"
#define BRASERO_TYPE_BURN_SESSION (brasero_burn_session_get_type ())
#define BRASERO_BURN_SESSION(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), BRASERO_TYPE_BURN_SESSION, BraseroBurnSession))
@@ -91,12 +90,9 @@
brasero_burn_session_get_input_type (BraseroBurnSession *session,
BraseroTrackType *type);
-const gchar *
-brasero_burn_session_get_label (BraseroBurnSession *session);
-
-void
-brasero_burn_session_set_label (BraseroBurnSession *session,
- const gchar *label);
+/**
+ * This is to set additional arbitrary information
+ */
BraseroBurnResult
brasero_burn_session_tag_lookup (BraseroBurnSession *session,
@@ -113,23 +109,9 @@
const gchar *tag);
/**
- *
+ * Destination
*/
-BraseroBurnResult
-brasero_burn_session_set_rate (BraseroBurnSession *session,
- guint64 rate);
-
-guint64
-brasero_burn_session_get_rate (BraseroBurnSession *session);
-
-void
-brasero_burn_session_set_num_copies (BraseroBurnSession *session,
- guint copies);
-
-guint
-brasero_burn_session_get_num_copies (BraseroBurnSession *session);
-
BraseroDrive *
brasero_burn_session_get_burner (BraseroBurnSession *session);
@@ -159,7 +141,27 @@
/**
- * Used to deal with the temporary files
+ * Session flags
+ */
+
+void
+brasero_burn_session_set_flags (BraseroBurnSession *session,
+ BraseroBurnFlag flag);
+
+void
+brasero_burn_session_add_flag (BraseroBurnSession *session,
+ BraseroBurnFlag flag);
+
+void
+brasero_burn_session_remove_flag (BraseroBurnSession *session,
+ BraseroBurnFlag flag);
+
+BraseroBurnFlag
+brasero_burn_session_get_flags (BraseroBurnSession *session);
+
+
+/**
+ * Used to deal with the temporary files (mostly used by plugins)
*/
BraseroBurnResult
@@ -187,27 +189,8 @@
GError **error);
/**
- * Session flags
- */
-
-void
-brasero_burn_session_set_flags (BraseroBurnSession *session,
- BraseroBurnFlag flag);
-
-void
-brasero_burn_session_add_flag (BraseroBurnSession *session,
- BraseroBurnFlag flag);
-
-void
-brasero_burn_session_remove_flag (BraseroBurnSession *session,
- BraseroBurnFlag flag);
-
-BraseroBurnFlag
-brasero_burn_session_get_flags (BraseroBurnSession *session);
-
-
-/**
* Allow to save a whole session settings/source and restore it later.
+ * (mostly used internally)
*/
void
@@ -220,18 +203,11 @@
void
brasero_burn_session_pop_tracks (BraseroBurnSession *session);
-
/**
- * Some convenient functions
+ * Some convenience functions
+ * FIXME: maybe they should be put into a brasero burn session helper file?
*/
-gchar *
-brasero_burn_session_get_config_key (BraseroBurnSession *session,
- const gchar *property);
-
-gboolean
-brasero_burn_session_same_src_dest_drive (BraseroBurnSession *session);
-
BraseroMedia
brasero_burn_session_get_dest_media (BraseroBurnSession *session);
@@ -244,6 +220,8 @@
gboolean
brasero_burn_session_is_dest_file (BraseroBurnSession *session);
+gboolean
+brasero_burn_session_same_src_dest_drive (BraseroBurnSession *session);
#define BRASERO_BURN_SESSION_EJECT(session) \
(brasero_burn_session_get_flags ((session)) & BRASERO_BURN_FLAG_EJECT)
@@ -262,18 +240,6 @@
/**
- * Used to report wrong checksum
- */
-
-void
-brasero_burn_session_add_wrong_checksum (BraseroBurnSession *session,
- const gchar *path);
-
-GSList *
-brasero_burn_session_get_wrong_checksums (BraseroBurnSession *session);
-
-
-/**
* This is to log a session
*/
@@ -298,6 +264,43 @@
const gchar *format,
...);
+/**
+ * These should be converted to tags
+ */
+
+const gchar *
+brasero_burn_session_get_label (BraseroBurnSession *session);
+
+void
+brasero_burn_session_set_label (BraseroBurnSession *session,
+ const gchar *label);
+
+BraseroBurnResult
+brasero_burn_session_set_rate (BraseroBurnSession *session,
+ guint64 rate);
+
+guint64
+brasero_burn_session_get_rate (BraseroBurnSession *session);
+
+void
+brasero_burn_session_set_num_copies (BraseroBurnSession *session,
+ guint copies);
+
+guint
+brasero_burn_session_get_num_copies (BraseroBurnSession *session);
+
+/**
+ * Used to report wrong checksum
+ */
+
+void
+brasero_burn_session_add_wrong_checksum (BraseroBurnSession *session,
+ const gchar *path);
+
+GSList *
+brasero_burn_session_get_wrong_checksums (BraseroBurnSession *session);
+
+
G_END_DECLS
#endif /* BURN_SESSION_H */
Modified: trunk/src/burn-track.h
==============================================================================
--- trunk/src/burn-track.h (original)
+++ trunk/src/burn-track.h Sun Nov 2 14:32:48 2008
@@ -145,6 +145,10 @@
};
typedef struct _BraseroTrackType BraseroTrackType;
+BraseroBurnResult
+brasero_track_type_is_supported (BraseroTrackType *type);
+
+
#define BRASERO_TRACK_TYPE_HAS_VIDEO(type_MACRO) \
(((type_MACRO)->type == BRASERO_TRACK_TYPE_AUDIO) && \
((type_MACRO)->subtype.audio_format & (BRASERO_VIDEO_FORMAT_UNDEFINED| \
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]