Esempio n. 1
0
SIGNAL_CALLBACK void
on_file_selection_dialog_ok_button_clicked(GtkWidget *w)
{
    GtkWidget *file_selection_dialog;

    gchar **selections;
    gchar **current;

    file_selection_dialog =
        glade_xml_get_widget(glade_xml, "file_selection_dialog");

    selections = gtk_file_selection_get_selections(
        GTK_FILE_SELECTION(file_selection_dialog));

    current = selections;

    while (*current)
    {
        add_file(*current);
        ++current;
    }

    g_strfreev(selections);
    gtk_widget_hide(file_selection_dialog);

    execute();
}
Esempio n. 2
0
SIGNAL_CALLBACK void
on_mask_file_selection_ok_button_clicked(GtkWidget *widget)
{
    GtkWidget *file_selection_dialog;
    gchar **selections;
    gchar **current;
    int i, n;

    file_selection_dialog = get_widget_checked("mask_file_selection");

    selections = gtk_file_selection_get_selections(
        GTK_FILE_SELECTION(file_selection_dialog));

    current = selections;
    i = n = 0;

    while (*current)
    {
        if (set_mask_file(*current))
            ++i;

        ++current;
        ++n;
    }

    g_strfreev(selections);
    gtk_widget_hide(file_selection_dialog);
}
Esempio n. 3
0
SIGNAL_CALLBACK void
on_input_file_selection_ok_button_clicked(GtkWidget *widget)
{
    GtkWidget *file_selection_dialog;
    gchar **selections;
    gchar **current;
    int i, n;

    file_selection_dialog =
        get_widget_checked("input_file_selection");

    selections = gtk_file_selection_get_selections(
        GTK_FILE_SELECTION(file_selection_dialog));

    current = selections;
    i = n = 0;

    while (*current)
    {
      printf("in while loop\n");
        /* second clause here allows silent fail for .L files, PR 92 */
        if ((add_to_files_list(*current) || is_meta_file(*current)) &&
             !is_asf_complex_data((const char *)(*current)))
        {
	  printf("passed conditions - counting up\n");
            ++i;
        }

        ++current;
        ++n;
    }

    if (i != n)
    {
        if (n == 1 || i == 0)
        {
            message_box(
              "Error: Unrecognized file type, file extension, or unsupported "
              "product level.  MapReady\ndoes not currently support Level 0, "
              "complex-valued, or ALOS PRISM or AVNIR2 Level 1A\nand 1B1 "
              "files.\n\n"
              "Please select the leader (.L, LED-, etc) file for product "
              "types higher than Level 0 to\nadd files to the input file "
              "list.\n\n"
              "See 'asf_import' or the ASF SAR Training Processor ('stp') "
              "for more information\non Level 0 processing.\n");
        }
        else
        {
            message_box("Some of the files were not added -- "
                        "unknown types or extensions.");
        }
    }

    g_strfreev(selections);
    gtk_widget_hide(file_selection_dialog);
}
Esempio n. 4
0
void do_add_layer(GtkWidget *widget, gpointer *data) {
  Layer *lay;
  char **sel = gtk_file_selection_get_selections(GTK_FILE_SELECTION(data));
  for(int c=0;sel[c];c++) {
    func("%s : creating %s",__FUNCTION__,sel[c]);
    lay = create_layer(sel[c]);
    if(!lay) return;
    if(lay->init(env)) {
      env->layers.append(lay);
      env->layers.sel(0); /* deselect others */
      lay->sel(true);
    } else delete lay;
  }
}
Esempio n. 5
0
File: gchan.cpp Progetto: dyne/MuSE
void gcb_add_file(GtkWidget *w, GtkFileSelection *fw)
{
	unsigned int idx = 0;
	struct gchan *o;
	gchar **cist; 
	//const gchar *cist;
	gint i;
	GtkTreeSelection *select;
	bool res=false;

	cist=NULL;
	
	idx= *(unsigned int *) g_object_get_data(G_OBJECT(GTK_FILE_SELECTION(fw)->ok_button), "chan");
	func(_("GTK_GUI::gcb_add_file : idx %u"), idx);
	cist = gtk_file_selection_get_selections(GTK_FILE_SELECTION(fw));
	//cist = gtk_file_selection_get_filename(GTK_FILE_SELECTION(fw));

	o = (struct gchan *) list_get_data(listachan, idx, 0);
	/*if(!cist[0]) {
		win_warning(_("You have to insert a filename!!"));
		return;
	}*/
	
	/* muse core'll add file into GtkTreeModel */
	for(i = 0; cist[i] != NULL; i++) {
		res = mixer->add_to_playlist(idx-1, cist[i]);
		//res = mixer->add_to_playlist(idx-1, cist);
		if(!res) { 
			func(_("gcb_add_file:: mixer->add_to_playlist(%u, %s) failed"),
					idx-1, cist[i]);
			win_error(_("Problem adding file :\\"));
		} else {
			//func(_("Added %s"), cist[i]);
			/* saves last directory visited */
			if(pathfile) 
				g_free(pathfile);
			pathfile = g_strdup(cist[i]);
			//pathfile = g_strdup(cist);
			int i = strlen(pathfile);
			while(pathfile[i] != '/') i--;
				pathfile[i+1]= '\0';
		}
	}
	g_strfreev(cist);
	select = gtk_tree_view_get_selection(GTK_TREE_VIEW(o->tree));
	gtk_tree_selection_unselect_all(select);
	gtk_widget_destroy((GtkWidget *)fw);

}
Esempio n. 6
0
static void filesel_ok(GtkWidget *w, GtkFileSelection *fs)
{
   ALLEGRO_NATIVE_DIALOG *fc;
   fc = g_object_get_data(G_OBJECT(w), "ALLEGRO_NATIVE_DIALOG");
   gchar **paths = gtk_file_selection_get_selections(fs);
   int n = 0, i;
   while (paths[n]) {
      n++;
   }
   fc->fc_path_count = n;
   fc->fc_paths = al_malloc(n * sizeof(void *));
   for (i = 0; i < n; i++)
      fc->fc_paths[i] = al_create_path(paths[i]);
   g_strfreev(paths);
}
Esempio n. 7
0
File: ml_gtk.c Progetto: CRogers/obc
/* properties
ML_2 (gtk_file_selection_set_filename, GtkFileSelection_val, String_val, Unit)
ML_1 (gtk_file_selection_get_filename, GtkFileSelection_val, Val_string)
ML_1 (gtk_file_selection_show_fileop_buttons, GtkFileSelection_val, Unit)
ML_1 (gtk_file_selection_hide_fileop_buttons, GtkFileSelection_val, Unit)
ML_2 (gtk_file_selection_set_select_multiple, GtkFileSelection_val, Bool_val,
      Unit)
ML_1 (gtk_file_selection_get_select_multiple, GtkFileSelection_val, Val_bool)
*/
CAMLprim value ml_gtk_file_selection_get_selections (value sel)
{
  gchar** selections =
    gtk_file_selection_get_selections(GtkFileSelection_val(sel));
  gchar** orig = selections;
  CAMLparam0();
  CAMLlocal3(ret,prev,next);
  for (prev = (value)((&ret)-1); *selections != NULL; selections++) {
    next = alloc(2,0);
    Store_field(prev, 1, next);
    Store_field(next, 0, Val_string(*selections));
    prev = next;
  }
  Field(prev,1) = Val_unit;
  g_strfreev(orig);
  CAMLreturn(ret);
}