comparison src/gtkconv.c @ 8557:fcb03dabbc53

[gaim-migrate @ 9301] " This patch makes conversation text get added to the history buffer so that the Save As menu item actually saves something useful. As the patch is now, it breaks the string freeze, though someone could probably adapt it to not do so if we wanted this to be back in gaim for 0.76." --Kevin Stange committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Fri, 02 Apr 2004 06:02:15 +0000
parents 008e4576dbfc
children 7dcd6f26e4a7
comparison
equal deleted inserted replaced
8556:267050247da9 8557:fcb03dabbc53
143 **************************************************************************/ 143 **************************************************************************/
144 static void 144 static void
145 do_save_convo(GtkWidget *wid) 145 do_save_convo(GtkWidget *wid)
146 { 146 {
147 GaimConversation *conv; 147 GaimConversation *conv;
148 const char *name;
148 const char *filename; 149 const char *filename;
149 FILE *fp; 150 FILE *fp;
150 151
151 conv = g_object_get_data(G_OBJECT(GTK_FILE_SELECTION(wid)->ok_button), 152 conv = g_object_get_data(G_OBJECT(GTK_FILE_SELECTION(wid)->ok_button),
152 "gaim_conversation"); 153 "gaim_conversation");
165 return; 166 return;
166 167
167 if ((fp = fopen(filename, "w+")) == NULL) 168 if ((fp = fopen(filename, "w+")) == NULL)
168 return; 169 return;
169 170
171 name = gaim_conversation_get_name(conv);
172
173 fprintf(fp, _("<h1>Conversation with %s</h1>\n"), name);
170 fprintf(fp, "%s", conv->history->str); 174 fprintf(fp, "%s", conv->history->str);
171 175
172 fclose(fp); 176 fclose(fp);
173 } 177 }
174 178
3067 char buf[BUF_LONG]; 3071 char buf[BUF_LONG];
3068 GtkWidget *window; 3072 GtkWidget *window;
3069 3073
3070 window = gtk_file_selection_new(_("Save Conversation")); 3074 window = gtk_file_selection_new(_("Save Conversation"));
3071 3075
3072 g_snprintf(buf, sizeof(buf), "%s" G_DIR_SEPARATOR_S "%s.log", 3076 g_snprintf(buf, sizeof(buf), "%s" G_DIR_SEPARATOR_S "%s.html",
3073 gaim_home_dir(), gaim_normalize(c->account, c->name)); 3077 gaim_home_dir(), gaim_normalize(c->account, c->name));
3074 gtk_file_selection_set_filename(GTK_FILE_SELECTION(window), buf); 3078 gtk_file_selection_set_filename(GTK_FILE_SELECTION(window), buf);
3075 g_object_set_data(G_OBJECT(GTK_FILE_SELECTION(window)->ok_button), 3079 g_object_set_data(G_OBJECT(GTK_FILE_SELECTION(window)->ok_button),
3076 "gaim_conversation", c); 3080 "gaim_conversation", c);
3077 g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(window)->ok_button), 3081 g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(window)->ok_button),
4624 gtk_imhtml_append_text_with_images(GTK_IMHTML(gtkconv->imhtml), 4628 gtk_imhtml_append_text_with_images(GTK_IMHTML(gtkconv->imhtml),
4625 with_font_tag, gtk_font_options, images); 4629 with_font_tag, gtk_font_options, images);
4626 4630
4627 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), "<BR>", 0); 4631 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), "<BR>", 0);
4628 4632
4629 /*conv->history = g_string_append(conv->history, t1); 4633 conv->history = g_string_append(conv->history, buf);
4630 conv->history = g_string_append(conv->history, t2); 4634 conv->history = g_string_append(conv->history, new_message);
4631 conv->history = g_string_append(conv->history, "\n"); 4635 conv->history = g_string_append(conv->history, "<BR>\n");
4632
4633 g_free(t1);
4634 g_free(t2); */
4635 4636
4636 g_free(with_font_tag); 4637 g_free(with_font_tag);
4637 g_free(new_message); 4638 g_free(new_message);
4638 } 4639 }
4639 4640