]> Pileus Git - ~andy/gtk/commitdiff
Move inclusion of <windows.h> before inclusion of <winsock.h>, to actually
authorTor Lillqvist <tml@iki.fi>
Sun, 24 Feb 2002 02:09:16 +0000 (02:09 +0000)
committerTor Lillqvist <tml@src.gnome.org>
Sun, 24 Feb 2002 02:09:16 +0000 (02:09 +0000)
2002-02-24  Tor Lillqvist  <tml@iki.fi>

* gtk/gtkfilesel.c: Move inclusion of <windows.h> before inclusion
of <winsock.h>, to actually get STRICT prototypes for Win32
API. Include glib.h early to get G_OS_WIN32 and G_WITH_CYGWIN.
Don't declare static functions that aren't defined if !HAVE_PWD_H
or if G_OS_WIN32.
(win32_gtk_add_drives_to_dir_list): Remove #if 0 code, reindent.
(gtk_file_selection_get_selections): Don't crash if nothing has
been selected.

ChangeLog
ChangeLog.pre-2-0
ChangeLog.pre-2-10
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtkfilesel.c

index aba8ba2e359f8d191393de1cb80d04294386c4f7..ded1b1d65edb34adff79fe049876dd1498a99fa9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2002-02-24  Tor Lillqvist  <tml@iki.fi>
+
+       * gtk/gtkfilesel.c: Move inclusion of <windows.h> before inclusion
+       of <winsock.h>, to actually get STRICT prototypes for Win32
+       API. Include glib.h early to get G_OS_WIN32 and G_WITH_CYGWIN.
+       Don't declare static functions that aren't defined if !HAVE_PWD_H
+       or if G_OS_WIN32.
+       (win32_gtk_add_drives_to_dir_list): Remove #if 0 code, reindent.
+       (gtk_file_selection_get_selections): Don't crash if nothing has
+       been selected.
+
 Sat Feb 23 20:33:29 2002  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtkplug.[ch] gtk/gtksocket.[ch] gtk/xembed.h: Implement 
index aba8ba2e359f8d191393de1cb80d04294386c4f7..ded1b1d65edb34adff79fe049876dd1498a99fa9 100644 (file)
@@ -1,3 +1,14 @@
+2002-02-24  Tor Lillqvist  <tml@iki.fi>
+
+       * gtk/gtkfilesel.c: Move inclusion of <windows.h> before inclusion
+       of <winsock.h>, to actually get STRICT prototypes for Win32
+       API. Include glib.h early to get G_OS_WIN32 and G_WITH_CYGWIN.
+       Don't declare static functions that aren't defined if !HAVE_PWD_H
+       or if G_OS_WIN32.
+       (win32_gtk_add_drives_to_dir_list): Remove #if 0 code, reindent.
+       (gtk_file_selection_get_selections): Don't crash if nothing has
+       been selected.
+
 Sat Feb 23 20:33:29 2002  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtkplug.[ch] gtk/gtksocket.[ch] gtk/xembed.h: Implement 
index aba8ba2e359f8d191393de1cb80d04294386c4f7..ded1b1d65edb34adff79fe049876dd1498a99fa9 100644 (file)
@@ -1,3 +1,14 @@
+2002-02-24  Tor Lillqvist  <tml@iki.fi>
+
+       * gtk/gtkfilesel.c: Move inclusion of <windows.h> before inclusion
+       of <winsock.h>, to actually get STRICT prototypes for Win32
+       API. Include glib.h early to get G_OS_WIN32 and G_WITH_CYGWIN.
+       Don't declare static functions that aren't defined if !HAVE_PWD_H
+       or if G_OS_WIN32.
+       (win32_gtk_add_drives_to_dir_list): Remove #if 0 code, reindent.
+       (gtk_file_selection_get_selections): Don't crash if nothing has
+       been selected.
+
 Sat Feb 23 20:33:29 2002  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtkplug.[ch] gtk/gtksocket.[ch] gtk/xembed.h: Implement 
index aba8ba2e359f8d191393de1cb80d04294386c4f7..ded1b1d65edb34adff79fe049876dd1498a99fa9 100644 (file)
@@ -1,3 +1,14 @@
+2002-02-24  Tor Lillqvist  <tml@iki.fi>
+
+       * gtk/gtkfilesel.c: Move inclusion of <windows.h> before inclusion
+       of <winsock.h>, to actually get STRICT prototypes for Win32
+       API. Include glib.h early to get G_OS_WIN32 and G_WITH_CYGWIN.
+       Don't declare static functions that aren't defined if !HAVE_PWD_H
+       or if G_OS_WIN32.
+       (win32_gtk_add_drives_to_dir_list): Remove #if 0 code, reindent.
+       (gtk_file_selection_get_selections): Don't crash if nothing has
+       been selected.
+
 Sat Feb 23 20:33:29 2002  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtkplug.[ch] gtk/gtksocket.[ch] gtk/xembed.h: Implement 
index aba8ba2e359f8d191393de1cb80d04294386c4f7..ded1b1d65edb34adff79fe049876dd1498a99fa9 100644 (file)
@@ -1,3 +1,14 @@
+2002-02-24  Tor Lillqvist  <tml@iki.fi>
+
+       * gtk/gtkfilesel.c: Move inclusion of <windows.h> before inclusion
+       of <winsock.h>, to actually get STRICT prototypes for Win32
+       API. Include glib.h early to get G_OS_WIN32 and G_WITH_CYGWIN.
+       Don't declare static functions that aren't defined if !HAVE_PWD_H
+       or if G_OS_WIN32.
+       (win32_gtk_add_drives_to_dir_list): Remove #if 0 code, reindent.
+       (gtk_file_selection_get_selections): Don't crash if nothing has
+       been selected.
+
 Sat Feb 23 20:33:29 2002  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtkplug.[ch] gtk/gtksocket.[ch] gtk/xembed.h: Implement 
index aba8ba2e359f8d191393de1cb80d04294386c4f7..ded1b1d65edb34adff79fe049876dd1498a99fa9 100644 (file)
@@ -1,3 +1,14 @@
+2002-02-24  Tor Lillqvist  <tml@iki.fi>
+
+       * gtk/gtkfilesel.c: Move inclusion of <windows.h> before inclusion
+       of <winsock.h>, to actually get STRICT prototypes for Win32
+       API. Include glib.h early to get G_OS_WIN32 and G_WITH_CYGWIN.
+       Don't declare static functions that aren't defined if !HAVE_PWD_H
+       or if G_OS_WIN32.
+       (win32_gtk_add_drives_to_dir_list): Remove #if 0 code, reindent.
+       (gtk_file_selection_get_selections): Don't crash if nothing has
+       been selected.
+
 Sat Feb 23 20:33:29 2002  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtkplug.[ch] gtk/gtksocket.[ch] gtk/xembed.h: Implement 
index aba8ba2e359f8d191393de1cb80d04294386c4f7..ded1b1d65edb34adff79fe049876dd1498a99fa9 100644 (file)
@@ -1,3 +1,14 @@
+2002-02-24  Tor Lillqvist  <tml@iki.fi>
+
+       * gtk/gtkfilesel.c: Move inclusion of <windows.h> before inclusion
+       of <winsock.h>, to actually get STRICT prototypes for Win32
+       API. Include glib.h early to get G_OS_WIN32 and G_WITH_CYGWIN.
+       Don't declare static functions that aren't defined if !HAVE_PWD_H
+       or if G_OS_WIN32.
+       (win32_gtk_add_drives_to_dir_list): Remove #if 0 code, reindent.
+       (gtk_file_selection_get_selections): Don't crash if nothing has
+       been selected.
+
 Sat Feb 23 20:33:29 2002  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/gtkplug.[ch] gtk/gtksocket.[ch] gtk/xembed.h: Implement 
index db7a02f40c6c4505ab637a51e5300b939628a07c..2140a4ae9e10dd3f2ab2e309c56b0de3f5656f03 100644 (file)
 #ifdef HAVE_PWD_H
 #include <pwd.h>
 #endif
+
+#include <glib.h>              /* Include early to get G_OS_WIN32 and
+                                * G_WITH_CYGWIN */
+
+#if defined(G_OS_WIN32) || defined(G_WITH_CYGWIN)
+#include <ctype.h>
+#define STRICT
+#include <windows.h>
+#undef STRICT
+#endif /* G_OS_WIN32 || G_WITH_CYGWIN */
 #ifdef HAVE_WINSOCK_H
 #include <winsock.h>           /* For gethostname */
 #endif
@@ -72,9 +82,6 @@
 #include "gtkdnd.h"
 #include "gtkeventbox.h"
 
-#if defined(G_OS_WIN32) || defined(G_WITH_CYGWIN)
-#define STRICT
-#include <windows.h>
 
 #ifdef G_OS_WIN32
 #include <direct.h>
 #ifndef S_ISDIR
 #define S_ISDIR(mode) ((mode)&_S_IFDIR)
 #endif
-
 #endif /* G_OS_WIN32 */
 
-#endif /* G_OS_WIN32 || G_WITH_CYGWIN */
-
 #define DIR_LIST_WIDTH   180
 #define DIR_LIST_HEIGHT  180
 #define FILE_LIST_WIDTH  180
@@ -329,7 +333,9 @@ static CompletionDirSent* open_new_dir     (gchar* dir_name,
 static gint           correct_dir_fullname (CompletionDir* cmpl_dir);
 static gint           correct_parent       (CompletionDir* cmpl_dir,
                                            struct stat *sbuf);
+#ifndef G_OS_WIN32
 static gchar*         find_parent_dir_fullname    (gchar* dirname);
+#endif
 static CompletionDir* attach_dir           (CompletionDirSent* sent,
                                            gchar* dir_name,
                                            CompletionState *cmpl_state);
@@ -338,8 +344,10 @@ static void           free_dir      (CompletionDir  *dir);
 static void           prune_memory_usage(CompletionState *cmpl_state);
 
 /* Completion operations */
+#ifdef HAVE_PWD_H
 static PossibleCompletion* attempt_homedir_completion(gchar* text_to_complete,
                                                      CompletionState *cmpl_state);
+#endif
 static PossibleCompletion* attempt_file_completion(CompletionState *cmpl_state);
 static CompletionDir* find_completion_dir(gchar* text_to_complete,
                                          gchar** remaining_text,
@@ -1913,39 +1921,28 @@ win32_gtk_add_drives_to_dir_list (GtkListStore *model)
 {
   gchar *textPtr;
   gchar buffer[128];
-  char volumeNameBuf[128];
   char formatBuffer[128];
   GtkTreeIter iter;
 
-  /* Get the Drives string */
+  /* Get the drives string */
   GetLogicalDriveStrings (sizeof (buffer), buffer);
 
   /* Add the drives as necessary */
   textPtr = buffer;
-  while (*textPtr != '\0') {
-    /* Get the volume information for this drive */
-    if ((tolower (textPtr[0]) != 'a') && (tolower (textPtr[0]) != 'b'))
-      {
-       /* Ignore floppies (?) */
-       DWORD maxComponentLength, flags;
-
-       GetVolumeInformation (textPtr,
-                             volumeNameBuf, sizeof(volumeNameBuf),
-                             NULL, &maxComponentLength,
-                             &flags, NULL, 0);
-       /* Build the actual displayable string */
-
-       sprintf (formatBuffer, "%c:\\", toupper(textPtr[0]));
-#if 0 /* HB: removed to allow drive change AND directory update with one click */
-       if (strlen (volumeNameBuf) > 0)
-         sprintf (formatBuffer, "%s (%s)", formatBuffer, volumeNameBuf);
-#endif
-       /* Add to the list */
-       gtk_list_store_append (model, &iter);
-       gtk_list_store_set (model, &iter, DIR_COLUMN, formatBuffer, -1);
-      }
-    textPtr += (strlen (textPtr) + 1);
-  }
+  while (*textPtr != '\0')
+    {
+      /* Ignore floppies (?) */
+      if ((tolower (textPtr[0]) != 'a') && (tolower (textPtr[0]) != 'b'))
+       {
+         /* Build the actual displayable string */
+         sprintf (formatBuffer, "%c:\\", toupper (textPtr[0]));
+
+         /* Add to the list */
+         gtk_list_store_append (model, &iter);
+         gtk_list_store_set (model, &iter, DIR_COLUMN, formatBuffer, -1);
+       }
+      textPtr += (strlen (textPtr) + 1);
+    }
 }
 #endif
 
@@ -2329,10 +2326,6 @@ gtk_file_selection_get_selections (GtkFileSelection *filesel)
 
   g_return_val_if_fail (GTK_IS_FILE_SELECTION (filesel), NULL);
 
-  names = filesel->selected_names;
-
-  selections = g_new (gchar *, names->len + 2);
-
   filename = g_strdup (gtk_file_selection_get_filename (filesel));
 
   if (strlen (filename) == 0)
@@ -2341,6 +2334,13 @@ gtk_file_selection_get_selections (GtkFileSelection *filesel)
       return NULL;
     }
 
+  names = filesel->selected_names;
+
+  if (names != NULL)
+    selections = g_new (gchar *, names->len + 2);
+  else
+    selections = g_new (gchar *, 2);
+
   count = 0;
   selections[count++] = filename;