Thread: [gq-commit] gq/src browse-dnd.c,1.13,1.14 browse.c,1.72,1.73 dt_oc.c,1.16,1.17 errorchain.c,1.14,1.1
Status: Beta
Brought to you by:
sur5r
Update of /cvsroot/gqclient/gq/src In directory sc8-pr-cvs1:/tmp/cvs-serv5544 Modified Files: browse-dnd.c browse.c dt_oc.c errorchain.c formfill.c input.c schema.c schemabrowse.c search.c tinput.c util.c util.h Log Message: * The statusbar_msg function now takes a printf style format and arguments. This is great whereever we used to allocate a message buffer for a variable message, filled it out, called statusbar_msg and free'd the message buffer again. It also helps with too short message-buffers * changed all calls to statusbar_msg to the new interface, getting rid of message buffers along the way * fixed a nasty bug in error_free regarding the deleting of an error context Index: browse-dnd.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/browse-dnd.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** browse-dnd.c 28 Sep 2003 23:01:52 -0000 1.13 --- browse-dnd.c 8 Oct 2003 22:01:04 -0000 1.14 *************** *** 478,487 **** const char *new_dn) { ! int len = strlen(from_dn) + strlen(to_dn) + 80; ! char *msg = g_malloc(len); ! /* snprintf(msg, len, "Moved %s to %s", from_dn, to_dn); */ ! snprintf(msg, len, _("Created %s"), new_dn); ! statusbar_msg(msg); ! g_free(msg); } --- 478,482 ---- const char *new_dn) { ! statusbar_msg(_("Created %s"), new_dn); } Index: browse.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/browse.c,v retrieving revision 1.72 retrieving revision 1.73 diff -C2 -d -r1.72 -r1.73 *** browse.c 5 Oct 2003 13:25:59 -0000 1.72 --- browse.c 8 Oct 2003 22:01:04 -0000 1.73 *************** *** 202,215 **** #if GTK_MAJOR < 2 ! snprintf(message, sizeof(message), ! _("onelevel search on %s"), ! c = decoded_string(entry->dn)); if (c) free(c); #else ! snprintf(message, sizeof(message), ! _("onelevel search on %s"), entry->dn); #endif - statusbar_msg(message); msg = ldap_search(ld, entry->dn, LDAP_SCOPE_ONELEVEL, --- 202,212 ---- #if GTK_MAJOR < 2 ! statusbar_msg(_("onelevel search on %s"), ! c = decoded_string(entry->dn)); if (c) free(c); #else ! statusbar_msg(_("onelevel search on %s"), entry->dn); #endif msg = ldap_search(ld, entry->dn, LDAP_SCOPE_ONELEVEL, *************** *** 217,221 **** if(msg == -1) { ! statusbar_msg(ldap_err2string(msg)); close_connection(server, FALSE); gtk_clist_thaw(GTK_CLIST(ctree)); --- 214,218 ---- if(msg == -1) { ! statusbar_msg("%s", ldap_err2string(msg)); close_connection(server, FALSE); gtk_clist_thaw(GTK_CLIST(ctree)); *************** *** 239,246 **** update_counter++; if(update_counter >= 100) { ! snprintf(message, sizeof(message), ! ngettext("One entry found (running)", ! "%d entries found (running)", ! num_children), num_children); /* make_message(message, sizeof(message), */ --- 236,242 ---- update_counter++; if(update_counter >= 100) { ! statusbar_msg(ngettext("One entry found (running)", ! "%d entries found (running)", ! num_children), num_children); /* make_message(message, sizeof(message), */ *************** *** 249,253 **** /* _("%d entries found (running)"), */ /* num_children); */ ! statusbar_msg(message); update_counter = 0; } --- 245,249 ---- /* _("%d entries found (running)"), */ /* num_children); */ ! update_counter = 0; } *************** *** 1001,1005 **** struct ldapserver *server; int server_cnt = 0; - char message[128]; GList *I; --- 997,1000 ---- *************** *** 1010,1020 **** } ! snprintf(message, sizeof(message), ! ngettext("One server found", ! "%d servers found", server_cnt), ! server_cnt); ! ! statusbar_msg(message); ! } --- 1005,1011 ---- } ! statusbar_msg(ngettext("One server found", ! "%d servers found", server_cnt), ! server_cnt); } *************** *** 1099,1103 **** GtkCTreeNode *node; struct ldapserver *server; - char msg[256]; ctree = BROWSETAB(tab)->ctreeroot; --- 1090,1093 ---- *************** *** 1106,1114 **** close_connection(server, TRUE); ! snprintf(msg, sizeof(msg), _("Closed connection to server %s"), ! server->name); ! ! statusbar_msg(msg); ! } --- 1096,1100 ---- close_connection(server, TRUE); ! statusbar_msg(_("Closed connection to server %s"), server->name); } *************** *** 1796,1801 **** gmessage = g_string_sized_new(256); for (I = g_list_first(bases) ; I ; I = g_list_next(I)) { ! g_string_sprintf(gmessage, _("subtree search on %s"), (char *) I->data); ! statusbar_msg(gmessage->str); msg = ldap_search_s(ld, (char *) I->data, LDAP_SCOPE_SUBTREE, --- 1782,1786 ---- gmessage = g_string_sized_new(256); for (I = g_list_first(bases) ; I ; I = g_list_next(I)) { ! statusbar_msg(_("subtree search on %s"), (char *) I->data); msg = ldap_search_s(ld, (char *) I->data, LDAP_SCOPE_SUBTREE, *************** *** 1840,1849 **** } ! snprintf(message, sizeof(message), ! ngettext("One entry exported to %2$s", ! "%1$d entries exported to %2$s", num_entries), ! num_entries, filename); ! ! statusbar_msg(message); } --- 1825,1831 ---- } ! statusbar_msg(ngettext("One entry exported to %2$s", ! "%1$d entries exported to %2$s", num_entries), ! num_entries, filename); } Index: dt_oc.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/dt_oc.c,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** dt_oc.c 5 Oct 2003 13:36:11 -0000 1.16 --- dt_oc.c 8 Oct 2003 22:01:07 -0000 1.17 *************** *** 201,205 **** LDAPAttributeType *at; char **cp; - char msg[80]; /* printf("changed: %s->%s\n", oldtext, newtext); */ --- 201,204 ---- *************** *** 342,348 **** } } ! snprintf(msg, sizeof(msg), ! _("Marked %d attribute(s) to be obsolete"), n); ! statusbar_msg(msg); } } --- 341,345 ---- } } ! statusbar_msg(_("Marked %d attribute(s) to be obsolete"), n); } } *************** *** 415,421 **** ci->iform->formlist = formlist; } ! snprintf(msg, sizeof(msg), ! _("Added %d attribute(s) from new objectClass"), n); ! statusbar_msg(msg); g_free(oldtext); --- 412,416 ---- ci->iform->formlist = formlist; } ! statusbar_msg(_("Added %d attribute(s) from new objectClass"), n); g_free(oldtext); Index: errorchain.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/errorchain.c,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** errorchain.c 5 Oct 2003 13:38:06 -0000 1.14 --- errorchain.c 8 Oct 2003 22:01:07 -0000 1.15 *************** *** 177,187 **** { struct errchain *chain; - GList *I; chain = error_chain_by_context(context); assert(chain); ! I = g_list_find(chains, chain); ! chains = g_list_remove(chains, I); free_errchain(chain); --- 177,185 ---- { struct errchain *chain; chain = error_chain_by_context(context); assert(chain); ! chains = g_list_remove(chains, chain); free_errchain(chain); Index: formfill.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/formfill.c,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** formfill.c 5 Oct 2003 13:40:53 -0000 1.37 --- formfill.c 8 Oct 2003 22:01:08 -0000 1.38 *************** *** 167,171 **** { GList *formlist; - GString *message; LDAP *ld; LDAPMessage *res, *entry; --- 167,170 ---- *************** *** 183,200 **** set_busycursor(); - message = g_string_sized_new(128); #if GTK_MAJOR >= 2 ! g_string_sprintf(message, _("fetching %1$s from %2$s"), ! dn, server->name); #else { char *c = NULL; ! g_string_sprintf(message, _("fetching %1$s from %2$s"), ! c = decoded_string(dn), server->name); if (c) free(c); } #endif - statusbar_msg(message->str); - g_string_free(message, TRUE); if( (ld = open_connection(server)) == NULL) { --- 182,195 ---- set_busycursor(); #if GTK_MAJOR >= 2 ! statusbar_msg(_("fetching %1$s from %2$s"), dn, server->name); #else { char *c = NULL; ! statusbar_msg(_("fetching %1$s from %2$s"), ! c = decoded_string(dn), server->name); if (c) free(c); } #endif if( (ld = open_connection(server)) == NULL) { *************** *** 211,215 **** if(msg != LDAP_SUCCESS) { ! statusbar_msg(ldap_err2string(msg)); set_normalcursor(); close_connection(server, FALSE); --- 206,210 ---- if(msg != LDAP_SUCCESS) { ! statusbar_msg("%s", ldap_err2string(msg)); set_normalcursor(); close_connection(server, FALSE); Index: input.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/input.c,v retrieving revision 1.60 retrieving revision 1.61 diff -C2 -d -r1.60 -r1.61 *** input.c 5 Oct 2003 13:43:39 -0000 1.60 --- input.c 8 Oct 2003 22:01:10 -0000 1.61 *************** *** 348,352 **** } ! statusbar_msg(""); error_flush(detail_context); } --- 348,352 ---- } ! statusbar_msg_clear(); error_flush(detail_context); } *************** *** 1228,1232 **** { GList *newlist, *oldlist; - GString *message; LDAPMod **mods; LDAP *ld; --- 1228,1231 ---- *************** *** 1249,1261 **** dn = iform->dn; ! /* prepare message with olddn - in case we change the DN */ ! message = g_string_sized_new(256); ! #if GTK_MAJOR >= 2 ! g_string_sprintfa(message, _("modified %s"), iform->olddn); ! #else ! c = decoded_string(iform->olddn); ! g_string_sprintfa(message, _("modified %s"), c); ! if(c) free(c); ! #endif /* obtain all needed stuff from the iform ASAP, as it might be --- 1248,1253 ---- dn = iform->dn; ! /* store olddn to use with message later on - in case we change the DN */ ! olddn = g_strdup(iform->olddn); /* obtain all needed stuff from the iform ASAP, as it might be *************** *** 1271,1275 **** if( (ld = open_connection(server)) == NULL) { ! g_string_free(message, TRUE); return; } --- 1263,1267 ---- if( (ld = open_connection(server)) == NULL) { ! g_free(olddn); return; } *************** *** 1293,1299 **** error = 1; goto done; } - statusbar_msg(message->str); } --- 1285,1291 ---- error = 1; + g_free(olddn); goto done; } } *************** *** 1324,1330 **** } /* free memory */ ! statusbar_msg(message->str); if(iform->close_window) destroy_editwindow(iform); --- 1316,1331 ---- } + + #if GTK_MAJOR >= 2 + statusbar_msg(_("modified %s"), olddn); + #else + c = decoded_string(olddn); + statusbar_msg(_("modified %s"), c); + if(c) free(c); + #endif /* free memory */ ! g_free(olddn); ! if(iform->close_window) destroy_editwindow(iform); *************** *** 1338,1342 **** close_connection(server, FALSE); - if (message) g_string_free(message, TRUE); /* refresh visual if requested by browse mode */ --- 1339,1342 ---- *************** *** 1344,1351 **** refresh_subtree_new_dn(ctreeroot, node, dn, 0); } - } - int change_rdn(struct inputform *iform, int context) { --- 1344,1349 ---- *************** *** 1400,1410 **** if(!error) { #if GTK_MAJOR >= 2 ! g_string_sprintfa(message, _("modifying RDN to %s"), rdn[0]); #else ! g_string_sprintfa(message, _("modifying RDN to %s"), ! c = decoded_string(rdn[0])); if (c) free(c); #endif - statusbar_msg(message->str); /* check to see if the rdn exists as an attribute. If it --- 1398,1407 ---- if(!error) { #if GTK_MAJOR >= 2 ! statusbar_msg(_("modifying RDN to %s"), rdn[0]); #else ! statusbar_msg(_("modifying RDN to %s"), ! c = decoded_string(rdn[0])); if (c) free(c); #endif /* check to see if the rdn exists as an attribute. If it Index: schema.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/schema.c,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** schema.c 4 Oct 2003 09:59:09 -0000 1.18 --- schema.c 8 Oct 2003 22:01:12 -0000 1.19 *************** *** 97,101 **** char *attr, **vals; const char *errp; ! char subschema[60], message[80]; char *subschemasubentry[] = { "subschemaSubentry", NULL }; --- 97,101 ---- char *attr, **vals; const char *errp; ! char subschema[100]; char *subschemasubentry[] = { "subschemaSubentry", NULL }; *************** *** 124,128 **** server->server_down++; } ! statusbar_msg(ldap_err2string(msg)); close_connection(server, FALSE); return(NULL); --- 124,128 ---- server->server_down++; } ! statusbar_msg("%s", ldap_err2string(msg)); close_connection(server, FALSE); return(NULL); *************** *** 130,134 **** if(res == NULL) { ! statusbar_msg(_("no schema information found")); close_connection(server, FALSE); return(NULL); --- 130,134 ---- if(res == NULL) { ! statusbar_msg("%s", _("no schema information found")); close_connection(server, FALSE); return(NULL); *************** *** 153,163 **** if(subschema[0] == 0) { ! statusbar_msg(_("no schema information found")); close_connection(server, FALSE); return(NULL); } ! snprintf(message, sizeof(message), _("Schema search on %s"), subschema); ! statusbar_msg(message); msg = ldap_search_s(ld, subschema, LDAP_SCOPE_BASE, "(objectclass=*)", schema_attrs, 0, &res); --- 153,163 ---- if(subschema[0] == 0) { ! statusbar_msg("%s", _("no schema information found")); close_connection(server, FALSE); return(NULL); } ! statusbar_msg(_("Schema search on %s"), subschema); ! msg = ldap_search_s(ld, subschema, LDAP_SCOPE_BASE, "(objectclass=*)", schema_attrs, 0, &res); *************** *** 167,171 **** server->server_down++; } ! statusbar_msg(ldap_err2string(msg)); close_connection(server, FALSE); return(NULL); --- 167,171 ---- server->server_down++; } ! statusbar_msg("%s", ldap_err2string(msg)); close_connection(server, FALSE); return(NULL); *************** *** 173,177 **** if(res == NULL) { ! statusbar_msg(_("no schema information found")); close_connection(server, FALSE); return(NULL); --- 173,177 ---- if(res == NULL) { ! statusbar_msg("%s", _("no schema information found")); close_connection(server, FALSE); return(NULL); Index: schemabrowse.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/schemabrowse.c,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** schemabrowse.c 5 Oct 2003 13:46:50 -0000 1.18 --- schemabrowse.c 8 Oct 2003 22:01:12 -0000 1.19 *************** *** 112,116 **** struct ldapserver *server; int server_cnt = 0; - char message[128]; GList *I; --- 112,115 ---- *************** *** 121,129 **** } ! snprintf(message, sizeof(message), ! ngettext("One server found", "%d servers found", server_cnt), ! server_cnt); ! ! statusbar_msg(message); } --- 120,126 ---- } ! statusbar_msg(ngettext("One server found", "%d servers found", ! server_cnt), ! server_cnt); } *************** *** 390,394 **** GTK_SIGNAL_FUNC(attach_server_schema), NULL); } - } --- 387,390 ---- *************** *** 668,672 **** gtk_widget_show(scrwin); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrwin), ! GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); /* just about right for four lines in the top clist */ --- 664,669 ---- gtk_widget_show(scrwin); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrwin), ! GTK_POLICY_AUTOMATIC, ! GTK_POLICY_AUTOMATIC); /* just about right for four lines in the top clist */ Index: search.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/search.c,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** search.c 6 Oct 2003 06:42:06 -0000 1.41 --- search.c 8 Oct 2003 22:01:12 -0000 1.42 *************** *** 426,430 **** struct attrs *attrlist; gchar *cur_servername, *cur_searchbase, *enc_searchbase, *querystring, *cl[MAX_NUM_ATTRIBUTES]; ! char tolist[MAX_NUM_ATTRIBUTES][128], message[MAX_LDAPFILTER_LEN + 128]; char *filter, *attr, *dn, **vals, *searchterm; int msg, rc, i, row; --- 426,430 ---- struct attrs *attrlist; gchar *cur_servername, *cur_searchbase, *enc_searchbase, *querystring, *cl[MAX_NUM_ATTRIBUTES]; ! char tolist[MAX_NUM_ATTRIBUTES][128]; char *filter, *attr, *dn, **vals, *searchterm; int msg, rc, i, row; *************** *** 469,474 **** free(querystring); ! snprintf(message, sizeof(message), _("searching for %s"), filter); ! statusbar_msg(message); searchbase_combo = SEARCHTAB(tab)->searchbase_combo; --- 469,473 ---- free(querystring); ! statusbar_msg(_("searching for %s"), filter); searchbase_combo = SEARCHTAB(tab)->searchbase_combo; *************** *** 491,495 **** server->server_down++; } ! statusbar_msg(ldap_err2string(msg == -1 ? LDAP_OTHER : msg)); g_free(searchterm); close_connection(server, FALSE); --- 490,494 ---- server->server_down++; } ! statusbar_msg("%s", ldap_err2string(msg == -1 ? LDAP_OTHER : msg)); g_free(searchterm); close_connection(server, FALSE); *************** *** 657,666 **** if(rc == -1) ! statusbar_msg(ldap_err2string(msg)); else { ! snprintf(message, sizeof(message), ! ngettext("One entry found", "%d entries found", row), ! row); ! statusbar_msg(message); } --- 656,663 ---- if(rc == -1) ! statusbar_msg("%s", ldap_err2string(msg)); else { ! statusbar_msg(ngettext("One entry found", "%d entries found", row), ! row); } Index: tinput.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/tinput.c,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** tinput.c 2 Oct 2003 16:16:26 -0000 1.40 --- tinput.c 8 Oct 2003 22:01:12 -0000 1.41 *************** *** 119,123 **** server->server_down++; } ! statusbar_msg(ldap_err2string(msg)); set_normalcursor(); close_connection(server, FALSE); --- 119,123 ---- server->server_down++; } ! statusbar_msg("%s", ldap_err2string(msg)); set_normalcursor(); close_connection(server, FALSE); Index: util.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/util.c,v retrieving revision 1.62 retrieving revision 1.63 diff -C2 -d -r1.62 -r1.63 *** util.c 5 Oct 2003 13:51:35 -0000 1.62 --- util.c 8 Oct 2003 22:01:13 -0000 1.63 *************** *** 216,220 **** _("GQ was compiled without Kerberos support.\n" "Run 'configure --help' for more information\n")); ! statusbar_msg(""); ldap_unbind(ld); ld = NULL; --- 216,220 ---- _("GQ was compiled without Kerberos support.\n" "Run 'configure --help' for more information\n")); ! statusbar_msg_clear(); ldap_unbind(ld); ld = NULL; *************** *** 228,232 **** _("GQ was compiled without SASL support.\n" "Run 'configure --help' for more information\n")); ! statusbar_msg(""); ldap_unbind(ld); ld = NULL; --- 228,232 ---- _("GQ was compiled without SASL support.\n" "Run 'configure --help' for more information\n")); ! statusbar_msg_clear(); ldap_unbind(ld); ld = NULL; *************** *** 250,254 **** ldap_err2string(rc)); push_ldap_addl_error(ld, open_context); ! statusbar_msg(""); /* might as well clean this up */ ldap_unbind(ld); --- 250,254 ---- ldap_err2string(rc)); push_ldap_addl_error(ld, open_context); ! statusbar_msg_clear(); /* might as well clean this up */ ldap_unbind(ld); *************** *** 343,354 **** if(server->ldapport == 389) { ! snprintf(message, sizeof(message), ! _("connecting to %s"), server->ldaphost); } else { ! snprintf(message, sizeof(message), ! _("connecting to %1$s port %2$d"), ! server->ldaphost, server->ldapport); } - statusbar_msg(message); ld = NULL; --- 343,351 ---- if(server->ldapport == 389) { ! statusbar_msg(_("connecting to %s"), server->ldaphost); } else { ! statusbar_msg(_("connecting to %1$s port %2$d"), ! server->ldaphost, server->ldapport); } ld = NULL; *************** *** 522,527 **** } ! snprintf(message, sizeof(message), _("deleting: %s"), dn); ! statusbar_msg(message); msg = ldap_delete_s(ld, dn); --- 519,523 ---- } ! statusbar_msg(_("deleting: %s"), dn); msg = ldap_delete_s(ld, dn); *************** *** 537,543 **** } else { ! snprintf(message, sizeof(message), ! _("deleted %s"), dn); ! statusbar_msg(message); } --- 533,537 ---- } else { ! statusbar_msg(_("deleted %s"), dn); } *************** *** 713,725 **** * GTK event queue */ ! void statusbar_msg(const char *message) { ! if(!context) ! context = gtk_statusbar_get_context_id(GTK_STATUSBAR(statusbar), ! "mainwin"); ! if(msgid) ! gtk_statusbar_remove(GTK_STATUSBAR(statusbar), context, msgid); ! msgid = gtk_statusbar_push(GTK_STATUSBAR(statusbar), context, message); /* make sure statusbar gets updated right away */ --- 707,745 ---- * GTK event queue */ ! void statusbar_msg(const char *fmt, ...) { ! /* do not use g_string_sprintf, as it usually does not support ! numbered arguments */ ! int len = strlen(fmt) * 2; ! char *buf; ! int n; ! if (len > 0) { ! for (;;) { ! va_list ap; ! buf = g_malloc(len); ! *buf = 0; ! ! va_start(ap, fmt); ! n = vsnprintf(buf, len, fmt, ap); ! va_end(ap); ! ! if (n > len || n == -1) { ! g_free(buf); ! len *= 2; ! continue; ! } ! break; ! } ! } else { ! buf = g_strdup(""); ! } ! ! statusbar_msg_clear(); ! ! msgid = gtk_statusbar_push(GTK_STATUSBAR(mainwin.statusbar), ! context, buf); ! ! g_free(buf); /* make sure statusbar gets updated right away */ *************** *** 728,731 **** --- 748,763 ---- } + void statusbar_msg_clear() + { + if(!context) + context = + gtk_statusbar_get_context_id(GTK_STATUSBAR(mainwin.statusbar), + "mainwin"); + if(msgid) + gtk_statusbar_remove(GTK_STATUSBAR(mainwin.statusbar), + context, msgid); + } + + #if 0 /* not needed anymore */ /* * display message in main window's statusbar, and flushes the *************** *** 744,753 **** if(!context) ! context = gtk_statusbar_get_context_id(GTK_STATUSBAR(statusbar), "mainwin"); if(msgid) ! gtk_statusbar_remove(GTK_STATUSBAR(statusbar), context, msgid); ! msgid = gtk_statusbar_push(GTK_STATUSBAR(statusbar), context, buf); /* make sure statusbar gets updated right away */ --- 776,785 ---- if(!context) ! context = gtk_statusbar_get_context_id(GTK_STATUSBAR(mainwin.statusbar), "mainwin"); if(msgid) ! gtk_statusbar_remove(GTK_STATUSBAR(mainwin.statusbar), context, msgid); ! msgid = gtk_statusbar_push(GTK_STATUSBAR(mainwin.statusbar), context, buf); /* make sure statusbar gets updated right away */ *************** *** 758,762 **** #endif } ! /* --- 790,794 ---- #endif } ! #endif /* *************** *** 794,798 **** LDAP *ld; LDAPMessage *res; - GString *gmessage; int msg, is_leaf; --- 826,829 ---- *************** *** 806,813 **** } ! gmessage = g_string_sized_new(128); ! g_string_sprintf(gmessage, _("checking subtree for %s"), dn); ! statusbar_msg(gmessage->str); ! g_string_free(gmessage, TRUE); msg = ldap_search(ld, dn, LDAP_SCOPE_ONELEVEL, "(objectclass=*)", --- 837,841 ---- } ! statusbar_msg(_("checking subtree for %s"), dn); msg = ldap_search(ld, dn, LDAP_SCOPE_ONELEVEL, "(objectclass=*)", *************** *** 822,826 **** close_connection(server, FALSE); set_normalcursor(); ! statusbar_msg(""); return(is_leaf); --- 850,854 ---- close_connection(server, FALSE); set_normalcursor(); ! statusbar_msg_clear(); return(is_leaf); *************** *** 1468,1472 **** int msg, i; int num_suffixes = 0; ! char **vals, message[128]; char *ldapv3_config[] = { "namingcontexts", --- 1496,1500 ---- int msg, i; int num_suffixes = 0; ! char **vals; char *ldapv3_config[] = { "namingcontexts", *************** *** 1565,1573 **** close_connection(server, FALSE); ! snprintf(message, sizeof(message), ! ngettext("One suffix found", "%d suffixes found", ! num_suffixes), ! num_suffixes); ! statusbar_msg(message); return g_list_first(suffixes); --- 1593,1599 ---- close_connection(server, FALSE); ! statusbar_msg(ngettext("One suffix found", "%d suffixes found", ! num_suffixes), ! num_suffixes); return g_list_first(suffixes); Index: util.h =================================================================== RCS file: /cvsroot/gqclient/gq/src/util.h,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** util.h 2 Oct 2003 16:16:26 -0000 1.22 --- util.h 8 Oct 2003 22:01:13 -0000 1.23 *************** *** 30,33 **** --- 30,34 ---- #include "config.h" + #include <glib.h> #include <gtk/gtk.h> #include <ldap.h> *************** *** 66,70 **** const gpointer detokenize_data(struct tokenlist *list, int token); char *get_username(void); ! void statusbar_msg(const char *message); struct ldapserver *server_by_name(const char *name); int is_leaf_entry(struct ldapserver *server, char *dn); --- 67,75 ---- const gpointer detokenize_data(struct tokenlist *list, int token); char *get_username(void); ! /* G_GNUC_PRINTF is the __attribute__ ((format (printf, 1, 2))) stuff, ! but portable */ ! void statusbar_msg(const char *fmt, ...) G_GNUC_PRINTF(1, 2); ! void statusbar_msg_clear(); ! struct ldapserver *server_by_name(const char *name); int is_leaf_entry(struct ldapserver *server, char *dn); |