[easytag/wip/mingw: 3/8] Several fixes to compile for mingw



commit 73b98b8f144309246cb051563a6a934c1cfcf403
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 d91c11c..2fbe809 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 */
 
@@ -670,7 +669,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);
 
@@ -3039,6 +3040,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);
@@ -3046,29 +3051,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,
@@ -4594,7 +4599,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 48eccd3..f7c8589 100644
--- a/src/easytag.c
+++ b/src/easytag.c
@@ -100,8 +100,13 @@ static 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);
@@ -173,11 +178,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;
@@ -4749,6 +4750,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)
 {
@@ -4897,6 +4899,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 0d0ac7a..cb887f9 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 3363c29..e1c543c 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]