[kdbus] Do not set body message if signature field is empty
[platform/upstream/glib.git] / gio / gwin32volumemonitor.c
index 6b4844c..ce8aaf7 100644 (file)
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General
- * Public License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
- * Boston, MA 02111-1307, USA.
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
  *
  * Author: Alexander Larsson <alexl@redhat.com>
  *         David Zeuthen <davidz@redhat.com>
  *         Hans Breuer <hans@breuer.org>
  */
 
-#include <config.h>
+#include "config.h"
 
 #include <string.h>
 
 
 #include "gwin32volumemonitor.h"
 #include "gwin32mount.h"
+#include "gmount.h"
 #include "giomodule.h"
-#include "gioalias.h"
 
-#define _WIN32_WINNT 0x0500
 #include <windows.h>
 
 struct _GWin32VolumeMonitor {
   GNativeVolumeMonitor parent;
-
-  GList *volumes;
-  GList *mounts;
 };
 
 #define g_win32_volume_monitor_get_type _g_win32_volume_monitor_get_type
@@ -52,28 +46,17 @@ G_DEFINE_TYPE_WITH_CODE (GWin32VolumeMonitor, g_win32_volume_monitor, G_TYPE_NAT
                                                         "win32",
                                                         0));
                                                         
-static void
-g_win32_volume_monitor_finalize (GObject *object)
-{
-  GWin32VolumeMonitor *monitor;
-  
-  monitor = G_WIN32_VOLUME_MONITOR (object);
-
-  if (G_OBJECT_CLASS (g_win32_volume_monitor_parent_class)->finalize)
-    (*G_OBJECT_CLASS (g_win32_volume_monitor_parent_class)->finalize) (object);
-}
-
 /**
  * get_viewable_logical_drives:
- * 
+ *
  * Returns the list of logical and viewable drives as defined by
  * GetLogicalDrives() and the registry keys
  * Software\Microsoft\Windows\CurrentVersion\Policies\Explorer under
  * HKLM or HKCU. If neither key exists the result of
  * GetLogicalDrives() is returned.
  *
- * Return value: bitmask with same meaning as returned by GetLogicalDrives()
-**/
+ * Returns: bitmask with same meaning as returned by GetLogicalDrives()
+ */
 static guint32 
 get_viewable_logical_drives (void)
 {
@@ -126,13 +109,10 @@ get_viewable_logical_drives (void)
 static GList *
 get_mounts (GVolumeMonitor *volume_monitor)
 {
-  GWin32VolumeMonitor *monitor;
   DWORD   drives;
   gchar   drive[4] = "A:\\";
   GList *list = NULL;
   
-  monitor = G_WIN32_VOLUME_MONITOR (volume_monitor);
-
   drives = get_viewable_logical_drives ();
 
   if (!drives)
@@ -154,36 +134,45 @@ get_mounts (GVolumeMonitor *volume_monitor)
 static GList *
 get_volumes (GVolumeMonitor *volume_monitor)
 {
-  GWin32VolumeMonitor *monitor;
-  GList *l = NULL;
-  
-  monitor = G_WIN32_VOLUME_MONITOR (volume_monitor);
-
-  return l;
+  return NULL;
 }
 
 /* real hardware */
 static GList *
 get_connected_drives (GVolumeMonitor *volume_monitor)
 {
-  GWin32VolumeMonitor *monitor;
+  GList *list = NULL;
+
+#if 0
   HANDLE  find_handle;
   BOOL    found;
   wchar_t wc_name[MAX_PATH+1];
-  GList *list = NULL;
   
-  monitor = G_WIN32_VOLUME_MONITOR (volume_monitor);
-
   find_handle = FindFirstVolumeW (wc_name, MAX_PATH);
   found = (find_handle != INVALID_HANDLE_VALUE);
   while (found)
     {
+      /* I don't know what this code is supposed to do; clearly it now
+       * does nothing, the returned GList is always NULL. But what was
+       * this code supposed to be a start of? The volume names that
+       * the FindFirstVolume/FindNextVolume loop iterates over returns
+       * device names like
+       *
+       *   \Device\HarddiskVolume1
+       *   \Device\HarddiskVolume2
+       *   \Device\CdRom0
+       *
+       * No DOS devices there, so I don't see the point with the
+       * QueryDosDevice call below. Probably this code is confusing volumes
+       * with something else that does contain the mapping from DOS devices
+       * to volumes.
+       */
       wchar_t wc_dev_name[MAX_PATH+1];
-      guint trailing = wcslen(wc_name) - 1;
+      guint trailing = wcslen (wc_name) - 1;
 
       /* remove trailing backslash and leading \\?\\ */
       wc_name[trailing] = L'\0';
-      if (QueryDosDeviceW(&wc_name[4], wc_dev_name, MAX_PATH))
+      if (QueryDosDeviceW (&wc_name[4], wc_dev_name, MAX_PATH))
         {
           gchar *name = g_utf16_to_utf8 (wc_dev_name, -1, NULL, NULL, NULL);
           g_print ("%s\n", name);
@@ -194,6 +183,7 @@ get_connected_drives (GVolumeMonitor *volume_monitor)
     }
   if (find_handle != INVALID_HANDLE_VALUE)
     FindVolumeClose (find_handle);
+#endif
 
   return list;
 }
@@ -231,12 +221,9 @@ get_mount_for_mount_path (const char *mount_path,
 static void
 g_win32_volume_monitor_class_init (GWin32VolumeMonitorClass *klass)
 {
-  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
   GVolumeMonitorClass *monitor_class = G_VOLUME_MONITOR_CLASS (klass);
   GNativeVolumeMonitorClass *native_class = G_NATIVE_VOLUME_MONITOR_CLASS (klass);
   
-  gobject_class->finalize = g_win32_volume_monitor_finalize;
-
   monitor_class->get_mounts = get_mounts;
   monitor_class->get_volumes = get_volumes;
   monitor_class->get_connected_drives = get_connected_drives;
@@ -255,11 +242,11 @@ g_win32_volume_monitor_init (GWin32VolumeMonitor *win32_monitor)
   unix_monitor->mount_monitor = g_win32_mount_monitor_new ();
 
   g_signal_connect (win32_monitor->mount_monitor,
-                   "mounts_changed", G_CALLBACK (mounts_changed),
+                   "mounts-changed", G_CALLBACK (mounts_changed),
                    win32_monitor);
   
   g_signal_connect (win32_monitor->mount_monitor,
-                   "mountpoints_changed", G_CALLBACK (mountpoints_changed),
+                   "mountpoints-changed", G_CALLBACK (mountpoints_changed),
                    win32_monitor);
                    
   update_volumes (win32_monitor);