--- link-journal.c.orig Tue Feb 7 09:00:43 2006
+++ link-journal.c Tue Feb 7 09:17:09 2006
@@ -44,11 +44,12 @@
void
link_journal_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;
@@ -78,6 +79,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);
@@ -89,6 +95,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) {
@@ -102,14 +109,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(
+ "%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);
+ free(username);
+ free(usernick);
+ }
}