SF.net SVN: geany:[3307] trunk

ntrel at users.sourceforge.net ntrel at xxxxx
Tue Dec 2 18:33:41 UTC 2008


Revision: 3307
          http://geany.svn.sourceforge.net/geany/?rev=3307&view=rev
Author:   ntrel
Date:     2008-12-02 18:33:41 +0000 (Tue, 02 Dec 2008)

Log Message:
-----------
Add ui_lookup_widget() to plugin API (so genapi.py has a suitable
prefix).
Mark SupportFuncs as deprecated.
Add description comment for geanyfunctions.h.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/plugins/geanyfunctions.h
    trunk/plugins/genapi.py
    trunk/src/plugindata.h
    trunk/src/plugins.c
    trunk/src/ui_utils.c
    trunk/src/ui_utils.h

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2008-12-02 17:05:50 UTC (rev 3306)
+++ trunk/ChangeLog	2008-12-02 18:33:41 UTC (rev 3307)
@@ -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>

Modified: trunk/plugins/geanyfunctions.h
===================================================================
--- trunk/plugins/geanyfunctions.h	2008-12-02 17:05:50 UTC (rev 3306)
+++ trunk/plugins/geanyfunctions.h	2008-12-02 18:33:41 UTC (rev 3307)
@@ -1,3 +1,6 @@
+/* @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 \

Modified: trunk/plugins/genapi.py
===================================================================
--- trunk/plugins/genapi.py	2008-12-02 17:05:50 UTC (rev 3306)
+++ trunk/plugins/genapi.py	2008-12-02 18:33:41 UTC (rev 3307)
@@ -63,6 +63,8 @@
 		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'

Modified: trunk/src/plugindata.h
===================================================================
--- trunk/src/plugindata.h	2008-12-02 17:05:50 UTC (rev 3306)
+++ trunk/src/plugindata.h	2008-12-02 18:33:41 UTC (rev 3307)
@@ -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 @@
 	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 @@
 	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 @@
 DialogFuncs;
 
 
-/* See support.h */
+/* @deprecated Use ui_lookup_widget() instead. */
 typedef struct SupportFuncs
 {
 	GtkWidget*	(*lookup_widget) (GtkWidget *widget, const gchar *widget_name);

Modified: trunk/src/plugins.c
===================================================================
--- trunk/src/plugins.c	2008-12-02 17:05:50 UTC (rev 3306)
+++ trunk/src/plugins.c	2008-12-02 18:33:41 UTC (rev 3307)
@@ -209,7 +209,8 @@
 	&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 @@
 	&dialogs_show_save_as
 };
 
+/* deprecated */
 static SupportFuncs support_funcs = {
 	&lookup_widget
 };

Modified: trunk/src/ui_utils.c
===================================================================
--- trunk/src/ui_utils.c	2008-12-02 17:05:50 UTC (rev 3306)
+++ trunk/src/ui_utils.c	2008-12-02 18:33:41 UTC (rev 3307)
@@ -1754,3 +1754,17 @@
 	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);
+}

Modified: trunk/src/ui_utils.h
===================================================================
--- trunk/src/ui_utils.h	2008-12-02 17:05:50 UTC (rev 3306)
+++ trunk/src/ui_utils.h	2008-12-02 18:33:41 UTC (rev 3307)
@@ -167,6 +167,10 @@
 
 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 @@
 
 void ui_add_document_sensitive(GtkWidget *widget);
 
-void ui_widget_set_tooltip_text(GtkWidget *widget, const gchar *text);
-
 #endif


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the Commits mailing list