lists.geany.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
List overview
Plugins-Commits
March 2019
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
plugins-commits@lists.geany.org
1 participants
17 discussions
Start a n
N
ew thread
[geany/geany-plugins] c3a212: Merge pull request #836 from eht16/geanyvc_add_commit_message_history
by Frank Lanitz
31 Mar '19
31 Mar '19
Branch: refs/heads/master Author: Frank Lanitz <frank(a)frank.uvena.de> Committer: GitHub <noreply(a)github.com> Date: Sun, 31 Mar 2019 14:30:08 UTC Commit: c3a212d3c92290ca9ee58602b873dabd5993c61e
https://github.com/geany/geany-plugins/commit/c3a212d3c92290ca9ee58602b873d…
Log Message: ----------- Merge pull request #836 from eht16/geanyvc_add_commit_message_history GeanyVC: Add a commit message history Modified Paths: -------------- geanyvc/src/geanyvc.c Modified: geanyvc/src/geanyvc.c 153 lines changed, 153 insertions(+), 0 deletions(-) =================================================================== @@ -84,6 +84,7 @@ static gboolean set_editor_menu_entries; static gboolean set_menubar_entry; static gint commit_dialog_width = 0; static gint commit_dialog_height = 0; +static GSList *commit_message_history = NULL; static gchar *config_file; @@ -155,6 +156,15 @@ enum COUNT_KB }; +enum +{ + COMMIT_MESSAGE_HISTORY_DISPLAY_TEXT = 0, + COMMIT_MESSAGE_HISTORY_FULL_TEXT, + COMMIT_MESSAGE_HISTORY_ACTIVE, + COMMIT_MESSAGE_HISTORY_NUM_COLUMNS +}; +#define COMMIT_MESSAGE_HISTORY_LENGTH 10 + GSList *get_commit_files_null(G_GNUC_UNUSED const gchar * dir) { @@ -1319,6 +1329,90 @@ static void commit_tree_selection_changed_cb(GtkTreeSelection *sel, GtkTextView g_free(path); } +static void commit_message_update_cb(GtkWidget *widget, gpointer user_data) +{ + GtkTreeIter iter; + + if (gtk_combo_box_get_active_iter(GTK_COMBO_BOX(widget), &iter)) + { + gchar *commit_message; + GtkTreeModel *model = gtk_combo_box_get_model(GTK_COMBO_BOX(widget)); + gboolean active = FALSE; + + gtk_tree_model_get(model, &iter, + COMMIT_MESSAGE_HISTORY_FULL_TEXT, &commit_message, + COMMIT_MESSAGE_HISTORY_ACTIVE, &active, -1); + + if (active) + { + GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(user_data)); + gtk_text_buffer_set_text(buffer, commit_message, -1); + } + g_free(commit_message); + } +} + +static GtkWidget * +create_commit_message_history_combobox(void) +{ + GtkWidget *combobox; + GtkCellRenderer *renderer; + GtkTreeIter iter; + GtkListStore *store; + GSList *list_item; + GString *display_message_string; + gchar *display_message; + + combobox = gtk_combo_box_new(); + renderer = gtk_cell_renderer_text_new(); + store = gtk_list_store_new( + COMMIT_MESSAGE_HISTORY_NUM_COLUMNS, + G_TYPE_STRING, + G_TYPE_STRING, + G_TYPE_BOOLEAN); + + foreach_slist(list_item, commit_message_history) + { + display_message_string = g_string_new(list_item->data); + /* replace line breaks */ + utils_string_replace_all(display_message_string, "\n", " "); + /* shorten commit message */ + if (display_message_string->len > 80) + { + g_string_truncate(display_message_string, 80); + g_string_append(display_message_string, "..."); + } + display_message = g_string_free(display_message_string, FALSE); + + /* by _prepend() we reverse the list order for display on purpose: + * most recent item should be on top */ + gtk_list_store_prepend(store, &iter); + gtk_list_store_set(store, &iter, + COMMIT_MESSAGE_HISTORY_DISPLAY_TEXT, display_message, + COMMIT_MESSAGE_HISTORY_FULL_TEXT, list_item->data, + COMMIT_MESSAGE_HISTORY_ACTIVE, TRUE, -1); + + g_free(display_message); + } + + gtk_list_store_prepend(store, &iter); + gtk_list_store_set(store, &iter, + COMMIT_MESSAGE_HISTORY_DISPLAY_TEXT, _("Choose a previous commit message"), + COMMIT_MESSAGE_HISTORY_FULL_TEXT, NULL, + COMMIT_MESSAGE_HISTORY_ACTIVE, FALSE, -1); + + gtk_combo_box_set_model(GTK_COMBO_BOX(combobox), GTK_TREE_MODEL(store)); + gtk_combo_box_set_active(GTK_COMBO_BOX(combobox), 0); + g_object_unref(store); + + gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combobox), renderer, TRUE); + gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combobox), renderer, + "text", COMMIT_MESSAGE_HISTORY_DISPLAY_TEXT, + "sensitive", COMMIT_MESSAGE_HISTORY_ACTIVE, NULL); + + return combobox; +} + static gboolean commit_text_line_number_update_cb(GtkWidget *widget, GdkEvent *event, gpointer user_data) { @@ -1363,6 +1457,7 @@ create_commitDialog(void) GtkWidget *bottom_vbox; GtkWidget *commit_text_vbox; GtkWidget *lineColumnLabel; + GtkWidget *commitMessageHistoryComboBox; GtkTreeSelection *sel; gchar *rcstyle = g_strdup_printf("style \"geanyvc-diff-font\"\n" @@ -1476,6 +1571,11 @@ create_commitDialog(void) gtk_box_pack_end(GTK_BOX(commit_text_vbox), lineColumnLabel, FALSE, TRUE, 0); gtk_widget_show(lineColumnLabel); + /* last commit message dropdown */ + commitMessageHistoryComboBox = create_commit_message_history_combobox(); + gtk_box_pack_end(GTK_BOX(commit_text_vbox), commitMessageHistoryComboBox, FALSE, TRUE, 0); + gtk_widget_show(commitMessageHistoryComboBox); + dialog_action_area1 = gtk_dialog_get_action_area(GTK_DIALOG(commitDialog)); gtk_widget_show(dialog_action_area1); gtk_button_box_set_layout(GTK_BUTTON_BOX(dialog_action_area1), GTK_BUTTONBOX_END); @@ -1496,6 +1596,8 @@ create_commitDialog(void) G_CALLBACK(commit_text_line_number_update_cb), lineColumnLabel); g_signal_connect(textCommitMessage, "button-release-event", G_CALLBACK(commit_text_line_number_update_cb), lineColumnLabel); + g_signal_connect(commitMessageHistoryComboBox, "changed", + G_CALLBACK(commit_message_update_cb), textCommitMessage); /* initial setup */ commit_text_line_number_update_cb(textCommitMessage, NULL, lineColumnLabel); @@ -1521,6 +1623,29 @@ create_commitDialog(void) return commitDialog; } +static void +add_commit_message_to_history(const gchar *commit_message) +{ + GSList *list_item = NULL; + gchar *message = g_strdup(commit_message); + + /* add commit message to the history */ + commit_message_history = g_slist_append(commit_message_history, (gpointer)message); + + /* House keeping: keep only a maximum of COMMIT_MESSAGE_HISTORY_LENGTH items and delete the rest + * We remove the first element from the list as often as the list is too long. + * While the loop is not the most efficient way, it should be ok since the list never has + * much more than 10 items */ + while (g_slist_length(commit_message_history) > COMMIT_MESSAGE_HISTORY_LENGTH) + { + list_item = commit_message_history; /* remember the element to delete */ + commit_message_history = list_item->next; /* start the list with the next item */ + /* delete the current item and its data */ + list_item->next = NULL; + g_slist_free_full(list_item, g_free); + } +} + static void vccommit_activated(G_GNUC_UNUSED GtkMenuItem * menuitem, G_GNUC_UNUSED gpointer gdata) { @@ -1630,6 +1755,7 @@ vccommit_activated(G_GNUC_UNUSED GtkMenuItem * menuitem, G_GNUC_UNUSED gpointer gtk_text_buffer_get_start_iter(mbuf, &begin); gtk_text_buffer_get_end_iter(mbuf, &end); message = gtk_text_buffer_get_text(mbuf, &begin, &end, FALSE); + add_commit_message_to_history(message); gtk_tree_model_foreach(model, get_commit_files_foreach, &selected_files); if (!EMPTY(message) && selected_files) { @@ -1795,6 +1921,8 @@ widgets; static void save_config(void) { + GSList *list_item = NULL; + gint list_item_count = 0; GKeyFile *config = g_key_file_new(); gchar *config_dir = g_path_get_dirname(config_file); @@ -1827,6 +1955,16 @@ save_config(void) "commit_dialog_height", commit_dialog_height); } + g_key_file_remove_group(config, "CommitMessageHistory", NULL); /* cleanup */ + foreach_slist(list_item, commit_message_history) + { + gchar *key = g_strdup_printf("message_%d", list_item_count); + g_key_file_set_string(config, "CommitMessageHistory", key, list_item->data); + g_free(key); + + list_item_count++; + } + if (!g_file_test(config_dir, G_FILE_TEST_IS_DIR) && utils_mkdir(config_dir, TRUE) != 0) { @@ -2009,6 +2147,8 @@ load_config(void) GError *error = NULL; #endif + gchar **commit_message_history_keys, **ptr; + gchar *commit_message; GKeyFile *config = g_key_file_new(); g_key_file_load_from_file(config, config_file, G_KEY_FILE_NONE, NULL); @@ -2054,6 +2194,18 @@ load_config(void) commit_dialog_height = utils_get_setting_integer(config, "CommitDialog", "commit_dialog_height", 500); + commit_message_history_keys = g_key_file_get_keys(config,"CommitMessageHistory", NULL, NULL); + if (commit_message_history_keys != NULL) + { + foreach_strv(ptr, commit_message_history_keys) + { + commit_message = g_key_file_get_string(config, "CommitMessageHistory", *ptr, NULL); + /* do not free the newly allocated commit_message string as we need it later in the list, + * will be finally freed when cleaning up the commit_message_history list */ + commit_message_history = g_slist_append(commit_message_history, commit_message); + } + g_strfreev(commit_message_history_keys); + } g_key_file_free(config); } @@ -2408,5 +2560,6 @@ plugin_cleanup(void) gtk_widget_destroy(menu_entry); g_slist_free(VC); VC = NULL; + g_slist_free_full(commit_message_history, g_free); g_free(config_file); } -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
[geany/geany-plugins] 1b8717: GeanyVC: Add a commit message history
by Enrico Tröger
28 Mar '19
28 Mar '19
Branch: refs/heads/master Author: Enrico Tröger <enrico.troeger(a)uvena.de> Committer: Enrico Tröger <enrico.troeger(a)uvena.de> Date: Thu, 28 Mar 2019 09:55:20 UTC Commit: 1b87179e2b785b8ae2edf9b2ecdafc4696a9e82f
https://github.com/geany/geany-plugins/commit/1b87179e2b785b8ae2edf9b2ecdaf…
Log Message: ----------- GeanyVC: Add a commit message history Remember the last 10 commit messages and offer a dropdown in the commit dialog to choose one of the last commit messages. Modified Paths: -------------- geanyvc/src/geanyvc.c Modified: geanyvc/src/geanyvc.c 153 lines changed, 153 insertions(+), 0 deletions(-) =================================================================== @@ -84,6 +84,7 @@ static gboolean set_editor_menu_entries; static gboolean set_menubar_entry; static gint commit_dialog_width = 0; static gint commit_dialog_height = 0; +static GSList *commit_message_history = NULL; static gchar *config_file; @@ -155,6 +156,15 @@ enum COUNT_KB }; +enum +{ + COMMIT_MESSAGE_HISTORY_DISPLAY_TEXT = 0, + COMMIT_MESSAGE_HISTORY_FULL_TEXT, + COMMIT_MESSAGE_HISTORY_ACTIVE, + COMMIT_MESSAGE_HISTORY_NUM_COLUMNS +}; +#define COMMIT_MESSAGE_HISTORY_LENGTH 10 + GSList *get_commit_files_null(G_GNUC_UNUSED const gchar * dir) { @@ -1319,6 +1329,90 @@ static void commit_tree_selection_changed_cb(GtkTreeSelection *sel, GtkTextView g_free(path); } +static void commit_message_update_cb(GtkWidget *widget, gpointer user_data) +{ + GtkTreeIter iter; + + if (gtk_combo_box_get_active_iter(GTK_COMBO_BOX(widget), &iter)) + { + gchar *commit_message; + GtkTreeModel *model = gtk_combo_box_get_model(GTK_COMBO_BOX(widget)); + gboolean active = FALSE; + + gtk_tree_model_get(model, &iter, + COMMIT_MESSAGE_HISTORY_FULL_TEXT, &commit_message, + COMMIT_MESSAGE_HISTORY_ACTIVE, &active, -1); + + if (active) + { + GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(user_data)); + gtk_text_buffer_set_text(buffer, commit_message, -1); + } + g_free(commit_message); + } +} + +static GtkWidget * +create_commit_message_history_combobox(void) +{ + GtkWidget *combobox; + GtkCellRenderer *renderer; + GtkTreeIter iter; + GtkListStore *store; + GSList *list_item; + GString *display_message_string; + gchar *display_message; + + combobox = gtk_combo_box_new(); + renderer = gtk_cell_renderer_text_new(); + store = gtk_list_store_new( + COMMIT_MESSAGE_HISTORY_NUM_COLUMNS, + G_TYPE_STRING, + G_TYPE_STRING, + G_TYPE_BOOLEAN); + + foreach_slist(list_item, commit_message_history) + { + display_message_string = g_string_new(list_item->data); + /* replace line breaks */ + utils_string_replace_all(display_message_string, "\n", " "); + /* shorten commit message */ + if (display_message_string->len > 80) + { + g_string_truncate(display_message_string, 80); + g_string_append(display_message_string, "..."); + } + display_message = g_string_free(display_message_string, FALSE); + + /* by _prepend() we reverse the list order for display on purpose: + * most recent item should be on top */ + gtk_list_store_prepend(store, &iter); + gtk_list_store_set(store, &iter, + COMMIT_MESSAGE_HISTORY_DISPLAY_TEXT, display_message, + COMMIT_MESSAGE_HISTORY_FULL_TEXT, list_item->data, + COMMIT_MESSAGE_HISTORY_ACTIVE, TRUE, -1); + + g_free(display_message); + } + + gtk_list_store_prepend(store, &iter); + gtk_list_store_set(store, &iter, + COMMIT_MESSAGE_HISTORY_DISPLAY_TEXT, _("Choose a previous commit message"), + COMMIT_MESSAGE_HISTORY_FULL_TEXT, NULL, + COMMIT_MESSAGE_HISTORY_ACTIVE, FALSE, -1); + + gtk_combo_box_set_model(GTK_COMBO_BOX(combobox), GTK_TREE_MODEL(store)); + gtk_combo_box_set_active(GTK_COMBO_BOX(combobox), 0); + g_object_unref(store); + + gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combobox), renderer, TRUE); + gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combobox), renderer, + "text", COMMIT_MESSAGE_HISTORY_DISPLAY_TEXT, + "sensitive", COMMIT_MESSAGE_HISTORY_ACTIVE, NULL); + + return combobox; +} + static gboolean commit_text_line_number_update_cb(GtkWidget *widget, GdkEvent *event, gpointer user_data) { @@ -1363,6 +1457,7 @@ create_commitDialog(void) GtkWidget *bottom_vbox; GtkWidget *commit_text_vbox; GtkWidget *lineColumnLabel; + GtkWidget *commitMessageHistoryComboBox; GtkTreeSelection *sel; gchar *rcstyle = g_strdup_printf("style \"geanyvc-diff-font\"\n" @@ -1476,6 +1571,11 @@ create_commitDialog(void) gtk_box_pack_end(GTK_BOX(commit_text_vbox), lineColumnLabel, FALSE, TRUE, 0); gtk_widget_show(lineColumnLabel); + /* last commit message dropdown */ + commitMessageHistoryComboBox = create_commit_message_history_combobox(); + gtk_box_pack_end(GTK_BOX(commit_text_vbox), commitMessageHistoryComboBox, FALSE, TRUE, 0); + gtk_widget_show(commitMessageHistoryComboBox); + dialog_action_area1 = gtk_dialog_get_action_area(GTK_DIALOG(commitDialog)); gtk_widget_show(dialog_action_area1); gtk_button_box_set_layout(GTK_BUTTON_BOX(dialog_action_area1), GTK_BUTTONBOX_END); @@ -1496,6 +1596,8 @@ create_commitDialog(void) G_CALLBACK(commit_text_line_number_update_cb), lineColumnLabel); g_signal_connect(textCommitMessage, "button-release-event", G_CALLBACK(commit_text_line_number_update_cb), lineColumnLabel); + g_signal_connect(commitMessageHistoryComboBox, "changed", + G_CALLBACK(commit_message_update_cb), textCommitMessage); /* initial setup */ commit_text_line_number_update_cb(textCommitMessage, NULL, lineColumnLabel); @@ -1521,6 +1623,29 @@ create_commitDialog(void) return commitDialog; } +static void +add_commit_message_to_history(const gchar *commit_message) +{ + GSList *list_item = NULL; + gchar *message = g_strdup(commit_message); + + /* add commit message to the history */ + commit_message_history = g_slist_append(commit_message_history, (gpointer)message); + + /* House keeping: keep only a maximum of COMMIT_MESSAGE_HISTORY_LENGTH items and delete the rest + * We remove the first element from the list as often as the list is too long. + * While the loop is not the most efficient way, it should be ok since the list never has + * much more than 10 items */ + while (g_slist_length(commit_message_history) > COMMIT_MESSAGE_HISTORY_LENGTH) + { + list_item = commit_message_history; /* remember the element to delete */ + commit_message_history = list_item->next; /* start the list with the next item */ + /* delete the current item and its data */ + list_item->next = NULL; + g_slist_free_full(list_item, g_free); + } +} + static void vccommit_activated(G_GNUC_UNUSED GtkMenuItem * menuitem, G_GNUC_UNUSED gpointer gdata) { @@ -1630,6 +1755,7 @@ vccommit_activated(G_GNUC_UNUSED GtkMenuItem * menuitem, G_GNUC_UNUSED gpointer gtk_text_buffer_get_start_iter(mbuf, &begin); gtk_text_buffer_get_end_iter(mbuf, &end); message = gtk_text_buffer_get_text(mbuf, &begin, &end, FALSE); + add_commit_message_to_history(message); gtk_tree_model_foreach(model, get_commit_files_foreach, &selected_files); if (!EMPTY(message) && selected_files) { @@ -1795,6 +1921,8 @@ widgets; static void save_config(void) { + GSList *list_item = NULL; + gint list_item_count = 0; GKeyFile *config = g_key_file_new(); gchar *config_dir = g_path_get_dirname(config_file); @@ -1827,6 +1955,16 @@ save_config(void) "commit_dialog_height", commit_dialog_height); } + g_key_file_remove_group(config, "CommitMessageHistory", NULL); /* cleanup */ + foreach_slist(list_item, commit_message_history) + { + gchar *key = g_strdup_printf("message_%d", list_item_count); + g_key_file_set_string(config, "CommitMessageHistory", key, list_item->data); + g_free(key); + + list_item_count++; + } + if (!g_file_test(config_dir, G_FILE_TEST_IS_DIR) && utils_mkdir(config_dir, TRUE) != 0) { @@ -2009,6 +2147,8 @@ load_config(void) GError *error = NULL; #endif + gchar **commit_message_history_keys, **ptr; + gchar *commit_message; GKeyFile *config = g_key_file_new(); g_key_file_load_from_file(config, config_file, G_KEY_FILE_NONE, NULL); @@ -2054,6 +2194,18 @@ load_config(void) commit_dialog_height = utils_get_setting_integer(config, "CommitDialog", "commit_dialog_height", 500); + commit_message_history_keys = g_key_file_get_keys(config,"CommitMessageHistory", NULL, NULL); + if (commit_message_history_keys != NULL) + { + foreach_strv(ptr, commit_message_history_keys) + { + commit_message = g_key_file_get_string(config, "CommitMessageHistory", *ptr, NULL); + /* do not free the newly allocated commit_message string as we need it later in the list, + * will be finally freed when cleaning up the commit_message_history list */ + commit_message_history = g_slist_append(commit_message_history, commit_message); + } + g_strfreev(commit_message_history_keys); + } g_key_file_free(config); } @@ -2408,5 +2560,6 @@ plugin_cleanup(void) gtk_widget_destroy(menu_entry); g_slist_free(VC); VC = NULL; + g_slist_free_full(commit_message_history, g_free); g_free(config_file); } -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
[geany/geany-plugins] 47e165: vimode: Fix repeated commands like 10dd not working
by Jiří Techet
24 Mar '19
24 Mar '19
Branch: refs/heads/master Author: Jiří Techet <techet(a)gmail.com> Committer: Jiří Techet <techet(a)gmail.com> Date: Sat, 09 Feb 2019 23:17:54 UTC Commit: 47e16587e6f6d7bc0193d5dc3f17bc8f594b833b
https://github.com/geany/geany-plugins/commit/47e16587e6f6d7bc0193d5dc3f17b…
Log Message: ----------- vimode: Fix repeated commands like 10dd not working By last-minute mistake made before the initial plugin release, none of the repeat commands worked because numbers were removed from the key press list. This patch fixes that issue. This is what happens when the author of the plugin actually doesn't use what he has created. Modified Paths: -------------- vimode/src/cmd-runner.c vimode/src/vi.c Modified: vimode/src/cmd-runner.c 22 lines changed, 17 insertions(+), 5 deletions(-) =================================================================== @@ -428,6 +428,18 @@ static gboolean is_cmdpart(GSList *kpl, CmdDef *cmds) } +static gboolean is_printable(GSList *kpl) +{ + guint mask = GDK_MODIFIER_MASK & ~(GDK_SHIFT_MASK | GDK_LOCK_MASK); + KeyPress *kp = g_slist_nth_data(kpl, 0); + + if (kp->modif & mask) + return FALSE; + + return g_unichar_isprint(gdk_keyval_to_unicode(kp->key)); +} + + static CmdDef *get_cmd_to_run(GSList *kpl, CmdDef *cmds, gboolean have_selection) { gint i; @@ -609,7 +621,7 @@ static gboolean perform_repeat_cmd(CmdContext *ctx) } -static gboolean process_cmd(CmdDef *cmds, CmdContext *ctx) +static gboolean process_cmd(CmdDef *cmds, CmdContext *ctx, gboolean ins_mode) { gboolean consumed; gboolean performed = FALSE; @@ -618,7 +630,7 @@ static gboolean process_cmd(CmdDef *cmds, CmdContext *ctx) SSM(ctx->sci, SCI_GETSELECTIONEND, 0, 0) - SSM(ctx->sci, SCI_GETSELECTIONSTART, 0, 0) > 0; CmdDef *def = get_cmd_to_run(ctx->kpl, cmds, have_selection); - consumed = is_cmdpart(ctx->kpl, cmds); + consumed = is_cmdpart(ctx->kpl, cmds) || (!ins_mode && is_printable(ctx->kpl)); if (def) { @@ -667,17 +679,17 @@ static gboolean process_cmd(CmdDef *cmds, CmdContext *ctx) gboolean cmd_perform_cmd(CmdContext *ctx) { - return process_cmd(cmd_mode_cmds, ctx); + return process_cmd(cmd_mode_cmds, ctx, FALSE); } gboolean cmd_perform_vis(CmdContext *ctx) { - return process_cmd(vis_mode_cmds, ctx); + return process_cmd(vis_mode_cmds, ctx, FALSE); } gboolean cmd_perform_ins(CmdContext *ctx) { - return process_cmd(ins_mode_cmds, ctx); + return process_cmd(ins_mode_cmds, ctx, TRUE); } Modified: vimode/src/vi.c 12 lines changed, 0 insertions(+), 12 deletions(-) =================================================================== @@ -210,17 +210,6 @@ void vi_set_active_sci(ScintillaObject *sci) } -static gboolean is_printable(GdkEventKey *ev) -{ - guint mask = GDK_MODIFIER_MASK & ~(GDK_SHIFT_MASK | GDK_LOCK_MASK); - - if (ev->state & mask) - return FALSE; - - return g_unichar_isprint(gdk_keyval_to_unicode(ev->keyval)); -} - - gboolean vi_notify_key_press(GdkEventKey *event) { ScintillaObject *sci = ctx.sci; @@ -244,7 +233,6 @@ gboolean vi_notify_key_press(GdkEventKey *event) consumed = cmd_perform_cmd(&ctx); else consumed = cmd_perform_vis(&ctx); - consumed = consumed || is_printable(event); } else //insert, replace mode { -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
[geany/geany-plugins] 55a25b: Merge pull request #820 from techee/vi_fix
by Frank Lanitz
24 Mar '19
24 Mar '19
Branch: refs/heads/master Author: Frank Lanitz <frank(a)frank.uvena.de> Committer: GitHub <noreply(a)github.com> Date: Sun, 24 Mar 2019 18:17:36 UTC Commit: 55a25bbc71a58310e86dfc0a94e123c01564388f
https://github.com/geany/geany-plugins/commit/55a25bbc71a58310e86dfc0a94e12…
Log Message: ----------- Merge pull request #820 from techee/vi_fix vimode: Fix repeated commands like 10dd not working Modified Paths: -------------- vimode/src/cmd-runner.c vimode/src/vi.c Modified: vimode/src/cmd-runner.c 22 lines changed, 17 insertions(+), 5 deletions(-) =================================================================== @@ -428,6 +428,18 @@ static gboolean is_cmdpart(GSList *kpl, CmdDef *cmds) } +static gboolean is_printable(GSList *kpl) +{ + guint mask = GDK_MODIFIER_MASK & ~(GDK_SHIFT_MASK | GDK_LOCK_MASK); + KeyPress *kp = g_slist_nth_data(kpl, 0); + + if (kp->modif & mask) + return FALSE; + + return g_unichar_isprint(gdk_keyval_to_unicode(kp->key)); +} + + static CmdDef *get_cmd_to_run(GSList *kpl, CmdDef *cmds, gboolean have_selection) { gint i; @@ -609,7 +621,7 @@ static gboolean perform_repeat_cmd(CmdContext *ctx) } -static gboolean process_cmd(CmdDef *cmds, CmdContext *ctx) +static gboolean process_cmd(CmdDef *cmds, CmdContext *ctx, gboolean ins_mode) { gboolean consumed; gboolean performed = FALSE; @@ -618,7 +630,7 @@ static gboolean process_cmd(CmdDef *cmds, CmdContext *ctx) SSM(ctx->sci, SCI_GETSELECTIONEND, 0, 0) - SSM(ctx->sci, SCI_GETSELECTIONSTART, 0, 0) > 0; CmdDef *def = get_cmd_to_run(ctx->kpl, cmds, have_selection); - consumed = is_cmdpart(ctx->kpl, cmds); + consumed = is_cmdpart(ctx->kpl, cmds) || (!ins_mode && is_printable(ctx->kpl)); if (def) { @@ -667,17 +679,17 @@ static gboolean process_cmd(CmdDef *cmds, CmdContext *ctx) gboolean cmd_perform_cmd(CmdContext *ctx) { - return process_cmd(cmd_mode_cmds, ctx); + return process_cmd(cmd_mode_cmds, ctx, FALSE); } gboolean cmd_perform_vis(CmdContext *ctx) { - return process_cmd(vis_mode_cmds, ctx); + return process_cmd(vis_mode_cmds, ctx, FALSE); } gboolean cmd_perform_ins(CmdContext *ctx) { - return process_cmd(ins_mode_cmds, ctx); + return process_cmd(ins_mode_cmds, ctx, TRUE); } Modified: vimode/src/vi.c 12 lines changed, 0 insertions(+), 12 deletions(-) =================================================================== @@ -210,17 +210,6 @@ void vi_set_active_sci(ScintillaObject *sci) } -static gboolean is_printable(GdkEventKey *ev) -{ - guint mask = GDK_MODIFIER_MASK & ~(GDK_SHIFT_MASK | GDK_LOCK_MASK); - - if (ev->state & mask) - return FALSE; - - return g_unichar_isprint(gdk_keyval_to_unicode(ev->keyval)); -} - - gboolean vi_notify_key_press(GdkEventKey *event) { ScintillaObject *sci = ctx.sci; @@ -244,7 +233,6 @@ gboolean vi_notify_key_press(GdkEventKey *event) consumed = cmd_perform_cmd(&ctx); else consumed = cmd_perform_vis(&ctx); - consumed = consumed || is_printable(event); } else //insert, replace mode { -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
[geany/geany-plugins] 426e6a: geanyctags: use new plugin API
by LarsDW223
24 Mar '19
24 Mar '19
Branch: refs/heads/master Author: LarsDW223 <lars_paulsen(a)web.de> Committer: LarsDW223 <lars_paulsen(a)web.de> Date: Sat, 24 Feb 2018 16:28:26 UTC Commit: 426e6a6040139e5af5a6fa5bb81354883a15ff93
https://github.com/geany/geany-plugins/commit/426e6a6040139e5af5a6fa5bb8135…
Log Message: ----------- geanyctags: use new plugin API Modified Paths: -------------- geanyctags/src/geanyctags.c Modified: geanyctags/src/geanyctags.c 56 lines changed, 40 insertions(+), 16 deletions(-) =================================================================== @@ -46,15 +46,8 @@ #endif -PLUGIN_VERSION_CHECK(226) -PLUGIN_SET_TRANSLATABLE_INFO(LOCALEDIR, GETTEXT_PACKAGE, - "GeanyCtags", - _("Ctags generation and search plugin for geany projects"), - VERSION, - "Jiri Techet <techet(a)gmail.com>") - -GeanyPlugin *geany_plugin; -GeanyData *geany_data; +static GeanyPlugin *geany_plugin = NULL; +static GeanyData *geany_data = NULL; static GtkWidget *s_context_fdec_item, *s_context_fdef_item, *s_context_sep_item, @@ -103,16 +96,16 @@ static void on_project_save(G_GNUC_UNUSED GObject * obj, GKeyFile * config, G_GN set_widgets_sensitive(TRUE); } -PluginCallback plugin_callbacks[] = { +static PluginCallback plugin_geanyctags_callbacks[] = { {"project-open", (GCallback) & on_project_open, TRUE, NULL}, {"project-close", (GCallback) & on_project_close, TRUE, NULL}, {"project-save", (GCallback) & on_project_save, TRUE, NULL}, {NULL, NULL, FALSE, NULL} }; -void plugin_help (void) +static void plugin_geanyctags_help (G_GNUC_UNUSED GeanyPlugin *plugin, G_GNUC_UNUSED gpointer pdata) { - utils_open_browser("
http://plugins.geany.org/geanyctags.html
"); + utils_open_browser("
https://plugins.geany.org/geanyctags.html
"); } static void spawn_cmd(const gchar *cmd, const gchar *dir) @@ -622,10 +615,15 @@ static gboolean kb_callback(guint key_id) return FALSE; } -void plugin_init(G_GNUC_UNUSED GeanyData * data) +static gboolean plugin_geanyctags_init(GeanyPlugin *plugin, G_GNUC_UNUSED gpointer pdata) { - GeanyKeyGroup *key_group = plugin_set_key_group(geany_plugin, "GeanyCtags", KB_COUNT, kb_callback); - + GeanyKeyGroup *key_group; + + geany_plugin = plugin; + geany_data = plugin->geany_data; + + key_group = plugin_set_key_group(geany_plugin, "GeanyCtags", KB_COUNT, kb_callback); + s_context_sep_item = gtk_separator_menu_item_new(); gtk_widget_show(s_context_sep_item); gtk_menu_shell_prepend(GTK_MENU_SHELL(geany->main_widgets->editor_menu), s_context_sep_item); @@ -659,9 +657,11 @@ void plugin_init(G_GNUC_UNUSED GeanyData * data) 0, 0, "find_tag", _("Find tag"), s_ft_item); set_widgets_sensitive(geany_data->app->project != NULL); + + return TRUE; } -void plugin_cleanup(void) +static void plugin_geanyctags_cleanup(G_GNUC_UNUSED GeanyPlugin *plugin, G_GNUC_UNUSED gpointer pdata) { gtk_widget_destroy(s_context_fdec_item); gtk_widget_destroy(s_context_fdef_item); @@ -675,3 +675,27 @@ void plugin_cleanup(void) gtk_widget_destroy(s_ft_dialog.widget); s_ft_dialog.widget = NULL; } + + +/* Load module */ +G_MODULE_EXPORT +void geany_load_module(GeanyPlugin *plugin) +{ + /* Setup translation */ + main_locale_init(LOCALEDIR, GETTEXT_PACKAGE); + + /* Set metadata */ + plugin->info->name = "GeanyCtags"; + plugin->info->description = _("Ctags generation and search plugin for geany projects"); + plugin->info->version = VERSION; + plugin->info->author = "Jiri Techet <techet(a)gmail.com>"; + + /* Set functions */ + plugin->funcs->init = plugin_geanyctags_init; + plugin->funcs->cleanup = plugin_geanyctags_cleanup; + plugin->funcs->help = plugin_geanyctags_help; + plugin->funcs->callbacks = plugin_geanyctags_callbacks; + + /* Register! */ + GEANY_PLUGIN_REGISTER(plugin, 226); +} -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
[geany/geany-plugins] 065484: Merge pull request #708 from LarsGit223/geanyctags-newapi
by Frank Lanitz
24 Mar '19
24 Mar '19
Branch: refs/heads/master Author: Frank Lanitz <frank(a)frank.uvena.de> Committer: GitHub <noreply(a)github.com> Date: Sun, 24 Mar 2019 17:45:53 UTC Commit: 0654842df581b416b1fa3f51fb3cd3431428b6f5
https://github.com/geany/geany-plugins/commit/0654842df581b416b1fa3f51fb3cd…
Log Message: ----------- Merge pull request #708 from LarsGit223/geanyctags-newapi geanyctags: use new plugin API Modified Paths: -------------- geanyctags/src/geanyctags.c Modified: geanyctags/src/geanyctags.c 56 lines changed, 40 insertions(+), 16 deletions(-) =================================================================== @@ -46,15 +46,8 @@ #endif -PLUGIN_VERSION_CHECK(226) -PLUGIN_SET_TRANSLATABLE_INFO(LOCALEDIR, GETTEXT_PACKAGE, - "GeanyCtags", - _("Ctags generation and search plugin for geany projects"), - VERSION, - "Jiri Techet <techet(a)gmail.com>") - -GeanyPlugin *geany_plugin; -GeanyData *geany_data; +static GeanyPlugin *geany_plugin = NULL; +static GeanyData *geany_data = NULL; static GtkWidget *s_context_fdec_item, *s_context_fdef_item, *s_context_sep_item, @@ -103,16 +96,16 @@ static void on_project_save(G_GNUC_UNUSED GObject * obj, GKeyFile * config, G_GN set_widgets_sensitive(TRUE); } -PluginCallback plugin_callbacks[] = { +static PluginCallback plugin_geanyctags_callbacks[] = { {"project-open", (GCallback) & on_project_open, TRUE, NULL}, {"project-close", (GCallback) & on_project_close, TRUE, NULL}, {"project-save", (GCallback) & on_project_save, TRUE, NULL}, {NULL, NULL, FALSE, NULL} }; -void plugin_help (void) +static void plugin_geanyctags_help (G_GNUC_UNUSED GeanyPlugin *plugin, G_GNUC_UNUSED gpointer pdata) { - utils_open_browser("
http://plugins.geany.org/geanyctags.html
"); + utils_open_browser("
https://plugins.geany.org/geanyctags.html
"); } static void spawn_cmd(const gchar *cmd, const gchar *dir) @@ -647,10 +640,15 @@ static gboolean kb_callback(guint key_id) return FALSE; } -void plugin_init(G_GNUC_UNUSED GeanyData * data) +static gboolean plugin_geanyctags_init(GeanyPlugin *plugin, G_GNUC_UNUSED gpointer pdata) { - GeanyKeyGroup *key_group = plugin_set_key_group(geany_plugin, "GeanyCtags", KB_COUNT, kb_callback); - + GeanyKeyGroup *key_group; + + geany_plugin = plugin; + geany_data = plugin->geany_data; + + key_group = plugin_set_key_group(geany_plugin, "GeanyCtags", KB_COUNT, kb_callback); + s_context_sep_item = gtk_separator_menu_item_new(); gtk_widget_show(s_context_sep_item); gtk_menu_shell_prepend(GTK_MENU_SHELL(geany->main_widgets->editor_menu), s_context_sep_item); @@ -684,9 +682,11 @@ void plugin_init(G_GNUC_UNUSED GeanyData * data) 0, 0, "find_tag", _("Find tag"), s_ft_item); set_widgets_sensitive(geany_data->app->project != NULL); + + return TRUE; } -void plugin_cleanup(void) +static void plugin_geanyctags_cleanup(G_GNUC_UNUSED GeanyPlugin *plugin, G_GNUC_UNUSED gpointer pdata) { gtk_widget_destroy(s_context_fdec_item); gtk_widget_destroy(s_context_fdef_item); @@ -700,3 +700,27 @@ void plugin_cleanup(void) gtk_widget_destroy(s_ft_dialog.widget); s_ft_dialog.widget = NULL; } + + +/* Load module */ +G_MODULE_EXPORT +void geany_load_module(GeanyPlugin *plugin) +{ + /* Setup translation */ + main_locale_init(LOCALEDIR, GETTEXT_PACKAGE); + + /* Set metadata */ + plugin->info->name = "GeanyCtags"; + plugin->info->description = _("Ctags generation and search plugin for geany projects"); + plugin->info->version = VERSION; + plugin->info->author = "Jiri Techet <techet(a)gmail.com>"; + + /* Set functions */ + plugin->funcs->init = plugin_geanyctags_init; + plugin->funcs->cleanup = plugin_geanyctags_cleanup; + plugin->funcs->help = plugin_geanyctags_help; + plugin->funcs->callbacks = plugin_geanyctags_callbacks; + + /* Register! */ + GEANY_PLUGIN_REGISTER(plugin, 226); +} -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
[geany/geany-plugins] 86f2b4: Update copyright years in Windows installer
by Enrico Tröger
19 Mar '19
19 Mar '19
Branch: refs/heads/master Author: Enrico Tröger <enrico.troeger(a)uvena.de> Committer: Enrico Tröger <enrico.troeger(a)uvena.de> Date: Tue, 19 Mar 2019 10:34:13 UTC Commit: 86f2b468c7af6580ec82680bf766ac52b628a8c6
https://github.com/geany/geany-plugins/commit/86f2b468c7af6580ec82680bf766a…
Log Message: ----------- Update copyright years in Windows installer Modified Paths: -------------- build/geany-plugins.nsi Modified: build/geany-plugins.nsi 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -48,7 +48,7 @@ VIProductVersion "${PRODUCT_VERSION_ID}" VIAddVersionKey "ProductName" "${PRODUCT_NAME}" VIAddVersionKey "FileVersion" "${PRODUCT_VERSION}" VIAddVersionKey "ProductVersion" "${PRODUCT_VERSION}" -VIAddVersionKey "LegalCopyright" "Copyright 2009-2017 by the Geany developer team" +VIAddVersionKey "LegalCopyright" "Copyright 2009-2019 by the Geany developer team" VIAddVersionKey "FileDescription" "${PRODUCT_NAME} Installer" BrandingText "$(^NAME) installer (NSIS 2.51)" -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
← Newer
1
2
Older →
Jump to page:
1
2
Results per page:
10
25
50
100
200