changeset 5934:91ee71a394be

[gaim-migrate @ 6374] Moved save_convo() to gtkconv.c. Only gtkconv.c uses it. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Sat, 21 Jun 2003 07:35:19 +0000
parents 44eb6d75a5c6
children e11b904c5bd7
files src/gtkconv.c src/log.c src/log.h
diffstat 3 files changed, 52 insertions(+), 46 deletions(-) [+]
line wrap: on
line diff
--- a/src/gtkconv.c	Sat Jun 21 04:10:03 2003 +0000
+++ b/src/gtkconv.c	Sat Jun 21 07:35:19 2003 +0000
@@ -135,11 +135,43 @@
 static void update_typing_icon(GaimConversation *conv);
 static gboolean update_send_as_selection(GaimWindow *win);
 static char *item_factory_translate_func (const char *path, gpointer func_data);
+static void save_convo(GtkWidget *save, GaimConversation *c);
 
 /**************************************************************************
  * Callbacks
  **************************************************************************/
 static void
+do_save_convo(GObject *obj, GtkWidget *wid)
+{
+	GaimConversation *c = g_object_get_data(obj, "gaim_conversation");
+	const char *filename;
+	FILE *fp;
+
+	filename = gtk_file_selection_get_filename(GTK_FILE_SELECTION(wid));
+
+	if (file_is_dir(filename, wid))
+		return;
+
+	if (!((gaim_conversation_get_type(c) != GAIM_CONV_CHAT &&
+		   g_list_find(gaim_get_ims(), c)) ||
+		  (gaim_conversation_get_type(c) == GAIM_CONV_CHAT &&
+		   g_list_find(gaim_get_chats(), c))))
+ 		filename = NULL;
+
+	gtk_widget_destroy(wid);
+
+	if (filename == NULL)
+		return;
+
+	if ((fp = fopen(filename, "w+")) == NULL)
+		return;
+
+	fprintf(fp, "%s", c->history->str);
+
+	fclose(fp);
+}
+
+static void
 do_insert_image_cb(GObject *obj, GtkWidget *wid)
 {
 	GaimConversation *conv;
@@ -2694,6 +2726,26 @@
 	return FALSE;
 }
 
+static void
+save_convo(GtkWidget *save, GaimConversation *c)
+{
+	char buf[BUF_LONG];
+	GtkWidget *window;
+
+	window = gtk_file_selection_new(_("Gaim - Save Conversation"));
+
+	g_snprintf(buf, sizeof(buf), "%s" G_DIR_SEPARATOR_S "%s.log",
+			   gaim_home_dir(), normalize(c->name));
+	gtk_file_selection_set_filename(GTK_FILE_SELECTION(window), buf);
+	g_object_set_data(G_OBJECT(GTK_FILE_SELECTION(window)->ok_button),
+			"gaim_conversation", c);
+	g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(window)->ok_button),
+			   "clicked", G_CALLBACK(do_save_convo), window);
+	g_signal_connect_swapped(G_OBJECT(GTK_FILE_SELECTION(window)->cancel_button),
+				  "clicked", G_CALLBACK(gtk_widget_destroy), (gpointer)window);
+	gtk_widget_show(window);
+}
+
 static GtkItemFactoryEntry menu_items[] =
 {
 	/* Conversation menu */
--- a/src/log.c	Sat Jun 21 04:10:03 2003 +0000
+++ b/src/log.c	Sat Jun 21 07:35:19 2003 +0000
@@ -86,51 +86,6 @@
 	}
 }
 
-static void do_save_convo(GObject *obj, GtkWidget *wid)
-{
-	GaimConversation *c = g_object_get_data(obj, "gaim_conversation");
-	const char *filename = gtk_file_selection_get_filename(GTK_FILE_SELECTION(wid));
-	FILE *f;
-
-	if (file_is_dir(filename, wid))
-		return;
-
-	if (!((gaim_conversation_get_type(c) != GAIM_CONV_CHAT &&
-		   g_list_find(gaim_get_ims(), c)) ||
-		  (gaim_conversation_get_type(c) == GAIM_CONV_CHAT &&
-		   g_list_find(gaim_get_chats(), c))))
- 		filename = NULL;
-
-	gtk_widget_destroy(wid);
-
-	if (!filename)
-		return;
-
-	f = fopen(filename, "w+");
-
-	if (!f)
-		return;
-
-	fprintf(f, "%s", c->history->str);
-	fclose(f);
-}
-
-
-void save_convo(GtkWidget *save, GaimConversation *c)
-{
-	char buf[BUF_LONG];
-	GtkWidget *window = gtk_file_selection_new(_("Gaim - Save Conversation"));
-	g_snprintf(buf, sizeof(buf), "%s" G_DIR_SEPARATOR_S "%s.log", gaim_home_dir(), normalize(c->name));
-	gtk_file_selection_set_filename(GTK_FILE_SELECTION(window), buf);
-	g_object_set_data(G_OBJECT(GTK_FILE_SELECTION(window)->ok_button),
-			"gaim_conversation", c);
-	g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(window)->ok_button),
-			   "clicked", G_CALLBACK(do_save_convo), window);
-	g_signal_connect_swapped(G_OBJECT(GTK_FILE_SELECTION(window)->cancel_button),
-				  "clicked", G_CALLBACK(gtk_widget_destroy), (gpointer)window);
-	gtk_widget_show(window);
-}
-
 static FILE *open_gaim_log_file(const char *name, int *flag)
 {
 	char *buf;
--- a/src/log.h	Sat Jun 21 04:10:03 2003 +0000
+++ b/src/log.h	Sat Jun 21 07:35:19 2003 +0000
@@ -57,7 +57,6 @@
 void rm_log(struct log_conversation *);
 struct log_conversation *find_log_info(const char *);
 void update_log_convs();
-void save_convo(GtkWidget *save, GaimConversation *c);
 char *html_logize(const char *p);
 
 #endif /* _GAIM_LOG_H_ */