comparison src/dialogs.c @ 5966:5fb6bd688a5b

[gaim-migrate @ 6413] I renamed file_is_dir to gaim_gtk_check_if_dir and moved it to gtkutils.c/h Chipster (or whoever) - Lemme know if that's notsogood, remember: I pretend not to know anything about gtk. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Fri, 27 Jun 2003 23:11:21 +0000
parents 0a2a32b1917c
children 730015652f4d
comparison
equal deleted inserted replaced
5965:cd8f8e5d697e 5966:5fb6bd688a5b
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, GTK_FILE_SELECTION(gtkconv->dialogs.log))) 2498 if (gaim_gtk_check_if_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, GTK_FILE_SELECTION(filesel))) 3809 if (gaim_gtk_check_if_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);
4500 gtk_box_pack_start(GTK_BOX(lbox), label, FALSE, FALSE, 0); 4500 gtk_box_pack_start(GTK_BOX(lbox), label, FALSE, FALSE, 0);
4501 } 4501 }
4502 4502
4503 gtk_widget_show_all(bbox); 4503 gtk_widget_show_all(bbox);
4504 return button; 4504 return button;
4505 }
4506
4507 int file_is_dir(const char *path, GtkFileSelection *w)
4508 {
4509 struct stat st;
4510 char *name;
4511
4512 if (stat(path, &st) == 0 && S_ISDIR(st.st_mode)) {
4513 /* append a / if needed */
4514 if (path[strlen(path) - 1] != '/') {
4515 name = g_strconcat(path, "/", NULL);
4516 } else {
4517 name = g_strdup(path);
4518 }
4519 gtk_file_selection_set_filename(w, name);
4520 g_free(name);
4521 return 1;
4522 }
4523
4524 return 0;
4525 } 4505 }
4526 4506
4527 /*------------------------------------------------------------------------*/ 4507 /*------------------------------------------------------------------------*/
4528 /* The dialog for setting V-Card info */ 4508 /* The dialog for setting V-Card info */
4529 /*------------------------------------------------------------------------*/ 4509 /*------------------------------------------------------------------------*/