src/perl.c

changeset 1947
ccb4d8d8c8db
parent 1896
3aba553a53ea
child 1949
fb01bcf6743f
equal deleted inserted replaced
1946:b4fc005a1993 1947:ccb4d8d8c8db
615 if (config) gtk_widget_destroy(config); 615 if (config) gtk_widget_destroy(config);
616 config = NULL; 616 config = NULL;
617 } 617 }
618 618
619 static void do_load(GtkWidget *m, gpointer n) { 619 static void do_load(GtkWidget *m, gpointer n) {
620 gchar* file = gtk_file_selection_get_filename(GTK_FILE_SELECTION(config)); 620 const char *f = gtk_file_selection_get_filename(GTK_FILE_SELECTION(config));
621 if (!file || !strlen(file)) { 621 gchar* file;
622 if (!f || !strlen(f)) {
622 perl_end(); 623 perl_end();
623 perl_init(); 624 perl_init();
624 return; 625 return;
625 } 626 }
627 file = g_strdup(f);
626 628
627 if (file_is_dir(file, config)) { 629 if (file_is_dir(file, config)) {
630 g_free(file);
628 return; 631 return;
629 } 632 }
630 633
631 if (last_dir) { 634 if (last_dir) {
635 g_free(file);
632 g_free(last_dir); 636 g_free(last_dir);
633 } 637 }
634 last_dir = g_dirname(file); 638 last_dir = g_dirname(file);
635 639
636 debug_printf("Loading perl script: %s\n", file); 640 debug_printf("Loading perl script: %s\n", file);
637 641
638 perl_load_file(file); 642 perl_load_file(file);
639 cfdes(config, NULL); 643 cfdes(config, NULL);
644 g_free(file);
640 } 645 }
641 646
642 void load_perl_script(GtkWidget *w, gpointer d) 647 void load_perl_script(GtkWidget *w, gpointer d)
643 { 648 {
644 char *buf, *temp; 649 char *buf, *temp;

mercurial