Revision: 1984
http://geany.svn.sourceforge.net/geany/?rev=1984&view=rev
Author: eht16
Date: 2007-10-28 10:02:36 -0700 (Sun, 28 Oct 2007)
Log Message:
-----------
Add support for relative project base path.
Improve and synchronize base path tooltips in project new and properties dialogs.
Fix minor GUI annoyances in project dialogs.
Modified Paths:
--------------
trunk/ChangeLog
trunk/doc/geany.txt
trunk/src/build.c
trunk/src/project.c
trunk/src/project.h
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2007-10-26 16:09:00 UTC (rev 1983)
+++ trunk/ChangeLog 2007-10-28 17:02:36 UTC (rev 1984)
@@ -1,3 +1,12 @@
+2007-10-28 Enrico Tröger <enrico.troeger(a)uvena.de>
+
+ * doc/geany.txt, src/build.c, src/project.c, src/project.h:
+ Add support for relative project base path.
+ Improve and synchronize base path tooltips in project new and
+ properties dialogs.
+ Fix minor GUI annoyances in project dialogs.
+
+
2007-10-26 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
* plugins/svndiff.c, plugins/export.c, plugins/demoplugin.c,
Modified: trunk/doc/geany.txt
===================================================================
--- trunk/doc/geany.txt 2007-10-26 16:09:00 UTC (rev 1983)
+++ trunk/doc/geany.txt 2007-10-28 17:02:36 UTC (rev 1984)
@@ -1171,13 +1171,15 @@
used elsewhere by Geany.
The *Base path* field is used as the directory to run the Make and Make
-custom commands in.
+custom commands in. It is also used as working directory for the project
+specific *Run command*.
+The specified path can be absolute or relative to the project's file name.
Run command
```````````
-The Run command overrides the default run command. You can set this
+The *Run command* overrides the default run command. You can set this
to the executable or main script file for the project, and append
any command-line arguments.
Modified: trunk/src/build.c
===================================================================
--- trunk/src/build.c 2007-10-26 16:09:00 UTC (rev 1983)
+++ trunk/src/build.c 2007-10-28 17:02:36 UTC (rev 1984)
@@ -300,7 +300,7 @@
static GPid build_make_file(gint idx, gint build_opts)
{
GString *cmdstr;
- const gchar *dir = NULL;
+ gchar *dir = NULL;
GPid pid;
if (idx < 0 || doc_list[idx].file_name == NULL) return (GPid) 1;
@@ -331,6 +331,7 @@
}
pid = build_spawn_cmd(idx, cmdstr->str, dir); // if dir is NULL, idx filename is used
+ g_free(dir);
g_string_free(cmdstr, TRUE);
return pid;
}
@@ -636,9 +637,14 @@
return NULL;
}
- working_dir = (have_project) ?
- utils_get_locale_from_utf8(project->base_path) :
- g_path_get_dirname(locale_filename);
+ if (have_project)
+ {
+ gchar *project_base_path = project_get_make_dir();
+ working_dir = utils_get_locale_from_utf8(project_base_path);
+ g_free(project_base_path);
+ }
+ else
+ working_dir = g_path_get_dirname(locale_filename);
if (chdir(working_dir) != 0)
{
Modified: trunk/src/project.c
===================================================================
--- trunk/src/project.c 2007-10-26 16:09:00 UTC (rev 1983)
+++ trunk/src/project.c 2007-10-28 17:02:36 UTC (rev 1984)
@@ -28,6 +28,7 @@
#include "geany.h"
#include <string.h>
+#include <unistd.h>
#include "project.h"
#include "dialogs.h"
@@ -46,7 +47,7 @@
static struct
{
- gchar *project_file_path;
+ gchar *project_file_path; // in UTF-8
} local_prefs = {NULL};
@@ -153,7 +154,8 @@
e->base_path = gtk_entry_new();
gtk_tooltips_set_tip(tooltips, e->base_path,
_("Base directory of all files that make up the project. "
- "This can be a new path, or an existing directory tree."), NULL);
+ "This can be a new path, or an existing directory tree absolute "
+ "or relative to the project filename."), NULL);
bbox = ui_path_box_new(_("Choose Project Base Path"),
GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, GTK_ENTRY(e->base_path));
@@ -219,6 +221,7 @@
#else
GtkWidget *dialog;
GtkFileFilter *filter;
+ gchar *locale_path;
#endif
if (! close_open_project()) return;
@@ -256,7 +259,13 @@
gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog), filter);
gtk_file_chooser_set_filter(GTK_FILE_CHOOSER(dialog), filter);
- gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), dir);
+ locale_path = utils_get_locale_from_utf8(dir);
+ if (g_file_test(locale_path, G_FILE_TEST_EXISTS) &&
+ g_file_test(locale_path, G_FILE_TEST_IS_DIR))
+ {
+ gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), locale_path);
+ }
+ g_free(locale_path);
gtk_widget_show_all(dialog);
run_open_dialog(GTK_DIALOG(dialog));
@@ -374,8 +383,9 @@
e->base_path = gtk_entry_new();
gtk_tooltips_set_tip(tooltips, e->base_path,
- _("Directory to run Make All from. "
- "Leave blank to use the default command."), NULL);
+ _("Base directory of all files that make up the project. "
+ "This can be a new path, or an existing directory tree absolute "
+ "or relative to the project filename."), NULL);
bbox = ui_path_box_new(_("Choose Project Base Path"),
GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, GTK_ENTRY(e->base_path));
gtk_table_attach(GTK_TABLE(table), bbox, 1, 2, 3, 4,
@@ -505,6 +515,7 @@
static gboolean update_config(const PropertyDialogElements *e)
{
const gchar *name, *file_name, *base_path;
+ gchar *locale_filename;
gint name_len;
gboolean new_project = FALSE;
GeanyProject *p;
@@ -534,10 +545,27 @@
return FALSE;
}
+ // finally test whether the given project file can be written
+ locale_filename = utils_get_locale_from_utf8(file_name);
+ if (utils_write_file(file_name, "") != 0)
+ {
+ SHOW_ERR(_("Project file could not be written."));
+ gtk_widget_grab_focus(e->file_name);
+ return FALSE;
+ }
+
base_path = gtk_entry_get_text(GTK_ENTRY(e->base_path));
if (NZV(base_path))
{ // check whether the given directory actually exists
gchar *locale_path = utils_get_locale_from_utf8(base_path);
+
+ if (! g_path_is_absolute(locale_path))
+ { // relative base path, so add base dir of project file name
+ gchar *dir = g_path_get_dirname(locale_filename);
+ setptr(locale_path, g_strconcat(dir, G_DIR_SEPARATOR_S, locale_path, NULL));
+ g_free(dir);
+ }
+
if (! g_file_test(locale_path, G_FILE_TEST_IS_DIR))
{
if (dialogs_show_question_full(NULL, GTK_STOCK_OK, GTK_STOCK_CANCEL,
@@ -556,15 +584,8 @@
}
g_free(locale_path);
}
+ g_free(locale_filename);
- // finally test whether the given project file can be written
- if (utils_write_file(file_name, "") != 0)
- {
- SHOW_ERR(_("Project file could not be written."));
- gtk_widget_grab_focus(e->file_name);
- return FALSE;
- }
-
if (app->project == NULL)
{
app->project = g_new0(GeanyProject, 1);
@@ -579,7 +600,7 @@
p->file_name = g_strdup(file_name);
if (p->base_path != NULL) g_free(p->base_path);
- p->base_path = g_strdup(base_path);
+ p->base_path = g_strdup(NZV(base_path) ? base_path : "./"); // use "." if base_path is empty
if (! new_project) // save properties specific fields
{
@@ -629,6 +650,18 @@
{
if (g_file_test(locale_filename, G_FILE_TEST_EXISTS))
gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dialog), utf8_filename);
+ else // if the file doesn't yet exist, use at least the current directory
+ {
+ gchar *locale_dir = g_path_get_dirname(locale_filename);
+ gchar *name = g_path_get_basename(utf8_filename);
+
+ if (g_file_test(locale_dir, G_FILE_TEST_EXISTS))
+ gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), locale_dir);
+ gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(dialog), name);
+
+ g_free(name);
+ g_free(locale_dir);
+ }
}
else
if (gtk_file_chooser_get_action(GTK_FILE_CHOOSER(dialog)) != GTK_FILE_CHOOSER_ACTION_OPEN)
@@ -849,10 +882,27 @@
}
-const gchar *project_get_make_dir()
+/* Constructs the project's base path which is used for "Make all" and "Execute".
+ * The result is an absolute string in UTF-8 encoding which is either the same as
+ * base path if it is absolute or it is built out of project file name's dir and base_path.
+ * If there is no project or project's base_path is invalid, NULL will be returned.
+ * The returned string should be freed when no longer needed. */
+gchar *project_get_make_dir()
{
if (app->project != NULL && NZV(app->project->base_path))
- return app->project->base_path;
+ {
+ if (g_path_is_absolute(app->project->base_path))
+ return g_strdup(app->project->base_path);
+ else
+ { // build base_path out of project file name's dir and base_path
+ gchar *path;
+ gchar *dir = g_path_get_dirname(app->project->file_name);
+
+ path = g_strconcat(dir, G_DIR_SEPARATOR_S, app->project->base_path, NULL);
+ g_free(dir);
+ return path;
+ }
+ }
else
return NULL;
}
@@ -911,8 +961,7 @@
const gchar *str;
str = gtk_entry_get_text(GTK_ENTRY(path_entry));
- g_free(local_prefs.project_file_path);
- local_prefs.project_file_path = g_strdup(str);
+ setptr(local_prefs.project_file_path, g_strdup(str));
}
Modified: trunk/src/project.h
===================================================================
--- trunk/src/project.h 2007-10-26 16:09:00 UTC (rev 1983)
+++ trunk/src/project.h 2007-10-28 17:02:36 UTC (rev 1984)
@@ -34,7 +34,7 @@
gchar *file_name; // where the project file is stored (in UTF-8)
- gchar *base_path; // base path of the project directory (in UTF-8)
+ gchar *base_path; // base path of the project directory (in UTF-8, maybe relative)
gchar *run_cmd; // project run command (in UTF-8)
// ... // fields for build process(run arguments and so on) should be added
@@ -60,7 +60,7 @@
gboolean project_load_file(const gchar *locale_file_name);
-const gchar *project_get_make_dir();
+gchar *project_get_make_dir();
void project_save_prefs(GKeyFile *config);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 1983
http://geany.svn.sourceforge.net/geany/?rev=1983&view=rev
Author: ntrel
Date: 2007-10-26 09:09:00 -0700 (Fri, 26 Oct 2007)
Log Message:
-----------
Show icons only in the file browser toolbar.
Modified Paths:
--------------
trunk/ChangeLog
trunk/plugins/filebrowser.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2007-10-26 16:07:36 UTC (rev 1982)
+++ trunk/ChangeLog 2007-10-26 16:09:00 UTC (rev 1983)
@@ -11,6 +11,8 @@
Minor editing of some strings.
* plugins/classbuilder.c:
Capitalize menu item text.
+ * plugins/filebrowser.c:
+ Show icons only in the file browser toolbar.
2007-10-25 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
Modified: trunk/plugins/filebrowser.c
===================================================================
--- trunk/plugins/filebrowser.c 2007-10-26 16:07:36 UTC (rev 1982)
+++ trunk/plugins/filebrowser.c 2007-10-26 16:09:00 UTC (rev 1983)
@@ -409,6 +409,7 @@
toolbar = gtk_toolbar_new();
gtk_toolbar_set_icon_size(GTK_TOOLBAR(toolbar), GTK_ICON_SIZE_MENU);
+ gtk_toolbar_set_style(GTK_TOOLBAR(toolbar), GTK_TOOLBAR_ICONS);
wid = (GtkWidget *) gtk_tool_button_new_from_stock(GTK_STOCK_GO_UP);
gtk_tool_item_set_tooltip(GTK_TOOL_ITEM(wid), tooltips,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 1981
http://geany.svn.sourceforge.net/geany/?rev=1981&view=rev
Author: ntrel
Date: 2007-10-26 09:04:38 -0700 (Fri, 26 Oct 2007)
Log Message:
-----------
Capitalize menu item text.
Minor editing of some strings.
Modified Paths:
--------------
trunk/ChangeLog
trunk/plugins/svndiff.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2007-10-26 15:54:28 UTC (rev 1980)
+++ trunk/ChangeLog 2007-10-26 16:04:38 UTC (rev 1981)
@@ -6,6 +6,9 @@
as Geany.
* plugins/pluginmacros.h:
Prevent conflict with document::encoding.
+ * plugins/svndiff.c:
+ Capitalize menu item text.
+ Minor editing of some strings.
2007-10-25 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
Modified: trunk/plugins/svndiff.c
===================================================================
--- trunk/plugins/svndiff.c 2007-10-26 15:54:28 UTC (rev 1980)
+++ trunk/plugins/svndiff.c 2007-10-26 16:04:38 UTC (rev 1981)
@@ -44,7 +44,8 @@
PLUGIN_INFO(_("SVNdiff"), _("Plugin to create a patch of a file against svn"), VERSION)
-/* Callback if menu item for the current procet or directory was acitvated */
+
+/* Callback if menu item for the current project or directory was activated */
static void svndirectory_activated(GtkMenuItem *menuitem, gpointer gdata)
{
guint idx, new_idx;
@@ -136,10 +137,11 @@
}
else
{
- ui->set_statusbar(FALSE, _("Could not determinate a path working in"));
+ ui->set_statusbar(FALSE, _("Could not determine a path to work in"));
}
}
+
/* Callback if menu item for a single file was acitvated */
static void svnfile_activated(GtkMenuItem *menuitem, gpointer gdata)
{
@@ -266,20 +268,20 @@
gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_svndiff), menu_svndiff_menu);
// Directory
- menu_svndiff_dir = gtk_menu_item_new_with_mnemonic(_("From current _project"));
+ menu_svndiff_dir = gtk_menu_item_new_with_mnemonic(_("From Current _Project"));
gtk_container_add(GTK_CONTAINER (menu_svndiff_menu), menu_svndiff_dir);
gtk_tooltips_set_tip (tooltips, menu_svndiff_dir,
- _("Makes a svn diff from the a complete projekt or if there is no "
- "project avaible of the directory of current activeted file"), NULL);
+ _("Make a diff from the current project's base path, or if there is no "
+ "project open, from the directory of the current active file"), NULL);
g_signal_connect((gpointer) menu_svndiff_dir, "activate",
G_CALLBACK(svndirectory_activated), NULL);
- // Singe file
- menu_svndiff_file = gtk_menu_item_new_with_mnemonic(_("From single _file"));
+ // Single file
+ menu_svndiff_file = gtk_menu_item_new_with_mnemonic(_("From Current _File"));
gtk_container_add(GTK_CONTAINER (menu_svndiff_menu), menu_svndiff_file);
gtk_tooltips_set_tip (tooltips, menu_svndiff_file,
- _("Makes a svn diff from the of current activeted file"), NULL);
+ _("Make a diff from the current active file"), NULL);
g_signal_connect((gpointer) menu_svndiff_file, "activate",
G_CALLBACK(svnfile_activated), NULL);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 1980
http://geany.svn.sourceforge.net/geany/?rev=1980&view=rev
Author: ntrel
Date: 2007-10-26 08:54:28 -0700 (Fri, 26 Oct 2007)
Log Message:
-----------
Prevent conflict with document::encoding (oops).
Modified Paths:
--------------
trunk/ChangeLog
trunk/plugins/pluginmacros.h
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2007-10-26 15:53:19 UTC (rev 1979)
+++ trunk/ChangeLog 2007-10-26 15:54:28 UTC (rev 1980)
@@ -4,6 +4,8 @@
plugins/filebrowser.c, plugins/htmlchars.c, plugins/classbuilder.c:
Make all plugins distributed with Geany have the same version number
as Geany.
+ * plugins/pluginmacros.h:
+ Prevent conflict with document::encoding.
2007-10-25 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
Modified: trunk/plugins/pluginmacros.h
===================================================================
--- trunk/plugins/pluginmacros.h 2007-10-26 15:53:19 UTC (rev 1979)
+++ trunk/plugins/pluginmacros.h 2007-10-26 15:54:28 UTC (rev 1980)
@@ -33,7 +33,7 @@
#define dialogs geany_data->dialogs
#define documents geany_data->document // avoids conflict with document typedef
-#define encodings geany_data->encodings // avoids conflict with document::encoding
+#define encodings geany_data->encoding // avoids conflict with document::encoding
#define keybindings geany_data->keybindings
#define msgwindow geany_data->msgwindow
#define scintilla geany_data->sci
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.