[Xfce4-commits] <thunar:master> Don't idle the volume loading in the shortcuts model.
Nick Schermer
noreply at xfce.org
Thu Dec 27 13:10:02 CET 2012
Updating branch refs/heads/master
to a8a2ce8c41578ece8fdcd79c9ab82eed6e0073d5 (commit)
from 0ba896ba9342f464b284a2513fa49280949cdc13 (commit)
commit a8a2ce8c41578ece8fdcd79c9ab82eed6e0073d5
Author: Nick Schermer <nick at xfce.org>
Date: Thu Dec 27 13:08:35 2012 +0100
Don't idle the volume loading in the shortcuts model.
Not needed because the device monitor is started in sync
in other objects. Also caused a crash if the model was
finalized before the monitor was loaded.
thunar/thunar-shortcuts-model.c | 28 +++++++---------------------
1 files changed, 7 insertions(+), 21 deletions(-)
diff --git a/thunar/thunar-shortcuts-model.c b/thunar/thunar-shortcuts-model.c
index 5f6ab62..ce05c9d 100644
--- a/thunar/thunar-shortcuts-model.c
+++ b/thunar/thunar-shortcuts-model.c
@@ -115,9 +115,9 @@ static gboolean thunar_shortcuts_model_drag_data_get (GtkTreeDrag
static gboolean thunar_shortcuts_model_drag_data_delete (GtkTreeDragSource *source,
GtkTreePath *path);
static void thunar_shortcuts_model_header_visibility (ThunarShortcutsModel *model);
+static void thunar_shortcuts_model_shortcut_devices (ThunarShortcutsModel *model);
static void thunar_shortcuts_model_shortcut_places (ThunarShortcutsModel *model);
static void thunar_shortcuts_model_shortcut_network (ThunarShortcutsModel *model);
-static gboolean thunar_shortcuts_model_devices_load (gpointer data);
static gboolean thunar_shortcuts_model_get_hidden (ThunarShortcutsModel *model,
ThunarShortcut *shortcut);
static void thunar_shortcuts_model_add_shortcut (ThunarShortcutsModel *model,
@@ -173,7 +173,6 @@ struct _ThunarShortcutsModel
gchar **hidden_bookmarks;
ThunarDeviceMonitor *device_monitor;
- guint devices_monitor_idle_id;
gint64 bookmarks_time;
GFile *bookmarks_file;
@@ -273,7 +272,7 @@ thunar_shortcuts_model_init (ThunarShortcutsModel *model)
G_OBJECT (model), "hidden-bookmarks");
/* load volumes */
- model->devices_monitor_idle_id = g_idle_add_full (G_PRIORITY_DEFAULT, thunar_shortcuts_model_devices_load, model, NULL);
+ thunar_shortcuts_model_shortcut_devices (model);
/* add network */
thunar_shortcuts_model_shortcut_network (model);
@@ -299,10 +298,6 @@ thunar_shortcuts_model_finalize (GObject *object)
if (model->bookmarks_idle_id != 0)
g_source_remove (model->bookmarks_idle_id);
- /* stop device monitor loading */
- if (model->devices_monitor_idle_id != 0)
- g_source_remove (model->devices_monitor_idle_id);
-
/* free all shortcuts */
g_list_foreach (model->shortcuts, (GFunc) thunar_shortcut_free, model);
g_list_free (model->shortcuts);
@@ -877,15 +872,12 @@ thunar_shortcuts_model_header_visibility (ThunarShortcutsModel *model)
-static gboolean
-thunar_shortcuts_model_devices_load (gpointer data)
+static void
+thunar_shortcuts_model_shortcut_devices (ThunarShortcutsModel *model)
{
- ThunarShortcutsModel *model = THUNAR_SHORTCUTS_MODEL (data);
- ThunarShortcut *shortcut;
- GList *devices;
- GList *lp;
-
- GDK_THREADS_ENTER ();
+ ThunarShortcut *shortcut;
+ GList *devices;
+ GList *lp;
/* add the devices heading */
shortcut = g_slice_new0 (ThunarShortcut);
@@ -914,18 +906,12 @@ thunar_shortcuts_model_devices_load (gpointer data)
}
g_list_free (devices);
- GDK_THREADS_LEAVE ();
-
/* monitor for changes */
g_signal_connect (model->device_monitor, "device-added", G_CALLBACK (thunar_shortcuts_model_device_added), model);
g_signal_connect (model->device_monitor, "device-removed", G_CALLBACK (thunar_shortcuts_model_device_removed), model);
g_signal_connect (model->device_monitor, "device-changed", G_CALLBACK (thunar_shortcuts_model_device_changed), model);
thunar_shortcuts_model_header_visibility (model);
-
- model->devices_monitor_idle_id = 0;
-
- return FALSE;
}
More information about the Xfce4-commits
mailing list