Revision: 61 http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=61&view=rev Author: eht16 Date: 2008-06-03 09:20:48 -0700 (Tue, 03 Jun 2008)
Log Message: ----------- Compilation fixes. Add html target
Modified Paths: -------------- trunk/spellcheck/ChangeLog trunk/spellcheck/Makefile.am trunk/spellcheck/src/spellcheck.c
Modified: trunk/spellcheck/ChangeLog =================================================================== --- trunk/spellcheck/ChangeLog 2008-06-03 16:09:07 UTC (rev 60) +++ trunk/spellcheck/ChangeLog 2008-06-03 16:20:48 UTC (rev 61) @@ -1,3 +1,11 @@ +2008-06-03 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de> + + * src/spellcheck.c: + Compilation fixes. + * Makefile.am: + Add html target. + + 2008-05-20 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
* src/spellcheck.c:
Modified: trunk/spellcheck/Makefile.am =================================================================== --- trunk/spellcheck/Makefile.am 2008-06-03 16:09:07 UTC (rev 60) +++ trunk/spellcheck/Makefile.am 2008-06-03 16:20:48 UTC (rev 61) @@ -16,3 +16,5 @@ if test -f $(PACKAGE)-$(VERSION).tar.bz2; then \ gpg --detach-sign --digest-algo SHA512 $(PACKAGE)-$(VERSION).tar.bz2; fi
+html: + rst2html README index.html
Modified: trunk/spellcheck/src/spellcheck.c =================================================================== --- trunk/spellcheck/src/spellcheck.c 2008-06-03 16:09:07 UTC (rev 60) +++ trunk/spellcheck/src/spellcheck.c 2008-06-03 16:20:48 UTC (rev 61) @@ -26,7 +26,7 @@ #include "geany.h" #include "support.h"
-#if HAVE_LOCALE_H +#ifdef HAVE_LOCALE_H # include <locale.h> #endif
@@ -34,6 +34,7 @@ # include <windows.h> #endif
+#include <string.h> #include <aspell.h>
#include "plugindata.h" @@ -43,17 +44,18 @@ #include "msgwindow.h" #include "keybindings.h" #include "utils.h" +#include "ui_utils.h"
#include "pluginmacros.h"
PluginFields *plugin_fields; GeanyData *geany_data; -GeanyFunctions *geany_functions; +GeanyFunctions *geany_functions;
-PLUGIN_VERSION_CHECK(58) -PLUGIN_INFO(_("Spell Check"), _("Checks the spelling of the current document."), "0.2", +PLUGIN_VERSION_CHECK(67) +PLUGIN_SET_INFO(_("Spell Check"), _("Checks the spelling of the current document."), "0.2", _("The Geany developer team"))
@@ -128,12 +130,12 @@ return 1;
str = g_string_sized_new(1024); - if (p_sci->can_copy(doc_list[idx].sci)) + if (p_sci->can_copy(documents[idx]->sci)) { first_line = p_sci->get_line_from_position( - doc_list[idx].sci, p_sci->get_selection_start(doc_list[idx].sci)); + documents[idx]->sci, p_sci->get_selection_start(documents[idx]->sci)); last_line = p_sci->get_line_from_position( - doc_list[idx].sci, p_sci->get_selection_end(doc_list[idx].sci)); + documents[idx]->sci, p_sci->get_selection_end(documents[idx]->sci));
p_msgwindow->msg_add(COLOR_BLUE, -1, -1, _("Checking file "%s" (lines %d to %d):"), @@ -142,7 +144,7 @@ else { first_line = 0; - last_line = p_sci->get_line_count(doc_list[idx].sci); + last_line = p_sci->get_line_count(documents[idx]->sci); p_msgwindow->msg_add(COLOR_BLUE, -1, -1, _("Checking file "%s":"), DOC_FILENAME(idx)); } @@ -159,7 +161,7 @@
for (i = first_line; i < last_line; i++) { - line = p_sci->get_line(doc_list[idx].sci, i); + line = p_sci->get_line(documents[idx]->sci, i); linewidth = strlen(line);
/* First process the line */ @@ -250,7 +252,7 @@ #ifdef ENABLE_NLS gchar *locale_dir = NULL;
-#if HAVE_LOCALE_H +#ifdef HAVE_LOCALE_H setlocale(LC_ALL, ""); #endif
@@ -314,8 +316,40 @@ }
-void init(GeanyData *data) +static void on_configure_response(GtkDialog *dialog, gint response, 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); + + setptr(language, gtk_combo_box_get_active_text(GTK_COMBO_BOX( + g_object_get_data(G_OBJECT(dialog), "combo")))); + + g_key_file_load_from_file(config, config_file, G_KEY_FILE_NONE, NULL); + g_key_file_set_string(config, "spellcheck", "language", language); + + if (! g_file_test(config_dir, G_FILE_TEST_IS_DIR) && p_utils->mkdir(config_dir, TRUE) != 0) + { + p_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); + p_utils->write_file(config_file, data); + g_free(data); + } + g_free(config_dir); + g_key_file_free(config); + } +} + + +void plugin_init(GeanyData *data) +{ GtkWidget *sp_item; GKeyFile *config = g_key_file_new();
@@ -330,7 +364,7 @@
sp_item = gtk_menu_item_new_with_mnemonic(_("_Spell Check")); gtk_widget_show(sp_item); - gtk_container_add(GTK_CONTAINER(geany_data->tools_menu), sp_item); + gtk_container_add(GTK_CONTAINER(main_widgets->tools_menu), sp_item); g_signal_connect(G_OBJECT(sp_item), "activate", G_CALLBACK(item_activate), NULL);
plugin_fields->menu_item = sp_item; @@ -342,16 +376,11 @@ }
-void configure(GtkWidget *parent) +GtkWidget *plugin_configure(GtkDialog *dialog) { - GtkWidget *dialog, *label, *vbox, *combo; + GtkWidget *label, *vbox, *combo;
- dialog = gtk_dialog_new_with_buttons(_("Spell Check"), - GTK_WINDOW(parent), GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL); - vbox = p_ui->dialog_vbox_new(GTK_DIALOG(dialog)); - gtk_widget_set_name(dialog, "GeanyDialog"); - gtk_box_set_spacing(GTK_BOX(vbox), 6); + vbox = gtk_vbox_new(FALSE, 6);
label = gtk_label_new(_("Language to use for the spell check:")); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); @@ -363,40 +392,16 @@ gtk_combo_box_set_wrap_width(GTK_COMBO_BOX(combo), 3); gtk_box_pack_start(GTK_BOX(vbox), combo, FALSE, FALSE, 0);
+ g_object_set_data(G_OBJECT(dialog), "combo", combo); + g_signal_connect(dialog, "response", G_CALLBACK(on_configure_response), NULL); + gtk_widget_show_all(vbox);
- /* run the dialog and check for the response code */ - if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) - { - GKeyFile *config = g_key_file_new(); - gchar *data; - gchar *config_dir = g_path_get_dirname(config_file); - - setptr(language, gtk_combo_box_get_active_text(GTK_COMBO_BOX(combo))); - - g_key_file_load_from_file(config, config_file, G_KEY_FILE_NONE, NULL); - g_key_file_set_string(config, "spellcheck", "language", language); - - if (! g_file_test(config_dir, G_FILE_TEST_IS_DIR) && p_utils->mkdir(config_dir, TRUE) != 0) - { - p_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); - p_utils->write_file(config_file, data); - g_free(data); - } - g_free(config_dir); - g_key_file_free(config); - } - gtk_widget_destroy(dialog); + return vbox; }
-void cleanup(void) +void plugin_cleanup(void) { g_free(language); g_free(config_file);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
plugins-commits@lists.geany.org