comparison src/dialogs.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 b432fa240263
children 5fb6bd688a5b
comparison
equal deleted inserted replaced
5958:b432fa240263 5959:0a2a32b1917c
2493 file = gtk_file_selection_get_filename( 2493 file = gtk_file_selection_get_filename(
2494 GTK_FILE_SELECTION(gtkconv->dialogs.log)); 2494 GTK_FILE_SELECTION(gtkconv->dialogs.log));
2495 2495
2496 strncpy(path, file, PATHSIZE - 1); 2496 strncpy(path, file, PATHSIZE - 1);
2497 2497
2498 if (file_is_dir(path, gtkconv->dialogs.log)) 2498 if (file_is_dir(path, GTK_FILE_SELECTION(gtkconv->dialogs.log)))
2499 return; 2499 return;
2500 2500
2501 l = (struct log_conversation *)g_new0(struct log_conversation, 1); 2501 l = (struct log_conversation *)g_new0(struct log_conversation, 1);
2502 strcpy(l->name, gaim_conversation_get_name(c)); 2502 strcpy(l->name, gaim_conversation_get_name(c));
2503 strcpy(l->filename, file); 2503 strcpy(l->filename, file);
3804 g_snprintf(filename, PATHSIZE, "%s" G_DIR_SEPARATOR_S "logs" G_DIR_SEPARATOR_S "%s%s", tmp, 3804 g_snprintf(filename, PATHSIZE, "%s" G_DIR_SEPARATOR_S "logs" G_DIR_SEPARATOR_S "%s%s", tmp,
3805 name ? normalize(name) : "system", name ? ".log" : ""); 3805 name ? normalize(name) : "system", name ? ".log" : "");
3806 3806
3807 file = (const char*)gtk_file_selection_get_filename(GTK_FILE_SELECTION(filesel)); 3807 file = (const char*)gtk_file_selection_get_filename(GTK_FILE_SELECTION(filesel));
3808 strncpy(path, file, PATHSIZE - 1); 3808 strncpy(path, file, PATHSIZE - 1);
3809 if (file_is_dir(path, filesel)) 3809 if (file_is_dir(path, GTK_FILE_SELECTION(filesel)))
3810 return; 3810 return;
3811 3811
3812 if ((fp_new = fopen(path, "w")) == NULL) { 3812 if ((fp_new = fopen(path, "w")) == NULL) {
3813 g_snprintf(error, BUF_LONG, 3813 g_snprintf(error, BUF_LONG,
3814 _("Couldn't write to %s."), path); 3814 _("Couldn't write to %s."), path);
4502 4502
4503 gtk_widget_show_all(bbox); 4503 gtk_widget_show_all(bbox);
4504 return button; 4504 return button;
4505 } 4505 }
4506 4506
4507 int file_is_dir(const char *path, GtkWidget *w) 4507 int file_is_dir(const char *path, GtkFileSelection *w)
4508 { 4508 {
4509 struct stat st; 4509 struct stat st;
4510 char *name; 4510 char *name;
4511 4511
4512 if (stat(path, &st) == 0 && S_ISDIR(st.st_mode)) { 4512 if (stat(path, &st) == 0 && S_ISDIR(st.st_mode)) {
4514 if (path[strlen(path) - 1] != '/') { 4514 if (path[strlen(path) - 1] != '/') {
4515 name = g_strconcat(path, "/", NULL); 4515 name = g_strconcat(path, "/", NULL);
4516 } else { 4516 } else {
4517 name = g_strdup(path); 4517 name = g_strdup(path);
4518 } 4518 }
4519 gtk_file_selection_set_filename(GTK_FILE_SELECTION(w), name); 4519 gtk_file_selection_set_filename(w, name);
4520 g_free(name); 4520 g_free(name);
4521 return 1; 4521 return 1;
4522 } 4522 }
4523 4523
4524 return 0; 4524 return 0;