Modules | |
| SQL Query Builder | |
| Resolve names into objects | |
| Database Queries | |
| Database Reports | |
| User interface activities | |
| Data Fields | |
| Populate values from queries | |
| Query Object Framework support | |
Data Structures | |
| struct | DuiResolver_s |
Defines | |
| #define | DUI_DATABASE_TYPE (dui_database_get_type()) |
| #define | DUI_DATABASE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), DUI_DATABASE_TYPE, DuiDatabase)) |
| #define | IS_DUI_DATABASE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), DUI_DATABASE_TYPE)) |
Typedefs | |
| typedef struct DuiResolver_s | DuiResolver |
| typedef void(* | DuiResolverFieldFunc )(DuiField *, gpointer) |
| typedef void(* | DuiResolverRealizeFunc )(gpointer) |
| typedef struct _escape | sqlEscape |
| typedef struct DuiGtkTop_s | DuiGtkTop |
| typedef struct DuiSignal_s | DuiSignal |
| typedef struct DuiWindow_s | DuiWindow |
| typedef struct DwiGtkParseCtxt_s | DwiGtkParseCtxt |
Functions | |
| DuiResolver * | dui_resolver_new (void) |
| void | dui_resolver_destroy (DuiResolver *res) |
| void | dui_resolver_add_field (DuiResolver *, DuiField *) |
| void | dui_resolver_add_resolver (DuiResolver *, DuiResolverFieldFunc, gpointer user_data) |
| void | dui_resolver_remove_resolver (DuiResolver *, DuiResolverFieldFunc, gpointer user_data) |
| void | dui_resolver_add_realizer (DuiResolver *, DuiResolverRealizeFunc, gpointer) |
| void | dui_resolver_resolve (DuiResolver *) |
| void | dui_resolver_realize (DuiResolver *) |
| sqlEscape * | sqlEscape_new (void) |
| void | sqlEscape_destroy (sqlEscape *) |
| const gchar * | sqlEscapeString (sqlEscape *, const gchar *orig_string) |
| GType | dui_database_get_type (void) |
| DuiDatabase * | dui_database_new (const gchar *name, const gchar *provider, const gchar *dbname, const gchar *hostname, const gchar *username, const gchar *authentication_token) |
| void | dui_database_destroy (DuiDatabase *) |
| DuiDBConnection * | dui_database_do_realize (DuiDatabase *) |
| const gchar * | dui_database_get_name (DuiDatabase *) |
| DuiGtkTop * | dui_gtk_top_new (void) |
| void | dui_gtk_top_destroy (DuiGtkTop *top) |
| void | dui_gtk_top_add_window (DuiGtkTop *top, DuiWindow *win) |
| DuiWindow * | dui_gtk_top_find_window_by_name (DuiGtkTop *top, const char *name) |
| DuiInterfacePlugin * | dui_gtk_top_plugin_new (DuiGtkTop *top) |
| DwiGtkParseCtxt * | dwi_gtk_parser_new (DuiParser *par) |
| void | dui_show_message (const char *, GLogLevelFlags, const gchar *, gpointer) |
| DuiSignal * | dui_signal_new (const gchar *objname, const gchar *signalname, const gchar *act) |
| void | dui_signal_destroy (DuiSignal *sig) |
| const gchar * | dui_signal_get_widgetname (DuiSignal *sig) |
| void | dui_signal_connect (DuiSignal *sig, GObject *obj, GCallback sigfunc, gpointer user_data) |
| void | dui_signal_do_realize (DuiSignal *sig, DuiWindow *) |
| void | xxxgtk_textview_set_text (GtkTextView *text, const gchar *str) |
| gchar * | xxxgtk_textview_get_text (GtkTextView *text) |
| DuiWindow * | dui_window_new (const char *name, DuiGtkTop *) |
| void | dui_window_destroy (DuiWindow *) |
| const char * | dui_window_get_name (DuiWindow *) |
| void | dui_window_set_glade (DuiWindow *, const char *glade_xml_filepath, const char *root_widget, int is_app_main_window) |
| void | dui_window_add_action (DuiWindow *, DuiAction *) |
| void | dui_window_add_report (DuiWindow *, DuiReport *) |
| void | dui_window_add_signal (DuiWindow *, DuiSignal *, DuiAction *) |
| GtkWidget * | dui_window_get_widget (DuiWindow *, const char *widgetname) |
| void | dui_window_resolve (DuiWindow *) |
| void | dui_window_realize (DuiWindow *) |
| int | dui_window_is_realized (DuiWindow *) |
| int | dui_window_is_app_main_window (DuiWindow *) |
| void | dui_window_db_connect (DuiWindow *) |
| typedef struct DwiGtkParseCtxt_s DwiGtkParseCtxt |
The Gtk XML Parse context
Definition at line 37 of file parse-gtk.h.
| void dui_gtk_top_add_window | ( | DuiGtkTop * | top, | |
| DuiWindow * | win | |||
| ) |
The top leve holds a list of windows that can be retreived.
Definition at line 69 of file duitop-gtk.c.
00070 { 00071 if (!win) return; 00072 top->window_list = g_list_append (top->window_list, win); 00073 }
| DuiGtkTop* dui_gtk_top_new | ( | void | ) |
Create a new top-level structure to hold top-level stuff
Definition at line 43 of file duitop-gtk.c.
00044 { 00045 DuiGtkTop *top; 00046 00047 top = g_new0 (DuiGtkTop, 1); 00048 top->window_list = NULL; 00049 return top; 00050 }
| DuiInterfacePlugin* dui_gtk_top_plugin_new | ( | DuiGtkTop * | top | ) |
Create a plugin that is needed to get the gtk widgets realized at the right time.
Definition at line 135 of file duitop-gtk.c.
00136 { 00137 DuiInterfacePlugin *dip; 00138 00139 dip = g_new0 (DuiInterfacePlugin, 1); 00140 dip->plugin_name = "dui_gtk_top"; 00141 dip->self = top; 00142 dip->realize = dui_gtk_top_realize; 00143 00144 return dip; 00145 }
| void dui_resolver_add_field | ( | DuiResolver * | , | |
| DuiField * | ||||
| ) |
Add a field which will need resolution later
Definition at line 69 of file duiresolver.c.
00070 { 00071 if (!res) return; 00072 res->field_list = g_list_prepend (res->field_list, fld); 00073 }
| void dui_resolver_add_realizer | ( | DuiResolver * | , | |
| DuiResolverRealizeFunc | , | |||
| gpointer | ||||
| ) |
Add a function which, when called, will realize objects
Definition at line 130 of file duiresolver.c.
00132 { 00133 DuiResolverRealizer *rr; 00134 00135 if (!res) return; 00136 rr = g_new0 (DuiResolverRealizer, 1); 00137 rr->realize_func = fn; 00138 rr->user_data = ud; 00139 00140 res->realizer_list = g_list_prepend (res->realizer_list, rr); 00141 }
| void dui_resolver_add_resolver | ( | DuiResolver * | , | |
| DuiResolverFieldFunc | , | |||
| gpointer | user_data | |||
| ) |
Add a function which is able to resolve fields
Definition at line 76 of file duiresolver.c.
00078 { 00079 DuiResolverResolver *rr; 00080 00081 if (!res) return; 00082 rr = g_new0 (DuiResolverResolver, 1); 00083 rr->resolver_func = fn; 00084 rr->user_data = ud; 00085 00086 res->resolver_list = g_list_prepend (res->resolver_list, rr); 00087 }
| void dui_resolver_remove_resolver | ( | DuiResolver * | , | |
| DuiResolverFieldFunc | , | |||
| gpointer | user_data | |||
| ) |
Remove function and its user_data from the resolver list. Note: This routine is intended for cleanup/shutdown. If you think you need this routine for any other purpose, you are wrong; what you really want is to use a different resolver function (and different user_data) that does what you need.
Definition at line 90 of file duiresolver.c.
00092 { 00093 GList *n; 00094 if (!res) return; 00095 00096 for (n=res->resolver_list; n; n=n->next) 00097 { 00098 DuiResolverResolver *rr = n->data; 00099 if ((rr->user_data == ud) && (rr->resolver_func == fn)) 00100 { 00101 g_free (rr); 00102 res->resolver_list = g_list_delete_link (res->resolver_list, n); 00103 return; 00104 } 00105 } 00106 }
| void dui_resolver_resolve | ( | DuiResolver * | ) |
Do the deed. Call the DuiResolverFunc once on each field in the list of fields.
Definition at line 109 of file duiresolver.c.
00110 { 00111 GList *n, *f; 00112 00113 if (!res) return; 00114 00115 for (n=res->resolver_list; n; n=n->next) 00116 { 00117 DuiResolverResolver *rr = n->data; 00118 00119 for (f= res->field_list; f; f=f->next) 00120 { 00121 DuiField *fld = f->data; 00122 (rr->resolver_func) (fld, rr->user_data); 00123 } 00124 } 00125 }
| void dui_signal_destroy | ( | DuiSignal * | sig | ) |
Definition at line 83 of file signal.c.
00084 { 00085 if (!sig) return; 00086 if (sig->gobj && G_IS_OBJECT(sig->gobj) ) 00087 { 00088 g_signal_handler_disconnect (sig->gobj, sig->signal_id); 00089 } 00090 g_free (sig->widgetname); 00091 g_free (sig->signalname); 00092 g_free (sig->actionname); 00093 00094 sig->widgetname = NULL; 00095 sig->signalname = NULL; 00096 sig->actionname = NULL; 00097 00098 sig->gobj = NULL; 00099 sig->signal_id = -1; 00100 sig->sigfunc = NULL; 00101 sig->user_data = NULL; 00102 00103 g_free (sig); 00104 }
| DuiSignal* dui_signal_new | ( | const gchar * | objname, | |
| const gchar * | signalname, | |||
| const gchar * | act | |||
| ) |
The objname must specify a GObject (possibly a GtkWidget) on which there exists a signal of name 'signalname'. The widgetname must specify the name of a widget that appears in the glade file for the window that this action is a part of.
Definition at line 61 of file signal.c.
00062 { 00063 DuiSignal *sig; 00064 00065 if (!signame || !wig || !act) return NULL; 00066 00067 sig = g_new (DuiSignal, 1); 00068 sig->widgetname = g_strdup (wig); 00069 sig->signalname = g_strdup (signame); 00070 sig->actionname = g_strdup (act); 00071 sig->gobj = NULL; 00072 sig->signal_id = -1; 00073 sig->sigfunc = NULL; 00074 sig->user_data = NULL; 00075 00076 return sig; 00077 }
| void dui_window_add_action | ( | DuiWindow * | , | |
| DuiAction * | ||||
| ) |
| void dui_window_add_report | ( | DuiWindow * | , | |
| DuiReport * | ||||
| ) |
| void dui_window_add_signal | ( | DuiWindow * | , | |
| DuiSignal * | , | |||
| DuiAction * | ||||
| ) |
Temporary implementation for signals. If action is non-null, then the action will be run. If null, then the signal is of type 'sigaction' and works independently.
Definition at line 198 of file window.c.
00199 { 00200 if (!win || !sig) return; 00201 win->signals = g_list_append (win->signals, sig); 00202 00203 if (!act) return; 00204 dui_signal_connect (sig, NULL, 00205 G_CALLBACK(action_signal_handler), act); 00206 }
| void dui_window_db_connect | ( | DuiWindow * | ) |
Force the database used for queries from this window to be connected to. This will cause any database-connection error messages to be displayed. XXX this is kind-of a hack. We should have a more formal error reporting chain.
Definition at line 373 of file window.c.
00374 { 00375 GList *node; 00376 if (!win) return; 00377 00378 for (node=win->actions; node; node=node->next) 00379 { 00380 DuiAction *act = node->data; 00381 dui_action_db_connect (act); 00382 } 00383 }
| GtkWidget* dui_window_get_widget | ( | DuiWindow * | , | |
| const char * | widgetname | |||
| ) |
Thin wrapper around glade_xml_get_widget() Gets the widget associated with the indicated name.
| int dui_window_is_realized | ( | DuiWindow * | ) |
Return non-zero value if the widget for this window exists
Definition at line 361 of file window.c.
00362 { 00363 if (!win) return 0; 00364 /* Note that closing some windows destroys them, 00365 * we can check this by seeing if our pointer is still a widget */ 00366 if (win->glxml && GTK_IS_WIDGET (win->widget)) return 1; 00367 return 0; 00368 }
| void dui_window_realize | ( | DuiWindow * | ) |
Cause this window to actually exist on the screen
Definition at line 269 of file window.c.
00270 { 00271 GList *node; 00272 if (!win) return; 00273 00274 /* We don't want to enter into here twice; in particular, if 00275 * we accidentally gtk_widget_show() too soon, for example, 00276 * if we show before the signals are initialized, then the 00277 * "show" signal will be missed, which will screw up dialogs 00278 * that depend on actions running as a result of window show. 00279 */ 00280 if (win->recurse_cnt) return; 00281 win->recurse_cnt ++; 00282 00283 ENTER ("(win=%p \"%s\")", win, win->name); 00284 /* If already realized, do (almost) nothing */ 00285 /* Note that closing some windows destroys them, 00286 * so we need to re-realize when they're gone ... */ 00287 if (win->glxml && win->widget && GTK_IS_WIDGET (win->widget)) 00288 { 00289 gtk_widget_show (win->widget); 00290 win->recurse_cnt --; 00291 LEAVE ("(win=%p \"%s\") { already realized, just showing }", win, win->name); 00292 return; 00293 } 00294 00295 win->glxml = glade_xml_new (win->glade_filepath, win->glade_top_widget, NULL); 00296 if (NULL == win->glxml) 00297 { 00298 SYNTAX ("can't open \"%s\"", win->glade_filepath); 00299 win->recurse_cnt --; 00300 return; 00301 } 00302 00303 glade_xml_signal_autoconnect (win->glxml); 00304 win->widget = glade_xml_get_widget (win->glxml, win->glade_top_widget); 00305 if (NULL == win->widget) 00306 { 00307 SYNTAX ("can't find the widget \"%s\" in \"%s\"\n", 00308 win->glade_top_widget, win->glade_filepath); 00309 win->recurse_cnt --; 00310 return; 00311 } 00312 00313 gtk_signal_connect (GTK_OBJECT(win->widget), "destroy", 00314 GTK_SIGNAL_FUNC(destroy_cb), win); 00315 00323 for (node=win->actions; node; node=node->next) 00324 { 00325 DuiAction *act = node->data; 00326 dui_action_do_realize (act); 00327 } 00328 00329 for (node=win->signals; node; node=node->next) 00330 { 00331 DuiSignal *sig = node->data; 00332 dui_signal_do_realize (sig, win); 00333 } 00334 00335 for (node=win->reports; node; node=node->next) 00336 { 00337 DuiReport *rpt = node->data; 00338 dui_report_do_realize (rpt); 00339 } 00340 00341 gtk_widget_show (win->widget); 00342 00343 win->recurse_cnt --; 00344 LEAVE ("(win=%p \"%s\")", win, win->name); 00345 }
| void dui_window_resolve | ( | DuiWindow * | ) |
resolve dangling references
Definition at line 244 of file window.c.
00245 { 00246 GList *node; 00247 if (!win) return; 00248 00249 ENTER ("(win=%p)", win); 00250 /* Tell the reports, actions about where they will find thier 00251 * widgets */ 00252 for (node=win->actions; node; node=node->next) 00253 { 00254 DuiAction *act = node->data; 00255 dui_action_add_resolver (act, dui_field_resolve_widget, win); 00256 dui_action_add_realizer (act, win_realize, win); 00257 } 00258 for (node=win->reports; node; node=node->next) 00259 { 00260 DuiReport *rpt = node->data; 00261 dui_report_add_resolver (rpt, dui_field_resolve_widget, win); 00262 dui_report_add_realizer (rpt, win_realize, win); 00263 } 00264 00265 LEAVE ("(win=%p)", win); 00266 }
| void dui_window_set_glade | ( | DuiWindow * | , | |
| const char * | glade_xml_filepath, | |||
| const char * | root_widget, | |||
| int | is_app_main_window | |||
| ) |
This records the top-level widget for this window. its typically a top-level window If is_app_main_window is set, then this window will be automatially created on application startup.
| DwiGtkParseCtxt* dwi_gtk_parser_new | ( | DuiParser * | par | ) |
Add a parsing context to the parser that is capable of understanding the Gtk fields.
Definition at line 440 of file parse-gtk.c.
00441 { 00442 DuiParserElementPlugin *plg; 00443 DwiGtkParseCtxt *ctx = g_new0 (DwiGtkParseCtxt, 1); 00444 00445 ctx->top = dui_gtk_top_new(); 00446 ctx->parser = par; 00447 ctx->window = NULL; 00448 ctx->action = NULL; 00449 00450 /* Make sure the gtk interface is realized */ 00451 DuiInterfacePlugin *dip = dui_gtk_top_plugin_new(ctx->top); 00452 DuiInterface *iface = dui_parser_get_interface (par); 00453 dui_interface_register_plugin (iface, dip); 00454 00455 plg = dwi_sigaction_parser_plugin(ctx); 00456 dui_parser_register_element_plugin (par, plg); 00457 00458 plg = dwi_submit_parser_plugin(ctx); 00459 dui_parser_register_element_plugin (par, plg); 00460 00463 plg = dwi_window_parser_plugin(ctx); 00464 dui_parser_register_element_plugin (par, plg); 00465 00466 DuiParserTablePlugin *tbl; 00467 tbl = gtk_parser_table_plugin (ctx); 00468 dui_parser_register_table_plugin (par, tbl); 00469 00470 DuiParserFieldPlugin *fp; 00471 fp = dwi_widget_parser_plugin (ctx); 00472 dui_parser_register_field_plugin (par, fp); 00473 00474 fp = dwi_widdata_parser_plugin (ctx); 00475 dui_parser_register_field_plugin (par, fp); 00476 00477 fp = dwi_widarg_parser_plugin (ctx); 00478 dui_parser_register_field_plugin (par, fp); 00479 00480 DuiParserStructPlugin *psp; 00481 psp = dwi_struct_plugin (ctx); 00482 dui_parser_register_struct_plugin (par, psp); 00483 00484 return ctx; 00485 }
| gchar* xxxgtk_textview_get_text | ( | GtkTextView * | text | ) |
Simplified interface to the textview widget
Definition at line 52 of file util-gtk.c.
00053 { 00054 GtkTextIter start, end; 00055 GtkTextBuffer *buff = gtk_text_view_get_buffer (text); 00056 gtk_text_buffer_get_start_iter (buff, &start); 00057 gtk_text_buffer_get_end_iter (buff, &end); 00058 return gtk_text_buffer_get_text(buff, &start, &end, TRUE); 00059 }
| void xxxgtk_textview_set_text | ( | GtkTextView * | text, | |
| const gchar * | str | |||
| ) |
Simplified interface to the textview widget
1.5.5