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

David Mohr squisher at xfce.org
Sun May 4 02:51:18 CEST 2008


Author: squisher
Date: 2008-05-04 00:51:17 +0000 (Sun, 04 May 2008)
New Revision: 4720

Modified:
   xfburn/trunk/xfburn/xfburn-device-box.c
Log:
Bugfix: don't complain about invalid disc if there is no available drive

Modified: xfburn/trunk/xfburn/xfburn-device-box.c
===================================================================
--- xfburn/trunk/xfburn/xfburn-device-box.c	2008-05-03 07:14:03 UTC (rev 4719)
+++ xfburn/trunk/xfburn/xfburn-device-box.c	2008-05-04 00:51:17 UTC (rev 4720)
@@ -104,7 +104,8 @@
 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 update_status_label_visibility();
+static void update_status_label_visibility ();
+static XfburnDevice * get_selected_device (XfburnDeviceBoxPrivate *priv);
 static void cb_speed_refresh_clicked (GtkButton *button, XfburnDeviceBox *box);
 static gboolean check_disc_validity (XfburnDeviceBoxPrivate *priv);
 static void cb_combo_device_changed (GtkComboBox *combo, XfburnDeviceBox *box);
@@ -503,8 +504,11 @@
           gtk_label_set_markup (GTK_LABEL(priv->status_label), _("<span weight=\"bold\" foreground=\"darkred\" stretch=\"semiexpanded\">No access to drive (mounted?)</span>"));
           break;
         default:
-          gtk_label_set_markup (GTK_LABEL(priv->status_label), _("<span weight=\"bold\" foreground=\"darkred\" stretch=\"semiexpanded\">Error determining disc!</span>"));
-          DBG ("weird disc_status = %d", disc_status);
+          /* if there is no detected device, then don't print an error message as it is expected to not have a disc status */
+          if (get_selected_device (priv) != NULL) {
+            gtk_label_set_markup (GTK_LABEL(priv->status_label), _("<span weight=\"bold\" foreground=\"darkred\" stretch=\"semiexpanded\">Error determining disc!</span>"));
+            DBG ("weird disc_status = %d", disc_status);
+          }
       }
     }
   } else {
@@ -578,6 +582,23 @@
   gtk_combo_box_set_active (GTK_COMBO_BOX (priv->combo_mode), 0);
 }
 
+static XfburnDevice *
+get_selected_device (XfburnDeviceBoxPrivate *priv)
+{
+
+  GtkTreeModel *model;
+  GtkTreeIter iter;
+  XfburnDevice * device = NULL;
+  gboolean ret;
+
+  model = gtk_combo_box_get_model (GTK_COMBO_BOX (priv->combo_device));
+  ret = gtk_combo_box_get_active_iter (GTK_COMBO_BOX (priv->combo_device), &iter);
+  if (ret)
+    gtk_tree_model_get (model, &iter, DEVICE_POINTER_COLUMN, &device, -1);
+
+  return device;
+}
+
 static void
 cb_speed_refresh_clicked (GtkButton *button, XfburnDeviceBox *box)
 {
@@ -665,17 +686,8 @@
 xfburn_device_box_get_selected_device (XfburnDeviceBox *box)
 {
   XfburnDeviceBoxPrivate *priv = XFBURN_DEVICE_BOX_GET_PRIVATE (box);
-  GtkTreeModel *model;
-  GtkTreeIter iter;
-  XfburnDevice * device = NULL;
-  gboolean ret;
 
-  model = gtk_combo_box_get_model (GTK_COMBO_BOX (priv->combo_device));
-  ret = gtk_combo_box_get_active_iter (GTK_COMBO_BOX (priv->combo_device), &iter);
-  if (ret)
-    gtk_tree_model_get (model, &iter, DEVICE_POINTER_COLUMN, &device, -1);
-
-  return device;
+  return get_selected_device (priv);
 }
 
 gint




More information about the Goodies-commits mailing list