[gq-commit] gq/src gq-xml.c,1.3,1.4
Status: Beta
Brought to you by:
sur5r
From: <sta...@us...> - 2003-10-05 22:23:33
|
Update of /cvsroot/gqclient/gq/src In directory sc8-pr-cvs1:/tmp/cvs-serv7986 Modified Files: gq-xml.c Log Message: * Added the new GUI preferences to the configuration * Moved the warning / error message handler out into xmlutil.[ch] Index: gq-xml.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/gq-xml.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** gq-xml.c 5 Oct 2003 13:42:10 -0000 1.3 --- gq-xml.c 5 Oct 2003 22:23:28 -0000 1.4 *************** *** 38,41 **** --- 38,42 ---- #include "gq-xml.h" #include "xmlparse.h" + #include "xmlutil.h" #include "configfile.h" #include "util.h" *************** *** 48,56 **** #include "common.h" - struct cf_comm { - int error_context; - int severity; - struct gq_config *config; - }; static void gq_configS(struct parser_context *ctx, --- 49,52 ---- *************** *** 65,74 **** { if (ctx->user_data) { ! struct cf_comm *comm = (struct cf_comm *)ctx->user_data; ! if (comm->config) { ! free_config(comm->config); } ! comm->config = e->data; e->data = NULL; --- 61,70 ---- { if (ctx->user_data) { ! struct parser_comm *comm = (struct parser_comm *)ctx->user_data; ! if (comm->result) { ! free_config(comm->result); } ! comm->result = e->data; e->data = NULL; *************** *** 195,199 **** --- 191,220 ---- } + static void restore_window_sizesE(struct parser_context *ctx, + struct tagstack_entry *e) + { + struct gq_config *c = peek_tag(ctx->stack, 1)->data; + + int b = booleanCDATA(ctx, e); + if (b >= 0) c->restore_window_sizes = b; + } + + static void restore_window_positionsE(struct parser_context *ctx, + struct tagstack_entry *e) + { + struct gq_config *c = peek_tag(ctx->stack, 1)->data; + + int b = booleanCDATA(ctx, e); + if (b >= 0) c->restore_window_positions = b; + } + + static void restore_search_historyE(struct parser_context *ctx, + struct tagstack_entry *e) + { + struct gq_config *c = peek_tag(ctx->stack, 1)->data; + int b = booleanCDATA(ctx, e); + if (b >= 0) c->restore_search_history = b; + } static void ldif_formatE(struct parser_context *ctx, *************** *** 206,211 **** } - - static void search_argumentE(struct parser_context *ctx, struct tagstack_entry *e) --- 227,230 ---- *************** *** 377,381 **** } - static void ldapserver_cache_connectionE(struct parser_context *ctx, struct tagstack_entry *e) --- 396,399 ---- *************** *** 548,552 **** ! struct xml_tag config_tags[] = { { "gq-config", 0, --- 566,570 ---- ! static struct xml_tag config_tags[] = { { "gq-config", 0, *************** *** 605,608 **** --- 623,641 ---- }, { + "restore-window-sizes", 0, + NULL, restore_window_sizesE, + { "gq-config", NULL }, + }, + { + "restore-window-positions", 0, + NULL, restore_window_positionsE, + { "gq-config", NULL }, + }, + { + "restore-search-history", 0, + NULL, restore_search_historyE, + { "gq-config", NULL }, + }, + { "ldif-format", 0, NULL, ldif_formatE, *************** *** 786,843 **** }; - static void XMLmessageHandler(struct parser_context *ctx, - int severity, - const char *type, - const char *format, va_list ap) - { - struct cf_comm *comm = ctx->user_data; - if (comm) { - int len = 1024, pos = 0, i; - char *buf = g_malloc(len); - - snprintf(buf, len, "%s: ", type); - i = strlen(buf); - pos += i; /* OK for UTF-8 */ - - vsnprintf(buf + pos, len - pos, format, ap); - error_push(comm->error_context, buf); - - fprintf(stderr, "%s\n", buf); - - g_free(buf); - - comm->severity = severity; - } - } - - static void XMLwarningHandler(struct parser_context *ctx, - const char *fmt, ...) - { - va_list args; - - va_start(args, fmt); - XMLmessageHandler(ctx, 1, _("Warning"), fmt, args); - va_end(args); - } - - static void XMLerrorHandler(struct parser_context *ctx, - const char *fmt, ...) - { - va_list args; - - va_start(args, fmt); - XMLmessageHandler(ctx, 2, _("Error"), fmt, args); - va_end(args); - } - - static void XMLfatalErrorHandler(struct parser_context *ctx, - const char *fmt, ...) - { - va_list args; - - va_start(args, fmt); - XMLmessageHandler(ctx, 3, _("Fatal Error"), fmt, args); - va_end(args); - } static int dot_gq_upgrade_hack(int error_context, const char *filename) --- 819,822 ---- *************** *** 1004,1011 **** xmlSAXHandler *handler = g_malloc0(sizeof(xmlSAXHandler)); int rc; ! struct cf_comm comm; comm.error_context = error_context; ! comm.config = NULL; handler->error = (errorSAXFunc) XMLerrorHandler; --- 983,990 ---- xmlSAXHandler *handler = g_malloc0(sizeof(xmlSAXHandler)); int rc; ! struct parser_comm comm; comm.error_context = error_context; ! comm.result = NULL; handler->error = (errorSAXFunc) XMLerrorHandler; *************** *** 1018,1026 **** g_free(handler); if (rc != 0) { ! free_config(comm.config); ! comm.config = NULL; } ! return comm.config; } --- 997,1005 ---- g_free(handler); if (rc != 0) { ! free_config(comm.result); ! comm.result = NULL; } ! return comm.result; } |