summaryrefslogtreecommitdiff
path: root/gtk/gtkfilesystemwin32.c
diff options
context:
space:
mode:
authorHans Breuer <hans@breuer.org>2004-11-30 22:56:35 +0000
committerHans Breuer <hans@src.gnome.org>2004-11-30 22:56:35 +0000
commit8dcf7d1d8a8fa69e21f318953c62b1aa49584c94 (patch)
tree28873528240f2316b97546579cfa04c8b144cac9 /gtk/gtkfilesystemwin32.c
parent35a3099ec676f0e4b62173154c377084c9f80640 (diff)
downloadgtk+-8dcf7d1d8a8fa69e21f318953c62b1aa49584c94.tar.gz
remove the disputable memset at the end of gdk_pixmap_new() - on X11 the
2004-11-30 Hans Breuer <hans@breuer.org> * gdk/win32/gdkpixmap-win32.c : remove the disputable memset at the end of gdk_pixmap_new() - on X11 the bits are not initialized either - fixes bug #145107 * gtk/gtkfilesystemwin32.c : add an idle handler to emit "volumes-changed" when drives are plugged in or removed. Fixes bug #137815
Diffstat (limited to 'gtk/gtkfilesystemwin32.c')
-rw-r--r--gtk/gtkfilesystemwin32.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/gtk/gtkfilesystemwin32.c b/gtk/gtkfilesystemwin32.c
index 9062888df0..f70fee98b2 100644
--- a/gtk/gtkfilesystemwin32.c
+++ b/gtk/gtkfilesystemwin32.c
@@ -64,6 +64,7 @@ struct _GtkFileSystemWin32
{
GObject parent_instance;
+ guint32 drives; /* bitmask as returned by GetLogicalDrives() */
GHashTable *folder_hash;
};
@@ -303,15 +304,33 @@ gtk_file_system_win32_finalize (GObject *object)
system_parent_class->finalize (object);
}
+static gboolean
+check_volumes (gpointer data)
+{
+ GtkFileSystemWin32 *fs_win32 = GTK_FILE_SYSTEM_WIN32 (data);
+
+ g_return_val_if_fail (fs_win32, FALSE);
+
+ if (fs_win32->drives != GetLogicalDrives())
+ g_signal_emit_by_name (fs_win32, "volumes-changed", 0);
+
+ return TRUE;
+}
+
static GSList *
gtk_file_system_win32_list_volumes (GtkFileSystem *file_system)
{
DWORD drives;
gchar drive[4] = "A:\\";
GSList *list = NULL;
+ GtkFileSystemWin32 *fs_win32 = (GtkFileSystemWin32 *)file_system;
drives = GetLogicalDrives();
+ fs_win32->drives = drives;
+ /* set up an idle handler for volume changes, every second should be enough */
+ g_timeout_add_full (0, 1000, check_volumes, fs_win32, NULL);
+
if (!drives)
g_warning ("GetLogicalDrives failed.");