From ad8695db96b90045e0470172373d40f42456b29b Mon Sep 17 00:00:00 2001 From: Frank Lanitz Date: Mon, 16 Jun 2008 21:04:49 +0200 Subject: [PATCH] Make plugin work together with API version 68 of Geany (arround svn r 2696) --- geanylatex.c | 53 +++++++++++++++++++++++++++++------------------------ 1 file changed, 29 insertions(+), 24 deletions(-) diff --git a/geanylatex.c b/geanylatex.c index 0caa043..97f6816 100644 --- a/geanylatex.c +++ b/geanylatex.c @@ -23,14 +23,16 @@ /* This plugin improves the work with LaTeX and Geany.*/ #include "geany.h" -#include "prefs.h" -#include "document.h" #include "support.h" #include "plugindata.h" +#include "document.h" #include "filetypes.h" -#include "encodings.h" -#include "pluginmacros.h" +#include "templates.h" +#include "utils.h" +#include "ui_utils.h" #include "keybindings.h" +#include "prefs.h" +#include "pluginmacros.h" #include "datatypes.h" #include "letters.h" @@ -38,11 +40,14 @@ typedef void (*SubMenuCallback) (G_GNUC_UNUSED GtkMenuItem * menuitem, G_GNUC_UNUSED gpointer gdata); -PluginFields *plugin_fields; -GeanyData *geany_data; +PluginInfo *plugin_info; +PluginFields *plugin_fields; +GeanyData *geany_data; +GeanyFunctions *geany_functions; + -PLUGIN_VERSION_CHECK(50) -PLUGIN_INFO(_("LaTeX"), _("Plugin to make Geany better support LaTeX"), "0.2-git", +PLUGIN_VERSION_CHECK(68) +PLUGIN_SET_INFO(_("LaTeX"), _("Plugin to make Geany better support LaTeX"), "0.2-git", "Frank Lanitz ") GtkWidget *menu_latex = NULL; @@ -90,8 +95,8 @@ insert_string(gchar *string) gint idx = p_document->get_cur_idx(); if (DOC_IDX_VALID(idx)) { - gint pos = p_sci->get_current_position(doc_list[idx].sci); - p_sci->insert_text(doc_list[idx].sci, pos, string); + gint pos = p_sci->get_current_position(documents[idx]->sci); + p_sci->insert_text(documents[idx]->sci, pos, string); } } @@ -118,7 +123,7 @@ insert_label_activated(G_GNUC_UNUSED GtkMenuItem * menuitem, G_GNUC_UNUSED gpoin GtkWidget *table = NULL; dialog = gtk_dialog_new_with_buttons(_("Insert label"), - GTK_WINDOW(app->window), + GTK_WINDOW(main_widgets->window), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL); @@ -162,7 +167,7 @@ insert_ref_activated(G_GNUC_UNUSED GtkMenuItem * menuitem, G_GNUC_UNUSED gpointe GtkWidget *radio2 = NULL; dialog = gtk_dialog_new_with_buttons(_("Insert reference"), - GTK_WINDOW(app->window), + GTK_WINDOW(main_widgets->window), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL); @@ -386,11 +391,12 @@ static void show_output(const gchar * output, const gchar * name, const gint local_enc) { gint idx; - + GeanyFiletype *ft = p_filetypes->lookup_by_name("LaTeX"); + if (output) { - idx = p_document->new_file(name, geany_data->filetypes[GEANY_FILETYPES_LATEX], output); - p_document->set_encoding(idx, p_encoding->get_charset_from_index(latex_encodings[local_enc].geany_enc)); + idx = p_document->new_file(name, ft, output); + p_document->set_encoding(idx, p_encodings->get_charset_from_index(latex_encodings[local_enc].geany_enc)); } } @@ -473,7 +479,7 @@ wizard_activated(G_GNUC_UNUSED GtkMenuItem * menuitem, G_GNUC_UNUSED gpointer gd latex_encodings[i].name); } - gtk_combo_box_set_active(GTK_COMBO_BOX(encoding_combobox), find_latex_enc(prefs->default_new_encoding)); + gtk_combo_box_set_active(GTK_COMBO_BOX(encoding_combobox), find_latex_enc(geany_data->file_prefs->default_new_encoding)); gtk_misc_set_alignment(GTK_MISC(label_encoding), 0, 0.5); @@ -501,9 +507,9 @@ wizard_activated(G_GNUC_UNUSED GtkMenuItem * menuitem, G_GNUC_UNUSED gpointer gd author_textbox = gtk_entry_new(); gtk_tooltips_set_tip(tooltip, author_textbox, _("Sets the entry of \\author command. In most cases here should stay your name"), NULL); - if (prefs->template_developer != NULL) + if (geany_data->template_prefs->developer != NULL) { - author = prefs->template_developer; + author = geany_data->template_prefs->developer; gtk_entry_set_text(GTK_ENTRY(author_textbox), author); } gtk_misc_set_alignment(GTK_MISC(label_author), 0, 0.5); @@ -549,7 +555,7 @@ wizard_activated(G_GNUC_UNUSED GtkMenuItem * menuitem, G_GNUC_UNUSED gpointer gd // Buidling the wizard-dialog and showing it dialog = gtk_dialog_new_with_buttons(_("LaTeX-Wizard"), - GTK_WINDOW(app->window), + GTK_WINDOW(main_widgets->window), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL); @@ -751,7 +757,7 @@ wizard_activated(G_GNUC_UNUSED GtkMenuItem * menuitem, G_GNUC_UNUSED gpointer gd static void update_menu_items() { - document *doc; + GeanyDocument *doc = NULL; gboolean have_file; doc = p_document->get_current(); @@ -790,7 +796,7 @@ static void kbwizard(G_GNUC_UNUSED guint key_id) } void -init(G_GNUC_UNUSED GeanyData * data) +plugin_init(G_GNUC_UNUSED GeanyData * data) { GtkTooltips *tooltips = NULL; @@ -803,7 +809,7 @@ init(G_GNUC_UNUSED GeanyData * data) tooltips = gtk_tooltips_new(); menu_latex = gtk_menu_item_new_with_mnemonic(_("_LaTeX")); - gtk_container_add(GTK_CONTAINER(geany_data->tools_menu), menu_latex); + gtk_container_add(GTK_CONTAINER(main_widgets->tools_menu), menu_latex); g_signal_connect((gpointer) menu_latex, "activate", G_CALLBACK(update_menu_items), NULL); menu_latex_menu = gtk_menu_new(); @@ -849,9 +855,8 @@ init(G_GNUC_UNUSED GeanyData * data) plugin_fields->menu_item = menu_latex; } - void -cleanup() +plugin_cleanup() { gtk_widget_destroy(plugin_fields->menu_item); } -- 2.11.4.GIT