Kaydet (Commit) f813a6a7 authored tarafından Nick Treleaven's avatar Nick Treleaven

Add ui_lookup_widget() to plugin API (so genapi.py has a suitable

prefix).
Mark SupportFuncs as deprecated.
Add description comment for geanyfunctions.h.



git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@3307 ea778897-0a13-0410-b9d1-a72fbfd435f5
üst 80a89396
......@@ -12,6 +12,12 @@
Add header guards for geanyfunctions.h and include pluginmacros.h
temporarily.
Update Demo plugin.
* src/ui_utils.h, src/plugindata.h, src/plugins.c, src/ui_utils.c,
plugins/geanyfunctions.h, plugins/genapi.py:
Add ui_lookup_widget() to plugin API (so genapi.py has a suitable
prefix).
Mark SupportFuncs as deprecated.
Add description comment for geanyfunctions.h.
2008-12-01 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
......
/* @file geanyfunctions.h @ref geany_functions wrappers.
This allows the use of normal API function names in plugins. */
#ifndef GEANY_FUNCTIONS_H
#define GEANY_FUNCTIONS_H
......@@ -169,6 +172,8 @@
p_ui->widget_set_tooltip_text
#define ui_image_menu_item_new \
p_ui->image_menu_item_new
#define ui_lookup_widget \
p_ui->lookup_widget
#define dialogs_show_question \
p_dialogs->show_question
#define dialogs_show_msgbox \
......
......@@ -63,6 +63,8 @@ if __name__ == "__main__":
sys.exit("No function names read!")
f = open(outfile, 'w')
print >>f, '/* @file %s @ref geany_functions wrappers. \n' % (outfile) +\
'This allows the use of normal API function names in plugins. */\n'
print >>f, '#ifndef GEANY_FUNCTIONS_H'
print >>f, '#define GEANY_FUNCTIONS_H\n'
print >>f, '#include "pluginmacros.h"\n'
......
......@@ -45,7 +45,7 @@
enum {
/** The Application Programming Interface (API) version, incremented
* whenever any plugin data types are modified or appended to. */
GEANY_API_VERSION = 112,
GEANY_API_VERSION = 113,
/** The Application Binary Interface (ABI) version, incremented whenever
* existing fields in the plugin data types have to be changed or reordered. */
......@@ -202,7 +202,8 @@ typedef struct GeanyFunctions
struct TemplateFuncs *p_templates; /**< See templates.h */
struct UtilsFuncs *p_utils; /**< See utils.h */
struct UIUtilsFuncs *p_ui; /**< See ui_utils.h */
struct SupportFuncs *p_support; /**< See support.h */
/** @deprecated Use ui_lookup_widget() instead. */
struct SupportFuncs *p_support;
struct DialogFuncs *p_dialogs; /**< See dialogs.h */
struct MsgWinFuncs *p_msgwindow; /**< See msgwindow.h */
struct EncodingFuncs *p_encodings; /**< See encodings.h */
......@@ -361,6 +362,7 @@ typedef struct UIUtilsFuncs
void (*add_document_sensitive) (GtkWidget *widget);
void (*widget_set_tooltip_text) (GtkWidget *widget, const gchar *text);
GtkWidget* (*image_menu_item_new) (const gchar *stock_id, const gchar *label);
GtkWidget* (*lookup_widget) (GtkWidget *widget, const gchar *widget_name);
}
UIUtilsFuncs;
......@@ -375,7 +377,7 @@ typedef struct DialogFuncs
DialogFuncs;
/* See support.h */
/* @deprecated Use ui_lookup_widget() instead. */
typedef struct SupportFuncs
{
GtkWidget* (*lookup_widget) (GtkWidget *widget, const gchar *widget_name);
......
......@@ -209,7 +209,8 @@ static UIUtilsFuncs uiutils_funcs = {
&ui_button_new_with_image,
&ui_add_document_sensitive,
&ui_widget_set_tooltip_text,
&ui_image_menu_item_new
&ui_image_menu_item_new,
&ui_lookup_widget
};
static DialogFuncs dialog_funcs = {
......@@ -218,6 +219,7 @@ static DialogFuncs dialog_funcs = {
&dialogs_show_save_as
};
/* deprecated */
static SupportFuncs support_funcs = {
&lookup_widget
};
......
......@@ -1754,3 +1754,17 @@ void ui_widget_set_tooltip_text(GtkWidget *widget, const gchar *text)
gtk_tooltips_set_tip(tooltips, widget, text, NULL);
#endif
}
/* needed because lookup_widget doesn't have a suitable API prefix */
/** This function returns a widget in a component created by Glade.
* Call it with the toplevel widget in the component (i.e. a window/dialog),
* or alternatively any widget in the component, and the name of the widget
* you want returned.
* @param widget Widget with the @a widget_name property set.
* @param widget_name Name to lookup.
* @return The widget found. */
GtkWidget *ui_lookup_widget(GtkWidget *widget, const gchar *widget_name)
{
return lookup_widget(widget, widget_name);
}
......@@ -167,6 +167,10 @@ void ui_table_add_row(GtkTable *table, gint row, ...) G_GNUC_NULL_TERMINATED;
void ui_auto_separator_add_ref(GeanyAutoSeparator *autosep, GtkWidget *item);
void ui_widget_set_tooltip_text(GtkWidget *widget, const gchar *text);
GtkWidget *ui_lookup_widget(GtkWidget *widget, const gchar *widget_name);
/* End of 'generic' functions */
......@@ -254,6 +258,4 @@ gint ui_get_toolbar_insert_position(void);
void ui_add_document_sensitive(GtkWidget *widget);
void ui_widget_set_tooltip_text(GtkWidget *widget, const gchar *text);
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment