[tracker] libtracker-miner: Don't signal status/progress so much & remove dups
- From: Martyn James Russell <mr src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [tracker] libtracker-miner: Don't signal status/progress so much & remove dups
- Date: Tue, 8 Sep 2009 16:05:10 +0000 (UTC)
commit 24e54a664883aace04db0e962a2b68171a20c110
Author: Martyn Russell <martyn lanedo com>
Date: Tue Sep 8 16:58:36 2009 +0100
libtracker-miner: Don't signal status/progress so much & remove dups
src/libtracker-miner/tracker-miner-fs.c | 2 --
src/libtracker-miner/tracker-miner.c | 30 +++++++++++++++++++++++++-----
2 files changed, 25 insertions(+), 7 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-miner-fs.c b/src/libtracker-miner/tracker-miner-fs.c
index e9ce966..058eac6 100644
--- a/src/libtracker-miner/tracker-miner-fs.c
+++ b/src/libtracker-miner/tracker-miner-fs.c
@@ -1376,8 +1376,6 @@ crawl_directories_start (TrackerMinerFS *fs)
return;
}
- g_object_set (fs, "status", _("Crawling"), NULL);
-
fs->private->timer = g_timer_new ();
fs->private->directories_found = 0;
diff --git a/src/libtracker-miner/tracker-miner.c b/src/libtracker-miner/tracker-miner.c
index bf2998a..2e9142e 100644
--- a/src/libtracker-miner/tracker-miner.c
+++ b/src/libtracker-miner/tracker-miner.c
@@ -243,15 +243,36 @@ miner_set_property (GObject *object,
g_free (miner->private->description);
miner->private->description = g_value_dup_string (value);
break;
- case PROP_STATUS:
+ case PROP_STATUS: {
+ const gchar *new_status;
+
+ new_status = g_value_get_string (value);
+ if (miner->private->status && new_status &&
+ strcmp (miner->private->status, new_status) == 0) {
+ /* Same, do nothing */
+ break;
+ }
+
g_free (miner->private->status);
- miner->private->status = g_value_dup_string (value);
+ miner->private->status = g_strdup (new_status);
miner_update_progress (miner);
break;
- case PROP_PROGRESS:
- miner->private->progress = g_value_get_double (value);
+ }
+ case PROP_PROGRESS: {
+ gdouble new_progress;
+
+ new_progress = g_value_get_double (value);
+
+ /* Only notify 1% changes */
+ if ((gint) (miner->private->progress * 100) == (gint) (new_progress * 100)) {
+ /* Same, do nothing */
+ break;
+ }
+
+ miner->private->progress = new_progress;
miner_update_progress (miner);
break;
+ }
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -655,7 +676,6 @@ tracker_miner_resume (TrackerMiner *miner,
return TRUE;
}
-
/* DBus methods */
void
tracker_miner_dbus_get_name (TrackerMiner *miner,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]