Commit 52c41cbb authored by Philippe Rouquier's avatar Philippe Rouquier

Fix build for nautilus extension

Rework brasero-project-name.c to make it rely entirely on the BraseroBurnSession object
parent 64701840
......@@ -211,14 +211,18 @@ write_activate (GtkWindow *toplevel)
track = brasero_track_data_cfg_new ();
brasero_track_data_cfg_add (track, BURN_URI, NULL);
session = brasero_session_cfg_new ();
brasero_burn_session_add_track (BRASERO_BURN_SESSION (session),
BRASERO_TRACK (track),
NULL);
g_object_unref (track);
/* Add option widget */
box = gtk_vbox_new (FALSE, 6);
gtk_widget_show (box);
/* add name widget here to set the label of the volume */
name_options = brasero_project_name_new ();
brasero_project_name_set_type (BRASERO_PROJECT_NAME (name_options),
BRASERO_PROJECT_TYPE_DATA);
name_options = brasero_project_name_new (BRASERO_BURN_SESSION (session));
string = g_strdup_printf ("<b>%s</b>", _("Disc name"));
options = brasero_utils_pack_properties (string,
name_options,
......@@ -258,7 +262,8 @@ launch_brasero_on_window_track (BraseroTrack *track,
/* create a session and add track */
session = brasero_session_cfg_new ();
brasero_burn_session_add_track (BRASERO_BURN_SESSION (session),
BRASERO_TRACK (track));
BRASERO_TRACK (track),
NULL);
launch_brasero_on_window_session (session, options, window);
g_object_unref (session);
......
......@@ -44,7 +44,6 @@ struct _BraseroProjectNamePrivate
BraseroBurnSession *session;
BraseroProjectType type;
BraseroMedium *medium;
guint label_modified:1;
};
......@@ -248,14 +247,27 @@ brasero_project_name_get_default_label (BraseroProjectName *self)
{
time_t t;
gchar buffer [128];
BraseroBurnFlag flags;
gchar *title_str = NULL;
BraseroProjectNamePrivate *priv;
priv = BRASERO_PROJECT_NAME_PRIVATE (self);
if (priv->medium) {
title_str = brasero_volume_get_name (BRASERO_VOLUME (priv->medium));
goto end;
if (priv->type == BRASERO_PROJECT_TYPE_INVALID)
return g_strdup ("");
flags = brasero_burn_session_get_flags (priv->session);
if (flags & BRASERO_BURN_FLAG_MERGE) {
BraseroMedium *medium;
BraseroDrive *burner;
burner = brasero_burn_session_get_burner (priv->session);
medium = brasero_drive_get_medium (burner);
if (medium) {
title_str = brasero_volume_get_name (BRASERO_VOLUME (medium));
goto end;
}
}
t = time (NULL);
......@@ -394,22 +406,36 @@ brasero_project_name_label_changed (GtkEditable *editable,
0);
}
void
brasero_project_name_set_type (BraseroProjectName *self,
BraseroProjectType type)
static void
brasero_project_name_set_type (BraseroProjectName *self)
{
BraseroProjectNamePrivate *priv;
BraseroTrackType *track_type;
BraseroProjectType type;
gchar *title_str = NULL;
priv = BRASERO_PROJECT_NAME_PRIVATE (self);
priv->type = type;
track_type = brasero_track_type_new ();
brasero_burn_session_get_input_type (priv->session, track_type);
if (priv->medium) {
g_object_unref (priv->medium);
priv->medium = NULL;
if (brasero_track_type_get_has_data (track_type))
type = BRASERO_PROJECT_TYPE_DATA;
else if (brasero_track_type_get_has_stream (track_type)) {
if (BRASERO_STREAM_FORMAT_HAS_VIDEO (brasero_track_type_get_stream_format (track_type)))
type = BRASERO_PROJECT_TYPE_VIDEO;
else
type = BRASERO_PROJECT_TYPE_AUDIO;
}
else
type = BRASERO_PROJECT_TYPE_INVALID;
brasero_track_type_free (track_type);
if (priv->type == type)
return;
priv->type = type;
priv->label_modified = FALSE;
title_str = brasero_project_name_get_default_label (self);
......@@ -421,23 +447,14 @@ brasero_project_name_set_type (BraseroProjectName *self,
g_free (title_str);
}
void
brasero_project_name_set_multisession_medium (BraseroProjectName *self,
BraseroMedium *medium)
static void
brasero_project_name_flags_changed (BraseroBurnSession *session,
BraseroProjectName *self)
{
BraseroProjectNamePrivate *priv;
gchar *title_str;
priv = BRASERO_PROJECT_NAME_PRIVATE (self);
if (priv->medium) {
g_object_unref (priv->medium);
priv->medium = NULL;
}
priv->medium = medium;
if (medium)
g_object_ref (medium);
if (priv->label_modified)
return;
......@@ -512,6 +529,8 @@ brasero_project_name_session_changed (BraseroProjectName *self)
}
brasero_track_type_free (type);
brasero_project_name_set_type (self);
}
static void
......@@ -558,6 +577,10 @@ brasero_project_name_set_property (GObject *object,
"track-removed",
G_CALLBACK (brasero_project_name_track_removed),
object);
g_signal_connect (g_value_get_object (value),
"flags-changed",
G_CALLBACK (brasero_project_name_flags_changed),
object);
break;
default:
......@@ -591,9 +614,16 @@ brasero_project_name_finalize (GObject *object)
BraseroProjectNamePrivate *priv;
priv = BRASERO_PROJECT_NAME_PRIVATE (object);
if (priv->medium) {
g_object_unref (priv->medium);
priv->medium = NULL;
if (priv->session) {
g_signal_handlers_disconnect_by_func (priv->session,
brasero_project_name_track_added,
object);
g_signal_handlers_disconnect_by_func (priv->session,
brasero_project_name_track_removed,
object);
g_signal_handlers_disconnect_by_func (priv->session,
brasero_project_name_flags_changed,
object);
}
G_OBJECT_CLASS (brasero_project_name_parent_class)->finalize (object);
......
......@@ -55,13 +55,6 @@ GType brasero_project_name_get_type (void) G_GNUC_CONST;
GtkWidget *
brasero_project_name_new (BraseroBurnSession *session);
void
brasero_project_name_set_type (BraseroProjectName *self,
BraseroProjectType type);
void
brasero_project_name_set_multisession_medium (BraseroProjectName *self,
BraseroMedium *medium);
G_END_DECLS
#endif /* _BRASERO_PROJECT_NAME_H_ */
......@@ -1010,20 +1010,6 @@ brasero_project_is_valid (BraseroSessionCfg *session,
}
}
static void
brasero_project_flags_changed_cb (BraseroBurnSession *session,
BraseroProject *project)
{
BraseroBurnFlag flags;
flags = brasero_burn_session_get_flags (session);
/* see if the project name should be updated */
if (flags & BRASERO_BURN_FLAG_MERGE)
brasero_project_name_set_multisession_medium (BRASERO_PROJECT_NAME (project->priv->name_display),
brasero_data_disc_get_loaded_medium (BRASERO_DATA_DISC (project->priv->current)));
}
static void
brasero_project_init (BraseroProject *obj)
{
......@@ -1053,10 +1039,6 @@ brasero_project_init (BraseroProject *obj)
"is-valid",
G_CALLBACK (brasero_project_is_valid),
obj);
g_signal_connect (obj->priv->session,
"flags-changed",
G_CALLBACK (brasero_project_flags_changed_cb),
obj);
g_signal_connect (obj->priv->session,
"track-added",
G_CALLBACK (brasero_project_track_added),
......@@ -1604,8 +1586,6 @@ brasero_project_switch (BraseroProject *project, BraseroProjectType type)
gtk_action_set_sensitive (action, TRUE);
action = gtk_action_group_get_action (project->priv->project_group, "Save");
gtk_action_set_sensitive (action, FALSE);
brasero_project_name_set_type (BRASERO_PROJECT_NAME (project->priv->name_display), type);
}
void
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment