Revision: 392 http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=392&view=rev Author: yurand Date: 2009-01-20 10:46:34 +0000 (Tue, 20 Jan 2009)
Log Message: ----------- GeanyPrj: removed native project hack
Modified Paths: -------------- trunk/geanyprj/src/geanyprj.c trunk/geanyprj/src/menu.c trunk/geanyprj/src/project.c trunk/geanyprj/src/xproject.c
Modified: trunk/geanyprj/src/geanyprj.c =================================================================== --- trunk/geanyprj/src/geanyprj.c 2009-01-20 00:17:04 UTC (rev 391) +++ trunk/geanyprj/src/geanyprj.c 2009-01-20 10:46:34 UTC (rev 392) @@ -53,9 +53,7 @@ gchar *dir; gchar *proj; GeanyDocument *doc; - GeanyProject *project = geany->app->project;
- debug("%s\n", __FUNCTION__);
doc = document_get_current(); @@ -65,21 +63,14 @@ 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 - if (project && project->type != PROJECT_TYPE) - { - debug("%s Closing unknown project type \n", __FUNCTION__); - xproject_close(TRUE); - } - if (!proj) { - if (project) + if (g_current_project) xproject_close(TRUE); return; }
- if (!project) + if (!g_current_project) { xproject_open(proj); } @@ -129,7 +120,8 @@ {NULL, NULL, FALSE, NULL} };
-static void locale_init(void) +static void +locale_init(void) { #ifdef ENABLE_NLS gchar *locale_dir = NULL; @@ -158,15 +150,9 @@ void plugin_init(G_GNUC_UNUSED GeanyData * data) { - GtkWidget *prj = - ui_lookup_widget(GTK_WIDGET(geany->main_widgets->window), "menu_project1"); - locale_init(); tools_menu_init();
- gtk_widget_set_child_visible(prj, FALSE); - gtk_widget_set_size_request(prj, 0, 0); - xproject_init(); create_sidebar(); reload_project(); @@ -176,19 +162,8 @@ void plugin_cleanup() { - GeanyProject *project = geany->app->project; - GtkWidget *prj = - 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); - tools_menu_uninit();
- if (project) - { - xproject_close(TRUE); - } - if (g_current_project) geany_project_free(g_current_project); g_current_project = NULL;
Modified: trunk/geanyprj/src/menu.c =================================================================== --- trunk/geanyprj/src/menu.c 2009-01-20 00:17:04 UTC (rev 391) +++ trunk/geanyprj/src/menu.c 2009-01-20 10:46:34 UTC (rev 392) @@ -158,8 +158,8 @@ image = gtk_image_new_from_stock("gtk-open", GTK_ICON_SIZE_BUTTON); gtk_container_add(GTK_CONTAINER(button), image); bbox = ui_path_box_new(_("Choose Project Location"), - GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, - GTK_ENTRY(e->file_name)); + GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, + GTK_ENTRY(e->file_name)); gtk_entry_set_text(GTK_ENTRY(e->file_name), dir); ui_table_add_row(GTK_TABLE(table), 1, label, bbox, NULL); } @@ -174,7 +174,7 @@ "This can be a new path, or an existing directory tree. " "You can use paths 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_FILE_CHOOSER_ACTION_SELECT_FOLDER, GTK_ENTRY(e->base_path)); gtk_entry_set_text(GTK_ENTRY(e->base_path), dir);
ui_table_add_row(GTK_TABLE(table), 2, label, bbox, NULL); @@ -309,7 +309,7 @@ return;
if (dialogs_show_question("Do you really wish to delete current project:\n%s?", - g_current_project->name)) + g_current_project->name)) { path = utils_get_locale_from_utf8(g_current_project->path); xproject_close(FALSE);
Modified: trunk/geanyprj/src/project.c =================================================================== --- trunk/geanyprj/src/project.c 2009-01-20 00:17:04 UTC (rev 391) +++ trunk/geanyprj/src/project.c 2009-01-20 10:46:34 UTC (rev 392) @@ -159,7 +159,7 @@
geany_project_set_type_string(ret, utils_get_setting_string(config, "project", "type", - project_type_string[0])); + project_type_string[0])); geany_project_set_regenerate(ret, g_key_file_get_boolean(config, "project", "regenerate", NULL));
@@ -177,7 +177,7 @@
locale_filename = utils_get_locale_from_utf8(filename); tm_obj = tm_source_file_new(locale_filename, FALSE, - filetypes_detect_from_file(filename)->name); + filetypes_detect_from_file(filename)->name); g_free(locale_filename); if (tm_obj) { @@ -205,7 +205,7 @@ }
static void -g_hash_table_remove_all(GHashTable *hash_table) +g_hash_table_remove_all(GHashTable * hash_table) { g_hash_table_foreach_remove(hash_table, get_true, NULL); } @@ -244,21 +244,9 @@ void geany_project_set_name(struct GeanyPrj *prj, const gchar * name) { - GeanyProject *project = geany->app->project; - if (prj->name) g_free(prj->name); prj->name = g_strdup(name); - - if (prj == g_current_project) - { - if (project) - { - if (project->name) - g_free(project->name); - project->name = g_strdup(name); - } - } }
void @@ -288,27 +276,14 @@ void geany_project_set_description(struct GeanyPrj *prj, const gchar * description) { - GeanyProject *project = geany->app->project; if (prj->description) g_free(prj->description); prj->description = g_strdup(description); - - if (prj == g_current_project) - { - if (project) - { - if (project->description) - g_free(project->description); - project->description = g_strdup(description); - } - } }
void geany_project_set_base_path(struct GeanyPrj *prj, const gchar * base_path) { - GeanyProject *project = geany->app->project; - if (prj->base_path) g_free(prj->base_path);
@@ -320,36 +295,14 @@ { prj->base_path = get_full_path(prj->path, base_path); } - - if (prj == g_current_project) - { - if (project) - { - if (project->base_path) - g_free(project->base_path); - project->base_path = g_strdup(base_path); - } - } }
void geany_project_set_run_cmd(struct GeanyPrj *prj, const gchar * run_cmd) { - GeanyProject *project = geany->app->project; - if (prj->run_cmd) g_free(prj->run_cmd); prj->run_cmd = g_strdup(run_cmd); - - if (prj == g_current_project) - { - if (project) - { - if (project->run_cmd) - g_free(project->run_cmd); - project->run_cmd = g_strdup(run_cmd); - } - } }
@@ -369,7 +322,7 @@ { 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); + filetypes_detect_from_file(tmp->data)->name); g_free(locale_filename); if (tm_obj) { @@ -424,8 +377,7 @@ }
filename = utils_get_locale_from_utf8(path); - tm_obj = tm_source_file_new(filename, FALSE, - filetypes_detect_from_file(path)->name); + tm_obj = tm_source_file_new(filename, FALSE, filetypes_detect_from_file(path)->name); g_free(filename); if (tm_obj) {
Modified: trunk/geanyprj/src/xproject.c =================================================================== --- trunk/geanyprj/src/xproject.c 2009-01-20 00:17:04 UTC (rev 391) +++ trunk/geanyprj/src/xproject.c 2009-01-20 10:46:34 UTC (rev 392) @@ -63,20 +63,6 @@ { debug("%s\n", __FUNCTION__);
- if (!geany->app->project) - return; - - ui_set_statusbar(TRUE, _("Project "%s" closed."), geany->app->project->name); - - g_free(geany->app->project->name); - g_free(geany->app->project->description); - g_free(geany->app->project->file_name); - g_free(geany->app->project->base_path); - g_free(geany->app->project->run_cmd); - - g_free(geany->app->project); - geany->app->project = NULL; - if (!g_current_project) return;
@@ -118,15 +104,6 @@ return;
ui_set_statusbar(TRUE, _("Project "%s" opened."), p->name); - - geany->app->project = g_new0(struct GeanyProject, 1); - geany->app->project->type = PROJECT_TYPE; - geany->app->project->name = g_strdup(p->name); - geany->app->project->description = g_strdup(p->description); - geany->app->project->base_path = g_strdup(p->base_path); - geany->app->project->run_cmd = g_strdup(p->run_cmd); - geany->app->project->make_in_base_path = TRUE; - g_hash_table_foreach(p->tags, add_tag, NULL);
g_current_project = p;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
plugins-commits@lists.geany.org