sprintf(kappbarmsg,_("Kanji found: %d"),count_kanji(klinklist)); gnome_appbar_set_status(GNOME_APPBAR(kanjiDic->appbar_kanji),kappbarmsg);
snprintf(kappbarmsg, 100, _("Kanji found: %d"), count_kanji(klinklist)); gnome_appbar_set_status(GNOME_APPBAR(kanjiDic->appbar_kanji), kappbarmsg);
void on_kanji_search() {  static gchar *kentry, *radentry;  int found;  int i, j;  int stroke, plus_min;  struct knode *node_ptr;  gchar kappbarmsg[100];  int push;  GtkWidget *kanji_result_button;  gchar kanji_result_str[6];  gchar kanji_result_labelstr[100];  GtkWidget *kanji_result_label;	GtkTextChildAnchor *kanji_results_anchor;  gnome_appbar_set_status(GNOME_APPBAR(kanjiDic->appbar_kanji),_("Searching..."));  kappbarmsg[0] = 0;  gtk_text_buffer_set_text(GTK_TEXT_BUFFER(kanjiDic->kanji_results_buffer), "", 0);  gtk_text_buffer_get_start_iter(kanjiDic->kanji_results_buffer, &kanjiDic->kanji_results_iter);  push = TRUE;  if (kentry != NULL) //Check if we need to save the key entry in the history    if (strcmp(kentry, gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(kanjiDic->combo_entry_key)->entry))) == 0) {        push = FALSE;      g_free(kentry);    }  kentry = g_strdup(gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(kanjiDic->combo_entry_key)->entry)));  //printf("KEY:%s\n", kentry);  if (kentry != NULL)    if ((strlen(kentry) > 0) && (push == TRUE) ) {      kanjiDic->combo_entry_key_glist = g_list_prepend(kanjiDic->combo_entry_key_glist, kentry);      gtk_combo_set_popdown_strings(GTK_COMBO(kanjiDic->combo_entry_key),kanjiDic->combo_entry_key_glist);    }  push = TRUE;  if (radentry != NULL) //Check if we need to save the radical entry in the history    if (strcmp(radentry, gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(kanjiDic->combo_entry_radical)->entry))) == 0) {  	push = FALSE;	g_free(radentry);      }    radentry = g_strdup(gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(kanjiDic->combo_entry_radical)->entry)));  if (radentry) {    if ((strlen(radentry) > 0) && push) {      kanjiDic->combo_entry_radical_glist = g_list_prepend(kanjiDic->combo_entry_radical_glist, radentry);      gtk_combo_set_popdown_strings(GTK_COMBO(kanjiDic->combo_entry_radical),				    kanjiDic->combo_entry_radical_glist);    }  }  stroke = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(kanjiDic->spinb_strokenum));  plus_min = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(kanjiDic->spinb_plusmin));  if (klinklist != NULL) klist_free(&klinklist);  tmpklinklist = NULL;  klinklist = NULL;  found = TRUE;  //FIND BY RADICAL  if ((GTK_TOGGLE_BUTTON(kanjiDic->checkb_radical)->active) && (g_utf8_strlen(radentry, -1) > 0)) {    findk_by_radical(radentry);     if (klinklist == NULL) {      gnome_appbar_set_status(GNOME_APPBAR(kanjiDic->appbar_kanji),_("No such kanji with this radical combination."));      return;    }  }  //FIND BY STROKE  if (GTK_TOGGLE_BUTTON(kanjiDic->checkb_stroke)->active) {    if ((stroke < 1) || (stroke > 30)) {      	gnome_appbar_set_status(GNOME_APPBAR(kanjiDic->appbar_kanji),				_("Invalid stroke count :-P "));	return;    }    if (klinklist == NULL) {      findk_by_stroke(stroke, plus_min, &klinklist);  // this should! give results      if (klinklist == NULL) {	gnome_appbar_set_status(GNOME_APPBAR(kanjiDic->appbar_kanji),				_("Stroke search didn't find any match :-O "));	return;      }    }    else {      findk_by_stroke(stroke, plus_min, &tmpklinklist);      klists_merge(&klinklist,&tmpklinklist);       if (klinklist == NULL) {  	found = FALSE; 	gnome_appbar_set_status(GNOME_APPBAR(kanjiDic->appbar_kanji),				_("No such kanji with this stroke/radical combination.")); 	return;      }    }  }  //FIND BY KEY  if ((found) && (GTK_TOGGLE_BUTTON(kanjiDic->checkb_ksearch)->active) && (strlen(kentry) >= 1)) {    if (klinklist == NULL) findk_by_key(kentry, &klinklist);    else {      findk_by_key(kentry, &tmpklinklist);      klists_merge(&klinklist,&tmpklinklist);    }    if (klinklist == NULL) {          gnome_appbar_set_status(GNOME_APPBAR(kanjiDic->appbar_kanji), _("No Matches found!"));      return;    }  }    sprintf(kappbarmsg,_("Kanji found: %d"),count_kanji(klinklist));  gnome_appbar_set_status(GNOME_APPBAR(kanjiDic->appbar_kanji),kappbarmsg);  if (count_kanji(klinklist) == 1) print_kanjinfo(klinklist->kanji);    // PRINT OUT KANJI FOUND  node_ptr = klinklist;  i = 0;  while (node_ptr != NULL) {     for (j = 0; j < 5; j++) kanji_result_str[j] = 0;    g_unichar_to_utf8(node_ptr->kanji, kanji_result_str);    //printf("%s\n", kanji_result_str);    g_snprintf(kanji_result_labelstr, 100, "<span size=\"xx-large\">%s</span>", kanji_result_str);     kanji_results_anchor = gtk_text_buffer_create_child_anchor(kanjiDic->kanji_results_buffer, &kanjiDic->kanji_results_iter);        if (gjitenApp->conf->bigkanji == TRUE) {      kanji_result_label = gtk_label_new(NULL);      gtk_label_set_markup(GTK_LABEL(kanji_result_label), kanji_result_labelstr);      gtk_widget_show(kanji_result_label);      kanji_result_button = gtk_button_new();      gtk_container_add(GTK_CONTAINER(kanji_result_button), kanji_result_label);    }    else {     kanji_result_label = gtk_label_new(kanji_result_str);     gtk_widget_show(kanji_result_label);     kanji_result_button = gtk_button_new();     gtk_container_add(GTK_CONTAINER(kanji_result_button), kanji_result_label);    }    if ((gjitenApp->conf->normalfont != NULL) && gjitenApp->conf->normalfont_desc != NULL) {      gtk_widget_modify_font(kanji_result_label, gjitenApp->conf->normalfont_desc);    }    gtk_widget_show(kanji_result_button);    g_signal_connect_swapped(G_OBJECT(kanji_result_button), "clicked", G_CALLBACK(kanji_selected), 			     (gpointer) &(node_ptr->kanji));    gtk_text_view_add_child_at_anchor(GTK_TEXT_VIEW(kanjiDic->kanji_results_view), kanji_result_button, kanji_results_anchor);    node_ptr = node_ptr->next;  }}