comparison 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
comparison
equal deleted inserted replaced
5958:b432fa240263 5959:0a2a32b1917c
108 static void 108 static void
109 pounce_update_entryfields(GtkWidget *w, gpointer data) 109 pounce_update_entryfields(GtkWidget *w, gpointer data)
110 { 110 {
111 const char *filename; 111 const char *filename;
112 GHashTable *args; 112 GHashTable *args;
113 GtkFileSelection *filesel;
113 114
114 args = (GHashTable *)data; 115 args = (GHashTable *)data;
115 116 filesel = GTK_FILE_SELECTION(g_hash_table_lookup(args, "filesel"));
116 filename = gtk_file_selection_get_filename(GTK_FILE_SELECTION( 117
117 g_hash_table_lookup(args, "filesel"))); 118 filename = gtk_file_selection_get_filename(filesel);
119
120 if (file_is_dir(filename, filesel))
121 return;
118 122
119 if (filename != NULL) 123 if (filename != NULL)
120 gtk_entry_set_text(GTK_ENTRY(g_hash_table_lookup(args, "entry")), 124 gtk_entry_set_text(GTK_ENTRY(g_hash_table_lookup(args, "entry")),
121 filename); 125 filename);
122 126
123 g_free(args); 127 gtk_widget_destroy(GTK_WIDGET(filesel));
128 g_hash_table_destroy(args);
124 } 129 }
125 130
126 static void 131 static void
127 filesel(GtkWidget *w, gpointer data) 132 filesel(GtkWidget *w, gpointer data)
128 { 133 {
136 gtk_file_selection_set_filename(GTK_FILE_SELECTION(filesel), 141 gtk_file_selection_set_filename(GTK_FILE_SELECTION(filesel),
137 gtk_entry_get_text(GTK_ENTRY(entry))); 142 gtk_entry_get_text(GTK_ENTRY(entry)));
138 gtk_file_selection_hide_fileop_buttons(GTK_FILE_SELECTION(filesel)); 143 gtk_file_selection_hide_fileop_buttons(GTK_FILE_SELECTION(filesel));
139 gtk_file_selection_set_select_multiple(GTK_FILE_SELECTION(filesel), FALSE); 144 gtk_file_selection_set_select_multiple(GTK_FILE_SELECTION(filesel), FALSE);
140 145
141 args = g_hash_table_new(g_str_hash,g_str_equal); 146 args = g_hash_table_new(g_str_hash, g_str_equal);
142 g_hash_table_insert(args, "filesel", filesel); 147 g_hash_table_insert(args, "filesel", filesel);
143 g_hash_table_insert(args, "entry", entry); 148 g_hash_table_insert(args, "entry", entry);
144 149
145 g_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(filesel)->ok_button), 150 g_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(filesel)->ok_button),
146 "clicked", 151 "clicked",
147 G_CALLBACK(pounce_update_entryfields), args); 152 G_CALLBACK(pounce_update_entryfields), args);
148 153 g_signal_connect_swapped(G_OBJECT(GTK_FILE_SELECTION(filesel)->cancel_button),
149 g_signal_connect_swapped(G_OBJECT(GTK_FILE_SELECTION(filesel)->ok_button),
150 "clicked", 154 "clicked",
151 G_CALLBACK(gtk_widget_destroy), filesel); 155 G_CALLBACK(g_hash_table_destroy), args);
152
153 g_signal_connect_swapped(G_OBJECT(GTK_FILE_SELECTION(filesel)->cancel_button), 156 g_signal_connect_swapped(G_OBJECT(GTK_FILE_SELECTION(filesel)->cancel_button),
154 "clicked", 157 "clicked",
155 G_CALLBACK(gtk_widget_destroy), filesel); 158 G_CALLBACK(gtk_widget_destroy), filesel);
156 159
157 gtk_widget_show(filesel); 160 gtk_widget_show(filesel);