Use cygwin_conv_to_posix_path(). (gtk_file_selection_dir_activate): Call
2002-08-31 Tor Lillqvist <tml@iki.fi> * Include <sys/cygwin.h on Cygwin, for cygwin_conv_to_posix_path(). (translate_win32_path, get_real_filename): Use cygwin_conv_to_posix_path(). (gtk_file_selection_dir_activate): Call get_real_filename() here, too. (#91843, Masahiro Sakai)
This commit is contained in:
committed by
Tor Lillqvist
parent
eab30a1223
commit
732c205236
@ -1,3 +1,11 @@
|
|||||||
|
2002-08-31 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
|
* Include <sys/cygwin.h on Cygwin, for cygwin_conv_to_posix_path().
|
||||||
|
(translate_win32_path, get_real_filename): Use
|
||||||
|
cygwin_conv_to_posix_path().
|
||||||
|
(gtk_file_selection_dir_activate): Call get_real_filename() here,
|
||||||
|
too. (#91843, Masahiro Sakai)
|
||||||
|
|
||||||
2002-08-26 Tor Lillqvist <tml@iki.fi>
|
2002-08-26 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
* gdk/win32/gdkwindow-win32.c (RegisterGdkClass): Use MAX_PATH
|
* gdk/win32/gdkwindow-win32.c (RegisterGdkClass): Use MAX_PATH
|
||||||
|
|||||||
@ -1,3 +1,11 @@
|
|||||||
|
2002-08-31 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
|
* Include <sys/cygwin.h on Cygwin, for cygwin_conv_to_posix_path().
|
||||||
|
(translate_win32_path, get_real_filename): Use
|
||||||
|
cygwin_conv_to_posix_path().
|
||||||
|
(gtk_file_selection_dir_activate): Call get_real_filename() here,
|
||||||
|
too. (#91843, Masahiro Sakai)
|
||||||
|
|
||||||
2002-08-26 Tor Lillqvist <tml@iki.fi>
|
2002-08-26 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
* gdk/win32/gdkwindow-win32.c (RegisterGdkClass): Use MAX_PATH
|
* gdk/win32/gdkwindow-win32.c (RegisterGdkClass): Use MAX_PATH
|
||||||
|
|||||||
@ -1,3 +1,11 @@
|
|||||||
|
2002-08-31 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
|
* Include <sys/cygwin.h on Cygwin, for cygwin_conv_to_posix_path().
|
||||||
|
(translate_win32_path, get_real_filename): Use
|
||||||
|
cygwin_conv_to_posix_path().
|
||||||
|
(gtk_file_selection_dir_activate): Call get_real_filename() here,
|
||||||
|
too. (#91843, Masahiro Sakai)
|
||||||
|
|
||||||
2002-08-26 Tor Lillqvist <tml@iki.fi>
|
2002-08-26 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
* gdk/win32/gdkwindow-win32.c (RegisterGdkClass): Use MAX_PATH
|
* gdk/win32/gdkwindow-win32.c (RegisterGdkClass): Use MAX_PATH
|
||||||
|
|||||||
@ -1,3 +1,11 @@
|
|||||||
|
2002-08-31 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
|
* Include <sys/cygwin.h on Cygwin, for cygwin_conv_to_posix_path().
|
||||||
|
(translate_win32_path, get_real_filename): Use
|
||||||
|
cygwin_conv_to_posix_path().
|
||||||
|
(gtk_file_selection_dir_activate): Call get_real_filename() here,
|
||||||
|
too. (#91843, Masahiro Sakai)
|
||||||
|
|
||||||
2002-08-26 Tor Lillqvist <tml@iki.fi>
|
2002-08-26 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
* gdk/win32/gdkwindow-win32.c (RegisterGdkClass): Use MAX_PATH
|
* gdk/win32/gdkwindow-win32.c (RegisterGdkClass): Use MAX_PATH
|
||||||
|
|||||||
@ -1,3 +1,11 @@
|
|||||||
|
2002-08-31 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
|
* Include <sys/cygwin.h on Cygwin, for cygwin_conv_to_posix_path().
|
||||||
|
(translate_win32_path, get_real_filename): Use
|
||||||
|
cygwin_conv_to_posix_path().
|
||||||
|
(gtk_file_selection_dir_activate): Call get_real_filename() here,
|
||||||
|
too. (#91843, Masahiro Sakai)
|
||||||
|
|
||||||
2002-08-26 Tor Lillqvist <tml@iki.fi>
|
2002-08-26 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
* gdk/win32/gdkwindow-win32.c (RegisterGdkClass): Use MAX_PATH
|
* gdk/win32/gdkwindow-win32.c (RegisterGdkClass): Use MAX_PATH
|
||||||
|
|||||||
@ -1,3 +1,11 @@
|
|||||||
|
2002-08-31 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
|
* Include <sys/cygwin.h on Cygwin, for cygwin_conv_to_posix_path().
|
||||||
|
(translate_win32_path, get_real_filename): Use
|
||||||
|
cygwin_conv_to_posix_path().
|
||||||
|
(gtk_file_selection_dir_activate): Call get_real_filename() here,
|
||||||
|
too. (#91843, Masahiro Sakai)
|
||||||
|
|
||||||
2002-08-26 Tor Lillqvist <tml@iki.fi>
|
2002-08-26 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
* gdk/win32/gdkwindow-win32.c (RegisterGdkClass): Use MAX_PATH
|
* gdk/win32/gdkwindow-win32.c (RegisterGdkClass): Use MAX_PATH
|
||||||
|
|||||||
@ -94,6 +94,10 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif /* G_OS_WIN32 */
|
#endif /* G_OS_WIN32 */
|
||||||
|
|
||||||
|
#ifdef G_WITH_CYGWIN
|
||||||
|
#include <sys/cygwin.h> /* For cygwin_conv_to_posix_path */
|
||||||
|
#endif
|
||||||
|
|
||||||
#define DIR_LIST_WIDTH 180
|
#define DIR_LIST_WIDTH 180
|
||||||
#define DIR_LIST_HEIGHT 180
|
#define DIR_LIST_HEIGHT 180
|
||||||
#define FILE_LIST_WIDTH 180
|
#define FILE_LIST_WIDTH 180
|
||||||
@ -433,7 +437,7 @@ static gint cmpl_errno;
|
|||||||
* instance translate:
|
* instance translate:
|
||||||
* x:\somepath\file.jpg
|
* x:\somepath\file.jpg
|
||||||
* to:
|
* to:
|
||||||
* //x/somepath/file.jpg
|
* /cygdrive/x/somepath/file.jpg
|
||||||
*
|
*
|
||||||
* Replace the path in the selection text field.
|
* Replace the path in the selection text field.
|
||||||
* Return a boolean value concerning whether a
|
* Return a boolean value concerning whether a
|
||||||
@ -443,47 +447,20 @@ static int
|
|||||||
translate_win32_path (GtkFileSelection *filesel)
|
translate_win32_path (GtkFileSelection *filesel)
|
||||||
{
|
{
|
||||||
int updated = 0;
|
int updated = 0;
|
||||||
gchar *path;
|
const gchar *path;
|
||||||
|
gchar newPath[MAX_PATH];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Retrieve the current path
|
* Retrieve the current path
|
||||||
*/
|
*/
|
||||||
path = gtk_entry_get_text (GTK_ENTRY (filesel->selection_entry));
|
path = gtk_entry_get_text (GTK_ENTRY (filesel->selection_entry));
|
||||||
|
|
||||||
/*
|
cygwin_conv_to_posix_path (path, newPath);
|
||||||
* Translate only if this looks like a DOS-ish
|
updated = (strcmp (path, newPath) != 0);
|
||||||
* path... First handle any drive letters.
|
|
||||||
*/
|
if (updated)
|
||||||
if (isalpha (path[0]) && (path[1] == ':')) {
|
|
||||||
/*
|
|
||||||
* This part kind of stinks... It isn't possible
|
|
||||||
* to know if there is enough space in the current
|
|
||||||
* string for the extra character required in this
|
|
||||||
* conversion. Assume that there isn't enough space
|
|
||||||
* and use the set function on the text field to
|
|
||||||
* set the newly created string.
|
|
||||||
*/
|
|
||||||
gchar *newPath = g_strdup_printf ("//%c/%s", path[0], (path + 3));
|
|
||||||
gtk_entry_set_text (GTK_ENTRY (filesel->selection_entry), newPath);
|
gtk_entry_set_text (GTK_ENTRY (filesel->selection_entry), newPath);
|
||||||
|
|
||||||
path = newPath;
|
|
||||||
updated = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Now, replace backslashes with forward slashes
|
|
||||||
* if necessary.
|
|
||||||
*/
|
|
||||||
if (strchr (path, '\\'))
|
|
||||||
{
|
|
||||||
int index;
|
|
||||||
for (index = 0; path[index] != '\0'; index++)
|
|
||||||
if (path[index] == '\\')
|
|
||||||
path[index] = '/';
|
|
||||||
|
|
||||||
updated = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return updated;
|
return updated;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -1918,17 +1895,26 @@ get_real_filename (gchar *filename,
|
|||||||
/* Check to see if the selection was a drive selector */
|
/* Check to see if the selection was a drive selector */
|
||||||
if (isalpha (filename[0]) && (filename[1] == ':'))
|
if (isalpha (filename[0]) && (filename[1] == ':'))
|
||||||
{
|
{
|
||||||
/* It is... map it to a CYGWIN32 drive */
|
gchar temp_filename[MAX_PATH];
|
||||||
gchar *temp_filename = g_strdup_printf ("//%c/", tolower (filename[0]));
|
int len;
|
||||||
|
|
||||||
|
cygwin_conv_to_posix_path (filename, temp_filename);
|
||||||
|
|
||||||
|
/* we need trailing '/'. */
|
||||||
|
len = strlen (temp_filename);
|
||||||
|
if (len > 0 && temp_filename[len-1] != '/')
|
||||||
|
{
|
||||||
|
temp_filename[len] = '/';
|
||||||
|
temp_filename[len+1] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
if (free_old)
|
if (free_old)
|
||||||
g_free (filename);
|
g_free (filename);
|
||||||
|
|
||||||
return temp_filename;
|
return g_strdup (temp_filename);
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
return filename;
|
|
||||||
#endif /* G_WITH_CYGWIN */
|
#endif /* G_WITH_CYGWIN */
|
||||||
|
return filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -1945,7 +1931,6 @@ gtk_file_selection_file_activate (GtkTreeView *tree_view,
|
|||||||
gtk_tree_model_get_iter (model, &iter, path);
|
gtk_tree_model_get_iter (model, &iter, path);
|
||||||
gtk_tree_model_get (model, &iter, FILE_COLUMN, &filename, -1);
|
gtk_tree_model_get (model, &iter, FILE_COLUMN, &filename, -1);
|
||||||
filename = get_real_filename (filename, TRUE);
|
filename = get_real_filename (filename, TRUE);
|
||||||
|
|
||||||
gtk_entry_set_text (GTK_ENTRY (fs->selection_entry), filename);
|
gtk_entry_set_text (GTK_ENTRY (fs->selection_entry), filename);
|
||||||
gtk_button_clicked (GTK_BUTTON (fs->ok_button));
|
gtk_button_clicked (GTK_BUTTON (fs->ok_button));
|
||||||
|
|
||||||
@ -1965,6 +1950,7 @@ gtk_file_selection_dir_activate (GtkTreeView *tree_view,
|
|||||||
|
|
||||||
gtk_tree_model_get_iter (model, &iter, path);
|
gtk_tree_model_get_iter (model, &iter, path);
|
||||||
gtk_tree_model_get (model, &iter, DIR_COLUMN, &filename, -1);
|
gtk_tree_model_get (model, &iter, DIR_COLUMN, &filename, -1);
|
||||||
|
filename = get_real_filename (filename, TRUE);
|
||||||
gtk_file_selection_populate (fs, filename, FALSE, FALSE);
|
gtk_file_selection_populate (fs, filename, FALSE, FALSE);
|
||||||
g_free (filename);
|
g_free (filename);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user