Revision: 639 Author: eht16 Date: 2006-07-26 10:02:16 -0700 (Wed, 26 Jul 2006) ViewCVS: http://svn.sourceforge.net/geany/?rev=639&view=rev
Log Message: ----------- Removed macro GEANY_WIN32, use G_OS_WIN32 instead. Introduced global variables for PACKAGE_DATA_DIR and PACKAGE_LOCALE_DIR, removed macro DOCDIR (these changes are important for the Windows port).
Modified Paths: -------------- trunk/ChangeLog trunk/src/Makefile.am trunk/src/about.c trunk/src/callbacks.c trunk/src/dialogs.c trunk/src/document.c trunk/src/gb.c trunk/src/geany.h trunk/src/highlighting.c trunk/src/keybindings.c trunk/src/main.c trunk/src/prefs.c trunk/src/utils.c trunk/src/utils.h trunk/src/win32.c trunk/src/win32.h Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2006-07-26 14:29:30 UTC (rev 638) +++ trunk/ChangeLog 2006-07-26 17:02:16 UTC (rev 639) @@ -1,3 +1,15 @@ +2006-07-26 Enrico Tröger enrico.troeger@uvena.de + + * src/Makefile.am: Added target to remove geany_res.res when cleaning. + * src/geany.h, src/main.c, src/callbacks.c, src/highlighting.c, + src/document.c, src/dialogs.c, src/prefs.c, src/utils.c, + src/win32.c, src/keybindings.c, src/gb.c, src/about.c: + Removed macro GEANY_WIN32, use G_OS_WIN32 instead. + Introduced global variables for PACKAGE_DATA_DIR and + PACKAGE_LOCALE_DIR, removed macro DOCDIR + (these changes are important for the Windows port). + + 2006-07-26 Nick Treleaven nick.treleaven@btinternet.com
* src/win32.c: Don't add .c extension for All files filter.
Modified: trunk/src/Makefile.am =================================================================== --- trunk/src/Makefile.am 2006-07-26 14:29:30 UTC (rev 638) +++ trunk/src/Makefile.am 2006-07-26 17:02:16 UTC (rev 639) @@ -44,16 +44,19 @@ #AM_CFLAGS = -DGEANY_DEBUG -Wall -pipe -mms-bitfields -g -O0 geany_LDFLAGS = -mwindows
-INCLUDES = \ - -DPACKAGE_DATA_DIR="data" -DPACKAGE_LOCALE_DIR="data" -I../scintilla/include \ - -I../tagmanager/include -DENABLE_NLS -I/usr/local/cross-tools/include @PACKAGE_CFLAGS@ +INCLUDES = -I../scintilla/include -I../tagmanager/include -DENABLE_NLS \ + -I/usr/local/cross-tools/include @PACKAGE_CFLAGS@
geany_windres.res: $(WINDRES) -i ../geany_windres.rc --input-format=rc -o geany_windres.res -O coff;
+clean-local: + rm -f windres.res + else # build Geany for all other platforms AM_CFLAGS = -DGEANY_DEBUG -Wall -pipe +#AM_CFLAGS = -DGEANY_DEBUG -Wall -pipe -g -O0 geany_SOURCES = $(SRCS) vte.c vte.h geany_LDADD = @PACKAGE_LIBS@ -lstdc++ ../scintilla/libscintilla.a ../tagmanager/libtagmanager.a $(INTLLIBS)
@@ -61,6 +64,8 @@ -DPACKAGE_DATA_DIR=""$(datadir)"" -DPACKAGE_LOCALE_DIR=""$(prefix)/$(DATADIRNAME)/locale"" \ -I../scintilla/include -I../tagmanager/include @PACKAGE_CFLAGS@
+clean-local: + endif
#geany_SOURCES = $(SRCS)
Modified: trunk/src/about.c =================================================================== --- trunk/src/about.c 2006-07-26 14:29:30 UTC (rev 638) +++ trunk/src/about.c 2006-07-26 17:02:16 UTC (rev 639) @@ -233,7 +233,9 @@ label = gtk_label_new(_("License")); gtk_widget_show(label);
- g_file_get_contents(GEANY_DATA_DIR G_DIR_SEPARATOR_S "GPL-2", &license_text, NULL, NULL); + g_snprintf(buffer, sizeof(buffer), "%s" G_DIR_SEPARATOR_S "GPL-2", app->datadir); + + g_file_get_contents(buffer, &license_text, NULL, NULL); if (license_text == NULL) { license_text = g_strdup("License text could not be found, please google for GPLv2");
Modified: trunk/src/callbacks.c =================================================================== --- trunk/src/callbacks.c 2006-07-26 14:29:30 UTC (rev 638) +++ trunk/src/callbacks.c 2006-07-26 17:02:16 UTC (rev 639) @@ -51,7 +51,7 @@ #include "search.h"
-#ifdef GEANY_WIN32 +#ifdef G_OS_WIN32 # include "win32.h" #endif
@@ -124,6 +124,8 @@ tm_workspace_free(TM_WORK_OBJECT(app->tm_workspace)); g_strfreev(html_entities); g_free(app->configdir); + g_free(app->datadir); + g_free(app->docdir); g_free(app->search_text); g_free(app->editor_font); g_free(app->tagbar_font); @@ -1055,7 +1057,7 @@ gint idx = GPOINTER_TO_INT(user_data); clickpos = sci_get_position_from_xy(doc_list[idx].sci, event->x, event->y, FALSE);
-#ifndef GEANY_WIN32 +#ifndef G_OS_WIN32 if (event->button == 1) { return utils_check_disk_status(idx); @@ -2150,16 +2152,14 @@ on_help1_activate (GtkMenuItem *menuitem, gpointer user_data) { -#ifdef GEANY_WIN32 - gchar *pwd = g_get_current_dir(); - gchar *uri = g_strconcat("file:///", g_path_skip_root(pwd), "/doc/index.html", NULL); - g_free(pwd); +#ifdef G_OS_WIN32 + gchar *uri = g_strconcat("file:///", g_path_skip_root(app->docdir), "/index.html", NULL); #else - gchar *uri = g_strconcat("file://", DOCDIR, "index.html", NULL); + gchar *uri = g_strconcat("file://", app->docdir, "index.html", NULL); #endif
if (! g_file_test(uri + 7, G_FILE_TEST_IS_REGULAR)) - { + { // fall back to online documentation if it is not found on the hard disk g_free(uri); uri = g_strconcat(GEANY_HOMEPAGE, "manual/index.html", NULL); } @@ -2189,7 +2189,7 @@ on_pref_tools_button_clicked (GtkButton *button, gpointer item) { -#ifdef GEANY_WIN32 +#ifdef G_OS_WIN32 win32_show_pref_file_dialog(item); #else GtkWidget *dialog;
Modified: trunk/src/dialogs.c =================================================================== --- trunk/src/dialogs.c 2006-07-26 14:29:30 UTC (rev 638) +++ trunk/src/dialogs.c 2006-07-26 17:02:16 UTC (rev 639) @@ -54,7 +54,7 @@ { if (gtk_notebook_get_n_pages(GTK_NOTEBOOK(app->notebook)) < GEANY_MAX_OPEN_FILES) { -#ifdef GEANY_WIN32 +#ifdef G_OS_WIN32 win32_show_file_dialog(TRUE); #else /* X11, not win32: use GTK_FILE_CHOOSER */
@@ -156,7 +156,7 @@ /* This shows the file selection dialog to save a file. */ void dialogs_show_save_as () { -#ifdef GEANY_WIN32 +#ifdef G_OS_WIN32 win32_show_file_dialog(FALSE); #else gint idx = document_get_cur_idx(); @@ -214,7 +214,7 @@
void dialogs_show_info(const gchar *text, ...) { -#ifndef GEANY_WIN32 +#ifndef G_OS_WIN32 GtkWidget *dialog; #endif gchar *string = g_malloc(512); @@ -224,14 +224,14 @@ g_vsnprintf(string, 511, text, args); va_end(args);
-#ifdef GEANY_WIN32 - win32_message_dialog(GTK_MESSAGE_INFO, string); +#ifdef G_OS_WIN32 + win32_message_dialog(GTK_MESSAGE_INFO, string); #else
- dialog = gtk_message_dialog_new(GTK_WINDOW(app->window), GTK_DIALOG_DESTROY_WITH_PARENT, + dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, "%s", string); - gtk_dialog_run (GTK_DIALOG (dialog)); - gtk_widget_destroy (dialog); + gtk_dialog_run(GTK_DIALOG(dialog)); + gtk_widget_destroy(dialog); #endif g_free(string); } @@ -239,7 +239,7 @@
void dialogs_show_error(const gchar *text, ...) { -#ifndef GEANY_WIN32 +#ifndef G_OS_WIN32 GtkWidget *dialog; #endif gchar *string = g_malloc(512); @@ -249,7 +249,7 @@ g_vsnprintf(string, 511, text, args); va_end(args);
-#ifdef GEANY_WIN32 +#ifdef G_OS_WIN32 win32_message_dialog(GTK_MESSAGE_ERROR, string); #else dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_DESTROY_WITH_PARENT, @@ -263,7 +263,7 @@
gboolean dialogs_show_unsaved_file(gint idx) { -#ifndef GEANY_WIN32 +#ifndef G_OS_WIN32 GtkWidget *dialog, *button, *label, *image, *hbox, *align; #endif gchar *msg; @@ -281,7 +281,7 @@ { msg = g_strdup(_("The file is not saved.\nDo you want to save it before closing?")); } -#ifdef GEANY_WIN32 +#ifdef G_OS_WIN32 ret = win32_message_dialog_unsaved(msg); #else dialog = gtk_message_dialog_new(GTK_WINDOW(app->window), GTK_DIALOG_DESTROY_WITH_PARENT, @@ -336,7 +336,7 @@ /* This shows the font selection dialog to choose a font. */ void dialogs_show_open_font(void) { -#ifdef GEANY_WIN32 +#ifdef G_OS_WIN32 win32_show_font_dialog(); #else
@@ -419,7 +419,7 @@ /* This shows the color selection dialog to choose a color. */ void dialogs_show_color(void) { -#ifdef GEANY_WIN32 +#ifdef G_OS_WIN32 win32_show_color_dialog(); #else
@@ -1696,7 +1696,7 @@
gboolean dialogs_show_question(const gchar *text, ...) { -#ifndef GEANY_WIN32 +#ifndef G_OS_WIN32 GtkWidget *dialog; #endif gchar *string = g_malloc(512); @@ -1707,7 +1707,7 @@ g_vsnprintf(string, 511, text, args); va_end(args);
-#ifdef GEANY_WIN32 +#ifdef G_OS_WIN32 ret = win32_message_dialog(GTK_MESSAGE_QUESTION, string); #else dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_DESTROY_WITH_PARENT,
Modified: trunk/src/document.c =================================================================== --- trunk/src/document.c 2006-07-26 14:29:30 UTC (rev 638) +++ trunk/src/document.c 2006-07-26 17:02:16 UTC (rev 639) @@ -76,7 +76,7 @@ { gchar *dl_fname = (is_tm_filename && doc_list[i].tm_file) ? doc_list[i].tm_file->file_name : doc_list[i].file_name; -#ifdef GEANY_WIN32 +#ifdef G_OS_WIN32 // ignore the case of filenames and paths under WIN32, causes errors if not if (dl_fname && ! strcasecmp(dl_fname, filename)) return i; #else @@ -222,7 +222,7 @@
gtk_widget_show(GTK_WIDGET(sci));
-#ifdef GEANY_WIN32 +#ifdef G_OS_WIN32 sci_set_codepage(sci, 0); #else sci_set_codepage(sci, SC_CP_UTF8); @@ -366,7 +366,7 @@ doc_list[idx].mtime = time(NULL); doc_list[idx].changed = FALSE; document_set_text_changed(idx); -#ifdef GEANY_WIN32 +#ifdef G_OS_WIN32 sci_set_eol_mode(doc_list[idx].sci, SC_EOL_CRLF); #else sci_set_eol_mode(doc_list[idx].sci, SC_EOL_LF); @@ -458,7 +458,7 @@ return -1; }
-#ifdef GEANY_WIN32 +#ifdef G_OS_WIN32 if (! g_file_get_contents(utf8_filename, &data, &size, &err)) #else if (! g_file_get_contents(locale_filename, &data, &size, &err))
Modified: trunk/src/gb.c =================================================================== --- trunk/src/gb.c 2006-07-26 14:29:30 UTC (rev 638) +++ trunk/src/gb.c 2006-07-26 17:02:16 UTC (rev 639) @@ -37,13 +37,7 @@ #define IMAGE_BUTTON_UP 11 #define IMAGE_BUTTON_DOWN 12
-#ifdef GEANY_WIN32 -# include <windows.h> -# include <commdlg.h> -# define GTK_BANDIT_WIN32 -#endif
- unsigned short lap; gint points; unsigned short iconset;
Modified: trunk/src/geany.h =================================================================== --- trunk/src/geany.h 2006-07-26 14:29:30 UTC (rev 638) +++ trunk/src/geany.h 2006-07-26 17:02:16 UTC (rev 639) @@ -43,14 +43,6 @@ #define SSM(s, m, w, l) scintilla_send_message(s, m, w, l)
-#if defined(G_OS_WIN32) || defined(WIN32) -# define GEANY_WIN32 -# define GEANY_DATA_DIR PACKAGE_DATA_DIR -#else -# define GEANY_DATA_DIR PACKAGE_DATA_DIR "/" PACKAGE -#endif - - // for detailed description look in the documentation, things are not // listed in the documentation should not be changed ;-) #define GEANY_HOME_DIR g_get_home_dir() @@ -82,9 +74,6 @@ #define GEANY_DEFAULT_FONT_MSG_WINDOW "Sans 9" #define GEANY_DEFAULT_FONT_EDITOR "Monospace 10"
-#ifndef DOCDIR -# define DOCDIR PACKAGE_DATA_DIR"/doc/"PACKAGE"/html/" -#endif
/* structure for representing an open tab with all its related stuff. */ @@ -198,6 +187,8 @@ gchar *tagbar_font; gchar *msgwin_font; gchar *configdir; + gchar *datadir; + gchar *docdir; gchar *search_text; gchar build_make_custopt[256]; gchar *tools_browser_cmd;
Modified: trunk/src/highlighting.c =================================================================== --- trunk/src/highlighting.c 2006-07-26 14:29:30 UTC (rev 638) +++ trunk/src/highlighting.c 2006-07-26 17:02:16 UTC (rev 639) @@ -189,9 +189,10 @@ { GKeyFile *config = g_key_file_new(); GKeyFile *config_home = g_key_file_new(); - gchar *f = g_strconcat(app->configdir, G_DIR_SEPARATOR_S GEANY_FILEDEFS_SUBDIR G_DIR_SEPARATOR_S, "filetypes.common", NULL); + gchar *f0 = g_strconcat(app->datadir, G_DIR_SEPARATOR_S "filetypes.common", NULL); + gchar *f = g_strconcat(app->configdir, G_DIR_SEPARATOR_S GEANY_FILEDEFS_SUBDIR G_DIR_SEPARATOR_S "filetypes.common", NULL);
- styleset_load_file(config, GEANY_DATA_DIR G_DIR_SEPARATOR_S "filetypes.common", G_KEY_FILE_KEEP_COMMENTS, NULL); + styleset_load_file(config, f0, G_KEY_FILE_KEEP_COMMENTS, NULL); g_key_file_load_from_file(config_home, f, G_KEY_FILE_KEEP_COMMENTS, NULL);
types[GEANY_FILETYPES_ALL] = g_new(style_set, 1); @@ -211,6 +212,7 @@
g_key_file_free(config); g_key_file_free(config_home); + g_free(f0); g_free(f); }
@@ -334,9 +336,10 @@ { GKeyFile *config = g_key_file_new(); GKeyFile *config_home = g_key_file_new(); - gchar *f = g_strconcat(app->configdir, G_DIR_SEPARATOR_S GEANY_FILEDEFS_SUBDIR G_DIR_SEPARATOR_S, "filetypes.c", NULL); + gchar *f0 = g_strconcat(app->datadir, G_DIR_SEPARATOR_S "filetypes.c", NULL); + gchar *f = g_strconcat(app->configdir, G_DIR_SEPARATOR_S GEANY_FILEDEFS_SUBDIR G_DIR_SEPARATOR_S "filetypes.c", NULL);
- styleset_load_file(config, GEANY_DATA_DIR G_DIR_SEPARATOR_S "filetypes.c", G_KEY_FILE_KEEP_COMMENTS, NULL); + styleset_load_file(config, f0, G_KEY_FILE_KEEP_COMMENTS, NULL); g_key_file_load_from_file(config_home, f, G_KEY_FILE_KEEP_COMMENTS, NULL);
types[GEANY_FILETYPES_C] = g_new(style_set, 1); @@ -371,14 +374,17 @@
g_key_file_free(config); g_key_file_free(config_home); + g_free(f0); g_free(f);
// load global tags file for C autocompletion if (! app->ignore_global_tags && ! global_c_tags_loaded) { + gchar *file = g_strconcat(app->datadir, G_DIR_SEPARATOR_S "global.tags", NULL); // 0 is the langType used in TagManager (see the table in tagmanager/parsers.h) - tm_workspace_load_global_tags(GEANY_DATA_DIR G_DIR_SEPARATOR_S "global.tags", 0); + tm_workspace_load_global_tags(file, 0); global_c_tags_loaded = TRUE; + g_free(file); } }
@@ -465,9 +471,10 @@ { GKeyFile *config = g_key_file_new(); GKeyFile *config_home = g_key_file_new(); - gchar *f = g_strconcat(app->configdir, G_DIR_SEPARATOR_S GEANY_FILEDEFS_SUBDIR G_DIR_SEPARATOR_S, "filetypes.cpp", NULL); + gchar *f0 = g_strconcat(app->datadir, G_DIR_SEPARATOR_S "filetypes.cpp", NULL); + gchar *f = g_strconcat(app->configdir, G_DIR_SEPARATOR_S GEANY_FILEDEFS_SUBDIR G_DIR_SEPARATOR_S "filetypes.cpp", NULL);
- styleset_load_file(config, GEANY_DATA_DIR G_DIR_SEPARATOR_S "filetypes.cpp", G_KEY_FILE_KEEP_COMMENTS, NULL); + styleset_load_file(config, f0, G_KEY_FILE_KEEP_COMMENTS, NULL); g_key_file_load_from_file(config_home, f, G_KEY_FILE_KEEP_COMMENTS, NULL);
types[GEANY_FILETYPES_CPP] = g_new(style_set, 1); @@ -502,14 +509,17 @@
g_key_file_free(config); g_key_file_free(config_home); + g_free(f0); g_free(f);
// load global tags file for C autocompletion if (! app->ignore_global_tags && ! global_c_tags_loaded) { - // 0 is the langType used in TagManager (see the table in tagmanager/parsers.h) - tm_workspace_load_global_tags(GEANY_DATA_DIR G_DIR_SEPARATOR_S "global.tags", 1); + gchar *file = g_strconcat(app->datadir, G_DIR_SEPARATOR_S "global.tags", NULL); + // 1 is the langType used in TagManager (see the table in tagmanager/parsers.h) + tm_workspace_load_global_tags(file, 1); global_c_tags_loaded = TRUE; + g_free(file); } }
@@ -594,9 +604,10 @@ { GKeyFile *config = g_key_file_new(); GKeyFile *config_home = g_key_file_new(); - gchar *f = g_strconcat(app->configdir, G_DIR_SEPARATOR_S GEANY_FILEDEFS_SUBDIR G_DIR_SEPARATOR_S, "filetypes.pascal", NULL); + gchar *f0 = g_strconcat(app->datadir, G_DIR_SEPARATOR_S "filetypes.pascal", NULL); + gchar *f = g_strconcat(app->configdir, G_DIR_SEPARATOR_S GEANY_FILEDEFS_SUBDIR G_DIR_SEPARATOR_S "filetypes.pascal", NULL);
- styleset_load_file(config, GEANY_DATA_DIR G_DIR_SEPARATOR_S "filetypes.pascal", G_KEY_FILE_KEEP_COMMENTS, NULL); + styleset_load_file(config, f0, G_KEY_FILE_KEEP_COMMENTS, NULL); g_key_file_load_from_file(config_home, f, G_KEY_FILE_KEEP_COMMENTS, NULL);
types[GEANY_FILETYPES_PASCAL] = g_new(style_set, 1); @@ -624,6 +635,7 @@
g_key_file_free(config); g_key_file_free(config_home); + g_free(f0); g_free(f); }
@@ -665,9 +677,10 @@ { GKeyFile *config = g_key_file_new(); GKeyFile *config_home = g_key_file_new(); - gchar *f = g_strconcat(app->configdir, G_DIR_SEPARATOR_S GEANY_FILEDEFS_SUBDIR G_DIR_SEPARATOR_S, "filetypes.makefile", NULL); + gchar *f0 = g_strconcat(app->datadir, G_DIR_SEPARATOR_S "filetypes.makefile", NULL); + gchar *f = g_strconcat(app->configdir, G_DIR_SEPARATOR_S GEANY_FILEDEFS_SUBDIR G_DIR_SEPARATOR_S "filetypes.makefile", NULL);
- styleset_load_file(config, GEANY_DATA_DIR G_DIR_SEPARATOR_S "filetypes.makefile", G_KEY_FILE_KEEP_COMMENTS, NULL); + styleset_load_file(config, f0, G_KEY_FILE_KEEP_COMMENTS, NULL); g_key_file_load_from_file(config_home, f, G_KEY_FILE_KEEP_COMMENTS, NULL);
types[GEANY_FILETYPES_MAKE] = g_new(style_set, 1); @@ -686,6 +699,7 @@
g_key_file_free(config); g_key_file_free(config_home); + g_free(f0); g_free(f); }
@@ -713,9 +727,10 @@ { GKeyFile *config = g_key_file_new(); GKeyFile *config_home = g_key_file_new(); - gchar *f = g_strconcat(app->configdir, G_DIR_SEPARATOR_S GEANY_FILEDEFS_SUBDIR G_DIR_SEPARATOR_S, "filetypes.latex", NULL); + gchar *f0 = g_strconcat(app->datadir, G_DIR_SEPARATOR_S "filetypes.latex", NULL); + gchar *f = g_strconcat(app->configdir, G_DIR_SEPARATOR_S GEANY_FILEDEFS_SUBDIR G_DIR_SEPARATOR_S "filetypes.latex", NULL);
- styleset_load_file(config, GEANY_DATA_DIR G_DIR_SEPARATOR_S "filetypes.latex", G_KEY_FILE_KEEP_COMMENTS, NULL); + styleset_load_file(config, f0, G_KEY_FILE_KEEP_COMMENTS, NULL); g_key_file_load_from_file(config_home, f, G_KEY_FILE_KEEP_COMMENTS, NULL);
types[GEANY_FILETYPES_LATEX] = g_new(style_set, 1); @@ -735,13 +750,16 @@ // load global tags file for LaTeX autocompletion if (! app->ignore_global_tags && ! global_latex_tags_loaded) { + gchar *file = g_strconcat(app->datadir, G_DIR_SEPARATOR_S "latex.tags", NULL); // 8 is the langType used in TagManager (see the table in tagmanager/parsers.h) - tm_workspace_load_global_tags(GEANY_DATA_DIR G_DIR_SEPARATOR_S "latex.tags", 8); + tm_workspace_load_global_tags(file, 8); global_latex_tags_loaded = TRUE; + g_free(file); }
g_key_file_free(config); g_key_file_free(config_home); + g_free(f0); g_free(f); }
@@ -769,9 +787,10 @@ { GKeyFile *config = g_key_file_new(); GKeyFile *config_home = g_key_file_new(); - gchar *f = g_strconcat(app->configdir, G_DIR_SEPARATOR_S GEANY_FILEDEFS_SUBDIR G_DIR_SEPARATOR_S, "filetypes.php", NULL); + gchar *f0 = g_strconcat(app->datadir, G_DIR_SEPARATOR_S "filetypes.php", NULL); + gchar *f = g_strconcat(app->configdir, G_DIR_SEPARATOR_S GEANY_FILEDEFS_SUBDIR G_DIR_SEPARATOR_S "filetypes.php", NULL);
- styleset_load_file(config, GEANY_DATA_DIR G_DIR_SEPARATOR_S "filetypes.php", G_KEY_FILE_KEEP_COMMENTS, NULL); + styleset_load_file(config, f0, G_KEY_FILE_KEEP_COMMENTS, NULL); g_key_file_load_from_file(config_home, f, G_KEY_FILE_KEEP_COMMENTS, NULL);
types[GEANY_FILETYPES_PHP] = g_new(style_set, 1); @@ -783,19 +802,24 @@ // load global tags file for PHP autocompletion if (! app->ignore_global_tags && ! global_php_tags_loaded) { + gchar *file = g_strconcat(app->datadir, G_DIR_SEPARATOR_S "php.tags", NULL); // 6 is the langType used in TagManager (see the table in tagmanager/parsers.h) - tm_workspace_load_global_tags(GEANY_DATA_DIR G_DIR_SEPARATOR_S "php.tags", 6); + tm_workspace_load_global_tags(file, 6); global_php_tags_loaded = TRUE; + g_free(file); } // load global tags file for HTML entities autocompletion if (! app->ignore_global_tags && ! global_html_tags_loaded) { - html_entities = utils_read_file_in_array(GEANY_DATA_DIR G_DIR_SEPARATOR_S "html_entities.tags"); + gchar *file = g_strconcat(app->datadir, G_DIR_SEPARATOR_S "html_entities.tags", NULL); + html_entities = utils_read_file_in_array(file); global_html_tags_loaded = TRUE; + g_free(file); }
g_key_file_free(config); g_key_file_free(config_home); + g_free(f0); g_free(f); }
@@ -820,9 +844,10 @@ { GKeyFile *config = g_key_file_new(); GKeyFile *config_home = g_key_file_new(); - gchar *f = g_strconcat(app->configdir, G_DIR_SEPARATOR_S GEANY_FILEDEFS_SUBDIR G_DIR_SEPARATOR_S, "filetypes.xml", NULL); + gchar *f0 = g_strconcat(app->datadir, G_DIR_SEPARATOR_S "filetypes.xml", NULL); + gchar *f = g_strconcat(app->configdir, G_DIR_SEPARATOR_S GEANY_FILEDEFS_SUBDIR G_DIR_SEPARATOR_S "filetypes.xml", NULL);
- styleset_load_file(config, GEANY_DATA_DIR G_DIR_SEPARATOR_S "filetypes.xml", G_KEY_FILE_KEEP_COMMENTS, NULL); + styleset_load_file(config, f0, G_KEY_FILE_KEEP_COMMENTS, NULL); g_key_file_load_from_file(config_home, f, G_KEY_FILE_KEEP_COMMENTS, NULL);
types[GEANY_FILETYPES_XML] = g_new(style_set, 1); @@ -899,6 +924,7 @@
g_key_file_free(config); g_key_file_free(config_home); + g_free(f0); g_free(f); }
@@ -1128,9 +1154,10 @@ { GKeyFile *config = g_key_file_new(); GKeyFile *config_home = g_key_file_new(); - gchar *f = g_strconcat(app->configdir, G_DIR_SEPARATOR_S GEANY_FILEDEFS_SUBDIR G_DIR_SEPARATOR_S, "filetypes.java", NULL); + gchar *f0 = g_strconcat(app->datadir, G_DIR_SEPARATOR_S "filetypes.java", NULL); + gchar *f = g_strconcat(app->configdir, G_DIR_SEPARATOR_S GEANY_FILEDEFS_SUBDIR G_DIR_SEPARATOR_S "filetypes.java", NULL);
- styleset_load_file(config, GEANY_DATA_DIR G_DIR_SEPARATOR_S "filetypes.java", G_KEY_FILE_KEEP_COMMENTS, NULL); + styleset_load_file(config, f0, G_KEY_FILE_KEEP_COMMENTS, NULL); g_key_file_load_from_file(config_home, f, G_KEY_FILE_KEEP_COMMENTS, NULL);
types[GEANY_FILETYPES_JAVA] = g_new(style_set, 1); @@ -1172,6 +1199,7 @@
g_key_file_free(config); g_key_file_free(config_home); + g_free(f0); g_free(f); }
@@ -1226,9 +1254,10 @@ { GKeyFile *config = g_key_file_new(); GKeyFile *config_home = g_key_file_new(); - gchar *f = g_strconcat(app->configdir, G_DIR_SEPARATOR_S GEANY_FILEDEFS_SUBDIR G_DIR_SEPARATOR_S, "filetypes.perl", NULL); + gchar *f0 = g_strconcat(app->datadir, G_DIR_SEPARATOR_S "filetypes.perl", NULL); + gchar *f = g_strconcat(app->configdir, G_DIR_SEPARATOR_S GEANY_FILEDEFS_SUBDIR G_DIR_SEPARATOR_S "filetypes.perl", NULL);
- styleset_load_file(config, GEANY_DATA_DIR G_DIR_SEPARATOR_S "filetypes.perl", G_KEY_FILE_KEEP_COMMENTS, NULL); + styleset_load_file(config, f, G_KEY_FILE_KEEP_COMMENTS, NULL); g_key_file_load_from_file(config_home, f, G_KEY_FILE_KEEP_COMMENTS, NULL);
types[GEANY_FILETYPES_PERL] = g_new(style_set, 1); @@ -1286,6 +1315,7 @@
g_key_file_free(config); g_key_file_free(config_home); + g_free(f0); g_free(f); }
@@ -1330,9 +1360,10 @@ { GKeyFile *config = g_key_file_new(); GKeyFile *config_home = g_key_file_new(); - gchar *f = g_strconcat(app->configdir, G_DIR_SEPARATOR_S GEANY_FILEDEFS_SUBDIR G_DIR_SEPARATOR_S, "filetypes.python", NULL); + gchar *f0 = g_strconcat(app->datadir, G_DIR_SEPARATOR_S "filetypes.python", NULL); + gchar *f = g_strconcat(app->configdir, G_DIR_SEPARATOR_S GEANY_FILEDEFS_SUBDIR G_DIR_SEPARATOR_S "filetypes.python", NULL);
- styleset_load_file(config, GEANY_DATA_DIR G_DIR_SEPARATOR_S "filetypes.python", G_KEY_FILE_KEEP_COMMENTS, NULL); + styleset_load_file(config, f0, G_KEY_FILE_KEEP_COMMENTS, NULL); g_key_file_load_from_file(config_home, f, G_KEY_FILE_KEEP_COMMENTS, NULL);
types[GEANY_FILETYPES_PYTHON] = g_new(style_set, 1); @@ -1360,6 +1391,7 @@
g_key_file_free(config); g_key_file_free(config_home); + g_free(f0); g_free(f); }
@@ -1397,9 +1429,10 @@ { GKeyFile *config = g_key_file_new(); GKeyFile *config_home = g_key_file_new(); - gchar *f = g_strconcat(app->configdir, G_DIR_SEPARATOR_S GEANY_FILEDEFS_SUBDIR G_DIR_SEPARATOR_S, "filetypes.ruby", NULL); + gchar *f0 = g_strconcat(app->datadir, G_DIR_SEPARATOR_S "filetypes.ruby", NULL); + gchar *f = g_strconcat(app->configdir, G_DIR_SEPARATOR_S GEANY_FILEDEFS_SUBDIR G_DIR_SEPARATOR_S "filetypes.ruby", NULL);
- styleset_load_file(config, GEANY_DATA_DIR G_DIR_SEPARATOR_S "filetypes.ruby", G_KEY_FILE_KEEP_COMMENTS, NULL); + styleset_load_file(config, f0, G_KEY_FILE_KEEP_COMMENTS, NULL); g_key_file_load_from_file(config_home, f, G_KEY_FILE_KEEP_COMMENTS, NULL);
types[GEANY_FILETYPES_RUBY] = g_new(style_set, 1); @@ -1432,6 +1465,7 @@
g_key_file_free(config); g_key_file_free(config_home); + g_free(f0); g_free(f); }
@@ -1471,9 +1505,10 @@ { GKeyFile *config = g_key_file_new(); GKeyFile *config_home = g_key_file_new(); - gchar *f = g_strconcat(app->configdir, G_DIR_SEPARATOR_S GEANY_FILEDEFS_SUBDIR G_DIR_SEPARATOR_S, "filetypes.sh", NULL); + gchar *f0 = g_strconcat(app->datadir, G_DIR_SEPARATOR_S "filetypes.sh", NULL); + gchar *f = g_strconcat(app->configdir, G_DIR_SEPARATOR_S GEANY_FILEDEFS_SUBDIR G_DIR_SEPARATOR_S "filetypes.sh", NULL);
- styleset_load_file(config, GEANY_DATA_DIR G_DIR_SEPARATOR_S "filetypes.sh", G_KEY_FILE_KEEP_COMMENTS, NULL); + styleset_load_file(config, f0, G_KEY_FILE_KEEP_COMMENTS, NULL); g_key_file_load_from_file(config_home, f, G_KEY_FILE_KEEP_COMMENTS, NULL);
types[GEANY_FILETYPES_SH] = g_new(style_set, 1); @@ -1498,6 +1533,7 @@
g_key_file_free(config); g_key_file_free(config_home); + g_free(f0); g_free(f); }
@@ -1549,9 +1585,10 @@ { GKeyFile *config = g_key_file_new(); GKeyFile *config_home = g_key_file_new(); - gchar *f = g_strconcat(app->configdir, G_DIR_SEPARATOR_S GEANY_FILEDEFS_SUBDIR G_DIR_SEPARATOR_S, "filetypes.docbook", NULL); + gchar *f0 = g_strconcat(app->datadir, G_DIR_SEPARATOR_S "filetypes.docbook", NULL); + gchar *f = g_strconcat(app->configdir, G_DIR_SEPARATOR_S GEANY_FILEDEFS_SUBDIR G_DIR_SEPARATOR_S "filetypes.docbook", NULL);
- styleset_load_file(config, GEANY_DATA_DIR G_DIR_SEPARATOR_S "filetypes.docbook", G_KEY_FILE_KEEP_COMMENTS, NULL); + styleset_load_file(config, f0, G_KEY_FILE_KEEP_COMMENTS, NULL); g_key_file_load_from_file(config_home, f, G_KEY_FILE_KEEP_COMMENTS, NULL);
types[GEANY_FILETYPES_DOCBOOK] = g_new(style_set, 1); @@ -1650,6 +1687,7 @@
g_key_file_free(config); g_key_file_free(config_home); + g_free(f0); g_free(f); }
@@ -1719,9 +1757,10 @@ { GKeyFile *config = g_key_file_new(); GKeyFile *config_home = g_key_file_new(); - gchar *f = g_strconcat(app->configdir, G_DIR_SEPARATOR_S GEANY_FILEDEFS_SUBDIR G_DIR_SEPARATOR_S, "filetypes.css", NULL); + gchar *f0 = g_strconcat(app->datadir, G_DIR_SEPARATOR_S "filetypes.css", NULL); + gchar *f = g_strconcat(app->configdir, G_DIR_SEPARATOR_S GEANY_FILEDEFS_SUBDIR G_DIR_SEPARATOR_S "filetypes.css", NULL);
- styleset_load_file(config, GEANY_DATA_DIR G_DIR_SEPARATOR_S "filetypes.css", G_KEY_FILE_KEEP_COMMENTS, NULL); + styleset_load_file(config, f0, G_KEY_FILE_KEEP_COMMENTS, NULL); g_key_file_load_from_file(config_home, f, G_KEY_FILE_KEEP_COMMENTS, NULL);
types[GEANY_FILETYPES_CSS] = g_new(style_set, 1); @@ -1773,6 +1812,7 @@
g_key_file_free(config); g_key_file_free(config_home); + g_free(f0); g_free(f); }
@@ -1808,9 +1848,10 @@ { GKeyFile *config = g_key_file_new(); GKeyFile *config_home = g_key_file_new(); - gchar *f = g_strconcat(app->configdir, G_DIR_SEPARATOR_S GEANY_FILEDEFS_SUBDIR G_DIR_SEPARATOR_S, "filetypes.conf", NULL); + gchar *f0 = g_strconcat(app->datadir, G_DIR_SEPARATOR_S "filetypes.conf", NULL); + gchar *f = g_strconcat(app->configdir, G_DIR_SEPARATOR_S GEANY_FILEDEFS_SUBDIR G_DIR_SEPARATOR_S "filetypes.conf", NULL);
- styleset_load_file(config, GEANY_DATA_DIR G_DIR_SEPARATOR_S "filetypes.conf", G_KEY_FILE_KEEP_COMMENTS, NULL); + styleset_load_file(config, f0, G_KEY_FILE_KEEP_COMMENTS, NULL); g_key_file_load_from_file(config_home, f, G_KEY_FILE_KEEP_COMMENTS, NULL);
types[GEANY_FILETYPES_CONF] = g_new(style_set, 1); @@ -1828,6 +1869,7 @@
g_key_file_free(config); g_key_file_free(config_home); + g_free(f0); g_free(f); }
@@ -1857,9 +1899,10 @@ { GKeyFile *config = g_key_file_new(); GKeyFile *config_home = g_key_file_new(); - gchar *f = g_strconcat(app->configdir, G_DIR_SEPARATOR_S GEANY_FILEDEFS_SUBDIR G_DIR_SEPARATOR_S, "filetypes.asm", NULL); + gchar *f0 = g_strconcat(app->datadir, G_DIR_SEPARATOR_S "filetypes.asm", NULL); + gchar *f = g_strconcat(app->configdir, G_DIR_SEPARATOR_S GEANY_FILEDEFS_SUBDIR G_DIR_SEPARATOR_S "filetypes.asm", NULL);
- styleset_load_file(config, GEANY_DATA_DIR G_DIR_SEPARATOR_S "filetypes.asm", G_KEY_FILE_KEEP_COMMENTS, NULL); + styleset_load_file(config, f0, G_KEY_FILE_KEEP_COMMENTS, NULL); g_key_file_load_from_file(config_home, f, G_KEY_FILE_KEEP_COMMENTS, NULL);
types[GEANY_FILETYPES_ASM] = g_new(style_set, 1); @@ -1890,6 +1933,7 @@
g_key_file_free(config); g_key_file_free(config_home); + g_free(f0); g_free(f); }
@@ -1933,9 +1977,10 @@ { GKeyFile *config = g_key_file_new(); GKeyFile *config_home = g_key_file_new(); - gchar *f = g_strconcat(app->configdir, G_DIR_SEPARATOR_S GEANY_FILEDEFS_SUBDIR G_DIR_SEPARATOR_S, "filetypes.sql", NULL); + gchar *f0 = g_strconcat(app->datadir, G_DIR_SEPARATOR_S "filetypes.sql", NULL); + gchar *f = g_strconcat(app->configdir, G_DIR_SEPARATOR_S GEANY_FILEDEFS_SUBDIR G_DIR_SEPARATOR_S "filetypes.sql", NULL);
- styleset_load_file(config, GEANY_DATA_DIR G_DIR_SEPARATOR_S "filetypes.sql", G_KEY_FILE_KEEP_COMMENTS, NULL); + styleset_load_file(config, f0, G_KEY_FILE_KEEP_COMMENTS, NULL); g_key_file_load_from_file(config_home, f, G_KEY_FILE_KEEP_COMMENTS, NULL);
types[GEANY_FILETYPES_SQL] = g_new(style_set, 1); @@ -1991,6 +2036,7 @@
g_key_file_free(config); g_key_file_free(config_home); + g_free(f0); g_free(f); }
@@ -2030,9 +2076,10 @@ { GKeyFile *config = g_key_file_new(); GKeyFile *config_home = g_key_file_new(); - gchar *f = g_strconcat(app->configdir, G_DIR_SEPARATOR_S GEANY_FILEDEFS_SUBDIR G_DIR_SEPARATOR_S, "filetypes.caml", NULL); + gchar *f0 = g_strconcat(app->datadir, G_DIR_SEPARATOR_S "filetypes.caml", NULL); + gchar *f = g_strconcat(app->configdir, G_DIR_SEPARATOR_S GEANY_FILEDEFS_SUBDIR G_DIR_SEPARATOR_S "filetypes.caml", NULL);
- styleset_load_file(config, GEANY_DATA_DIR G_DIR_SEPARATOR_S "filetypes.caml", G_KEY_FILE_KEEP_COMMENTS, NULL); + styleset_load_file(config, f0, G_KEY_FILE_KEEP_COMMENTS, NULL); g_key_file_load_from_file(config_home, f, G_KEY_FILE_KEEP_COMMENTS, NULL);
types[GEANY_FILETYPES_CAML] = g_new(style_set, 1); @@ -2066,6 +2113,7 @@
g_key_file_free(config); g_key_file_free(config_home); + g_free(f0); g_free(f); }
@@ -2105,9 +2153,10 @@ { GKeyFile *config = g_key_file_new(); GKeyFile *config_home = g_key_file_new(); - gchar *f = g_strconcat(app->configdir, G_DIR_SEPARATOR_S GEANY_FILEDEFS_SUBDIR G_DIR_SEPARATOR_S, "filetypes.oms", NULL); + gchar *f0 = g_strconcat(app->datadir, G_DIR_SEPARATOR_S "filetypes.oms", NULL); + gchar *f = g_strconcat(app->configdir, G_DIR_SEPARATOR_S GEANY_FILEDEFS_SUBDIR G_DIR_SEPARATOR_S "filetypes.oms", NULL);
- styleset_load_file(config, GEANY_DATA_DIR G_DIR_SEPARATOR_S "filetypes.oms", G_KEY_FILE_KEEP_COMMENTS, NULL); + styleset_load_file(config, f0, G_KEY_FILE_KEEP_COMMENTS, NULL); g_key_file_load_from_file(config_home, f, G_KEY_FILE_KEEP_COMMENTS, NULL);
types[GEANY_FILETYPES_OMS] = g_new(style_set, 1); @@ -2136,6 +2185,7 @@
g_key_file_free(config); g_key_file_free(config_home); + g_free(f0); g_free(f); }
@@ -2174,9 +2224,10 @@ { GKeyFile *config = g_key_file_new(); GKeyFile *config_home = g_key_file_new(); - gchar *f = g_strconcat(app->configdir, G_DIR_SEPARATOR_S GEANY_FILEDEFS_SUBDIR G_DIR_SEPARATOR_S, "filetypes.tcl", NULL); + gchar *f0 = g_strconcat(app->datadir, G_DIR_SEPARATOR_S "filetypes.tcl", NULL); + gchar *f = g_strconcat(app->configdir, G_DIR_SEPARATOR_S GEANY_FILEDEFS_SUBDIR G_DIR_SEPARATOR_S "filetypes.tcl", NULL);
- styleset_load_file(config, GEANY_DATA_DIR G_DIR_SEPARATOR_S "filetypes.tcl", G_KEY_FILE_KEEP_COMMENTS, NULL); + styleset_load_file(config, f, G_KEY_FILE_KEEP_COMMENTS, NULL); g_key_file_load_from_file(config_home, f, G_KEY_FILE_KEEP_COMMENTS, NULL);
types[GEANY_FILETYPES_TCL] = g_new(style_set, 1); @@ -2210,6 +2261,7 @@
g_key_file_free(config); g_key_file_free(config_home); + g_free(f0); g_free(f); }
@@ -2257,9 +2309,10 @@ { GKeyFile *config = g_key_file_new(); GKeyFile *config_home = g_key_file_new(); - gchar *f = g_strconcat(app->configdir, G_DIR_SEPARATOR_S GEANY_FILEDEFS_SUBDIR G_DIR_SEPARATOR_S, "filetypes.d", NULL); + gchar *f0 = g_strconcat(app->datadir, G_DIR_SEPARATOR_S "filetypes.d", NULL); + gchar *f = g_strconcat(app->configdir, G_DIR_SEPARATOR_S GEANY_FILEDEFS_SUBDIR G_DIR_SEPARATOR_S "filetypes.d", NULL);
- styleset_load_file(config, GEANY_DATA_DIR G_DIR_SEPARATOR_S "filetypes.d", G_KEY_FILE_KEEP_COMMENTS, NULL); + styleset_load_file(config, f0, G_KEY_FILE_KEEP_COMMENTS, NULL); g_key_file_load_from_file(config_home, f, G_KEY_FILE_KEEP_COMMENTS, NULL);
types[GEANY_FILETYPES_D] = g_new(style_set, 1); @@ -2294,15 +2347,18 @@
g_key_file_free(config); g_key_file_free(config_home); + g_free(f0); g_free(f);
// load global tags file for C autocompletion if (! app->ignore_global_tags && ! global_c_tags_loaded) { + gchar *file = g_strconcat(app->datadir, G_DIR_SEPARATOR_S "global.tags", NULL); // 0 is the langType used in TagManager (see the table in tagmanager/parsers.h) // C++ is a special case, here we use 0 to have C global tags in C++, too - tm_workspace_load_global_tags(GEANY_DATA_DIR G_DIR_SEPARATOR_S "global.tags", 0); + tm_workspace_load_global_tags(file, 0); global_c_tags_loaded = TRUE; + g_free(file); } }
@@ -2313,7 +2369,6 @@
styleset_common(sci, 5);
- /* Assign global keywords */ if ((app->tm_workspace) && (app->tm_workspace->global_tags)) {
Modified: trunk/src/keybindings.c =================================================================== --- trunk/src/keybindings.c 2006-07-26 14:29:30 UTC (rev 638) +++ trunk/src/keybindings.c 2006-07-26 17:02:16 UTC (rev 639) @@ -195,7 +195,7 @@ GDK_d, GDK_CONTROL_MASK, "edit_commentline", _("Comment line")); keys[GEANY_KEYS_EDIT_AUTOCOMPLETE] = fill(cb_func_edit_autocomplete, GDK_space, GDK_CONTROL_MASK, "edit_autocomplete", _("Complete word")); -#ifdef GEANY_WIN32 +#ifdef G_OS_WIN32 // on windows alt-space is taken by the window manager keys[GEANY_KEYS_EDIT_CALLTIP] = fill(cb_func_edit_calltip, GDK_space, GDK_CONTROL_MASK | GDK_SHIFT_MASK, "edit_calltip", _("Show calltip"));
Modified: trunk/src/main.c =================================================================== --- trunk/src/main.c 2006-07-26 14:29:30 UTC (rev 638) +++ trunk/src/main.c 2006-07-26 17:02:16 UTC (rev 639) @@ -454,12 +454,33 @@ gint mkdir_result = 0; gint idx; gchar *config_dir; + gchar *data_dir; + gchar *doc_dir; + gchar *locale_dir;
+ // set paths +#ifdef G_OS_WIN32 + // take the installation directory(the one where geany.exe is located) as the base for the + // language catalogs, documentation and data files + gchar *install_dir = g_win32_get_package_installation_directory("geany", NULL); + + data_dir = g_strconcat(install_dir, "\data", NULL); // e.g. C:\Program Files\geany\data + doc_dir = g_strconcat(install_dir, "\doc", NULL); + locale_dir = g_strdup(data_dir); + + g_free(install_dir); +#else + data_dir = g_strdup(PACKAGE_DATA_DIR "/" PACKAGE "/"); // e.g. /usr/share/geany + doc_dir = g_strdup(PACKAGE_DATA_DIR "/doc/" PACKAGE "/html/"); + locale_dir = g_strdup(PACKAGE_LOCALE_DIR); +#endif + #ifdef ENABLE_NLS - bindtextdomain(GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR); + bindtextdomain(GETTEXT_PACKAGE, locale_dir); bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8"); textdomain(GETTEXT_PACKAGE); #endif + g_free(locale_dir);
context = g_option_context_new(_(" - A fast and lightweight IDE")); g_option_context_add_main_entries(context, entries, GETTEXT_PACKAGE); @@ -490,13 +511,13 @@ if (alternate_config) config_dir = g_strdup(alternate_config); else config_dir = g_strconcat(GEANY_HOME_DIR, G_DIR_SEPARATOR_S, ".", PACKAGE, NULL);
- mkdir_result = utils_make_settings_dir(config_dir); + mkdir_result = utils_make_settings_dir(config_dir, data_dir, doc_dir); if (mkdir_result != 0) { if (! dialogs_show_question( _("Configuration directory could not be created (%s).\nThere could be some problems " - "using %s without a configuration directory.\nStart %s anyway?"), - g_strerror(mkdir_result), PACKAGE, PACKAGE)) + "using Geany without a configuration directory.\nStart Geany anyway?"), + g_strerror(mkdir_result))) { g_free(config_dir); return (0); @@ -512,6 +533,8 @@
// inits main_init(); + app->datadir = data_dir; + app->docdir = doc_dir; gtk_widget_set_size_request(app->window, GEANY_WINDOW_MINIMAL_WIDTH, GEANY_WINDOW_MINIMAL_HEIGHT); gtk_window_set_default_size(GTK_WINDOW(app->window), GEANY_WINDOW_DEFAULT_WIDTH, GEANY_WINDOW_DEFAULT_HEIGHT); encodings_init(); @@ -609,7 +632,7 @@ utils_build_show_hide(idx); utils_update_tag_list(idx, FALSE);
-#ifdef GEANY_WIN32 +#ifdef G_OS_WIN32 // hide "Build" menu item, at least until it is available for Windows gtk_widget_hide(lookup_widget(app->window, "menu_build1")); gtk_widget_hide(app->compile_button);
Modified: trunk/src/prefs.c =================================================================== --- trunk/src/prefs.c 2006-07-26 14:29:30 UTC (rev 638) +++ trunk/src/prefs.c 2006-07-26 17:02:16 UTC (rev 639) @@ -229,7 +229,7 @@
// Tools Settings -#ifdef GEANY_WIN32 +#ifdef G_OS_WIN32 // hide related Make path setting gtk_widget_set_sensitive(lookup_widget(app->prefs_dialog, "label11"), FALSE); gtk_widget_set_sensitive(lookup_widget(app->prefs_dialog, "entry_com_make"), FALSE); @@ -434,7 +434,7 @@ app->pref_toolbar_show_undo = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
widget = lookup_widget(app->prefs_dialog, "check_toolbar_compile"); -#ifdef GEANY_WIN32 +#ifdef G_OS_WIN32 app->pref_toolbar_show_compile = FALSE; #else app->pref_toolbar_show_compile = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); @@ -917,7 +917,7 @@ app->prefs_dialog = create_prefs_dialog(); gtk_window_set_transient_for(GTK_WINDOW(app->prefs_dialog), GTK_WINDOW(app->window));
-#ifdef GEANY_WIN32 +#ifdef G_OS_WIN32 gtk_widget_hide(lookup_widget(app->prefs_dialog, "check_toolbar_compile")); #endif
Modified: trunk/src/utils.c =================================================================== --- trunk/src/utils.c 2006-07-26 14:29:30 UTC (rev 638) +++ trunk/src/utils.c 2006-07-26 17:02:16 UTC (rev 639) @@ -57,7 +57,7 @@
void utils_start_browser(const gchar *uri) { -#ifdef GEANY_WIN32 +#ifdef G_OS_WIN32 win32_open_browser(uri); #else const gchar *argv[3]; @@ -951,7 +951,7 @@
gboolean utils_check_disk_status(gint idx) { -#ifndef GEANY_WIN32 +#ifndef G_OS_WIN32 struct stat st; time_t t; gchar *locale_filename; @@ -1207,7 +1207,7 @@ { if (! path || *path == '\0') return FALSE; -#ifdef GEANY_WIN32 +#ifdef G_OS_WIN32 if (path[0] == '\' || path[1] == ':') return TRUE; #else @@ -1245,7 +1245,7 @@
void utils_build_show_hide(gint idx) { -#ifndef GEANY_WIN32 +#ifndef G_OS_WIN32 gboolean is_header = FALSE; gchar *ext = NULL; filetype *ft; @@ -1488,7 +1488,7 @@ }
-gint utils_make_settings_dir(const gchar *dir) +gint utils_make_settings_dir(const gchar *dir, const gchar *data_dir, const gchar *doc_dir) { gint error_nr = 0; gchar *filetypes_readme = g_strconcat( @@ -1501,7 +1501,7 @@ if (! g_file_test(dir, G_FILE_TEST_EXISTS)) { geany_debug("creating config directory %s", dir); -#ifdef GEANY_WIN32 +#ifdef G_OS_WIN32 if (mkdir(dir) != 0) error_nr = errno; #else if (mkdir(dir, 0700) != 0) error_nr = errno; @@ -1510,10 +1510,15 @@
if (error_nr == 0 && ! g_file_test(filetypes_readme, G_FILE_TEST_EXISTS)) { // try to write template.README - error_nr = utils_write_file(filetypes_readme, + gchar *text; + text = g_strconcat( "There are several template files in this directory. For these templates you can use wildcards.\n\ -For more information read the documentation (in " DOCDIR " or visit " GEANY_HOMEPAGE ")."); - if (error_nr == 0 && ! g_file_test(filetypes_readme, G_FILE_TEST_EXISTS)) +For more information read the documentation (in ", doc_dir, "index.html or visit " GEANY_HOMEPAGE ").", + NULL); + error_nr = utils_write_file(filetypes_readme, text); + g_free(text); + + if (error_nr == 0 && ! g_file_test(filetypes_readme, G_FILE_TEST_EXISTS)) { // check whether write test was successful, otherwise directory is not writable geany_debug("The chosen configuration directory is not writable."); errno = EPERM; @@ -1525,16 +1530,21 @@ { if (! g_file_test(filedefs_dir, G_FILE_TEST_EXISTS)) { -#ifdef GEANY_WIN32 +#ifdef G_OS_WIN32 if (mkdir(filedefs_dir) != 0) error_nr = errno; #else if (mkdir(filedefs_dir, 0700) != 0) error_nr = errno; #endif } if (error_nr == 0 && ! g_file_test(filedefs_readme, G_FILE_TEST_EXISTS)) - utils_write_file(filedefs_readme, -"Copy files from " PACKAGE_DATA_DIR G_DIR_SEPARATOR_S PACKAGE " to this directory to overwrite them. To use the defaults, just delete the file in this directory.\n\ -For more information read the documentation (in " DOCDIR " or visit " GEANY_HOMEPAGE ")."); + { + gchar *text = g_strconcat( +"Copy files from ", data_dir, " to this directory to overwrite " +"them. To use the defaults, just delete the file in this directory.\nFor more information read " +"the documentation (in ", doc_dir, "index.html or visit " GEANY_HOMEPAGE ").", NULL); + utils_write_file(filedefs_readme, text); + g_free(text); + } }
g_free(filetypes_readme);
Modified: trunk/src/utils.h =================================================================== --- trunk/src/utils.h 2006-07-26 14:29:30 UTC (rev 638) +++ trunk/src/utils.h 2006-07-26 17:02:16 UTC (rev 639) @@ -151,7 +151,7 @@
gchar *utils_get_hostname(void);
-gint utils_make_settings_dir(const gchar *dir); +gint utils_make_settings_dir(const gchar *dir, const gchar *data_dir, const gchar *doc_dir);
gchar *utils_str_replace(gchar *haystack, const gchar *needle, const gchar *replacement);
Modified: trunk/src/win32.c =================================================================== --- trunk/src/win32.c 2006-07-26 14:29:30 UTC (rev 638) +++ trunk/src/win32.c 2006-07-26 17:02:16 UTC (rev 639) @@ -25,7 +25,7 @@
#include "geany.h"
-#ifdef GEANY_WIN32 +#ifdef G_OS_WIN32
#include <windows.h> #include <commdlg.h> @@ -356,7 +356,7 @@ }
// convert the Unicode chars to wide chars - /// TODO test if LANG == C then possibly skip conversion + /// TODO test if LANG == C then possibly skip conversion => g_win32_getlocale() MultiByteToWideChar(CP_UTF8, 0, msg, -1, w_msg, sizeof(w_msg)/sizeof(w_msg[0])); MultiByteToWideChar(CP_UTF8, 0, title, -1, w_title, sizeof(w_title)/sizeof(w_title[0]));
Modified: trunk/src/win32.h =================================================================== --- trunk/src/win32.h 2006-07-26 14:29:30 UTC (rev 638) +++ trunk/src/win32.h 2006-07-26 17:02:16 UTC (rev 639) @@ -21,7 +21,7 @@ */
-#ifdef GEANY_WIN32 +#ifdef G_OS_WIN32
void win32_show_pref_file_dialog(GtkEntry *item);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.