diff src/gtkpounce.c @ 5959:0a2a32b1917c

[gaim-migrate @ 6405] Some minor UI fixes from yours truely: -Closing a conversation that has a "select image to insert" dialog open now also closes and frees the "select image to insert" dialog. -The buddy icon selection dialog now lets you type, eg "~/.gaim/icons" and hit enter without it thinking you've selected "~/.gaim/icons" as your buddy icon. It will instead change the icon selection dialog to that directory. -Same for the "select file to send" dialog. -Same for the right-click-on-an-icon "save icon" dialog. -Same for the right-click-on-an-IM-image "save image" dialog. -Same for buddy pounce "select sound" and "select program" dialogs. I think there is a small leak here, but I don't have time to figure it out. Someone should memprof this. I think it's gtkpounce.c line 140. -Same for toc's "select file to send" dialog. This needs to change-- toc has gtk code in it. -Made file_is_dir() accept a GtkFileSelection rather than a GtkWidget (there is no reason it would need to accept anything other than a GtkFileSelection) -Some minor pounce dialog memleak fixes, I think. The hash table wasn't getting freed on cancel. Line 4960 of gtkconv.c might be leaking somehow. Someone should look into that. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Thu, 26 Jun 2003 02:01:56 +0000
parents 3034a6ea2d89
children 5fb6bd688a5b
line wrap: on
line diff
--- a/src/gtkpounce.c	Wed Jun 25 22:30:49 2003 +0000
+++ b/src/gtkpounce.c	Thu Jun 26 02:01:56 2003 +0000
@@ -110,17 +110,22 @@
 {
 	const char *filename;
 	GHashTable *args;
+	GtkFileSelection *filesel;
 
 	args = (GHashTable *)data;
+	filesel = GTK_FILE_SELECTION(g_hash_table_lookup(args, "filesel"));
 
-	filename = gtk_file_selection_get_filename(GTK_FILE_SELECTION(
-				g_hash_table_lookup(args, "filesel")));
+	filename = gtk_file_selection_get_filename(filesel);
+
+	if (file_is_dir(filename, filesel))
+		return;
 
 	if (filename != NULL)
 		gtk_entry_set_text(GTK_ENTRY(g_hash_table_lookup(args, "entry")),
 						   filename);
 
-	g_free(args);
+	gtk_widget_destroy(GTK_WIDGET(filesel));
+	g_hash_table_destroy(args);
 }
 
 static void
@@ -138,18 +143,16 @@
 	gtk_file_selection_hide_fileop_buttons(GTK_FILE_SELECTION(filesel));
 	gtk_file_selection_set_select_multiple(GTK_FILE_SELECTION(filesel), FALSE);
 
-	args = g_hash_table_new(g_str_hash,g_str_equal);
+	args = g_hash_table_new(g_str_hash, g_str_equal);
 	g_hash_table_insert(args, "filesel", filesel);
 	g_hash_table_insert(args, "entry",   entry);
 
 	g_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(filesel)->ok_button),
 					 "clicked",
 					 G_CALLBACK(pounce_update_entryfields), args);
-
-	g_signal_connect_swapped(G_OBJECT(GTK_FILE_SELECTION(filesel)->ok_button),
+	g_signal_connect_swapped(G_OBJECT(GTK_FILE_SELECTION(filesel)->cancel_button),
 							 "clicked",
-							 G_CALLBACK(gtk_widget_destroy), filesel);
-
+							 G_CALLBACK(g_hash_table_destroy), args);
 	g_signal_connect_swapped(G_OBJECT(GTK_FILE_SELECTION(filesel)->cancel_button),
 							 "clicked",
 							 G_CALLBACK(gtk_widget_destroy), filesel);