--- src.orig/link.c Wed Apr 7 22:18:26 2004 +++ src/link.c Mon Oct 11 13:13:16 2004 @@ -254,11 +254,12 @@ void link_jam_dialog_run(GtkWindow *win, JamDoc *doc) { GtkWidget *dlg; - GtkWidget *vbox, *hbox, *entry, *omenu; + GtkWidget *vbox, *hbox, *entry, *entry_name, *omenu; GtkSizeGroup *sizegroup; GtkTextBuffer *buffer; GtkTextIter start, end; char *username = NULL; + char *usernick = NULL; int usertype; gboolean selection = FALSE; @@ -288,6 +289,11 @@ hbox = labelled_box_new_sg(_("_Username:"), entry, sizegroup); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); + entry_name = gtk_entry_new(); + gtk_entry_set_activates_default(GTK_ENTRY(entry_name), TRUE); + hbox = labelled_box_new_sg(_("_Nickname:"), entry_name, sizegroup); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); + omenu = make_usertype_omenu(); hbox = labelled_box_new_sg(_("User _Type:"), omenu, sizegroup); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); @@ -299,6 +305,7 @@ return; } username = gtk_editable_get_chars(GTK_EDITABLE(entry), 0, -1); + usernick = gtk_editable_get_chars(GTK_EDITABLE(entry_name), 0, -1); usertype = gtk_option_menu_get_history(GTK_OPTION_MENU(omenu)); gtk_widget_destroy(dlg); if (username[0] == 0) { @@ -312,14 +319,46 @@ gtk_text_buffer_get_iter_at_mark(buffer, &start, gtk_text_buffer_get_insert(buffer)); - gtk_text_buffer_insert(buffer, &start, "", -1); + if (strlen(usernick) == 0) { + gtk_text_buffer_insert(buffer, &start, "", -1); + } else { + char *link; + char *img; + JamAccount *acc = jam_doc_get_account(doc); + + xml_escape(&username); + xml_escape(&usernick); + + if (usertype == 0) + img = g_strdup("userinfo.gif"); + else + img = g_strdup("community.gif"); + + link = g_strdup_printf( + "[info]%s", + jam_account_lj_get_server(JAM_ACCOUNT_LJ(acc))->url, + username, + jam_account_lj_get_server(JAM_ACCOUNT_LJ(acc))->url, + img, + jam_account_lj_get_server(JAM_ACCOUNT_LJ(acc))->url, + username, + usernick); + + gtk_text_buffer_insert(buffer, &start, link, -1); + + g_free(link); + g_free(img); + g_free(username); + g_free(usernick); + } }