Get volume name also on Win9x. (#301798, Daniel Atallah)
2005-04-25 Tor Lillqvist <tml@novell.com> * gtk/gtkfilesystemwin32.c (gtk_file_system_win32_volume_get_display_name): Get volume name also on Win9x. (#301798, Daniel Atallah) (canonicalize_filename): Add explicit braces to silence compiler warning.
This commit is contained in:
committed by
Tor Lillqvist
parent
e0e7056fe2
commit
3b16bb011e
@ -1,3 +1,11 @@
|
||||
2005-04-25 Tor Lillqvist <tml@novell.com>
|
||||
|
||||
* gtk/gtkfilesystemwin32.c
|
||||
(gtk_file_system_win32_volume_get_display_name): Get volume name
|
||||
also on Win9x. (#301798, Daniel Atallah)
|
||||
(canonicalize_filename): Add explicit braces to silence compiler
|
||||
warning.
|
||||
|
||||
2005-04-22 Tor Lillqvist <tml@novell.com>
|
||||
|
||||
* gtk/gtkmain.c: Initailize gettext before use. Calling
|
||||
|
||||
@ -1,3 +1,11 @@
|
||||
2005-04-25 Tor Lillqvist <tml@novell.com>
|
||||
|
||||
* gtk/gtkfilesystemwin32.c
|
||||
(gtk_file_system_win32_volume_get_display_name): Get volume name
|
||||
also on Win9x. (#301798, Daniel Atallah)
|
||||
(canonicalize_filename): Add explicit braces to silence compiler
|
||||
warning.
|
||||
|
||||
2005-04-22 Tor Lillqvist <tml@novell.com>
|
||||
|
||||
* gtk/gtkmain.c: Initailize gettext before use. Calling
|
||||
|
||||
@ -1,3 +1,11 @@
|
||||
2005-04-25 Tor Lillqvist <tml@novell.com>
|
||||
|
||||
* gtk/gtkfilesystemwin32.c
|
||||
(gtk_file_system_win32_volume_get_display_name): Get volume name
|
||||
also on Win9x. (#301798, Daniel Atallah)
|
||||
(canonicalize_filename): Add explicit braces to silence compiler
|
||||
warning.
|
||||
|
||||
2005-04-22 Tor Lillqvist <tml@novell.com>
|
||||
|
||||
* gtk/gtkmain.c: Initailize gettext before use. Calling
|
||||
|
||||
@ -612,23 +612,48 @@ gtk_file_system_win32_volume_get_display_name (GtkFileSystem *file_system,
|
||||
else if ((filename_is_drive_root (volume->drive) && volume->drive[0] >= 'C') ||
|
||||
volume->drive_type != DRIVE_REMOVABLE)
|
||||
{
|
||||
gunichar2 *wdrive = g_utf8_to_utf16 (volume->drive, -1, NULL, NULL, NULL);
|
||||
gunichar2 wname[80];
|
||||
if (GetVolumeInformationW (wdrive,
|
||||
wname, G_N_ELEMENTS(wname),
|
||||
NULL, /* serial number */
|
||||
NULL, /* max. component length */
|
||||
NULL, /* fs flags */
|
||||
NULL, 0) /* fs type like FAT, NTFS */ &&
|
||||
wname[0])
|
||||
gchar *name = NULL;
|
||||
if (G_WIN32_HAVE_WIDECHAR_API ())
|
||||
{
|
||||
gchar *name = g_utf16_to_utf8 (wname, -1, NULL, NULL, NULL);
|
||||
gunichar2 *wdrive = g_utf8_to_utf16 (volume->drive, -1, NULL, NULL, NULL);
|
||||
gunichar2 wname[80];
|
||||
if (GetVolumeInformationW (wdrive,
|
||||
wname, G_N_ELEMENTS(wname),
|
||||
NULL, /* serial number */
|
||||
NULL, /* max. component length */
|
||||
NULL, /* fs flags */
|
||||
NULL, 0) /* fs type like FAT, NTFS */ &&
|
||||
wname[0])
|
||||
{
|
||||
name = g_utf16_to_utf8 (wname, -1, NULL, NULL, NULL);
|
||||
}
|
||||
g_free (wdrive);
|
||||
}
|
||||
else
|
||||
{
|
||||
gchar *cpdrive = g_locale_from_utf8 (volume->drive, -1, NULL, NULL, NULL);
|
||||
gchar cpname[80];
|
||||
if (GetVolumeInformationA (cpdrive,
|
||||
cpname, G_N_ELEMENTS(cpname),
|
||||
NULL, /* serial number */
|
||||
NULL, /* max. component length */
|
||||
NULL, /* fs flags */
|
||||
NULL, 0) /* fs type like FAT, NTFS */ &&
|
||||
cpname[0])
|
||||
{
|
||||
name = g_locale_to_utf8 (cpname, -1, NULL, NULL, NULL);
|
||||
}
|
||||
g_free (cpdrive);
|
||||
}
|
||||
if (name != NULL)
|
||||
{
|
||||
real_display_name = g_strdup_printf (_("%s (%s)"), name, volume->drive);
|
||||
g_free (name);
|
||||
}
|
||||
else
|
||||
real_display_name = g_strdup (volume->drive);
|
||||
g_free (wdrive);
|
||||
{
|
||||
real_display_name = g_strdup (volume->drive);
|
||||
}
|
||||
}
|
||||
else
|
||||
real_display_name = g_strdup (volume->drive);
|
||||
@ -741,7 +766,7 @@ canonicalize_filename (gchar *filename)
|
||||
printf("canonicalize_filename: %s ", filename);
|
||||
#endif
|
||||
|
||||
past_root = g_path_skip_root (filename);
|
||||
past_root = (gchar *) g_path_skip_root (filename);
|
||||
|
||||
q = p = past_root;
|
||||
|
||||
@ -1287,10 +1312,12 @@ gtk_file_system_win32_render_icon (GtkFileSystem *file_system,
|
||||
}
|
||||
|
||||
if (!icon_set)
|
||||
if (g_file_test (filename, G_FILE_TEST_IS_EXECUTABLE))
|
||||
icon_set = gtk_style_lookup_icon_set (widget->style, GTK_STOCK_EXECUTE);
|
||||
else
|
||||
icon_set = gtk_style_lookup_icon_set (widget->style, GTK_STOCK_FILE);
|
||||
{
|
||||
if (g_file_test (filename, G_FILE_TEST_IS_EXECUTABLE))
|
||||
icon_set = gtk_style_lookup_icon_set (widget->style, GTK_STOCK_EXECUTE);
|
||||
else
|
||||
icon_set = gtk_style_lookup_icon_set (widget->style, GTK_STOCK_FILE);
|
||||
}
|
||||
|
||||
// FIXME : I'd like to get from pixel_size (=20) back to
|
||||
// icon size, which is an index, but there appears to be no way ?
|
||||
|
||||
Reference in New Issue
Block a user