Revision: 1140 http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=1140&view=re... Author: yurand Date: 2010-01-27 06:13:39 +0000 (Wed, 27 Jan 2010)
Log Message: ----------- change the API usage of GeanyDoc to fix compilation with the SVN version of Geany
patch from Enrico Tr?\195?\182ger
Modified Paths: -------------- trunk/geany-plugins/geanydoc/src/config.c trunk/geany-plugins/geanydoc/src/geanydoc.c
Modified: trunk/geany-plugins/geanydoc/src/config.c =================================================================== --- trunk/geany-plugins/geanydoc/src/config.c 2010-01-24 22:28:33 UTC (rev 1139) +++ trunk/geany-plugins/geanydoc/src/config.c 2010-01-27 06:13:39 UTC (rev 1140) @@ -24,14 +24,7 @@
#include <string.h>
-#include "geany.h" -#include "support.h" -#include "plugindata.h" -#include "document.h" -#include "filetypes.h" -#include "utils.h" -#include "project.h" -#include "pluginmacros.h" +#include "geanyplugin.h"
#include "geanydoc.h"
@@ -66,7 +59,7 @@ config_init() { config_file = g_build_filename(geany->app->configdir, "plugins", "geanydoc", NULL); - p_utils->mkdir(config_file, TRUE); + utils_mkdir(config_file, TRUE);
setptr(config_file, g_build_filename(config_file, "geanydoc.conf", NULL));
@@ -107,7 +100,7 @@ config = cfg;
data = g_key_file_to_data(config, NULL, NULL); - p_utils->write_file(config_file, data); + utils_write_file(config_file, data); g_free(data); }
@@ -116,17 +109,17 @@ { gchar *ret, *tmp; gchar *key = g_strdup_printf("command%d", cmd_num); - ret = p_utils->get_setting_string(config, lang, key, ""); + ret = utils_get_setting_string(config, lang, key, ""); g_free(key); if (!NZV(ret)) return ret; key = g_strdup_printf("command%d", cmd_num + 1); - tmp = p_utils->get_setting_string(config, lang, key, ""); + tmp = utils_get_setting_string(config, lang, key, ""); g_free(key); if (NZV(tmp)) *intern = TRUE; else - *intern = p_utils->get_setting_boolean(config, lang, "internal", FALSE); + *intern = utils_get_setting_boolean(config, lang, "internal", FALSE); g_free(tmp); return ret; }
Modified: trunk/geany-plugins/geanydoc/src/geanydoc.c =================================================================== --- trunk/geany-plugins/geanydoc/src/geanydoc.c 2010-01-24 22:28:33 UTC (rev 1139) +++ trunk/geany-plugins/geanydoc/src/geanydoc.c 2010-01-27 06:13:39 UTC (rev 1140) @@ -29,22 +29,9 @@ #include "config.h" #endif
-#include "geany.h" /* for the GeanyApp data type */ -#include "keybindings.h" -#include "support.h" /* for the _() translation macro (see also po/POTFILES.in) */ -#include "document.h" -#include "editor.h" -#include "filetypes.h" -#include "ui_utils.h" -#include "utils.h" +#include "geanyplugin.h"
-#include "plugindata.h" /* this defines the plugin API */ -#include "pluginmacros.h" /* some useful macros to avoid typing geany_data so often */
-#ifdef HAVE_LOCALE_H -# include <locale.h> -#endif - #include "geanydoc.h"
/* These items are set by Geany before init() is called. */ @@ -101,23 +88,23 @@ gchar c; gint text_len;
- doc = p_document->get_current(); + doc = document_get_current(); g_return_val_if_fail(doc != NULL && doc->file_name != NULL, NULL);
- text_len = p_sci->get_selected_text_length(doc->editor->sci); + text_len = sci_get_selected_text_length(doc->editor->sci); if (text_len > 1) { txt = g_malloc(text_len + 1); - p_sci->get_selected_text(doc->editor->sci, txt); + sci_get_selected_text(doc->editor->sci, txt); return txt; }
- pos = p_sci->get_current_position(doc->editor->sci); + pos = sci_get_current_position(doc->editor->sci); if (pos > 0) pos--;
cstart = pos; - c = p_sci->get_char_at(doc->editor->sci, cstart); + c = sci_get_char_at(doc->editor->sci, cstart);
if (!word_check_left(c)) return NULL; @@ -126,25 +113,25 @@ { cstart--; if (cstart >= 0) - c = p_sci->get_char_at(doc->editor->sci, cstart); + c = sci_get_char_at(doc->editor->sci, cstart); else break; } cstart++;
cend = pos; - c = p_sci->get_char_at(doc->editor->sci, cend); - while (word_check_right(c) && cend < p_sci->get_length(doc->editor->sci)) + c = sci_get_char_at(doc->editor->sci, cend); + while (word_check_right(c) && cend < sci_get_length(doc->editor->sci)) { cend++; - c = p_sci->get_char_at(doc->editor->sci, cend); + c = sci_get_char_at(doc->editor->sci, cend); }
if (cstart == cend) return NULL; txt = g_malloc0(cend - cstart + 1);
- p_sci->get_text_range(doc->editor->sci, cstart, cend, txt); + sci_get_text_range(doc->editor->sci, cstart, cend, txt); return txt; }
@@ -159,28 +146,28 @@
if (std_output) { - cur_doc = p_document->get_current(); - doc = p_document->find_by_filename(name); + cur_doc = document_get_current(); + doc = document_find_by_filename(name); if (doc == NULL) { - doc = p_document->new_file(name, - filetypes_array->pdata[filetype_new_file], + doc = document_new_file(name, + filetypes[filetype_new_file], std_output); } else { - p_sci->set_text(doc->editor->sci, std_output); + sci_set_text(doc->editor->sci, std_output); book = GTK_NOTEBOOK(geany->main_widgets->notebook); page = gtk_notebook_page_num(book, GTK_WIDGET(doc->editor->sci)); gtk_notebook_set_current_page(book, page); } - p_document->set_text_changed(doc, FALSE); - p_document->set_encoding(doc, (force_encoding ? force_encoding : "UTF-8")); - p_navqueue->goto_line(cur_doc, p_document->get_current(), 1); + document_set_text_changed(doc, FALSE); + document_set_encoding(doc, (force_encoding ? force_encoding : "UTF-8")); + navqueue_goto_line(cur_doc, document_get_current(), 1); } else { - p_ui->set_statusbar(FALSE, _("Could not parse the output of command")); + ui_set_statusbar(FALSE, _("Could not parse the output of command")); } }
@@ -193,7 +180,7 @@ gchar *tmp; gboolean intern;
- doc = p_document->get_current(); + doc = document_get_current(); g_return_if_fail(doc != NULL && doc->file_name != NULL);
ftype = doc->file_type->name; @@ -254,7 +241,7 @@ /* run the dialog and check for the response code */ if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) { - entry = p_support->lookup_widget(dialog, "entry_word"); + entry = ui_lookup_widget(dialog, "entry_word"); word = g_strdup(gtk_entry_get_text(GTK_ENTRY(entry))); } gtk_widget_destroy(dialog); @@ -270,9 +257,9 @@ on_comboboxType_changed(GtkComboBox * combobox, G_GNUC_UNUSED gpointer user_data) { gchar *from, *to; - GtkWidget *cmd0 = p_support->lookup_widget(GTK_WIDGET(combobox), "entryCommand0"); - GtkWidget *cmd1 = p_support->lookup_widget(GTK_WIDGET(combobox), "entryCommand1"); - GtkWidget *intern = p_support->lookup_widget(GTK_WIDGET(combobox), "cbIntern"); + GtkWidget *cmd0 = ui_lookup_widget(GTK_WIDGET(combobox), "entryCommand0"); + GtkWidget *cmd1 = ui_lookup_widget(GTK_WIDGET(combobox), "entryCommand1"); + GtkWidget *intern = ui_lookup_widget(GTK_WIDGET(combobox), "cbIntern");
gchar *cmd0_txt = (gchar *) gtk_entry_get_text(GTK_ENTRY(cmd0)); gchar *cmd1_txt = (gchar *) gtk_entry_get_text(GTK_ENTRY(cmd1)); @@ -297,9 +284,9 @@ } g_object_set_data(G_OBJECT(combobox), "current", g_strdup(to));
- cmd0_txt = p_utils->get_setting_string(config, to, "command0", ""); - cmd1_txt = p_utils->get_setting_string(config, to, "command1", ""); - intern_b = p_utils->get_setting_boolean(config, to, "internal", FALSE); + cmd0_txt = utils_get_setting_string(config, to, "command0", ""); + cmd1_txt = utils_get_setting_string(config, to, "command1", ""); + intern_b = utils_get_setting_boolean(config, to, "internal", FALSE);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(intern), intern_b); gtk_entry_set_text(GTK_ENTRY(cmd0), cmd0_txt); @@ -449,7 +436,7 @@ gchar *kb_label1; gchar *kb_label2;
- p_main->locale_init(LOCALEDIR, GETTEXT_PACKAGE); + main_locale_init(LOCALEDIR, GETTEXT_PACKAGE); kb_label1 = _("Document current word"); kb_label2 = _("Document interactive");
@@ -458,9 +445,9 @@ keyb1 = gtk_menu_item_new(); keyb2 = gtk_menu_item_new();
- p_keybindings->set_item(plugin_key_group, KB_DOCUMENT_WORD, kb_doc, + keybindings_set_item(plugin_key_group, KB_DOCUMENT_WORD, kb_doc, 0, 0, kb_label1, kb_label1, keyb1); - p_keybindings->set_item(plugin_key_group, KB_DOCUMENT_WORD_ASK, kb_doc_ask, + keybindings_set_item(plugin_key_group, KB_DOCUMENT_WORD_ASK, kb_doc_ask, 0, 0, kb_label2, kb_label2, keyb2); }
@@ -470,13 +457,13 @@ guint i; GtkWidget *cbTypes;
- cbTypes = p_support->lookup_widget(dialog, "comboboxType"); + cbTypes = ui_lookup_widget(dialog, "comboboxType"); g_object_set(cbTypes, "wrap-width", 3, NULL);
- for (i = 0; i < filetypes_array->len; i++) + for (i = 0; i < geany->filetypes_array->len; i++) { gtk_combo_box_append_text(GTK_COMBO_BOX(cbTypes), - ((struct GeanyFiletype *) (filetypes_array->pdata[i]))-> + ((struct GeanyFiletype *) (filetypes[i]))-> name); } g_object_set_data(G_OBJECT(cbTypes), "config", config_clone()); @@ -497,7 +484,7 @@ dialog = create_Configure(); init_Configure(dialog);
- cbTypes = p_support->lookup_widget(dialog, "comboboxType"); + cbTypes = ui_lookup_widget(dialog, "comboboxType");
/* run the dialog and check for the response code */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.