[gnome-multi-writer] trivial: Detect if the ISO changes
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-multi-writer] trivial: Detect if the ISO changes
- Date: Wed, 28 Jan 2015 13:29:51 +0000 (UTC)
commit ad1c730122165fa549a50cc4f6386a91bd011db2
Author: Richard Hughes <richard hughsie com>
Date: Tue Jan 27 15:21:06 2015 +0000
trivial: Detect if the ISO changes
We don't actually do anything with this information yet.
src/gmw-main.c | 28 ++++++++++++++++++++++++++++
1 files changed, 28 insertions(+), 0 deletions(-)
---
diff --git a/src/gmw-main.c b/src/gmw-main.c
index 0a4b687..396cf79 100644
--- a/src/gmw-main.c
+++ b/src/gmw-main.c
@@ -43,6 +43,7 @@ typedef struct {
typedef struct {
GFile *image_file;
+ GFileMonitor *image_monitor;
guint64 image_file_size;
gboolean rename_labels;
GPtrArray *devices;
@@ -939,6 +940,19 @@ gmw_update_title (GmwPrivate *priv)
}
/**
+ * gmw_set_image_file_changed_cb:
+ **/
+static void
+gmw_set_image_file_changed_cb (GFileMonitor *monitor,
+ GFile *file,
+ GFile *other_file,
+ GFileMonitorEvent event_type,
+ GmwPrivate *priv)
+{
+ g_debug ("ISO file changed");
+}
+
+/**
* gmw_set_image_filename:
**/
static void
@@ -949,7 +963,19 @@ gmw_set_image_filename (GmwPrivate *priv, const gchar *filename)
if (priv->image_file != NULL)
g_object_unref (priv->image_file);
+ if (priv->image_monitor != NULL)
+ g_object_unref (priv->image_monitor);
priv->image_file = g_file_new_for_path (filename);
+ priv->image_monitor = g_file_monitor (priv->image_file,
+ G_FILE_MONITOR_NONE,
+ NULL, &error);
+ if (priv->image_monitor == NULL) {
+ /* TRANSLATORS: we couldn't open the ISO file the user chose */
+ gmw_error_dialog (priv, _("Failed to open"), error->message);
+ return;
+ }
+ g_signal_connect (priv->image_monitor, "changed",
+ G_CALLBACK (gmw_set_image_file_changed_cb), priv);
/* get the size of the ISO file */
info = g_file_query_info (priv->image_file,
@@ -1824,6 +1850,8 @@ out:
g_object_unref (priv->usb_ctx);
if (priv->image_file != NULL)
g_object_unref (priv->image_file);
+ if (priv->image_monitor != NULL)
+ g_object_unref (priv->image_monitor);
if (priv->cancellable != NULL)
g_object_unref (priv->cancellable);
if (priv->application != NULL)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]