[eog] EogJobs: Fix signalling callbacks
- From: Felix Riemann <friemann src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [eog] EogJobs: Fix signalling callbacks
- Date: Sun, 16 Jun 2013 14:07:01 +0000 (UTC)
commit 420ad68cb6fa9d9dcbbb6034529e1f64a1479fe5
Author: Felix Riemann <friemann gnome org>
Date: Wed May 15 21:55:09 2013 +0200
EogJobs: Fix signalling callbacks
Make sure the callbacks are only called once each time.
src/eog-jobs.c | 22 ++++++++++++++--------
1 files changed, 14 insertions(+), 8 deletions(-)
---
diff --git a/src/eog-jobs.c b/src/eog-jobs.c
index 3866b15..430ec5f 100644
--- a/src/eog-jobs.c
+++ b/src/eog-jobs.c
@@ -49,9 +49,9 @@ enum {
static guint job_signals[LAST_SIGNAL];
/* notify signal funcs */
-static void notify_progress (EogJob *job);
-static void notify_cancelled (EogJob *job);
-static void notify_finished (EogJob *job);
+static gboolean notify_progress (EogJob *job);
+static gboolean notify_cancelled (EogJob *job);
+static gboolean notify_finished (EogJob *job);
/* gobject vfuncs */
static void eog_job_class_init (EogJobClass *class);
@@ -106,12 +106,12 @@ static void eog_job_save_progress_callback (EogImage *image,
gpointer data);
/* --------------------------- notify signal funcs --------------------------- */
-static void
+static gboolean
notify_progress (EogJob *job)
{
/* check if the current job was previously cancelled */
if (eog_job_is_cancelled (job))
- return;
+ return FALSE;
/* show info for debugging */
eog_debug_message (DEBUG_JOBS,
@@ -125,9 +125,10 @@ notify_progress (EogJob *job)
job_signals[PROGRESS],
0,
job->progress);
+ return FALSE;
}
-static void
+static gboolean
notify_cancelled (EogJob *job)
{
/* show info for debugging */
@@ -140,9 +141,11 @@ notify_cancelled (EogJob *job)
g_signal_emit (job,
job_signals[CANCELLED],
0);
+
+ return FALSE;
}
-static void
+static gboolean
notify_finished (EogJob *job)
{
/* show info for debugging */
@@ -155,6 +158,7 @@ notify_finished (EogJob *job)
g_signal_emit (job,
job_signals[FINISHED],
0);
+ return FALSE;
}
/* --------------------------------- EogJob ---------------------------------- */
@@ -320,6 +324,8 @@ eog_job_set_progress (EogJob *job,
g_return_if_fail (EOG_IS_JOB (job));
g_return_if_fail (progress >= 0.0 && progress <= 1.0);
+ g_object_ref (job);
+
/* --- enter critical section --- */
g_mutex_lock (job->mutex);
@@ -332,7 +338,7 @@ eog_job_set_progress (EogJob *job,
g_idle_add_full (G_PRIORITY_DEFAULT_IDLE,
(GSourceFunc) notify_progress,
job,
- NULL);
+ g_object_unref);
}
gboolean
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]