Mercurial > gftp.yaz
comparison src/gtk/menu-items.c @ 48:e5f6054590b5
2002-11-5 Brian Masney <masneyb@gftp.org>
* lib/*.c src/gtk/*.c - removed function declarations for the static
functions from the top of the file. I had to rearrange the order of a
bunch of functions to avoid compiler warnings
* lib/gftp.h - include sys/sysmacros.h. If major() and minor() isn't
defined, give a compiler warning and define our own
* lib/local.c (local_get_next_file) - if this file is a device, store
the major/minor number in the file size
* src/gtk/misc-gtk.c (add_file_listbox) - if this file is a device,
use the major() and minor() macros to display the major and minor number
author | masneyb |
---|---|
date | Wed, 06 Nov 2002 02:20:25 +0000 |
parents | eec25f215772 |
children | a12bcbc2fce4 |
comparison
equal
deleted
inserted
replaced
47:eec25f215772 | 48:e5f6054590b5 |
---|---|
17 /* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ | 17 /* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ |
18 /*****************************************************************************/ | 18 /*****************************************************************************/ |
19 | 19 |
20 #include <gftp-gtk.h> | 20 #include <gftp-gtk.h> |
21 static const char cvsid[] = "$Id$"; | 21 static const char cvsid[] = "$Id$"; |
22 | |
23 static int do_change_dir ( gftp_window_data * wdata, | |
24 char * directory ); | |
25 static void *do_change_dir_thread ( void * data ); | |
26 | 22 |
27 void | 23 void |
28 change_setting (gftp_window_data * wdata, int menuitem, GtkWidget * checkmenu) | 24 change_setting (gftp_window_data * wdata, int menuitem, GtkWidget * checkmenu) |
29 { | 25 { |
30 switch (menuitem) | 26 switch (menuitem) |
420 MakeEditDialog (_("Site"), _("Enter site-specific command"), NULL, 1, | 416 MakeEditDialog (_("Site"), _("Enter site-specific command"), NULL, 1, |
421 NULL, gftp_dialog_button_ok, dosite, wdata, NULL, NULL); | 417 NULL, gftp_dialog_button_ok, dosite, wdata, NULL, NULL); |
422 } | 418 } |
423 | 419 |
424 | 420 |
421 static void * | |
422 do_change_dir_thread (void * data) | |
423 { | |
424 gftp_window_data * wdata; | |
425 int success, sj; | |
426 | |
427 wdata = data; | |
428 wdata->request->user_data = (void *) 0x01; | |
429 | |
430 if (wdata->request->use_threads) | |
431 { | |
432 sj = sigsetjmp (jmp_environment, 1); | |
433 use_jmp_environment = 1; | |
434 } | |
435 else | |
436 sj = 0; | |
437 | |
438 success = 0; | |
439 if (sj == 0) | |
440 { | |
441 if (wdata->request->network_timeout > 0) | |
442 alarm (wdata->request->network_timeout); | |
443 success = gftp_set_directory (wdata->request, wdata->request->directory); | |
444 alarm (0); | |
445 } | |
446 else | |
447 { | |
448 gftp_disconnect (wdata->request); | |
449 wdata->request->logging_function (gftp_logging_error, | |
450 wdata->request->user_data, | |
451 _("Operation canceled\n")); | |
452 } | |
453 | |
454 if (wdata->request->use_threads) | |
455 use_jmp_environment = 0; | |
456 | |
457 wdata->request->user_data = NULL; | |
458 wdata->request->stopable = 0; | |
459 return ((void *) success); | |
460 } | |
461 | |
462 | |
463 static int | |
464 do_change_dir (gftp_window_data * wdata, char *directory) | |
465 { | |
466 char *olddir; | |
467 int ret; | |
468 | |
469 if (directory != wdata->request->directory) | |
470 { | |
471 olddir = wdata->request->directory; | |
472 wdata->request->directory = g_malloc (strlen (directory) + 1); | |
473 strcpy (wdata->request->directory, directory); | |
474 } | |
475 else | |
476 olddir = NULL; | |
477 | |
478 ret = (int) generic_thread (do_change_dir_thread, wdata); | |
479 | |
480 if (!GFTP_IS_CONNECTED (wdata->request)) | |
481 { | |
482 disconnect (wdata); | |
483 if (olddir != NULL) | |
484 g_free (olddir); | |
485 return (-2); | |
486 } | |
487 | |
488 if (ret != 0) | |
489 { | |
490 g_free (wdata->request->directory); | |
491 wdata->request->directory = olddir; | |
492 } | |
493 else | |
494 g_free (olddir); | |
495 | |
496 return (ret); | |
497 } | |
498 | |
499 | |
425 int | 500 int |
426 chdir_edit (GtkWidget * widget, gpointer data) | 501 chdir_edit (GtkWidget * widget, gpointer data) |
427 { | 502 { |
428 gftp_window_data * wdata; | 503 gftp_window_data * wdata; |
429 const char *edttxt; | 504 const char *edttxt; |
500 gtk_clist_thaw (GTK_CLIST (wdata->listbox)); | 575 gtk_clist_thaw (GTK_CLIST (wdata->listbox)); |
501 ret = 1; | 576 ret = 1; |
502 } | 577 } |
503 g_free (tempstr); | 578 g_free (tempstr); |
504 return (ret); | 579 return (ret); |
505 } | |
506 | |
507 | |
508 static int | |
509 do_change_dir (gftp_window_data * wdata, char *directory) | |
510 { | |
511 char *olddir; | |
512 int ret; | |
513 | |
514 if (directory != wdata->request->directory) | |
515 { | |
516 olddir = wdata->request->directory; | |
517 wdata->request->directory = g_malloc (strlen (directory) + 1); | |
518 strcpy (wdata->request->directory, directory); | |
519 } | |
520 else | |
521 olddir = NULL; | |
522 | |
523 ret = (int) generic_thread (do_change_dir_thread, wdata); | |
524 | |
525 if (!GFTP_IS_CONNECTED (wdata->request)) | |
526 { | |
527 disconnect (wdata); | |
528 if (olddir != NULL) | |
529 g_free (olddir); | |
530 return (-2); | |
531 } | |
532 | |
533 if (ret != 0) | |
534 { | |
535 g_free (wdata->request->directory); | |
536 wdata->request->directory = olddir; | |
537 } | |
538 else | |
539 g_free (olddir); | |
540 | |
541 return (ret); | |
542 } | |
543 | |
544 | |
545 static void * | |
546 do_change_dir_thread (void * data) | |
547 { | |
548 gftp_window_data * wdata; | |
549 int success, sj; | |
550 | |
551 wdata = data; | |
552 wdata->request->user_data = (void *) 0x01; | |
553 | |
554 if (wdata->request->use_threads) | |
555 { | |
556 sj = sigsetjmp (jmp_environment, 1); | |
557 use_jmp_environment = 1; | |
558 } | |
559 else | |
560 sj = 0; | |
561 | |
562 success = 0; | |
563 if (sj == 0) | |
564 { | |
565 if (wdata->request->network_timeout > 0) | |
566 alarm (wdata->request->network_timeout); | |
567 success = gftp_set_directory (wdata->request, wdata->request->directory); | |
568 alarm (0); | |
569 } | |
570 else | |
571 { | |
572 gftp_disconnect (wdata->request); | |
573 wdata->request->logging_function (gftp_logging_error, | |
574 wdata->request->user_data, | |
575 _("Operation canceled\n")); | |
576 } | |
577 | |
578 if (wdata->request->use_threads) | |
579 use_jmp_environment = 0; | |
580 | |
581 wdata->request->user_data = NULL; | |
582 wdata->request->stopable = 0; | |
583 return ((void *) success); | |
584 } | 580 } |
585 | 581 |
586 | 582 |
587 void | 583 void |
588 clearlog (gpointer data) | 584 clearlog (gpointer data) |