SF.net SVN: geany:[3497] trunk
eht16 at users.sourceforge.net
eht16 at xxxxx
Wed Jan 21 22:49:47 UTC 2009
Revision: 3497
http://geany.svn.sourceforge.net/geany/?rev=3497&view=rev
Author: eht16
Date: 2009-01-21 22:49:47 +0000 (Wed, 21 Jan 2009)
Log Message:
-----------
Add dialogs_show_input_numeric() to the plugins API.
Modified Paths:
--------------
trunk/ChangeLog
trunk/plugins/geanyfunctions.h
trunk/src/dialogs.c
trunk/src/plugindata.h
trunk/src/plugins.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2009-01-21 22:49:21 UTC (rev 3496)
+++ trunk/ChangeLog 2009-01-21 22:49:47 UTC (rev 3497)
@@ -9,6 +9,9 @@
* src/document.c, src/keyfile.c, src/search.c, src/tools.c,
src/utils.c, src/vte.c, tagmanager/tm_source_file.c:
Replace remaining occurrences of '__func__' with 'G_STRFUNC'.
+ * plugins/geanyfunctions.h, src/dialogs.c, src/plugindata.h,
+ src/plugins.c:
+ Add dialogs_show_input_numeric() to the plugins API.
2009-01-20 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
Modified: trunk/plugins/geanyfunctions.h
===================================================================
--- trunk/plugins/geanyfunctions.h 2009-01-21 22:49:21 UTC (rev 3496)
+++ trunk/plugins/geanyfunctions.h 2009-01-21 22:49:47 UTC (rev 3497)
@@ -190,6 +190,8 @@
geany_functions->p_dialogs->show_msgbox
#define dialogs_show_save_as \
geany_functions->p_dialogs->show_save_as
+#define dialogs_show_input_numeric \
+ geany_functions->p_dialogs->show_input_numeric
#define msgwin_status_add \
geany_functions->p_msgwin->status_add
#define msgwin_compiler_add \
Modified: trunk/src/dialogs.c
===================================================================
--- trunk/src/dialogs.c 2009-01-21 22:49:21 UTC (rev 3496)
+++ trunk/src/dialogs.c 2009-01-21 22:49:47 UTC (rev 3497)
@@ -924,12 +924,30 @@
}
+/**
+ * Show an input box to enter a numerical value using a GtkSpinButton.
+ *
+ * @param title The dialog title.
+ * @param label_text The shown dialog label.
+ * @param value The default value for the spin button and the return location of the entered value.
+ * Must be non-NULL.
+ * @param min Minimum allowable value (see documentation for @a gtk_spin_button_new_with_range()).
+ * @param max Maximum allowable value (see documentation for @a gtk_spin_button_new_with_range()).
+ * @param step Increment added or subtracted by spinning the widget
+ * (see documentation for @a gtk_spin_button_new_with_range()).
+ *
+ * @return @a TRUE if a value was entered and the dialog closed with 'OK'. @a FALSE otherwise.
+ **/
gboolean dialogs_show_input_numeric(const gchar *title, const gchar *label_text,
gdouble *value, gdouble min, gdouble max, gdouble step)
{
GtkWidget *dialog, *label, *spin, *vbox;
gboolean res = FALSE;
+ g_return_val_if_fail(title != NULL, FALSE);
+ g_return_val_if_fail(label_text != NULL, FALSE);
+ g_return_val_if_fail(value != NULL, FALSE);
+
dialog = gtk_dialog_new_with_buttons(title, GTK_WINDOW(main_widgets.window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
Modified: trunk/src/plugindata.h
===================================================================
--- trunk/src/plugindata.h 2009-01-21 22:49:21 UTC (rev 3496)
+++ trunk/src/plugindata.h 2009-01-21 22:49:47 UTC (rev 3497)
@@ -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 = 127,
+ GEANY_API_VERSION = 128,
/** The Application Binary Interface (ABI) version, incremented whenever
* existing fields in the plugin data types have to be changed or reordered. */
@@ -393,6 +393,9 @@
gboolean (*show_question) (const gchar *text, ...);
void (*show_msgbox) (gint type, const gchar *text, ...);
gboolean (*show_save_as) (void);
+ gboolean (*dialogs_show_input_numeric) (const gchar *title, const gchar *label_text,
+ gdouble *value, gdouble min, gdouble max, gdouble step);
+
}
DialogFuncs;
Modified: trunk/src/plugins.c
===================================================================
--- trunk/src/plugins.c 2009-01-21 22:49:21 UTC (rev 3496)
+++ trunk/src/plugins.c 2009-01-21 22:49:47 UTC (rev 3497)
@@ -231,7 +231,8 @@
static DialogFuncs dialog_funcs = {
&dialogs_show_question,
&dialogs_show_msgbox,
- &dialogs_show_save_as
+ &dialogs_show_save_as,
+ &dialogs_show_input_numeric
};
/* Macro to prevent confusing macro being generated in geanyfunctions.h */
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