[easytag] Use G_OS_WIN32 to contain Windows code
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [easytag] Use G_OS_WIN32 to contain Windows code
- Date: Sat, 12 Jan 2013 09:21:14 +0000 (UTC)
commit 4255c0af75fde90ce96306e50bf260f490da1dc7
Author: David King <amigadave amigadave com>
Date: Fri Jan 11 22:19:28 2013 +0000
Use G_OS_WIN32 to contain Windows code
WIN32 was used previously, but was no longer set by the configure
script.
src/bar.c | 11 +++---
src/browser.c | 98 +++++++++++++++++++++++++----------------------------
src/cddb.c | 24 +++++++-------
src/charset.c | 54 +++++++++++++++---------------
src/easytag.c | 66 +++++++++++++++++++-----------------
src/et_core.c | 18 +++++-----
src/id3v24_tag.c | 6 ++--
src/log.c | 6 ++--
src/misc.c | 32 ++++++++---------
src/ogg_tag.c | 6 ++--
src/picture.c | 32 ++++++++++--------
src/prefs.c | 32 +++++++++---------
src/setting.c | 44 +++++++++++++-----------
src/ui_manager.h | 8 ++--
14 files changed, 219 insertions(+), 218 deletions(-)
---
diff --git a/src/bar.c b/src/bar.c
index e7513b2..715beb1 100644
--- a/src/bar.c
+++ b/src/bar.c
@@ -270,10 +270,11 @@ void Create_UI (GtkWidget **ppmenubar, GtkWidget **pptoolbar)
{
//{ AM_BROWSE_SUBDIR, GTK_STOCK_INDEX, _("Browse _Subdirectories"), NULL, _("Browse _Sub-directories"), NULL, FALSE },
{ AM_BROWSE_SUBDIR, NULL, _("Browse _Subdirectories"), NULL, _("Browse subdirectories"), NULL, BROWSE_SUBDIR },
-#ifndef WIN32 // No sense here for Win32, "hidden" means : starts with a '.'
- //{ AM_BROWSER_HIDDEN_DIR, NULL, _("Show Hidden Directories"), NULL, _("Show Hidden Directories"), G_CALLBACK(Browser_Tree_Rebuild), FALSE },
+#ifndef G_OS_WIN32 /* No sense here for Win32, "hidden" means : starts with a
+ * '.'
+ */
{ AM_BROWSER_HIDDEN_DIR, NULL, _("Show Hidden Directories"), NULL, _("Show hidden directories"), G_CALLBACK(Browser_Tree_Rebuild), BROWSE_HIDDEN_DIR },
-#endif
+#endif /* !G_OS_WIN32 */
{ AM_VIEWMODE_TOGGLE, "easytag-artist-album", _("Show Tree Browser / Display by Artist and Album"), NULL, _("Show tree browser / display by artist and Album"), G_CALLBACK(Action_Select_Browser_Style), FALSE },
};
@@ -392,9 +393,9 @@ Check_Menu_Item_Toggled_Browse_Hidden_Dir (GtkWidget *checkmenuitem)
void
Check_Menu_Item_Update_Browse_Hidden_Dir (void)
{
-#ifndef WIN32
+#ifndef G_OS_WIN32
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(CheckMenuItemBrowseHiddenDirMainMenu),BROWSE_HIDDEN_DIR);
-#endif
+#endif /* !G_OS_WIN32 */
}
diff --git a/src/browser.c b/src/browser.c
index f914fbd..ef967af 100644
--- a/src/browser.c
+++ b/src/browser.c
@@ -53,19 +53,19 @@
#include <assert.h>
-#ifdef WIN32
-# include <windows.h>
-# include "win32/win32dep.h"
-#endif
+#ifdef G_OS_WIN32
+#include <windows.h>
+#include "win32/win32dep.h"
+#endif /* G_OS_WIN32 */
/* Pixmaps */
#include "pixmaps/opened_folder.xpm"
#include "pixmaps/closed_folder.xpm"
#include "pixmaps/closed_folder_readonly.xpm"
#include "pixmaps/closed_folder_unreadable.xpm"
-#ifdef WIN32
+#ifdef G_OS_WIN32
#include "pixmaps/ram_disk.xpm"
-#endif
+#endif /* G_OS_WIN32 */
@@ -75,10 +75,10 @@
// Pixmaps
static GdkPixbuf *opened_folder_pixmap = NULL, *closed_folder_pixmap, *closed_folder_readonly_pixmap, *closed_folder_unreadable_pixmap;
-#ifdef WIN32
+#ifdef G_OS_WIN32
// Pixmap used for Win32 only
static GdkPixbuf *harddrive_pixmap, *removable_pixmap, *cdrom_pixmap, *network_pixmap, *ramdisk_pixmap;
-#endif
+#endif /* G_OS_WIN32 */
GtkWidget *BrowserTree; // Tree of directories
GtkTreeStore *directoryTreeModel;
@@ -340,10 +340,10 @@ Browser_Update_Current_Path (const gchar *path)
g_free(BrowserCurrentPath);
BrowserCurrentPath = g_strdup(path);
-#ifdef WIN32
+#ifdef G_OS_WIN32
/* On win32 : "c:\path\to\dir" succeed with stat() for example, while "c:\path\to\dir\" fails */
ET_Win32_Path_Remove_Trailing_Backslash(BrowserCurrentPath);
-#endif
+#endif /* G_OS_WIN32 */
if (strcmp(G_DIR_SEPARATOR_S,BrowserCurrentPath) == 0)
gtk_widget_set_sensitive(BrowserButton,FALSE);
@@ -696,12 +696,12 @@ void Browser_Tree_Collapse (void)
gtk_tree_view_collapse_all(GTK_TREE_VIEW(BrowserTree));
-#ifndef WIN32
+#ifndef G_OS_WIN32
/* But keep the main directory opened */
rootPath = gtk_tree_path_new_first();
gtk_tree_view_expand_to_path(GTK_TREE_VIEW(BrowserTree), rootPath);
gtk_tree_path_free(rootPath);
-#endif
+#endif /* !G_OS_WIN32 */
}
@@ -914,10 +914,10 @@ gboolean Browser_Tree_Select_Dir (const gchar *current_path)
return TRUE;
}
-#ifdef WIN32
+#ifdef G_OS_WIN32
/* On win32 : stat("c:\path\to\dir") succeed, while stat("c:\path\to\dir\") fails */
ET_Win32_Path_Remove_Trailing_Backslash(current_path);
-#endif
+#endif /* G_OS_WIN32 */
/* Don't check here if the path is valid. It will be done later when
@@ -928,13 +928,13 @@ gboolean Browser_Tree_Select_Dir (const gchar *current_path)
parts = g_strsplit(current_path, G_DIR_SEPARATOR_S, 0);
// Expand root node (fill parentNode and rootPath)
-#ifdef WIN32
+#ifdef G_OS_WIN32
if (!Browser_Win32_Get_Drive_Root(parts[0], &parentNode, &rootPath))
return FALSE;
-#else
+#else /* !G_OS_WIN32 */
gtk_tree_model_get_iter_first(GTK_TREE_MODEL(directoryTreeModel), &parentNode);
rootPath = gtk_tree_path_new_first();
-#endif
+#endif /* !G_OS_WIN32 */
if (rootPath)
{
gtk_tree_view_expand_to_path(GTK_TREE_VIEW(BrowserTree), rootPath);
@@ -959,11 +959,11 @@ gboolean Browser_Tree_Select_Dir (const gchar *current_path)
TREE_COLUMN_FULL_PATH, &temp, -1);
nodeName = g_path_get_basename(temp);
g_free(temp);
-#ifdef WIN32
+#ifdef G_OS_WIN32
if (strcasecmp(parts[index],nodeName) == 0)
-#else
+#else /* !G_OS_WIN32 */
if (strcmp(parts[index],nodeName) == 0)
-#endif
+#endif /* !G_OS_WIN32 */
{
g_free(nodeName);
break;
@@ -2396,8 +2396,7 @@ Browser_Tree_Initialize (void)
gtk_tree_store_clear(directoryTreeModel);
-#ifdef WIN32
-
+#ifdef G_OS_WIN32
/* Code strangely familiar with gtkfilesystemwin32.c */
GdkPixbuf *drive_pixmap;
@@ -2474,8 +2473,7 @@ Browser_Tree_Initialize (void)
drive_slashless[0]++;
}
-#else
-
+#else /* !G_OS_WIN32 */
gtk_tree_store_append(directoryTreeModel, &parent_iter, NULL);
gtk_tree_store_set(directoryTreeModel, &parent_iter,
TREE_COLUMN_DIR_NAME, G_DIR_SEPARATOR_S,
@@ -2486,9 +2484,7 @@ Browser_Tree_Initialize (void)
-1);
// insert dummy node
gtk_tree_store_append(directoryTreeModel, &dummy_iter, &parent_iter);
-
-#endif
-
+#endif /* !G_OS_WIN32 */
}
/*
@@ -2566,12 +2562,12 @@ Browser_Tree_Rename_Directory (const gchar *last_path, const gchar *new_path)
*/
textsplit = g_strsplit(last_path, G_DIR_SEPARATOR_S, 0);
-#ifdef WIN32
+#ifdef G_OS_WIN32
if (!Browser_Win32_Get_Drive_Root(textsplit[0], &iter, &parentpath))
return;
-#else
+#else /* !G_OS_WIN32 */
parentpath = gtk_tree_path_new_first();
-#endif
+#endif /* !G_OS_WIN32 */
for (i = 1; textsplit[i] != NULL; i++)
{
@@ -2720,12 +2716,12 @@ static gboolean check_for_subdir (gchar *path)
&& (g_ascii_strncasecmp(dirent->d_name+1,".", 1) != 0) ))
)
{
-#ifdef WIN32
+#ifdef G_OS_WIN32
// On win32 : stat("/path/to/dir") succeed, while stat("/path/to/dir/") fails
npath = g_strconcat(path,dirent->d_name,NULL);
-#else
+#else /* !G_OS_WIN32 */
npath = g_strconcat(path,dirent->d_name,G_DIR_SEPARATOR_S,NULL);
-#endif
+#endif /* !G_OS_WIN32 */
if (stat(npath,&statbuf) == -1)
{
@@ -2923,7 +2919,7 @@ static void expand_cb (GtkWidget *tree, GtkTreeIter *iter, GtkTreePath *gtreePat
gtk_tree_model_iter_children(GTK_TREE_MODEL(directoryTreeModel), &subNodeIter, iter);
gtk_tree_store_remove(directoryTreeModel, &subNodeIter);
-#ifdef WIN32
+#ifdef G_OS_WIN32
// set open folder pixmap except on drive (depth == 0)
if (gtk_tree_path_get_depth(gtreePath) > 1)
{
@@ -2932,12 +2928,12 @@ static void expand_cb (GtkWidget *tree, GtkTreeIter *iter, GtkTreePath *gtreePat
TREE_COLUMN_SCANNED, TRUE,
TREE_COLUMN_PIXBUF, opened_folder_pixmap, -1);
}
-#else
+#else /* !G_OS_WIN32 */
// update the icon of the node to opened folder :-)
gtk_tree_store_set(directoryTreeModel, iter,
TREE_COLUMN_SCANNED, TRUE,
TREE_COLUMN_PIXBUF, opened_folder_pixmap, -1);
-#endif
+#endif /* !G_OS_WIN32 */
gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(directoryTreeModel),
TREE_COLUMN_DIR_NAME, GTK_SORT_ASCENDING);
@@ -2959,7 +2955,7 @@ static void collapse_cb (GtkWidget *tree, GtkTreeIter *iter, GtkTreePath *treePa
gtk_tree_store_remove(directoryTreeModel, &subNodeIter);
}
-#ifdef WIN32
+#ifdef G_OS_WIN32
// set closed folder pixmap except on drive (depth == 0)
if(gtk_tree_path_get_depth(treePath) > 1)
{
@@ -2968,12 +2964,12 @@ static void collapse_cb (GtkWidget *tree, GtkTreeIter *iter, GtkTreePath *treePa
TREE_COLUMN_SCANNED, FALSE,
TREE_COLUMN_PIXBUF, closed_folder_pixmap, -1);
}
-#else
+#else /* !G_OS_WIN32 */
// update the icon of the node to closed folder :-)
gtk_tree_store_set(directoryTreeModel, iter,
TREE_COLUMN_SCANNED, FALSE,
TREE_COLUMN_PIXBUF, closed_folder_pixmap, -1);
-#endif
+#endif /* !G_OS_WIN32 */
// insert dummy node
gtk_tree_store_append(directoryTreeModel, &subNodeIter, iter);
@@ -3066,7 +3062,7 @@ GtkWidget *Create_Browser_Items (GtkWidget *parent)
closed_folder_readonly_pixmap = gdk_pixbuf_new_from_xpm_data(closed_folder_readonly_xpm);
closed_folder_unreadable_pixmap = gdk_pixbuf_new_from_xpm_data(closed_folder_unreadable_xpm);
-#ifdef WIN32
+#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,
@@ -3097,8 +3093,7 @@ GtkWidget *Create_Browser_Items (GtkWidget *parent)
parent, NULL);
ramdisk_pixmap = gdk_pixbuf_new_from_xpm_data(ram_disk_xpm);
-
-#endif
+#endif /* G_OS_WIN32 */
}
/* Browser NoteBook :
@@ -4253,10 +4248,10 @@ void Run_Program_With_Directory (GtkWidget *combobox)
program_name = g_strdup(gtk_entry_get_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(combobox)))));
current_directory = g_object_get_data(G_OBJECT(combobox), "Current_Directory");
-#ifdef WIN32
+#ifdef G_OS_WIN32
/* On win32 : 'winamp.exe "c:\path\to\dir"' succeed, while 'winamp.exe "c:\path\to\dir\"' fails */
ET_Win32_Path_Remove_Trailing_Backslash(current_directory);
-#endif
+#endif /* G_OS_WIN32 */
// List of parameters (here only one! : the current directory)
args_list = g_list_append(args_list,current_directory);
@@ -4466,7 +4461,7 @@ Run_Program_With_Selected_Files (GtkWidget *combobox)
static gboolean
Run_Program (const gchar *program_name, GList *args_list)
{
-#ifdef WIN32
+#ifdef G_OS_WIN32
GList *filelist;
gchar **argv;
gint argv_index = 0;
@@ -4474,9 +4469,9 @@ Run_Program (const gchar *program_name, GList *args_list)
gchar *full_command;
STARTUPINFO siStartupInfo;
PROCESS_INFORMATION piProcessInfo;
-#else
+#else /* !G_OS_WIN32 */
pid_t pid;
-#endif
+#endif /* !G_OS_WIN32 */
gchar *program_path;
@@ -4516,8 +4511,7 @@ Run_Program (const gchar *program_name, GList *args_list)
}
-#ifdef WIN32
-
+#ifdef G_OS_WIN32
filelist = args_list;
// See documentation : http://c.developpez.com/faq/vc/?page=ProcessThread and http://www.answers.com/topic/createprocess
@@ -4566,7 +4560,7 @@ Run_Program (const gchar *program_name, GList *args_list)
g_free(full_command);
g_free(program_path);
-#else
+#else /* !G_OS_WIN32 */
g_free(program_path); // Freed as never used
@@ -4618,7 +4612,7 @@ Run_Program (const gchar *program_name, GList *args_list)
default:
break;
}
- return TRUE;
-#endif
+ return TRUE;
+#endif /* !G_OS_WIN32 */
}
diff --git a/src/cddb.c b/src/cddb.c
index d7fa105..7818820 100644
--- a/src/cddb.c
+++ b/src/cddb.c
@@ -28,16 +28,16 @@
#include <string.h>
#include <stdlib.h>
#include <sys/types.h>
-#ifdef WIN32
-# include "win32/win32dep.h"
-#else
-# include <sys/socket.h>
-// Patch OpenBSD from Jim Geovedi
-# include <netinet/in.h>
-# include <arpa/inet.h>
-// End patch
-# include <netdb.h>
-#endif
+#ifdef G_OS_WIN32
+#include "win32/win32dep.h"
+#else /* !G_OS_WIN32 */
+#include <sys/socket.h>
+/* Patch OpenBSD from Jim Geovedi. */
+#include <netinet/in.h>
+#include <arpa/inet.h>
+/* End patch */
+#include <netdb.h>
+#endif /* !G_OS_WIN32 */
#include <errno.h>
#include "gtk2_compat.h"
@@ -1657,9 +1657,9 @@ Cddb_Open_Connection (const gchar *host, gint port)
static void
Cddb_Close_Connection (gint socket_id)
{
-#ifndef WIN32
+#ifndef G_OS_WIN32
shutdown(socket_id,SHUT_RDWR);
-#endif
+#endif /* !G_OS_WIN32 */
close(socket_id);
if (!CddbWindow)
diff --git a/src/charset.c b/src/charset.c
index 2254edc..f5e429e 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -35,9 +35,9 @@
#include "setting.h"
#include "log.h"
-#ifdef WIN32
- #include "win32/win32dep.h"
-#endif
+#ifdef G_OS_WIN32
+#include "win32/win32dep.h"
+#endif /* G_OS_WIN32 */
/****************
@@ -185,11 +185,11 @@ Charset_Insert_Locales_Init (void)
/* "C" is plain ascii */
insert_locales (encodings, "ASCII", "C", NULL);
-#if WIN32
+#if G_OS_WIN32
insert_locales (encodings, "windows-1256", "ar", NULL); // 2006.12.31 - For testing with Arabic
-#else
+#else /* !G_OS_WIN32 */
insert_locales (encodings, "ISO-8859-6", "ar", NULL);
-#endif
+#endif /* !G_OS_WIN32 */
insert_locales (encodings, "ARMSCII-8", "by", NULL);
insert_locales (encodings, "BIG5", "zh_TW", NULL);
insert_locales (encodings, "CP1251", "be", "bg", NULL);
@@ -203,31 +203,31 @@ Charset_Insert_Locales_Init (void)
/*insert_locales (encodings, "GEORGIAN-ACADEMY", NULL);*/
insert_locales (encodings, "GEORGIAN-PS", "ka", NULL);
insert_locales (encodings, "ISO-8859-1", "br", "ca", "da", "de", "en", "es", "eu", "fi", "fr", "gl", "it", "nl", "wa", "nb", "nn", "pt", "pt", "sv", NULL);
-#if WIN32
+#if G_OS_WIN32
insert_locales (encodings, "windows-1250", "cs", "hr", "hu", "pl", "ro", "sk", "sl", "sq", "sr", NULL);
-#else
+#else /* !G_OS_WIN32 */
insert_locales (encodings, "ISO-8859-2", "cs", "hr", "hu", "pl", "ro", "sk", "sl", "sq", "sr", NULL);
-#endif
+#endif /* !G_OS_WIN32 */
insert_locales (encodings, "ISO-8859-3", "eo", NULL);
insert_locales (encodings, "ISO-8859-5", "mk", "sp", NULL);
-#if WIN32
+#if G_OS_WIN32
insert_locales (encodings, "windows-1253", "el", NULL);
-#else
+#else /* !G_OS_WIN32 */
insert_locales (encodings, "ISO-8859-7", "el", NULL);
-#endif
-#if WIN32
+#endif /* !G_OS_WIN32 */
+#if G_OS_WIN32
insert_locales (encodings, "windows-1254", "tr", NULL);
-#else
+#else /* !G_OS_WIN32 */
insert_locales (encodings, "ISO-8859-9", "tr", NULL);
-#endif
+#endif /* !G_OS_WIN32 */
insert_locales (encodings, "ISO-8859-13", "lt", "lv", "mi", NULL);
insert_locales (encodings, "ISO-8859-14", "ga", "cy", NULL);
insert_locales (encodings, "ISO-8859-15", "et", NULL);
-#if WIN32
+#if G_OS_WIN32
insert_locales (encodings, "windows-1251", "ru", NULL);
-#else
+#else /* !G_OS_WIN32 */
insert_locales (encodings, "KOI8-R", "ru", NULL);
-#endif
+#endif /* !G_OS_WIN32 */
insert_locales (encodings, "KOI8-U", "uk", NULL);
if (check_locale ("TCVN-5712")) {
insert_locales (encodings, "TCVN-5712", "vi", NULL);
@@ -235,9 +235,9 @@ Charset_Insert_Locales_Init (void)
insert_locales (encodings, "TCVN", "vi", NULL);
}
insert_locales (encodings, "TIS-620", "th", NULL);
-#if WIN32
+#if G_OS_WIN32
insert_locales (encodings, "windows-1255", "he", NULL);
-#endif
+#endif /* G_OS_WIN32 */
/*insert_locales (encodings, "VISCII", NULL);*/
}
@@ -516,10 +516,10 @@ filename_to_display (const gchar *string)
}
}
-#ifdef WIN32
- ET_Win32_Path_Remove_Trailing_Slash(ret);
- ET_Win32_Path_Replace_Slashes(ret);
-#endif
+#ifdef G_OS_WIN32
+ ET_Win32_Path_Remove_Trailing_Slash (ret);
+ ET_Win32_Path_Replace_Slashes (ret);
+#endif /* G_OS_WIN32 */
return ret;
}
@@ -614,9 +614,9 @@ gchar *filename_from_display (const gchar *string)
ret = escaped_str;
}
-#ifdef WIN32
- //ET_Win32_Path_Replace_Backslashes(ret);
-#endif
+#ifdef G_OS_WIN32
+ //ET_Win32_Path_Replace_Backslashes (ret);
+#endif /* G_OS_WIN32 */
return ret; // We need to catch errors (e.g. temp=NULL) in the real code
}
diff --git a/src/easytag.c b/src/easytag.c
index af2757b..64d42d4 100644
--- a/src/easytag.c
+++ b/src/easytag.c
@@ -31,10 +31,10 @@
#include <errno.h>
#include <signal.h>
#ifdef ENABLE_MP3
-# include <id3tag.h>
+#include <id3tag.h>
#endif
#if defined ENABLE_MP3 && defined ENABLE_ID3LIB
-# include <id3.h>
+#include <id3.h>
#endif
#include <sys/types.h>
#include <utime.h>
@@ -56,11 +56,11 @@
#include "picture.h"
#include "charset.h"
-#ifdef WIN32
+#ifdef G_OS_WIN32
#include "win32/win32dep.h"
-#else
+#else /* !G_OS_WIN32 */
#include <sys/wait.h>
-#endif
+#endif /* !G_OS_WIN32 */
/****************
@@ -146,7 +146,7 @@ static void Quit_Recursion_Window_Key_Press (GtkWidget *window,
static void File_Area_Set_Sensitive (gboolean activate);
static void Tag_Area_Set_Sensitive (gboolean activate);
-#ifndef WIN32
+#ifndef G_OS_WIN32
static void
setup_sigbus_fpe_segv (void)
{
@@ -174,16 +174,16 @@ setup_sigchld (void)
sa.sa_flags = SA_RESTART;
sigaction (SIGCHLD, &sa, NULL);
}
-#endif /* !WIN32 */
+#endif /* !G_OS_WIN32 */
/********
* Main *
********/
-#ifdef WIN32
+#ifdef G_OS_WIN32
int easytag_main (struct HINSTANCE__ *hInstance, int argc, char *argv[]) /* entry point of DLL */
-#else
+#else /* !G_OS_WIN32 */
int main (int argc, char *argv[])
-#endif
+#endif /* !G_OS_WIN32 */
{
GtkWidget *MainVBox;
GtkWidget *HBox, *VBox;
@@ -191,15 +191,15 @@ int main (int argc, char *argv[])
//GError *error = NULL;
-#ifdef WIN32
+#ifdef G_OS_WIN32
weasytag_init();
//ET_Win32_Init(hInstance);
-#else
+#else /* !G_OS_WIN32 */
/* Signal handling to display a message(SIGSEGV, ...) */
setup_sigbus_fpe_segv ();
// Must handle this signal to avoid zombie of applications executed (ex: xmms)
setup_sigchld ();
-#endif
+#endif /* !G_OS_WIN32 */
#ifdef ENABLE_NLS
bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR);
@@ -226,12 +226,12 @@ int main (int argc, char *argv[])
ID3LIB_PATCH_VERSION);
#endif
-#ifdef WIN32
+#ifdef G_OS_WIN32
if (g_getenv("EASYTAGLANG"))
Log_Print(LOG_OK,_("Variable EASYTAGLANG defined. Setting locale: '%s'"),g_getenv("EASYTAGLANG"));
else
Log_Print(LOG_OK,_("Setting locale: '%s'"),g_getenv("LANG"));
-#endif
+#endif /* G_OS_WIN32 */
if (get_locale())
Log_Print(LOG_OK,_("Currently using locale '%s' (and eventually '%s')â"),
@@ -279,9 +279,10 @@ int main (int argc, char *argv[])
g_free(curdir);
}
-#ifdef WIN32
+#ifdef G_OS_WIN32
ET_Win32_Path_Replace_Slashes(path2check);
-#endif
+#endif /* G_OS_WIN32 */
+
// Check if contains hidden directories
pathsplit = g_strsplit(path2check,G_DIR_SEPARATOR_S,0);
g_free(path2check);
@@ -306,12 +307,13 @@ int main (int argc, char *argv[])
path2check_tmp = g_strconcat(path2check,G_DIR_SEPARATOR_S,pathsplit[ps_index],NULL);
}else
{
-#ifdef WIN32
+#ifdef G_OS_WIN32
// Build a path starting with the drive letter
path2check_tmp = g_strdup(pathsplit[ps_index]);
-#else
+#else /* !G_OS_WIN32 */
path2check_tmp = g_strconcat(G_DIR_SEPARATOR_S,pathsplit[ps_index],NULL);
-#endif
+#endif /* !G_OS_WIN32 */
+
}
path2check = g_strdup(path2check_tmp);
@@ -2866,9 +2868,9 @@ Make_Dir (const gchar *dirname_old, const gchar *dirname_new)
{
gchar *parent, *temp;
struct stat dirstat;
-#ifdef WIN32
+#ifdef G_OS_WIN32
gboolean first = TRUE;
-#endif
+#endif /* G_OS_WIN32 */
// Use same permissions as the old directory
stat(dirname_old,&dirstat);
@@ -2879,13 +2881,13 @@ Make_Dir (const gchar *dirname_old, const gchar *dirname_new)
if (*temp!=G_DIR_SEPARATOR)
continue;
-#ifdef WIN32
+#ifdef G_OS_WIN32
if (first)
{
first = FALSE;
continue;
}
-#endif
+#endif /* G_OS_WIN32 */
*temp=0; // To truncate temporarly dirname_new
@@ -4910,11 +4912,11 @@ static void
Display_Usage (void)
{
// Fix from Steve Ralston for gcc-3.2.2
-#ifdef WIN32
- #define xPREFIX "c:"
-#else
- #define xPREFIX ""
-#endif
+#ifdef G_OS_WIN32
+#define xPREFIX "c:"
+#else /* !G_OS_WIN32 */
+#define xPREFIX ""
+#endif /* !G_OS_WIN32 */
g_print(_("\nUsage: easytag [option] "
"\n or: easytag [directory]\n"
@@ -4930,7 +4932,7 @@ Display_Usage (void)
"path_to/files Use a relative path.\n"
"\n"),xPREFIX);
- #undef xPREFIX
+#undef xPREFIX
exit(0);
}
@@ -4947,9 +4949,9 @@ EasyTAG_Exit (void)
Charset_Insert_Locales_Destroy();
Log_Print(LOG_OK,_("EasyTAG: Normal exit."));
gtk_main_quit();
-#ifdef WIN32
+#ifdef G_OS_WIN32
weasytag_cleanup();
-#endif
+#endif /* G_OS_WIN32 */
exit(0);
}
diff --git a/src/et_core.c b/src/et_core.c
index c965a34..9d95e88 100644
--- a/src/et_core.c
+++ b/src/et_core.c
@@ -65,9 +65,9 @@
#include "setting.h"
#include "charset.h"
-#ifdef WIN32
-# include "win32/win32dep.h"
-#endif
+#ifdef G_OS_WIN32
+#include "win32/win32dep.h"
+#endif /* G_OS_WIN32 */
/***************
@@ -3798,10 +3798,10 @@ gboolean ET_Save_File_Tag_To_HD (ET_File *ETFile)
// Update properties for the file
if ( file_set_properties == TRUE )
{
-#ifndef WIN32
+#ifndef G_OS_WIN32
chmod(cur_filename,statbuf.st_mode & (S_IRWXU|S_IRWXG|S_IRWXO));
chown(cur_filename,statbuf.st_uid,statbuf.st_gid);
-#endif
+#endif /* !G_OS_WIN32 */
if (PRESERVE_MODIFICATION_TIME)
{
utimbufbuf.actime = statbuf.st_atime; // Last access time
@@ -4660,14 +4660,14 @@ gboolean ET_File_Name_Convert_Character (gchar *filename_utf8)
while ( (character=g_utf8_strchr(filename_utf8, -1, G_DIR_SEPARATOR))!=NULL )
*character = '-';
-#ifdef WIN32
- // Convert character '\' on WIN32 to '-'.
+#ifdef G_OS_WIN32
+ /* Convert character '\' on WIN32 to '-'. */
while ( (character=g_utf8_strchr(filename_utf8, -1, '\\'))!=NULL )
*character = '-';
- // Convert character '/' on WIN32 to '-'. (May be converted to '\', after...)
+ /* Convert character '/' on WIN32 to '-'. May be converted to '\' after. */
while ( (character=g_utf8_strchr(filename_utf8, -1, '/'))!=NULL )
*character = '-';
-#endif
+#endif /* G_OS_WIN32 */
// Convert other illegal characters on FAT32/16 filesystems and ISO9660 and Joliet (CD-ROM filesystems)
if (REPLACE_ILLEGAL_CHARACTERS_IN_FILENAME)
diff --git a/src/id3v24_tag.c b/src/id3v24_tag.c
index 0b21af3..086e10f 100644
--- a/src/id3v24_tag.c
+++ b/src/id3v24_tag.c
@@ -43,9 +43,9 @@
#include "et_core.h"
#include "charset.h"
-#ifdef WIN32
-# include "win32/win32dep.h"
-#endif
+#ifdef G_OS_WIN32
+#include "win32/win32dep.h"
+#endif /* G_OS_WIN32 */
#ifdef ENABLE_MP3
diff --git a/src/log.c b/src/log.c
index 79f96e0..7faa826 100644
--- a/src/log.c
+++ b/src/log.c
@@ -35,9 +35,9 @@
#include "setting.h"
#include "charset.h"
-#ifdef WIN32
-# include "win32/win32dep.h"
-#endif
+#ifdef G_OS_WIN32
+#include "win32/win32dep.h"
+#endif /* G_OS_WIN32 */
/****************
diff --git a/src/misc.c b/src/misc.c
index c9a4008..ba05cc9 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -44,9 +44,9 @@
#include "log.h"
#include "charset.h"
-#ifdef WIN32
-# include <windows.h>
-#endif
+#ifdef G_OS_WIN32
+#include <windows.h>
+#endif /* G_OS_WIN32 */
/***************
@@ -846,15 +846,15 @@ Run_Audio_Player_Using_File_List (GList *etfilelist_init)
ET_File *etfile;
gchar *filename;
gchar *program_path;
-#ifdef WIN32
+#ifdef G_OS_WIN32
gchar *argv_join;
STARTUPINFO siStartupInfo;
PROCESS_INFORMATION piProcessInfo;
-#else
+#else /* !G_OS_WIN32 */
pid_t pid;
gchar **argv_user;
gint argv_user_number;
-#endif
+#endif /* !G_OS_WIN32 */
// Exit if no program selected...
if (!AUDIO_FILE_PLAYER || strlen(g_strstrip(AUDIO_FILE_PLAYER))<1)
@@ -885,8 +885,7 @@ Run_Audio_Player_Using_File_List (GList *etfilelist_init)
// The list of files to play
etfilelist = etfilelist_init;
-#ifdef WIN32
-
+#ifdef G_OS_WIN32
// See documentation : http://c.developpez.com/faq/vc/?page=ProcessThread and http://www.answers.com/topic/createprocess
ZeroMemory(&siStartupInfo, sizeof(siStartupInfo));
siStartupInfo.cb = sizeof(siStartupInfo);
@@ -930,8 +929,7 @@ Run_Audio_Player_Using_File_List (GList *etfilelist_init)
g_free(argv_join);
-#else
-
+#else /* !G_OS_WIN32 */
argv_user = g_strsplit(AUDIO_FILE_PLAYER," ",0); // the string may contains arguments, space is the delimiter
// Number of arguments into 'argv_user'
for (argv_user_number=0;argv_user[argv_user_number];argv_user_number++);
@@ -975,8 +973,7 @@ Run_Audio_Player_Using_File_List (GList *etfilelist_init)
default:
break;
}
-
-#endif
+#endif /* !G_OS_WIN32 */
g_free(argv);
}
@@ -1086,15 +1083,15 @@ gchar *Check_If_Executable_Exists (const gchar *program)
program_tmp = g_strdup(program);
g_strstrip(program_tmp);
-#ifdef WIN32
+#ifdef G_OS_WIN32
// Remove arguments if found, after '.exe'
if ( (tmp=strstr(program_tmp,".exe")) )
*(tmp + 4) = 0;
-#else
+#else /* !G_OS_WIN32 */
// Remove arguments if found
if ( (tmp=strchr(program_tmp,' ')) )
*tmp = 0;
-#endif
+#endif /* !G_OS_WIN32 */
if (g_path_is_absolute(program_tmp))
{
@@ -1349,9 +1346,10 @@ void Open_Write_Playlist_Window (void)
// DOS Separator
playlist_use_dos_separator = gtk_check_button_new_with_label(_("Use DOS directory separator"));
-#ifndef WIN32 // This has no sense under Win32, so we don't display it
+#ifndef G_OS_WIN32
+ /* This makes no sense under Win32, so we do not display it. */
gtk_box_pack_start(GTK_BOX(vbox),playlist_use_dos_separator,FALSE,FALSE,0);
-#endif
+#endif /* !G_OS_WIN32 */
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(playlist_use_dos_separator),PLAYLIST_USE_DOS_SEPARATOR);
gtk_widget_set_tooltip_text(playlist_use_dos_separator,_("This option replaces the UNIX directory "
"separator '/' into DOS separator '\\'."));
diff --git a/src/ogg_tag.c b/src/ogg_tag.c
index 0d1c2af..f0fcbae 100644
--- a/src/ogg_tag.c
+++ b/src/ogg_tag.c
@@ -43,10 +43,10 @@
#include "setting.h"
#include "charset.h"
-#ifdef WIN32
+#ifdef G_OS_WIN32
// for mkstemp
-# include "win32/win32dep.h"
-#endif
+#include "win32/win32dep.h"
+#endif /* G_OS_WIN32 */
/***************
diff --git a/src/picture.c b/src/picture.c
index 74d501c..e440ca9 100644
--- a/src/picture.c
+++ b/src/picture.c
@@ -40,9 +40,9 @@
#include "bar.h"
#include "charset.h"
-#ifdef WIN32
-# include "win32/win32dep.h"
-#endif
+#ifdef G_OS_WIN32
+#include "win32/win32dep.h"
+#endif /* G_OS_WIN32 */
/****************
@@ -1089,34 +1089,38 @@ void Picture_Free (Picture *pic)
/*
+ * FIXME: On modern filesystems this is bogus, as GLib assumes that the
+ * encoding is UTF-8 (and that will normally be correct).
+ */
+/*
* Load the picture represented by the 'filename' (must be passed in
* file system encoding, not UTF-8)
*/
-#ifdef WIN32
+#ifdef G_OS_WIN32
static Picture *
Picture_Load_File_Data (const gchar *filename_utf8)
-#else
+#else /* !G_OS_WIN32 */
static Picture *
Picture_Load_File_Data (const gchar *filename)
-#endif
+#endif /* !G_OS_WIN32 */
{
Picture *pic;
gchar *buffer = 0;
size_t size = 0;
struct stat st;
-#ifdef WIN32
+#ifdef G_OS_WIN32
// Strange : on Win32, the file seems to be in UTF-8, so we can't load files with accentuated characters...
// To avoid this problem, we convert the filename to the file system encoding
gchar *filename = filename_from_display(filename_utf8);
-#endif
+#endif /* G_OS_WIN32 */
if (stat(filename, &st)==-1)
{
Log_Print(LOG_ERROR,_("Picture file not loaded (%s)â"),g_strerror(errno));
-#ifdef WIN32
+#ifdef G_OS_WIN32
g_free(filename);
-#endif
+#endif /* G_OS_WIN32 */
return NULL;
}
@@ -1144,15 +1148,15 @@ Picture_Load_File_Data (const gchar *filename)
Log_Print(LOG_ERROR,_("Picture file not loaded (%s)â"),g_strerror(errno));
g_free(filename_utf8);
-#ifdef WIN32
+#ifdef G_OS_WIN32
g_free(filename);
-#endif
+#endif /* G_OS_WIN32 */
return FALSE;
}
-#ifdef WIN32
+#ifdef G_OS_WIN32
g_free(filename);
-#endif
+#endif /* G_OS_WIN32 */
if (fread(buffer, size, 1, fd) != 1)
{
diff --git a/src/prefs.c b/src/prefs.c
index 43675be..be65652 100644
--- a/src/prefs.c
+++ b/src/prefs.c
@@ -42,11 +42,6 @@
#include "cddb.h"
#include "charset.h"
-//#ifdef WIN32
-//# include "win32/win32dep.h"
-//#endif
-
-
/**************
* Prototypes *
**************/
@@ -219,9 +214,9 @@ void Open_OptionsWindow (void)
/* Browse hidden directories */
BrowseHiddendir = gtk_check_button_new_with_label(_("Search hidden directories"));
-#ifndef WIN32 /* Always true and not user modifiable on win32 */
+#ifndef G_OS_WIN32 /* Always true and not user modifiable on win32 */
gtk_box_pack_start(GTK_BOX(vbox),BrowseHiddendir,FALSE,FALSE,0);
-#endif
+#endif /* !G_OS_WIN32 */
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(BrowseHiddendir),BROWSE_HIDDEN_DIR);
gtk_widget_set_tooltip_text(BrowseHiddendir,_("Search hidden directories for files "
"(directories starting by a '.')."));
@@ -319,9 +314,12 @@ void Open_OptionsWindow (void)
"when loading a directory."));
SortingFileCaseSensitive = gtk_check_button_new_with_label(_("Case sensitive"));
-#ifndef WIN32 /* Always true and not user modifiable on win32, as strncasecmp() doesn't work correctly with g_utf8_collate_key() */
+#ifndef G_OS_WIN32
+ /* Always true and not user modifiable on win32, as strncasecmp() does not
+ * work correctly with g_utf8_collate_key().
+ */
gtk_box_pack_start(GTK_BOX(hbox),SortingFileCaseSensitive,FALSE,FALSE,0);
-#endif
+#endif /* !G_OS_WIN32 */
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(SortingFileCaseSensitive),
SORTING_FILE_CASE_SENSITIVE);
gtk_widget_set_tooltip_text(SortingFileCaseSensitive,_("If activated, the "
@@ -1669,13 +1667,13 @@ OptionsWindow_Save_Button (void)
{
if (!Check_Config()) return;
-#ifndef WIN32
+#ifndef G_OS_WIN32
/* FIXME : make gtk crash on win32 */
Add_String_To_Combo_List(DefaultPathModel, gtk_entry_get_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(DefaultPathToMp3)))));
Add_String_To_Combo_List(FilePlayerModel, gtk_entry_get_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(FilePlayerCombo)))));
Add_String_To_Combo_List(DefaultCommentModel, gtk_entry_get_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(DefaultComment)))));
Add_String_To_Combo_List(CddbLocalPathModel, gtk_entry_get_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(CddbLocalPath)))));
-#endif
+#endif /* !G_OS_WIN32 */
Save_Changes_Of_Preferences_Window();
@@ -1773,10 +1771,12 @@ Check_DefaultPathToMp3 (void)
path_real = filename_from_display(path_utf8);
-#ifdef WIN32
- /* On win32 : stat("c:\path\to\dir") succeed, while stat("c:\path\to\dir\") fails */
+#ifdef G_OS_WIN32
+ /* On win32 : stat("c:\path\to\dir") succeed, while stat("c:\path\to\dir\")
+ * fails.
+ */
ET_Win32_Path_Remove_Trailing_Backslash(path_real);
-#endif
+#endif /* G_OS_WIN32 */
if ( stat(path_real,&stbuf)==0 && S_ISDIR(stbuf.st_mode) )
{
@@ -1888,10 +1888,10 @@ Check_FilePlayerCombo (void)
gchar *program_path = NULL;
gchar *program_path_validated = NULL;
-#ifdef WIN32
+#ifdef G_OS_WIN32
return TRUE; /* FIXME see Check_If_Executable_Exists */
/* Note : Check_If_Executable_Exists crashes when player is 'winamp.exe' with g_find_program_in_path */
-#endif
+#endif /* G_OS_WIN32 */
// The program typed
program_path = g_strdup(gtk_entry_get_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(FilePlayerCombo)))));
diff --git a/src/setting.c b/src/setting.c
index 8201598..e2ccf7a 100644
--- a/src/setting.c
+++ b/src/setting.c
@@ -43,9 +43,9 @@
#include "cddb.h"
#include "browser.h"
-#ifdef WIN32
-# include "win32/win32dep.h"
-#endif
+#ifdef G_OS_WIN32
+#include "win32/win32dep.h"
+#endif /* G_OS_WIN32 */
/***************
@@ -358,11 +358,11 @@ void Init_Config_Variables (void)
LOAD_ON_STARTUP = 0;
DEFAULT_PATH_TO_MP3 = g_strdup(g_get_home_dir ());
BROWSE_SUBDIR = 1;
-#ifdef WIN32
+#ifdef G_OS_WIN32
BROWSE_HIDDEN_DIR = 1;
-#else
+#else /* !G_OS_WIN32 */
BROWSE_HIDDEN_DIR = 0;
-#endif
+#endif /* !G_OS_WIN32 */
OPEN_SELECTED_BROWSER_NODE = 1;
/*
@@ -388,11 +388,11 @@ void Init_Config_Variables (void)
SET_FOCUS_TO_SAME_TAG_FIELD = 1;
SET_FOCUS_TO_FIRST_TAG_FIELD = 0;
SORTING_FILE_MODE = SORTING_BY_ASCENDING_FILENAME;
-#ifdef WIN32
+#ifdef G_OS_WIN32
SORTING_FILE_CASE_SENSITIVE = 1;
-#else
+#else /* !G_OS_WIN32 */
SORTING_FILE_CASE_SENSITIVE = 0;
-#endif
+#endif /* !G_OS_WIN32 */
LOG_MAX_LINES = 50;
SHOW_LOG_VIEW = 1;
@@ -401,11 +401,11 @@ void Init_Config_Variables (void)
MESSAGE_BOX_POSITION_MOUSE = 0;
MESSAGE_BOX_POSITION_CENTER_ON_PARENT = 1;
-#ifdef WIN32
+#ifdef G_OS_WIN32
AUDIO_FILE_PLAYER = ET_Win32_Get_Audio_File_Player();
-#else
+#else /* !G_OS_WIN32 */
AUDIO_FILE_PLAYER = g_strdup("xmms -p");
-#endif
+#endif /* !G_OS_WIN32 */
/*
* File Settings
@@ -430,19 +430,19 @@ void Init_Config_Variables (void)
USE_NON_STANDARD_ID3_READING_CHARACTER_SET = 0;
FILE_READING_ID3V1V2_CHARACTER_SET = g_strdup("UTF-8");
FILE_WRITING_ID3V2_WRITE_TAG = 1;
-#ifdef WIN32
+#ifdef G_OS_WIN32
FILE_WRITING_ID3V2_VERSION_4 = 0;
-#else
+#else /* !G_OS_WIN32 */
FILE_WRITING_ID3V2_VERSION_4 = 1;
-#endif
+#endif /* !G_OS_WIN32 */
FILE_WRITING_ID3V2_USE_CRC32 = 0;
FILE_WRITING_ID3V2_USE_COMPRESSION = 0;
FILE_WRITING_ID3V2_USE_UNICODE_CHARACTER_SET = 1;
-#ifdef WIN32
+#ifdef G_OS_WIN32
FILE_WRITING_ID3V2_UNICODE_CHARACTER_SET = g_strdup("UTF-16");
-#else
+#else /* !G_OS_WIN32 */
FILE_WRITING_ID3V2_UNICODE_CHARACTER_SET = g_strdup("UTF-8");
-#endif
+#endif /* !G_OS_WIN32 */
FILE_WRITING_ID3V2_NO_UNICODE_CHARACTER_SET = g_strdup("ISO-8859-1");
FILE_WRITING_ID3V2_ICONV_OPTIONS_NO = 1;
FILE_WRITING_ID3V2_ICONV_OPTIONS_TRANSLIT = 0;
@@ -660,9 +660,11 @@ Apply_Changes_Of_Preferences_Window (void)
LOAD_ON_STARTUP = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(LoadOnStartup));
if (DEFAULT_PATH_TO_MP3) g_free(DEFAULT_PATH_TO_MP3);
DEFAULT_PATH_TO_MP3 = g_strdup(gtk_entry_get_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(DefaultPathToMp3))))); // Saved in UTF-8
-//#ifdef WIN32
-// ET_Win32_Path_Replace_Backslashes(DEFAULT_PATH_TO_MP3);
-//#endif
+#if 0
+#ifdef G_OS_WIN32
+ ET_Win32_Path_Replace_Backslashes(DEFAULT_PATH_TO_MP3);
+#endif /* G_OS_WIN32 */
+#endif
BROWSE_SUBDIR = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(BrowseSubdir));
BROWSE_HIDDEN_DIR = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(BrowseHiddendir));
OPEN_SELECTED_BROWSER_NODE = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(OpenSelectedBrowserNode));
diff --git a/src/ui_manager.h b/src/ui_manager.h
index fe8a82a..a43ed3d 100644
--- a/src/ui_manager.h
+++ b/src/ui_manager.h
@@ -131,9 +131,9 @@ static const gchar *ui_xml =
" <separator />"
" <menuitem action='BrowseSubdir' />"
-#ifndef WIN32
+#ifndef G_OS_WIN32
" <menuitem action='BrowseHiddenDir' />"
-#endif
+#endif /* !G_OS_WIN32 */
" <separator />"
" <menuitem action='CollapseTree' />"
@@ -306,9 +306,9 @@ static const gchar *ui_xml =
" <menuitem action='BrowseDir' />"
" <separator />"
" <menuitem action='BrowseSubdir' />"
-#ifndef WIN32
+#ifndef G_OS_WIN32
" <menuitem action='BrowseHiddenDir' />"
-#endif
+#endif /* !G_OS_WIN32 */
" <separator />"
" <menuitem action='CollapseTree' />"
" <menuitem action='RefreshTree' />"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]