• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ GTK_FILE_SELECTION函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中GTK_FILE_SELECTION函数的典型用法代码示例。如果您正苦于以下问题:C++ GTK_FILE_SELECTION函数的具体用法?C++ GTK_FILE_SELECTION怎么用?C++ GTK_FILE_SELECTION使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了GTK_FILE_SELECTION函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: playlist_op

static void
playlist_op(GtkWidget *widget, guint data)
{
    int		i;
    const gchar	*filename[2];
    gchar	action, *rowdata, fname[BUFSIZ], *tmp;
    FILE	*plfp;

    gtk_widget_hide(plfilesel);

    if(!data)
	return;

    action = GPOINTER_TO_INT(gtk_object_get_user_data(GTK_OBJECT(plfilesel)));
    filename[0] = gtk_file_selection_get_filename(GTK_FILE_SELECTION(plfilesel));

    if(action == 'l') {
	if((plfp = fopen(filename[0], "r")) == NULL) {
	    g_error("Can't open %s for reading.", filename[0]);
	    return;
	}
	while(fgets(fname, BUFSIZ, plfp) != NULL) {
            gchar *filename[2];
	    if(fname[strlen(fname) - 1] == '\n')
		fname[strlen(fname) - 1] = '\0';
	    filename[0] = fname;
	    filename[1] = NULL;
	    gtk_clist_append(GTK_CLIST(clist), filename);
	}
	fclose(plfp);
	gtk_clist_columns_autosize(GTK_CLIST(clist));
    }
    else if(action == 's') {
	if((plfp = fopen(filename[0], "w")) == NULL) {
	    g_error("Can't open %s for writing.", filename[0]);
	    return;
	}
	for(i = 0; i < GTK_CLIST(clist)->rows; i++) {
	    gtk_clist_get_text(GTK_CLIST(clist), i, 0, &rowdata);
	    /* Make sure we have an absolute path. */
	    if(*rowdata != '/') {
		tmp = g_get_current_dir();
		rowdata = g_strconcat(tmp, "/", rowdata, NULL);
		fprintf(plfp, "%s\n", rowdata);
		g_free(rowdata);
		g_free(tmp);
	    }
	    else {
		fprintf(plfp, "%s\n", rowdata);
	    }
	}
	fclose(plfp);
    }
    else {
	g_error("Invalid playlist action!.");
    }
} /* playlist_op */
开发者ID:wyongfei,项目名称:LinuxSound-HTMLSource,代码行数:57,代码来源:gtk_i.c


示例2: FileSelec

void FileSelec(GtkButton* button)
{
	GtkWidget *selec;
	selec = gtk_file_selection_new("File Selection");
	
//	gtk_signal_connect(selec,"destroy",G_CALLBACK(gtk_main_quit), NULL);
	gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(selec)->ok_button),"clicked", G_CALLBACK(file_ok_sel), selec);
	gtk_widget_show(selec);
}
开发者ID:ThePenIsland,项目名称:FaceRecon,代码行数:9,代码来源:test.c


示例3: fileselbox

void fileselbox(char *title, char **filesel_path, GtkSignalFunc func)
{
fileselbox_text=filesel_path;
filesel_ok=0;
cleanup=func;

fs=gtk_file_selection_new(title);
gtk_signal_connect(GTK_OBJECT(fs), "destroy", (GtkSignalFunc) destroy_callback, NULL);
gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(fs)->ok_button), 
	"clicked", (GtkSignalFunc) enter_callback, GTK_OBJECT(fs));
gtk_signal_connect_object(GTK_OBJECT(GTK_FILE_SELECTION(fs)->cancel_button),
	"clicked", (GtkSignalFunc) cancel_callback, GTK_OBJECT(fs));
gtk_file_selection_hide_fileop_buttons(GTK_FILE_SELECTION(fs));
if(*fileselbox_text) gtk_file_selection_set_filename(GTK_FILE_SELECTION(fs), *fileselbox_text);

gtk_grab_add(fs);
gtk_widget_show(fs);
}
开发者ID:embisi-github,项目名称:embisi_gip,代码行数:18,代码来源:file.c


示例4: on_save_as1_activate

void on_save_as1_activate(GtkMenuItem * menuitem, gpointer user_data)
{
	GtkWidget *fs;

	fs = gtk_file_selection_new(_("Save file as..."));
	g_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(fs)->ok_button),
			 "clicked",
			 G_CALLBACK(store_filename), (gpointer) fs);
	g_signal_connect_swapped(GTK_OBJECT
				 (GTK_FILE_SELECTION(fs)->ok_button),
				 "clicked", G_CALLBACK(gtk_widget_destroy),
				 (gpointer) fs);
	g_signal_connect_swapped(GTK_OBJECT
				 (GTK_FILE_SELECTION(fs)->cancel_button),
				 "clicked", G_CALLBACK(gtk_widget_destroy),
				 (gpointer) fs);
	gtk_widget_show(fs);
}
开发者ID:HobbesOSR,项目名称:kitten,代码行数:18,代码来源:gconf.c


示例5: gtk_widget_get_toplevel

void
on_fileselect_ok                       (GtkButton       *button,
                                        gpointer         user_data)
{
    GtkWidget *filesel, *window3D, *save_procedure;
    gint what;
    gchar *filename;
    v5d_info *info;
    int hires;
    filesel = gtk_widget_get_toplevel (GTK_WIDGET (button));
    filename = gtk_file_selection_get_filename (GTK_FILE_SELECTION (filesel));

    what =  GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(filesel), "OpenWhat"));

    window3D = GTK_WIDGET(gtk_object_get_data(GTK_OBJECT(filesel), "window3D"));

    if(window3D==NULL) {
        fprintf(stderr,"Could not find window3D widget\n");
        exit ;
    }
    info = (v5d_info *) lookup_widget(window3D,"v5d_info");
    switch(what) {
    case DATA_FILE:
        load_data_file(window3D,filename);
        break;
    case TOPO_FILE:
        hires = vis5d_graphics_mode(info->v5d_display_context,VIS5D_HIRESTOPO,VIS5D_GET);
        vis5d_init_topo(info->v5d_display_context,filename,hires);
        vis5d_load_topo_and_map(info->v5d_display_context);
        break;
    case MAP_FILE:
        vis5d_init_map(info->v5d_display_context,filename);
        vis5d_load_topo_and_map(info->v5d_display_context);
        break;
    case PROCEDURE_FILE:
        if(info->ProcedureDialog)
            gtk_widget_destroy(info->ProcedureDialog);
        info->ProcedureDialog = new_ProcedureDialog(info, filename);
        gtk_window_set_transient_for(GTK_WINDOW(info->ProcedureDialog),GTK_WINDOW(window3D));
        break;
    case SAVE_PROCEDURE_FILE:
        if(! info->ProcedureDialog) {
            printf("Error: ProcedureDialog not defined\n");
            return;
        }
        save_procedure = lookup_widget(info->ProcedureDialog, "saveProcedure");
        on_saveProcedure_activate(GTK_MENU_ITEM(save_procedure), filename);
        break;
    default:
        g_print("open what ? %d\n",what);
    }

    gtk_widget_hide (filesel);
    /* This is the only window that should accept input */
    gtk_grab_remove(filesel);

}
开发者ID:pseudotensor,项目名称:Vis5dPlus,代码行数:57,代码来源:support_cb.c


示例6: cb_startup_dir_browse_ok

static void
cb_startup_dir_browse_ok (GtkWidget * widget, gpointer data)
{
    gtk_entry_set_text (GTK_ENTRY (prefs_win.startup_dir_entry),
			gtk_file_selection_get_filename (GTK_FILE_SELECTION
							 (data)));

    gtk_widget_destroy (data);
}
开发者ID:gentoo,项目名称:pornview,代码行数:9,代码来源:prefs_ui_common.c


示例7: choose_clicked

PRIVATE void choose_clicked(GtkWidget *choose_button, Generator *g) {
  GtkWidget *fs = gtk_file_selection_new("Open Sample File");
  Data *data = g->data;

  gtk_object_set_data(GTK_OBJECT(fs), "Generator", g);
  gtk_object_set_data(GTK_OBJECT(fs), "FilenameLabel",
		      gtk_object_get_data(GTK_OBJECT(choose_button), "FilenameLabel"));

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

  gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(fs)->ok_button), "clicked",
		     GTK_SIGNAL_FUNC(load_new_sample), fs);
  gtk_signal_connect_object(GTK_OBJECT(GTK_FILE_SELECTION(fs)->cancel_button), "clicked",
			    GTK_SIGNAL_FUNC(gtk_widget_destroy), GTK_OBJECT(fs));

  gtk_window_set_modal(GTK_WINDOW(fs), TRUE);
  gtk_widget_show(fs);
}
开发者ID:BackupTheBerlios,项目名称:galan,代码行数:19,代码来源:sndfile_in.c


示例8: DeviceBoxBrowseEvent

gint DeviceBoxBrowseEvent(GtkWidget *widget, GdkEvent event, gpointer data)
{
	DeviceBoxUnfocus();
	// Transfer file name to file selection
	gtk_file_selection_set_filename(GTK_FILE_SELECTION(selectionbox.window),
	                                gtk_entry_get_text(GTK_ENTRY(devicebox.file)));
	selectionbox.wherefrom = 2; // From the Device Window
	SelectionBoxRefocus();
	return (TRUE);
} // END DeviceBoxBrowseEvent()
开发者ID:Codyle,项目名称:pcsx2,代码行数:10,代码来源:devicebox.c


示例9: save_file_dlg

void save_file_dlg(NKEdit *doc)
{
  file_dlg = gtk_file_selection_new(_("Numakiti: Save as..."));
  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(save_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;
}
开发者ID:kaznum,项目名称:gtk-simple-editor,代码行数:19,代码来源:nkfile.c


示例10: executable_filename

void executable_filename (GtkWidget *widget, gpointer user_data) {
  const gchar *selected_filename;

  selected_filename = gtk_file_selection_get_filename (
    GTK_FILE_SELECTION (file_selector));

  ap_prefs_set_string ((struct widget *) user_data, "command",
    selected_filename);
  gtk_entry_set_text (GTK_ENTRY (file_entry), selected_filename);
}
开发者ID:Javran,项目名称:purple-plugin-pack,代码行数:10,代码来源:comp_executable.c


示例11: dnj_koj_frame_mantra_scene_set

static void
dnj_koj_frame_mantra_scene_set (GtkWidget *button, struct drqmj_koji_mantra *info) {
  char buf[BUFFERLEN];
  
  // fix compiler warning
  (void)button;

  strncpy(buf,gtk_file_selection_get_filename(GTK_FILE_SELECTION(info->fsscene)),BUFFERLEN-1);
  gtk_entry_set_text (GTK_ENTRY(info->escene),buf);
}
开发者ID:Hyask,项目名称:drqueue,代码行数:10,代码来源:drqm_jobs_mantra.c


示例12: saveDialog

void saveDialog(GtkWidget * widget, gpointer image) {
	GtkWidget * fileSelection = gtk_file_selection_new("Save an image");

	_saveData * data = (_saveData *)malloc(sizeof(_saveData));
	data->fs = fileSelection;
	data->image = (GtkImage *)image;

	/* Connect the ok_button to file_ok_sel function */
	g_signal_connect (G_OBJECT (GTK_FILE_SELECTION (fileSelection)->ok_button),
			      "clicked", G_CALLBACK (saveFileSignal), data);

	/* Connect the cancel_button to destroy the widget */
	g_signal_connect_swapped (G_OBJECT (GTK_FILE_SELECTION (fileSelection)->cancel_button),
		                      "clicked", G_CALLBACK (gtk_widget_destroy),
				      G_OBJECT (fileSelection));


	gtk_widget_show(fileSelection);
}
开发者ID:N4TT,项目名称:LevelSet,代码行数:19,代码来源:Core.cpp


示例13: file_selected

static int
file_selected(GtkWidget * nul,
	      GtkWidget * filew)
{
 char * fname = (char*)gtk_file_selection_get_filename(GTK_FILE_SELECTION(filew));
 gtk_widget_hide(filew);
 
 comm_plugin_upload(fname);
 return 0;
}	  
开发者ID:miettal,项目名称:armadillo420_standard,代码行数:10,代码来源:prefs_plugins.c


示例14: open

gint open(GtkWidget *widget, gpointer data) {
  if (!really(widget,data))
    return TRUE;
  GtkFileSelection *fsel = GTK_FILE_SELECTION(gtk_file_selection_new("Open"));
  gtk_signal_connect(GTK_OBJECT(fsel->ok_button), "clicked", GTK_SIGNAL_FUNC(openok), fsel);
  gtk_signal_connect_object(GTK_OBJECT(fsel->cancel_button), "clicked", GTK_SIGNAL_FUNC(gtk_widget_destroy), GTK_OBJECT(fsel));
  gtk_window_set_transient_for(GTK_WINDOW(fsel), GTK_WINDOW(mainwin->getWidget()));
  gtk_widget_show(GTK_WIDGET(fsel));
  return TRUE;
}
开发者ID:szakats,项目名称:bzflag_mirror,代码行数:10,代码来源:callbacks.cpp


示例15: DUMP

void
nsSetupTypeDlg::SelectFolder(GtkWidget *aWidget, gpointer aData)
{
    DUMP("SelectFolder");

    GtkWidget *fileSel = NULL;
    char *selDir = gCtx->opt->mDestination;

    fileSel = gtk_file_selection_new(gCtx->Res("SELECT_DIR"));
    gtk_window_set_modal(GTK_WINDOW(fileSel), TRUE);
    gtk_file_selection_set_filename(GTK_FILE_SELECTION(fileSel), selDir);
    gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(fileSel)->ok_button),
                       "clicked", (GtkSignalFunc) SelectFolderOK, fileSel);
    gtk_signal_connect_object(GTK_OBJECT(
                                GTK_FILE_SELECTION(fileSel)->cancel_button),
                                "clicked", (GtkSignalFunc) SelectFolderCancel,
                                GTK_OBJECT(fileSel));
    gtk_widget_show(fileSel); 
}
开发者ID:rn10950,项目名称:RetroZilla,代码行数:19,代码来源:nsSetupTypeDlg.cpp


示例16: load

static void load(GtkWidget *widget, gpointer data)
{
   if (!file_selection_launched)
     {
	GtkWidget *load_dialog;
	load_dialog = gtk_file_selection_new("Choose a N64 rom file : ");
	
	gtk_signal_connect(GTK_OBJECT(load_dialog), "destroy",
			   GTK_SIGNAL_FUNC(destroy_load), NULL);
	gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(load_dialog)->ok_button), 
			   "clicked", GTK_SIGNAL_FUNC(launch_rom), load_dialog);
	gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(load_dialog)->cancel_button),
			   "clicked", GTK_SIGNAL_FUNC(cancel_load), load_dialog);
   
	gtk_file_selection_set_filename(GTK_FILE_SELECTION(load_dialog),
					".");
	gtk_widget_show(load_dialog);
	file_selection_launched = 1;
     }
}
开发者ID:anta-,项目名称:mupen64-rr-lua-2,代码行数:20,代码来源:main_gtk.c


示例17: file_dialog_ok_set_textentry

/** ok callback for file_dialog that sets the selected filename in the
 * textentry that was passed as user data to file_dialog()
 */
static void file_dialog_ok_set_textentry (GtkWidget *widget, gpointer textentry) {
	const char *filename = NULL;
	GtkWidget* filesel = topmost_parent(widget);

	filename = gtk_file_selection_get_filename (GTK_FILE_SELECTION (filesel));

	if (!filename)
		return;

	gtk_entry_set_text (GTK_ENTRY (textentry), filename);
}
开发者ID:aufau,项目名称:xqf,代码行数:14,代码来源:dialogs.c


示例18: file_selected

void file_selected( GtkWidget* w, GtkFileSelection* fs )
{
    rom_file romfile;
    int system_type;
    
    strncpy( rom_name, gtk_file_selection_get_filename( GTK_FILE_SELECTION( fs ) ), 127 );
    gtk_widget_destroy( GTK_WIDGET( fs ) );
    romfile = read_romimage(rom_name);
    system_type = guess_system(romfile);
    activate_system( system_type, romfile);
}
开发者ID:Keripo,项目名称:ProjectZeroSlackr-SVN,代码行数:11,代码来源:ui_gtk.c


示例19: fdsn_choosen

static void
fdsn_choosen(GtkWidget *widget, TFDRIVERCHOOSER *choose_t)
{
  if (choose_t)
    {
      gtk_entry_set_text (GTK_ENTRY (choose_t->dsn_entry),
	  gtk_file_selection_get_filename (GTK_FILE_SELECTION (choose_t->
		  browse_sel)));
      choose_t->browse_sel = NULL;
    }
}
开发者ID:tws67,项目名称:bayonne-cygwin,代码行数:11,代码来源:driverchooser.c


示例20: filedump_set_entry

void filedump_set_entry(GtkWidget *w, GtkWidget *entry)
{
	const gchar *pd;

	pd = gtk_file_selection_get_filename(
			GTK_FILE_SELECTION(gtk_widget_get_toplevel(w)));
	gtk_entry_set_text(GTK_ENTRY(entry), 
			g_filename_to_utf8(pd, -1, NULL, NULL, NULL));
	gtk_widget_destroy(gtk_widget_get_toplevel(w));
	
}
开发者ID:dyne,项目名称:MuSE,代码行数:11,代码来源:filedump.cpp



注:本文中的GTK_FILE_SELECTION函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GTK_FIXED函数代码示例发布时间:2022-05-30
下一篇:
C++ GTK_FILE_CHOOSER函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap