Revision: 339 http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=339&view=rev Author: yurand Date: 2008-12-13 10:49:29 +0000 (Sat, 13 Dec 2008)
Log Message: ----------- GeanyPrj: Update of Geany plugin API v116 and make usage of geanyfunctions.h
Patch from Nick Treleaven
Modified Paths: -------------- trunk/geanyprj/src/geanyprj.c trunk/geanyprj/src/menu.c trunk/geanyprj/src/project.c trunk/geanyprj/src/sidebar.c trunk/geanyprj/src/utils.c trunk/geanyprj/src/xproject.c
Modified: trunk/geanyprj/src/geanyprj.c =================================================================== --- trunk/geanyprj/src/geanyprj.c 2008-12-12 13:07:11 UTC (rev 338) +++ trunk/geanyprj/src/geanyprj.c 2008-12-13 10:49:29 UTC (rev 339) @@ -30,7 +30,7 @@ #include "filetypes.h" #include "utils.h" #include "ui_utils.h" -#include "pluginmacros.h" +#include "geanyfunctions.h"
#ifdef HAVE_LOCALE_H # include <locale.h> @@ -40,7 +40,7 @@
#include "geanyprj.h"
-PLUGIN_VERSION_CHECK(82); +PLUGIN_VERSION_CHECK(115); PLUGIN_SET_INFO(_("Project"), _("Alternative project support."), VERSION, _("Yura Siamashka yurand2@gmail.com"));
@@ -58,7 +58,7 @@
debug("%s\n", __FUNCTION__);
- doc = p_document->get_current(); + doc = document_get_current(); if (doc == NULL || doc->file_name == NULL) return;
@@ -159,7 +159,7 @@ plugin_init(G_GNUC_UNUSED GeanyData * data) { GtkWidget *prj = - p_support->lookup_widget(GTK_WIDGET(geany->main_widgets->window), "menu_project1"); + ui_lookup_widget(GTK_WIDGET(geany->main_widgets->window), "menu_project1");
locale_init(); tools_menu_init(); @@ -178,7 +178,7 @@ { GeanyProject *project = geany->app->project; GtkWidget *prj = - p_support->lookup_widget(GTK_WIDGET(geany->main_widgets->window), "menu_project1"); + ui_lookup_widget(GTK_WIDGET(geany->main_widgets->window), "menu_project1"); gtk_widget_set_child_visible(prj, TRUE); gtk_widget_set_size_request(prj, -1, -1);
Modified: trunk/geanyprj/src/menu.c =================================================================== --- trunk/geanyprj/src/menu.c 2008-12-12 13:07:11 UTC (rev 338) +++ trunk/geanyprj/src/menu.c 2008-12-13 10:49:29 UTC (rev 339) @@ -30,7 +30,7 @@ #include "keybindings.h" #include "utils.h" #include "ui_utils.h" -#include "pluginmacros.h" +#include "geanyfunctions.h"
#include "project.h"
@@ -78,14 +78,14 @@ GtkWidget *bbox; GtkWidget *label; GtkTooltips *tooltips = - GTK_TOOLTIPS(p_support->lookup_widget(geany->main_widgets->window, "tooltips")); + GTK_TOOLTIPS(ui_lookup_widget(geany->main_widgets->window, "tooltips")); PropertyDialogElements *e; gchar *dir = NULL; gchar *basename = NULL; gint i; GeanyDocument *doc;
- doc = p_document->get_current(); + doc = document_get_current();
if (doc && doc->file_name != NULL && g_path_is_absolute(doc->file_name)) { @@ -127,7 +127,7 @@ gtk_dialog_add_action_widget(GTK_DIALOG(e->dialog), button, GTK_RESPONSE_OK); }
- vbox = p_ui->dialog_vbox_new(GTK_DIALOG(e->dialog)); + vbox = ui_dialog_vbox_new(GTK_DIALOG(e->dialog));
table = gtk_table_new(5, 2, FALSE); gtk_table_set_row_spacings(GTK_TABLE(table), 5); @@ -140,7 +140,7 @@ gtk_entry_set_max_length(GTK_ENTRY(e->name), MAX_NAME_LEN); gtk_entry_set_text(GTK_ENTRY(e->name), basename);
- p_ui->table_add_row(GTK_TABLE(table), 0, label, e->name, NULL); + ui_table_add_row(GTK_TABLE(table), 0, label, e->name, NULL);
label = gtk_label_new(_("Location:")); gtk_misc_set_alignment(GTK_MISC(label), 1, 0); @@ -150,18 +150,18 @@ if (properties) { gtk_widget_set_sensitive(e->file_name, FALSE); - p_ui->table_add_row(GTK_TABLE(table), 1, label, e->file_name, NULL); + ui_table_add_row(GTK_TABLE(table), 1, label, e->file_name, NULL); } else { button = gtk_button_new(); image = gtk_image_new_from_stock("gtk-open", GTK_ICON_SIZE_BUTTON); gtk_container_add(GTK_CONTAINER(button), image); - bbox = p_ui->path_box_new(_("Choose Project Location"), + bbox = ui_path_box_new(_("Choose Project Location"), GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, GTK_ENTRY(e->file_name)); gtk_entry_set_text(GTK_ENTRY(e->file_name), dir); - p_ui->table_add_row(GTK_TABLE(table), 1, label, bbox, NULL); + ui_table_add_row(GTK_TABLE(table), 1, label, bbox, NULL); }
@@ -173,11 +173,11 @@ _("Base directory of all files that make up the project. " "This can be a new path, or an existing directory tree. " "You can use paths relative to the project filename."), NULL); - bbox = p_ui->path_box_new(_("Choose Project Base Path"), + bbox = ui_path_box_new(_("Choose Project Base Path"), GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, GTK_ENTRY(e->base_path)); gtk_entry_set_text(GTK_ENTRY(e->base_path), dir);
- p_ui->table_add_row(GTK_TABLE(table), 2, label, bbox, NULL); + ui_table_add_row(GTK_TABLE(table), 2, label, bbox, NULL);
label = gtk_label_new(_("")); e->regenerate = gtk_check_button_new_with_label(_("Generate file list on load")); @@ -187,7 +187,7 @@ "you checked this option, since your modification will be lost on " "on next project load"), NULL); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(e->regenerate), TRUE); - p_ui->table_add_row(GTK_TABLE(table), 3, label, e->regenerate, NULL); + ui_table_add_row(GTK_TABLE(table), 3, label, e->regenerate, NULL);
label = gtk_label_new(_("Type:")); @@ -198,7 +198,7 @@ gtk_combo_box_append_text(GTK_COMBO_BOX(e->type), project_type_string[i]); gtk_combo_box_set_active(GTK_COMBO_BOX(e->type), 0);
- p_ui->table_add_row(GTK_TABLE(table), 4, label, e->type, NULL); + ui_table_add_row(GTK_TABLE(table), 4, label, e->type, NULL);
gtk_container_add(GTK_CONTAINER(vbox), table); g_free(dir); @@ -228,7 +228,7 @@
if (g_file_test(path, G_FILE_TEST_EXISTS)) { - p_ui->set_statusbar(TRUE, _("Project file "%s" already exists"), path); + ui_set_statusbar(TRUE, _("Project file "%s" already exists"), path); g_free(path); goto retry; } @@ -248,7 +248,7 @@
geany_project_save(prj); geany_project_free(prj); - p_document->open_file(path, FALSE, NULL, NULL); + document_open_file(path, FALSE, NULL, NULL); }
gtk_widget_destroy(e->dialog); @@ -308,10 +308,10 @@ if (!g_current_project) return;
- if (p_dialogs->show_question("Do you really wish to delete current project:\n%s?", + if (dialogs_show_question("Do you really wish to delete current project:\n%s?", g_current_project->name)) { - path = p_utils->get_locale_from_utf8(g_current_project->path); + path = utils_get_locale_from_utf8(g_current_project->path); xproject_close(FALSE); g_unlink(path); g_free(path); @@ -323,7 +323,7 @@ { GeanyDocument *doc;
- doc = p_document->get_current(); + doc = document_get_current(); g_return_if_fail(doc && doc->file_name != NULL && g_path_is_absolute(doc->file_name));
if (!g_current_project) @@ -341,7 +341,7 @@
dir = g_path_get_dirname(g_current_project->path); setptr(dir, g_build_filename(dir, g_current_project->base_path, NULL)); - p_search->show_find_in_files_dialog(dir); + search_show_find_in_files_dialog(dir); g_free(dir); }
@@ -352,7 +352,7 @@ gboolean badd_file; GeanyDocument *doc;
- doc = p_document->get_current(); + doc = document_get_current(); g_return_if_fail(doc != NULL && doc->file_name != NULL);
cur_file_exists = doc && doc->file_name != NULL && g_path_is_absolute(doc->file_name);
Modified: trunk/geanyprj/src/project.c =================================================================== --- trunk/geanyprj/src/project.c 2008-12-12 13:07:11 UTC (rev 338) +++ trunk/geanyprj/src/project.c 2008-12-13 10:49:29 UTC (rev 339) @@ -30,7 +30,7 @@ #include "document.h" #include "filetypes.h" #include "utils.h" -#include "pluginmacros.h" +#include "geanyfunctions.h"
#include "project.h"
@@ -50,8 +50,8 @@ static gboolean project_filter_c_cpp(const gchar * file) { - if (p_filetypes->detect_from_file(file)->id == GEANY_FILETYPES_C || - p_filetypes->detect_from_file(file)->id == GEANY_FILETYPES_CPP) + if (filetypes_detect_from_file(file)->id == GEANY_FILETYPES_C || + filetypes_detect_from_file(file)->id == GEANY_FILETYPES_CPP) return TRUE; return FALSE; } @@ -59,7 +59,7 @@ static gboolean project_filter_c(const gchar * file) { - if (p_filetypes->detect_from_file(file)->id == GEANY_FILETYPES_C) + if (filetypes_detect_from_file(file)->id == GEANY_FILETYPES_C) return TRUE; return FALSE; } @@ -67,7 +67,7 @@ static gboolean project_filter_python(const gchar * file) { - if (p_filetypes->detect_from_file(file)->id == GEANY_FILETYPES_PYTHON) + if (filetypes_detect_from_file(file)->id == GEANY_FILETYPES_PYTHON) return TRUE; return FALSE; } @@ -75,7 +75,7 @@ static gboolean project_filter_all(const gchar * file) { - if (p_filetypes->detect_from_file(file)->id != GEANY_FILETYPES_NONE) + if (filetypes_detect_from_file(file)->id != GEANY_FILETYPES_NONE) return TRUE; return FALSE; } @@ -99,7 +99,7 @@ static void free_tag_object(gpointer obj) { - p_tm->workspace_remove_object((TMWorkObject *) obj, TRUE, FALSE); + tm_workspace_remove_object((TMWorkObject *) obj, TRUE, FALSE); }
struct GeanyPrj * @@ -141,24 +141,24 @@ ret = geany_project_new(); geany_project_set_path(ret, path);
- tmp = p_utils->get_setting_string(config, "project", "name", GEANY_STRING_UNTITLED); + tmp = utils_get_setting_string(config, "project", "name", GEANY_STRING_UNTITLED); geany_project_set_name(ret, tmp); g_free(tmp);
- tmp = p_utils->get_setting_string(config, "project", "description", ""); + tmp = utils_get_setting_string(config, "project", "description", ""); geany_project_set_description(ret, tmp); g_free(tmp);
- tmp = p_utils->get_setting_string(config, "project", "base_path", ""); + tmp = utils_get_setting_string(config, "project", "base_path", ""); geany_project_set_base_path(ret, tmp); g_free(tmp);
- tmp = p_utils->get_setting_string(config, "project", "run_cmd", ""); + tmp = utils_get_setting_string(config, "project", "run_cmd", ""); geany_project_set_run_cmd(ret, tmp); g_free(tmp);
geany_project_set_type_string(ret, - p_utils->get_setting_string(config, "project", "type", + utils_get_setting_string(config, "project", "type", project_type_string[0])); geany_project_set_regenerate(ret, g_key_file_get_boolean(config, "project", "regenerate", NULL)); @@ -175,15 +175,14 @@ { filename = get_full_path(path, file);
- locale_filename = p_utils->get_locale_from_utf8(filename); - tm_obj = p_tm->source_file_new(locale_filename, FALSE, - p_filetypes-> - detect_from_file(filename)->name); + locale_filename = utils_get_locale_from_utf8(filename); + tm_obj = tm_source_file_new(locale_filename, FALSE, + filetypes_detect_from_file(filename)->name); g_free(locale_filename); if (tm_obj) { g_hash_table_insert(ret->tags, filename, tm_obj); - p_tm->source_file_update(tm_obj, TRUE, FALSE, TRUE); + tm_source_file_update(tm_obj, TRUE, FALSE, TRUE); } else g_free(filename); @@ -354,14 +353,14 @@
for (tmp = files; tmp != NULL; tmp = g_slist_next(tmp)) { - locale_filename = p_utils->get_locale_from_utf8(tmp->data); - tm_obj = p_tm->source_file_new(locale_filename, FALSE, - p_filetypes->detect_from_file(tmp->data)->name); + locale_filename = utils_get_locale_from_utf8(tmp->data); + tm_obj = tm_source_file_new(locale_filename, FALSE, + filetypes_detect_from_file(tmp->data)->name); g_free(locale_filename); if (tm_obj) { g_hash_table_insert(prj->tags, g_strdup(tmp->data), tm_obj); - p_tm->source_file_update(tm_obj, TRUE, FALSE, TRUE); + tm_source_file_update(tm_obj, TRUE, FALSE, TRUE); } } } @@ -410,14 +409,14 @@ return TRUE; }
- filename = p_utils->get_locale_from_utf8(path); - tm_obj = p_tm->source_file_new(filename, FALSE, - p_filetypes->detect_from_file(path)->name); + filename = utils_get_locale_from_utf8(path); + tm_obj = tm_source_file_new(filename, FALSE, + filetypes_detect_from_file(path)->name); g_free(filename); if (tm_obj) { g_hash_table_insert(prj->tags, g_strdup(path), tm_obj); - p_tm->source_file_update(tm_obj, TRUE, FALSE, TRUE); + tm_source_file_update(tm_obj, TRUE, FALSE, TRUE); } geany_project_save(prj); return TRUE;
Modified: trunk/geanyprj/src/sidebar.c =================================================================== --- trunk/geanyprj/src/sidebar.c 2008-12-12 13:07:11 UTC (rev 338) +++ trunk/geanyprj/src/sidebar.c 2008-12-13 10:49:29 UTC (rev 339) @@ -31,7 +31,7 @@ #include "keybindings.h" #include "utils.h" #include "ui_utils.h" -#include "pluginmacros.h" +#include "geanyfunctions.h"
#include "project.h"
@@ -74,7 +74,7 @@
gtk_tree_model_get_iter(model, &iter, treepath); gtk_tree_model_get(model, &iter, FILEVIEW_COLUMN_NAME, &name, -1); - setptr(name, p_utils->get_locale_from_utf8(name)); + setptr(name, utils_get_locale_from_utf8(name)); setptr(name, get_full_path(g_current_project->path, name)); return name; } @@ -92,7 +92,7 @@ gchar *fname = get_tree_path_filename(treepath); files = g_slist_append(files, fname); } - p_document->open_files(files, FALSE, NULL, NULL); + document_open_files(files, FALSE, NULL, NULL); g_slist_foreach(files, (GFunc) g_free, NULL); // free filenames g_slist_free(files); } @@ -254,7 +254,7 @@ gtk_widget_show(item); gtk_container_add(GTK_CONTAINER(menu), item); g_signal_connect_swapped((gpointer) item, "activate", - G_CALLBACK(p_keybindings->send_command), + G_CALLBACK(keybindings_send_command), GINT_TO_POINTER(GEANY_KEYS_VIEW_SIDEBAR));
return menu; @@ -267,7 +267,7 @@ gboolean badd_file; GeanyDocument *doc;
- doc = p_document->get_current(); + doc = document_get_current();
cur_file_exists = doc && doc->file_name != NULL && g_path_is_absolute(doc->file_name);
Modified: trunk/geanyprj/src/utils.c =================================================================== --- trunk/geanyprj/src/utils.c 2008-12-12 13:07:11 UTC (rev 338) +++ trunk/geanyprj/src/utils.c 2008-12-13 10:49:29 UTC (rev 339) @@ -22,8 +22,8 @@
#include "geany.h" #include "plugindata.h" -#include "pluginmacros.h" #include "utils.h" +#include "geanyfunctions.h"
extern GeanyData *geany_data; extern GeanyFunctions *geany_functions; @@ -173,7 +173,7 @@ save_config(GKeyFile * config, const gchar * path) { gchar *data = g_key_file_to_data(config, NULL, NULL); - p_utils->write_file(path, data); + utils_write_file(path, data); g_free(data); }
Modified: trunk/geanyprj/src/xproject.c =================================================================== --- trunk/geanyprj/src/xproject.c 2008-12-12 13:07:11 UTC (rev 338) +++ trunk/geanyprj/src/xproject.c 2008-12-13 10:49:29 UTC (rev 339) @@ -30,7 +30,7 @@ #include "document.h" #include "filetypes.h" #include "utils.h" -#include "pluginmacros.h" +#include "geanyfunctions.h"
#include "project.h"
@@ -47,14 +47,14 @@ add_tag(G_GNUC_UNUSED gpointer key, gpointer value, G_GNUC_UNUSED gpointer user_data) { debug("%s file=%s\n", __FUNCTION__, (const gchar *) key); - p_tm->workspace_add_object((TMWorkObject *) value); + tm_workspace_add_object((TMWorkObject *) value); }
static void remove_tag(G_GNUC_UNUSED gpointer key, gpointer value, G_GNUC_UNUSED gpointer user_data) { debug("%s file=%s\n", __FUNCTION__, (const gchar *) key); - p_tm->workspace_remove_object((TMWorkObject *) value, FALSE, FALSE); + tm_workspace_remove_object((TMWorkObject *) value, FALSE, FALSE); }
/* This fonction should keep in sync with geany code */ @@ -66,7 +66,7 @@ if (!geany->app->project) return;
- p_ui->set_statusbar(TRUE, _("Project "%s" closed."), geany->app->project->name); + ui_set_statusbar(TRUE, _("Project "%s" closed."), geany->app->project->name);
g_free(geany->app->project->name); g_free(geany->app->project->description); @@ -117,7 +117,7 @@ if (!p) return;
- p_ui->set_statusbar(TRUE, _("Project "%s" opened."), p->name); + ui_set_statusbar(TRUE, _("Project "%s" opened."), p->name);
geany->app->project = g_new0(struct GeanyProject, 1); geany->app->project->type = PROJECT_TYPE; @@ -144,7 +144,7 @@ tm_obj = g_hash_table_lookup(g_current_project->tags, filename); if (tm_obj) { - p_tm->source_file_update(tm_obj, TRUE, FALSE, TRUE); + tm_source_file_update(tm_obj, TRUE, FALSE, TRUE); } }
@@ -155,7 +155,7 @@ filename); if (tm_obj) { - p_tm->source_file_update(tm_obj, TRUE, FALSE, TRUE); + tm_source_file_update(tm_obj, TRUE, FALSE, TRUE); } } } @@ -175,7 +175,7 @@ tm_obj = (TMWorkObject *) g_hash_table_lookup(g_current_project->tags, path); if (tm_obj) { - p_tm->workspace_add_object((TMWorkObject *) tm_obj); + tm_workspace_add_object((TMWorkObject *) tm_obj); } sidebar_refresh(); return TRUE; @@ -196,7 +196,7 @@ tm_obj = (TMWorkObject *) g_hash_table_lookup(g_current_project->tags, path); if (tm_obj) { - p_tm->workspace_remove_object(tm_obj, FALSE, FALSE); + tm_workspace_remove_object(tm_obj, FALSE, FALSE); }
if (geany_project_remove_file(g_current_project, path))
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
plugins-commits@lists.geany.org