[Xfce4-commits] [xfce/thunar] 01/02: Store column width setting asynchronously and only once (Bug #15305)
noreply at xfce.org
noreply at xfce.org
Wed Jan 1 22:30:57 CET 2020
This is an automated email from the git hooks/post-receive script.
a n d r e p u s h e d a c o m m i t t o b r a n c h x f c e - 4 . 1 4
in repository xfce/thunar.
commit 806cf8e2cdbadbd3604ea959380bc60bc7d17469
Author: Andre Miranda <andreldm at xfce.org>
Date: Wed Jan 1 17:56:35 2020 -0300
Store column width setting asynchronously and only once (Bug #15305)
To avoid overloading Xfconf
---
thunar/thunar-column-model.c | 25 +++++++++++++++++++++++--
1 file changed, 23 insertions(+), 2 deletions(-)
diff --git a/thunar/thunar-column-model.c b/thunar/thunar-column-model.c
index 35ac6fc..d2fc88d 100644
--- a/thunar/thunar-column-model.c
+++ b/thunar/thunar-column-model.c
@@ -86,6 +86,7 @@ static void thunar_column_model_save_visible_columns (ThunarCol
static void thunar_column_model_notify_visible_columns (ThunarPreferences *preferences,
GParamSpec *pspec,
ThunarColumnModel *column_model);
+static gboolean thunar_column_model_set_column_width_timer (gpointer user_data);
@@ -113,6 +114,7 @@ struct _ThunarColumnModel
ThunarColumn order[THUNAR_N_VISIBLE_COLUMNS];
gboolean visible[THUNAR_N_VISIBLE_COLUMNS];
gint width[THUNAR_N_VISIBLE_COLUMNS];
+ guint save_width_timer_id;
};
@@ -720,6 +722,19 @@ thunar_column_model_notify_visible_columns (ThunarPreferences *preferences,
+static gboolean
+thunar_column_model_set_column_width_timer (gpointer user_data)
+{
+ ThunarColumnModel *column_model = THUNAR_COLUMN_MODEL (user_data);
+
+ thunar_column_model_save_column_widths (column_model);
+ column_model->save_width_timer_id = 0;
+
+ return FALSE;
+}
+
+
+
/**
* thunar_column_model_get_default:
*
@@ -998,8 +1013,14 @@ thunar_column_model_set_column_width (ThunarColumnModel *column_model,
/* apply the new value */
column_model->width[column] = width;
- /* store the settings */
- thunar_column_model_save_column_widths (column_model);
+ /* store the settings... */
+ if (column_model->save_width_timer_id != 0)
+ g_source_remove (column_model->save_width_timer_id);
+
+ /* ... asynchronously and only once to not overload xfconf */
+ column_model->save_width_timer_id = g_timeout_add (1000,
+ thunar_column_model_set_column_width_timer,
+ column_model);
}
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list