Commit 3b16bb01 authored by Tor Lillqvist's avatar Tor Lillqvist Committed by Tor Lillqvist

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.
parent e0e7056f
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> 2005-04-22 Tor Lillqvist <tml@novell.com>
* gtk/gtkmain.c: Initailize gettext before use. Calling * gtk/gtkmain.c: Initailize gettext before use. Calling
......
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> 2005-04-22 Tor Lillqvist <tml@novell.com>
* gtk/gtkmain.c: Initailize gettext before use. Calling * gtk/gtkmain.c: Initailize gettext before use. Calling
......
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> 2005-04-22 Tor Lillqvist <tml@novell.com>
* gtk/gtkmain.c: Initailize gettext before use. Calling * gtk/gtkmain.c: Initailize gettext before use. Calling
......
...@@ -612,23 +612,48 @@ gtk_file_system_win32_volume_get_display_name (GtkFileSystem *file_system, ...@@ -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') || else if ((filename_is_drive_root (volume->drive) && volume->drive[0] >= 'C') ||
volume->drive_type != DRIVE_REMOVABLE) volume->drive_type != DRIVE_REMOVABLE)
{ {
gunichar2 *wdrive = g_utf8_to_utf16 (volume->drive, -1, NULL, NULL, NULL); gchar *name = NULL;
gunichar2 wname[80]; if (G_WIN32_HAVE_WIDECHAR_API ())
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 = 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); real_display_name = g_strdup_printf (_("%s (%s)"), name, volume->drive);
g_free (name); g_free (name);
} }
else else
real_display_name = g_strdup (volume->drive); {
g_free (wdrive); real_display_name = g_strdup (volume->drive);
}
} }
else else
real_display_name = g_strdup (volume->drive); real_display_name = g_strdup (volume->drive);
...@@ -741,7 +766,7 @@ canonicalize_filename (gchar *filename) ...@@ -741,7 +766,7 @@ canonicalize_filename (gchar *filename)
printf("canonicalize_filename: %s ", filename); printf("canonicalize_filename: %s ", filename);
#endif #endif
past_root = g_path_skip_root (filename); past_root = (gchar *) g_path_skip_root (filename);
q = p = past_root; q = p = past_root;
...@@ -1287,10 +1312,12 @@ gtk_file_system_win32_render_icon (GtkFileSystem *file_system, ...@@ -1287,10 +1312,12 @@ gtk_file_system_win32_render_icon (GtkFileSystem *file_system,
} }
if (!icon_set) 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); if (g_file_test (filename, G_FILE_TEST_IS_EXECUTABLE))
else icon_set = gtk_style_lookup_icon_set (widget->style, GTK_STOCK_EXECUTE);
icon_set = gtk_style_lookup_icon_set (widget->style, GTK_STOCK_FILE); 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 // 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 ? // icon size, which is an index, but there appears to be no way ?
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment