[patch] fix LP #220312
- From: "Gregory Petrosyan" <gregory petrosyan gmail com>
- To: brasero-list gnome org
- Subject: [patch] fix LP #220312
- Date: Thu, 8 May 2008 03:28:38 +0400
Attached totally untested patch (probably) fixes
https://bugs.launchpad.net/ubuntu/+source/brasero/+bug/220312
As I see it, the problem is that label edit box is limited to 32
_characters_, not bytes.
This patch does 2 things:
- ensure that brasero_disc_option_dialog_get_default_label returns valid label
- make brasero_disc_option_dialog_set_label truncate long labels
(I am not sure if g_utf8_find_prev_char-based approach is ok here)
Sorry for my poor English; any feedback is welcome.
--
Regards, Gregory.
Index: src/brasero-disc-option-dialog.c
===================================================================
--- src/brasero-disc-option-dialog.c (revision 801)
+++ src/brasero-disc-option-dialog.c (working copy)
@@ -163,11 +163,21 @@
title_str = brasero_volume_get_name (BRASERO_VOLUME (medium));
}
- if (!title_str || title_str [0] == '\0')
+ if (!title_str || title_str [0] == '\0') {
title_str = g_strdup_printf (_("Data disc (%s)"), buffer);
+ if (strlen (title_str) > 32) {
+ strftime (buffer, sizeof (buffer), "%F", localtime (&t));
+ title_str = g_strdup_printf ("Data disc %s", buffer);
+ }
+ }
}
- else if (source.type == BRASERO_TRACK_TYPE_AUDIO)
+ else if (source.type == BRASERO_TRACK_TYPE_AUDIO) {
title_str = g_strdup_printf (_("Audio disc (%s)"), buffer);
+ if (strlen (title_str) > 32) {
+ strftime (buffer, sizeof (buffer), "%F", localtime (&t));
+ title_str = g_strdup_printf ("Audio disc %s", buffer);
+ }
+ }
if (drive)
g_object_unref (drive);
@@ -178,12 +188,22 @@
static void
brasero_disc_option_dialog_set_label (BraseroDiscOptionDialog *dialog)
{
+ gchar *delim;
const gchar *label;
BraseroDiscOptionDialogPrivate *priv;
priv = BRASERO_DISC_OPTION_DIALOG_PRIVATE (dialog);
label = gtk_entry_get_text (GTK_ENTRY (priv->label));
+ if (strlen (label) > 32) {
+ gdk_beep ();
+ delim = g_utf8_find_prev_char (label, label + 32);
+ if (delim) {
+ *delim = '\0';
+ gtk_entry_set_text (GTK_ENTRY (priv->label), label);
+ }
+ }
+
brasero_burn_session_set_label (priv->session, label);
}
@@ -380,7 +400,7 @@
/**
* These functions are used to update the session according to the states
- * of the buttons and entry
+ * of the buttons and entry
*/
static void
@@ -845,10 +865,10 @@
brasero_disc_option_dialog_new ()
{
BraseroDiscOptionDialog *obj;
-
+
obj = BRASERO_DISC_OPTION_DIALOG (g_object_new (BRASERO_TYPE_DISC_OPTION_DIALOG,
"title", _("Disc burning setup"),
NULL));
-
+
return GTK_WIDGET (obj);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]