[Goodies-commits] r2856 - in xfce4-cddrive-plugin/trunk: . panel-plugin
Sylvain Reynal
syl at xfce.org
Sun Jun 24 21:17:08 CEST 2007
Author: syl
Date: 2007-06-24 19:17:08 +0000 (Sun, 24 Jun 2007)
New Revision: 2856
Modified:
xfce4-cddrive-plugin/trunk/ChangeLog
xfce4-cddrive-plugin/trunk/panel-plugin/cddrive-dialogs.c
xfce4-cddrive-plugin/trunk/panel-plugin/cddrive-monitor.c
Log:
fix wrong error handling when drive detection fails
Modified: xfce4-cddrive-plugin/trunk/ChangeLog
===================================================================
--- xfce4-cddrive-plugin/trunk/ChangeLog 2007-06-24 16:54:36 UTC (rev 2855)
+++ xfce4-cddrive-plugin/trunk/ChangeLog 2007-06-24 19:17:08 UTC (rev 2856)
@@ -1,11 +1,12 @@
2007-06-22 Sylvain Reynal <sreynal at nerim.net>
* === Released 0.1.0 ===
- - add "Network" section with a switch to enable/disable connections to freedb.org
- - add --enable-cddb/--disable-cddb switches to configure script (bug #3354)
- - fix useless expansion of the plugin in the panel (bug #3354)
+ - add "Network" section with a switch to enable/disable connections to freedb.org.
+ - add --enable-cddb/--disable-cddb switches to configure script (bug #3354).
+ - fix useless expansion of the plugin in the panel (bug #3354).
- fix bug that disabled the name entry when opening the configuration dialog
if the "use in tooltip" option was not selected.
+ - fix wrong error handling when drive detection fails (bug #3354).
2007-04-20 Sylvain Reynal <sreynal at nerim.net>
Modified: xfce4-cddrive-plugin/trunk/panel-plugin/cddrive-dialogs.c
===================================================================
--- xfce4-cddrive-plugin/trunk/panel-plugin/cddrive-dialogs.c 2007-06-24 16:54:36 UTC (rev 2855)
+++ xfce4-cddrive-plugin/trunk/panel-plugin/cddrive-dialogs.c 2007-06-24 19:17:08 UTC (rev 2856)
@@ -327,6 +327,24 @@
+static GtkWidget*
+cddrive_label_with_icon_new (const gchar *str, const gchar *stock_icon_id)
+{
+ GtkWidget *res;
+
+ res = gtk_hbox_new (FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (res),
+ gtk_image_new_from_stock (stock_icon_id,
+ GTK_ICON_SIZE_DIALOG),
+ FALSE, FALSE, 5);
+ gtk_box_pack_start (GTK_BOX (res),
+ gtk_label_new (str),
+ FALSE, FALSE, 5);
+ return res;
+}
+
+
+
static void
cddrive_add_fallback_entry (CddrivePlugin *cddrive,
GtkTable *table,
@@ -470,13 +488,18 @@
/* get infos (device path and model) for all detected CD-ROM drives */
drv_infos = cddrive_cdrom_drive_infos_new (&err);
- if (drv_infos == NULL)
- drv_wid = gtk_label_new (_("CD-ROM drive detection failed !"));
- /* 'err' is displayed after the dialog is shown; see at the end of this function */
+ if (err != NULL)
+ {
+ g_assert (drv_infos == NULL);
+ drv_wid = cddrive_label_with_icon_new (_("CD-ROM drive detection failed !"),
+ GTK_STOCK_DIALOG_ERROR);
+ /* 'err' is displayed after the dialog is shown; see at the end of this function. */
+ }
else
{
if (drv_infos [0] == NULL)
- drv_wid = gtk_label_new (_("No CD-ROM drive detected"));
+ drv_wid = cddrive_label_with_icon_new (_("No CD-ROM drive detected"),
+ GTK_STOCK_DIALOG_WARNING);
else
{
/* create the CD-ROM drivers combo box */
@@ -493,9 +516,9 @@
while (drv_infos [i] != NULL)
{
combo_txt = g_strconcat (drv_infos [i]->model,
- " ( ",
+ " (",
drv_infos [i]->device,
- " )",
+ ")",
NULL);
gtk_combo_box_append_text (GTK_COMBO_BOX (drv_wid), combo_txt);
if (cddrive->device != NULL &&
Modified: xfce4-cddrive-plugin/trunk/panel-plugin/cddrive-monitor.c
===================================================================
--- xfce4-cddrive-plugin/trunk/panel-plugin/cddrive-monitor.c 2007-06-24 16:54:36 UTC (rev 2855)
+++ xfce4-cddrive-plugin/trunk/panel-plugin/cddrive-monitor.c 2007-06-24 19:17:08 UTC (rev 2856)
@@ -226,6 +226,7 @@
+/* Return a NULL terminated array of all detected CD drives */
CddriveDriveInfo**
cddrive_cdrom_drive_infos_new (GError **error)
{
@@ -248,14 +249,14 @@
"storage.cdrom",
&count,
&derr);
- if (udis == NULL)
+ if (dbus_error_is_set (&derr))
{
cddrive_store_dbus_error (error, CDDRIVE_ERROR_FAILED, &derr);
dbus_error_free (&derr);
cddrive_close_hal_context (ctx);
return NULL;
}
-
+
res = (CddriveDriveInfo**) g_malloc0 ((count + 1) * sizeof (CddriveDriveInfo*));
for (i=0; i < count; i++)
More information about the Goodies-commits
mailing list