Author: pollux
Date: 2006-12-24 20:49:17 +0000 (Sun, 24 Dec 2006)
New Revision: 24183

Modified:
   xfburn/branches/libburn_trial/xfburn/xfburn-blank-cd-dialog.c
   xfburn/branches/libburn_trial/xfburn/xfburn-burn-image-dialog.c
   xfburn/branches/libburn_trial/xfburn/xfburn-copy-dvd-dialog.c
   xfburn/branches/libburn_trial/xfburn/xfburn-device-box.c
   xfburn/branches/libburn_trial/xfburn/xfburn-device-box.h
   xfburn/branches/libburn_trial/xfburn/xfburn-device-list.c
   xfburn/branches/libburn_trial/xfburn/xfburn-device-list.h
   xfburn/branches/libburn_trial/xfburn/xfburn-format-dvd-dialog.c
Log:
* add some info in XfburnDevice struct
* add write mode selection combo in XfburnDeviceBox
* improve XfburnBurnImageDialog a bit
* Merry Christmas



Modified: xfburn/branches/libburn_trial/xfburn/xfburn-blank-cd-dialog.c
===================================================================
--- xfburn/branches/libburn_trial/xfburn/xfburn-blank-cd-dialog.c       
2006-12-24 16:13:31 UTC (rev 24182)
+++ xfburn/branches/libburn_trial/xfburn/xfburn-blank-cd-dialog.c       
2006-12-24 20:49:17 UTC (rev 24183)
@@ -100,7 +100,7 @@
   g_object_unref (icon);
 
   /* devices list */
-  priv->device_box = xfburn_device_box_new (TRUE, FALSE);
+  priv->device_box = xfburn_device_box_new (TRUE, FALSE, FALSE);
   gtk_widget_show (priv->device_box);
 
   frame = xfce_create_framebox_with_content (_("Burning device"), 
priv->device_box);

Modified: xfburn/branches/libburn_trial/xfburn/xfburn-burn-image-dialog.c
===================================================================
--- xfburn/branches/libburn_trial/xfburn/xfburn-burn-image-dialog.c     
2006-12-24 16:13:31 UTC (rev 24182)
+++ xfburn/branches/libburn_trial/xfburn/xfburn-burn-image-dialog.c     
2006-12-24 20:49:17 UTC (rev 24183)
@@ -39,7 +39,6 @@
   GtkWidget *chooser_image;
   
   GtkWidget *device_box;
-  GtkWidget *combo_mode;
 
   GtkWidget *check_eject;
   GtkWidget *check_burnfree;
@@ -50,7 +49,8 @@
 static void xfburn_burn_image_dialog_class_init (XfburnBurnImageDialogClass * 
klass);
 static void xfburn_burn_image_dialog_init (XfburnBurnImageDialog * sp);
 
-static void xfburn_burn_image_dialog_response_cb (XfburnBurnImageDialog * 
dialog, gint response_id, gpointer user_data);
+static void cb_device_changed (XfburnDeviceBox *box, XfburnDevice *device, 
XfburnBurnImageDialog * dialog);
+static void cb_dialog_response (XfburnBurnImageDialog * dialog, gint 
response_id, gpointer user_data);
 
 /*********************/
 /* class declaration */
@@ -98,9 +98,8 @@
   GtkFileFilter *filter;
   GtkWidget *frame;
   GtkWidget *vbox;
-  GtkWidget *hbox;
-  GtkWidget *label;
   GtkWidget *button;
+  XfburnDevice *device;
 
   gtk_window_set_title (GTK_WINDOW (obj), _("Burn CD image"));
   gtk_window_set_destroy_with_parent (GTK_WINDOW (obj), TRUE);
@@ -127,26 +126,13 @@
   gtk_box_pack_start (box, frame, FALSE, FALSE, BORDER);
 
   /* devices list */
-  priv->device_box = xfburn_device_box_new (TRUE, TRUE);
+  priv->device_box = xfburn_device_box_new (TRUE, TRUE, TRUE);
   gtk_widget_show (priv->device_box);
   
   frame = xfce_create_framebox_with_content (_("Burning device"), 
priv->device_box);
   gtk_widget_show (frame);
   gtk_box_pack_start (box, frame, FALSE, FALSE, BORDER);
 
-  /* mode */
-  hbox = gtk_hbox_new (FALSE, 0);
-  gtk_widget_show (hbox);
-  gtk_box_pack_start (GTK_BOX (priv->device_box), hbox, FALSE, FALSE, BORDER);
-
-  label = gtk_label_new_with_mnemonic (_("Write _mode :"));
-  gtk_widget_show (label);
-  gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, BORDER);
-
-  priv->combo_mode = xfburn_write_mode_combo_box_new ();
-  gtk_box_pack_start (GTK_BOX (hbox), priv->combo_mode, TRUE, TRUE, BORDER);
-  gtk_widget_show (priv->combo_mode);
-
   /* options */
   vbox = gtk_vbox_new (FALSE, 0);
   gtk_widget_show (vbox);
@@ -181,15 +167,28 @@
   gtk_widget_grab_focus (button);
   gtk_widget_grab_default (button);
 
-  g_signal_connect (G_OBJECT (obj), "response", G_CALLBACK 
(xfburn_burn_image_dialog_response_cb), obj);
+  g_signal_connect (G_OBJECT (priv->device_box), "device-changed", G_CALLBACK 
(cb_device_changed), obj);
+  g_signal_connect (G_OBJECT (obj), "response", G_CALLBACK 
(cb_dialog_response), obj);
+
+  device = xfburn_device_box_get_selected_device (XFBURN_DEVICE_BOX 
(priv->device_box));
+  if (device)
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->check_dummy), 
!device->dummy_write);
 }
 
 /*************/
 /* internals */
 /*************/
 static void
-xfburn_burn_image_dialog_response_cb (XfburnBurnImageDialog * dialog, gint 
response_id, gpointer user_data)
+cb_device_changed (XfburnDeviceBox *box, XfburnDevice *device, 
XfburnBurnImageDialog * dialog) 
 {
+  XfburnBurnImageDialogPrivate *priv = XFBURN_BURN_IMAGE_DIALOG_GET_PRIVATE 
(dialog);
+
+  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->check_dummy), 
!device->dummy_write);
+}
+
+static void
+cb_dialog_response (XfburnBurnImageDialog * dialog, gint response_id, gpointer 
user_data)
+{
   /*
   if (response_id == GTK_RESPONSE_OK) {
     XfburnBurnImageDialogPrivate *priv = XFBURN_BURN_IMAGE_DIALOG_GET_PRIVATE 
(dialog);

Modified: xfburn/branches/libburn_trial/xfburn/xfburn-copy-dvd-dialog.c
===================================================================
--- xfburn/branches/libburn_trial/xfburn/xfburn-copy-dvd-dialog.c       
2006-12-24 16:13:31 UTC (rev 24182)
+++ xfburn/branches/libburn_trial/xfburn/xfburn-copy-dvd-dialog.c       
2006-12-24 20:49:17 UTC (rev 24183)
@@ -117,7 +117,7 @@
   g_object_unref (icon);
 
   /* reader devices list */
-  priv->device_box_src = xfburn_device_box_new (FALSE, FALSE);
+  priv->device_box_src = xfburn_device_box_new (FALSE, FALSE, FALSE);
   gtk_widget_show (priv->device_box_src);
   
   frame = xfce_create_framebox_with_content (_("DVD Reader device"), 
priv->device_box_src);
@@ -125,7 +125,7 @@
   gtk_box_pack_start (box, frame, FALSE, FALSE, BORDER);
 
   /* burning devices list */
-  priv->device_box_dest = xfburn_device_box_new (TRUE, TRUE);
+  priv->device_box_dest = xfburn_device_box_new (TRUE, TRUE, FALSE);
   gtk_widget_show (priv->device_box_dest);
 
   priv->frame_burn = xfce_create_framebox_with_content (_("Burning device"), 
priv->device_box_dest);

Modified: xfburn/branches/libburn_trial/xfburn/xfburn-device-box.c
===================================================================
--- xfburn/branches/libburn_trial/xfburn/xfburn-device-box.c    2006-12-24 
16:13:31 UTC (rev 24182)
+++ xfburn/branches/libburn_trial/xfburn/xfburn-device-box.c    2006-12-24 
20:49:17 UTC (rev 24183)
@@ -38,6 +38,7 @@
   PROP_0,
   PROP_SHOW_WRITERS_ONLY,
   PROP_SHOW_SPEED_SELECTION,
+  PROP_SHOW_MODE_SELECTION,
 };
 
 enum {
@@ -52,16 +53,26 @@
   SPEED_N_COLUMNS,
 };
 
+enum {
+  MODE_TEXT_COLUMN,
+  MODE_VALUE_COLUMN,
+  MODE_N_COLUMNS,
+};
+
 /* private struct */
 typedef struct
 {
   gboolean show_writers_only;
   gboolean show_speed_selection;
+  gboolean show_mode_selection;
   
   GtkWidget *combo_device;
   
   GtkWidget *hbox_speed_selection;
   GtkWidget *combo_speed;
+
+  GtkWidget *hbox_mode_selection;
+  GtkWidget *combo_mode;
 } XfburnDeviceBoxPrivate;
 
 /* prototypes */
@@ -70,7 +81,6 @@
 static void xfburn_device_box_get_property (GObject *object, guint prop_id, 
GValue *value, GParamSpec *pspec);
 static void xfburn_device_box_set_property (GObject *object, guint prop_id, 
const GValue *value, GParamSpec *pspec);
 
-static void fill_combo_speed (XfburnDeviceBox *box);
 static void cb_combo_device_changed (GtkComboBox *combo, XfburnDeviceBox *box);
 
 /* globals */
@@ -128,15 +138,19 @@
                                                         _("Show writers 
only"), FALSE, G_PARAM_READWRITE));
   g_object_class_install_property (object_class, PROP_SHOW_SPEED_SELECTION, 
                                    g_param_spec_boolean 
("show-speed-selection", _("Show speed selection"),
-                                                        _("Show speed 
selection list and refresh button"), 
+                                                        _("Show speed 
selection combo"), 
                                                         FALSE, 
G_PARAM_READWRITE));
+  g_object_class_install_property (object_class, PROP_SHOW_MODE_SELECTION, 
+                                   g_param_spec_boolean 
("show-mode-selection", _("Show mode selection"),
+                                                        _("Show mode selection 
combo"), 
+                                                        FALSE, 
G_PARAM_READWRITE));
 }
 
 static void
 xfburn_device_box_init (XfburnDeviceBox * box)
 {
   XfburnDeviceBoxPrivate *priv = XFBURN_DEVICE_BOX_GET_PRIVATE (box);
-  
+
   GtkWidget *label;
   GList *device = NULL;
   GtkListStore *store = NULL;
@@ -170,7 +184,7 @@
   gtk_widget_show (priv->hbox_speed_selection);
   gtk_box_pack_start (GTK_BOX (box), priv->hbox_speed_selection, FALSE, FALSE, 
BORDER);
 
-  label = gtk_label_new_with_mnemonic (_("_Speed :"));
+  label = gtk_label_new_with_mnemonic (_("_Speed:"));
   gtk_widget_show (label);
   gtk_box_pack_start (GTK_BOX (priv->hbox_speed_selection), label, FALSE, 
FALSE, BORDER);
 
@@ -184,6 +198,25 @@
   gtk_widget_show (priv->combo_speed);
   gtk_box_pack_start (GTK_BOX (priv->hbox_speed_selection), priv->combo_speed, 
TRUE, TRUE, BORDER);
 
+  /* mode */
+  priv->hbox_mode_selection = gtk_hbox_new (FALSE, 0);
+  gtk_widget_show (priv->hbox_mode_selection);
+  gtk_box_pack_start (GTK_BOX (box), priv->hbox_mode_selection, FALSE, FALSE, 
BORDER);
+
+  label = gtk_label_new_with_mnemonic (_("Write _mode:"));
+  gtk_widget_show (label);
+  gtk_box_pack_start (GTK_BOX (priv->hbox_mode_selection), label, FALSE, 
FALSE, BORDER);
+
+  store = gtk_list_store_new (MODE_N_COLUMNS, G_TYPE_STRING, G_TYPE_INT);
+  priv->combo_mode = gtk_combo_box_new_with_model (GTK_TREE_MODEL (store));
+  g_object_unref (store);
+
+  cell = gtk_cell_renderer_text_new ();
+  gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (priv->combo_mode), cell, TRUE);
+  gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (priv->combo_mode), cell, 
"text", MODE_TEXT_COLUMN, NULL);
+  gtk_widget_show (priv->combo_mode);
+  gtk_box_pack_start (GTK_BOX (priv->hbox_mode_selection), priv->combo_mode, 
TRUE, TRUE, BORDER);
+
   g_signal_connect (G_OBJECT (priv->combo_device), "changed", G_CALLBACK 
(cb_combo_device_changed), box);
   gtk_combo_box_set_active (GTK_COMBO_BOX (priv->combo_device), 0);
 }
@@ -200,6 +233,9 @@
     case PROP_SHOW_SPEED_SELECTION:
       g_value_set_boolean (value, priv->show_speed_selection);
       break;
+    case PROP_SHOW_MODE_SELECTION:
+      g_value_set_boolean (value, priv->show_mode_selection);
+      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -222,6 +258,13 @@
       else
         gtk_widget_hide (priv->hbox_speed_selection);
       break;
+  case PROP_SHOW_MODE_SELECTION:
+      priv->show_mode_selection = g_value_get_boolean (value);
+      if (priv->show_mode_selection)
+        gtk_widget_show (priv->hbox_mode_selection);
+      else
+        gtk_widget_hide (priv->hbox_mode_selection);
+      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -232,10 +275,9 @@
 /* internals */
 /*************/
 static void
-fill_combo_speed (XfburnDeviceBox *box)
+fill_combo_speed (XfburnDeviceBox *box, XfburnDevice *device)
 {
   XfburnDeviceBoxPrivate *priv = XFBURN_DEVICE_BOX_GET_PRIVATE (box);
-  XfburnDevice *device = xfburn_device_box_get_selected_device (box);
   GtkTreeModel *model = gtk_combo_box_get_model (GTK_COMBO_BOX 
(priv->combo_speed));
   gint i;
 
@@ -255,28 +297,58 @@
 }
 
 static void
+fill_combo_mode (XfburnDeviceBox *box, XfburnDevice *device)
+{
+  XfburnDeviceBoxPrivate *priv = XFBURN_DEVICE_BOX_GET_PRIVATE (box);
+  GtkTreeModel *model = gtk_combo_box_get_model (GTK_COMBO_BOX 
(priv->combo_mode));
+  GtkTreeIter iter;
+
+  gtk_list_store_clear (GTK_LIST_STORE (model));
+
+  if (device->tao_block_types) {
+    gtk_list_store_append (GTK_LIST_STORE (model), &iter);
+    gtk_list_store_set (GTK_LIST_STORE (model), &iter, MODE_TEXT_COLUMN, 
"TAO", MODE_VALUE_COLUMN, WRITE_MODE_TAO, -1);
+  }
+  if (device->sao_block_types) {
+    gtk_list_store_append (GTK_LIST_STORE (model), &iter);
+    gtk_list_store_set (GTK_LIST_STORE (model), &iter, MODE_TEXT_COLUMN, 
"SAO", MODE_VALUE_COLUMN, WRITE_MODE_SAO, -1);
+  }
+  if (device->raw_block_types) {
+    gtk_list_store_append (GTK_LIST_STORE (model), &iter);
+    gtk_list_store_set (GTK_LIST_STORE (model), &iter, MODE_TEXT_COLUMN, 
"RAW", MODE_VALUE_COLUMN, WRITE_MODE_RAW, -1);
+  }
+  if (device->packet_block_types) {
+    gtk_list_store_append (GTK_LIST_STORE (model), &iter);
+    gtk_list_store_set (GTK_LIST_STORE (model), &iter, MODE_TEXT_COLUMN, 
"packet", MODE_VALUE_COLUMN, WRITE_MODE_PACKET, -1);
+  }
+  
+  gtk_combo_box_set_active (GTK_COMBO_BOX (priv->combo_mode), 0);
+}
+
+static void
 cb_combo_device_changed (GtkComboBox *combo, XfburnDeviceBox *box)
 {
-  gchar *device_name = NULL;
+  XfburnDevice *device;
   
-  fill_combo_speed (box);
+  device = xfburn_device_box_get_selected_device (box);
 
-  device_name =  gtk_combo_box_get_active_text (combo);  
-  g_signal_emit (G_OBJECT (box), signals[DEVICE_CHANGED], 0, device_name);
-  
-  g_free (device_name);
+  fill_combo_speed (box, device);
+  fill_combo_mode (box,device);
+
+  g_signal_emit (G_OBJECT (box), signals[DEVICE_CHANGED], 0, device);
 }
 
 /******************/
 /* public methods */
 /******************/
 GtkWidget *
-xfburn_device_box_new (gboolean show_writers_only, gboolean 
show_speed_selection)
+xfburn_device_box_new (gboolean show_writers_only, gboolean 
show_speed_selection, gboolean show_mode_selection)
 {
   GtkWidget *obj;
 
   obj = g_object_new (xfburn_device_box_get_type (), "show-writers-only", 
show_writers_only, 
-                      "show-speed-selection", show_speed_selection, NULL);
+                      "show-speed-selection", show_speed_selection, 
+                     "show-mode-selection", show_mode_selection, NULL);
 
   return obj;
 }
@@ -320,7 +392,7 @@
   GtkTreeIter iter;
   gint speed = -1;
 
-  g_return_val_if_fail (priv->show_speed_selection == TRUE, -1);
+  g_return_val_if_fail (priv->show_speed_selection, -1);
 
   model = gtk_combo_box_get_model (GTK_COMBO_BOX (priv->combo_speed));
   gtk_combo_box_get_active_iter (GTK_COMBO_BOX (priv->combo_speed), &iter);
@@ -328,3 +400,21 @@
 
   return speed;
 }
+
+XfburnWriteMode
+xfburn_device_box_get_mode (XfburnDeviceBox *box)
+{
+  XfburnDeviceBoxPrivate *priv = XFBURN_DEVICE_BOX_GET_PRIVATE (box);
+  
+  GtkTreeModel *model;
+  GtkTreeIter iter;
+  gint mode = -1;
+
+  g_return_val_if_fail (priv->show_mode_selection, -1);
+
+  model = gtk_combo_box_get_model (GTK_COMBO_BOX (priv->combo_mode));
+  gtk_combo_box_get_active_iter (GTK_COMBO_BOX (priv->combo_mode), &iter);
+  gtk_tree_model_get (model, &iter, SPEED_VALUE_COLUMN, &mode, -1);
+
+  return mode;
+}

Modified: xfburn/branches/libburn_trial/xfburn/xfburn-device-box.h
===================================================================
--- xfburn/branches/libburn_trial/xfburn/xfburn-device-box.h    2006-12-24 
16:13:31 UTC (rev 24182)
+++ xfburn/branches/libburn_trial/xfburn/xfburn-device-box.h    2006-12-24 
20:49:17 UTC (rev 24183)
@@ -46,17 +46,27 @@
 {
   GtkVBoxClass parent_class;
   
-  void (*device_changed) (XfburnDeviceBox *box, const gchar *selected_device);
+  void (*device_changed) (XfburnDeviceBox *box, XfburnDevice *device);
 } XfburnDeviceBoxClass;
 
+typedef enum
+{
+  WRITE_MODE_TAO,
+  WRITE_MODE_SAO,
+  WRITE_MODE_RAW,
+  WRITE_MODE_PACKET,
+} XfburnWriteMode;
+
 GtkType xfburn_device_box_get_type (void);
 
-GtkWidget *xfburn_device_box_new (gboolean show_writers_only, gboolean 
show_speed_selection);
+GtkWidget *xfburn_device_box_new (gboolean show_writers_only, gboolean 
show_speed_selection, gboolean show_mode_selection);
 
 gchar *xfburn_device_box_get_selected (XfburnDeviceBox *box);
 XfburnDevice *xfburn_device_box_get_selected_device (XfburnDeviceBox *box);
 
 gint xfburn_device_box_get_speed (XfburnDeviceBox *box);
 
+XfburnWriteMode xfburn_device_box_get_mode (XfburnDeviceBox *box);
+
 G_END_DECLS
 #endif

Modified: xfburn/branches/libburn_trial/xfburn/xfburn-device-list.c
===================================================================
--- xfburn/branches/libburn_trial/xfburn/xfburn-device-list.c   2006-12-24 
16:13:31 UTC (rev 24182)
+++ xfburn/branches/libburn_trial/xfburn/xfburn-device-list.c   2006-12-24 
20:49:17 UTC (rev 24183)
@@ -84,9 +84,18 @@
 
     device->cdr = drives[i].write_cdr;
     device->cdrw = drives[i].write_cdrw;
+    DBG ("max speed reported by libburn: %d", burn_drive_get_write_speed 
(drives[i].drive));
     device->min_cdr_speed = 2;
     device->max_cdr_speed = 48;
 
+    device->buffer_size = drives[i].buffer_size;
+    device->dummy_write = drives[i].write_simulate;
+
+    device->tao_block_types = drives[i].tao_block_types;
+    device->sao_block_types = drives[i].sao_block_types;
+    device->raw_block_types = drives[i].raw_block_types;
+    device->packet_block_types = drives[i].packet_block_types;
+
     device->dvdr = drives[i].write_dvdr;
     device->dvdram = drives[i].write_dvdram;
 

Modified: xfburn/branches/libburn_trial/xfburn/xfburn-device-list.h
===================================================================
--- xfburn/branches/libburn_trial/xfburn/xfburn-device-list.h   2006-12-24 
16:13:31 UTC (rev 24182)
+++ xfburn/branches/libburn_trial/xfburn/xfburn-device-list.h   2006-12-24 
20:49:17 UTC (rev 24183)
@@ -30,12 +30,19 @@
 {
   gchar *name;
   gchar *node_path;
+  gint buffer_size;
+  gboolean dummy_write;
   
   gboolean cdr;
   gboolean cdrw;
   gint min_cdr_speed;
   gint max_cdr_speed;
 
+  gint tao_block_types;
+  gint sao_block_types;
+  gint raw_block_types;
+  gint packet_block_types;
+
   gboolean dvdr;
   gboolean dvdram;
 

Modified: xfburn/branches/libburn_trial/xfburn/xfburn-format-dvd-dialog.c
===================================================================
--- xfburn/branches/libburn_trial/xfburn/xfburn-format-dvd-dialog.c     
2006-12-24 16:13:31 UTC (rev 24182)
+++ xfburn/branches/libburn_trial/xfburn/xfburn-format-dvd-dialog.c     
2006-12-24 20:49:17 UTC (rev 24183)
@@ -96,7 +96,7 @@
   g_object_unref (icon);
 
   /* devices list */
-  priv->device_box = xfburn_device_box_new (TRUE, TRUE);
+  priv->device_box = xfburn_device_box_new (TRUE, TRUE, FALSE);
   gtk_widget_show (priv->device_box);
 
   frame = xfce_create_framebox_with_content (_("Burning device"), 
priv->device_box);

_______________________________________________
Xfce4-commits mailing list
[email protected]
http://foo-projects.org/mailman/listinfo/xfce4-commits

Reply via email to