Beispiel #1
0
void TheComputer (GtkWidget *tcwidget, gpointer tcdata)
{
  if ((ifilestuff == 0) && ((biscomputer == 0) || (wiscomputer == 0))
    && (iyesno == 0))
  {
    ichangecolor = (int) tcdata;
    if (ichangecolor == 1)
    {
      change = gtk_file_selection_new ("change white");
    }
    else
    {
      change = gtk_file_selection_new ("change black");
    }
    gtk_signal_connect (GTK_OBJECT (change), "delete_event",
      GTK_SIGNAL_FUNC (DestroyChange), NULL);
    gtk_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION
      (change)->ok_button), "clicked", (GtkSignalFunc) EnableComp, change);
    gtk_signal_connect_object (GTK_OBJECT (GTK_FILE_SELECTION
      (change)->cancel_button), "clicked",
      (GtkSignalFunc) DestroyChange, NULL);
    if (ichangecolor == 2)
    {
      if (biscomputer == 1)
      {
        sprintf (defchange, PKGDATADIR"computers/%s.gtkgo", bplayername);
      }
      else
      {
        sprintf (defchange, "%s", PKGDATADIR"computers/default2.gtkgo");
      }
      gtk_file_selection_set_filename (GTK_FILE_SELECTION (change), defchange);
    }
    else
    {
      if (wiscomputer == 1)
      {
        sprintf (defchange, PKGDATADIR"computers/%s.gtkgo", wplayername);
      }
      else
      {
        sprintf (defchange, "%s", PKGDATADIR"computers/default2.gtkgo");
      }
      gtk_file_selection_set_filename (GTK_FILE_SELECTION (change), defchange);
    }
    gtk_file_selection_hide_fileop_buttons (GTK_FILE_SELECTION (change));
    gtk_widget_set_usize (GTK_WIDGET (change), 445, 300);
    gtk_widget_show (change);
    ifilestuff = 1;
  }
}
Beispiel #2
0
void
on_button_config_move_path_clicked(GtkButton *unused_button,
	gpointer unused_udata)
{
	(void) unused_button;
	(void) unused_udata;

	if (directory_chooser) {
		gtk_widget_destroy(directory_chooser);
		directory_chooser = NULL;
	}

	directory_chooser = gtk_file_selection_new(
			_("Please choose where to move files after successful download"));

	gui_signal_connect(
		GTK_FILE_SELECTION(directory_chooser)->ok_button,
		"clicked", button_fs_move_path_clicked, GINT_TO_POINTER(1));
	gui_signal_connect(
		GTK_FILE_SELECTION(directory_chooser)->cancel_button,
		"clicked", button_fs_move_path_clicked, NULL);
	gui_signal_connect(directory_chooser,
		"delete_event", on_directory_chooser_delete_event, NULL);

	gtk_widget_show(directory_chooser);
}
static void
file_selection_clicked_cb (GtkButton *button,
                           gpointer   user_data)
{
    DictionaryConfigWidgets *data = static_cast <DictionaryConfigWidgets *> (user_data);

    if (data) {
        GtkWidget *dialog = gtk_file_selection_new (_(data->title));
        gint result;

        gtk_file_selection_set_filename(GTK_FILE_SELECTION (dialog), gtk_entry_get_text(GTK_ENTRY(data->entry)));

        result = gtk_dialog_run (GTK_DIALOG (dialog));

        if (result == GTK_RESPONSE_OK) {
            const gchar *fname =
                gtk_file_selection_get_filename (GTK_FILE_SELECTION (dialog));

            if (!fname) fname = "";

            gtk_entry_set_text (GTK_ENTRY (data->entry), fname);
        }

        gtk_widget_destroy (dialog);
    }
}
Beispiel #4
0
static void
dnj_koj_frame_terragen_script_search (GtkWidget *button, struct drqmj_koji_terragen *info) {
    GtkWidget *dialog;

    // fix compiler warning
    (void)button;

    dialog = gtk_file_selection_new ("Please select a script directory");
    info->fsscript = dialog;

    if (strlen(gtk_entry_get_text(GTK_ENTRY(info->escript)))) {
        gtk_file_selection_set_filename (GTK_FILE_SELECTION(dialog),gtk_entry_get_text(GTK_ENTRY(info->escript)));
    }

    gtk_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION(dialog)->ok_button),
                        "clicked", GTK_SIGNAL_FUNC (dnj_koj_frame_terragen_script_set), info);
    gtk_signal_connect_object (GTK_OBJECT (GTK_FILE_SELECTION(dialog)->ok_button),
                               "clicked", GTK_SIGNAL_FUNC (gtk_widget_destroy),
                               (gpointer) dialog);
    gtk_signal_connect_object (GTK_OBJECT (GTK_FILE_SELECTION(dialog)->cancel_button),
                               "clicked", GTK_SIGNAL_FUNC (gtk_widget_destroy),
                               (gpointer) dialog);
    gtk_widget_show (dialog);
    gtk_window_set_modal (GTK_WINDOW(dialog),TRUE);
}
Beispiel #5
0
bool FileSelector::Run(bool runMain)
{
    bool dummyBool;
    if (!runMain)
        gdk_threads_enter();

    filesel = gtk_file_selection_new(title.c_str());
    m_context->prefs->GetPrefBoolean(kSetLastResumePref, &dummyBool);
    if(dummyBool)
		gtk_file_selection_set_filename (GTK_FILE_SELECTION (filesel), old_path);
    gtk_window_set_modal(GTK_WINDOW(filesel), TRUE);
    gtk_signal_connect(GTK_OBJECT(filesel), "destroy",
                       GTK_SIGNAL_FUNC(filesel_destroy), (gpointer)runMain);
    gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(filesel)->cancel_button),
                       "clicked", GTK_SIGNAL_FUNC(cancel_internal), this);
    gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(filesel)->ok_button),
                       "clicked", GTK_SIGNAL_FUNC(ok_internal), this);

    if (extended)
        gtk_clist_set_selection_mode(GTK_CLIST(GTK_FILE_SELECTION(filesel)->
                                     file_list), GTK_SELECTION_EXTENDED);
    gtk_widget_show(filesel);

    if (runMain)
        gtk_main();
    else {
        gdk_threads_leave();
        while (!done)
            usleep(20);
    }

    if (ok)
       return true;
    return false;
}
Beispiel #6
0
/*
 * display the file open dialog
 */
void gtkui_load_filter(void)
{
   GtkWidget *dialog;
   char *filename;
   int response = 0;
   char *path = get_full_path("share", "");

   DEBUG_MSG("gtk_load_filter");

   dialog = gtk_file_selection_new ("Select a precompiled filter file...");
   gtk_file_selection_set_filename(GTK_FILE_SELECTION(dialog), path);

   SAFE_FREE(path);

   response = gtk_dialog_run (GTK_DIALOG (dialog));

   if (response == GTK_RESPONSE_OK) {
      gtk_widget_hide(dialog);
      filename = gtk_file_selection_get_filename (GTK_FILE_SELECTION (dialog));

      /* 
       * load the filters chain.
       * errors are spawned by the function itself
       */
      filter_load_file(filename, GBL_FILTERS);
   }
   gtk_widget_destroy (dialog);
}
Beispiel #7
0
void open_file_dlg(NKEdit *doc)
{

  if (doc->changed) {
    confir_save_dlg(doc, FROM_OPEN_FILE_DLG);
    return;
  }

  file_dlg = gtk_file_selection_new(_("Numakiti: Open..."));
  gtk_window_set_modal(GTK_WINDOW(file_dlg), TRUE);
  GTK_WINDOW(file_dlg)->type = GTK_WINDOW_DIALOG;
  gtk_signal_connect_object(GTK_OBJECT(file_dlg), "destroy",
		            GTK_SIGNAL_FUNC(gtk_widget_destroy),
			    GTK_OBJECT(file_dlg));
  gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(file_dlg)->ok_button),
			    "clicked", GTK_SIGNAL_FUNC(open_dlg_ok),
			    doc);
  gtk_signal_connect_object(GTK_OBJECT(
                            GTK_FILE_SELECTION(file_dlg)->cancel_button),
			    "clicked", GTK_SIGNAL_FUNC(gtk_widget_destroy),
			    GTK_OBJECT(file_dlg));
  gtk_widget_show(file_dlg);

  return;
}
GtkWidget	*create_fileselection1 (void)
{
  GtkWidget *fileselection1;
  GtkWidget *ok_button1;
  GtkWidget *cancel_button1;

  fileselection1 = gtk_file_selection_new (_("Select File"));
    gtk_widget_show (fileselection1);
  gtk_container_set_border_width (GTK_CONTAINER (fileselection1), 10);

  ok_button1 = GTK_FILE_SELECTION (fileselection1)->ok_button;
  gtk_widget_show (ok_button1);
  GTK_WIDGET_SET_FLAGS (ok_button1, GTK_CAN_DEFAULT);

  cancel_button1 = GTK_FILE_SELECTION (fileselection1)->cancel_button;
  gtk_widget_show (cancel_button1);
  GTK_WIDGET_SET_FLAGS (cancel_button1, GTK_CAN_DEFAULT);
// Patch
g_signal_connect (    	GTK_OBJECT (ok_button1), "clicked", 	G_CALLBACK (response_accept_cb), fileselection1);
g_signal_connect (    	GTK_OBJECT (cancel_button1), "clicked", 	G_CALLBACK (response_cancel_cb), fileselection1);

// /Patch
  /* Store pointers to all widgets, for use by lookup_widget(). */
  GLADE_HOOKUP_OBJECT_NO_REF (fileselection1, fileselection1, "fileselection1");
  GLADE_HOOKUP_OBJECT_NO_REF (fileselection1, ok_button1, "ok_button1");
  GLADE_HOOKUP_OBJECT_NO_REF (fileselection1, cancel_button1, "cancel_button1");

  return fileselection1;
}
Beispiel #9
0
PRIVATE gpointer req_thread( Generator *g ) {

    Data *data = g->data;
    GtkWidget *fs;

    while( 1 ) {
	gpointer ptr = g_async_queue_pop( data->req );
	if( ptr == NULL )
	    break;
	else {

	    gdk_threads_enter();
	    
	    fs = gtk_file_selection_new("Select File");

	    gtk_object_set_data(GTK_OBJECT(fs), "Generator", g);
	    gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(fs)->ok_button), "clicked",
		    GTK_SIGNAL_FUNC(access_output_file), fs);
	    gtk_signal_connect_object(GTK_OBJECT(GTK_FILE_SELECTION(fs)->cancel_button), "clicked",
		    GTK_SIGNAL_FUNC(gtk_widget_destroy), GTK_OBJECT(fs));

	    if (data->filename != NULL)
		gtk_file_selection_set_filename(GTK_FILE_SELECTION(fs), data->filename);

	    gtk_window_set_modal(GTK_WINDOW(fs), TRUE);
	    gtk_widget_show(fs);

	    gdk_threads_leave();
	}
	
    }
    return NULL;
}
Beispiel #10
0
static void
playlist_cb(GtkWidget *widget, guint data)
{
    const gchar	*pldir;
    gchar	*plpatt;

    if( ! plfilesel ) {
	plfilesel = gtk_file_selection_new("");
	gtk_file_selection_hide_fileop_buttons(GTK_FILE_SELECTION(plfilesel));

	pldir = g_getenv("TIMIDITY_PLAYLIST_DIR");
	if(pldir != NULL) {
	    plpatt = g_strconcat(pldir, "/*.tpl", NULL);
	    gtk_file_selection_set_filename(GTK_FILE_SELECTION(plfilesel),
					    plpatt);
	    g_free(plpatt);
	}

	gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(plfilesel)->ok_button),
			   "clicked",
			   GTK_SIGNAL_FUNC (playlist_op), (gpointer)1);
	gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(plfilesel)->cancel_button),
			   "clicked",
			   GTK_SIGNAL_FUNC (playlist_op), NULL);
    }

    gtk_window_set_title(GTK_WINDOW(plfilesel), ((char)data == 'l')?
			 "Load Playlist":
			 "Save Playlist");
    gtk_object_set_user_data(GTK_OBJECT(plfilesel), GINT_TO_POINTER(data));
    gtk_file_selection_complete(GTK_FILE_SELECTION(plfilesel), "*.tpl");

    gtk_widget_show(plfilesel);
} /* playlist_cb */
Beispiel #11
0
static void
open_file_cb(GtkWidget *widget, gpointer data)
{
    if( ! filesel ) {
	filesel = gtk_file_selection_new("Open File");
	gtk_file_selection_hide_fileop_buttons(GTK_FILE_SELECTION(filesel));

#ifdef HAVE_GTK_2
	gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(filesel)->ok_button),
			   "clicked",
			   G_CALLBACK (filer_cb), GINT_TO_POINTER(1));
#else
	gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(filesel)->ok_button),
			   "clicked",
			   GTK_SIGNAL_FUNC (filer_cb), GINT_TO_POINTER(1));
#endif
#ifdef HAVE_GTK_2
	gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(filesel)->cancel_button),
			   "clicked",
			   G_CALLBACK (filer_cb), GINT_TO_POINTER(0));
#else
	gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(filesel)->cancel_button),
			   "clicked",
			   GTK_SIGNAL_FUNC (filer_cb), GINT_TO_POINTER(0));
#endif
    }

    gtk_widget_show(GTK_WIDGET(filesel));
}
Beispiel #12
0
void spawnfilew(GtkWidget *button, struct gchan *o)
{
	GtkWidget *filew;

/*#if GTK_CHECK_VERSION(2,4,0)
	notice("use file chooser");
#else*/
	func(_("GTK_GUI::spawnfilew : filebrowser for chan[%u]"), o->idx);

	filew = gtk_file_selection_new(_("Select a .mp3 file or a playlist (.pl)"));
	if(pathfile)
		gtk_file_selection_set_filename(GTK_FILE_SELECTION(filew), pathfile);
	g_object_set_data(G_OBJECT(GTK_FILE_SELECTION(filew)->ok_button),
			"chan", (void *) &o->idx);
	g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(filew)->ok_button),
			"clicked", G_CALLBACK(gcb_add_file), filew);
	
	gtk_file_selection_set_select_multiple(GTK_FILE_SELECTION(filew), TRUE);
	
	g_signal_connect(G_OBJECT(GTK_WIDGET(filew)), "destroy",
			G_CALLBACK(gtk_widget_destroy), NULL);
	g_signal_connect_swapped(G_OBJECT(
				GTK_FILE_SELECTION(filew)->cancel_button),
			"clicked", G_CALLBACK(gtk_widget_destroy), 
			G_OBJECT(filew));
	
	gtk_widget_show(filew);
/*#endif*/
}
Beispiel #13
0
IDataSource * choosePalette()
{
	FileSystem * filesys = FileSystem::get_instance();
	GtkWidget *file_sel;
	gchar *filename;
	gboolean selected = FALSE;

	file_sel = gtk_file_selection_new( "Choose a Palette" );
	gtk_window_set_modal( GTK_WINDOW( file_sel ), TRUE );

	gtk_signal_connect( GTK_OBJECT( file_sel ), "destroy",
                            GTK_SIGNAL_FUNC( file_sel_delete ), &file_sel );

	gtk_signal_connect( GTK_OBJECT( GTK_FILE_SELECTION( file_sel )->cancel_button ), "clicked", GTK_SIGNAL_FUNC( file_sel_delete ), &file_sel );

	gtk_signal_connect( GTK_OBJECT( GTK_FILE_SELECTION( file_sel )->ok_button ), "clicked", GTK_SIGNAL_FUNC( file_selected ), &selected );

	gtk_widget_show( file_sel );

	while( ( ! selected ) && ( file_sel ) )
		gtk_main_iteration();

	/* canceled or window was closed */
	if( ! selected )
		return 0;

	/* ok */
	filename = g_strdup( gtk_file_selection_get_filename( GTK_FILE_SELECTION( file_sel ) ) );
	gtk_widget_destroy( file_sel );

	IDataSource * ds = filesys->ReadFile(filename);
	return ds;
}
Beispiel #14
0
GtkWidget*
file_selection_create (const gchar *title,
		       void(*clickfunc)())
{
    GtkWidget *window;

    window = gtk_file_selection_new (title);
    gtk_window_position (GTK_WINDOW (window), GTK_WIN_POS_MOUSE);
	
    gtk_signal_connect(GTK_OBJECT (window), "destroy",
		       GTK_SIGNAL_FUNC(gtk_main_quit),
		       NULL);
    gtk_signal_connect(GTK_OBJECT (GTK_FILE_SELECTION (window)->ok_button),
		       "clicked", GTK_SIGNAL_FUNC(clickfunc),
		       window);
 
    gtk_signal_connect(GTK_OBJECT (window), "delete_event",
		       GTK_SIGNAL_FUNC(gtk_widget_hide),
		       window);
    gtk_signal_connect_object(GTK_OBJECT (GTK_FILE_SELECTION (window)->cancel_button),
			      "clicked", GTK_SIGNAL_FUNC(gtk_widget_hide),
			      GTK_OBJECT (window));

    return window;
}
Beispiel #15
0
void
on_button_config_add_dir_clicked(GtkButton *unused_button,
	gpointer unused_udata)
{
	(void) unused_button;
	(void) unused_udata;

	if (directory_chooser) {
		gtk_widget_destroy(directory_chooser);
		directory_chooser = NULL;
	}

	directory_chooser = gtk_file_selection_new(
			_("Please choose a directory to share"));

	gui_signal_connect(
		GTK_FILE_SELECTION(directory_chooser)->ok_button,
		"clicked", button_fs_add_dir_clicked, GINT_TO_POINTER(1));
	gui_signal_connect(GTK_FILE_SELECTION(directory_chooser)->cancel_button,
		"clicked", button_fs_add_dir_clicked, NULL);
	gui_signal_connect(directory_chooser,
		"delete_event", on_directory_chooser_delete_event, NULL);

	gtk_widget_show(directory_chooser);
}
Beispiel #16
0
/*
 * display the file open dialog
 */
void gtkui_plugin_load(void)
{
   GtkWidget *dialog;
   char *filename;
   int response = 0;
#ifdef OS_WINDOWS
   char *path = get_full_path("/lib/", "");
#else
   char *path = INSTALL_LIBDIR "/" EC_PROGRAM "/";
#endif
   
   DEBUG_MSG("gtk_plugin_load");
   
   dialog = gtk_file_selection_new ("Select a plugin...");
   gtk_file_selection_set_filename(GTK_FILE_SELECTION(dialog), path);   

#ifdef OS_WINDOWS
   SAFE_FREE(path);
#endif
   
   response = gtk_dialog_run (GTK_DIALOG (dialog));
   
   if (response == GTK_RESPONSE_OK) {
      gtk_widget_hide(dialog);
      filename = gtk_file_selection_get_filename (GTK_FILE_SELECTION (dialog));
      
      gtkui_load_plugin(filename);

      /* update the list */
      gtkui_create_plug_array();
   }
   gtk_widget_destroy (dialog);
}
void
GTK_browse_server_executable(GtkWidget *entry, gpointer user_data)
{
    GtkWidget *w;
    const gchar *path = gtk_entry_get_text(GTK_ENTRY(entry));
    const gchar *os_path;
    gchar *s;
    w = gtk_file_selection_new("Select Local Executable");
    gtk_file_selection_hide_fileop_buttons(GTK_FILE_SELECTION(w));
    if (*path) {
	os_path = g_filename_from_utf8(path, -1, NULL, NULL, NULL);
	if (os_path) {
	    s = g_find_program_in_path(os_path);
	    gtk_file_selection_set_filename(GTK_FILE_SELECTION(w),
	      s ? s : os_path);
	    g_free(s);
	    g_free((void *)os_path);
	}
    }
    if (gtk_dialog_run(GTK_DIALOG(w)) == GTK_RESPONSE_OK) {
	os_path = gtk_file_selection_get_filename(GTK_FILE_SELECTION(w));
	path = g_filename_to_utf8(os_path, -1, NULL, NULL, NULL);
	if (path) {
	    gtk_entry_set_text(GTK_ENTRY(entry), path);
	    g_free((void *)path);
	}
    }
    gtk_widget_destroy(w);
}
Beispiel #18
0
static void openfile(GtkObject *object, gpointer data)
{
  GtkWidget *app = GTK_WIDGET(data);
  GtkWidget *fileselection;
  GtkWidget *okButton;
  GtkWidget *cancelButton;

  fileselection =
    gtk_file_selection_new("Open File");

  gtk_object_set_data(GTK_OBJECT(fileselection), "app", app);

  okButton =
    GTK_FILE_SELECTION(fileselection)->ok_button;

  cancelButton =
    GTK_FILE_SELECTION(fileselection)->cancel_button;

  gtk_signal_connect(GTK_OBJECT(fileselection), "destroy",
             GTK_SIGNAL_FUNC(gtk_main_quit), NULL);

  gtk_signal_connect(GTK_OBJECT(okButton), "clicked",
             GTK_SIGNAL_FUNC(openOK), fileselection);

  gtk_signal_connect_object(GTK_OBJECT(cancelButton), "clicked",
             GTK_SIGNAL_FUNC(gtk_widget_destroy), GTK_OBJECT(fileselection));

  gtk_window_set_modal(GTK_WINDOW(fileselection), TRUE);
  gtk_widget_show(fileselection);
  gtk_main();
}
Beispiel #19
0
GtkWidget*
create_bsv_fs_dlg (void)
{
  GtkWidget *bsv_fs_dlg;
  GtkWidget *ok_button1;
  GtkWidget *cancel_button1;

  bsv_fs_dlg = gtk_file_selection_new (_("Select File"));
  gtk_container_set_border_width (GTK_CONTAINER (bsv_fs_dlg), 10);

  ok_button1 = GTK_FILE_SELECTION (bsv_fs_dlg)->ok_button;
  gtk_widget_show (ok_button1);
  GTK_WIDGET_SET_FLAGS (ok_button1, GTK_CAN_DEFAULT);

  cancel_button1 = GTK_FILE_SELECTION (bsv_fs_dlg)->cancel_button;
  gtk_widget_show (cancel_button1);
  GTK_WIDGET_SET_FLAGS (cancel_button1, GTK_CAN_DEFAULT);

  g_signal_connect_swapped ((gpointer) bsv_fs_dlg, "delete_event",
                            G_CALLBACK (gtk_widget_hide),
                            GTK_OBJECT (bsv_fs_dlg));
  g_signal_connect ((gpointer) ok_button1, "clicked",
                    G_CALLBACK (update_logfile),
                    NULL);
  g_signal_connect_swapped ((gpointer) cancel_button1, "clicked",
                            G_CALLBACK (gtk_widget_hide),
                            GTK_OBJECT (bsv_fs_dlg));

  /* Store pointers to all widgets, for use by lookup_widget(). */
  GLADE_HOOKUP_OBJECT_NO_REF (bsv_fs_dlg, bsv_fs_dlg, "bsv_fs_dlg");
  GLADE_HOOKUP_OBJECT_NO_REF (bsv_fs_dlg, ok_button1, "ok_button1");
  GLADE_HOOKUP_OBJECT_NO_REF (bsv_fs_dlg, cancel_button1, "cancel_button1");

  return bsv_fs_dlg;
}
Beispiel #20
0
void on_import_activate(GtkAction * action, gpointer user_data)
{
    GtkFileSelection *fs;
    GtkResponseType response;
    const gchar *filename;
    gchar last_dir[PATH_MAX];

    g_strlcpy(last_dir, prefs.last_dir, sizeof(last_dir));
    if (!la_str_has_suffix_case(prefs.last_dir, G_DIR_SEPARATOR_S))
	g_strlcat(last_dir, "/", sizeof(last_dir));

    fs = GTK_FILE_SELECTION(gtk_file_selection_new
			    (_("Select .pls Files to Import...")));
    gtk_file_selection_set_select_multiple(fs, FALSE);
    gtk_file_selection_set_filename(fs, last_dir);
    gtk_widget_show_all(GTK_WIDGET(fs));

    response = gtk_dialog_run(GTK_DIALOG(fs));

    if (response == GTK_RESPONSE_OK) {
	filename = gtk_file_selection_get_filename(fs);
	playlist_import_pls(get_playlist(app), filename);

	g_free(prefs.last_dir);
	prefs.last_dir = g_path_get_dirname(filename);
    }

    gtk_widget_destroy(GTK_WIDGET(fs));
}
static void change_clicked (GtkWidget *widget, gpointer data)
{
  GtkWidget* file_sel;
  char* filename = NULL;
  int loop = 1;

  file_sel = gtk_file_selection_new ("Locate portal (.prt) file");
  gtk_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION (file_sel)->ok_button), "clicked",
                      GTK_SIGNAL_FUNC (file_sel_callback), GINT_TO_POINTER (IDOK));
  gtk_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION (file_sel)->cancel_button), "clicked",
                      GTK_SIGNAL_FUNC (file_sel_callback), GINT_TO_POINTER (IDCANCEL));
  gtk_signal_connect (GTK_OBJECT (file_sel), "delete_event",
                      GTK_SIGNAL_FUNC (dialog_delete_callback), NULL);
  gtk_file_selection_hide_fileop_buttons (GTK_FILE_SELECTION (file_sel));

  g_object_set_data (G_OBJECT (file_sel), "loop", &loop);
  g_object_set_data (G_OBJECT (file_sel), "filename", &filename);
  gtk_file_selection_set_filename (GTK_FILE_SELECTION (file_sel), portals.fn);

  gtk_grab_add (file_sel);
  gtk_widget_show (file_sel);

  while (loop)
    gtk_main_iteration ();

  gtk_grab_remove (file_sel);
  gtk_widget_destroy (file_sel);

  if (filename != NULL)
  {
    strcpy (portals.fn, filename);
    gtk_entry_set_text (GTK_ENTRY (data), filename);
    g_free (filename);
  }
}
Beispiel #22
0
void
on_pick_dir_but_clicked (GtkButton       *button,
						 gpointer         user_data)
{
	file_selector = gtk_file_selection_new(_("Please select a directory"));
	
	gtk_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION(file_selector)->ok_button),
						"clicked", GTK_SIGNAL_FUNC (store_filename), NULL);
	
	/* Ensure that the dialog box is destroyed when the user clicks a button. */
	
	gtk_signal_connect_object (GTK_OBJECT (GTK_FILE_SELECTION(file_selector)->ok_button),
							   "clicked", GTK_SIGNAL_FUNC (gtk_widget_destroy),
							   (gpointer) file_selector);
	
	gtk_signal_connect_object (GTK_OBJECT (GTK_FILE_SELECTION(file_selector)->cancel_button),
							   "clicked", GTK_SIGNAL_FUNC (gtk_widget_destroy),
							   (gpointer) file_selector);

	gtk_window_set_transient_for(GTK_WINDOW(file_selector), 
								 GTK_WINDOW(glade_xml_get_widget(rescue_glade, 
																 "media_select")));
	
	/* Display that dialog */
	
	gtk_widget_show (file_selector);
}
Beispiel #23
0
void 
save_directory_listing (gpointer data)
{
  gftp_save_dir_struct * str;
  GtkWidget *filew;

  filew = gtk_file_selection_new (_("Save Directory Listing"));

  str = g_malloc0 (sizeof (*str));
  str->filew = filew;
  str->wdata = data;

  gtk_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION (filew)->ok_button),
                      "clicked", GTK_SIGNAL_FUNC (dosave_directory_listing), 
                      str);
  gtk_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION (filew)->ok_button),
                      "clicked", 
                      GTK_SIGNAL_FUNC (destroy_save_directory_listing), str);
  gtk_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION (filew)->cancel_button), 
                      "clicked", 
                      GTK_SIGNAL_FUNC (destroy_save_directory_listing), str);

  gtk_window_set_wmclass (GTK_WINDOW(filew), "Save Directory Listing", "gFTP");
  gtk_widget_show (filew);
}
Beispiel #24
0
PRIVATE void evt_record_handler(Generator *g, AEvent *event) {
  gboolean start = (event->d.number > 0.5);
  Data *data = g->data;

  if (start) {
    GtkWidget *fs = gtk_file_selection_new("Select Output WAV File");

    gtk_object_set_data(GTK_OBJECT(fs), "Generator", g);
    gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(fs)->ok_button), "clicked",
		       GTK_SIGNAL_FUNC(access_output_file), fs);
    gtk_signal_connect_object(GTK_OBJECT(GTK_FILE_SELECTION(fs)->cancel_button), "clicked",
			      GTK_SIGNAL_FUNC(gtk_widget_destroy), GTK_OBJECT(fs));

    if (data->filename != NULL)
      gtk_file_selection_set_filename(GTK_FILE_SELECTION(fs), data->filename);

    gtk_window_set_modal(GTK_WINDOW(fs), TRUE);
    gtk_widget_show(fs);
  } else {
    if (data->output != NULL) {
      afCloseFile(data->output);
      data->output = NULL;
    }

    popup_msgbox("Recording Complete", MSGBOX_OK, 0, MSGBOX_OK,
		 "Recorded %g seconds (%d frames) of data to file\n"
		 "%s",
		 (float) data->frames_recorded / (SAMPLE_RATE), data->frames_recorded,
		 data->filename ? data->filename : "<anonymous>");
  }
}
Beispiel #25
0
static void
dnj_koj_frame_terragen_terrainfile_search (GtkWidget *button, struct drqmj_koji_terragen *info) {
    GtkWidget *dialog;
    char dir[BUFFERLEN];

    // fix compiler warning
    (void)button;

    dialog = gtk_file_selection_new ("Please select the Terragen Terrain File");
    info->fsterrainfile = dialog;

    if (strlen(gtk_entry_get_text(GTK_ENTRY(info->eterrainfile)))) {
        strncpy (dir,gtk_entry_get_text(GTK_ENTRY(info->eterrainfile)),BUFFERLEN-1);
        gtk_file_selection_set_filename (GTK_FILE_SELECTION(dialog),strcat(dir,"/"));
    }

    gtk_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION(dialog)->ok_button),
                        "clicked", GTK_SIGNAL_FUNC (dnj_koj_frame_terragen_terrainfile_set), info);
    gtk_signal_connect_object (GTK_OBJECT (GTK_FILE_SELECTION(dialog)->ok_button),
                               "clicked", GTK_SIGNAL_FUNC (gtk_widget_destroy),
                               (gpointer) dialog);
    gtk_signal_connect_object (GTK_OBJECT (GTK_FILE_SELECTION(dialog)->cancel_button),
                               "clicked", GTK_SIGNAL_FUNC (gtk_widget_destroy),
                               (gpointer) dialog);
    gtk_widget_show (dialog);
    gtk_window_set_modal (GTK_WINDOW(dialog),TRUE);
}
Beispiel #26
0
GtkWidget*
create_fileselection (void)
{
  GtkWidget *fileselection;
  GtkWidget *filesel_ok;
  GtkWidget *filesel_cancel;

  fileselection = gtk_file_selection_new ("Select File");
  gtk_object_set_data (GTK_OBJECT (fileselection), "fileselection", fileselection);
  gtk_container_set_border_width (GTK_CONTAINER (fileselection), 10);
  gtk_window_set_modal (GTK_WINDOW (fileselection), TRUE);

  filesel_ok = GTK_FILE_SELECTION (fileselection)->ok_button;
  gtk_object_set_data (GTK_OBJECT (fileselection), "filesel_ok", filesel_ok);
  gtk_widget_show (filesel_ok);
  GTK_WIDGET_SET_FLAGS (filesel_ok, GTK_CAN_DEFAULT);

  filesel_cancel = GTK_FILE_SELECTION (fileselection)->cancel_button;
  gtk_object_set_data (GTK_OBJECT (fileselection), "filesel_cancel", filesel_cancel);
  gtk_widget_show (filesel_cancel);
  GTK_WIDGET_SET_FLAGS (filesel_cancel, GTK_CAN_DEFAULT);

  gtk_signal_connect (GTK_OBJECT (fileselection), "destroy",
                      GTK_SIGNAL_FUNC (on_fileselection_destroy),
                      NULL);
  gtk_signal_connect (GTK_OBJECT (filesel_ok), "clicked",
                      GTK_SIGNAL_FUNC (on_filesel_ok_clicked),
                      NULL);
  gtk_signal_connect (GTK_OBJECT (filesel_cancel), "clicked",
                      GTK_SIGNAL_FUNC (on_filesel_cancel_clicked),
                      NULL);

  return fileselection;
}
Beispiel #27
0
/*
 * display the file open dialog
 */
static void gtkui_file_open(void)
{
   GtkWidget *dialog;
   const char *filename;
   int response = 0;

   DEBUG_MSG("gtk_file_open");

   dialog = gtk_file_selection_new ("Select a pcap file...");

   response = gtk_dialog_run (GTK_DIALOG (dialog));

   if (response == GTK_RESPONSE_OK) {
      gtk_widget_hide(dialog);
      filename = gtk_file_selection_get_filename (GTK_FILE_SELECTION (dialog));
      /* destroy needs to come before read_pcapfile so gtk_main_quit
         can reside inside read_pcapfile, which is why destroy is here
         twice and not after the if() block */
      gtk_widget_destroy (dialog);

      read_pcapfile (filename);
   } else {
      gtk_widget_destroy (dialog);
   }
}
// Set file as specified by dialog
// data is *fullPath
void pt_find_file( GtkWidget *widget, gpointer data )
{
    GtkWidget *filew;
    static wdata wd;

    filew = gtk_file_selection_new ("Find/Set file...");
    gtk_window_position (GTK_WINDOW (filew), GTK_WIN_POS_MOUSE);

    wd.data = data;
    wd.widg = filew;

    /* Connect the ok_button to file_ok_sel function */
    gtk_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION (filew)->ok_button),
                        "clicked", (GtkSignalFunc) pt_set_file, (gpointer)&wd );


    /* Connect the cancel_button to destroy the widget */
    gtk_signal_connect_object (GTK_OBJECT (GTK_FILE_SELECTION(filew)->cancel_button),
                               "clicked", (GtkSignalFunc) gtk_widget_destroy,
                               GTK_OBJECT (GTK_WINDOW (filew)));

    gtk_file_selection_set_filename (GTK_FILE_SELECTION(filew), "");

    gtk_widget_show (filew);
}
Beispiel #29
0
int main( int   argc,
          char *argv[] )
{
    GtkWidget *filew;
    
    gtk_init (&argc, &argv);
    
    /* Create a new file selection widget */
    filew = gtk_file_selection_new ("File selection");
    
    gtk_signal_connect (GTK_OBJECT (filew), "destroy",
			(GtkSignalFunc) destroy, &filew);
    /* Connect the ok_button to file_ok_sel function */
    gtk_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION (filew)->ok_button),
			"clicked", (GtkSignalFunc) file_ok_sel, filew );
    
    /* Connect the cancel_button to destroy the widget */
    gtk_signal_connect_object (GTK_OBJECT (GTK_FILE_SELECTION
                                            (filew)->cancel_button),
			       "clicked", (GtkSignalFunc) gtk_widget_destroy,
			       GTK_OBJECT (filew));
    
    /* Lets set the filename, as if this were a save dialog, and we are giving
     a default filename */
    gtk_file_selection_set_filename (GTK_FILE_SELECTION(filew), 
				     "penguin.png");
    
    gtk_widget_show(filew);
    gtk_main ();
    return 0;
}
Beispiel #30
0
GtkWidget* file_dialog(const char *title, GtkSignalFunc ok_callback, gpointer data) {
	GtkFileSelection* file_selector;

	file_selector = GTK_FILE_SELECTION(gtk_file_selection_new (title));

	if (!file_selector)
		return NULL;

	gtk_window_set_modal (GTK_WINDOW(file_selector),TRUE);

	// gtk_signal_connect (GTK_OBJECT (file_selector), "destroy", (GtkSignalFunc) file_dialog_destroy_callback, &file_selector);

	gtk_signal_connect (GTK_OBJECT (file_selector->ok_button),
			"clicked", ok_callback, data );

	gtk_signal_connect_object (GTK_OBJECT (file_selector->ok_button),
			"clicked", (GtkSignalFunc) gtk_widget_destroy,
			GTK_OBJECT (file_selector));

	/* Connect the cancel_button to destroy the widget */
	gtk_signal_connect_object (GTK_OBJECT (file_selector->cancel_button),
			"clicked", (GtkSignalFunc) gtk_widget_destroy,
			GTK_OBJECT (file_selector));

	gtk_widget_show(GTK_WIDGET(file_selector));

	return GTK_WIDGET(file_selector);
}