[easytag/wip/mingw: 4/10] Several fixes to compile for mingw



commit 325d0398d27bbea811ba8d1c6673d27824cd9419
Author: David King <amigadave amigadave com>
Date:   Tue Jan 15 21:55:29 2013 +0000

    Several fixes to compile for mingw

 src/browser.c             |   27 ++++++++++++++++-----------
 src/easytag.c             |   11 +++++++----
 src/libapetag/apetaglib.c |   24 +-----------------------
 src/prefs.c               |    3 +++
 4 files changed, 27 insertions(+), 38 deletions(-)
---
diff --git a/src/browser.c b/src/browser.c
index b20bf58..f6cedfa 100644
--- a/src/browser.c
+++ b/src/browser.c
@@ -54,7 +54,6 @@
 #include <assert.h>
 
 #ifdef G_OS_WIN32
-#include <windows.h>
 #include "win32/win32dep.h"
 #endif /* G_OS_WIN32 */
 
@@ -76,7 +75,7 @@
 // Pixmaps
 static GdkPixbuf *opened_folder_pixmap = NULL, *closed_folder_pixmap, *closed_folder_readonly_pixmap, *closed_folder_unreadable_pixmap;
 #ifdef G_OS_WIN32
-// Pixmap used for Win32 only
+/* Pixmap used for Win32 only. */
 static GdkPixbuf *harddrive_pixmap, *removable_pixmap, *cdrom_pixmap, *network_pixmap, *ramdisk_pixmap;
 #endif /* G_OS_WIN32 */
 
@@ -686,7 +685,9 @@ Browser_List_Button_Press (GtkTreeView *treeView, GdkEventButton *event)
  */
 void Browser_Tree_Collapse (void)
 {
+#ifndef G_OS_WIN32
     GtkTreePath *rootPath;
+#endif /* !G_OS_WIN32 */
 
     g_return_if_fail (BrowserTree != NULL);
 
@@ -3055,6 +3056,10 @@ GtkWidget *Create_Browser_Items (GtkWidget *parent)
     /* Create pixmaps */
     if(!opened_folder_pixmap)
     {
+#ifdef G_OS_WIN32
+        GtkStyle *style = gtk_widget_get_style (parent);
+#endif /* G_OS_WIN32 */
+
         opened_folder_pixmap            = gdk_pixbuf_new_from_xpm_data(opened_folder_xpm);
         closed_folder_pixmap            = gdk_pixbuf_new_from_xpm_data(closed_folder_xpm);
         closed_folder_readonly_pixmap   = gdk_pixbuf_new_from_xpm_data(closed_folder_readonly_xpm);
@@ -3062,29 +3067,29 @@ GtkWidget *Create_Browser_Items (GtkWidget *parent)
 
 #ifdef G_OS_WIN32
         /* get GTK's theme harddrive and removable icons and render it in a pixbuf */
-        harddrive_pixmap =  gtk_icon_set_render_icon(gtk_style_lookup_icon_set(parent->style, GTK_STOCK_HARDDISK),
-                                                     parent->style,
+        harddrive_pixmap = gtk_icon_set_render_icon (gtk_style_lookup_icon_set (style, GTK_STOCK_HARDDISK),
+                                                     style,
                                                      gtk_widget_get_direction(parent),
                                                      GTK_STATE_NORMAL,
                                                      GTK_ICON_SIZE_BUTTON,
                                                      parent, NULL);
 
-        removable_pixmap =  gtk_icon_set_render_icon(gtk_style_lookup_icon_set(parent->style, GTK_STOCK_FLOPPY),
-                                                     parent->style,
+        removable_pixmap = gtk_icon_set_render_icon (gtk_style_lookup_icon_set (style, GTK_STOCK_FLOPPY),
+                                                     style,
                                                      gtk_widget_get_direction(parent),
                                                      GTK_STATE_NORMAL,
                                                      GTK_ICON_SIZE_BUTTON,
                                                      parent, NULL);
 
-        cdrom_pixmap =  gtk_icon_set_render_icon(gtk_style_lookup_icon_set(parent->style, GTK_STOCK_CDROM),
-                                                 parent->style,
+        cdrom_pixmap =  gtk_icon_set_render_icon (gtk_style_lookup_icon_set (style, GTK_STOCK_CDROM),
+                                                 style,
                                                  gtk_widget_get_direction(parent),
                                                  GTK_STATE_NORMAL,
                                                  GTK_ICON_SIZE_BUTTON,
                                                  parent, NULL);
 
-        network_pixmap =  gtk_icon_set_render_icon(gtk_style_lookup_icon_set(parent->style, GTK_STOCK_NETWORK),
-                                                   parent->style,
+        network_pixmap =  gtk_icon_set_render_icon (gtk_style_lookup_icon_set (style, GTK_STOCK_NETWORK),
+                                                   style,
                                                    gtk_widget_get_direction(parent),
                                                    GTK_STATE_NORMAL,
                                                    GTK_ICON_SIZE_BUTTON,
@@ -4610,7 +4615,7 @@ Run_Program (const gchar *program_name, GList *args_list)
         default:
             break;
     }
+#endif /* !G_OS_WIN32 */
 
     return TRUE;
-#endif /* !G_OS_WIN32 */
 }
diff --git a/src/easytag.c b/src/easytag.c
index 865248f..96deaf1 100644
--- a/src/easytag.c
+++ b/src/easytag.c
@@ -101,8 +101,13 @@ gint     SF_ButtonPressed_Delete_File;
 /**************
  * Prototypes *
  **************/
+#ifdef G_OS_WIN32
+int easytag_main (struct HINSTANCE__ *hInstance, int argc, char *argv[]);
+#endif /* G_OS_WIN32 */
+#ifndef G_OS_WIN32
 static void Handle_Crash (gint signal_id);
 static const gchar *signal_to_string (gint signal);
+#endif /* !G_OS_WIN32 */
 
 static GtkWidget *Create_Browser_Area (void);
 static GtkWidget *Create_File_Area    (void);
@@ -178,11 +183,7 @@ setup_sigchld (void)
 /********
  * Main *
  ********/
-#ifdef G_OS_WIN32
-int easytag_main (struct HINSTANCE__ *hInstance, int argc, char *argv[]) /* entry point of DLL */
-#else /* !G_OS_WIN32 */
 int main (int argc, char *argv[])
-#endif /* !G_OS_WIN32 */
 {
     GtkWidget *MainVBox;
     GtkWidget *HBox, *VBox;
@@ -4754,6 +4755,7 @@ void Attach_Popup_Menu_To_Tag_Entries (GtkEntry *entry)
  * Function to manage the received signals (specially for segfaults)
  * Handle crashs
  */
+#ifndef G_OS_WIN32
 static void
 Handle_Crash (gint signal_id)
 {
@@ -4902,6 +4904,7 @@ signal_to_string (gint signal)
 #endif
     return (_("Unknown signal"));
 }
+#endif /* !G_OS_WIN32 */
 
 
 /*
diff --git a/src/libapetag/apetaglib.c b/src/libapetag/apetaglib.c
index 52fc971..217074d 100644
--- a/src/libapetag/apetaglib.c
+++ b/src/libapetag/apetaglib.c
@@ -34,6 +34,7 @@
 #endif
 #include "apetaglib.h"
 #include "../genres.h"
+#include "../win32/win32dep.h"
 
 #include "is_tag.h"
 #ifdef ID3V2_READ
@@ -864,29 +865,6 @@ libapetag_qsort (struct tag **a, struct tag **b)
         return -1;
 }
 
-#ifdef USE_CHSIZE
-#include <fcntl.h>
-#include <sys/stat.h>
-#include <io.h>
-/* on winblows we don't have truncate (and ftruncate) but have chsize() */
-void
-truncate (char *filename, size_t fileSize)
-{
-    int handle;
-
-    handle = open (filename, O_RDWR | O_CREAT,
-            S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
-    if (handle != -1) {
-        if (chsize (handle, fileSize) != 0) {
-            PRINT_ERR ("Error truncatng file\n");
-        }
-        close (handle);
-    }
-
-}
-
-#endif
-
 /*
     PL: domyslne %flag% = APE_TAG_V2 + SAVE_NEW_OLD_APE_TAG
 */
diff --git a/src/prefs.c b/src/prefs.c
index be65652..b3d4be6 100644
--- a/src/prefs.c
+++ b/src/prefs.c
@@ -41,6 +41,9 @@
 #include "browser.h"
 #include "cddb.h"
 #include "charset.h"
+#ifdef G_OS_WIN32
+#include "win32/win32dep.h"
+#endif /* G_OS_WIN32 */
 
 /**************
  * Prototypes *



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]