Kaydet (Commit) 716360ee authored tarafından Enrico Tröger's avatar Enrico Tröger

Started to implement project management (still unusable).

Added project.[c|h].


git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@1194 ea778897-0a13-0410-b9d1-a72fbfd435f5
üst e68f2546
......@@ -4,6 +4,11 @@
Fixed changing directories when the path contains whitespace.
* src/callbacks.c: When using Save As the returned filename needs to be
converted into UTF-8.
* geany.glade, po/POTFILES.in, src/callbacks.c, src/callbacks.h,
src/geany.h, src/interface.c, src/main.c, src/makefile.win32,
src/Makefile.am, src/project.c, src/project.h:
Started to implement project management (still unusable).
Added project.[c|h].
2007-01-15 Nick Treleaven <nick.treleaven@btinternet.com>
......
......@@ -57,7 +57,7 @@
<property name="use_underline">True</property>
<child internal-child="image">
<widget class="GtkImage" id="image1381">
<widget class="GtkImage" id="image1412">
<property name="visible">True</property>
<property name="stock">gtk-new</property>
<property name="icon_size">1</property>
......@@ -138,7 +138,7 @@
<signal name="activate" handler="on_save_all1_activate" last_modification_time="Thu, 02 Jun 2005 14:15:30 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1382">
<widget class="GtkImage" id="image1413">
<property name="visible">True</property>
<property name="stock">gtk-save</property>
<property name="icon_size">1</property>
......@@ -159,7 +159,7 @@
<signal name="activate" handler="on_toolbutton23_clicked" last_modification_time="Mon, 24 Jul 2006 19:26:04 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1383">
<widget class="GtkImage" id="image1414">
<property name="visible">True</property>
<property name="stock">gtk-revert-to-saved</property>
<property name="icon_size">1</property>
......@@ -179,7 +179,7 @@
<property name="use_underline">True</property>
<child internal-child="image">
<widget class="GtkImage" id="image1384">
<widget class="GtkImage" id="image1415">
<property name="visible">True</property>
<property name="stock">gtk-revert-to-saved</property>
<property name="icon_size">1</property>
......@@ -259,7 +259,7 @@
<signal name="activate" handler="on_close_all1_activate" last_modification_time="Thu, 02 Jun 2005 14:15:30 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1385">
<widget class="GtkImage" id="image1416">
<property name="visible">True</property>
<property name="stock">gtk-close</property>
<property name="icon_size">1</property>
......@@ -467,7 +467,7 @@
<signal name="activate" handler="on_menu_increase_indent1_activate" last_modification_time="Tue, 01 Aug 2006 10:28:54 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1386">
<widget class="GtkImage" id="image1417">
<property name="visible">True</property>
<property name="stock">gtk-indent</property>
<property name="icon_size">1</property>
......@@ -488,7 +488,7 @@
<signal name="activate" handler="on_menu_decrease_indent1_activate" last_modification_time="Tue, 01 Aug 2006 10:28:54 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1387">
<widget class="GtkImage" id="image1418">
<property name="visible">True</property>
<property name="stock">gtk-unindent</property>
<property name="icon_size">1</property>
......@@ -518,7 +518,7 @@
<property name="use_underline">True</property>
<child internal-child="image">
<widget class="GtkImage" id="image1388">
<widget class="GtkImage" id="image1419">
<property name="visible">True</property>
<property name="stock">gtk-add</property>
<property name="icon_size">1</property>
......@@ -550,7 +550,7 @@
<property name="use_underline">True</property>
<child internal-child="image">
<widget class="GtkImage" id="image1389">
<widget class="GtkImage" id="image1420">
<property name="visible">True</property>
<property name="stock">gtk-add</property>
<property name="icon_size">1</property>
......@@ -720,7 +720,7 @@
<signal name="activate" handler="on_replace1_activate" last_modification_time="Sun, 23 Oct 2005 13:22:36 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1390">
<widget class="GtkImage" id="image1421">
<property name="visible">True</property>
<property name="stock">gtk-find-and-replace</property>
<property name="icon_size">1</property>
......@@ -762,7 +762,7 @@
<signal name="activate" handler="on_go_to_line1_activate" last_modification_time="Tue, 23 May 2006 17:10:49 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1391">
<widget class="GtkImage" id="image1422">
<property name="visible">True</property>
<property name="stock">gtk-jump-to</property>
<property name="icon_size">1</property>
......@@ -797,7 +797,7 @@
<signal name="activate" handler="on_change_font1_activate" last_modification_time="Fri, 22 Apr 2005 18:58:45 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1392">
<widget class="GtkImage" id="image1423">
<property name="visible">True</property>
<property name="stock">gtk-select-font</property>
<property name="icon_size">1</property>
......@@ -1121,6 +1121,62 @@
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="menu_project1">
<property name="visible">True</property>
<property name="label" translatable="yes">_Project</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_menu_project1_activate" last_modification_time="Mon, 15 Jan 2007 18:01:10 GMT"/>
<child>
<widget class="GtkMenu" id="menu_project1_menu">
<child>
<widget class="GtkImageMenuItem" id="project_new1">
<property name="visible">True</property>
<property name="label">gtk-new</property>
<property name="use_stock">True</property>
<signal name="activate" handler="on_project_new1_activate" last_modification_time="Mon, 15 Jan 2007 17:34:17 GMT"/>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="project_open1">
<property name="visible">True</property>
<property name="label">gtk-open</property>
<property name="use_stock">True</property>
<signal name="activate" handler="on_project_open1_activate" last_modification_time="Mon, 15 Jan 2007 17:34:17 GMT"/>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="project_close1">
<property name="visible">True</property>
<property name="label">gtk-close</property>
<property name="use_stock">True</property>
<signal name="activate" handler="on_project_close1_activate" last_modification_time="Mon, 15 Jan 2007 17:34:17 GMT"/>
</widget>
</child>
<child>
<widget class="GtkSeparatorMenuItem" id="separator34">
<property name="visible">True</property>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="project_properties1">
<property name="visible">True</property>
<property name="label">gtk-properties</property>
<property name="use_stock">True</property>
<signal name="activate" handler="on_project_properties1_activate" last_modification_time="Mon, 15 Jan 2007 17:34:17 GMT"/>
</widget>
</child>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="menu_build1">
<property name="visible">True</property>
......@@ -1147,7 +1203,7 @@
<signal name="activate" handler="on_show_color_chooser1_activate" last_modification_time="Wed, 22 Jun 2005 18:10:21 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1393">
<widget class="GtkImage" id="image1424">
<property name="visible">True</property>
<property name="stock">gtk-select-color</property>
<property name="icon_size">1</property>
......
......@@ -17,6 +17,7 @@ src/main.c
src/msgwindow.c
src/notebook.c
src/prefs.c
src/project.c
src/sci_cb.c
src/sciwrappers.c
src/search.c
......
......@@ -7,33 +7,33 @@ EXTRA_DIST = images.c gb.c win32.c win32.h
bin_PROGRAMS = geany
SRCS = \
main.c main.h geany.h \
symbols.c symbols.h \
search.c search.h \
notebook.c notebook.h \
keybindings.c keybindings.h \
templates.c templates.h \
treeviews.c treeviews.h \
about.c about.h \
encodings.c encodings.h \
keyfile.c keyfile.h \
prefs.c prefs.h \
dialogs.c dialogs.h \
msgwindow.c msgwindow.h \
build.c build.h \
callbacks.c callbacks.h \
dialogs.c dialogs.h \
document.c document.h \
encodings.c encodings.h \
filetypes.c filetypes.h \
highlighting.c highlighting.h \
interface.c interface.h \
keybindings.c keybindings.h \
keyfile.c keyfile.h \
main.c main.h geany.h \
msgwindow.c msgwindow.h \
notebook.c notebook.h \
prefs.c prefs.h \
project.c project.h \
sci_cb.c sci_cb.h \
sciwrappers.c sciwrappers.h \
document.c document.h \
search.c search.h \
socket.c socket.h \
support.c support.h \
symbols.c symbols.h \
templates.c templates.h \
tools.c tools.h \
utils.c utils.h \
treeviews.c treeviews.h \
ui_utils.c ui_utils.h \
support.c support.h \
interface.c interface.h \
callbacks.c callbacks.h
utils.c utils.h
if MINGW
......
......@@ -53,6 +53,7 @@
#include "main.h"
#include "symbols.h"
#include "tools.h"
#include "project.h"
#ifdef HAVE_VTE
# include "vte.h"
......@@ -2077,3 +2078,53 @@ on_menu_insert_date_activate (GtkMenuItem *menuitem,
void
on_project_new1_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
project_new();
}
void
on_project_open1_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
project_open();
}
void
on_project_close1_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
project_close();
}
void
on_project_properties1_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
project_properties();
}
void
on_menu_project1_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
static GtkWidget *item_close= NULL;
static GtkWidget *item_properties= NULL;
if (item_close == NULL)
{
item_close = lookup_widget(app->window, "project_close1");
item_properties = lookup_widget(app->window, "project_properties1");
}
gtk_widget_set_sensitive(item_close, (app->project != NULL));
gtk_widget_set_sensitive(item_properties, (app->project != NULL));
}
......@@ -571,3 +571,23 @@ on_menu_comments_bsd_activate (GtkMenuItem *menuitem,
void
on_comments_bsd_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_project_new1_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_project_open1_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_project_close1_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_project_properties1_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_menu_project1_activate (GtkMenuItem *menuitem,
gpointer user_data);
......@@ -69,6 +69,10 @@
// simple forward declaration to avoid unnecessary inclusion of project.h
typedef struct _GeanyProject GeanyProject;
/* store some pointers and variables for frequently used widgets */
typedef struct MyApp
{
......@@ -184,6 +188,7 @@ typedef struct MyApp
GtkWidget *default_tag_tree;
const TMWorkspace *tm_workspace;
GQueue *recent_queue;
GeanyProject *project; // currently active project or NULL if none is open
} MyApp;
MyApp *app;
......
This diff is collapsed.
......@@ -228,6 +228,7 @@ static void main_init(void)
{
// inits
app->window = NULL;
app->project = NULL;
app->open_fontsel = NULL;
app->open_colorsel = NULL;
app->open_filesel = NULL;
......@@ -695,6 +696,7 @@ void main_quit()
build_finalize();
document_finalize();
symbols_finalize();
if (app->project != NULL) project_close();
tm_workspace_free(TM_WORK_OBJECT(app->tm_workspace));
g_free(app->configdir);
......
......@@ -47,7 +47,7 @@ CCFLAGS=-Wall -O2 -g -mms-bitfields $(DEFINES) $(INCLUDEDIRS)
OBJS = treeviews.o templates.o encodings.o about.o prefs.o win32.o build.o msgwindow.o dialogs.o \
filetypes.o interface.o main.o support.o callbacks.o utils.o ui_utils.o socket.o \
highlighting.o sci_cb.o document.o sciwrappers.o keyfile.o keybindings.o search.o notebook.o \
symbols.o tools.o
symbols.o tools.o project.o
.c.o:
$(CC) $(CCFLAGS) -c $<
......
/*
* project.c - this file is part of Geany, a fast and lightweight IDE
*
* Copyright 2007 Enrico Tröger <enrico.troeger@uvena.de>
* Copyright 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* $Id$
*/
#include "geany.h"
#include "project.h"
#include "dialogs.h"
#include "support.h"
static gboolean close_open_project();
void project_new()
{
if (! close_open_project()) return;
// simply create an empty project and show the properties dialog
app->project = g_new0(GeanyProject, 1);
project_properties();
}
void project_open()
{
if (! close_open_project()) return;
}
void project_close()
{
/// TODO should we handle open files in any way here?
g_return_if_fail(app->project != NULL);
g_free(app->project->name);
g_free(app->project->description);
g_free(app->project->file_name);
g_free(app->project->base_path);
g_free(app->project->executable);
g_free(app->project);
app->project = NULL;
}
void project_properties()
{
g_return_if_fail(app->project != NULL);
}
/* checks whether there is an already open project and asks the user if he want to close it or
* abort the current action. Returns FALSE when the current action(the caller) should be cancelled
* and TRUE if we can go ahead */
static gboolean close_open_project()
{
if (app->project != NULL)
{
gchar *msg =
_("There is already an open project \"%s\". Do you want to close it before proceed?");
if (dialogs_show_question(msg, app->project->name))
{
project_close();
return TRUE;
}
else
return FALSE;
}
else
return TRUE;
}
/*
* project.h - this file is part of Geany, a fast and lightweight IDE
*
* Copyright 2007 Enrico Tröger <enrico.troeger@uvena.de>
* Copyright 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* $Id$
*/
#ifndef GEANY_PROJECT_H
#define GEANY_PROJECT_H 1
/* structure for representing a project. */
struct _GeanyProject
{
gchar *name; // the name of the project
gchar *description; // short description of the project
gchar *file_name; // where the project file is stored
gchar *base_path; // base path of the project directory
gchar *executable; // name of the project executable
// ... // fields for build process(run arguments and so on) should be added
};
void project_new();
void project_open();
void project_close();
void project_properties();
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment