本文整理汇总了C++中GTK_FILE_SELECTION函数的典型用法代码示例。如果您正苦于以下问题:C++ GTK_FILE_SELECTION函数的具体用法?C++ GTK_FILE_SELECTION怎么用?C++ GTK_FILE_SELECTION使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GTK_FILE_SELECTION函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 */
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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()
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}