Revision: 1269 http://svn.sourceforge.net/geany/?rev=1269&view=rev Author: eht16 Date: 2007-02-12 09:21:57 -0800 (Mon, 12 Feb 2007)
Log Message: ----------- Convert config, application and documentation dir paths to locale encoding before using it. Fixed errors when changing directories containing special characters within the VTE component. Fixed paste problems on Windows. When using Save As the returned filename needs to be converted into UTF-8. Fixed error when parsing of compiler errors by the va_list system. Added MimeType entry as suggested by Nick Schermer. LaTeX parser: Allow \section*{} and other commands with *. Change default keybinding for Close All to Ctrl-Shift-W. Allow Make for files with no extension - prevent Build when the output filename would be the same as the source file.
Modified Paths: -------------- branches/geany-0.10.1/NEWS branches/geany-0.10.1/geany.desktop.in branches/geany-0.10.1/src/build.c branches/geany-0.10.1/src/callbacks.c branches/geany-0.10.1/src/keybindings.c branches/geany-0.10.1/src/main.c branches/geany-0.10.1/src/msgwindow.c branches/geany-0.10.1/src/msgwindow.h branches/geany-0.10.1/src/utils.c branches/geany-0.10.1/src/utils.h branches/geany-0.10.1/src/vte.c
Modified: branches/geany-0.10.1/NEWS =================================================================== --- branches/geany-0.10.1/NEWS 2007-02-12 16:32:56 UTC (rev 1268) +++ branches/geany-0.10.1/NEWS 2007-02-12 17:21:57 UTC (rev 1269) @@ -1,18 +1,32 @@ Geany 0.10.1 (TBA)
- Bugs fixed: - * Wrong tab foreground colour for unmodified documents. - * Fixed crashes when closing dialogs by clicking X on some systems. - * Fixed missing global tags for C files when a C++ source file was - loaded first. - * Fixed autocompletion missing tag matches. - * Fixed a wrong PASCAL autocompletion. - * Set single undo action when toggling multiple lines. - * Prevent some possible invalid memory reads. + Bugs fixed: + * Wrong tab foreground colour for unmodified documents. + * Fixed crashes when closing dialogs by clicking X on some systems. + * Fixed missing global tags for C files when a C++ source file was + loaded first. + * Fixed autocompletion missing tag matches. + * Fixed a wrong PASCAL autocompletion. + * Set single undo action when toggling multiple lines. + * Prevent some possible invalid memory reads. + * Convert config, application and documentation dir paths to locale + encoding before using it. + * Fixed errors when changing directories containing special + characters within the VTE component. + * Fixed paste problems on Windows. + * When using Save As the returned filename needs to be converted + into UTF-8. + * Fixed error when parsing of compiler errors by the va_list system. + * Added MimeType entry as suggested by Nick Schermer. + * LaTeX parser: Allow \section*{} and other commands with *. + * Change default keybinding for Close All to Ctrl-Shift-W. + * Allow Make for files with no extension - prevent Build when the + output filename would be the same as the source file.
+ Internationalisation: * New translations: fi (thanks to Harri Koskinen). - * Updated translations: de, es. + * Updated translations: de, es.
Geany 0.10 (December 21, 2006)
Modified: branches/geany-0.10.1/geany.desktop.in =================================================================== --- branches/geany-0.10.1/geany.desktop.in 2007-02-12 16:32:56 UTC (rev 1268) +++ branches/geany-0.10.1/geany.desktop.in 2007-02-12 17:21:57 UTC (rev 1269) @@ -11,6 +11,7 @@ Type=Application Categories=Application;GTK;Development;IDE; Encoding=UTF-8 +MimeType=text/plain;text/html;text/css;text/x-chdr;text/x-csrc;text/x-c++src;text/x-java;text/x-dsrc;text/x-sql;application/x-php; # currently false, changes perhaps in the future StartupNotify=false Version=1.1
Modified: branches/geany-0.10.1/src/build.c =================================================================== --- branches/geany-0.10.1/src/build.c 2007-02-12 16:32:56 UTC (rev 1268) +++ branches/geany-0.10.1/src/build.c 2007-02-12 17:21:57 UTC (rev 1269) @@ -1,7 +1,8 @@ /* * build.c - this file is part of Geany, a fast and lightweight IDE * - * Copyright 2006 Enrico Troeger enrico.troeger@uvena.de + * Copyright 2005-2007 Enrico Tröger enrico.troeger@uvena.de + * Copyright 2006-2007 Nick Treleaven nick.treleaven@btinternet.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -78,7 +79,6 @@ static void set_stop_button(gboolean stop); static void build_exit_cb(GPid child_pid, gint status, gpointer user_data); static void run_exit_cb(GPid child_pid, gint status, gpointer user_data); -static void free_pointers(gpointer first, ...);
#ifndef G_OS_WIN32 static void kill_process(GPid *pid); @@ -154,7 +154,7 @@ if (stat(locale_filename, &st) != 0) { msgwin_status_add(_("Failed to view %s (make sure it is already compiled)"), view_file); - free_pointers(executable, view_file, locale_filename, script_name); + utils_free_pointers(executable, view_file, locale_filename, script_name, NULL);
return (GPid) 1; } @@ -189,8 +189,8 @@ _("Could not find terminal '%s' " "(check path for Terminal tool setting in Preferences)"), app->tools_term_cmd);
- free_pointers(executable, view_file, locale_filename, cmd_string, locale_cmd_string, - script_name, locale_term_cmd); + utils_free_pointers(executable, view_file, locale_filename, cmd_string, locale_cmd_string, + script_name, locale_term_cmd, NULL); g_strfreev(term_argv); return (GPid) 1; } @@ -202,8 +202,8 @@ gchar *utf8_check_executable = utils_remove_ext_from_filename(doc_list[idx].file_name); msgwin_status_add(_("Failed to execute %s (start-script could not be created)"), utf8_check_executable); - free_pointers(executable, view_file, locale_filename, cmd_string, locale_cmd_string, - utf8_check_executable, script_name, locale_term_cmd); + utils_free_pointers(executable, view_file, locale_filename, cmd_string, locale_cmd_string, + utf8_check_executable, script_name, locale_term_cmd, NULL); g_strfreev(term_argv); return (GPid) 1; } @@ -230,8 +230,8 @@ geany_debug("g_spawn_async_with_pipes() failed: %s", error->message); msgwin_status_add(_("Process failed (%s)"), error->message);
- free_pointers(executable, view_file, locale_filename, cmd_string, locale_cmd_string, - script_name, locale_term_cmd); + utils_free_pointers(executable, view_file, locale_filename, cmd_string, locale_cmd_string, + script_name, locale_term_cmd, NULL); g_strfreev(argv); g_strfreev(term_argv); g_error_free(error); @@ -246,8 +246,8 @@ build_menu_update(idx); }
- free_pointers(executable, view_file, locale_filename, cmd_string, locale_cmd_string, - script_name, locale_term_cmd); + utils_free_pointers(executable, view_file, locale_filename, cmd_string, locale_cmd_string, + script_name, locale_term_cmd, NULL); g_strfreev(argv); g_strfreev(term_argv);
@@ -335,6 +335,15 @@ locale_filename = utils_get_locale_from_utf8(doc_list[idx].file_name);
executable = utils_remove_ext_from_filename(locale_filename); + // check for filename extension and abort if filename doesn't have one + if (utils_str_equal(locale_filename, executable)) + { + msgwin_status_add(_("Command stopped because the current file has no extension.")); + utils_beep(); + utils_free_pointers(locale_filename, executable, NULL); + return (GPid) 1; + } + object_file = g_strdup_printf("%s.o", executable);
// check wether object file (file.o) exists @@ -401,7 +410,7 @@ gint stdout_fd; gint stderr_fd;
- g_return_val_if_fail(idx >= 0 && doc_list[idx].is_valid, (GPid) 1); + g_return_val_if_fail(DOC_IDX_VALID(idx), (GPid) 1);
document_clear_indicators(idx);
@@ -432,7 +441,7 @@ working_dir = g_path_get_dirname(locale_filename); utf8_working_dir = g_path_get_dirname(doc_list[idx].file_name); gtk_list_store_clear(msgwindow.store_compiler); - msgwin_compiler_add(COLOR_BLUE, _("%s (in directory: %s)"), utf8_cmd_string, utf8_working_dir); + msgwin_compiler_add_fmt(COLOR_BLUE, _("%s (in directory: %s)"), utf8_cmd_string, utf8_working_dir); gtk_notebook_set_current_page(GTK_NOTEBOOK(msgwindow.notebook), MSG_COMPILER);
// set the build info for the message window @@ -531,6 +540,15 @@ else check_executable = g_strdup(long_executable);
+ // check for filename extension and abort if filename doesn't have one + if (utils_str_equal(locale_filename, check_executable)) + { + msgwin_status_add(_("Command stopped because the current file has no extension.")); + utils_beep(); + result_id = (GPid) 1; + goto free_strings; + } + // check whether executable exists if (stat(check_executable, &st) != 0) { @@ -727,7 +745,7 @@ if (failure) { msg = _("Compilation failed."); - msgwin_compiler_add(COLOR_DARK_RED, "%s", msg); + msgwin_compiler_add(COLOR_DARK_RED, msg); // If msgwindow is hidden, user will want to display it to see the error if (! app->msgwindow_visible) { @@ -741,7 +759,7 @@ else { msg = _("Compilation finished successfully."); - msgwin_compiler_add(COLOR_BLUE, "%s", msg); + msgwin_compiler_add(COLOR_BLUE, msg); if (! app->msgwindow_visible || gtk_notebook_get_current_page(GTK_NOTEBOOK(msgwindow.notebook)) != MSG_COMPILER) ui_set_statusbar("%s", msg); @@ -810,7 +828,7 @@ #else str = g_strdup_printf( "#!/bin/sh\n\n%s\n\necho "\n\n------------------\n(program exited with code: $?)" \ - \n\n%s\nunlink $0\n", cmd, (autoclose) ? "" : + \n\n%s\nrm $0\n", cmd, (autoclose) ? "" : "\necho "Press return to continue"\n#to be more compatible with shells like dash\ndummy_var=""\nread dummy_var"); #endif
@@ -1465,25 +1483,6 @@ #endif
-// frees all passed pointers if they are non-NULL, the first argument is nothing special, -// it will also be freed -static void free_pointers(gpointer first, ...) -{ - va_list a; - gpointer sa; - - for (va_start(a, first); (sa = va_arg(a, gpointer), sa!=NULL);) - { - if (sa != NULL) - g_free(sa); - } - va_end(a); - - if (first != NULL) - g_free(first); -} - - void on_build_next_error (GtkMenuItem *menuitem, gpointer user_data)
Modified: branches/geany-0.10.1/src/callbacks.c =================================================================== --- branches/geany-0.10.1/src/callbacks.c 2007-02-12 16:32:56 UTC (rev 1268) +++ branches/geany-0.10.1/src/callbacks.c 2007-02-12 17:21:57 UTC (rev 1269) @@ -1,7 +1,8 @@ /* * callbacks.c - this file is part of Geany, a fast and lightweight IDE * - * Copyright 2006 Enrico Troeger enrico.troeger@uvena.de + * Copyright 2005-2007 Enrico Tröger enrico.troeger@uvena.de + * Copyright 2006-2007 Nick Treleaven nick.treleaven@btinternet.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -382,8 +383,7 @@ gchar *content = gtk_clipboard_wait_for_text(gtk_clipboard_get(GDK_NONE)); if (content != NULL) { - sci_insert_text(doc_list[idx].sci, - sci_get_current_position(doc_list[idx].sci), content); + sci_replace_sel(doc_list[idx].sci, content); g_free(content); } } @@ -885,7 +885,8 @@ doc_list[idx].tm_file = NULL; g_free(doc_list[idx].file_name); } - doc_list[idx].file_name = new_filename; + doc_list[idx].file_name = utils_get_utf8_from_locale(new_filename); + g_free(new_filename);
utils_replace_filename(idx); document_save_file(idx, TRUE);
Modified: branches/geany-0.10.1/src/keybindings.c =================================================================== --- branches/geany-0.10.1/src/keybindings.c 2007-02-12 16:32:56 UTC (rev 1268) +++ branches/geany-0.10.1/src/keybindings.c 2007-02-12 17:21:57 UTC (rev 1269) @@ -1,7 +1,8 @@ /* * keybindings.c - this file is part of Geany, a fast and lightweight IDE * - * Copyright 2006 Enrico Troeger enrico.troeger@uvena.de + * Copyright 2006-2007 Enrico Tröger enrico.troeger@uvena.de + * Copyright 2006-2007 Nick Treleaven nick.treleaven@btinternet.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -117,7 +118,7 @@ keys[GEANY_KEYS_MENU_CLOSE] = fill(cb_func_menu_close, GDK_w, GDK_CONTROL_MASK, "menu_close", _("Close")); keys[GEANY_KEYS_MENU_CLOSEALL] = fill(cb_func_menu_closeall, - GDK_d, GDK_MOD1_MASK, "menu_closeall", _("Close all")); + GDK_w, GDK_CONTROL_MASK | GDK_SHIFT_MASK, "menu_closeall", _("Close all")); keys[GEANY_KEYS_MENU_RELOADFILE] = fill(cb_func_menu_reloadfile, GDK_r, GDK_CONTROL_MASK, "menu_reloadfile", _("Reload file")); keys[GEANY_KEYS_MENU_UNDO] = fill(cb_func_menu_undo,
Modified: branches/geany-0.10.1/src/main.c =================================================================== --- branches/geany-0.10.1/src/main.c 2007-02-12 16:32:56 UTC (rev 1268) +++ branches/geany-0.10.1/src/main.c 2007-02-12 17:21:57 UTC (rev 1269) @@ -1,7 +1,8 @@ /* * main.c - this file is part of Geany, a fast and lightweight IDE * - * Copyright 2006 Enrico Troeger enrico.troeger@uvena.de + * Copyright 2005-2007 Enrico Tröger enrico.troeger@uvena.de + * Copyright 2006-2007 Nick Treleaven nick.treleaven@btinternet.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -363,8 +364,12 @@ doc_dir = g_strdup(PACKAGE_DATA_DIR "/doc/" PACKAGE "/html/"); #endif
- app->datadir = data_dir; - app->docdir = doc_dir; + // convert path names to locale encoding + app->datadir = utils_get_locale_from_utf8(data_dir); + app->docdir = utils_get_locale_from_utf8(doc_dir); + + g_free(data_dir); + g_free(doc_dir); }
@@ -442,6 +447,12 @@ { gint mkdir_result = 0;
+ gchar *tmp = app->configdir; + + // convert configdir to locale encoding to avoid troubles + app->configdir = utils_get_locale_from_utf8(app->configdir); + g_free(tmp); + mkdir_result = utils_make_settings_dir(app->configdir, app->datadir, app->docdir); if (mkdir_result != 0) {
Modified: branches/geany-0.10.1/src/msgwindow.c =================================================================== --- branches/geany-0.10.1/src/msgwindow.c 2007-02-12 16:32:56 UTC (rev 1268) +++ branches/geany-0.10.1/src/msgwindow.c 2007-02-12 17:21:57 UTC (rev 1269) @@ -1,7 +1,8 @@ /* * msgwindow.c - this file is part of Geany, a fast and lightweight IDE * - * Copyright 2006 Enrico Troeger enrico.troeger@uvena.de + * Copyright 2005-2007 Enrico Tröger enrico.troeger@uvena.de + * Copyright 2006-2007 Nick Treleaven nick.treleaven@btinternet.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -185,8 +186,20 @@
static const GdkColor color_error = {0, 65535, 0, 0};
+void msgwin_compiler_add_fmt(gint msg_color, const gchar *format, ...) +{ + gchar string[512]; + va_list args; + + va_start(args, format); + g_vsnprintf(string, 512, format, args); + va_end(args); + msgwin_compiler_add(msg_color, string); +} + + // adds string to the compiler textview -void msgwin_compiler_add(gint msg_color, const gchar *format, ...) +void msgwin_compiler_add(gint msg_color, const gchar *msg) { GtkTreeIter iter; GtkTreePath *path; @@ -194,13 +207,7 @@ const GdkColor dark_red = {0, 65535 / 2, 0, 0}; const GdkColor blue = {0, 0, 0, 0xD000}; // not too bright ;-) const GdkColor black = {0, 0, 0, 0}; - gchar string[512]; - va_list args;
- va_start(args, format); - g_vsnprintf(string, 512, format, args); - va_end(args); - switch (msg_color) { case COLOR_RED: color = &color_error; break; @@ -210,7 +217,7 @@ }
gtk_list_store_append(msgwindow.store_compiler, &iter); - gtk_list_store_set(msgwindow.store_compiler, &iter, 0, color, 1, string, -1); + gtk_list_store_set(msgwindow.store_compiler, &iter, 0, color, 1, msg, -1);
if (app->msgwindow_visible) {
Modified: branches/geany-0.10.1/src/msgwindow.h =================================================================== --- branches/geany-0.10.1/src/msgwindow.h 2007-02-12 16:32:56 UTC (rev 1268) +++ branches/geany-0.10.1/src/msgwindow.h 2007-02-12 17:21:57 UTC (rev 1269) @@ -1,7 +1,8 @@ /* * msgwindow.h - this file is part of Geany, a fast and lightweight IDE * - * Copyright 2005 Enrico Troeger enrico.troeger@uvena.de + * Copyright 2005-2007 Enrico Tröger enrico.troeger@uvena.de + * Copyright 2006-2007 Nick Treleaven nick.treleaven@btinternet.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -70,9 +71,10 @@
void msgwin_msg_add(gint line, gint idx, const gchar *string);
-void msgwin_compiler_add(gint msg_color, const gchar *format, ...) - G_GNUC_PRINTF (2, 3); +void msgwin_compiler_add_fmt(gint msg_color, const gchar *format, ...) G_GNUC_PRINTF (2, 3);
+void msgwin_compiler_add(gint msg_color, const gchar *msg); + void msgwin_status_add(const gchar *format, ...) G_GNUC_PRINTF (1, 2);
void msgwin_menu_add_common_items(GtkMenu *menu);
Modified: branches/geany-0.10.1/src/utils.c =================================================================== --- branches/geany-0.10.1/src/utils.c 2007-02-12 16:32:56 UTC (rev 1268) +++ branches/geany-0.10.1/src/utils.c 2007-02-12 17:21:57 UTC (rev 1269) @@ -1,7 +1,8 @@ /* * utils.c - this file is part of Geany, a fast and lightweight IDE * - * Copyright 2006 Enrico Troeger enrico.troeger@uvena.de + * Copyright 2005-2007 Enrico Tröger enrico.troeger@uvena.de + * Copyright 2006-2007 Nick Treleaven nick.treleaven@btinternet.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1452,3 +1453,23 @@ }
+/* frees all passed pointers if they are non-NULL, the first argument is nothing special, + * it will also be freed, the list should be ended with NULL */ +void utils_free_pointers(gpointer first, ...) +{ + va_list a; + gpointer sa; + + for (va_start(a, first); (sa = va_arg(a, gpointer), sa!=NULL);) + { + if (sa != NULL) + g_free(sa); + } + va_end(a); + + if (first != NULL) + g_free(first); +} + + +
Modified: branches/geany-0.10.1/src/utils.h =================================================================== --- branches/geany-0.10.1/src/utils.h 2007-02-12 16:32:56 UTC (rev 1268) +++ branches/geany-0.10.1/src/utils.h 2007-02-12 17:21:57 UTC (rev 1269) @@ -1,7 +1,8 @@ /* * utils.h - this file is part of Geany, a fast and lightweight IDE * - * Copyright 2006 Enrico Troeger enrico.troeger@uvena.de + * Copyright 2005-2007 Enrico Tröger enrico.troeger@uvena.de + * Copyright 2006-2007 Nick Treleaven nick.treleaven@btinternet.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -149,4 +150,8 @@ /* Simple wrapper for g_locale_to_utf8; returns a copy of locale_text on failure. */ gchar *utils_get_utf8_from_locale(const gchar *locale_text);
+/* frees all passed pointers if they are non-NULL, the first argument is nothing special, + * it will also be freed, the list should be ended with NULL */ +void utils_free_pointers(gpointer first, ...); + #endif
Modified: branches/geany-0.10.1/src/vte.c =================================================================== --- branches/geany-0.10.1/src/vte.c 2007-02-12 16:32:56 UTC (rev 1268) +++ branches/geany-0.10.1/src/vte.c 2007-02-12 17:21:57 UTC (rev 1269) @@ -1,7 +1,8 @@ /* * vte.c - this file is part of Geany, a fast and lightweight IDE * - * Copyright 2006 Enrico Troeger enrico.troeger@uvena.de + * Copyright 2005-2007 Enrico Tröger enrico.troeger@uvena.de + * Copyright 2006-2007 Nick Treleaven nick.treleaven@btinternet.com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -133,11 +134,14 @@ } else { - module = g_module_open("libvte.so", G_MODULE_BIND_LAZY); - // try to fallback to different versions of libvte.so.x - if (module == NULL) module = g_module_open("libvte.so.4", G_MODULE_BIND_LAZY); - else if (module == NULL) module = g_module_open("libvte.so.8", G_MODULE_BIND_LAZY); - else if (module == NULL) module = g_module_open("libvte.so.9", G_MODULE_BIND_LAZY); + gint i; + const gchar *sonames[] = { "libvte.so", "libvte.so.4", + "libvte.so.8", "libvte.so.9", NULL }; + + for (i = 0; sonames[i] != NULL && module == NULL; i++ ) + { + module = g_module_open(sonames[i], G_MODULE_BIND_LAZY); + } }
if (module == NULL) @@ -435,14 +439,16 @@ if (vte_info.have_vte && (vc->follow_path || force) && filename != NULL) { gchar *path; - gchar *cmd;
path = g_path_get_dirname(filename); vte_get_working_directory(); // refresh vte_info.dir if (! utils_str_equal(path, vte_info.dir)) { - cmd = g_strconcat("cd ", path, "\n", NULL); + // use g_shell_quote to avoid problems with spaces, '!' or something else in path + gchar *quoted_path = g_shell_quote(path); + gchar *cmd = g_strconcat("cd ", quoted_path, "\n", NULL); vte_send_cmd(cmd); + g_free(quoted_path); g_free(cmd); } g_free(path);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.