[geany/geany-plugins] f4fa09: pretty-printer: Drop use of the most obvious deprecated Geany API

Colomban Wendling git-noreply at xxxxx
Thu Jun 9 13:09:17 UTC 2016


Branch:      refs/heads/master
Author:      Colomban Wendling <ban at herbesfolles.org>
Committer:   Colomban Wendling <ban at herbesfolles.org>
Date:        Sat, 20 Feb 2016 19:04:47 UTC
Commit:      f4fa093b5adc7d4e3b601ebf7c639c80607365ba
             https://github.com/geany/geany-plugins/commit/f4fa093b5adc7d4e3b601ebf7c639c80607365ba

Log Message:
-----------
pretty-printer: Drop use of the most obvious deprecated Geany API


Modified Paths:
--------------
    pretty-printer/src/PluginEntry.c

Modified: pretty-printer/src/PluginEntry.c
14 lines changed, 6 insertions(+), 8 deletions(-)
===================================================================
@@ -37,7 +37,6 @@ PLUGIN_SET_TRANSLATABLE_INFO(
     _("XML PrettyPrinter"),
     _("Formats an XML and makes it human-readable."),
     PRETTY_PRINTER_VERSION, "Cédric Tabin - http://www.astorm.ch")
-PLUGIN_KEY_GROUP(prettyprinter, 1)
 
 /*========================================== DECLARATIONS ================================================================*/
 
@@ -52,6 +51,8 @@ static void config_closed(GtkWidget* configWidget, gint response, gpointer data)
 
 void plugin_init(GeanyData *data)
 {
+    GeanyKeyGroup *key_group;
+
     /* initializes the libxml2 */
     LIBXML_TEST_VERSION
 
@@ -66,7 +67,8 @@ void plugin_init(GeanyData *data)
     gtk_container_add(GTK_CONTAINER(geany->main_widgets->tools_menu), main_menu_item);
 
     /* init keybindings */
-    keybindings_set_item(plugin_key_group, 0, kb_run_xml_pretty_print,
+    key_group = plugin_set_key_group(geany_plugin, "prettyprinter", 1, NULL);
+    keybindings_set_item(key_group, 0, kb_run_xml_pretty_print,
                          0, 0, "run_pretty_printer_xml", _("Run the PrettyPrinter XML"),
                          main_menu_item);
 
@@ -128,13 +130,9 @@ void xml_format(GtkMenuItem* menuitem, gpointer gdata)
     /* default printing options */
     if (prettyPrintingOptions == NULL) { prettyPrintingOptions = createDefaultPrettyPrintingOptions(); }
 
-    /* prepare the buffer that will contain the text
-     * from the scintilla object */
-    input_length = sci_get_length(sco)+1;
-    input_buffer = (char*)g_malloc(input_length*sizeof(char));
-
     /* retrieves the text */
-    sci_get_text(sco, input_length, input_buffer);
+    input_length = sci_get_length(sco)+1;
+    input_buffer = sci_get_contents(sco, input_length);
 
     /* checks if the data is an XML format */
     parsedDocument = xmlParseDoc((unsigned char*)buffer);



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Plugins-Commits mailing list