SF.net SVN: geany:[3084] trunk

ntrel at users.sourceforge.net ntrel at xxxxx
Tue Oct 14 14:49:41 UTC 2008


Revision: 3084
          http://geany.svn.sourceforge.net/geany/?rev=3084&view=rev
Author:   ntrel
Date:     2008-10-14 14:49:41 +0000 (Tue, 14 Oct 2008)

Log Message:
-----------
Add ui_add_document_sensitive() to the plugin API.
Deprecate plugin_fields, PluginFlags - use
ui_add_document_sensitive() instead.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/doc/pluginsymbols.c
    trunk/src/plugindata.h
    trunk/src/plugins.c
    trunk/src/ui_utils.c
    trunk/src/ui_utils.h

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2008-10-13 22:36:52 UTC (rev 3083)
+++ trunk/ChangeLog	2008-10-14 14:49:41 UTC (rev 3084)
@@ -1,3 +1,12 @@
+2008-10-14  Nick Treleaven  <nick(dot)treleaven(at)btinternet(dot)com>
+
+ * src/ui_utils.h, src/plugindata.h, src/plugins.c, src/ui_utils.c,
+   doc/pluginsymbols.c:
+   Add ui_add_document_sensitive() to the plugin API.
+   Deprecate plugin_fields, PluginFlags - use
+   ui_add_document_sensitive() instead.
+
+
 2008-10-13  Frank Lanitz  <frank(at)frank(dot)uvena(dot)de>
 
  * ko.po, LINGUAS, src/about.c, THANKS:

Modified: trunk/doc/pluginsymbols.c
===================================================================
--- trunk/doc/pluginsymbols.c	2008-10-13 22:36:52 UTC (rev 3083)
+++ trunk/doc/pluginsymbols.c	2008-10-14 14:49:41 UTC (rev 3084)
@@ -61,7 +61,8 @@
  * @c p_document->new_file(NULL, NULL, NULL); */
 const GeanyFunctions *geany_functions;
 
-/** Plugin owned fields, including flags. */
+/** @deprecated Use @ref ui_add_document_sensitive() instead.
+ * Plugin owned fields, including flags. */
 PluginFields *plugin_fields;
 
 /** An array for connecting GeanyObject events, which should be terminated with

Modified: trunk/src/plugindata.h
===================================================================
--- trunk/src/plugindata.h	2008-10-13 22:36:52 UTC (rev 3083)
+++ trunk/src/plugindata.h	2008-10-14 14:49:41 UTC (rev 3084)
@@ -41,7 +41,7 @@
 enum {
 	/** The Application Programming Interface (API) version, incremented
 	 * whenever any plugin data types are modified or appended to. */
-	GEANY_API_VERSION = 99,
+	GEANY_API_VERSION = 100,
 
 	/** The Application Binary Interface (ABI) version, incremented whenever
 	 * existing fields in the plugin data types have to be changed or reordered. */
@@ -144,8 +144,8 @@
 PluginCallback;
 
 
-
-/** Flags to be set by plugins in PluginFields struct. */
+/** @deprecated Use @ref ui_add_document_sensitive() instead.
+ * Flags to be set by plugins in PluginFields struct. */
 typedef enum
 {
 	/** Whether a plugin's menu item should be disabled when there are no open documents */
@@ -153,7 +153,8 @@
 }
 PluginFlags;
 
-/** Fields set and owned by the plugin. */
+/** @deprecated Use @ref ui_add_document_sensitive() instead.
+ * Fields set and owned by the plugin. */
 typedef struct PluginFields
 {
 	/** Bitmask of PluginFlags. */
@@ -348,6 +349,7 @@
 	void		(*table_add_row) (GtkTable *table, gint row, ...) G_GNUC_NULL_TERMINATED;
 	GtkWidget*	(*path_box_new) (const gchar *title, GtkFileChooserAction action, GtkEntry *entry);
 	GtkWidget*	(*button_new_with_image) (const gchar *stock_id, const gchar *text);
+	void		(*add_document_sensitive) (GtkWidget *widget);
 }
 UIUtilsFuncs;
 

Modified: trunk/src/plugins.c
===================================================================
--- trunk/src/plugins.c	2008-10-13 22:36:52 UTC (rev 3083)
+++ trunk/src/plugins.c	2008-10-14 14:49:41 UTC (rev 3084)
@@ -203,6 +203,7 @@
 	&ui_table_add_row,
 	&ui_path_box_new,
 	&ui_button_new_with_image,
+	&ui_add_document_sensitive
 };
 
 static DialogFuncs dialog_funcs = {

Modified: trunk/src/ui_utils.c
===================================================================
--- trunk/src/ui_utils.c	2008-10-13 22:36:52 UTC (rev 3083)
+++ trunk/src/ui_utils.c	2008-10-14 14:49:41 UTC (rev 3084)
@@ -654,6 +654,23 @@
 }
 
 
+static void on_doc_sensitive_widget_destroy(GtkWidget *widget, G_GNUC_UNUSED gpointer user_data)
+{
+	g_ptr_array_remove_fast(widgets.document_buttons, widget);
+}
+
+
+/** Add a widget to the list of widgets that should be set sensitive/insensitive
+ * when some documents are present/no documents are open.
+ * It will be removed when the widget is destroyed.
+ * @param widget The widget to add. */
+void ui_add_document_sensitive(GtkWidget *widget)
+{
+	g_ptr_array_add(widgets.document_buttons, widget);
+	g_signal_connect(widget, "destroy", G_CALLBACK(on_doc_sensitive_widget_destroy), NULL);
+}
+
+
 void ui_widget_show_hide(GtkWidget *widget, gboolean show)
 {
 	if (show)

Modified: trunk/src/ui_utils.h
===================================================================
--- trunk/src/ui_utils.h	2008-10-13 22:36:52 UTC (rev 3083)
+++ trunk/src/ui_utils.h	2008-10-14 14:49:41 UTC (rev 3084)
@@ -243,4 +243,6 @@
 
 gint ui_get_toolbar_insert_position(void);
 
+void ui_add_document_sensitive(GtkWidget *widget);
+
 #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