/usr/include/gnucash/gnc-dialog.h is in gnucash-common 1:2.4.10-6.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 | /* Copyright (C) 2005 Chris Shoemaker <c.shoemaker@cox.net>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, contact:
*
* Free Software Foundation Voice: +1-617-542-5942
* 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652
* Boston, MA 02110-1301, USA gnu@gnu.org
*/
#ifndef GNC_DIALOG_H
#define GNC_DIALOG_H
#include <time.h>
GType gnc_dialog_get_type (void);
/* type macros */
#define GNC_TYPE_DIALOG (gnc_dialog_get_type ())
#define GNC_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
GNC_TYPE_DIALOG, GncDialog))
#define GNC_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), \
GNC_TYPE_DIALOG, GncDialogClass))
#define GNC_IS_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
GNC_TYPE_DIALOG))
#define GNC_IS_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \
GNC_TYPE_DIALOG))
#define GNC_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
GNC_TYPE_DIALOG, GncDialogClass))
typedef struct _GncDialog GncDialog;
typedef struct _GncDialogClass GncDialogClass;
/**** PROTOTYPES *************************************************/
/* filename is a glade filenames; and root is the name of the root
widget you want to show. */
GncDialog *gnc_dialog_new(const char *filename,
const char *root);
typedef gboolean (*GncDialogCallback) (GncDialog *d, gpointer user_data);
/* The apply callback is optional, but useful dialogs will probably
* supply one. The apply callback should return FALSE if any values
* are invalid. In that case, the dialog will not close automatically
* after the user clicks OK, and the changed state will not be marked
* clean. If you supply NULL, for the apply callback, no "OK" button
* will be visible.
*
* The close callback is optional. If you provide a close callback,
* its return value should be TRUE if you want to proceed with the
* close. There's no destroy notifier for user_data, but you can
* treat the close_cb as one. So if you must pass this function its
* own copy of user_data, free it from within close_cb.
*
* The help callback return value is not checked.
*
* Any callback may be NULL, in which case it's not used. If help_cb
* is NULL, no help button is shown.
*/
void gnc_dialog_set_cb(GncDialog *d,
GncDialogCallback apply_cb,
GncDialogCallback close_cb,
GncDialogCallback help_cb,
gpointer user_data);
/* By default, GncDialog works best in asynchronous environments,
* where your program execution flow isn't waiting for the dialog to
* close. But, if you're using the dialog to do something like fetch
* a value you want to return on the stack, then you have to block the
* current thread until the dialog is closed. Calling this function
* will do exactly that.
*/
void gnc_dialog_block_until_close(GncDialog *d);
/* This is a catch-all interface to whatever kind of widgets may have
* been specified in the glade file. Once you have you widget you can
* use whatever interface that widget offers to set and get widget
* state. You _have_ to use if the widget type isn't supported by the
* type-specific or type-generic interfaces below.
*/
GtkWidget *gnc_dialog_get_widget(GncDialog *d, const gchar* name);
void gnc_dialog_set_sensitive(GncDialog *d, const gchar* name, gboolean sen);
/* Infers val type from widget type *
*/
/* Type-generic getter/setter: Be careful with these. They are NOT
* type safe. Also, if they prove to be more trouble than they're
* worth, they'll go away.
*
* These functions try to use the widget type to infer the type of
* data pointed at by val. They will return FALSE if they are unable
* to infer value type. The inferences made are:
*
* Widget Type ---> Value Type
* =========== ==========
* GnomeDateEdit GDate *
* GtkSpinButton gdouble *
* GtkToggleButton gboolean *
* GtkEntry gchar *
* GtkLabel gchar *
* GtkTextView GtkTextBuffer *
* GtkComboBox gint *
*
* WARNING: For the given widget type you must cast the corresponding
* value type to/from the passed gpointer. Having mis-matched widget
* and value types will likely cause a revolt among the electrons.
*
*/
gboolean gnc_dialog_set(GncDialog *d, const char* name, const gpointer val);
gpointer gnc_dialog_get(GncDialog *d, const char* name);
/* Type-specific getter/setters */
gboolean gnc_dialog_set_string(GncDialog *d, const char* name,
const gchar* val);
gchar* gnc_dialog_get_string(GncDialog *d, const char* name);
gboolean gnc_dialog_set_double(GncDialog *d, const char* name, gdouble val);
gdouble gnc_dialog_get_double(GncDialog *d, const char* name);
gboolean gnc_dialog_set_int(GncDialog *d, const char* name, gint val);
gint gnc_dialog_get_int(GncDialog *d, const char* name);
gboolean gnc_dialog_set_date(GncDialog *d, const char* name, time_t val);
time_t gnc_dialog_get_date(GncDialog *d, const char* name);
gboolean gnc_dialog_set_index(GncDialog *d, const char* name, gint val);
gint gnc_dialog_get_index(GncDialog *d, const char* name);
gboolean gnc_dialog_set_boolean(GncDialog *d, const char* name, gboolean val);
gboolean gnc_dialog_get_boolean(GncDialog *d, const char* name);
/* Possible TODO: there are more types that could be added here.
Maybe currency/gnc_commodity *
*/
gpointer gnc_dialog_get_custom(GncDialog *d, const char* name);
gboolean gnc_dialog_set_custom(GncDialog *d, const char* name, gpointer val);
gboolean gnc_dialog_fill_custom(GncDialog *d, const char* name);
/* should return true for success */
typedef gboolean (*GncDialogSetter) (gpointer widget, gpointer val);
typedef gpointer (*GncDialogGetter) (gpointer widget);
//typedef gboolean (*GncDialogFiller) (gpointer widget, gpointer data);
void gnc_dialog_register_custom(GType widgetType, GncDialogGetter getter,
GncDialogSetter setter,
GncDialogSetter filler);
void gnc_dialog_unregister_custom(GType widgetType);
void gnc_dialog_register_testing_types(void);
#endif
|