static void menu_file_open() { x_dialog_unimplemented_feature(); #if 0 GSList *file_list; file_list = x_fileselect_open(); /* Load the files, don't check if it went OK */ x_fileselect_load_files(file_list); g_slist_foreach(file_list, (GFunc)g_free, NULL); g_slist_free(file_list); #endif }
/*! \brief gattrib_main -- main gattrib fcn. * * \par * *------------------------------------------------------------------*/ void gattrib_main(void *closure, int argc, char *argv[]) { /* TOPLEVEL *pr_current is a global */ /* SHEET_DATA *sheet_head is a global */ /* GtkWidget *main_window is a global */ int argv_index; gchar *cwd; gchar *logfile; #ifdef HAVE_GTHREAD /* Gattrib isn't threaded, but some of GTK's file chooser * backends uses threading so we need to call g_thread_init(). * GLib requires threading be initialised before any other GLib * functions are called. Do it now if its not already setup. */ if (!g_thread_supported ()) g_thread_init (NULL); #endif /* Initialize gEDA stuff */ libgeda_init(); /* Ensure object->sel_func can be used to correctly determine object * locking when the project is saved out */ select_func = s_toplevel_select_object; /* Note that argv_index holds index to first non-flag command line option * (that is, to the first file name) */ argv_index = parse_commandline(argc, argv); /* ---------- create log file right away ---------- */ /* ---------- even if logging is enabled ---------- */ cwd = g_get_current_dir(); logfile = g_build_filename (cwd, "gattrib.log", NULL); s_log_init (logfile); g_free (logfile); g_free (cwd); s_log_message ("gEDA/gattrib version %s%s.%s\n", PREPEND_VERSION_STRING, DOTTED_VERSION, DATE_VERSION); s_log_message ("gEDA/gattrib comes with ABSOLUTELY NO WARRANTY; see COPYING for more details.\n"); s_log_message ("This is free software, and you are welcome to redistribute it under certain\n"); s_log_message ("conditions; please see the COPYING file for more details.\n\n"); if (!quiet_mode) { fflush(stderr); fflush(stdout); fprintf(stderr, "gEDA/gattrib version %s%s.%s\n", PREPEND_VERSION_STRING, DOTTED_VERSION, DATE_VERSION); fprintf(stderr, "gEDA/gattrib comes with ABSOLUTELY NO WARRANTY; see COPYING for more details.\n"); fprintf(stderr, "This is free software, and you are welcome to redistribute it under certain\n"); fprintf(stderr, "conditions; please see the COPYING file for more details.\n\n"); } /* ------ register guile (scheme) functions. Necessary to parse RC file. ------ */ g_register_funcs(); /* ---------- Start creation of new project: (TOPLEVEL *pr_current) ---------- */ pr_current = s_toplevel_new(); /* ----- Read in RC files. ----- */ g_rc_parse(pr_current, "gattribrc", NULL); i_vars_set(pr_current); gtk_init(&argc, &argv); x_window_init(); /* ---------- Initialize SHEET_DATA data structure ---------- */ sheet_head = s_sheet_data_new(); /* sheet_head was declared in globals.h */ GSList *file_list = NULL; if (argv_index >= argc) { /* No files specified on the command line, pop up the File open dialog. */ file_list = x_fileselect_open(); if(file_list == NULL) exit(0); } else { /* Construct the list of filenames from the command line. * argv_index holds the position of the first filename */ while (argv_index < argc) { gchar *filename = f_normalize_filename(argv[argv_index], NULL); if (filename != NULL) { file_list = g_slist_append(file_list, filename); } else { fprintf(stderr, "Couldn't find file [%s]\n", argv[argv_index]); exit(1); } argv_index++; } } /* Load the files */ if(x_fileselect_load_files(file_list) == FALSE) { /* just exit the program */ exit(1); } g_slist_foreach(file_list, (GFunc)g_free, NULL); g_slist_free(file_list); gtk_main(); exit(0); }