SF.net SVN: geany-plugins: [85] trunk/geanyprj/src
yurand at users.sourceforge.net
yurand at xxxxx
Wed Jun 25 08:20:32 UTC 2008
Revision: 85
http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=85&view=rev
Author: yurand
Date: 2008-06-25 01:20:08 -0700 (Wed, 25 Jun 2008)
Log Message:
-----------
Fix compilation with API 71.
Modified Paths:
--------------
trunk/geanyprj/src/geanyprj.c
trunk/geanyprj/src/geanyprj.h
trunk/geanyprj/src/menu.c
trunk/geanyprj/src/project.c
trunk/geanyprj/src/sidebar.c
trunk/geanyprj/src/xproject.c
Modified: trunk/geanyprj/src/geanyprj.c
===================================================================
--- trunk/geanyprj/src/geanyprj.c 2008-06-20 10:32:59 UTC (rev 84)
+++ trunk/geanyprj/src/geanyprj.c 2008-06-25 08:20:08 UTC (rev 85)
@@ -21,6 +21,7 @@
*/
#include <sys/time.h>
+#include <string.h>
#include "geany.h"
#include "support.h"
@@ -35,7 +36,7 @@
#include "geanyprj.h"
-PLUGIN_VERSION_CHECK(38);
+PLUGIN_VERSION_CHECK(71);
PLUGIN_SET_INFO(_("Project"), _("Alternative project support."), VERSION,
_("Yura Siamashka <yurand2 at gmail.com>"));
@@ -46,17 +47,17 @@
static void
reload_project()
{
- gint idx;
gchar *dir;
gchar *proj;
+ GeanyDocument *doc;
debug("%s\n", __FUNCTION__);
- idx = p_document->get_cur_idx();
- if (!DOC_IDX_VALID(idx) || doc_list[idx].file_name == NULL)
+ doc = p_document->get_current();
+ if (doc == NULL || doc->file_name == NULL)
return;
- dir = g_path_get_dirname(doc_list[idx].file_name);
+ dir = g_path_get_dirname(doc->file_name);
proj = find_file_path(dir, ".geanyprj");
// This is not our project, close it as best as we can
@@ -87,34 +88,32 @@
}
static void
-on_doc_save(G_GNUC_UNUSED GObject * obj, gint idx, G_GNUC_UNUSED gpointer user_data)
+on_doc_save(G_GNUC_UNUSED GObject * obj, GeanyDocument * doc, G_GNUC_UNUSED gpointer user_data)
{
gchar *name;
- debug("%s obj=%p, idx = %d, user_data = %p\n", __FUNCTION__, obj, idx, user_data);
- g_return_if_fail(DOC_IDX_VALID(idx) && doc_list[idx].file_name != NULL);
+ g_return_if_fail(doc != NULL && doc->file_name != NULL);
- name = g_path_get_basename(doc_list[idx].file_name);
+ name = g_path_get_basename(doc->file_name);
if (g_current_project && strcmp(name, ".geanyprj") == 0)
{
xproject_close(FALSE);
}
reload_project();
- xproject_update_tag(doc_list[idx].file_name);
+ xproject_update_tag(doc->file_name);
}
static void
-on_doc_open(G_GNUC_UNUSED GObject * obj, G_GNUC_UNUSED gint idx, G_GNUC_UNUSED gpointer user_data)
+on_doc_open(G_GNUC_UNUSED GObject * obj, G_GNUC_UNUSED GeanyDocument * doc,
+ G_GNUC_UNUSED gpointer user_data)
{
- debug("%s obj=%p, idx = %d, user_data = %p\n", __FUNCTION__, obj, idx, user_data);
reload_project();
}
static void
-on_doc_activate(G_GNUC_UNUSED GObject * obj, G_GNUC_UNUSED gint idx,
+on_doc_activate(G_GNUC_UNUSED GObject * obj, G_GNUC_UNUSED GeanyDocument * doc,
G_GNUC_UNUSED gpointer user_data)
{
- debug("%s obj=%p, idx = %d, user_data = %p\n", __FUNCTION__, obj, idx, user_data);
reload_project();
}
Modified: trunk/geanyprj/src/geanyprj.h
===================================================================
--- trunk/geanyprj/src/geanyprj.h 2008-06-20 10:32:59 UTC (rev 84)
+++ trunk/geanyprj/src/geanyprj.h 2008-06-25 08:20:08 UTC (rev 85)
@@ -47,7 +47,7 @@
NEW_PROJECT_TYPE_SIZE
};
-struct GeanyProject
+struct GeanyPrj
{
gchar *path; ///< path to disk file
@@ -67,27 +67,27 @@
extern void *project_type_filter[NEW_PROJECT_TYPE_SIZE];
// project.c
-struct GeanyProject *geany_project_new();
-struct GeanyProject *geany_project_load(const gchar * path);
-void geany_project_free(struct GeanyProject *prj);
+struct GeanyPrj *geany_project_new();
+struct GeanyPrj *geany_project_load(const gchar * path);
+void geany_project_free(struct GeanyPrj *prj);
-void geany_project_regenerate_file_list(struct GeanyProject *prj);
+void geany_project_regenerate_file_list(struct GeanyPrj *prj);
-gboolean geany_project_add_file(struct GeanyProject *prj, const gchar * path);
-gboolean geany_project_remove_file(struct GeanyProject *prj, const gchar * path);
-void geany_project_save(struct GeanyProject *prj);
+gboolean geany_project_add_file(struct GeanyPrj *prj, const gchar * path);
+gboolean geany_project_remove_file(struct GeanyPrj *prj, const gchar * path);
+void geany_project_save(struct GeanyPrj *prj);
-void geany_project_set_path(struct GeanyProject *prj, const gchar * path);
-void geany_project_set_name(struct GeanyProject *prj, const gchar * name);
-void geany_project_set_type_int(struct GeanyProject *prj, gint val);
-void geany_project_set_type_string(struct GeanyProject *prj, const gchar * val);
-void geany_project_set_regenerate(struct GeanyProject *prj, gboolean val);
+void geany_project_set_path(struct GeanyPrj *prj, const gchar * path);
+void geany_project_set_name(struct GeanyPrj *prj, const gchar * name);
+void geany_project_set_type_int(struct GeanyPrj *prj, gint val);
+void geany_project_set_type_string(struct GeanyPrj *prj, const gchar * val);
+void geany_project_set_regenerate(struct GeanyPrj *prj, gboolean val);
-void geany_project_set_description(struct GeanyProject *prj, const gchar * description);
-void geany_project_set_base_path(struct GeanyProject *prj, const gchar * base_path);
-void geany_project_set_run_cmd(struct GeanyProject *prj, const gchar * run_cmd);
+void geany_project_set_description(struct GeanyPrj *prj, const gchar * description);
+void geany_project_set_base_path(struct GeanyPrj *prj, const gchar * base_path);
+void geany_project_set_run_cmd(struct GeanyPrj *prj, const gchar * run_cmd);
-void geany_project_set_tags_from_list(struct GeanyProject *prj, GSList * files);
+void geany_project_set_tags_from_list(struct GeanyPrj *prj, GSList * files);
// sidebar.c
@@ -130,6 +130,6 @@
GError ** error);
-extern struct GeanyProject *g_current_project;
+extern struct GeanyPrj *g_current_project;
#endif
Modified: trunk/geanyprj/src/menu.c
===================================================================
--- trunk/geanyprj/src/menu.c 2008-06-20 10:32:59 UTC (rev 84)
+++ trunk/geanyprj/src/menu.c 2008-06-25 08:20:08 UTC (rev 85)
@@ -82,14 +82,14 @@
PropertyDialogElements *e;
gchar *dir = NULL;
gchar *basename = NULL;
- gint idx;
gint i;
+ GeanyDocument *doc;
- idx = p_document->get_cur_idx();
- if (DOC_IDX_VALID(idx) &&
- doc_list[idx].file_name != NULL && g_path_is_absolute(doc_list[idx].file_name))
+ doc = p_document->get_current();
+
+ if (doc && doc->file_name != NULL && g_path_is_absolute(doc->file_name))
{
- dir = g_path_get_dirname(doc_list[idx].file_name);
+ dir = g_path_get_dirname(doc->file_name);
}
else
{
@@ -221,7 +221,7 @@
if (response == GTK_RESPONSE_OK)
{
gchar *path;
- struct GeanyProject *prj;
+ struct GeanyPrj *prj;
path = g_build_filename(gtk_entry_get_text(GTK_ENTRY(e->file_name)), ".geanyprj",
NULL);
@@ -321,17 +321,15 @@
void
on_add_file(G_GNUC_UNUSED GtkMenuItem * menuitem, G_GNUC_UNUSED gpointer user_data)
{
- gint idx;
+ GeanyDocument *doc;
- idx = p_document->get_cur_idx();
- g_return_if_fail(DOC_IDX_VALID(idx) &&
- doc_list[idx].file_name != NULL &&
- g_path_is_absolute(doc_list[idx].file_name));
+ doc = p_document->get_current();
+ g_return_if_fail(doc && doc->file_name != NULL && g_path_is_absolute(doc->file_name));
if (!g_current_project)
return;
- xproject_add_file(doc_list[idx].file_name);
+ xproject_add_file(doc->file_name);
}
void
@@ -350,19 +348,18 @@
static void
update_menu_items()
{
- gint idx;
gboolean cur_file_exists;
gboolean badd_file;
+ GeanyDocument *doc;
- idx = p_document->get_cur_idx();
+ doc = p_document->get_current();
+ g_return_if_fail(doc != NULL && doc->file_name != NULL);
- cur_file_exists = DOC_IDX_VALID(idx) &&
- doc_list[idx].file_name != NULL && g_path_is_absolute(doc_list[idx].file_name);
+ cur_file_exists = doc && doc->file_name != NULL && g_path_is_absolute(doc->file_name);
badd_file = (g_current_project ? TRUE : FALSE) &&
!g_current_project->regenerate &&
- cur_file_exists &&
- !g_hash_table_lookup(g_current_project->tags, doc_list[idx].file_name);
+ cur_file_exists && !g_hash_table_lookup(g_current_project->tags, doc->file_name);
gtk_widget_set_sensitive(menu_items.new_project, TRUE);
gtk_widget_set_sensitive(menu_items.delete_project, g_current_project ? TRUE : FALSE);
Modified: trunk/geanyprj/src/project.c
===================================================================
--- trunk/geanyprj/src/project.c 2008-06-20 10:32:59 UTC (rev 84)
+++ trunk/geanyprj/src/project.c 2008-06-25 08:20:08 UTC (rev 85)
@@ -20,6 +20,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include <string.h>
#include <sys/time.h>
#include "geany.h"
@@ -101,21 +102,21 @@
p_tm->workspace_remove_object((TMWorkObject *) obj, TRUE, FALSE);
}
-struct GeanyProject *
+struct GeanyPrj *
geany_project_new()
{
- struct GeanyProject *ret;
+ struct GeanyPrj *ret;
- ret = (struct GeanyProject *) g_new0(struct GeanyProject, 1);
+ ret = (struct GeanyPrj *) g_new0(struct GeanyPrj, 1);
ret->tags = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, free_tag_object);
return ret;
}
-struct GeanyProject *
+struct GeanyPrj *
geany_project_load(const gchar * path)
{
- struct GeanyProject *ret;
+ struct GeanyPrj *ret;
TMWorkObject *tm_obj = NULL;
GKeyFile *config;
gint i = 0;
@@ -198,7 +199,7 @@
}
void
-geany_project_regenerate_file_list(struct GeanyProject *prj)
+geany_project_regenerate_file_list(struct GeanyPrj *prj)
{
GSList *lst;
@@ -213,7 +214,7 @@
}
void
-geany_project_set_path(struct GeanyProject *prj, const gchar * path)
+geany_project_set_path(struct GeanyPrj *prj, const gchar * path)
{
gchar *norm_path = normpath(path);
if (prj->path)
@@ -228,7 +229,7 @@
}
void
-geany_project_set_name(struct GeanyProject *prj, const gchar * name)
+geany_project_set_name(struct GeanyPrj *prj, const gchar * name)
{
if (prj->name)
g_free(prj->name);
@@ -246,13 +247,13 @@
}
void
-geany_project_set_type_int(struct GeanyProject *prj, gint val)
+geany_project_set_type_int(struct GeanyPrj *prj, gint val)
{
prj->type = val;
}
void
-geany_project_set_type_string(struct GeanyProject *prj, const gchar * val)
+geany_project_set_type_string(struct GeanyPrj *prj, const gchar * val)
{
guint i;
@@ -264,13 +265,13 @@
}
void
-geany_project_set_regenerate(struct GeanyProject *prj, gboolean val)
+geany_project_set_regenerate(struct GeanyPrj *prj, gboolean val)
{
prj->regenerate = val;
}
void
-geany_project_set_description(struct GeanyProject *prj, const gchar * description)
+geany_project_set_description(struct GeanyPrj *prj, const gchar * description)
{
if (prj->description)
g_free(prj->description);
@@ -288,7 +289,7 @@
}
void
-geany_project_set_base_path(struct GeanyProject *prj, const gchar * base_path)
+geany_project_set_base_path(struct GeanyPrj *prj, const gchar * base_path)
{
if (prj->base_path)
g_free(prj->base_path);
@@ -314,7 +315,7 @@
}
void
-geany_project_set_run_cmd(struct GeanyProject *prj, const gchar * run_cmd)
+geany_project_set_run_cmd(struct GeanyPrj *prj, const gchar * run_cmd)
{
if (prj->run_cmd)
g_free(prj->run_cmd);
@@ -334,7 +335,7 @@
// list in utf8
void
-geany_project_set_tags_from_list(struct GeanyProject *prj, GSList * files)
+geany_project_set_tags_from_list(struct GeanyPrj *prj, GSList * files)
{
GSList *tmp;
gchar *locale_filename;
@@ -360,7 +361,7 @@
void
-geany_project_free(struct GeanyProject *prj)
+geany_project_free(struct GeanyPrj *prj)
{
debug("%s prj=%p\n", __FUNCTION__, prj);
g_return_if_fail(prj);
@@ -382,7 +383,7 @@
}
gboolean
-geany_project_add_file(struct GeanyProject *prj, const gchar * path)
+geany_project_add_file(struct GeanyPrj *prj, const gchar * path)
{
gchar *filename;
TMWorkObject *tm_obj = NULL;
@@ -417,7 +418,7 @@
struct CFGData
{
- struct GeanyProject *prj;
+ struct GeanyPrj *prj;
GKeyFile *config;
int i;
};
@@ -441,7 +442,7 @@
}
gboolean
-geany_project_remove_file(struct GeanyProject *prj, const gchar * path)
+geany_project_remove_file(struct GeanyPrj *prj, const gchar * path)
{
if (!g_hash_table_remove(prj->tags, path))
{
@@ -453,7 +454,7 @@
}
void
-geany_project_save(struct GeanyProject *prj)
+geany_project_save(struct GeanyPrj *prj)
{
GKeyFile *config;
struct CFGData data;
Modified: trunk/geanyprj/src/sidebar.c
===================================================================
--- trunk/geanyprj/src/sidebar.c 2008-06-20 10:32:59 UTC (rev 84)
+++ trunk/geanyprj/src/sidebar.c 2008-06-25 08:20:08 UTC (rev 85)
@@ -263,19 +263,17 @@
static void
update_popup_menu(G_GNUC_UNUSED GtkWidget * popup_menu)
{
- gint idx;
gboolean cur_file_exists;
gboolean badd_file;
+ GeanyDocument *doc;
- idx = p_document->get_cur_idx();
+ doc = p_document->get_current();
- cur_file_exists = DOC_IDX_VALID(idx) &&
- doc_list[idx].file_name != NULL && g_path_is_absolute(doc_list[idx].file_name);
+ cur_file_exists = doc && doc->file_name != NULL && g_path_is_absolute(doc->file_name);
badd_file = (g_current_project ? TRUE : FALSE) &&
!g_current_project->regenerate &&
- cur_file_exists &&
- !g_hash_table_lookup(g_current_project->tags, doc_list[idx].file_name);
+ cur_file_exists && !g_hash_table_lookup(g_current_project->tags, doc->file_name);
GtkTreeSelection *treesel = gtk_tree_view_get_selection(GTK_TREE_VIEW(file_view));
gboolean bremove_file = (g_current_project ? TRUE : FALSE) &&
Modified: trunk/geanyprj/src/xproject.c
===================================================================
--- trunk/geanyprj/src/xproject.c 2008-06-20 10:32:59 UTC (rev 84)
+++ trunk/geanyprj/src/xproject.c 2008-06-25 08:20:08 UTC (rev 85)
@@ -20,6 +20,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include <string.h>
#include <sys/time.h>
#include "geany.h"
@@ -39,7 +40,7 @@
extern GeanyFunctions *geany_functions;
-struct GeanyProject *g_current_project = NULL;
+struct GeanyPrj *g_current_project = NULL;
static GPtrArray *g_projects = NULL;
static void
@@ -96,14 +97,14 @@
xproject_open(const gchar * path)
{
guint i;
- struct GeanyProject *p = NULL;
+ struct GeanyPrj *p = NULL;
debug("%s\n", __FUNCTION__);
for (i = 0; i < g_projects->len; i++)
{
- if (strcmp(path, ((struct GeanyProject *) g_projects->pdata[i])->path) == 0)
+ if (strcmp(path, ((struct GeanyPrj *) g_projects->pdata[i])->path) == 0)
{
- p = (struct GeanyProject *) g_projects->pdata[i];
+ p = (struct GeanyPrj *) g_projects->pdata[i];
g_ptr_array_remove_index(g_projects, i);
break;
}
@@ -116,7 +117,7 @@
p_ui->set_statusbar(TRUE, _("Project \"%s\" opened."), p->name);
- project = g_new0(struct _GeanyProject, 1);
+ project = g_new0(struct GeanyProject, 1);
project->type = PROJECT_TYPE;
project->name = g_strdup(p->name);
project->description = g_strdup(p->description);
@@ -148,7 +149,7 @@
for (i = 0; i < g_projects->len; i++)
{
tm_obj = (TMWorkObject *)
- g_hash_table_lookup(((struct GeanyProject *) (g_projects->pdata[i]))->tags,
+ g_hash_table_lookup(((struct GeanyPrj *) (g_projects->pdata[i]))->tags,
filename);
if (tm_obj)
{
@@ -217,7 +218,7 @@
guint i;
for (i = 0; i < g_projects->len; i++)
{
- geany_project_free(((struct GeanyProject *) (g_projects->pdata[i])));
+ geany_project_free(((struct GeanyPrj *) (g_projects->pdata[i])));
}
g_ptr_array_free(g_projects, TRUE);
g_projects = NULL;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Plugins-Commits
mailing list