geany
1.38
About: Geany is a text editor (using GTK2) with basic features of an integrated development environment (syntax highlighting, code folding, symbol name auto-completion, ...). F: office T: editor programming GTK+ IDE
![]() ![]() |
#include "project.h"
#include "app.h"
#include "build.h"
#include "dialogs.h"
#include "document.h"
#include "editor.h"
#include "filetypesprivate.h"
#include "geanyobject.h"
#include "keyfile.h"
#include "main.h"
#include "projectprivate.h"
#include "sidebar.h"
#include "stash.h"
#include "support.h"
#include "ui_utils.h"
#include "utils.h"
#include "win32.h"
#include <string.h>
#include <unistd.h>
#include <errno.h>
Go to the source code of this file.
Classes | |
struct | _PropertyDialogElements |
Macros | |
#define | SHOW_ERR(args) dialogs_show_msgbox(GTK_MESSAGE_ERROR, args) |
#define | SHOW_ERR1(args, more) dialogs_show_msgbox(GTK_MESSAGE_ERROR, args, more) |
#define | MAX_NAME_LEN 50 |
#define | PROJECT_DIR _("projects") |
#define | COPY_PREF(dest, prefname) (dest.prefname = priv.prefname) |
Typedefs | |
typedef struct _PropertyDialogElements | PropertyDialogElements |
Functions | |
static gboolean | update_config (const PropertyDialogElements *e, gboolean new_project) |
static void | on_file_save_button_clicked (GtkButton *button, PropertyDialogElements *e) |
static gboolean | load_config (const gchar *filename) |
static gboolean | write_config (void) |
static void | on_name_entry_changed (GtkEditable *editable, PropertyDialogElements *e) |
static void | on_entries_changed (GtkEditable *editable, PropertyDialogElements *e) |
static void | on_radio_long_line_custom_toggled (GtkToggleButton *radio, GtkWidget *spin_long_line) |
static void | run_new_dialog (PropertyDialogElements *e) |
static void | apply_editor_prefs (void) |
static void | init_stash_prefs (void) |
static void | destroy_project (gboolean open_default) |
static gboolean | have_session_docs (void) |
static gboolean | handle_current_session (void) |
void | project_new (void) |
gboolean | project_load_file_with_session (const gchar *locale_file_name) |
static void | run_open_dialog (GtkDialog *dialog) |
void | project_open (void) |
static void | update_ui (void) |
static void | remove_foreach_project_filetype (gpointer data, gpointer user_data) |
gboolean | project_close (gboolean open_default) |
static void | on_project_properties_base_path_button_clicked (GtkWidget *button, GtkWidget *base_path_entry) |
static void | insert_build_page (PropertyDialogElements *e) |
static void | create_properties_dialog (PropertyDialogElements *e) |
static void | show_project_properties (gboolean show_build) |
void | project_properties (void) |
void | project_build_properties (void) |
gboolean | project_ask_close (void) |
static GeanyProject * | create_project (void) |
static void | run_dialog (GtkWidget *dialog, GtkWidget *entry) |
gboolean | project_load_file (const gchar *locale_file_name) |
void | project_write_config (void) |
Forces the project file rewrite and emission of the project-save signal. More... | |
gchar * | project_get_base_path (void) |
void | project_save_prefs (GKeyFile *config) |
void | project_load_prefs (GKeyFile *config) |
void | project_setup_prefs (void) |
void | project_apply_prefs (void) |
static void | add_stash_group (StashGroup *group, gboolean apply_defaults) |
const GeanyFilePrefs * | project_get_file_prefs (void) |
void | project_init (void) |
void | project_finalize (void) |
Variables | |
ProjectPrefs | project_prefs = { NULL, FALSE, FALSE } |
static GeanyProjectPrivate | priv |
static GeanyIndentPrefs | indentation |
static GSList * | stash_groups = NULL |
struct { | |
gchar * project_file_path | |
} | local_prefs = { NULL } |
#define COPY_PREF | ( | dest, | |
prefname | |||
) | (dest.prefname = priv.prefname) |
#define SHOW_ERR | ( | args | ) | dialogs_show_msgbox(GTK_MESSAGE_ERROR, args) |
#define SHOW_ERR1 | ( | args, | |
more | |||
) | dialogs_show_msgbox(GTK_MESSAGE_ERROR, args, more) |
typedef struct _PropertyDialogElements PropertyDialogElements |
|
static |
Definition at line 1259 of file project.c.
References group, stash_group_load_from_key_file(), and stash_groups.
Referenced by init_stash_prefs().
|
static |
Definition at line 1091 of file project.c.
References documents, editor_apply_update_prefs(), and foreach_document.
Referenced by destroy_project(), load_config(), and update_config().
|
static |
Definition at line 678 of file project.c.
References app, editor_prefs, GeanyProject::file_patterns, indentation, GeanyProjectPrivate::indentation, init_stash_prefs(), GeanyProjectPrivate::long_line_behaviour, GeanyEditorPrefs::long_line_column, GeanyProjectPrivate::long_line_column, NULL, priv, GeanyProject::priv, and GeanyApp::project.
Referenced by load_config(), and update_config().
|
static |
Definition at line 525 of file project.c.
References _PropertyDialogElements::base_path, create_project_dialog(), _PropertyDialogElements::description, _PropertyDialogElements::dialog, _PropertyDialogElements::file_name, MAX_NAME_LEN, _PropertyDialogElements::name, _PropertyDialogElements::notebook, on_project_properties_base_path_button_clicked(), on_radio_long_line_custom_toggled(), _PropertyDialogElements::patterns, ui_entry_add_clear_icon(), and ui_lookup_widget().
Referenced by show_project_properties().
|
static |
Definition at line 428 of file project.c.
References app, apply_editor_prefs(), GeanyProject::base_path, GeanyProjectPrivate::build_filetypes_list, build_remove_menu_item(), cl_options, configuration_open_files(), configuration_reload_default_session(), GeanyProject::description, document_new_file_if_non_open(), GeanyProject::file_name, GeanyProject::file_patterns, foreach_slist, GEANY_BCS_PROJ, GEANY_GBG_EXEC, GEANY_GBG_NON_FT, geany_object, GeanyProject::name, NULL, GeanyProject::priv, GeanyApp::project, project_prefs, remove_foreach_project_filetype(), stash_group_free(), stash_groups, ui_focus_current_document(), and update_ui().
Referenced by project_close(), and run_new_dialog().
|
static |
Definition at line 113 of file project.c.
References _, app, configuration_clear_default_session(), configuration_save_default_session(), dialogs_show_question(), document_close_all(), have_session_docs(), GeanyApp::project, project_close(), and project_prefs.
Referenced by run_new_dialog().
|
static |
Definition at line 104 of file project.c.
References GeanyDocument::changed, document_get_current(), GeanyDocument::file_name, main_widgets, and GeanyMainWidgets::notebook.
Referenced by handle_current_session(), and run_new_dialog().
|
static |
Definition at line 1273 of file project.c.
References add_stash_group(), GeanyEditorPrefs::auto_continue_multiline, GeanyProjectPrivate::auto_continue_multiline, GeanyIndentPrefs::auto_indent_mode, GeanyIndentPrefs::detect_type, GeanyIndentPrefs::detect_width, editor_get_indent_prefs(), editor_prefs, GeanyFilePrefs::ensure_convert_new_lines, GeanyProjectPrivate::ensure_convert_new_lines, file_prefs, GeanyFilePrefs::final_new_line, GeanyProjectPrivate::final_new_line, GEANY_AUTOINDENT_CURRENTCHARS, GEANY_INDENT_TYPE_BOTH, GEANY_INDENT_TYPE_SPACES, GEANY_INDENT_TYPE_TABS, group, GeanyIndentPrefs::hard_tab_width, indentation, GeanyEditorPrefs::line_break_column, GeanyProjectPrivate::line_break_column, GeanyEditorPrefs::line_wrapping, GeanyProjectPrivate::line_wrapping, NULL, priv, GeanyFilePrefs::replace_tabs, GeanyProjectPrivate::replace_tabs, stash_group_add_combo_box(), stash_group_add_integer(), stash_group_add_radio_buttons(), stash_group_add_spin_button_integer(), stash_group_add_toggle_button(), stash_group_new(), stash_group_set_use_defaults(), GeanyFilePrefs::strip_trailing_spaces, GeanyProjectPrivate::strip_trailing_spaces, GeanyIndentPrefs::type, and GeanyIndentPrefs::width.
Referenced by create_project().
|
static |
Definition at line 508 of file project.c.
References _, build_commands_table(), _PropertyDialogElements::build_page_num, _PropertyDialogElements::build_properties, document_get_current(), GeanyDocument::file_type, GEANY_BCS_PROJ, label, _PropertyDialogElements::notebook, and NULL.
Referenced by show_project_properties().
|
static |
Definition at line 1040 of file project.c.
References app, apply_editor_prefs(), GeanyProject::base_path, build_load_menu(), configuration_load_session_files(), configuration_save_default_session(), create_project(), GeanyProject::description, document_close_all(), editor_prefs, GeanyProject::file_name, GeanyProject::file_patterns, filename, foreach_slist, GEANY_BCS_PROJ, geany_object, GEANY_STRING_UNTITLED, GeanyProjectPrivate::long_line_behaviour, GeanyEditorPrefs::long_line_column, GeanyProjectPrivate::long_line_column, GeanyProject::name, NULL, GeanyProject::priv, GeanyApp::project, project_prefs, stash_group_load_from_key_file(), stash_groups, update_ui(), utils_get_setting_integer(), utils_get_setting_string(), and utils_get_utf8_from_locale().
Referenced by project_load_file().
|
static |
Definition at line 999 of file project.c.
References _PropertyDialogElements::entries_modified.
Referenced by project_new().
|
static |
Definition at line 930 of file project.c.
References _, dialog, _PropertyDialogElements::dialog, _PropertyDialogElements::file_name, NULL, and run_dialog().
Referenced by project_new().
|
static |
Definition at line 960 of file project.c.
References _PropertyDialogElements::base_path, EMPTY, _PropertyDialogElements::entries_modified, _PropertyDialogElements::file_name, GEANY_PROJECT_EXT, local_prefs, name, NULL, and project_prefs.
Referenced by project_new().
|
static |
|
static |
Definition at line 1005 of file project.c.
Referenced by create_properties_dialog(), and show_project_properties().
void project_apply_prefs | ( | void | ) |
Definition at line 1249 of file project.c.
References local_prefs, path_entry, SETPTR, ui_lookup_widget(), and ui_widgets.
Referenced by on_prefs_dialog_response().
gboolean project_ask_close | ( | void | ) |
Definition at line 660 of file project.c.
References _, app, dialogs_show_question_full(), GeanyProject::name, NULL, GeanyApp::project, and project_close().
void project_build_properties | ( | void | ) |
Definition at line 651 of file project.c.
References show_project_properties().
Referenced by on_set_build_commands_activate().
gboolean project_close | ( | gboolean | open_default | ) |
Definition at line 408 of file project.c.
References _, app, destroy_project(), document_close_all(), GeanyProject::file_name, GeanyProject::name, NULL, GeanyApp::project, project_prefs, ui_set_statusbar(), and write_config().
Referenced by handle_current_session(), project_ask_close(), project_open(), and run_open_dialog().
void project_finalize | ( | void | ) |
Definition at line 1348 of file project.c.
Referenced by do_main_quit().
gchar * project_get_base_path | ( | void | ) |
Definition at line 1171 of file project.c.
References app, GeanyProject::base_path, EMPTY, GeanyProject::file_name, NULL, GeanyApp::project, and utils_str_equal().
Referenced by build_load_menu(), build_replace_placeholder(), get_doc_folder(), and on_menu_open_selected_file1_activate().
const GeanyFilePrefs * project_get_file_prefs | ( | void | ) |
Definition at line 1327 of file project.c.
References app, COPY_PREF, file_prefs, and GeanyApp::project.
Referenced by document_save_file().
void project_init | ( | void | ) |
Definition at line 1343 of file project.c.
Referenced by main_lib().
gboolean project_load_file | ( | const gchar * | locale_file_name | ) |
Definition at line 1011 of file project.c.
References _, app, load_config(), GeanyProject::name, NULL, GeanyApp::project, ui_add_recent_project_file(), ui_set_statusbar(), and utils_get_utf8_from_locale().
Referenced by load_session_project_file(), main_load_project_from_command_line(), and project_load_file_with_session().
gboolean project_load_file_with_session | ( | const gchar * | locale_file_name | ) |
Definition at line 274 of file project.c.
References configuration_open_files(), document_new_file_if_non_open(), project_load_file(), project_prefs, and ui_focus_current_document().
Referenced by main_load_project_from_command_line(), project_open(), recent_project_activate_cb(), and run_open_dialog().
void project_load_prefs | ( | GKeyFile * | config | ) |
Definition at line 1212 of file project.c.
References cl_options, local_prefs, NULL, PROJECT_DIR, project_prefs, and utils_get_setting_string().
Referenced by configuration_load().
void project_new | ( | void | ) |
Definition at line 144 of file project.c.
References _, _PropertyDialogElements::base_path, _PropertyDialogElements::dialog, document_new_file_if_non_open(), _PropertyDialogElements::file_name, GEANY_PROJECT_EXT, gtk_container_add(), gtk_widget_show_all(), label, main_widgets, MAX_NAME_LEN, _PropertyDialogElements::name, NULL, on_entries_changed(), on_file_save_button_clicked(), on_name_entry_changed(), run_new_dialog(), ui_button_new_with_image(), ui_dialog_vbox_new(), ui_entry_add_clear_icon(), ui_focus_current_document(), ui_path_box_new(), ui_table_add_row(), and GeanyMainWidgets::window.
Referenced by on_project_new1_activate().
void project_open | ( | void | ) |
Definition at line 314 of file project.c.
References _, app, dialog, filter, GEANY_PROJECT_EXT, gtk_widget_show_all(), interface_prefs, local_prefs, main_widgets, NULL, GeanyApp::project, project_close(), project_load_file_with_session(), run_open_dialog(), SHOW_ERR1, GeanyInterfacePrefs::use_native_windows_dialogs, utils_get_locale_from_utf8(), and GeanyMainWidgets::window.
void project_properties | ( | void | ) |
Definition at line 645 of file project.c.
References show_project_properties().
Referenced by on_project_properties1_activate().
void project_save_prefs | ( | GKeyFile * | config | ) |
Definition at line 1197 of file project.c.
References app, cl_options, FALLBACK, GeanyProject::file_name, local_prefs, NULL, and GeanyApp::project.
Referenced by configuration_save().
void project_setup_prefs | ( | void | ) |
Definition at line 1230 of file project.c.
References local_prefs, NULL, path_entry, ui_lookup_widget(), ui_setup_open_button_callback(), and ui_widgets.
Referenced by prefs_init_dialog().
void project_write_config | ( | void | ) |
Forces the project file rewrite and emission of the project-save signal.
Plugins can use this function to save additional project data outside the project dialog.
Definition at line 1159 of file project.c.
References _, SHOW_ERR, and write_config().
Referenced by save_configuration_cb().
|
static |
Definition at line 394 of file project.c.
References NULL, GeanyFiletype::priv, GeanyFiletypePrivate::project_list_entry, GeanyFiletypePrivate::projerror_regex_string, GeanyFiletypePrivate::projexeccmds, GeanyFiletypePrivate::projfilecmds, and SETPTR.
Referenced by destroy_project().
|
static |
Definition at line 877 of file project.c.
References dialog, entry, filename, name, utils_get_locale_from_utf8(), and utils_get_utf8_from_locale().
Referenced by on_file_save_button_clicked().
|
static |
Definition at line 237 of file project.c.
References _, app, configuration_open_files(), configuration_reload_default_session(), configuration_save_default_session(), destroy_project(), _PropertyDialogElements::dialog, GeanyProject::file_name, handle_current_session(), have_session_docs(), GeanyProject::name, GeanyApp::project, SHOW_ERR, ui_add_recent_project_file(), ui_set_statusbar(), update_config(), and write_config().
Referenced by project_new().
|
static |
Definition at line 290 of file project.c.
References _, app, dialog, filename, GeanyApp::project, project_close(), project_load_file_with_session(), SHOW_ERR1, and utils_get_utf8_from_locale().
Referenced by project_open().
|
static |
Definition at line 567 of file project.c.
References _, app, _PropertyDialogElements::base_path, GeanyProject::base_path, build_free_fields(), _PropertyDialogElements::build_page_num, _PropertyDialogElements::build_properties, create_properties_dialog(), _PropertyDialogElements::description, GeanyProject::description, _PropertyDialogElements::dialog, _PropertyDialogElements::file_name, GeanyProject::file_name, GeanyProject::file_patterns, foreach_slist, geany_object, gtk_widget_show_all(), insert_build_page(), GeanyProjectPrivate::long_line_behaviour, GeanyProjectPrivate::long_line_column, _PropertyDialogElements::name, GeanyProject::name, _PropertyDialogElements::notebook, NULL, on_radio_long_line_custom_toggled(), _PropertyDialogElements::patterns, GeanyProject::priv, GeanyApp::project, SHOW_ERR, stash_group_display(), stash_groups, ui_lookup_widget(), ui_set_statusbar(), update_config(), and write_config().
Referenced by project_build_properties(), and project_properties().
|
static |
Definition at line 701 of file project.c.
References _, app, apply_editor_prefs(), _PropertyDialogElements::base_path, GeanyProject::base_path, GeanyProjectPrivate::build_filetypes_list, build_menu_update(), _PropertyDialogElements::build_properties, build_read_project(), create_project(), _PropertyDialogElements::description, GeanyProject::description, _PropertyDialogElements::dialog, dialogs_show_question_full(), document_get_current(), EMPTY, _PropertyDialogElements::file_name, GeanyProject::file_name, GeanyProject::file_patterns, GeanyDocument::file_type, foreach_slist, GeanyProjectPrivate::long_line_behaviour, GeanyProjectPrivate::long_line_column, MAX_NAME_LEN, name, _PropertyDialogElements::name, GeanyProject::name, NULL, _PropertyDialogElements::patterns, GeanyFiletype::priv, GeanyProject::priv, GeanyApp::project, GeanyFiletypePrivate::project_list_entry, GeanyFiletypePrivate::projfilecmds, SETPTR, SHOW_ERR, SHOW_ERR1, stash_group_update(), stash_groups, ui_lookup_widget(), update_ui(), utils_free_pointers(), utils_get_locale_from_utf8(), utils_is_file_writable(), utils_mkdir(), and utils_string_replace_all().
Referenced by run_new_dialog(), and show_project_properties().
|
static |
Definition at line 381 of file project.c.
References build_menu_update(), main_status, NULL, sidebar_openfiles_update_all(), ui_set_window_title(), and ui_update_recent_project_menu().
Referenced by destroy_project(), load_config(), and update_config().
|
static |
Definition at line 1102 of file project.c.
References app, GeanyProject::base_path, build_save_menu(), configuration_save_session_files(), GeanyProject::description, GeanyProject::file_name, GeanyProject::file_patterns, filename, foreach_slist, GEANY_BCS_PROJ, geany_object, GeanyProjectPrivate::long_line_behaviour, GeanyProjectPrivate::long_line_column, GeanyProject::name, NULL, GeanyProject::priv, GeanyApp::project, project_prefs, stash_group_save_to_key_file(), stash_groups, utils_get_locale_from_utf8(), and utils_write_file().
Referenced by project_close(), project_write_config(), run_new_dialog(), and show_project_properties().
|
static |
Definition at line 57 of file project.c.
Referenced by addNestingLevel(), create_project(), CreateIndentation(), Scintilla::Editor::DelCharBack(), Scintilla::Editor::Indent(), and init_stash_prefs().
struct { ... } local_prefs |
|
static |
Definition at line 56 of file project.c.
Referenced by create_project(), delegate_entry_activate_backward_cb(), delegate_entry_activate_cb(), delegate_entry_changed_cb(), findHxTags(), geany_entry_action_connect_proxy(), geany_entry_action_create_tool_item(), geany_entry_action_init(), geany_entry_action_new(), geany_menu_button_action_create_tool_item(), geany_menu_button_action_finalize(), geany_menu_button_action_get_menu(), geany_menu_button_action_init(), geany_menu_button_action_set_menu(), geany_menu_button_action_set_property(), init_stash_prefs(), menu_items_changed_cb(), notebook_new_tab(), plugin_set_key_group(), scintilla_object_accessible_finalize(), scintilla_object_accessible_init(), scintilla_object_accessible_widget_set(), tm_source_file_dup(), tm_source_file_free(), and tm_source_file_new().
ProjectPrefs project_prefs = { NULL, FALSE, FALSE } |
Definition at line 53 of file project.c.
Referenced by destroy_project(), handle_current_session(), load_config(), load_dialog_prefs(), load_session_project_file(), load_startup_files(), on_name_entry_changed(), on_prefs_dialog_response(), prefs_init_dialog(), project_close(), project_load_file_with_session(), project_load_prefs(), save_dialog_prefs(), and write_config().
|
static |
Definition at line 59 of file project.c.
Referenced by add_stash_group(), destroy_project(), load_config(), show_project_properties(), update_config(), and write_config().