Branch: refs/heads/master Author: Frank Lanitz frank@frank.uvena.de Committer: GitHub noreply@github.com Date: Sat, 20 Jan 2018 16:55:49 UTC Commit: 44b12b520a2bcd573eeca352d865714a0f2707a0 https://github.com/geany/geany-plugins/commit/44b12b520a2bcd573eeca352d86571...
Log Message: ----------- Merge pull request #679 from eht16/geanyvc_commit_dialog_size
GeanyVC: Remember the commit dialog size
Modified Paths: -------------- geanyvc/src/geanyvc.c
Modified: geanyvc/src/geanyvc.c 111 lines changed, 68 insertions(+), 43 deletions(-) =================================================================== @@ -82,6 +82,8 @@ static gboolean set_maximize_commit_dialog; static gboolean set_external_diff; static gboolean set_editor_menu_entries; static gboolean set_menubar_entry; +static gint commit_dialog_width = 0; +static gint commit_dialog_height = 0;
static gchar *config_file;
@@ -1598,6 +1600,8 @@ vccommit_activated(G_GNUC_UNUSED GtkMenuItem * menuitem, G_GNUC_UNUSED gpointer else { gtk_widget_set_size_request(commit, 700, 500); + gtk_window_set_default_size(GTK_WINDOW(commit), + commit_dialog_width, commit_dialog_height); }
gtk_widget_show_now(commit); @@ -1635,6 +1639,9 @@ vccommit_activated(G_GNUC_UNUSED GtkMenuItem * menuitem, G_GNUC_UNUSED gpointer } g_free(message); } + /* remember commit dialog widget size */ + gtk_window_get_size(GTK_WINDOW(commit), + &commit_dialog_width, &commit_dialog_height);
gtk_widget_destroy(commit); free_commit_list(lst); @@ -1785,16 +1792,66 @@ static struct } widgets;
+static void +save_config(void) +{ + GKeyFile *config = g_key_file_new(); + gchar *config_dir = g_path_get_dirname(config_file); + + g_key_file_load_from_file(config, config_file, G_KEY_FILE_NONE, NULL); + + g_key_file_set_boolean(config, "VC", "set_changed_flag", set_changed_flag); + g_key_file_set_boolean(config, "VC", "set_add_confirmation", set_add_confirmation); + g_key_file_set_boolean(config, "VC", "set_external_diff", set_external_diff); + g_key_file_set_boolean(config, "VC", "set_maximize_commit_dialog", + set_maximize_commit_dialog); + g_key_file_set_boolean(config, "VC", "set_editor_menu_entries", set_editor_menu_entries); + g_key_file_set_boolean(config, "VC", "attach_to_menubar", set_menubar_entry); + + g_key_file_set_boolean(config, "VC", "enable_cvs", enable_cvs); + g_key_file_set_boolean(config, "VC", "enable_git", enable_git); + g_key_file_set_boolean(config, "VC", "enable_svn", enable_svn); + g_key_file_set_boolean(config, "VC", "enable_svk", enable_svk); + g_key_file_set_boolean(config, "VC", "enable_bzr", enable_bzr); + g_key_file_set_boolean(config, "VC", "enable_hg", enable_hg); + +#ifdef USE_GTKSPELL + g_key_file_set_string(config, "VC", "spellchecking_language", lang); +#endif + + if (commit_dialog_width > 0 && commit_dialog_height > 0) + { + g_key_file_set_integer(config, "CommitDialog", + "commit_dialog_width", commit_dialog_width); + g_key_file_set_integer(config, "CommitDialog", + "commit_dialog_height", commit_dialog_height); + } + + if (!g_file_test(config_dir, G_FILE_TEST_IS_DIR) + && utils_mkdir(config_dir, TRUE) != 0) + { + dialogs_show_msgbox(GTK_MESSAGE_ERROR, + _ + ("Plugin configuration directory could not be created.")); + } + else + { + /* write config to file */ + gchar *data = g_key_file_to_data(config, NULL, NULL); + utils_write_file(config_file, data); + g_free(data); + } + + g_free(config_dir); + g_key_file_free(config); +} + static void on_configure_response(G_GNUC_UNUSED GtkDialog * dialog, gint response, G_GNUC_UNUSED gpointer user_data) { if (response == GTK_RESPONSE_OK || response == GTK_RESPONSE_APPLY) { - GKeyFile *config = g_key_file_new(); - gchar *data; - gchar *config_dir = g_path_get_dirname(config_file); - set_changed_flag = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets.cb_changed_flag)); set_add_confirmation = @@ -1822,51 +1879,13 @@ on_configure_response(G_GNUC_UNUSED GtkDialog * dialog, gint response, lang = g_strdup(gtk_entry_get_text(GTK_ENTRY(widgets.spellcheck_lang_textbox))); #endif
- g_key_file_load_from_file(config, config_file, G_KEY_FILE_NONE, NULL); - - g_key_file_set_boolean(config, "VC", "set_changed_flag", set_changed_flag); - g_key_file_set_boolean(config, "VC", "set_add_confirmation", set_add_confirmation); - g_key_file_set_boolean(config, "VC", "set_external_diff", set_external_diff); - g_key_file_set_boolean(config, "VC", "set_maximize_commit_dialog", - set_maximize_commit_dialog); - g_key_file_set_boolean(config, "VC", "set_editor_menu_entries", set_editor_menu_entries); - g_key_file_set_boolean(config, "VC", "attach_to_menubar", set_menubar_entry); - - g_key_file_set_boolean(config, "VC", "enable_cvs", enable_cvs); - g_key_file_set_boolean(config, "VC", "enable_git", enable_git); - g_key_file_set_boolean(config, "VC", "enable_svn", enable_svn); - g_key_file_set_boolean(config, "VC", "enable_svk", enable_svk); - g_key_file_set_boolean(config, "VC", "enable_bzr", enable_bzr); - g_key_file_set_boolean(config, "VC", "enable_hg", enable_hg); - -#ifdef USE_GTKSPELL - g_key_file_set_string(config, "VC", "spellchecking_language", lang); -#endif - - if (!g_file_test(config_dir, G_FILE_TEST_IS_DIR) - && utils_mkdir(config_dir, TRUE) != 0) - { - dialogs_show_msgbox(GTK_MESSAGE_ERROR, - _ - ("Plugin configuration directory could not be created.")); - } - else - { - /* write config to file */ - data = g_key_file_to_data(config, NULL, NULL); - utils_write_file(config_file, data); - g_free(data); - } + save_config();
if (set_editor_menu_entries == FALSE) remove_menuitems_from_editor_menu(); else add_menuitems_to_editor_menu();
- - g_free(config_dir); - g_key_file_free(config); - registrate(); } } @@ -2030,6 +2049,11 @@ load_config(void) } #endif
+ commit_dialog_width = utils_get_setting_integer(config, "CommitDialog", + "commit_dialog_width", 700); + commit_dialog_height = utils_get_setting_integer(config, "CommitDialog", + "commit_dialog_height", 500); + g_key_file_free(config); }
@@ -2378,6 +2402,7 @@ plugin_init(G_GNUC_UNUSED GeanyData * data) void plugin_cleanup(void) { + save_config(); external_diff_viewer_deinit(); remove_menuitems_from_editor_menu(); gtk_widget_destroy(menu_entry);
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).