Branch: refs/heads/master
Author: Matthew Brush <matt(a)geany.org>
Committer: Matthew Brush <mbrush(a)codebrainz.ca>
Date: Fri, 04 Aug 2017 09:09:37 UTC
Commit: ea217b7d4d9997e46a41f97d0da180639105d6ad
https://github.com/geany/geany/commit/ea217b7d4d9997e46a41f97d0da180639105d…
Log Message:
-----------
Update HACKING for best practices (C99)
Modified Paths:
--------------
HACKING
Modified: HACKING
14 lines changed, 12 insertions(+), 2 deletions(-)
===================================================================
@@ -200,8 +200,18 @@ Coding
moment, we want to keep the minimum requirement for GTK at 2.24 (of
course, you can use the GTK_CHECK_VERSION macro to protect code using
later versions).
-* Variables should be declared before statements. You can use
- gcc's -Wdeclaration-after-statement to warn about this.
+* Variables should be declared (and initialized) as close as practical
+ to their first use. This reduces the chances of intervening code being
+ inserted between declaration and use, where the variable may be
+ uninitialized.
+* Variables should be defined within the smallest scope that is practical,
+ for example inside a conditional branch which uses them or in the
+ initialization part of a for loop.
+* Local variables that will not be modified should be marked as ``const``
+ to indicate intention. This allows the compiler to give a warning if
+ part of the code accidentally tries to change the value. This does not
+ apply to non-pointer parameters where it needlessly exposes the
+ implementation and it's obvious a copy is made anyway.
* Don't let variable names shadow outer variables - use gcc's -Wshadow
option.
* Do not use G_LIKELY or G_UNLIKELY (except in critical loops). These
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
Branch: refs/heads/master
Author: Jiří Techet <techet(a)gmail.com>
Committer: Matthew Brush <mbrush(a)codebrainz.ca>
Date: Fri, 04 Aug 2017 08:30:21 UTC
Commit: e43c8d831445669bd94f960ff289bc1155668cd0
https://github.com/geany/geany/commit/e43c8d831445669bd94f960ff289bc1155668…
Log Message:
-----------
Always emit the project-save signal when writing project file
For some reason "project-save" isn't emitted when closing project - see
write_config(FALSE) in project_close(). This means that in this case
plugins cannot save their configuration into the config file. This doesn't
even correspond to the documentation of the signal
"Sent when a project is saved (happens when the project is created, the
properties dialog is closed or Geany is exited)"
as the signal isn't emitted when exiting Geany because at this point Geany
closes the project.
The comment seems to indicate that the reason is that "project-save"
shouldn't be emitted when "project-close" is emitted but I don't see any
reason why.
Bump API so plugins can rely on the changed behavior.
Modified Paths:
--------------
doc/pluginsignals.c
src/project.c
Modified: doc/pluginsignals.c
5 lines changed, 3 insertions(+), 2 deletions(-)
===================================================================
@@ -142,8 +142,9 @@ signal void (*document_close)(GObject *obj, GeanyDocument *doc, gpointer user_da
signal void (*project_open)(GObject *obj, GKeyFile *config, gpointer user_data);
/** Sent when a project is saved (happens when the project is created, the properties
- * dialog is closed or Geany is exited). This signal is emitted shortly before Geany
- * will write the contents of the GKeyFile to the disc.
+ * dialog is closed, before the project is closed, or when Geany is exited).
+ * This signal is emitted shortly before Geany will write the contents of the
+ * GKeyFile to the disc.
*
* @param obj a GeanyObject instance, should be ignored.
* @param config an existing GKeyFile object which can be used to read and write data.
Modified: src/project.c
20 lines changed, 7 insertions(+), 13 deletions(-)
===================================================================
@@ -83,7 +83,7 @@ typedef struct _PropertyDialogElements
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(gboolean emit_signal);
+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);
@@ -246,7 +246,7 @@ void project_new(void)
if (update_config(&e, TRUE))
{
// app->project is now set
- if (!write_config(TRUE))
+ if (!write_config())
{
SHOW_ERR(_("Project file could not be written"));
destroy_project(FALSE);
@@ -404,7 +404,7 @@ gboolean project_close(gboolean open_default)
g_return_val_if_fail(app->project != NULL, FALSE);
/* save project session files, etc */
- if (!write_config(FALSE))
+ if (!write_config())
g_warning("Project file \"%s\" could not be written", app->project->file_name);
if (project_prefs.project_session)
@@ -619,7 +619,7 @@ static void show_project_properties(gboolean show_build)
if (update_config(&e, FALSE))
{
g_signal_emit_by_name(geany_object, "project-dialog-confirmed", e.notebook);
- if (!write_config(TRUE))
+ if (!write_config())
SHOW_ERR(_("Project file could not be written"));
else
{
@@ -1092,11 +1092,8 @@ static void apply_editor_prefs(void)
/* Write the project settings as well as the project session files into its configuration files.
- * emit_signal defines whether the project-save signal should be emitted. When write_config()
- * is called while closing a project, this is used to skip emitting the signal because
- * project-close will be emitted afterwards.
* Returns: TRUE if project file was written successfully. */
-static gboolean write_config(gboolean emit_signal)
+static gboolean write_config(void)
{
GeanyProject *p;
GKeyFile *config;
@@ -1134,10 +1131,7 @@ static gboolean write_config(gboolean emit_signal)
if (project_prefs.project_session)
configuration_save_session_files(config);
build_save_menu(config, (gpointer)p, GEANY_BCS_PROJ);
- if (emit_signal)
- {
- g_signal_emit_by_name(geany_object, "project-save", config);
- }
+ g_signal_emit_by_name(geany_object, "project-save", config);
/* write the file */
data = g_key_file_to_data(config, NULL, NULL);
ret = (utils_write_file(filename, data) == 0);
@@ -1158,7 +1152,7 @@ static gboolean write_config(gboolean emit_signal)
GEANY_API_SYMBOL
void project_write_config(void)
{
- if (!write_config(TRUE))
+ if (!write_config())
SHOW_ERR(_("Project file could not be written"));
}
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
Branch: refs/heads/master
Author: Thomas Martitz <t.martitz(a)avm.de>
Committer: Matthew Brush <mbrush(a)codebrainz.ca>
Date: Fri, 04 Aug 2017 08:13:11 UTC
Commit: 180e1da427b4b23478360c720549c4c4e6ec92a7
https://github.com/geany/geany/commit/180e1da427b4b23478360c720549c4c4e6ec9…
Log Message:
-----------
api: the commits 745f424 and 169feae should have incremented the API version, do so now
Increment one time for both, and fix the corresponding doc comments.
The comment for keybindings_load_keyfile() is reflowed to split into
brief/detail sections properly.
Modified Paths:
--------------
src/keybindings.c
src/plugindata.h
src/tagmanager/tm_tag.c
Modified: src/keybindings.c
17 lines changed, 9 insertions(+), 8 deletions(-)
===================================================================
@@ -824,14 +824,15 @@ static void apply_kb_accel(GeanyKeyGroup *group, GeanyKeyBinding *kb, gpointer u
}
-/** Reloads keybinding settings from configuration file. Normally plugins do
- * not need to call this function as it is called automatically when a the
- * plugin is activated. However, plugins which need to create keybindings
- * dynamically and reload them when needed should call this function after
- * all keybindings have been updated with plugin_set_key_group() and
- * keybindings_set_item() calls - this makes sure that the corresponding user
- * keybinding shortcuts are applied.
- * @since 1.31. */
+/** Reloads keybinding settings from configuration file.
+ *
+ * Normally plugins do not need to call this function as it is called automatically when a
+ * the plugin is activated. However, plugins which need to create keybindings dynamically
+ * and reload them when needed should call this function after all keybindings have been
+ * updated with plugin_set_key_group() and keybindings_set_item() calls - this makes sure
+ * that the corresponding user keybinding shortcuts are applied.
+ *
+ * @since 1.32 (API 233) */
GEANY_API_SYMBOL
void keybindings_load_keyfile(void)
{
Modified: src/plugindata.h
2 lines changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -59,7 +59,7 @@ G_BEGIN_DECLS
* @warning You should not test for values below 200 as previously
* @c GEANY_API_VERSION was defined as an enum value, not a macro.
*/
-#define GEANY_API_VERSION 232
+#define GEANY_API_VERSION 233
/* hack to have a different ABI when built with GTK3 because loading GTK2-linked plugins
* with GTK3-linked Geany leads to crash */
Modified: src/tagmanager/tm_tag.c
2 lines changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -85,7 +85,7 @@ typedef struct
/** Gets the GType for a TMTag.
*
* @return TMTag type
- * @since 1.32 (API 232) */
+ * @since 1.32 (API 233) */
GEANY_API_SYMBOL
GType tm_tag_get_type(void)
{
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
Branch: refs/heads/master
Author: Jiří Techet <techet(a)gmail.com>
Committer: Matthew Brush <mbrush(a)codebrainz.ca>
Date: Fri, 04 Aug 2017 07:37:19 UTC
Commit: 745f424b7752e1f181e0ef82b1d00ed99d6c69a7
https://github.com/geany/geany/commit/745f424b7752e1f181e0ef82b1d00ed99d6c6…
Log Message:
-----------
Export keybindings_load_keyfile() for plugins
This allows plugins to reload keybindings later during their execution.
For more info see the comment in the commit.
Closes #1430
Modified Paths:
--------------
src/keybindings.c
src/keybindings.h
Modified: src/keybindings.c
9 lines changed, 9 insertions(+), 0 deletions(-)
===================================================================
@@ -824,6 +824,15 @@ static void apply_kb_accel(GeanyKeyGroup *group, GeanyKeyBinding *kb, gpointer u
}
+/** Reloads keybinding settings from configuration file. Normally plugins do
+ * not need to call this function as it is called automatically when a the
+ * plugin is activated. However, plugins which need to create keybindings
+ * dynamically and reload them when needed should call this function after
+ * all keybindings have been updated with plugin_set_key_group() and
+ * keybindings_set_item() calls - this makes sure that the corresponding user
+ * keybinding shortcuts are applied.
+ * @since 1.31. */
+GEANY_API_SYMBOL
void keybindings_load_keyfile(void)
{
load_user_kb();
Modified: src/keybindings.h
4 lines changed, 2 insertions(+), 2 deletions(-)
===================================================================
@@ -293,15 +293,15 @@ GeanyKeyBinding *keybindings_get_item(GeanyKeyGroup *group, gsize key_id);
GdkModifierType keybindings_get_modifiers(GdkModifierType mods);
+void keybindings_load_keyfile(void);
+
#ifdef GEANY_PRIVATE
extern GPtrArray *keybinding_groups; /* array of GeanyKeyGroup pointers */
void keybindings_init(void);
-void keybindings_load_keyfile(void);
-
void keybindings_free(void);
GeanyKeyGroup *keybindings_get_core_group(guint id);
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
Branch: refs/heads/master
Author: Thomas Martitz <kugel(a)rockbox.org>
Committer: Matthew Brush <mbrush(a)codebrainz.ca>
Date: Fri, 04 Aug 2017 07:17:11 UTC
Commit: 169feae90e72d54049c7765c6975fa9a009268aa
https://github.com/geany/geany/commit/169feae90e72d54049c7765c6975fa9a00926…
Log Message:
-----------
api: export tm_tag_get_type()
This indicates that TMTag is GBoxed-derived, and can be copied/ref'd.
This helps plugins that must store a tag pointer for later usage while the
tagmanager might let it go in the meantime (can happen quickly if the user
comments a function out when starting a doxygen-comment).
Closes #1465
Modified Paths:
--------------
doc/Doxyfile.in
src/tagmanager/tm_tag.c
src/tagmanager/tm_tag.h
Modified: doc/Doxyfile.in
1 lines changed, 1 insertions(+), 0 deletions(-)
===================================================================
@@ -798,6 +798,7 @@ INPUT = @top_srcdir@/src/ \
@top_srcdir@/src/tagmanager/tm_source_file.h \
@top_srcdir@/src/tagmanager/tm_workspace.c \
@top_srcdir@/src/tagmanager/tm_workspace.h \
+ @top_srcdir@/src/tagmanager/tm_tag.c \
@top_srcdir@/src/tagmanager/tm_tag.h \
@top_srcdir@/src/tagmanager/tm_parser.h
Modified: src/tagmanager/tm_tag.c
6 lines changed, 5 insertions(+), 1 deletions(-)
===================================================================
@@ -82,7 +82,11 @@ typedef struct
gboolean first;
} TMSortOptions;
-/* Gets the GType for a TMTag */
+/** Gets the GType for a TMTag.
+ *
+ * @return TMTag type
+ * @since 1.32 (API 232) */
+GEANY_API_SYMBOL
GType tm_tag_get_type(void)
{
static GType gtype = 0;
Modified: src/tagmanager/tm_tag.h
5 lines changed, 2 insertions(+), 3 deletions(-)
===================================================================
@@ -103,14 +103,13 @@ typedef struct TMTag
TMParserType lang; /* Programming language of the file */
} TMTag;
-
-#ifdef GEANY_PRIVATE
-
/* The GType for a TMTag */
#define TM_TYPE_TAG (tm_tag_get_type())
GType tm_tag_get_type(void) G_GNUC_CONST;
+#ifdef GEANY_PRIVATE
+
TMTag *tm_tag_new(void);
void tm_tags_remove_file_tags(TMSourceFile *source_file, GPtrArray *tags_array);
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).