[brasero/gnome-2-28] Forgotten file + cosmetic code change for readability



commit 9df71dc10b30be58820bfb84aa539a88abc09724
Author: Philippe Rouquier <bonfire-app wanadoo fr>
Date:   Sun Oct 4 12:58:10 2009 +0200

    Forgotten file + cosmetic code change for readability

 libbrasero-media/brasero-drive-priv.h     |   43 ++++++++++++++
 libbrasero-media/brasero-medium-monitor.c |   88 +++++++++++-----------------
 2 files changed, 78 insertions(+), 53 deletions(-)
---
diff --git a/libbrasero-media/brasero-drive-priv.h b/libbrasero-media/brasero-drive-priv.h
new file mode 100644
index 0000000..c6dc1a0
--- /dev/null
+++ b/libbrasero-media/brasero-drive-priv.h
@@ -0,0 +1,43 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/*
+ * Libbrasero-media
+ * Copyright (C) Philippe Rouquier 2005-2009 <bonfire-app wanadoo fr>
+ *
+ * Libbrasero-media is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * The Libbrasero-media authors hereby grant permission for non-GPL compatible
+ * GStreamer plugins to be used and distributed together with GStreamer
+ * and Libbrasero-media. This permission is above and beyond the permissions granted
+ * by the GPL license by which Libbrasero-media is covered. If you modify this code
+ * you may extend this exception to your version of the code, but you are not
+ * obligated to do so. If you do not wish to do so, delete this exception
+ * statement from your version.
+ * 
+ * Libbrasero-media is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Library General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to:
+ * 	The Free Software Foundation, Inc.,
+ * 	51 Franklin Street, Fifth Floor
+ * 	Boston, MA  02110-1301, USA.
+ */
+
+#include "brasero-drive.h"
+
+#ifndef _BURN_DRIVE_PRIV_H_
+#define _BURN_DRIVE_PRIV_H_
+
+G_BEGIN_DECLS
+
+gboolean
+brasero_drive_probing (BraseroDrive *drive);
+
+G_END_DECLS
+
+#endif
diff --git a/libbrasero-media/brasero-medium-monitor.c b/libbrasero-media/brasero-medium-monitor.c
index 7721c62..770207b 100644
--- a/libbrasero-media/brasero-medium-monitor.c
+++ b/libbrasero-media/brasero-medium-monitor.c
@@ -389,6 +389,37 @@ brasero_medium_monitor_is_drive (BraseroMediumMonitor *monitor,
 	return result;
 }
 
+static BraseroDrive *
+brasero_medium_monitor_drive_new (BraseroMediumMonitor *self,
+                                  const gchar *device,
+                                  GDrive *gdrive)
+{
+	BraseroMediumMonitorPrivate *priv;
+	BraseroDrive *drive;
+
+	if (!brasero_medium_monitor_is_drive (self, device))
+		return NULL;
+
+	priv = BRASERO_MEDIUM_MONITOR_PRIVATE (self);
+	drive = g_object_new (BRASERO_TYPE_DRIVE,
+	                      "device", device,
+			      "gdrive", gdrive,
+			      NULL);
+
+	priv->drives = g_slist_prepend (priv->drives, drive);
+
+	g_signal_connect (drive,
+			  "medium-added",
+			  G_CALLBACK (brasero_medium_monitor_medium_added_cb),
+			  self);
+	g_signal_connect (drive,
+			  "medium-removed",
+			  G_CALLBACK (brasero_medium_monitor_medium_removed_cb),
+			  self);
+
+	return drive;
+}
+
 static void
 brasero_medium_monitor_device_added (BraseroMediumMonitor *self,
                                      const gchar *device,
@@ -418,28 +449,11 @@ brasero_medium_monitor_device_added (BraseroMediumMonitor *self,
 	}
 
 	/* Make sure it's an optical drive */
-	if (!brasero_medium_monitor_is_drive (self, device))
+	drive = brasero_medium_monitor_drive_new (self, device, gdrive);
+	if (!drive)
 		return;
 
 	BRASERO_MEDIA_LOG ("New drive added");
-
-	drive = g_object_new (BRASERO_TYPE_DRIVE,
-	                      "device", device,
-	                      "gdrive", gdrive,
-	                      NULL);
-	priv->drives = g_slist_prepend (priv->drives, drive);
-
-	/* connect to signals. This must come before the g_signal_emit () so we
-	 * are the first to get an update on the medium inside. */
-	g_signal_connect (drive,
-			  "medium-added",
-			  G_CALLBACK (brasero_medium_monitor_medium_added_cb),
-			  self);
-	g_signal_connect (drive,
-			  "medium-removed",
-			  G_CALLBACK (brasero_medium_monitor_medium_removed_cb),
-			  self);
-
 	g_signal_emit (self,
 		       medium_monitor_signals [DRIVE_ADDED],
 		       0,
@@ -654,23 +668,7 @@ brasero_medium_monitor_init (BraseroMediumMonitor *object)
 		gdrive = iter->data;
 
 		device = g_drive_get_identifier (gdrive, G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE);
-		if (brasero_medium_monitor_is_drive (object, device)) {
-			drive = g_object_new (BRASERO_TYPE_DRIVE,
-			                      "device", device,
-					      "gdrive", gdrive,
-					      NULL);
-
-			priv->drives = g_slist_prepend (priv->drives, drive);
-
-			g_signal_connect (drive,
-					  "medium-added",
-					  G_CALLBACK (brasero_medium_monitor_medium_added_cb),
-					  object);
-			g_signal_connect (drive,
-					  "medium-removed",
-					  G_CALLBACK (brasero_medium_monitor_medium_removed_cb),
-					  object);
-		}
+		brasero_medium_monitor_drive_new (object, device, gdrive);
 		g_free (device);
 	}
 	g_list_foreach (drives, (GFunc) g_object_unref, NULL);
@@ -696,23 +694,7 @@ brasero_medium_monitor_init (BraseroMediumMonitor *object)
 			continue;
 		}
 
-		if (brasero_medium_monitor_is_drive (object, device)) {
-			drive = g_object_new (BRASERO_TYPE_DRIVE,
-			                      "device", device,
-			                      "gdrive", NULL,
-					      NULL);
-			priv->drives = g_slist_prepend (priv->drives, drive);
-
-			g_signal_connect (drive,
-					  "medium-added",
-					  G_CALLBACK (brasero_medium_monitor_medium_added_cb),
-					  object);
-			g_signal_connect (drive,
-					  "medium-removed",
-					  G_CALLBACK (brasero_medium_monitor_medium_removed_cb),
-					  object);
-		}
-
+		brasero_medium_monitor_drive_new (object, device, NULL);
 		g_free (device);
 	}
 	g_list_foreach (volumes, (GFunc) g_object_unref, NULL);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]