summaryrefslogtreecommitdiff
path: root/libcaja-private/caja-progress-info.c
diff options
context:
space:
mode:
authoremanuele-f <[email protected]>2016-06-12 01:08:39 +0200
committerlukefromdc <[email protected]>2016-10-17 14:05:36 -0400
commitb33833f44adbfaa9e4b188e56af20c9a189b2664 (patch)
tree18a07d85ff8c1431205dbdba3b5ecb0f58d4e3ce /libcaja-private/caja-progress-info.c
parenta17a2a6f28d6c5c3b3726879d12eabafe5ad98a2 (diff)
downloadcaja-b33833f44adbfaa9e4b188e56af20c9a189b2664.tar.bz2
caja-b33833f44adbfaa9e4b188e56af20c9a189b2664.tar.xz
fix GSource leak and little changes
Diffstat (limited to 'libcaja-private/caja-progress-info.c')
-rw-r--r--libcaja-private/caja-progress-info.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/libcaja-private/caja-progress-info.c b/libcaja-private/caja-progress-info.c
index 26faf6ae..f4e28c0c 100644
--- a/libcaja-private/caja-progress-info.c
+++ b/libcaja-private/caja-progress-info.c
@@ -284,6 +284,11 @@ typedef enum
STATE_QUEUED
} ProgressWidgetState;
+static gboolean
+is_op_paused (ProgressWidgetState state) {
+ return state == STATE_PAUSED || state == STATE_QUEUED;
+}
+
typedef struct _ProgressWidgetData
{
GtkWidget *widget;
@@ -355,14 +360,13 @@ get_widgets_container ()
return gtk_bin_get_child (GTK_BIN (window));
}
-
static void
foreach_get_running_operations (GtkWidget * widget, int * n)
{
ProgressWidgetData *data = (ProgressWidgetData*) g_object_get_data (
G_OBJECT(widget), "data");
- if (data->state == STATE_RUNNING)
+ if (! is_op_paused (data->state))
(*n)++;
}
@@ -467,8 +471,7 @@ widget_reposition_as_paused (GtkWidget * widget, GtkWidget * container)
if (child->data == widget)
mypos = i;
- if (child->data != widget && (data->state == STATE_PAUSED ||
- data->state == STATE_QUEUED)) {
+ if (child->data != widget && is_op_paused(data->state)) {
abort = TRUE;
i--;
}
@@ -502,7 +505,7 @@ widget_reposition_as_running (GtkWidget * widget, GtkWidget * container)
if (child->data == widget)
mypos = i;
- if (data->state == STATE_PAUSED || data->state == STATE_QUEUED) {
+ if (is_op_paused(data->state)) {
abort = TRUE;
}
@@ -640,13 +643,12 @@ progress_widget_invalid_state (ProgressWidgetData *data)
static int
widget_state_notify_paused_callback (ProgressWidgetData *data)
{
- if (data == NULL)
- return G_SOURCE_CONTINUE;
-
- if (data->state == STATE_PAUSING)
- widget_state_transit_to (data, STATE_PAUSED);
- else if (data->state == STATE_QUEUEING)
- widget_state_transit_to (data, STATE_QUEUED);
+ if (data != NULL) {
+ if (data->state == STATE_PAUSING)
+ widget_state_transit_to (data, STATE_PAUSED);
+ else if (data->state == STATE_QUEUEING)
+ widget_state_transit_to (data, STATE_QUEUED);
+ }
return G_SOURCE_REMOVE;
}