[Goodies-commits] r7869 - xfburn/trunk/xfburn

David Mohr squisher at xfce.org
Fri Jul 31 02:56:31 CEST 2009


Author: squisher
Date: 2009-07-31 00:56:31 +0000 (Fri, 31 Jul 2009)
New Revision: 7869

Modified:
   xfburn/trunk/xfburn/xfburn-burn-data-cd-composition-dialog.c
   xfburn/trunk/xfburn/xfburn-burn-data-cd-composition-dialog.h
   xfburn/trunk/xfburn/xfburn-burn-data-composition-base-dialog.c
   xfburn/trunk/xfburn/xfburn-data-composition.c
Log:
Restore show volume name in burn dialog functionality

Modified: xfburn/trunk/xfburn/xfburn-burn-data-cd-composition-dialog.c
===================================================================
--- xfburn/trunk/xfburn/xfburn-burn-data-cd-composition-dialog.c	2009-07-30 21:46:58 UTC (rev 7868)
+++ xfburn/trunk/xfburn/xfburn-burn-data-cd-composition-dialog.c	2009-07-31 00:56:31 UTC (rev 7869)
@@ -111,11 +111,13 @@
 
 /* public */
 GtkWidget *
-xfburn_burn_data_cd_composition_dialog_new (IsoImage *image)
+xfburn_burn_data_cd_composition_dialog_new (IsoImage *image, gboolean has_default_name)
 {
   XfburnBurnDataCdCompositionDialog *obj;
 
-  obj = XFBURN_BURN_DATA_CD_COMPOSITION_DIALOG (g_object_new (XFBURN_TYPE_BURN_DATA_CD_COMPOSITION_DIALOG, "image", image, NULL));
+  obj = XFBURN_BURN_DATA_CD_COMPOSITION_DIALOG (g_object_new (XFBURN_TYPE_BURN_DATA_CD_COMPOSITION_DIALOG, "image", image, 
+                                                                                                           "show-volume-name", has_default_name,
+                                                                                                           NULL));
   
   return GTK_WIDGET (obj);
 }

Modified: xfburn/trunk/xfburn/xfburn-burn-data-cd-composition-dialog.h
===================================================================
--- xfburn/trunk/xfburn/xfburn-burn-data-cd-composition-dialog.h	2009-07-30 21:46:58 UTC (rev 7868)
+++ xfburn/trunk/xfburn/xfburn-burn-data-cd-composition-dialog.h	2009-07-31 00:56:31 UTC (rev 7869)
@@ -51,7 +51,7 @@
 
 GType xfburn_burn_data_cd_composition_dialog_get_type ();
 
-GtkWidget *xfburn_burn_data_cd_composition_dialog_new (IsoImage *image);
+GtkWidget *xfburn_burn_data_cd_composition_dialog_new (IsoImage *image, gboolean has_default_name);
 
 G_END_DECLS
 #endif /* XFBURN_BURN_DATA_CD_COMPOSITION_DIALOG_H */

Modified: xfburn/trunk/xfburn/xfburn-burn-data-composition-base-dialog.c
===================================================================
--- xfburn/trunk/xfburn/xfburn-burn-data-composition-base-dialog.c	2009-07-30 21:46:58 UTC (rev 7868)
+++ xfburn/trunk/xfburn/xfburn-burn-data-composition-base-dialog.c	2009-07-31 00:56:31 UTC (rev 7869)
@@ -67,11 +67,14 @@
   */
 
   gint response;
+
+  gboolean show_volume_name;
 } XfburnBurnDataCompositionBaseDialogPrivate;
 
 enum {
   PROP_0,
-  PROP_IMAGE
+  PROP_IMAGE,
+  PROP_SHOW_VOLUME_NAME,
 };
 
 /*
@@ -150,7 +153,9 @@
 
   /* properties */
   g_object_class_install_property (object_class, PROP_IMAGE,
-				   g_param_spec_pointer ("image", "Image", "Image", G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
+				   g_param_spec_pointer ("image", _("Image"), _("Image"), G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
+  g_object_class_install_property (object_class, PROP_SHOW_VOLUME_NAME,
+				   g_param_spec_boolean ("show-volume-name", _("Show volume name"), _("Show a text entry for the name of the volume"), FALSE, G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
 }
 
 static GObject *
@@ -194,7 +199,7 @@
 
   /* composition name */
   comp_name = iso_image_get_volume_id (priv->image);
-  if (strcmp (comp_name, _(DATA_COMPOSITION_DEFAULT_NAME)) == 0) {
+  if (priv->show_volume_name) {
     GtkWidget *label;
     vbox = gtk_vbox_new (FALSE, 0);
     gtk_widget_show (vbox);
@@ -305,6 +310,9 @@
   case PROP_IMAGE:
     g_value_set_pointer (value, priv->image);
     break;
+  case PROP_SHOW_VOLUME_NAME:
+    g_value_set_boolean (value, priv->show_volume_name);
+    break;
   default:
     G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
     break;
@@ -320,6 +328,9 @@
   case PROP_IMAGE:
     priv->image = g_value_get_pointer (value);
     break;
+  case PROP_SHOW_VOLUME_NAME:
+    priv->show_volume_name = g_value_get_boolean (value);
+    break;
   default:
     G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
     break;

Modified: xfburn/trunk/xfburn/xfburn-data-composition.c
===================================================================
--- xfburn/trunk/xfburn/xfburn-data-composition.c	2009-07-30 21:46:58 UTC (rev 7868)
+++ xfburn/trunk/xfburn/xfburn-data-composition.c	2009-07-31 00:56:31 UTC (rev 7869)
@@ -113,6 +113,9 @@
 
 static gint directory_tree_sortfunc (GtkTreeModel * model, GtkTreeIter * a, GtkTreeIter * b, gpointer user_data);
 
+static void set_default_name (XfburnDataComposition * dc);
+static gboolean has_default_name (XfburnDataComposition * dc);
+
 static void action_create_directory (GtkAction *, XfburnDataComposition *);
 static void action_clear (GtkAction *, XfburnDataComposition *);
 static void action_remove_selection (GtkAction *, XfburnDataComposition *);
@@ -172,6 +175,8 @@
   GtkWidget *progress;
   GtkTreeStore *model;
 
+  gchar *default_vol_name;
+
 } XfburnDataCompositionPrivate;
 
 /* globals */
@@ -290,13 +295,6 @@
                                 { "text/plain;charset=utf-8", 0, DATA_COMPOSITION_DND_TARGET_TEXT_PLAIN },
                               };
 
-  gchar *vol_name;
-  char timestr[80];
-  struct tm *today;
-  time_t tm;
-  /* FIXME: put i into the class? */
-  static int i = 0;
-
   priv->full_paths_to_add = NULL;
 
   instances++;
@@ -357,17 +355,8 @@
   
   priv->entry_volume_name = gtk_entry_new ();
 
-  tm = time (NULL);
-  today = localtime (&tm);
+  set_default_name (composition);
 
-  if (tm && strftime (timestr, 80, "%Y-%m-%d", today))
-    /* Note to translators: first %s is the date in "i18n" format (year-month-day), %d is a running number of compositions */
-    vol_name = g_strdup_printf (_("Data %s~%d"), timestr, ++i);
-  else
-    vol_name = g_strdup_printf ("%s %d", _(DATA_COMPOSITION_DEFAULT_NAME), ++i);
-
-  gtk_entry_set_text (GTK_ENTRY (priv->entry_volume_name), vol_name);
-  g_free (vol_name);
   gtk_box_pack_start (GTK_BOX (hbox), priv->entry_volume_name, FALSE, FALSE, 0);
   gtk_widget_show (priv->entry_volume_name);
   
@@ -512,7 +501,7 @@
   
   switch (xfburn_disc_usage_get_disc_type (XFBURN_DISC_USAGE (du))) {
   case CD_DISC:
-    dialog = xfburn_burn_data_cd_composition_dialog_new (image);
+    dialog = xfburn_burn_data_cd_composition_dialog_new (image, has_default_name (dc));
     break;
   case DVD_DISC:
     dialog = xfburn_burn_data_dvd_composition_dialog_new (image);
@@ -957,6 +946,44 @@
 }
 
 static void
+set_default_name (XfburnDataComposition * dc)
+{
+  XfburnDataCompositionPrivate *priv = XFBURN_DATA_COMPOSITION_GET_PRIVATE (dc);
+
+  char timestr[80];
+  struct tm *today;
+  time_t tm;
+  /* FIXME: put i into the class? */
+  static int i = 0;
+
+  tm = time (NULL);
+  today = localtime (&tm);
+
+  if (priv->default_vol_name)
+    g_free (priv->default_vol_name);
+
+  if (tm && strftime (timestr, 80, "%Y-%m-%d", today))
+    /* Note to translators: first %s is the date in "i18n" format (year-month-day), %d is a running number of compositions */
+    priv->default_vol_name = g_strdup_printf (_("Data %s~%d"), timestr, ++i);
+  else
+    priv->default_vol_name = g_strdup_printf ("%s %d", _(DATA_COMPOSITION_DEFAULT_NAME), ++i);
+
+  gtk_entry_set_text (GTK_ENTRY (priv->entry_volume_name), priv->default_vol_name);
+}
+
+static gboolean
+has_default_name (XfburnDataComposition * dc)
+{
+  XfburnDataCompositionPrivate *priv = XFBURN_DATA_COMPOSITION_GET_PRIVATE (dc);
+
+  const gchar *name;
+
+  name = gtk_entry_get_text (GTK_ENTRY (priv->entry_volume_name));
+
+  return strcmp (name, priv->default_vol_name) == 0;
+}
+
+static void
 action_clear (GtkAction * action, XfburnDataComposition * dc)
 {
   XfburnDataCompositionPrivate *priv = XFBURN_DATA_COMPOSITION_GET_PRIVATE (dc);
@@ -966,7 +993,7 @@
   model = gtk_tree_view_get_model (GTK_TREE_VIEW (priv->content));
   gtk_tree_store_clear (GTK_TREE_STORE (model));
   
-  gtk_entry_set_text (GTK_ENTRY (priv->entry_volume_name), _(DATA_COMPOSITION_DEFAULT_NAME));
+  set_default_name (dc);
 
   xfburn_disc_usage_set_size (XFBURN_DISC_USAGE (priv->disc_usage), 0);
 }




More information about the Goodies-commits mailing list