handle GTK_DATADIR similar as the other filesystem placement 'constants'
2003-12-14 Hans Breuer <hans@breuer.org> * gtk/gtkprivate.h gtk/gtkmain.c : handle GTK_DATADIR similar as the other filesystem placement 'constants' (dynamic resolving on win32) * gtk/gtkfilechooserwidget.c : handle file system to win32 renaming here as will * gtk/gtkfilesystemwin32.c : implement render_icon * gtk/gtk.def gdk/gdk.def : updated externals * gdk/win32/gdkdisplay-win32.c : make it compile without <multimon.h> - i.e. even older sdk * gdk/win32/gdkevents-win32.c : match resize_timer_proc with TIMERPROC prototype * gdk/win32/gdkwindow-win32.c : older msvc does not know BITMAPV5HEADER (from win xp) either * gtk/gtkimmodule.c : make it compile even if GTK_LOCALEDIR is not defined * tests/testfilechooser.c : recent GLib crashes on g_print ("%s", NULL) so avoid this
This commit is contained in:
		
							
								
								
									
										27
									
								
								ChangeLog
									
									
									
									
									
								
							
							
						
						
									
										27
									
								
								ChangeLog
									
									
									
									
									
								
							| @ -1,3 +1,30 @@ | |||||||
|  | 2003-12-14  Hans Breuer  <hans@breuer.org> | ||||||
|  |  | ||||||
|  | 	* gtk/gtkprivate.h gtk/gtkmain.c : handle GTK_DATADIR | ||||||
|  | 	similar as the other filesystem placement 'constants' (dynamic | ||||||
|  | 	resolving on win32) | ||||||
|  |  | ||||||
|  | 	* gtk/gtkfilechooserwidget.c : handle file system to win32 | ||||||
|  | 	renaming here as will | ||||||
|  | 	* gtk/gtkfilesystemwin32.c : implement render_icon | ||||||
|  |  | ||||||
|  | 	* gtk/gtk.def gdk/gdk.def : updated externals | ||||||
|  |  | ||||||
|  | 	* gdk/win32/gdkdisplay-win32.c : make it compile without | ||||||
|  | 	<multimon.h> - i.e. even older sdk | ||||||
|  |  | ||||||
|  | 	* gdk/win32/gdkevents-win32.c : match resize_timer_proc | ||||||
|  | 	with TIMERPROC prototype | ||||||
|  |  | ||||||
|  | 	* gdk/win32/gdkwindow-win32.c : older msvc does not know | ||||||
|  | 	BITMAPV5HEADER (from win xp) either | ||||||
|  |  | ||||||
|  | 	* gtk/gtkimmodule.c : make it compile even if GTK_LOCALEDIR is | ||||||
|  | 	not defined | ||||||
|  |  | ||||||
|  | 	* tests/testfilechooser.c : recent GLib crashes on  | ||||||
|  | 	g_print ("%s", NULL) so avoid this | ||||||
|  |  | ||||||
| 2003-12-14  Tor Lillqvist  <tml@iki.fi> | 2003-12-14  Tor Lillqvist  <tml@iki.fi> | ||||||
|  |  | ||||||
| 	* gdk/win32/gdkselection-win32.c: Calls to OpenClipboard() must be | 	* gdk/win32/gdkselection-win32.c: Calls to OpenClipboard() must be | ||||||
|  | |||||||
| @ -1,3 +1,30 @@ | |||||||
|  | 2003-12-14  Hans Breuer  <hans@breuer.org> | ||||||
|  |  | ||||||
|  | 	* gtk/gtkprivate.h gtk/gtkmain.c : handle GTK_DATADIR | ||||||
|  | 	similar as the other filesystem placement 'constants' (dynamic | ||||||
|  | 	resolving on win32) | ||||||
|  |  | ||||||
|  | 	* gtk/gtkfilechooserwidget.c : handle file system to win32 | ||||||
|  | 	renaming here as will | ||||||
|  | 	* gtk/gtkfilesystemwin32.c : implement render_icon | ||||||
|  |  | ||||||
|  | 	* gtk/gtk.def gdk/gdk.def : updated externals | ||||||
|  |  | ||||||
|  | 	* gdk/win32/gdkdisplay-win32.c : make it compile without | ||||||
|  | 	<multimon.h> - i.e. even older sdk | ||||||
|  |  | ||||||
|  | 	* gdk/win32/gdkevents-win32.c : match resize_timer_proc | ||||||
|  | 	with TIMERPROC prototype | ||||||
|  |  | ||||||
|  | 	* gdk/win32/gdkwindow-win32.c : older msvc does not know | ||||||
|  | 	BITMAPV5HEADER (from win xp) either | ||||||
|  |  | ||||||
|  | 	* gtk/gtkimmodule.c : make it compile even if GTK_LOCALEDIR is | ||||||
|  | 	not defined | ||||||
|  |  | ||||||
|  | 	* tests/testfilechooser.c : recent GLib crashes on  | ||||||
|  | 	g_print ("%s", NULL) so avoid this | ||||||
|  |  | ||||||
| 2003-12-14  Tor Lillqvist  <tml@iki.fi> | 2003-12-14  Tor Lillqvist  <tml@iki.fi> | ||||||
|  |  | ||||||
| 	* gdk/win32/gdkselection-win32.c: Calls to OpenClipboard() must be | 	* gdk/win32/gdkselection-win32.c: Calls to OpenClipboard() must be | ||||||
|  | |||||||
| @ -1,3 +1,30 @@ | |||||||
|  | 2003-12-14  Hans Breuer  <hans@breuer.org> | ||||||
|  |  | ||||||
|  | 	* gtk/gtkprivate.h gtk/gtkmain.c : handle GTK_DATADIR | ||||||
|  | 	similar as the other filesystem placement 'constants' (dynamic | ||||||
|  | 	resolving on win32) | ||||||
|  |  | ||||||
|  | 	* gtk/gtkfilechooserwidget.c : handle file system to win32 | ||||||
|  | 	renaming here as will | ||||||
|  | 	* gtk/gtkfilesystemwin32.c : implement render_icon | ||||||
|  |  | ||||||
|  | 	* gtk/gtk.def gdk/gdk.def : updated externals | ||||||
|  |  | ||||||
|  | 	* gdk/win32/gdkdisplay-win32.c : make it compile without | ||||||
|  | 	<multimon.h> - i.e. even older sdk | ||||||
|  |  | ||||||
|  | 	* gdk/win32/gdkevents-win32.c : match resize_timer_proc | ||||||
|  | 	with TIMERPROC prototype | ||||||
|  |  | ||||||
|  | 	* gdk/win32/gdkwindow-win32.c : older msvc does not know | ||||||
|  | 	BITMAPV5HEADER (from win xp) either | ||||||
|  |  | ||||||
|  | 	* gtk/gtkimmodule.c : make it compile even if GTK_LOCALEDIR is | ||||||
|  | 	not defined | ||||||
|  |  | ||||||
|  | 	* tests/testfilechooser.c : recent GLib crashes on  | ||||||
|  | 	g_print ("%s", NULL) so avoid this | ||||||
|  |  | ||||||
| 2003-12-14  Tor Lillqvist  <tml@iki.fi> | 2003-12-14  Tor Lillqvist  <tml@iki.fi> | ||||||
|  |  | ||||||
| 	* gdk/win32/gdkselection-win32.c: Calls to OpenClipboard() must be | 	* gdk/win32/gdkselection-win32.c: Calls to OpenClipboard() must be | ||||||
|  | |||||||
| @ -1,3 +1,30 @@ | |||||||
|  | 2003-12-14  Hans Breuer  <hans@breuer.org> | ||||||
|  |  | ||||||
|  | 	* gtk/gtkprivate.h gtk/gtkmain.c : handle GTK_DATADIR | ||||||
|  | 	similar as the other filesystem placement 'constants' (dynamic | ||||||
|  | 	resolving on win32) | ||||||
|  |  | ||||||
|  | 	* gtk/gtkfilechooserwidget.c : handle file system to win32 | ||||||
|  | 	renaming here as will | ||||||
|  | 	* gtk/gtkfilesystemwin32.c : implement render_icon | ||||||
|  |  | ||||||
|  | 	* gtk/gtk.def gdk/gdk.def : updated externals | ||||||
|  |  | ||||||
|  | 	* gdk/win32/gdkdisplay-win32.c : make it compile without | ||||||
|  | 	<multimon.h> - i.e. even older sdk | ||||||
|  |  | ||||||
|  | 	* gdk/win32/gdkevents-win32.c : match resize_timer_proc | ||||||
|  | 	with TIMERPROC prototype | ||||||
|  |  | ||||||
|  | 	* gdk/win32/gdkwindow-win32.c : older msvc does not know | ||||||
|  | 	BITMAPV5HEADER (from win xp) either | ||||||
|  |  | ||||||
|  | 	* gtk/gtkimmodule.c : make it compile even if GTK_LOCALEDIR is | ||||||
|  | 	not defined | ||||||
|  |  | ||||||
|  | 	* tests/testfilechooser.c : recent GLib crashes on  | ||||||
|  | 	g_print ("%s", NULL) so avoid this | ||||||
|  |  | ||||||
| 2003-12-14  Tor Lillqvist  <tml@iki.fi> | 2003-12-14  Tor Lillqvist  <tml@iki.fi> | ||||||
|  |  | ||||||
| 	* gdk/win32/gdkselection-win32.c: Calls to OpenClipboard() must be | 	* gdk/win32/gdkselection-win32.c: Calls to OpenClipboard() must be | ||||||
|  | |||||||
| @ -1,3 +1,30 @@ | |||||||
|  | 2003-12-14  Hans Breuer  <hans@breuer.org> | ||||||
|  |  | ||||||
|  | 	* gtk/gtkprivate.h gtk/gtkmain.c : handle GTK_DATADIR | ||||||
|  | 	similar as the other filesystem placement 'constants' (dynamic | ||||||
|  | 	resolving on win32) | ||||||
|  |  | ||||||
|  | 	* gtk/gtkfilechooserwidget.c : handle file system to win32 | ||||||
|  | 	renaming here as will | ||||||
|  | 	* gtk/gtkfilesystemwin32.c : implement render_icon | ||||||
|  |  | ||||||
|  | 	* gtk/gtk.def gdk/gdk.def : updated externals | ||||||
|  |  | ||||||
|  | 	* gdk/win32/gdkdisplay-win32.c : make it compile without | ||||||
|  | 	<multimon.h> - i.e. even older sdk | ||||||
|  |  | ||||||
|  | 	* gdk/win32/gdkevents-win32.c : match resize_timer_proc | ||||||
|  | 	with TIMERPROC prototype | ||||||
|  |  | ||||||
|  | 	* gdk/win32/gdkwindow-win32.c : older msvc does not know | ||||||
|  | 	BITMAPV5HEADER (from win xp) either | ||||||
|  |  | ||||||
|  | 	* gtk/gtkimmodule.c : make it compile even if GTK_LOCALEDIR is | ||||||
|  | 	not defined | ||||||
|  |  | ||||||
|  | 	* tests/testfilechooser.c : recent GLib crashes on  | ||||||
|  | 	g_print ("%s", NULL) so avoid this | ||||||
|  |  | ||||||
| 2003-12-14  Tor Lillqvist  <tml@iki.fi> | 2003-12-14  Tor Lillqvist  <tml@iki.fi> | ||||||
|  |  | ||||||
| 	* gdk/win32/gdkselection-win32.c: Calls to OpenClipboard() must be | 	* gdk/win32/gdkselection-win32.c: Calls to OpenClipboard() must be | ||||||
|  | |||||||
| @ -507,6 +507,7 @@ EXPORTS | |||||||
| 	gdk_window_reparent | 	gdk_window_reparent | ||||||
| 	gdk_window_resize | 	gdk_window_resize | ||||||
| 	gdk_window_scroll | 	gdk_window_scroll | ||||||
|  | 	gdk_window_set_accept_focus | ||||||
| 	gdk_window_set_back_pixmap | 	gdk_window_set_back_pixmap | ||||||
| 	gdk_window_set_background | 	gdk_window_set_background | ||||||
| 	gdk_window_set_child_shapes | 	gdk_window_set_child_shapes | ||||||
|  | |||||||
| @ -21,15 +21,21 @@ | |||||||
| #include "gdk.h" | #include "gdk.h" | ||||||
| #include "gdkprivate-win32.h" | #include "gdkprivate-win32.h" | ||||||
|  |  | ||||||
| #if defined(_MSC_VER) && (WINVER < 0x500) | #define HAVE_MONITOR_INFO | ||||||
|  |  | ||||||
|  | #if defined(_MSC_VER) && (WINVER < 0x500) && (WINVER > 0x0400) | ||||||
| #include <multimon.h> | #include <multimon.h> | ||||||
|  | #elif (WINVER <= 0x0400) | ||||||
|  | #undef HAVE_MONITOR_INFO | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|  | #ifdef HAVE_MONITOR_INFO | ||||||
| typedef BOOL (WINAPI *t_EnumDisplayMonitors)(HDC, LPCRECT, MONITORENUMPROC, LPARAM); | typedef BOOL (WINAPI *t_EnumDisplayMonitors)(HDC, LPCRECT, MONITORENUMPROC, LPARAM); | ||||||
| typedef BOOL (WINAPI *t_GetMonitorInfoA)(HMONITOR, LPMONITORINFO); | typedef BOOL (WINAPI *t_GetMonitorInfoA)(HMONITOR, LPMONITORINFO); | ||||||
|  |  | ||||||
| static t_EnumDisplayMonitors p_EnumDisplayMonitors = NULL; | static t_EnumDisplayMonitors p_EnumDisplayMonitors = NULL; | ||||||
| static t_GetMonitorInfoA p_GetMonitorInfoA = NULL; | static t_GetMonitorInfoA p_GetMonitorInfoA = NULL; | ||||||
|  | #endif | ||||||
|  |  | ||||||
| void | void | ||||||
| _gdk_windowing_set_default_display (GdkDisplay *display) | _gdk_windowing_set_default_display (GdkDisplay *display) | ||||||
| @ -37,6 +43,7 @@ _gdk_windowing_set_default_display (GdkDisplay *display) | |||||||
|   g_assert (_gdk_display == display); |   g_assert (_gdk_display == display); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | #ifdef HVAE_MONITOR_INFO | ||||||
| static BOOL CALLBACK | static BOOL CALLBACK | ||||||
| count_monitor (HMONITOR hmonitor, | count_monitor (HMONITOR hmonitor, | ||||||
| 	       HDC      hdc, | 	       HDC      hdc, | ||||||
| @ -105,6 +112,7 @@ enum_monitor (HMONITOR hmonitor, | |||||||
|  |  | ||||||
|   return TRUE; |   return TRUE; | ||||||
| } | } | ||||||
|  | #endif /* HAVE_MONITOR_INFO */ | ||||||
|  |  | ||||||
| GdkDisplay * | GdkDisplay * | ||||||
| gdk_display_open (const gchar *display_name) | gdk_display_open (const gchar *display_name) | ||||||
| @ -117,6 +125,7 @@ gdk_display_open (const gchar *display_name) | |||||||
|   _gdk_display = g_object_new (GDK_TYPE_DISPLAY, NULL); |   _gdk_display = g_object_new (GDK_TYPE_DISPLAY, NULL); | ||||||
|   _gdk_screen = g_object_new (GDK_TYPE_SCREEN, NULL); |   _gdk_screen = g_object_new (GDK_TYPE_SCREEN, NULL); | ||||||
|  |  | ||||||
|  | #ifdef HAVE_MONITOR_INFO | ||||||
|   user32 = GetModuleHandle ("user32.dll"); |   user32 = GetModuleHandle ("user32.dll"); | ||||||
|   g_assert (user32 != NULL); |   g_assert (user32 != NULL); | ||||||
|  |  | ||||||
| @ -160,6 +169,7 @@ gdk_display_open (const gchar *display_name) | |||||||
| #endif | #endif | ||||||
|     } |     } | ||||||
|   else |   else | ||||||
|  | #endif /* HAVE_MONITOR_INFO */ | ||||||
|     { |     { | ||||||
|       RECT rect; |       RECT rect; | ||||||
|  |  | ||||||
|  | |||||||
| @ -155,7 +155,7 @@ static HKL latin_locale = NULL; | |||||||
|  |  | ||||||
| static gboolean in_ime_composition = FALSE; | static gboolean in_ime_composition = FALSE; | ||||||
| static gboolean resizing = FALSE; | static gboolean resizing = FALSE; | ||||||
| static UINT_PTR resize_timer; | static UINT     resize_timer; | ||||||
|  |  | ||||||
| static int debug_indent = 0; | static int debug_indent = 0; | ||||||
|  |  | ||||||
| @ -1992,7 +1992,7 @@ handle_stuff_while_moving_or_resizing (void) | |||||||
| static VOID CALLBACK | static VOID CALLBACK | ||||||
| resize_timer_proc (HWND     hwnd, | resize_timer_proc (HWND     hwnd, | ||||||
| 		   UINT     msg, | 		   UINT     msg, | ||||||
| 		   UINT_PTR id, | 		   UINT     id, | ||||||
| 		   DWORD    time) | 		   DWORD    time) | ||||||
| { | { | ||||||
|   if (resizing) |   if (resizing) | ||||||
|  | |||||||
| @ -35,7 +35,7 @@ | |||||||
| #include "gdkprivate-win32.h" | #include "gdkprivate-win32.h" | ||||||
| #include "gdkinput-win32.h" | #include "gdkinput-win32.h" | ||||||
|  |  | ||||||
| #ifdef __MINGW32__ | #if defined __MINGW32__ || (WINVER < 0x0500) | ||||||
| typedef struct {  | typedef struct {  | ||||||
|   DWORD        bV5Size;  |   DWORD        bV5Size;  | ||||||
|   LONG         bV5Width;  |   LONG         bV5Width;  | ||||||
|  | |||||||
							
								
								
									
										13
									
								
								gtk/gtk.def
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								gtk/gtk.def
									
									
									
									
									
								
							| @ -376,6 +376,8 @@ EXPORTS | |||||||
| 	gtk_combo_disable_activate | 	gtk_combo_disable_activate | ||||||
| 	gtk_combo_get_type | 	gtk_combo_get_type | ||||||
| 	gtk_combo_new | 	gtk_combo_new | ||||||
|  | 	gtk_combo_box_entry_new_with_model | ||||||
|  | 	gtk_combo_box_new_with_model | ||||||
| 	gtk_combo_set_case_sensitive | 	gtk_combo_set_case_sensitive | ||||||
| 	gtk_combo_set_item_string | 	gtk_combo_set_item_string | ||||||
| 	gtk_combo_set_popdown_strings | 	gtk_combo_set_popdown_strings | ||||||
| @ -717,7 +719,7 @@ EXPORTS | |||||||
| 	gtk_file_info_free | 	gtk_file_info_free | ||||||
| 	gtk_file_info_get_display_key | 	gtk_file_info_get_display_key | ||||||
| 	gtk_file_info_get_display_name | 	gtk_file_info_get_display_name | ||||||
| 	gtk_file_info_get_icon_type | ;	gtk_file_info_get_icon_type | ||||||
| 	gtk_file_info_get_is_folder | 	gtk_file_info_get_is_folder | ||||||
| 	gtk_file_info_get_is_hidden | 	gtk_file_info_get_is_hidden | ||||||
| 	gtk_file_info_get_mime_type | 	gtk_file_info_get_mime_type | ||||||
| @ -725,9 +727,9 @@ EXPORTS | |||||||
| 	gtk_file_info_get_size | 	gtk_file_info_get_size | ||||||
| 	gtk_file_info_get_type | 	gtk_file_info_get_type | ||||||
| 	gtk_file_info_new | 	gtk_file_info_new | ||||||
| 	gtk_file_info_render_icon | ;	gtk_file_info_render_icon | ||||||
| 	gtk_file_info_set_display_name | 	gtk_file_info_set_display_name | ||||||
| 	gtk_file_info_set_icon_type | ;	gtk_file_info_set_icon_type | ||||||
| 	gtk_file_info_set_is_folder | 	gtk_file_info_set_is_folder | ||||||
| 	gtk_file_info_set_is_hidden | 	gtk_file_info_set_is_hidden | ||||||
| 	gtk_file_info_set_mime_type | 	gtk_file_info_set_mime_type | ||||||
| @ -760,9 +762,9 @@ EXPORTS | |||||||
| 	gtk_file_system_path_to_filename | 	gtk_file_system_path_to_filename | ||||||
| 	gtk_file_system_path_to_uri | 	gtk_file_system_path_to_uri | ||||||
| 	gtk_file_system_remove_bookmark | 	gtk_file_system_remove_bookmark | ||||||
| 	gtk_file_system_unix_get_type |  | ||||||
| 	gtk_file_system_unix_new |  | ||||||
| 	gtk_file_system_uri_to_path | 	gtk_file_system_uri_to_path | ||||||
|  | 	gtk_file_system_win32_get_type | ||||||
|  | 	gtk_file_system_win32_new | ||||||
| 	gtk_fixed_get_has_window | 	gtk_fixed_get_has_window | ||||||
| 	gtk_fixed_get_type | 	gtk_fixed_get_type | ||||||
| 	gtk_fixed_move | 	gtk_fixed_move | ||||||
| @ -2055,7 +2057,6 @@ EXPORTS | |||||||
| 	gtk_toolbar_set_tooltips | 	gtk_toolbar_set_tooltips | ||||||
| 	gtk_toolbar_space_style_get_type | 	gtk_toolbar_space_style_get_type | ||||||
| 	gtk_toolbar_style_get_type | 	gtk_toolbar_style_get_type | ||||||
| 	gtk_toolbar_unhighlight_drop_location |  | ||||||
| 	gtk_toolbar_unset_icon_size | 	gtk_toolbar_unset_icon_size | ||||||
| 	gtk_toolbar_unset_style | 	gtk_toolbar_unset_style | ||||||
| 	gtk_tooltips_data_get | 	gtk_tooltips_data_get | ||||||
|  | |||||||
| @ -23,8 +23,7 @@ | |||||||
| #include "gtkfilechooserutils.h" | #include "gtkfilechooserutils.h" | ||||||
| #ifdef G_OS_UNIX | #ifdef G_OS_UNIX | ||||||
| #include "gtkfilesystemunix.h" | #include "gtkfilesystemunix.h" | ||||||
| #endif | #else if defined G_OS_WIN32 | ||||||
| #ifdef G_OS_WIN32 |  | ||||||
| #include "gtkfilesystemwin32.h" | #include "gtkfilesystemwin32.h" | ||||||
| #endif | #endif | ||||||
| #include "gtktypebuiltins.h" | #include "gtktypebuiltins.h" | ||||||
| @ -135,7 +134,13 @@ gtk_file_chooser_widget_constructor (GType                  type, | |||||||
|   gtk_widget_push_composite_child (); |   gtk_widget_push_composite_child (); | ||||||
|  |  | ||||||
|   if (!priv->file_system) |   if (!priv->file_system) | ||||||
|     priv->file_system = gtk_file_system_unix_new (); |     { | ||||||
|  | #if defined G_OS_UNIX | ||||||
|  |       priv->file_system = gtk_file_system_unix_new (); | ||||||
|  | #else if defined G_OS_WIN32 | ||||||
|  |       priv->file_system = gtk_file_system_win32_new (); | ||||||
|  | #endif | ||||||
|  |     } | ||||||
|        |        | ||||||
|   priv->impl = _gtk_file_chooser_default_new (priv->file_system); |   priv->impl = _gtk_file_chooser_default_new (priv->file_system); | ||||||
|   gtk_box_pack_start (GTK_BOX (object), priv->impl, TRUE, TRUE, 0); |   gtk_box_pack_start (GTK_BOX (object), priv->impl, TRUE, TRUE, 0); | ||||||
|  | |||||||
| @ -22,6 +22,7 @@ | |||||||
| #include "gtkfilesystemwin32.h" | #include "gtkfilesystemwin32.h" | ||||||
| #include "gtkintl.h" | #include "gtkintl.h" | ||||||
| #include "gtkstock.h" | #include "gtkstock.h" | ||||||
|  | #include "gtkiconfactory.h" | ||||||
|  |  | ||||||
| #include <errno.h> | #include <errno.h> | ||||||
| #include <stdio.h> | #include <stdio.h> | ||||||
| @ -31,9 +32,11 @@ | |||||||
| #ifdef G_OS_WIN32 | #ifdef G_OS_WIN32 | ||||||
| #define WIN32_LEAN_AND_MEAN | #define WIN32_LEAN_AND_MEAN | ||||||
| #include <windows.h> | #include <windows.h> | ||||||
|  | #include <shellapi.h> /* ExtractAssociatedIcon */ | ||||||
| #include <direct.h> | #include <direct.h> | ||||||
| #include <io.h> | #include <io.h> | ||||||
| #define mkdir(p,m) _mkdir(p) | #define mkdir(p,m) _mkdir(p) | ||||||
|  | #include <gdk/win32/gdkwin32.h> /* gdk_win32_hdc_get */ | ||||||
| #else | #else | ||||||
| #error "The implementation is win32 only yet." | #error "The implementation is win32 only yet." | ||||||
| #endif /* G_OS_WIN32 */ | #endif /* G_OS_WIN32 */ | ||||||
| @ -118,6 +121,12 @@ static GtkFilePath *  gtk_file_system_win32_uri_to_path      (GtkFileSystem | |||||||
| 							      const gchar              *uri); | 							      const gchar              *uri); | ||||||
| static GtkFilePath *  gtk_file_system_win32_filename_to_path (GtkFileSystem            *file_system, | static GtkFilePath *  gtk_file_system_win32_filename_to_path (GtkFileSystem            *file_system, | ||||||
| 							      const gchar              *filename); | 							      const gchar              *filename); | ||||||
|  | static GdkPixbuf *gtk_file_system_win32_render_icon (GtkFileSystem     *file_system, | ||||||
|  |                                                      const GtkFilePath *path, | ||||||
|  |                                                      GtkWidget         *widget, | ||||||
|  |                                                      gint               pixel_size, | ||||||
|  |                                                      GError           **error); | ||||||
|  |  | ||||||
| static gboolean       gtk_file_system_win32_add_bookmark     (GtkFileSystem            *file_system, | static gboolean       gtk_file_system_win32_add_bookmark     (GtkFileSystem            *file_system, | ||||||
| 							      const GtkFilePath        *path, | 							      const GtkFilePath        *path, | ||||||
| 							      GError                  **error); | 							      GError                  **error); | ||||||
| @ -224,6 +233,7 @@ gtk_file_system_win32_iface_init (GtkFileSystemIface *iface) | |||||||
|   iface->path_to_filename = gtk_file_system_win32_path_to_filename; |   iface->path_to_filename = gtk_file_system_win32_path_to_filename; | ||||||
|   iface->uri_to_path = gtk_file_system_win32_uri_to_path; |   iface->uri_to_path = gtk_file_system_win32_uri_to_path; | ||||||
|   iface->filename_to_path = gtk_file_system_win32_filename_to_path; |   iface->filename_to_path = gtk_file_system_win32_filename_to_path; | ||||||
|  |   iface->render_icon = gtk_file_system_win32_render_icon; | ||||||
|   iface->add_bookmark = gtk_file_system_win32_add_bookmark; |   iface->add_bookmark = gtk_file_system_win32_add_bookmark; | ||||||
|   iface->remove_bookmark = gtk_file_system_win32_remove_bookmark; |   iface->remove_bookmark = gtk_file_system_win32_remove_bookmark; | ||||||
|   iface->list_bookmarks = gtk_file_system_win32_list_bookmarks; |   iface->list_bookmarks = gtk_file_system_win32_list_bookmarks; | ||||||
| @ -304,6 +314,7 @@ gtk_file_system_win32_get_root_info (GtkFileSystem    *file_system, | |||||||
|         gtk_file_info_set_display_name (info, filename); |         gtk_file_info_set_display_name (info, filename); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  | #if 0 /* it's dead in GtkFileSystemUnix.c, too */ | ||||||
|   if (GTK_FILE_INFO_ICON & types) |   if (GTK_FILE_INFO_ICON & types) | ||||||
|     { |     { | ||||||
|       switch (dt) |       switch (dt) | ||||||
| @ -326,6 +337,7 @@ gtk_file_system_win32_get_root_info (GtkFileSystem    *file_system, | |||||||
|           g_assert_not_reached (); |           g_assert_not_reached (); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  | #endif | ||||||
|   g_free (filename); |   g_free (filename); | ||||||
|   return info; |   return info; | ||||||
| } | } | ||||||
| @ -633,7 +645,7 @@ bookmarks_serialize (GSList  **bookmarks, | |||||||
|     { |     { | ||||||
|       gchar *contents = NULL; |       gchar *contents = NULL; | ||||||
|       gsize  len = 0; |       gsize  len = 0; | ||||||
|       GList *entry; |       GSList *entry; | ||||||
|       FILE  *f;    |       FILE  *f;    | ||||||
|         |         | ||||||
|       if (g_file_test (filename, G_FILE_TEST_EXISTS)) |       if (g_file_test (filename, G_FILE_TEST_EXISTS)) | ||||||
| @ -685,6 +697,168 @@ bookmarks_serialize (GSList  **bookmarks, | |||||||
|   return ok; |   return ok; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | static GdkPixbuf* | ||||||
|  | extract_icon (const char* filename) | ||||||
|  | { | ||||||
|  |   GdkPixbuf *pixbuf = NULL; | ||||||
|  |   WORD iicon; | ||||||
|  |   HICON hicon; | ||||||
|  |    | ||||||
|  |   if (!filename || !filename[0]) | ||||||
|  |     return NULL; | ||||||
|  |  | ||||||
|  |   hicon = ExtractAssociatedIcon (GetModuleHandle (NULL), filename, &iicon); | ||||||
|  |   if (hicon > (HICON)1) | ||||||
|  |     { | ||||||
|  |       ICONINFO ii; | ||||||
|  |  | ||||||
|  |       if (GetIconInfo (hicon, &ii)) | ||||||
|  |         { | ||||||
|  |           SIZE   size; | ||||||
|  |           GdkPixmap *pixmap; | ||||||
|  |           GdkGC *gc; | ||||||
|  |           HDC    hdc; | ||||||
|  |  | ||||||
|  |           if (!GetBitmapDimensionEx (ii.hbmColor, &size)) | ||||||
|  |             g_warning ("GetBitmapDimensionEx failed."); | ||||||
|  |  | ||||||
|  | 	  if (size.cx < 1) size.cx = 32; | ||||||
|  | 	  if (size.cy < 1) size.cy = 32; | ||||||
|  | 	     | ||||||
|  |           pixmap = gdk_pixmap_new (NULL, size.cx, size.cy,  | ||||||
|  | 	                           gdk_screen_get_system_visual (gdk_screen_get_default ())->depth); | ||||||
|  |           gc = gdk_gc_new (pixmap); | ||||||
|  |           hdc = gdk_win32_hdc_get (GDK_DRAWABLE (pixmap), gc, 0); | ||||||
|  |  | ||||||
|  |           if (!DrawIcon (hdc, 0, 0, hicon)) | ||||||
|  |             g_warning ("DrawIcon failed"); | ||||||
|  |  | ||||||
|  |           gdk_win32_hdc_release (GDK_DRAWABLE (pixmap), gc, 0); | ||||||
|  |  | ||||||
|  |           pixbuf = gdk_pixbuf_get_from_drawable ( | ||||||
|  | 		     NULL, pixmap,  | ||||||
|  | 		     gdk_screen_get_system_colormap (gdk_screen_get_default ()), | ||||||
|  | 		     0, 0, 0, 0, size.cx, size.cy); | ||||||
|  |           g_object_unref (pixmap); | ||||||
|  |           g_object_unref (gc); | ||||||
|  |         } | ||||||
|  |       else | ||||||
|  |         g_print ("GetIconInfo failed: %s\n", g_win32_error_message (GetLastError ()));  | ||||||
|  |  | ||||||
|  |       if (!DestroyIcon (hicon)) | ||||||
|  |         g_warning ("DestroyIcon failed"); | ||||||
|  |     } | ||||||
|  |   else | ||||||
|  |     g_print ("ExtractAssociatedIcon failed: %s\n", g_win32_error_message (GetLastError ())); | ||||||
|  |  | ||||||
|  |   return pixbuf; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | static GtkIconSet * | ||||||
|  | win32_pseudo_mime_lookup (const char* name) | ||||||
|  | { | ||||||
|  |   static GHashTable *mime_hash = NULL; | ||||||
|  |   GtkIconSet *is = NULL; | ||||||
|  |   char *p = strrchr(name, '.'); | ||||||
|  |   char *extension = p ? g_ascii_strdown (p, -1) : g_strdup (""); | ||||||
|  |  | ||||||
|  |   if (!mime_hash) | ||||||
|  |     mime_hash = g_hash_table_new (g_str_hash, g_str_equal); | ||||||
|  |  | ||||||
|  |   /* do we already have it ? */ | ||||||
|  |   is = g_hash_table_lookup (mime_hash, extension); | ||||||
|  |   if (is) | ||||||
|  |     { | ||||||
|  |       g_free (extension); | ||||||
|  |       return is; | ||||||
|  |     } | ||||||
|  |   /* create icon and set */ | ||||||
|  |   { | ||||||
|  |     GdkPixbuf *pixbuf = extract_icon (name); | ||||||
|  |     if (pixbuf) | ||||||
|  |       { | ||||||
|  |         GtkIconSource* source = gtk_icon_source_new (); | ||||||
|  |  | ||||||
|  |         is = gtk_icon_set_new_from_pixbuf (pixbuf); | ||||||
|  | 	gtk_icon_source_set_pixbuf (source, pixbuf); | ||||||
|  | 	gtk_icon_set_add_source (is, source); | ||||||
|  |  | ||||||
|  | 	gtk_icon_source_free (source); | ||||||
|  |       } | ||||||
|  |  | ||||||
|  |     g_hash_table_insert (mime_hash, extension, is); | ||||||
|  |     return is; | ||||||
|  |   } | ||||||
|  | } | ||||||
|  |  | ||||||
|  | static GdkPixbuf * | ||||||
|  | gtk_file_system_win32_render_icon (GtkFileSystem     *file_system, | ||||||
|  |                                    const GtkFilePath *path, | ||||||
|  |                                    GtkWidget         *widget, | ||||||
|  |                                    gint               pixel_size, | ||||||
|  |                                    GError           **error) | ||||||
|  | { | ||||||
|  |   GtkIconSet *icon_set = NULL; | ||||||
|  |   const char* filename = gtk_file_path_get_string (path); | ||||||
|  |  | ||||||
|  |   /* handle drives with stock icons */ | ||||||
|  |   if (filename_is_root (filename)) | ||||||
|  |     { | ||||||
|  |       gchar *filename2 = g_strconcat(filename, "\\", NULL); | ||||||
|  |       DWORD dt = GetDriveType (filename2); | ||||||
|  |  | ||||||
|  |       switch (dt) | ||||||
|  |         { | ||||||
|  |         case DRIVE_REMOVABLE : | ||||||
|  |           icon_set = gtk_style_lookup_icon_set (widget->style, GTK_STOCK_FLOPPY); | ||||||
|  |           break; | ||||||
|  |         case DRIVE_CDROM : | ||||||
|  |           icon_set = gtk_style_lookup_icon_set (widget->style, GTK_STOCK_CDROM); | ||||||
|  |           break; | ||||||
|  |         case DRIVE_FIXED : /* need a hard disk icon */ | ||||||
|  |           icon_set = gtk_style_lookup_icon_set (widget->style, GTK_STOCK_CDROM); | ||||||
|  |           break; | ||||||
|  |         default : | ||||||
|  |           break; | ||||||
|  |         } | ||||||
|  |       g_free (filename2); | ||||||
|  |     } | ||||||
|  |   else if (g_file_test (filename, G_FILE_TEST_IS_DIR)) | ||||||
|  |     { | ||||||
|  |       if (0 == strcmp (g_get_home_dir(), filename)) | ||||||
|  |         icon_set = gtk_style_lookup_icon_set (widget->style, GTK_STOCK_HOME); | ||||||
|  |       else | ||||||
|  |         icon_set = gtk_style_lookup_icon_set (widget->style, GTK_STOCK_OPEN); | ||||||
|  |     } | ||||||
|  |   else if (g_file_test (filename, G_FILE_TEST_IS_EXECUTABLE)) | ||||||
|  |     { | ||||||
|  |       /* don't lookup all executable icons */ | ||||||
|  |       icon_set = gtk_style_lookup_icon_set (widget->style, GTK_STOCK_EXECUTE); | ||||||
|  |     } | ||||||
|  |   else if (g_file_test (filename, G_FILE_TEST_EXISTS)) | ||||||
|  |     { | ||||||
|  |       icon_set = win32_pseudo_mime_lookup (filename); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |   if (!icon_set) | ||||||
|  |     { | ||||||
|  |        g_set_error (error, | ||||||
|  |      	          GTK_FILE_SYSTEM_ERROR, | ||||||
|  |      	          GTK_FILE_SYSTEM_ERROR_FAILED, | ||||||
|  |      	          _("This file system does not support icons for everything")); | ||||||
|  |        return NULL; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |   // 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 ? | ||||||
|  |   return gtk_icon_set_render_icon (icon_set,  | ||||||
|  |                                    widget->style, | ||||||
|  |                                    gtk_widget_get_direction (widget), | ||||||
|  |                                    GTK_STATE_NORMAL, | ||||||
|  |                                    GTK_ICON_SIZE_BUTTON, | ||||||
|  | 				   widget, NULL);  | ||||||
|  | } | ||||||
|  |  | ||||||
| static GSList *_bookmarks = NULL; | static GSList *_bookmarks = NULL; | ||||||
|  |  | ||||||
| static gboolean | static gboolean | ||||||
| @ -881,7 +1055,9 @@ filename_get_info (const gchar     *filename, | |||||||
| 		   GError         **error) | 		   GError         **error) | ||||||
| { | { | ||||||
|   GtkFileInfo *info; |   GtkFileInfo *info; | ||||||
|  | #if 0 /* it's dead in GtkFileSystemUnix.c, too */ | ||||||
|   GtkFileIconType icon_type = GTK_FILE_ICON_REGULAR; |   GtkFileIconType icon_type = GTK_FILE_ICON_REGULAR; | ||||||
|  | #endif | ||||||
|   WIN32_FILE_ATTRIBUTE_DATA wfad; |   WIN32_FILE_ATTRIBUTE_DATA wfad; | ||||||
|  |  | ||||||
|   if (!GetFileAttributesEx (filename, GetFileExInfoStandard, &wfad)) |   if (!GetFileAttributesEx (filename, GetFileExInfoStandard, &wfad)) | ||||||
| @ -940,6 +1116,7 @@ filename_get_info (const gchar     *filename, | |||||||
|       gtk_file_info_set_is_folder (info, !!(wfad.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)); |       gtk_file_info_set_is_folder (info, !!(wfad.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)); | ||||||
|    } |    } | ||||||
|  |  | ||||||
|  | #if 0 /* it's dead in GtkFileSystemUnix.c, too */ | ||||||
|   if (types & GTK_FILE_INFO_ICON) |   if (types & GTK_FILE_INFO_ICON) | ||||||
|     { |     { | ||||||
|       if (wfad.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) |       if (wfad.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) | ||||||
| @ -947,9 +1124,13 @@ filename_get_info (const gchar     *filename, | |||||||
|  |  | ||||||
|       gtk_file_info_set_icon_type (info, icon_type); |       gtk_file_info_set_icon_type (info, icon_type); | ||||||
|     } |     } | ||||||
|  | #endif | ||||||
|  |  | ||||||
|   if ((types & GTK_FILE_INFO_MIME_TYPE) || |   if ((types & GTK_FILE_INFO_MIME_TYPE) | ||||||
|       ((types & GTK_FILE_INFO_ICON) && icon_type == GTK_FILE_ICON_REGULAR)) | #if 0 /* it's dead in GtkFileSystemUnix.c, too */ | ||||||
|  |       || ((types & GTK_FILE_INFO_ICON) && icon_type == GTK_FILE_ICON_REGULAR) | ||||||
|  | #endif | ||||||
|  |      ) | ||||||
|     { |     { | ||||||
| #if 0 | #if 0 | ||||||
|       const char *mime_type = xdg_mime_get_mime_type_for_file (filename); |       const char *mime_type = xdg_mime_get_mime_type_for_file (filename); | ||||||
|  | |||||||
| @ -418,7 +418,11 @@ _gtk_im_module_list (const GtkIMContextInfo ***contexts, | |||||||
|     SIMPLE_ID, |     SIMPLE_ID, | ||||||
|     N_("Default"), |     N_("Default"), | ||||||
|     GETTEXT_PACKAGE, |     GETTEXT_PACKAGE, | ||||||
|  | #ifdef GTK_LOCALEDIR | ||||||
|     GTK_LOCALEDIR, |     GTK_LOCALEDIR, | ||||||
|  | #else | ||||||
|  |     "", | ||||||
|  | #endif | ||||||
|     "" |     "" | ||||||
|   }; |   }; | ||||||
|  |  | ||||||
|  | |||||||
| @ -274,6 +274,17 @@ check_setugid (void) | |||||||
|  |  | ||||||
| G_WIN32_DLLMAIN_FOR_DLL_NAME(static, dll_name) | G_WIN32_DLLMAIN_FOR_DLL_NAME(static, dll_name) | ||||||
|  |  | ||||||
|  | const gchar * | ||||||
|  | _gtk_get_datadir (void) | ||||||
|  | { | ||||||
|  |   static char *gtk_datadir = NULL; | ||||||
|  |   if (gtk_datadir == NULL) | ||||||
|  |     gtk_datadir = g_win32_get_package_installation_subdirectory | ||||||
|  |       (GETTEXT_PACKAGE, dll_name, "share"); | ||||||
|  |  | ||||||
|  |   return gtk_datadir; | ||||||
|  | } | ||||||
|  |  | ||||||
| const gchar * | const gchar * | ||||||
| _gtk_get_libdir (void) | _gtk_get_libdir (void) | ||||||
| { | { | ||||||
|  | |||||||
| @ -80,11 +80,14 @@ typedef enum | |||||||
|  |  | ||||||
| #ifdef G_OS_WIN32 | #ifdef G_OS_WIN32 | ||||||
|  |  | ||||||
|  | const gchar *_gtk_get_datadir (); | ||||||
| const gchar *_gtk_get_libdir (); | const gchar *_gtk_get_libdir (); | ||||||
| const gchar *_gtk_get_sysconfdir (); | const gchar *_gtk_get_sysconfdir (); | ||||||
| const gchar *_gtk_get_localedir (); | const gchar *_gtk_get_localedir (); | ||||||
| const gchar *_gtk_get_data_prefix (); | const gchar *_gtk_get_data_prefix (); | ||||||
|  |  | ||||||
|  | #undef GTK_DATADIR | ||||||
|  | #define GTK_DATADIR _gtk_get_datadir () | ||||||
| #undef GTK_LIBDIR | #undef GTK_LIBDIR | ||||||
| #define GTK_LIBDIR _gtk_get_libdir () | #define GTK_LIBDIR _gtk_get_libdir () | ||||||
| #undef GTK_LOCALEDIR | #undef GTK_LOCALEDIR | ||||||
|  | |||||||
| @ -32,7 +32,7 @@ print_current_folder (GtkFileChooser *chooser) | |||||||
|   gchar *uri; |   gchar *uri; | ||||||
|  |  | ||||||
|   uri = gtk_file_chooser_get_current_folder_uri (chooser); |   uri = gtk_file_chooser_get_current_folder_uri (chooser); | ||||||
|   g_print ("Current folder changed :\n  %s\n", uri); |   g_print ("Current folder changed :\n  %s\n", uri ? uri : "(null)"); | ||||||
|   g_free (uri); |   g_free (uri); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 Hans Breuer
					Hans Breuer