[brasero] Move the disc name entry into the nautilus bar. This is the first patch of a series which attempt at



commit 89f49c2c2b006dd0e410d01d26813a394d7189d9
Author: Philippe Rouquier <bonfire-app wanadoo fr>
Date:   Thu Nov 11 13:53:05 2010 +0100

    Move the disc name entry into the nautilus bar.
    This is the first patch of a series which attempt at refreshing the nautilus burn extension UI

 nautilus/Makefile.am               |    6 +-
 nautilus/nautilus-burn-bar.c       |  310 ++++++++++++++++++++++++++++++++++--
 nautilus/nautilus-burn-bar.h       |   23 +++-
 nautilus/nautilus-burn-extension.c |  112 +++++++------
 4 files changed, 382 insertions(+), 69 deletions(-)
---
diff --git a/nautilus/Makefile.am b/nautilus/Makefile.am
index 3076101..de41521 100644
--- a/nautilus/Makefile.am
+++ b/nautilus/Makefile.am
@@ -42,11 +42,7 @@ nautilus_extension_LTLIBRARIES = libnautilus-brasero-extension.la
 libnautilus_brasero_extension_la_SOURCES = 	\
 	nautilus-burn-bar.c			\
 	nautilus-burn-bar.h			\
-	nautilus-burn-extension.c			\
-	$(top_srcdir)/src/brasero-project-name.c                       \
-	$(top_srcdir)/src/brasero-project-name.h	\
-	$(top_srcdir)/src/brasero-drive-settings.h	\
-	$(top_srcdir)/src/brasero-drive-settings.c
+	nautilus-burn-extension.c
 
 libnautilus_brasero_extension_la_LIBADD =	\
 	$(NAUTILUS_EXTENSION_LIBS)		\
diff --git a/nautilus/nautilus-burn-bar.c b/nautilus/nautilus-burn-bar.c
index 4951e59..f7c2de4 100644
--- a/nautilus/nautilus-burn-bar.c
+++ b/nautilus/nautilus-burn-bar.c
@@ -36,18 +36,96 @@ static void nautilus_disc_burn_bar_finalize   (GObject *object);
 
 struct NautilusDiscBurnBarPrivate
 {
-        GtkWidget   *button;
+        GtkWidget  *button;
+        GtkWidget  *title;
+        gchar      *icon_path;
 };
 
 enum {
-       ACTIVATE,
-       LAST_SIGNAL
+        TITLE_CHANGED,
+        ICON_CHANGED,
+        ACTIVATE,
+        LAST_SIGNAL
 };
 
 static guint           signals [LAST_SIGNAL] = { 0, };
 
 G_DEFINE_TYPE (NautilusDiscBurnBar, nautilus_disc_burn_bar, GTK_TYPE_HBOX)
 
+const gchar *
+nautilus_disc_burn_bar_get_icon (NautilusDiscBurnBar *bar)
+{
+        g_return_val_if_fail (bar != NULL, NULL);
+        return bar->priv->icon_path;
+}
+
+void
+nautilus_disc_burn_bar_set_icon (NautilusDiscBurnBar *bar,
+                                 const gchar *icon_path)
+{
+        g_return_if_fail (bar != NULL);
+
+        if (bar->priv->icon_path)
+                g_free (bar->priv->icon_path);
+
+        bar->priv->icon_path = g_strdup (icon_path);
+
+        if (bar->priv->icon_path) {
+                GIcon *icon;
+                GFile *file;
+
+                file = g_file_new_for_path (bar->priv->icon_path);
+		icon = g_file_icon_new (file);
+                g_object_unref (file);
+                gtk_entry_set_icon_from_gicon (GTK_ENTRY (bar->priv->title),
+                                               GTK_ENTRY_ICON_PRIMARY,
+                                               icon);
+                g_object_unref (icon);
+        }
+	else
+                gtk_entry_set_icon_from_icon_name (GTK_ENTRY (bar->priv->title),
+						   GTK_ENTRY_ICON_PRIMARY,
+						   "media-optical");
+}
+
+const gchar *
+nautilus_disc_burn_bar_get_title (NautilusDiscBurnBar *bar)
+{
+        g_return_val_if_fail (bar != NULL, NULL);
+        return gtk_entry_get_text (GTK_ENTRY (bar->priv->title));
+}
+
+void
+nautilus_disc_burn_bar_set_title (NautilusDiscBurnBar *bar,
+                                  const gchar *title)
+{
+        g_return_if_fail (bar != NULL);
+
+        if (!title) {
+                time_t  t;
+                gchar  *title_str;
+                gchar   buffer [128];
+
+                t = time (NULL);
+                strftime (buffer, sizeof (buffer), "%d %b %y", localtime (&t));
+
+	        /* NOTE to translators: the final string must not be over
+		 * 32 _bytes_ otherwise it gets truncated.
+		 * The %s is the date */
+		title_str = g_strdup_printf (_("Data disc (%s)"), buffer);
+
+		if (strlen (title_str) > 32) {
+			g_free (title_str);
+			strftime (buffer, sizeof (buffer), "%F", localtime (&t));
+			title_str = g_strdup_printf ("Data disc %s", buffer);
+		}
+
+                gtk_entry_set_text (GTK_ENTRY (bar->priv->title), title_str);
+        }
+        else
+                gtk_entry_set_text (GTK_ENTRY (bar->priv->title), title);
+}
+
 GtkWidget *
 nautilus_disc_burn_bar_get_button (NautilusDiscBurnBar *bar)
 {
@@ -105,6 +183,20 @@ nautilus_disc_burn_bar_class_init (NautilusDiscBurnBarClass *klass)
 
         g_type_class_add_private (klass, sizeof (NautilusDiscBurnBarPrivate));
 
+        signals [TITLE_CHANGED] = g_signal_new ("title_changed",
+                                                G_TYPE_FROM_CLASS (klass),
+                                                G_SIGNAL_RUN_LAST,
+                                                G_STRUCT_OFFSET (NautilusDiscBurnBarClass, title_changed),
+                                                NULL, NULL,
+                                                g_cclosure_marshal_VOID__VOID,
+                                                G_TYPE_NONE, 0);
+        signals [ICON_CHANGED] = g_signal_new ("icon_changed",
+                                               G_TYPE_FROM_CLASS (klass),
+                                               G_SIGNAL_RUN_LAST,
+                                               G_STRUCT_OFFSET (NautilusDiscBurnBarClass, icon_changed),
+                                               NULL, NULL,
+                                               g_cclosure_marshal_VOID__VOID,
+                                               G_TYPE_NONE, 0);
         signals [ACTIVATE] = g_signal_new ("activate",
                                            G_TYPE_FROM_CLASS (klass),
                                            G_SIGNAL_RUN_LAST,
@@ -122,37 +214,230 @@ button_clicked_cb (GtkWidget       *button,
 }
 
 static void
+nautilus_disc_burn_bar_title_changed (GtkEditable *editable,
+                                      NautilusDiscBurnBar *bar)
+{
+	g_signal_emit (bar,
+		       signals [TITLE_CHANGED],
+		       0);
+}
+
+static void
+nautilus_disc_burn_bar_icon_button_clicked (GtkEntry *entry,
+                                            GtkEntryIconPosition position,
+                                            GdkEvent *event,
+                                            NautilusDiscBurnBar *bar)
+{
+        GtkFileFilter *filter;
+	GtkWidget *chooser;
+	gchar *path;
+	gint res;
+
+	chooser = gtk_file_chooser_dialog_new (_("Medium Icon"),
+					       GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (bar))),
+					       GTK_FILE_CHOOSER_ACTION_OPEN,
+					       GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+					       GTK_STOCK_OK, GTK_RESPONSE_OK,
+					       NULL);
+
+	filter = gtk_file_filter_new ();
+	gtk_file_filter_set_name (filter, _("All files"));
+	gtk_file_filter_add_pattern (filter, "*");
+	gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (chooser), filter);
+
+	filter = gtk_file_filter_new ();
+	/* Translators: this is an image, a picture, not a "Disc Image" */
+	gtk_file_filter_set_name (filter, C_("picture", "Image files"));
+	gtk_file_filter_add_mime_type (filter, "image/*");
+	gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (chooser), filter);
+
+	gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (chooser), filter);
+
+        if (bar->priv->icon_path)
+		gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (chooser), bar->priv->icon_path);
+
+	gtk_widget_show (chooser);
+	res = gtk_dialog_run (GTK_DIALOG (chooser));
+	if (res != GTK_RESPONSE_OK) {
+		gtk_widget_destroy (chooser);
+		return;
+	}
+
+	path = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (chooser));
+	gtk_widget_destroy (chooser);
+
+        nautilus_disc_burn_bar_set_icon (bar, path);
+        g_free (path);
+
+        g_signal_emit (bar,
+                       signals [ICON_CHANGED],
+                       0);
+}
+
+static void
+nautilus_disc_burn_bar_title_insert_text (GtkEditable *editable,
+                                          const gchar *text,
+                                          gint length,
+                                          gint *position,
+                                          NautilusDiscBurnBar *bar)
+{
+	const gchar *label;
+	gchar *new_text;
+	gint new_length;
+	gchar *current;
+	gint max_len;
+	gchar *prev;
+	gchar *next;
+
+	/* check if this new text will fit in 32 _bytes_ long buffer */
+	label = gtk_entry_get_text (GTK_ENTRY (editable));
+	max_len = 32 - strlen (label) - length;
+	if (max_len >= 0)
+		return;
+
+	gdk_beep ();
+
+	/* get the last character '\0' of the text to be inserted */
+	new_length = length;
+	new_text = g_strdup (text);
+	current = g_utf8_offset_to_pointer (new_text, g_utf8_strlen (new_text, -1));
+
+	/* don't just remove one character in case there was many more
+	 * that were inserted at the same time through DND, paste, ... */
+	prev = g_utf8_find_prev_char (new_text, current);
+	if (!prev) {
+		/* no more characters so no insertion */
+		g_signal_stop_emission_by_name (editable, "insert_text"); 
+		g_free (new_text);
+		return;
+	}
+
+	do {
+		next = current;
+		current = prev;
+
+		prev = g_utf8_find_prev_char (new_text, current);
+		if (!prev) {
+			/* no more characters so no insertion */
+			g_signal_stop_emission_by_name (editable, "insert_text"); 
+			g_free (new_text);
+			return;
+		}
+
+		new_length -= next - current;
+		max_len += next - current;
+	} while (max_len < 0 && new_length > 0);
+
+	*current = '\0';
+	g_signal_handlers_block_by_func (editable,
+					 (gpointer) nautilus_disc_burn_bar_title_insert_text,
+					 bar);
+	gtk_editable_insert_text (editable, new_text, new_length, position);
+	g_signal_handlers_unblock_by_func (editable,
+					   (gpointer) nautilus_disc_burn_bar_title_insert_text,
+					   bar);
+
+	g_signal_stop_emission_by_name (editable, "insert_text");
+	g_free (new_text);
+}
+
+static void
 nautilus_disc_burn_bar_init (NautilusDiscBurnBar *bar)
 {
+        GtkWidget   *table;
         GtkWidget   *label;
         GtkWidget   *hbox;
         GtkWidget   *image;
+        GtkWidget   *entry;
         gchar       *string;
 
         bar->priv = NAUTILUS_DISC_BURN_BAR_GET_PRIVATE (bar);
 
         hbox = GTK_WIDGET (bar);
+        table = gtk_table_new (3, 2, FALSE);       
 
-        string = g_strdup_printf ("<b>%s</b>", _("CD/DVD Creator Folder"));
-        label = gtk_label_new (string);
-        g_free (string);
-        gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
+        gtk_table_set_col_spacings (GTK_TABLE (table), 6);
+        gtk_table_set_row_spacings (GTK_TABLE (table), 6);
+        gtk_widget_show (table);
+        gtk_box_pack_start (GTK_BOX (hbox), table, TRUE, TRUE, 0);
+
+        label = gtk_label_new (_("CD/DVD Creator Folder"));
+        gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+        gtk_widget_show (label);
+        gtk_table_attach (GTK_TABLE (table),
+                          label,
+                          0, 2,
+                          0, 1,
+                          GTK_FILL,
+                          GTK_FILL,
+                          0,
+                          0);
+
+        label = gtk_label_new (_("Disc Name:"));
+        gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
         gtk_widget_show (label);
-        gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
+        gtk_table_attach (GTK_TABLE (table),
+                          label,
+                          0, 1,
+                          1, 2,
+                          GTK_FILL,
+                          GTK_FILL,
+                          0,
+                          0);
+
+        entry = gtk_entry_new ();
+        bar->priv->title = entry;
+        gtk_widget_show (entry);
+        gtk_table_attach (GTK_TABLE (table),
+                          entry,
+                          1, 2,
+                          1, 2,
+                          GTK_FILL|GTK_EXPAND,
+                          GTK_FILL|GTK_EXPAND,
+                          0,
+                          0);
+
+        g_signal_connect (entry,
+			  "icon-release",
+			  G_CALLBACK (nautilus_disc_burn_bar_icon_button_clicked),
+			  bar);
+	g_signal_connect (entry,
+			  "insert_text",
+			  G_CALLBACK (nautilus_disc_burn_bar_title_insert_text),
+			  bar);
+	g_signal_connect (entry,
+			  "changed",
+			  G_CALLBACK (nautilus_disc_burn_bar_title_changed),
+			  bar);
 
         /* Translators: be careful, anything longer than the English will likely
          * not fit on small Nautilus windows */
         string = g_strdup_printf ("<i>%s</i>", _("Drag or copy files below to write them to disc"));
         label = gtk_label_new (string);
         g_free (string);
+        gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
         gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
         gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_END);
         gtk_widget_show (label);
-        gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0);
+        gtk_table_attach (GTK_TABLE (table),
+                          label,
+                          0, 2,
+                          2, 3,
+                          GTK_FILL|GTK_EXPAND,
+                          GTK_FILL|GTK_EXPAND,
+                          0,
+                          0);
 
         bar->priv->button = gtk_button_new_with_label (_("Write to Disc"));
         gtk_widget_show (bar->priv->button);
-        gtk_box_pack_end (GTK_BOX (hbox), bar->priv->button, FALSE, FALSE, 0);
+        gtk_table_attach (GTK_TABLE (table),
+                          bar->priv->button,
+                          2, 3,
+                          1, 2,
+                          GTK_FILL,
+                          GTK_FILL,
+                          0,
+                          0);
 
         image = gtk_image_new_from_icon_name ("media-optical-burn", GTK_ICON_SIZE_BUTTON);
         gtk_widget_show (image);
@@ -177,6 +462,11 @@ nautilus_disc_burn_bar_finalize (GObject *object)
 
         g_return_if_fail (bar->priv != NULL);
 
+        if (bar->priv->icon_path) {
+                g_free (bar->priv->icon_path);
+                bar->priv->icon_path = NULL;
+        }
+
         G_OBJECT_CLASS (nautilus_disc_burn_bar_parent_class)->finalize (object);
 }
 
diff --git a/nautilus/nautilus-burn-bar.h b/nautilus/nautilus-burn-bar.h
index 6e8373e..f6f6200 100644
--- a/nautilus/nautilus-burn-bar.h
+++ b/nautilus/nautilus-burn-bar.h
@@ -38,16 +38,17 @@ typedef struct NautilusDiscBurnBarPrivate NautilusDiscBurnBarPrivate;
 
 typedef struct
 {
-        GtkHBox                 box;
-
+        GtkHBox                     box;
         NautilusDiscBurnBarPrivate *priv;
 } NautilusDiscBurnBar;
 
 typedef struct
 {
-        GtkHBoxClass            parent_class;
+        GtkHBoxClass          parent_class;
 
-	void (* activate) (NautilusDiscBurnBar *bar);
+	void (* title_changed) (NautilusDiscBurnBar *bar);
+	void (* icon_changed)  (NautilusDiscBurnBar *bar);
+	void (* activate)      (NautilusDiscBurnBar *bar);
 
 } NautilusDiscBurnBarClass;
 
@@ -56,6 +57,20 @@ GtkWidget  *nautilus_disc_burn_bar_new               (void);
 
 GtkWidget  *nautilus_disc_burn_bar_get_button        (NautilusDiscBurnBar *bar);
 
+const gchar *
+nautilus_disc_burn_bar_get_icon (NautilusDiscBurnBar *bar);
+
+void
+nautilus_disc_burn_bar_set_icon (NautilusDiscBurnBar *bar,
+                                 const gchar *icon_path);
+
+void
+nautilus_disc_burn_bar_set_title (NautilusDiscBurnBar *bar,
+                                  const gchar *title);
+
+const gchar *
+nautilus_disc_burn_bar_get_title (NautilusDiscBurnBar *bar);
+
 G_END_DECLS
 
 #endif /* __GS_BURN_BAR_H */
diff --git a/nautilus/nautilus-burn-extension.c b/nautilus/nautilus-burn-extension.c
index 5514504..83a9703 100644
--- a/nautilus/nautilus-burn-extension.c
+++ b/nautilus/nautilus-burn-extension.c
@@ -55,15 +55,13 @@
 
 #include "nautilus-burn-bar.h"
 
-#include "brasero-project-name.h"
-
 #include "brasero-misc.h"
-#include "brasero-drive-settings.h"
 
 #include "brasero-media-private.h"
 #include "burn-debug.h"
 
-#define BURN_URI "burn:///"
+#define BURN_URI	"burn:///"
+#define WINDOW_KEY      "NautilusWindow"
 
 #define NAUTILUS_TYPE_DISC_BURN  (nautilus_disc_burn_get_type ())
 #define NAUTILUS_DISC_BURN(o)    (G_TYPE_CHECK_INSTANCE_CAST ((o), NAUTILUS_TYPE_DISC_BURN, NautilusDiscBurn))
@@ -93,6 +91,9 @@ struct _NautilusDiscBurnPrivate
         guint         empty_update_id;
 
         GSList       *widget_list;
+
+	gchar        *title;
+	gchar        *icon;
 };
 
 static GType nautilus_disc_burn_get_type      (void);
@@ -141,12 +142,6 @@ launch_brasero_on_window_session (BraseroSessionCfg	*session,
 	GtkResponseType		 result;
 	const gchar		*icon_name;
 	GtkWidget		*dialog;
-	BraseroDriveSettings	*settings;
-
-	/* Set saved temporary directory for the session.
-	 * NOTE: BraseroBurnSession can cope with NULL path */
-	settings = brasero_drive_settings_new ();
-	brasero_drive_settings_set_session (settings, BRASERO_BURN_SESSION (session));
 
 	/* Get the icon for the window */
 	if (window)
@@ -169,10 +164,8 @@ launch_brasero_on_window_session (BraseroSessionCfg	*session,
 	gtk_widget_destroy (dialog);
 
 	if (result != GTK_RESPONSE_OK
-	&&  result != GTK_RESPONSE_ACCEPT) {
-		g_object_unref (settings);
+	&&  result != GTK_RESPONSE_ACCEPT)
 		return;
-	}
 
 	/* now run burn dialog */
 	dialog = brasero_burn_dialog_new ();
@@ -195,8 +188,6 @@ launch_brasero_on_window_session (BraseroSessionCfg	*session,
 		                                         BRASERO_BURN_SESSION (session));
 
 	gtk_widget_destroy (dialog);
-
-	g_object_unref (settings);
 }
 
 static gboolean
@@ -257,23 +248,11 @@ nautilus_disc_burn_is_empty (GtkWindow *toplevel)
 }
 
 static void
-brasero_session_name_changed (BraseroProjectName *project_name,
-                              BraseroBurnSession *session)
-{
-	const gchar *label;
-
-	label = gtk_entry_get_text (GTK_ENTRY (project_name));
-	brasero_burn_session_set_label (session, label);
-}
-
-static void
-write_activate (GtkWindow *toplevel)
+write_activate (NautilusDiscBurn *burn,
+                GtkWindow *toplevel)
 {
 	BraseroTrackDataCfg	*track;
 	BraseroSessionCfg	*session;
-	GtkWidget 		*name_options;
-	GtkWidget		*options;
-	gchar			*string;
 
 	if (nautilus_disc_burn_is_empty (toplevel))
 		return;
@@ -283,32 +262,25 @@ write_activate (GtkWindow *toplevel)
 	track = brasero_track_data_cfg_new ();
 	brasero_track_data_cfg_add (track, BURN_URI, NULL);
 
+	if (burn->priv->icon)
+		brasero_track_data_cfg_set_icon (BRASERO_TRACK_DATA_CFG (track),
+		                                 burn->priv->icon,
+		                                 NULL);
+
 	session = brasero_session_cfg_new ();
 	brasero_burn_session_add_track (BRASERO_BURN_SESSION (session),
 					BRASERO_TRACK (track),
 					NULL);
 	g_object_unref (track);
 
-	/* add name widget here to set the label of the volume */
-	name_options = brasero_project_name_new (NULL);
-	brasero_project_name_set_session (BRASERO_PROJECT_NAME (name_options),
-					  BRASERO_BURN_SESSION (session));
-	g_signal_connect (name_options,
-	                  "name-changed",
-	                  G_CALLBACK (brasero_session_name_changed),
-	                  session);
-
-	string = g_strdup_printf ("<b>%s</b>", _("Disc name"));
-	options = brasero_utils_pack_properties (string,
-						 name_options,
-						 NULL);
-	g_free (string);
-	gtk_widget_show_all (options);
+	if (burn->priv->title)
+		brasero_burn_session_set_label (BRASERO_BURN_SESSION (session),
+		                                burn->priv->title);
 
 	/* NOTE: set the disc we're handling */
 	launch_brasero_on_window_session (session,
 	                                  _("CD/DVD Creator"),
-	                                  options,
+	                                  NULL,
 	                                  toplevel);
 
 	/* cleanup */
@@ -319,7 +291,8 @@ static void
 write_activate_cb (NautilusMenuItem *item,
                    gpointer          user_data)
 {
-	write_activate (GTK_WINDOW (user_data));
+	write_activate (NAUTILUS_DISC_BURN (user_data),
+	                GTK_WINDOW (g_object_get_data (G_OBJECT (item), WINDOW_KEY)));
 }
 
 static void
@@ -742,9 +715,10 @@ nautilus_disc_burn_get_background_items (NautilusMenuProvider *provider,
                                                _("_Write to Discâ?¦"),
                                                _("Write contents to a CD or DVD"),
                                                "brasero");
+		g_object_set_data (G_OBJECT (item), WINDOW_KEY, window);
                 g_signal_connect (item, "activate",
                                   G_CALLBACK (write_activate_cb),
-                                  window);
+                                  NAUTILUS_DISC_BURN (provider));
                 items = g_list_append (items, item);
 
                 g_object_set (item, "sensitive", ! NAUTILUS_DISC_BURN (provider)->priv->empty, NULL);
@@ -779,7 +753,26 @@ static void
 bar_activated_cb (NautilusDiscBurnBar	*bar,
                   gpointer		 user_data)
 {
-	write_activate (GTK_WINDOW (user_data));
+	write_activate (NAUTILUS_DISC_BURN (user_data),
+	                GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (bar))));
+}
+
+static void
+title_changed_cb (NautilusDiscBurnBar	*bar,
+                  NautilusDiscBurn	*burn)
+{
+	if (burn->priv->title)
+		g_free (burn->priv->title);
+	burn->priv->title = g_strdup (nautilus_disc_burn_bar_get_title (bar));
+}
+
+static void
+icon_changed_cb (NautilusDiscBurnBar	*bar,
+                 NautilusDiscBurn	*burn)
+{
+	if (burn->priv->icon)
+		g_free (burn->priv->icon);
+	burn->priv->icon = g_strdup (nautilus_disc_burn_bar_get_icon (bar));
 }
 
 static void
@@ -816,12 +809,21 @@ nautilus_disc_burn_get_location_widget (NautilusLocationWidgetProvider *iface,
                 burn = NAUTILUS_DISC_BURN (iface);
 
                 bar = nautilus_disc_burn_bar_new ();
-
+		nautilus_disc_burn_bar_set_title (NAUTILUS_DISC_BURN_BAR (bar),
+		                                  burn->priv->title);
+		nautilus_disc_burn_bar_set_icon (NAUTILUS_DISC_BURN_BAR (bar),
+		                                 burn->priv->icon);
                 sense_widget (burn, nautilus_disc_burn_bar_get_button (NAUTILUS_DISC_BURN_BAR (bar)));
 
                 g_signal_connect (bar, "activate",
                                   G_CALLBACK (bar_activated_cb),
-                                  window);
+                                  burn);
+		g_signal_connect (bar, "title-changed",
+		                  G_CALLBACK (title_changed_cb),
+		                  burn);
+		g_signal_connect (bar, "icon-changed",
+		                  G_CALLBACK (icon_changed_cb),
+		                  burn);
 
                 gtk_widget_show (bar);
 
@@ -958,6 +960,16 @@ nautilus_disc_burn_finalize (GObject *object)
 
         g_return_if_fail (burn->priv != NULL);
 
+	if (burn->priv->icon) {
+		g_free (burn->priv->icon);
+		burn->priv->icon = NULL;
+	}
+
+	if (burn->priv->title) {
+		g_free (burn->priv->title);
+		burn->priv->title = NULL;
+	}
+
         if (burn->priv->empty_update_id > 0) {
                 g_source_remove (burn->priv->empty_update_id);
         }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]