Add ui_add_document_sensitive() to the plugin API.

Deprecate plugin_fields, PluginFlags - use
ui_add_document_sensitive() instead.


git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@3084 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Nick Treleaven 2008-10-14 14:49:41 +00:00
parent 94542c5032
commit c343d904b2
6 changed files with 37 additions and 5 deletions

View File

@ -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:

View File

@ -61,7 +61,8 @@ const GeanyData *geany_data;
* @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

View File

@ -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 @@ typedef struct PluginCallback
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 @@ typedef enum
}
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 @@ typedef struct UIUtilsFuncs
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;

View File

@ -203,6 +203,7 @@ static UIUtilsFuncs uiutils_funcs = {
&ui_table_add_row,
&ui_path_box_new,
&ui_button_new_with_image,
&ui_add_document_sensitive
};
static DialogFuncs dialog_funcs = {

View File

@ -654,6 +654,23 @@ void ui_document_buttons_update(void)
}
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)

View File

@ -243,4 +243,6 @@ void ui_statusbar_showhide(gboolean state);
gint ui_get_toolbar_insert_position(void);
void ui_add_document_sensitive(GtkWidget *widget);
#endif