Hi there, This is a new patch for Geanyprj. It doesn't implement any functionality or bug fix. It's only a cosmetic patch to comply to Geany's coding conventions.
Since geany-plugins has moved on GitHub, is there an equivalent to the "tracker->patches" functionality of SourceForge for sending patches ? Thanks, Johann
From 9003959d1f9e422498d20639e6ea4e36d05468f1 Mon Sep 17 00:00:00 2001 From: Johann Saunier <jsaunier.de...@gmail.com> Date: Mon, 12 Dec 2011 15:21:41 +0100 Subject: [PATCH] cosmetics for conforming to Geany's rules - run scripts/fix-alignment.pl - replace "int" by "gint" - put functions' prototypes and their return type one the same line - remove spaces between "*" and the identifier - replace C++ style comments with C comments --- geanyprj/src/geanyprj.c | 32 +++++++------- geanyprj/src/geanyprj.h | 92 +++++++++++++++++++----------------------- geanyprj/src/menu.c | 41 +++++++++---------- geanyprj/src/project.c | 103 +++++++++++++++++++++++------------------------ geanyprj/src/sidebar.c | 85 +++++++++++++++++++------------------- geanyprj/src/utils.c | 28 ++++++------- geanyprj/src/xproject.c | 51 +++++++++++------------ 7 files changed, 206 insertions(+), 226 deletions(-) diff --git a/geanyprj/src/geanyprj.c b/geanyprj/src/geanyprj.c index 44bd831..a8f28b1 100644 --- a/geanyprj/src/geanyprj.c +++ b/geanyprj/src/geanyprj.c @@ -51,8 +51,7 @@ enum PLUGIN_KEY_GROUP(geanyprj, KB_COUNT) -static void -reload_project() +static void reload_project() { gchar *dir; gchar *proj; @@ -87,8 +86,8 @@ reload_project() g_free(proj); } -static void -on_doc_save(G_GNUC_UNUSED GObject * obj, GeanyDocument * doc, G_GNUC_UNUSED gpointer user_data) + +static void on_doc_save(G_GNUC_UNUSED GObject *obj, GeanyDocument *doc, G_GNUC_UNUSED gpointer user_data) { gchar *name; @@ -103,20 +102,21 @@ on_doc_save(G_GNUC_UNUSED GObject * obj, GeanyDocument * doc, G_GNUC_UNUSED gpoi xproject_update_tag(doc->file_name); } -static void -on_doc_open(G_GNUC_UNUSED GObject * obj, G_GNUC_UNUSED GeanyDocument * doc, - G_GNUC_UNUSED gpointer user_data) + +static void on_doc_open(G_GNUC_UNUSED GObject *obj, G_GNUC_UNUSED GeanyDocument *doc, + G_GNUC_UNUSED gpointer user_data) { reload_project(); } -static void -on_doc_activate(G_GNUC_UNUSED GObject * obj, G_GNUC_UNUSED GeanyDocument * doc, - G_GNUC_UNUSED gpointer user_data) + +static void on_doc_activate(G_GNUC_UNUSED GObject *obj, G_GNUC_UNUSED GeanyDocument *doc, + G_GNUC_UNUSED gpointer user_data) { reload_project(); } + PluginCallback plugin_callbacks[] = { {"document-open", (GCallback) & on_doc_open, TRUE, NULL}, {"document-save", (GCallback) & on_doc_save, TRUE, NULL}, @@ -124,16 +124,16 @@ PluginCallback plugin_callbacks[] = { {NULL, NULL, FALSE, NULL} }; + /* Keybinding callback */ -static void -kb_find_in_project() +static void kb_find_in_project() { on_find_in_project(NULL, NULL); } + /* Called by Geany to initialize the plugin */ -void -plugin_init(G_GNUC_UNUSED GeanyData * data) +void plugin_init(G_GNUC_UNUSED GeanyData *data) { main_locale_init(LOCALEDIR, GETTEXT_PACKAGE); tools_menu_init(); @@ -147,9 +147,9 @@ plugin_init(G_GNUC_UNUSED GeanyData * data) _("Find a text in geanyprj's project"), NULL); } + /* Called by Geany before unloading the plugin. */ -void -plugin_cleanup() +void plugin_cleanup() { tools_menu_uninit(); diff --git a/geanyprj/src/geanyprj.h b/geanyprj/src/geanyprj.h index be8fe89..3c2202a 100644 --- a/geanyprj/src/geanyprj.h +++ b/geanyprj/src/geanyprj.h @@ -69,68 +69,60 @@ extern GeanyFunctions *geany_functions; extern const gchar *project_type_string[NEW_PROJECT_TYPE_SIZE]; extern void *project_type_filter[NEW_PROJECT_TYPE_SIZE]; -// project.c -struct GeanyPrj *geany_project_new(); -struct GeanyPrj *geany_project_load(const gchar * path); -void geany_project_free(struct GeanyPrj *prj); +/* project.c */ +struct GeanyPrj *geany_project_new(void); +struct GeanyPrj *geany_project_load(const gchar *path); +void geany_project_free(struct GeanyPrj *prj); void geany_project_regenerate_file_list(struct GeanyPrj *prj); - -gboolean geany_project_add_file(struct GeanyPrj *prj, const gchar * path); -gboolean geany_project_remove_file(struct GeanyPrj *prj, const gchar * path); +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 GeanyPrj *prj, const gchar * path); -void geany_project_set_name(struct GeanyPrj *prj, const gchar * name); +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_type_string(struct GeanyPrj *prj, const gchar *val); void geany_project_set_regenerate(struct GeanyPrj *prj, gboolean val); - -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 GeanyPrj *prj, GSList * files); +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 GeanyPrj *prj, GSList *files); -// sidebar.c -void create_sidebar(); -void destroy_sidebar(); +/* sidebar.c */ +void create_sidebar(void); +void destroy_sidebar(void); +void sidebar_refresh(void); -void sidebar_refresh(); - -// xproject.c -void xproject_init(); -void xproject_open(const gchar * path); -gboolean xproject_add_file(const gchar * path); -gboolean xproject_remove_file(const gchar * path); -void xproject_update_tag(const gchar * filename); -void xproject_cleanup(); +/* xproject.c */ +void xproject_init(void); +void xproject_open(const gchar *path); +gboolean xproject_add_file(const gchar *path); +gboolean xproject_remove_file(const gchar *path); +void xproject_update_tag(const gchar *filename); +void xproject_cleanup(void); void xproject_close(gboolean cache); -// menu.h -void tools_menu_init(); -void tools_menu_uninit(); - -void on_new_project(GtkMenuItem * menuitem, gpointer user_data); -void on_preferences(GtkMenuItem * menuitem, gpointer user_data); -void on_delete_project(GtkMenuItem * menuitem, gpointer user_data); -void on_add_file(GtkMenuItem * menuitem, gpointer user_data); -void on_find_in_project(GtkMenuItem * menuitem, gpointer user_data); - - - -// utils.c -gchar *find_file_path(const gchar * dir, const gchar * filename); -gchar *normpath(const gchar * filename); -gchar *get_full_path(const gchar * location, const gchar * path); -gchar *get_relative_path(const gchar * location, const gchar * path); -gint config_length(GKeyFile * config, const gchar * section, const gchar * name); -void save_config(GKeyFile * config, const gchar * path); -GSList *get_file_list(const gchar * path, guint * length, gboolean(*func) (const gchar *), - GError ** error); +/* menu.h */ +void tools_menu_init(void); +void tools_menu_uninit(void); +void on_new_project(GtkMenuItem *menuitem, gpointer user_data); +void on_preferences(GtkMenuItem *menuitem, gpointer user_data); +void on_delete_project(GtkMenuItem *menuitem, gpointer user_data); +void on_add_file(GtkMenuItem *menuitem, gpointer user_data); +void on_find_in_project(GtkMenuItem *menuitem, gpointer user_data); + + +/* utils.c */ +gchar *find_file_path(const gchar *dir, const gchar *filename); +gchar *normpath(const gchar *filename); +gchar *get_full_path(const gchar *location, const gchar *path); +gchar *get_relative_path(const gchar *location, const gchar *path); +gint config_length(GKeyFile *config, const gchar *section, const gchar *name); +void save_config(GKeyFile *config, const gchar *path); +GSList *get_file_list(const gchar *path, guint *length, gboolean(*func)(const gchar *), GError **error); extern struct GeanyPrj *g_current_project; diff --git a/geanyprj/src/menu.c b/geanyprj/src/menu.c index fdce1a5..2e77b92 100644 --- a/geanyprj/src/menu.c +++ b/geanyprj/src/menu.c @@ -43,7 +43,7 @@ static struct GtkWidget *find_in_files; } menu_items; -// simple struct to keep references to the elements of the properties dialog +/* simple struct to keep references to the elements of the properties dialog */ typedef struct _PropertyDialogElements { GtkWidget *dialog; @@ -58,8 +58,8 @@ typedef struct _PropertyDialogElements GtkWidget *patterns; } PropertyDialogElements; -static PropertyDialogElements * -build_properties_dialog(gboolean properties) + +static PropertyDialogElements *build_properties_dialog(gboolean properties) { GtkWidget *vbox; GtkWidget *table; @@ -197,8 +197,8 @@ build_properties_dialog(gboolean properties) return e; } -void -on_new_project(G_GNUC_UNUSED GtkMenuItem * menuitem, G_GNUC_UNUSED gpointer user_data) + +void on_new_project(G_GNUC_UNUSED GtkMenuItem *menuitem, G_GNUC_UNUSED gpointer user_data) { PropertyDialogElements *e; gint response; @@ -245,8 +245,8 @@ on_new_project(G_GNUC_UNUSED GtkMenuItem * menuitem, G_GNUC_UNUSED gpointer user g_free(e); } -void -on_preferences(G_GNUC_UNUSED GtkMenuItem * menuitem, G_GNUC_UNUSED gpointer user_data) + +void on_preferences(G_GNUC_UNUSED GtkMenuItem *menuitem, G_GNUC_UNUSED gpointer user_data) { PropertyDialogElements *e; gint response; @@ -291,8 +291,8 @@ on_preferences(G_GNUC_UNUSED GtkMenuItem * menuitem, G_GNUC_UNUSED gpointer user g_free(project_dir); } -void -on_delete_project(G_GNUC_UNUSED GtkMenuItem * menuitem, G_GNUC_UNUSED gpointer user_data) + +void on_delete_project(G_GNUC_UNUSED GtkMenuItem *menuitem, G_GNUC_UNUSED gpointer user_data) { gchar *path; if (!g_current_project) @@ -308,8 +308,8 @@ on_delete_project(G_GNUC_UNUSED GtkMenuItem * menuitem, G_GNUC_UNUSED gpointer u } } -void -on_add_file(G_GNUC_UNUSED GtkMenuItem * menuitem, G_GNUC_UNUSED gpointer user_data) + +void on_add_file(G_GNUC_UNUSED GtkMenuItem *menuitem, G_GNUC_UNUSED gpointer user_data) { GeanyDocument *doc; @@ -322,8 +322,8 @@ on_add_file(G_GNUC_UNUSED GtkMenuItem * menuitem, G_GNUC_UNUSED gpointer user_da xproject_add_file(doc->file_name); } -void -on_find_in_project(G_GNUC_UNUSED GtkMenuItem * menuitem, G_GNUC_UNUSED gpointer user_data) + +void on_find_in_project(G_GNUC_UNUSED GtkMenuItem *menuitem, G_GNUC_UNUSED gpointer user_data) { gchar *dir; if (!g_current_project) @@ -334,8 +334,8 @@ on_find_in_project(G_GNUC_UNUSED GtkMenuItem * menuitem, G_GNUC_UNUSED gpointer g_free(dir); } -static void -update_menu_items() + +static void update_menu_items() { gboolean cur_file_exists; gboolean badd_file; @@ -360,8 +360,8 @@ update_menu_items() gtk_widget_set_sensitive(menu_items.find_in_files, g_current_project ? TRUE : FALSE); } -void -tools_menu_init() + +void tools_menu_init() { GtkWidget *item, *image; @@ -379,9 +379,6 @@ tools_menu_init() menu_prj_menu = gtk_menu_new(); gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_prj), menu_prj_menu); - // - - image = gtk_image_new_from_stock(GTK_STOCK_NEW, GTK_ICON_SIZE_MENU); item = gtk_image_menu_item_new_with_mnemonic(_("New Project")); gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item), image); @@ -438,8 +435,8 @@ tools_menu_init() plugin_fields->flags = PLUGIN_IS_DOCUMENT_SENSITIVE; } -void -tools_menu_uninit() + +void tools_menu_uninit() { gtk_widget_destroy(plugin_fields->menu_item); } diff --git a/geanyprj/src/project.c b/geanyprj/src/project.c index 809c463..b7a8af7 100644 --- a/geanyprj/src/project.c +++ b/geanyprj/src/project.c @@ -36,8 +36,7 @@ const gchar *project_type_string[NEW_PROJECT_TYPE_SIZE] = { "None" }; -static gboolean -project_filter_c_cpp(const gchar * file) +static gboolean project_filter_c_cpp(const gchar *file) { if (filetypes_detect_from_file(file)->id == GEANY_FILETYPES_C || filetypes_detect_from_file(file)->id == GEANY_FILETYPES_CPP) @@ -45,32 +44,32 @@ project_filter_c_cpp(const gchar * file) return FALSE; } -static gboolean -project_filter_c(const gchar * file) + +static gboolean project_filter_c(const gchar *file) { if (filetypes_detect_from_file(file)->id == GEANY_FILETYPES_C) return TRUE; return FALSE; } -static gboolean -project_filter_python(const gchar * file) + +static gboolean project_filter_python(const gchar *file) { if (filetypes_detect_from_file(file)->id == GEANY_FILETYPES_PYTHON) return TRUE; return FALSE; } -static gboolean -project_filter_all(const gchar * file) + +static gboolean project_filter_all(const gchar *file) { if (filetypes_detect_from_file(file)->id != GEANY_FILETYPES_NONE) return TRUE; return FALSE; } -static gboolean -project_filter_none(G_GNUC_UNUSED const gchar * file) + +static gboolean project_filter_none(G_GNUC_UNUSED const gchar *file) { return FALSE; } @@ -85,14 +84,13 @@ void *project_type_filter[NEW_PROJECT_TYPE_SIZE] = { }; -static void -free_tag_object(gpointer obj) +static void free_tag_object(gpointer obj) { tm_workspace_remove_object((TMWorkObject *) obj, TRUE, FALSE); } -struct GeanyPrj * -geany_project_new() + +struct GeanyPrj *geany_project_new() { struct GeanyPrj *ret; @@ -102,8 +100,8 @@ geany_project_new() return ret; } -struct GeanyPrj * -geany_project_load(const gchar * path) + +struct GeanyPrj *geany_project_load(const gchar *path) { struct GeanyPrj *ret; TMWorkObject *tm_obj = NULL; @@ -158,7 +156,7 @@ geany_project_load(const gchar * path) } else { - // Create tag files + /* Create tag files */ key = g_strdup_printf("file%d", i); while ((file = g_key_file_get_string(config, "files", key, NULL))) { @@ -186,22 +184,22 @@ geany_project_load(const gchar * path) return ret; } + #if !GLIB_CHECK_VERSION(2, 12, 0) -static gboolean -get_true(gpointer key, gpointer value, gpointer user_data) +static gboolean get_true(gpointer key, gpointer value, gpointer user_data) { return TRUE; } -static void -g_hash_table_remove_all(GHashTable * hash_table) + +static void g_hash_table_remove_all(GHashTable *hash_table) { g_hash_table_foreach_remove(hash_table, get_true, NULL); } #endif -void -geany_project_regenerate_file_list(struct GeanyPrj *prj) + +void geany_project_regenerate_file_list(struct GeanyPrj *prj) { GSList *lst; @@ -215,8 +213,8 @@ geany_project_regenerate_file_list(struct GeanyPrj *prj) g_slist_free(lst); } -void -geany_project_set_path(struct GeanyPrj *prj, const gchar * path) + +void geany_project_set_path(struct GeanyPrj *prj, const gchar *path) { gchar *norm_path = normpath(path); if (prj->path) @@ -230,22 +228,22 @@ geany_project_set_path(struct GeanyPrj *prj, const gchar * path) prj->path = norm_path; } -void -geany_project_set_name(struct GeanyPrj *prj, const gchar * name) + +void geany_project_set_name(struct GeanyPrj *prj, const gchar *name) { if (prj->name) g_free(prj->name); prj->name = g_strdup(name); } -void -geany_project_set_type_int(struct GeanyPrj *prj, gint val) + +void geany_project_set_type_int(struct GeanyPrj *prj, gint val) { prj->type = val; } -void -geany_project_set_type_string(struct GeanyPrj *prj, const gchar * val) + +void geany_project_set_type_string(struct GeanyPrj *prj, const gchar *val) { guint i; @@ -256,22 +254,22 @@ 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_regenerate(struct GeanyPrj *prj, gboolean val) { prj->regenerate = val; } -void -geany_project_set_description(struct GeanyPrj *prj, const gchar * description) + +void geany_project_set_description(struct GeanyPrj *prj, const gchar *description) { if (prj->description) g_free(prj->description); prj->description = g_strdup(description); } -void -geany_project_set_base_path(struct GeanyPrj *prj, const gchar * base_path) + +void geany_project_set_base_path(struct GeanyPrj *prj, const gchar *base_path) { if (prj->base_path) g_free(prj->base_path); @@ -286,8 +284,8 @@ 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_run_cmd(struct GeanyPrj *prj, const gchar *run_cmd) { if (prj->run_cmd) g_free(prj->run_cmd); @@ -295,9 +293,8 @@ geany_project_set_run_cmd(struct GeanyPrj *prj, const gchar * run_cmd) } -// list in utf8 -void -geany_project_set_tags_from_list(struct GeanyPrj *prj, GSList * files) +/* list in utf8 */ +void geany_project_set_tags_from_list(struct GeanyPrj *prj, GSList *files) { GSList *tmp; gchar *locale_filename; @@ -322,8 +319,7 @@ geany_project_set_tags_from_list(struct GeanyPrj *prj, GSList * files) } -void -geany_project_free(struct GeanyPrj *prj) +void geany_project_free(struct GeanyPrj *prj) { debug("%s prj=%p\n", __FUNCTION__, prj); g_return_if_fail(prj); @@ -344,8 +340,8 @@ geany_project_free(struct GeanyPrj *prj) g_free(prj); } -gboolean -geany_project_add_file(struct GeanyPrj *prj, const gchar * path) + +gboolean geany_project_add_file(struct GeanyPrj *prj, const gchar *path) { gchar *filename; TMWorkObject *tm_obj = NULL; @@ -377,15 +373,16 @@ geany_project_add_file(struct GeanyPrj *prj, const gchar * path) return TRUE; } + struct CFGData { struct GeanyPrj *prj; GKeyFile *config; - int i; + gint i; }; -static void -geany_project_save_files(gpointer key, G_GNUC_UNUSED gpointer value, gpointer user_data) + +static void geany_project_save_files(gpointer key, G_GNUC_UNUSED gpointer value, gpointer user_data) { gchar *fkey; gchar *filename; @@ -402,8 +399,8 @@ geany_project_save_files(gpointer key, G_GNUC_UNUSED gpointer value, gpointer us } } -gboolean -geany_project_remove_file(struct GeanyPrj *prj, const gchar * path) + +gboolean geany_project_remove_file(struct GeanyPrj *prj, const gchar *path) { if (!g_hash_table_remove(prj->tags, path)) { @@ -414,8 +411,8 @@ geany_project_remove_file(struct GeanyPrj *prj, const gchar * path) return TRUE; } -void -geany_project_save(struct GeanyPrj *prj) + +void geany_project_save(struct GeanyPrj *prj) { GKeyFile *config; struct CFGData data; diff --git a/geanyprj/src/sidebar.c b/geanyprj/src/sidebar.c index a11cee6..af7bbec 100644 --- a/geanyprj/src/sidebar.c +++ b/geanyprj/src/sidebar.c @@ -57,8 +57,7 @@ static struct /* Returns: the full filename in locale encoding. */ -static gchar * -get_tree_path_filename(GtkTreePath * treepath) +static gchar *get_tree_path_filename(GtkTreePath *treepath) { GtkTreeModel *model = GTK_TREE_MODEL(file_store); GtkTreeIter iter; @@ -71,9 +70,9 @@ get_tree_path_filename(GtkTreePath * treepath) return name; } + /* We use documents->open_files() as it's more efficient. */ -static void -open_selected_files(GList * list) +static void open_selected_files(GList *list) { GSList *files = NULL; GList *item; @@ -85,12 +84,12 @@ open_selected_files(GList * list) files = g_slist_append(files, fname); } document_open_files(files, FALSE, NULL, NULL); - g_slist_foreach(files, (GFunc) g_free, NULL); // free filenames + g_slist_foreach(files, (GFunc)g_free, NULL); /* free filenames */ g_slist_free(files); } -static void -on_open_clicked(G_GNUC_UNUSED GtkMenuItem * menuitem, G_GNUC_UNUSED gpointer user_data) + +static void on_open_clicked(G_GNUC_UNUSED GtkMenuItem *menuitem, G_GNUC_UNUSED gpointer user_data) { GtkTreeSelection *treesel; GtkTreeModel *model; @@ -100,21 +99,21 @@ on_open_clicked(G_GNUC_UNUSED GtkMenuItem * menuitem, G_GNUC_UNUSED gpointer use list = gtk_tree_selection_get_selected_rows(treesel, &model); open_selected_files(list); - g_list_foreach(list, (GFunc) gtk_tree_path_free, NULL); + g_list_foreach(list, (GFunc)gtk_tree_path_free, NULL); g_list_free(list); } -static gboolean -on_button_press(G_GNUC_UNUSED GtkWidget * widget, GdkEventButton * event, - G_GNUC_UNUSED gpointer user_data) + +static gboolean on_button_press(G_GNUC_UNUSED GtkWidget *widget, GdkEventButton *event, + G_GNUC_UNUSED gpointer user_data) { if (event->button == 1 && event->type == GDK_2BUTTON_PRESS) on_open_clicked(NULL, NULL); return FALSE; } -static GtkWidget * -make_toolbar() + +static GtkWidget *make_toolbar() { GtkWidget *toolbar; @@ -125,8 +124,8 @@ make_toolbar() return toolbar; } -static void -remove_selected_files(GList * list) + +static void remove_selected_files(GList *list) { GList *item; for (item = list; item != NULL; item = g_list_next(item)) @@ -138,8 +137,8 @@ remove_selected_files(GList * list) } } -static void -on_remove_files(G_GNUC_UNUSED GtkMenuItem * menuitem, G_GNUC_UNUSED gpointer user_data) + +static void on_remove_files(G_GNUC_UNUSED GtkMenuItem *menuitem, G_GNUC_UNUSED gpointer user_data) { GtkTreeSelection *treesel; GtkTreeModel *model; @@ -153,8 +152,8 @@ on_remove_files(G_GNUC_UNUSED GtkMenuItem * menuitem, G_GNUC_UNUSED gpointer use g_list_free(list); } -static gboolean -on_key_press(G_GNUC_UNUSED GtkWidget * widget, GdkEventKey * event, G_GNUC_UNUSED gpointer data) + +static gboolean on_key_press(G_GNUC_UNUSED GtkWidget *widget, GdkEventKey *event, G_GNUC_UNUSED gpointer data) { if (event->keyval == GDK_Return || event->keyval == GDK_ISO_Enter @@ -163,8 +162,8 @@ on_key_press(G_GNUC_UNUSED GtkWidget * widget, GdkEventKey * event, G_GNUC_UNUSE return FALSE; } -static GtkWidget * -create_popup_menu() + +static GtkWidget *create_popup_menu() { GtkWidget *item, *menu, *image; @@ -252,8 +251,8 @@ create_popup_menu() return menu; } -static void -update_popup_menu(G_GNUC_UNUSED GtkWidget * popup_menu) + +static void update_popup_menu(G_GNUC_UNUSED GtkWidget *popup_menu) { gboolean cur_file_exists; gboolean badd_file; @@ -283,10 +282,10 @@ update_popup_menu(G_GNUC_UNUSED GtkWidget * popup_menu) gtk_widget_set_sensitive(popup_items.find_in_files, g_current_project ? TRUE : FALSE); } -// delay updating popup menu until the selection has been set -static gboolean -on_button_release(G_GNUC_UNUSED GtkWidget * widget, GdkEventButton * event, - G_GNUC_UNUSED gpointer user_data) + +/* delay updating popup menu until the selection has been set */ +static gboolean on_button_release(G_GNUC_UNUSED GtkWidget *widget, GdkEventButton *event, + G_GNUC_UNUSED gpointer user_data) { if (event->button == 3) { @@ -303,8 +302,8 @@ on_button_release(G_GNUC_UNUSED GtkWidget * widget, GdkEventButton * event, return FALSE; } -static void -prepare_file_view() + +static void prepare_file_view() { GtkCellRenderer *text_renderer; GtkTreeViewColumn *column; @@ -330,7 +329,7 @@ prepare_file_view() gtk_widget_modify_font(file_view, pfd); pango_font_description_free(pfd); - // selection handling + /* selection handling */ select = gtk_tree_view_get_selection(GTK_TREE_VIEW(file_view)); gtk_tree_selection_set_mode(select, GTK_SELECTION_SINGLE); @@ -342,14 +341,14 @@ prepare_file_view() g_signal_connect(G_OBJECT(file_view), "key-press-event", G_CALLBACK(on_key_press), NULL); } -void -sidebar_clear() + +void sidebar_clear() { gtk_list_store_clear(file_store); } -gint -mycmp(const gchar * a, const gchar * b) + +gint mycmp(const gchar *a, const gchar *b) { const gchar *p1 = a; const gchar *p2 = b; @@ -397,8 +396,8 @@ mycmp(const gchar * a, const gchar * b) return -1; } -static void -add_item(gpointer name, G_GNUC_UNUSED gpointer value, gpointer user_data) + +static void add_item(gpointer name, G_GNUC_UNUSED gpointer value, gpointer user_data) { gchar *item; GSList **lst = (GSList **) user_data; @@ -407,9 +406,9 @@ add_item(gpointer name, G_GNUC_UNUSED gpointer value, gpointer user_data) *lst = g_slist_prepend(*lst, item); } -// recreate the tree model from current_dir. -void -sidebar_refresh() + +/* recreate the tree model from current_dir */ +void sidebar_refresh() { GtkTreeIter iter; GSList *lst = NULL; @@ -431,8 +430,8 @@ sidebar_refresh() g_slist_free(lst); } -void -create_sidebar() + +void create_sidebar() { GtkWidget *scrollwin, *toolbar; @@ -454,8 +453,8 @@ create_sidebar() file_view_vbox, gtk_label_new(_("Project"))); } -void -destroy_sidebar() + +void destroy_sidebar() { gtk_widget_destroy(file_view_vbox); } diff --git a/geanyprj/src/utils.c b/geanyprj/src/utils.c index ca1682a..ae728d1 100644 --- a/geanyprj/src/utils.c +++ b/geanyprj/src/utils.c @@ -21,8 +21,7 @@ #include "geanyprj.h" -gchar * -find_file_path(const gchar * dir, const gchar * filename) +gchar *find_file_path(const gchar *dir, const gchar *filename) { gboolean ret = FALSE; gchar *base; @@ -52,13 +51,13 @@ find_file_path(const gchar * dir, const gchar * filename) return NULL; } + /* Normalize a pathname. This collapses redundant separators and up-level references so that A//B, A/./B * and A/foo/../B all become A/B. It does not normalize the case. On Windows, it converts forward * slashes to backward slashes. It should be understood that this may change the meaning of the * path if it contains symbolic links! */ -gchar * -normpath(const gchar * filename) +gchar *normpath(const gchar *filename) { gchar **v; gchar **p; @@ -116,8 +115,8 @@ normpath(const gchar * filename) return ret; } -gchar * -get_full_path(const gchar * location, const gchar * path) + +gchar *get_full_path(const gchar *location, const gchar *path) { gchar *dir; @@ -127,8 +126,8 @@ get_full_path(const gchar * location, const gchar * path) return dir; } -gchar * -get_relative_path(const gchar * location, const gchar * path) + +gchar *get_relative_path(const gchar *location, const gchar *path) { gchar *dir; gint plen; @@ -161,16 +160,16 @@ get_relative_path(const gchar * location, const gchar * path) return NULL; } -void -save_config(GKeyFile * config, const gchar * path) + +void save_config(GKeyFile *config, const gchar *path) { gchar *data = g_key_file_to_data(config, NULL, NULL); utils_write_file(path, data); g_free(data); } -gint -config_length(GKeyFile * config, const gchar * section, const gchar * name) + +gint config_length(GKeyFile *config, const gchar *section, const gchar *name) { gchar *key; gint i = 0; @@ -193,8 +192,7 @@ config_length(GKeyFile * config, const gchar * section, const gchar * name) * Returns: The list or NULL if no files found. * length will point to the number of non-NULL data items in the list, unless NULL. * error is the location for storing a possible error, or NULL. */ -GSList * -get_file_list(const gchar * path, guint * length, gboolean(*func) (const gchar *), GError ** error) +GSList *get_file_list(const gchar *path, guint * length, gboolean(*func)(const gchar *), GError ** error) { GSList *list = NULL; guint len = 0; @@ -240,7 +238,7 @@ get_file_list(const gchar * path, guint * length, gboolean(*func) (const gchar * continue; filename = g_build_filename(abs_path, name, NULL); - + if (g_file_test(filename, G_FILE_TEST_IS_SYMLINK)) { g_free(filename); diff --git a/geanyprj/src/xproject.c b/geanyprj/src/xproject.c index 3e0690e..c75a957 100644 --- a/geanyprj/src/xproject.c +++ b/geanyprj/src/xproject.c @@ -37,23 +37,23 @@ extern GeanyFunctions *geany_functions; struct GeanyPrj *g_current_project = NULL; static GPtrArray *g_projects = NULL; -static void -add_tag(G_GNUC_UNUSED gpointer key, gpointer value, G_GNUC_UNUSED gpointer user_data) + +static void add_tag(G_GNUC_UNUSED gpointer key, gpointer value, G_GNUC_UNUSED gpointer user_data) { - debug("%s file=%s\n", __FUNCTION__, (const gchar *) key); - tm_workspace_add_object((TMWorkObject *) value); + debug("%s file=%s\n", __FUNCTION__, (const gchar *)key); + tm_workspace_add_object((TMWorkObject *)value); } -static void -remove_tag(G_GNUC_UNUSED gpointer key, gpointer value, G_GNUC_UNUSED gpointer user_data) + +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); - tm_workspace_remove_object((TMWorkObject *) value, FALSE, FALSE); + debug("%s file=%s\n", __FUNCTION__, (const gchar *)key); + tm_workspace_remove_object((TMWorkObject *)value, FALSE, FALSE); } + /* This fonction should keep in sync with geany code */ -void -xproject_close(gboolean cache) +void xproject_close(gboolean cache) { debug("%s\n", __FUNCTION__); @@ -75,8 +75,7 @@ xproject_close(gboolean cache) } -void -xproject_open(const gchar * path) +void xproject_open(const gchar *path) { guint i; struct GeanyPrj *p = NULL; @@ -86,7 +85,7 @@ xproject_open(const gchar * path) { if (strcmp(path, ((struct GeanyPrj *) g_projects->pdata[i])->path) == 0) { - p = (struct GeanyPrj *) g_projects->pdata[i]; + p = (struct GeanyPrj *)g_projects->pdata[i]; g_ptr_array_remove_index(g_projects, i); break; } @@ -104,8 +103,8 @@ xproject_open(const gchar * path) sidebar_refresh(); } -void -xproject_update_tag(const gchar * filename) + +void xproject_update_tag(const gchar *filename) { guint i; TMWorkObject *tm_obj; @@ -121,9 +120,7 @@ xproject_update_tag(const gchar * filename) for (i = 0; i < g_projects->len; i++) { - tm_obj = (TMWorkObject *) - g_hash_table_lookup(((struct GeanyPrj *) (g_projects->pdata[i]))->tags, - filename); + tm_obj = (TMWorkObject *)g_hash_table_lookup(((struct GeanyPrj *)(g_projects->pdata[i]))->tags, filename); if (tm_obj) { tm_source_file_update(tm_obj, TRUE, FALSE, TRUE); @@ -131,8 +128,8 @@ xproject_update_tag(const gchar * filename) } } -gboolean -xproject_add_file(const gchar * path) + +gboolean xproject_add_file(const gchar *path) { TMWorkObject *tm_obj; @@ -154,8 +151,8 @@ xproject_add_file(const gchar * path) return FALSE; } -gboolean -xproject_remove_file(const gchar * path) + +gboolean xproject_remove_file(const gchar *path) { TMWorkObject *tm_obj; @@ -178,20 +175,20 @@ xproject_remove_file(const gchar * path) return FALSE; } -void -xproject_init() + +void xproject_init() { g_projects = g_ptr_array_sized_new(10); g_current_project = NULL; } -void -xproject_cleanup() + +void xproject_cleanup() { guint i; for (i = 0; i < g_projects->len; i++) { - geany_project_free(((struct GeanyPrj *) (g_projects->pdata[i]))); + geany_project_free(((struct GeanyPrj *)(g_projects->pdata[i]))); } g_ptr_array_free(g_projects, TRUE); g_projects = NULL; -- 1.7.1
_______________________________________________ Geany-devel mailing list Geany-devel@uvena.de https://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel