SF.net SVN: geany:[4903] trunk
ntrel at users.sourceforge.net
ntrel at xxxxx
Tue May 11 14:38:42 UTC 2010
Revision: 4903
http://geany.svn.sourceforge.net/geany/?rev=4903&view=rev
Author: ntrel
Date: 2010-05-11 14:38:42 +0000 (Tue, 11 May 2010)
Log Message:
-----------
Make some ugly build.h global variables static.
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/build.c
trunk/src/build.h
trunk/src/project.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2010-05-11 12:31:16 UTC (rev 4902)
+++ trunk/ChangeLog 2010-05-11 14:38:42 UTC (rev 4903)
@@ -8,6 +8,8 @@
Only replace template filename matching start of word on saving.
* plugins/filebrowser.c:
Add 'Refresh' popup menu item (part of geany-plugins #2999858).
+ * src/build.c, src/build.h, src/project.c:
+ Make some ugly build.h global variables static.
2010-05-10 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
Modified: trunk/src/build.c
===================================================================
--- trunk/src/build.c 2010-05-11 12:31:16 UTC (rev 4902)
+++ trunk/src/build.c 2010-05-11 14:38:42 UTC (rev 4903)
@@ -185,15 +185,16 @@
/* the various groups of commands not in the filetype struct */
static GeanyBuildCommand *ft_def = NULL;
-GeanyBuildCommand *non_ft_proj = NULL;
+static GeanyBuildCommand *non_ft_proj = NULL;
static GeanyBuildCommand *non_ft_pref = NULL;
static GeanyBuildCommand *non_ft_def = NULL;
-GeanyBuildCommand *exec_proj = NULL;
+static GeanyBuildCommand *exec_proj = NULL;
static GeanyBuildCommand *exec_pref = NULL;
static GeanyBuildCommand *exec_def = NULL;
/* and the regexen not in the filetype structure */
static gchar *regex_pref = NULL;
-gchar *regex_proj = NULL;
+/* project non-fileregex string */
+static gchar *regex_proj = NULL;
/* control if build commands are printed by get_build_cmd, for debug purposes only*/
#ifndef PRINTBUILDCMDS
@@ -2125,7 +2126,7 @@
}
-gboolean build_read_commands(BuildDestination *dst, TableData table_data, gint response)
+static gboolean build_read_commands(BuildDestination *dst, TableData table_data, gint response)
{
gint cmdindex, cmd;
gboolean changed = FALSE;
@@ -2145,6 +2146,28 @@
}
+void build_read_project(GeanyFiletype *ft, TableData build_properties)
+{
+ BuildDestination menu_dst;
+
+ if (ft != NULL)
+ {
+ menu_dst.dst[GEANY_GBG_FT] = &(ft->projfilecmds);
+ menu_dst.fileregexstr = &(ft->projerror_regex_string);
+ }
+ else
+ {
+ menu_dst.dst[GEANY_GBG_FT] = NULL;
+ menu_dst.fileregexstr = NULL;
+ }
+ menu_dst.dst[GEANY_GBG_NON_FT] = &non_ft_proj;
+ menu_dst.dst[GEANY_GBG_EXEC] = &exec_proj;
+ menu_dst.nonfileregexstr = ®ex_proj;
+
+ build_read_commands(&menu_dst, build_properties, GTK_RESPONSE_ACCEPT);
+}
+
+
static void show_build_commands_dialog(void)
{
GtkWidget *dialog, *table, *vbox;
@@ -2593,6 +2616,13 @@
}
+static void on_project_close(void)
+{
+ /* remove project regexen */
+ setptr(regex_proj, NULL);
+}
+
+
static struct
{
const gchar *entries[GEANY_BC_CMDENTRIES_COUNT];
@@ -2613,6 +2643,8 @@
GtkWidget *toolmenu;
gint cmdindex;
+ g_signal_connect(geany_object, "project-close", on_project_close, NULL);
+
ft_def = g_new0(GeanyBuildCommand, build_groups_count[GEANY_GBG_FT]);
non_ft_def = g_new0(GeanyBuildCommand, build_groups_count[GEANY_GBG_NON_FT]);
exec_def = g_new0(GeanyBuildCommand, build_groups_count[GEANY_GBG_EXEC]);
Modified: trunk/src/build.h
===================================================================
--- trunk/src/build.h 2010-05-11 12:31:16 UTC (rev 4902)
+++ trunk/src/build.h 2010-05-11 14:38:42 UTC (rev 4903)
@@ -141,11 +141,6 @@
gboolean old; /**< Converted from old format. */
} GeanyBuildCommand;
-/* project command array pointers */
-extern GeanyBuildCommand *non_ft_proj;
-extern GeanyBuildCommand *exec_proj;
-extern gchar *regex_proj; /* project non-fileregex string */
-
typedef struct BuildMenuItems
{
GtkWidget *menu;
@@ -170,7 +165,7 @@
/* menu configuration dialog functions */
GtkWidget *build_commands_table(GeanyDocument *doc, GeanyBuildSource dst, TableData *data, GeanyFiletype *ft);
-gboolean build_read_commands(BuildDestination *dst, TableData data, gint response);
+void build_read_project(GeanyFiletype *ft, TableData build_properties);
void build_free_fields(TableData data);
Modified: trunk/src/project.c
===================================================================
--- trunk/src/project.c 2010-05-11 12:31:16 UTC (rev 4902)
+++ trunk/src/project.c 2010-05-11 14:38:42 UTC (rev 4903)
@@ -351,9 +351,6 @@
build_remove_menu_item(GEANY_BCS_PROJ, GEANY_GBG_NON_FT, -1);
build_remove_menu_item(GEANY_BCS_PROJ, GEANY_GBG_EXEC, -1);
- /* remove project regexen */
- setptr(regex_proj, NULL);
-
g_free(app->project->name);
g_free(app->project->description);
g_free(app->project->file_name);
@@ -737,13 +734,12 @@
if (! new_project) /* save properties specific fields */
{
- GtkTextIter start, end;
- GtkTextBuffer *buffer;
- GeanyDocument *doc = document_get_current();
- BuildDestination menu_dst;
- GeanyBuildCommand *oldvalue;
- GeanyFiletype *ft = NULL;
- GtkWidget *widget;
+ GtkTextIter start, end;
+ GtkTextBuffer *buffer;
+ GeanyDocument *doc = document_get_current();
+ GeanyBuildCommand *oldvalue;
+ GeanyFiletype *ft = doc ? doc->file_type : NULL;
+ GtkWidget *widget;
/* get and set the project description */
buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(e->description));
@@ -752,24 +748,9 @@
setptr(p->description, g_strdup(gtk_text_buffer_get_text(buffer, &start, &end, FALSE)));
/* read the project build menu */
- if (doc != NULL)
- ft = doc->file_type;
- if (ft != NULL)
- {
- menu_dst.dst[GEANY_GBG_FT] = &(ft->projfilecmds);
- oldvalue = ft->projfilecmds;
- menu_dst.fileregexstr = &(ft->projerror_regex_string);
- }
- else
- {
- menu_dst.dst[GEANY_GBG_FT] = NULL;
- oldvalue = NULL;
- menu_dst.fileregexstr = NULL;
- }
- menu_dst.dst[GEANY_GBG_NON_FT] = &non_ft_proj;
- menu_dst.dst[GEANY_GBG_EXEC] = &exec_proj;
- menu_dst.nonfileregexstr = ®ex_proj;
- build_read_commands(&menu_dst, e->build_properties, GTK_RESPONSE_ACCEPT);
+ oldvalue = ft ? ft->projfilecmds : NULL;
+ build_read_project(ft, e->build_properties);
+
if (ft != NULL && ft->projfilecmds != oldvalue && ft->project_list_entry < 0)
{
if (p->build_filetypes_list == NULL)
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