SF.net SVN: geany: [2019] trunk
eht16 at users.sourceforge.net
eht16 at xxxxx
Mon Nov 5 15:09:13 UTC 2007
Revision: 2019
http://geany.svn.sourceforge.net/geany/?rev=2019&view=rev
Author: eht16
Date: 2007-11-05 07:09:13 -0800 (Mon, 05 Nov 2007)
Log Message:
-----------
Don't use unnecessary #ifdefs for utils_get_locale_from_utf8().
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/dialogs.c
trunk/src/document.c
trunk/src/utils.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2007-11-05 14:21:46 UTC (rev 2018)
+++ trunk/ChangeLog 2007-11-05 15:09:13 UTC (rev 2019)
@@ -1,3 +1,9 @@
+2007-11-05 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
+
+ * src/dialogs.c, src/document.c, src/utils.c:
+ Don't use unnecessary #ifdefs for utils_get_locale_from_utf8().
+
+
2007-11-05 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
* plugins/svndiff.c:
Modified: trunk/src/dialogs.c
===================================================================
--- trunk/src/dialogs.c 2007-11-05 14:21:46 UTC (rev 2018)
+++ trunk/src/dialogs.c 2007-11-05 15:09:13 UTC (rev 2019)
@@ -393,11 +393,7 @@
gboolean open_new_tab = gtk_toggle_button_get_active(
GTK_TOGGLE_BUTTON(lookup_widget(ui_widgets.save_filesel, "check_open_new_tab")));
-#ifdef G_OS_WIN32
- utf8_filename = g_strdup(new_filename);
-#else
utf8_filename = utils_get_utf8_from_locale(new_filename);
-#endif
// check if file exists and ask whether to overwrite or not
if (g_file_test(new_filename, G_FILE_TEST_EXISTS))
{
@@ -418,14 +414,10 @@
{
if (rename_file)
{ // delete the previous file name
-#ifdef G_OS_WIN32
- g_unlink(doc_list[idx].file_name);
-#else
gchar *old_filename = utils_get_locale_from_utf8(doc_list[idx].file_name);
g_unlink(old_filename);
g_free(old_filename);
-#endif
}
// create a new tm_source_file object otherwise tagmanager won't work correctly
tm_workspace_remove_object(doc_list[idx].tm_file, TRUE);
@@ -511,19 +503,13 @@
// If the current document has a filename we use that as the default.
if (doc_list[idx].file_name != NULL)
{
-#ifdef G_OS_WIN32
- gchar *locale_filename = doc_list[idx].file_name;
-#else
gchar *locale_filename = utils_get_locale_from_utf8(doc_list[idx].file_name);
-#endif
if (g_path_is_absolute(locale_filename))
gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(ui_widgets.save_filesel), locale_filename);
else
gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(ui_widgets.save_filesel),
doc_list[idx].file_name);
-#ifndef G_OS_WIN32
g_free(locale_filename);
-#endif
}
else
{
@@ -544,14 +530,9 @@
{
if (g_path_is_absolute(prefs.default_open_path))
{
-#ifdef G_OS_WIN32
- gtk_file_chooser_set_current_folder(
- GTK_FILE_CHOOSER(ui_widgets.save_filesel), prefs.default_open_path);
-#else
gchar *def_path = utils_get_locale_from_utf8(prefs.default_open_path);
gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(ui_widgets.save_filesel), def_path);
g_free(def_path);
-#endif
}
}
g_free(fname);
@@ -823,12 +804,7 @@
#if defined(HAVE_SYS_STAT_H) && defined(TIME_WITH_SYS_TIME) && defined(HAVE_SYS_TYPES_H)
-#ifdef G_OS_WIN32
- // don't try to convert the filename on Windows, it should be already in UTF8
- locale_filename = g_strdup(doc_list[idx].file_name);
-#else
locale_filename = utils_get_locale_from_utf8(doc_list[idx].file_name);
-#endif
if (g_stat(locale_filename, &st) == 0)
{
// first copy the returned string and the trim it, to not modify the static glibc string
Modified: trunk/src/document.c
===================================================================
--- trunk/src/document.c 2007-11-05 14:21:46 UTC (rev 2018)
+++ trunk/src/document.c 2007-11-05 15:09:13 UTC (rev 2019)
@@ -70,6 +70,7 @@
#include "symbols.h"
#include "callbacks.h"
#include "geanyobject.h"
+#include "highlighting.h"
/* dynamic array of document elements to hold all information of the notebook tabs */
@@ -1115,12 +1116,7 @@
g_return_val_if_fail(DOC_IDX_VALID(idx), FALSE);
-#ifdef G_OS_WIN32
- // don't try to convert the filename on Windows, it should be already in UTF8
- locale_filename = g_strdup(doc_list[idx].file_name);
-#else
locale_filename = utils_get_locale_from_utf8(doc_list[idx].file_name);
-#endif
if (g_stat(locale_filename, &st) != 0)
{
ui_set_statusbar(TRUE, _("Could not open file %s (%s)"), doc_list[idx].file_name,
@@ -1219,13 +1215,11 @@
{
len = strlen(data);
}
-#ifdef G_OS_WIN32
- fp = g_fopen(doc_list[idx].file_name, "wb"); // this should fix the windows \n problem
-#else
+
locale_filename = utils_get_locale_from_utf8(doc_list[idx].file_name);
fp = g_fopen(locale_filename, "w");
g_free(locale_filename);
-#endif
+
if (fp == NULL)
{
ui_set_statusbar(TRUE, _("Error saving file (%s)."), g_strerror(errno));
Modified: trunk/src/utils.c
===================================================================
--- trunk/src/utils.c 2007-11-05 14:21:46 UTC (rev 2018)
+++ trunk/src/utils.c 2007-11-05 15:09:13 UTC (rev 2019)
@@ -319,12 +319,7 @@
if (! force && doc_list[idx].last_check > (t - GEANY_CHECK_FILE_DELAY)) return FALSE;
-#ifdef G_OS_WIN32
- // don't try to convert the filename on Windows, it should be already in UTF8
- locale_filename = g_strdup(doc_list[idx].file_name);
-#else
locale_filename = utils_get_locale_from_utf8(doc_list[idx].file_name);
-#endif
if (g_stat(locale_filename, &st) != 0)
{
// TODO: warn user file on disk is missing
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Commits
mailing list