Author: pollux
Date: 2006-12-24 16:13:31 +0000 (Sun, 24 Dec 2006)
New Revision: 24182

Modified:
   xfburn/branches/libburn_trial/xfburn-toolbars.ui
   xfburn/branches/libburn_trial/xfburn.ui
   xfburn/branches/libburn_trial/xfburn/Makefile.am
   xfburn/branches/libburn_trial/xfburn/xfburn-burn-image-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-main-window.c
Log:
* remove dvd actions from GUI
* add filters in image selection dialog
* improve XfburnDeviceBox



Modified: xfburn/branches/libburn_trial/xfburn/Makefile.am
===================================================================
--- xfburn/branches/libburn_trial/xfburn/Makefile.am    2006-12-24 15:01:41 UTC 
(rev 24181)
+++ xfburn/branches/libburn_trial/xfburn/Makefile.am    2006-12-24 16:13:31 UTC 
(rev 24182)
@@ -44,6 +44,7 @@
        $(xfburn_headers)                                               \
        xfburn-adding-progress.c                                        \
        xfburn-blank-cd-dialog.c                                        \
+       xfburn-burn-image-dialog.c                                      \
        xfburn-composition.c                                            \
        xfburn-compositions-notebook.c                                  \
        xfburn-settings.c                                               \

Modified: xfburn/branches/libburn_trial/xfburn/xfburn-burn-image-dialog.c
===================================================================
--- xfburn/branches/libburn_trial/xfburn/xfburn-burn-image-dialog.c     
2006-12-24 15:01:41 UTC (rev 24181)
+++ xfburn/branches/libburn_trial/xfburn/xfburn-burn-image-dialog.c     
2006-12-24 16:13:31 UTC (rev 24182)
@@ -95,6 +95,7 @@
   XfburnBurnImageDialogPrivate *priv = XFBURN_BURN_IMAGE_DIALOG_GET_PRIVATE 
(obj);
   
   GdkPixbuf *icon = NULL;
+  GtkFileFilter *filter;
   GtkWidget *frame;
   GtkWidget *vbox;
   GtkWidget *hbox;
@@ -111,6 +112,16 @@
   priv->chooser_image = gtk_file_chooser_button_new (_("Image to burn"), 
GTK_FILE_CHOOSER_ACTION_OPEN);
   gtk_widget_show (priv->chooser_image);
 
+  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(priv->chooser_image), filter);
+  filter = gtk_file_filter_new ();
+  gtk_file_filter_set_name (filter, _("ISO images"));
+  gtk_file_filter_add_pattern (filter, "*.iso");
+  gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (priv->chooser_image), filter);
+  gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (priv->chooser_image), filter);
+
   frame = xfce_create_framebox_with_content (_("Image to burn"), 
priv->chooser_image);
   gtk_widget_show (frame);
   gtk_box_pack_start (box, frame, FALSE, FALSE, BORDER);
@@ -179,6 +190,7 @@
 static void
 xfburn_burn_image_dialog_response_cb (XfburnBurnImageDialog * dialog, gint 
response_id, gpointer user_data)
 {
+  /*
   if (response_id == GTK_RESPONSE_OK) {
     XfburnBurnImageDialogPrivate *priv = XFBURN_BURN_IMAGE_DIALOG_GET_PRIVATE 
(dialog);
     XfburnDevice *device;
@@ -211,6 +223,7 @@
     
     g_free (command);
   }
+  */
 }
 
 /* public */

Modified: xfburn/branches/libburn_trial/xfburn/xfburn-device-box.c
===================================================================
--- xfburn/branches/libburn_trial/xfburn/xfburn-device-box.c    2006-12-24 
15:01:41 UTC (rev 24181)
+++ xfburn/branches/libburn_trial/xfburn/xfburn-device-box.c    2006-12-24 
16:13:31 UTC (rev 24182)
@@ -40,6 +40,18 @@
   PROP_SHOW_SPEED_SELECTION,
 };
 
+enum {
+  DEVICE_NAME_COLUMN,
+  DEVICE_POINTER_COLUMN,
+  DEVICE_N_COLUMNS,
+};
+
+enum {
+  SPEED_TEXT_COLUMN,
+  SPEED_VALUE_COLUMN,
+  SPEED_N_COLUMNS,
+};
+
 /* private struct */
 typedef struct
 {
@@ -58,6 +70,7 @@
 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 */
@@ -124,12 +137,19 @@
 {
   XfburnDeviceBoxPrivate *priv = XFBURN_DEVICE_BOX_GET_PRIVATE (box);
   
-  GtkWidget *label, *img, *button;
+  GtkWidget *label;
   GList *device = NULL;
-  gint i;
+  GtkListStore *store = NULL;
+  GtkCellRenderer *cell;
   
   /* devices */
-  priv->combo_device = gtk_combo_box_new_text ();
+  store = gtk_list_store_new (DEVICE_N_COLUMNS, G_TYPE_STRING, G_TYPE_POINTER);
+  priv->combo_device = 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_device), cell, 
TRUE);
+  gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (priv->combo_device), cell, 
"text", DEVICE_NAME_COLUMN, NULL);
   gtk_widget_show (priv->combo_device);
   gtk_box_pack_start (GTK_BOX (box), priv->combo_device, FALSE, FALSE, BORDER);
 
@@ -137,15 +157,14 @@
 
   while (device) {
     XfburnDevice *device_data = (XfburnDevice *) device->data;
+    GtkTreeIter iter;
 
-    gtk_combo_box_append_text (GTK_COMBO_BOX (priv->combo_device), 
device_data->name);
+    gtk_list_store_append (store, &iter);
+    gtk_list_store_set (store, &iter, DEVICE_NAME_COLUMN, device_data->name, 
DEVICE_POINTER_COLUMN, device_data, -1);
 
     device = g_list_next (device);
   }
-  gtk_combo_box_set_active (GTK_COMBO_BOX (priv->combo_device), 0);
   
-  g_signal_connect (G_OBJECT (priv->combo_device), "changed", G_CALLBACK 
(cb_combo_device_changed), box);
-  
   /* speed */
   priv->hbox_speed_selection = gtk_hbox_new (FALSE, 0);
   gtk_widget_show (priv->hbox_speed_selection);
@@ -155,25 +174,18 @@
   gtk_widget_show (label);
   gtk_box_pack_start (GTK_BOX (priv->hbox_speed_selection), label, FALSE, 
FALSE, BORDER);
 
-  priv->combo_speed = gtk_combo_box_new_text ();
+  store = gtk_list_store_new (SPEED_N_COLUMNS, G_TYPE_STRING, G_TYPE_INT);
+  priv->combo_speed = 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_speed), cell, TRUE);
+  gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (priv->combo_speed), cell, 
"text", SPEED_TEXT_COLUMN, NULL);
   gtk_widget_show (priv->combo_speed);
   gtk_box_pack_start (GTK_BOX (priv->hbox_speed_selection), priv->combo_speed, 
TRUE, TRUE, BORDER);
 
-  for (i = 2; i <= 52; i += 2) {
-    gchar *str = NULL;
-
-    str = g_strdup_printf ("%d", i);
-    gtk_combo_box_append_text (GTK_COMBO_BOX (priv->combo_speed), str);
-    g_free (str);
-  }
-  gtk_combo_box_set_active (GTK_COMBO_BOX (priv->combo_speed), 19);
-
-  img = gtk_image_new_from_stock (GTK_STOCK_REFRESH, 
GTK_ICON_SIZE_SMALL_TOOLBAR);
-  gtk_widget_show (img);
-  button = gtk_button_new ();
-  gtk_container_add (GTK_CONTAINER (button), img);
-  gtk_widget_show (button);
-  gtk_box_pack_start (GTK_BOX (priv->hbox_speed_selection), button, FALSE, 
FALSE, 0);
+  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);
 }
 
 static void
@@ -220,12 +232,36 @@
 /* internals */
 /*************/
 static void
+fill_combo_speed (XfburnDeviceBox *box)
+{
+  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;
+
+  gtk_list_store_clear (GTK_LIST_STORE (model));
+
+  for (i = device->min_cdr_speed; i <= device->max_cdr_speed; i += 2) {
+    GtkTreeIter iter;
+    gchar *str = NULL;
+
+    str = g_strdup_printf ("%d", i);
+
+    gtk_list_store_append (GTK_LIST_STORE (model), &iter);
+    gtk_list_store_set (GTK_LIST_STORE (model), &iter, SPEED_TEXT_COLUMN, str, 
SPEED_VALUE_COLUMN, i, -1);
+    g_free (str);
+  }
+  gtk_combo_box_set_active (GTK_COMBO_BOX (priv->combo_speed), 
gtk_tree_model_iter_n_children (model, NULL) - 1);
+}
+
+static void
 cb_combo_device_changed (GtkComboBox *combo, XfburnDeviceBox *box)
 {
   gchar *device_name = NULL;
   
-  gtk_combo_box_get_active_text (combo);
-  
+  fill_combo_speed (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);
@@ -249,32 +285,46 @@
 xfburn_device_box_get_selected (XfburnDeviceBox *box)
 {
   XfburnDeviceBoxPrivate *priv = XFBURN_DEVICE_BOX_GET_PRIVATE (box);
-  
-  return gtk_combo_box_get_active_text (GTK_COMBO_BOX (priv->combo_device));
+  GtkTreeModel *model;
+  GtkTreeIter iter;
+  gchar *name = NULL;
+
+  model = gtk_combo_box_get_model (GTK_COMBO_BOX (priv->combo_device));
+  gtk_combo_box_get_active_iter (GTK_COMBO_BOX (priv->combo_device), &iter);
+  gtk_tree_model_get (model, &iter, DEVICE_NAME_COLUMN, &name, -1);
+
+  return name;
 }
 
 XfburnDevice *
 xfburn_device_box_get_selected_device (XfburnDeviceBox *box)
 {
   XfburnDeviceBoxPrivate *priv = XFBURN_DEVICE_BOX_GET_PRIVATE (box);
-  gchar *device_name = NULL;
+  GtkTreeModel *model;
+  GtkTreeIter iter;
   XfburnDevice * device = NULL;
-  
-  device_name = gtk_combo_box_get_active_text (GTK_COMBO_BOX 
(priv->combo_device));
-  device = xfburn_device_lookup_by_name (device_name);
-  g_free (device_name);
-  
+
+  model = gtk_combo_box_get_model (GTK_COMBO_BOX (priv->combo_device));
+  gtk_combo_box_get_active_iter (GTK_COMBO_BOX (priv->combo_device), &iter);
+  gtk_tree_model_get (model, &iter, DEVICE_POINTER_COLUMN, &device, -1);
+
   return device;
 }
 
-gchar *
+gint
 xfburn_device_box_get_speed (XfburnDeviceBox *box)
 {
   XfburnDeviceBoxPrivate *priv = XFBURN_DEVICE_BOX_GET_PRIVATE (box);
   
-  g_return_val_if_fail (priv->show_speed_selection == TRUE, NULL);
-  if (priv->show_speed_selection)
-    return gtk_combo_box_get_active_text (GTK_COMBO_BOX (priv->combo_speed));
-  else
-    return NULL;
+  GtkTreeModel *model;
+  GtkTreeIter iter;
+  gint speed = -1;
+
+  g_return_val_if_fail (priv->show_speed_selection == TRUE, -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);
+  gtk_tree_model_get (model, &iter, SPEED_VALUE_COLUMN, &speed, -1);
+
+  return speed;
 }

Modified: xfburn/branches/libburn_trial/xfburn/xfburn-device-box.h
===================================================================
--- xfburn/branches/libburn_trial/xfburn/xfburn-device-box.h    2006-12-24 
15:01:41 UTC (rev 24181)
+++ xfburn/branches/libburn_trial/xfburn/xfburn-device-box.h    2006-12-24 
16:13:31 UTC (rev 24182)
@@ -56,7 +56,7 @@
 gchar *xfburn_device_box_get_selected (XfburnDeviceBox *box);
 XfburnDevice *xfburn_device_box_get_selected_device (XfburnDeviceBox *box);
 
-gchar *xfburn_device_box_get_speed (XfburnDeviceBox *box);
+gint xfburn_device_box_get_speed (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 
15:01:41 UTC (rev 24181)
+++ xfburn/branches/libburn_trial/xfburn/xfburn-device-list.c   2006-12-24 
16:13:31 UTC (rev 24182)
@@ -35,6 +35,8 @@
 
 #include "xfburn-device-list.h"
 
+#define CDR_1X_SPEED 150
+
 /* private */
 static GList *devices = NULL;
 
@@ -76,11 +78,15 @@
   for (i = 0; i < n_drives; i++) {
     XfburnDevice *device = g_new0 (XfburnDevice, 1);
     gint ret = 0;
-
+    
     device->name = g_strconcat (drives[i].vendor, " ", drives[i].product, 
NULL);
     device->node_path = g_strdup (drives[i].location);
+
     device->cdr = drives[i].write_cdr;
     device->cdrw = drives[i].write_cdrw;
+    device->min_cdr_speed = 2;
+    device->max_cdr_speed = 48;
+
     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 
15:01:41 UTC (rev 24181)
+++ xfburn/branches/libburn_trial/xfburn/xfburn-device-list.h   2006-12-24 
16:13:31 UTC (rev 24182)
@@ -30,8 +30,12 @@
 {
   gchar *name;
   gchar *node_path;
+  
   gboolean cdr;
   gboolean cdrw;
+  gint min_cdr_speed;
+  gint max_cdr_speed;
+
   gboolean dvdr;
   gboolean dvdram;
 

Modified: xfburn/branches/libburn_trial/xfburn/xfburn-main-window.c
===================================================================
--- xfburn/branches/libburn_trial/xfburn/xfburn-main-window.c   2006-12-24 
15:01:41 UTC (rev 24181)
+++ xfburn/branches/libburn_trial/xfburn/xfburn-main-window.c   2006-12-24 
16:13:31 UTC (rev 24182)
@@ -391,12 +391,11 @@
 action_burn_image (GtkAction * action, XfburnMainWindow * window)
 {
   GtkWidget *dialog;
-  /*  
+
   dialog = xfburn_burn_image_dialog_new ();
   gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (window));
   gtk_dialog_run (GTK_DIALOG (dialog));
   gtk_widget_destroy (dialog);
-  */
 }
 
 static void

Modified: xfburn/branches/libburn_trial/xfburn-toolbars.ui
===================================================================
--- xfburn/branches/libburn_trial/xfburn-toolbars.ui    2006-12-24 15:01:41 UTC 
(rev 24181)
+++ xfburn/branches/libburn_trial/xfburn-toolbars.ui    2006-12-24 16:13:31 UTC 
(rev 24182)
@@ -17,13 +17,13 @@
     <!-- <toolitem id="copy-audio" /> -->
 
     <toolitem id="burn-cd" />
-
+<!--
     <separator />
 
     <toolitem id="format-dvd" />
     <toolitem id="copy-dvd" />
     <toolitem id="burn-dvd" />
-
+-->
     <separator />
 
     <toolitem id="refresh" />

Modified: xfburn/branches/libburn_trial/xfburn.ui
===================================================================
--- xfburn/branches/libburn_trial/xfburn.ui     2006-12-24 15:01:41 UTC (rev 
24181)
+++ xfburn/branches/libburn_trial/xfburn.ui     2006-12-24 16:13:31 UTC (rev 
24182)
@@ -32,11 +32,13 @@
       <menuitem action="copy-data"/>
       <menuitem action="burn-cd"/>
       <placeholder name="placeholder-action-cd"/>
+      <!--
       <separator />
       <menuitem action="format-dvd"/>
       <menuitem action="copy-dvd"/>
       <menuitem action="burn-dvd"/>
       <placeholder name="placeholder-action-dvd"/>
+      -->
     </menu>
     <menu action="view-menu">
       <menuitem action="refresh"/>

_______________________________________________
Xfce4-commits mailing list
Xfce4-commits@xfce.org
http://foo-projects.org/mailman/listinfo/xfce4-commits

Reply via email to