"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "import_gui.c" between
jpilot-1.8.2.tar.gz and jpilot-2_0_1.tar.gz

About: J-Pilot is a desktop organizer application for Palm Pilot (PalmOS) devices. Ported to GTK3.

import_gui.c  (jpilot-1.8.2):import_gui.c  (jpilot-2_0_1)
skipping to change at line 40 skipping to change at line 40
#include "i18n.h" #include "i18n.h"
#include "utils.h" #include "utils.h"
#include "prefs.h" #include "prefs.h"
#include "log.h" #include "log.h"
#include "export.h" #include "export.h"
/******************************* Global vars **********************************/ /******************************* Global vars **********************************/
static GtkWidget *radio_types[MAX_IMPORT_TYPES+1]; static GtkWidget *radio_types[MAX_IMPORT_TYPES+1];
static int radio_file_types[MAX_IMPORT_TYPES+1]; static int radio_file_types[MAX_IMPORT_TYPES+1];
static int line_selected; static int line_selected;
static GtkWidget *filew=NULL;
static GtkWidget *import_record_ask_window=NULL; static GtkWidget *import_record_ask_window=NULL;
static int glob_import_record_ask_button_pressed; static int glob_import_record_ask_button_pressed;
static int glob_type_selected; static int glob_type_selected;
/****************************** Prototypes ************************************/ /****************************** Prototypes ************************************/
static int (*glob_import_callback)(GtkWidget *parent_window, const char *file_pa th, int type); static int (*glob_import_callback)(GtkWidget *parent_window, const char *file_pa th, int type);
/****************************** Main Code *************************************/ /****************************** Main Code *************************************/
/* /*
skipping to change at line 128 skipping to change at line 127
text[n++]='\0'; text[n++]='\0';
return n; return n;
} }
} /* end while(1) reading field */ } /* end while(1) reading field */
/* Terminate string and return */ /* Terminate string and return */
text[n++]='\0'; text[n++]='\0';
return n; return n;
} }
/*
static int guess_file_type(const char *path) static int guess_file_type(const char *path)
{ {
FILE *in; FILE *in;
char text[256]; char text[256];
if (!path) return IMPORT_TYPE_UNKNOWN; if (!path) return IMPORT_TYPE_UNKNOWN;
in=fopen(path, "r"); in=fopen(path, "r");
if (!in) return IMPORT_TYPE_UNKNOWN; if (!in) return IMPORT_TYPE_UNKNOWN;
if (dat_check_if_dat_file(in)) { if (dat_check_if_dat_file(in)) {
fclose(in); fclose(in);
skipping to change at line 150 skipping to change at line 150
fseek(in, 0, SEEK_SET); fseek(in, 0, SEEK_SET);
if (fread(text, 1, 15, in) < 1) { if (fread(text, 1, 15, in) < 1) {
jp_logf(JP_LOG_WARN, "fread failed %s %d\n", __FILE__, __LINE__); jp_logf(JP_LOG_WARN, "fread failed %s %d\n", __FILE__, __LINE__);
} }
if (!strncmp(text, "CSV ", 4)) { if (!strncmp(text, "CSV ", 4)) {
fclose(in); fclose(in);
return IMPORT_TYPE_CSV; return IMPORT_TYPE_CSV;
} }
fclose(in); fclose(in);
return IMPORT_TYPE_TEXT; return IMPORT_TYPE_TEXT;
} }*/
/* Main import file selection window */ /* Main import file selection window */
static gboolean cb_destroy(GtkWidget *widget) static gboolean cb_destroy(GtkWidget *widget)
{ {
filew = NULL; widget = NULL;
return FALSE; return FALSE;
} }
static void cb_quit(GtkWidget *widget, gpointer data) static void cb_quit(GtkWidget *widget, gpointer data)
{ {
const char *sel; const char *sel;
char dir[MAX_PREF_LEN+2]; char dir[MAX_PREF_LEN+2];
int i; int i;
jp_logf(JP_LOG_DEBUG, "Quit\n"); jp_logf(JP_LOG_DEBUG, "Quit\n");
sel = gtk_file_selection_get_filename(GTK_FILE_SELECTION(filew)); sel = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(widget));
strncpy(dir, sel, MAX_PREF_LEN); strncpy(dir, sel, MAX_PREF_LEN);
dir[MAX_PREF_LEN]='\0'; dir[MAX_PREF_LEN]='\0';
i=strlen(dir)-1; i=strlen(dir)-1;
if (i<0) i=0; if (i<0) i=0;
if (dir[i]!='/') { if (dir[i]!='/') {
for (i=strlen(dir); i>=0; i--) { for (i=strlen(dir); i>=0; i--) {
if (dir[i]=='/') { if (dir[i]=='/') {
dir[i+1]='\0'; dir[i+1]='\0';
break; break;
} }
} }
} }
set_pref(PREF_MEMO_IMPORT_PATH, 0, dir, TRUE); set_pref(PREF_MEMO_IMPORT_PATH, 0, dir, TRUE);
filew = NULL; gtk_widget_destroy(widget);
gtk_widget_destroy(data);
} }
static void cb_type(GtkWidget *widget, gpointer data) static void cb_type(GtkWidget *widget, gpointer data)
{ {
glob_type_selected=GPOINTER_TO_INT(data); glob_type_selected=GPOINTER_TO_INT(data);
} }
static void cb_import(GtkWidget *widget, gpointer filesel) static void cb_import(GtkWidget *widget, gpointer filesel)
{ {
const char *sel; char *sel;
struct stat statb; struct stat statb;
jp_logf(JP_LOG_DEBUG, "cb_import\n"); jp_logf(JP_LOG_DEBUG, "cb_import\n");
sel = gtk_file_selection_get_filename(GTK_FILE_SELECTION(filesel)); sel = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(widget));
jp_logf(JP_LOG_DEBUG, "file selected [%s]\n", sel); jp_logf(JP_LOG_DEBUG, "file selected [%s]\n", sel);
/* Check to see if its a regular file */ /* Check to see if its a regular file */
if (stat(sel, &statb)) { if (stat(sel, &statb)) {
jp_logf(JP_LOG_DEBUG, "File selected was not stat-able\n"); jp_logf(JP_LOG_DEBUG, "File selected was not stat-able\n");
g_free(sel);
return; return;
} }
if (!S_ISREG(statb.st_mode)) { if (!S_ISREG(statb.st_mode)) {
jp_logf(JP_LOG_DEBUG, "File selected was not a regular file\n"); jp_logf(JP_LOG_DEBUG, "File selected was not a regular file\n");
g_free(sel);
return; return;
} }
glob_import_callback(filesel, sel, glob_type_selected); glob_import_callback(widget, sel, glob_type_selected);
cb_quit(widget, filew); g_free(sel);
}
static void cb_import_select_row(GtkWidget *file_clist,
gint row,
gint column,
GdkEventButton *bevent,
gpointer data)
{
const char *sel;
struct stat statb;
int guessed_type;
int i;
jp_logf(JP_LOG_DEBUG, "cb_import_select_row\n");
sel = gtk_file_selection_get_filename(GTK_FILE_SELECTION(filew));
/* Check to see if its a regular file */ cb_quit(widget, widget);
if (stat(sel, &statb)) {
jp_logf(JP_LOG_DEBUG, "File selected was not stat-able\n");
return;
}
if (!S_ISREG(statb.st_mode)) {
jp_logf(JP_LOG_DEBUG, "File selected was not a regular file\n");
return;
}
guessed_type=guess_file_type(sel);
for (i=0; i<MAX_IMPORT_TYPES; i++) {
if (radio_types[i]==NULL) break;
if (guessed_type==radio_file_types[i]) {
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radio_types[i]), TRUE);
break;
}
}
return;
} }
static gboolean cb_import_record_ask_destroy(GtkWidget *widget) static gboolean cb_import_record_ask_destroy(GtkWidget *widget)
{ {
import_record_ask_window = NULL; import_record_ask_window = NULL;
gtk_main_quit(); gtk_main_quit();
return FALSE; return FALSE;
} }
static void static void
skipping to change at line 293 skipping to change at line 260
char str[100]; char str[100];
char *l; char *l;
long char_set; long char_set;
/* There is no support yet for changing the suggested category */ /* There is no support yet for changing the suggested category */
/* A menu for selecting cat to be imported into is desirable */ /* A menu for selecting cat to be imported into is desirable */
*new_cat_num = suggested_cat_num; *new_cat_num = suggested_cat_num;
glob_import_record_ask_button_pressed = DIALOG_SAID_IMPORT_QUIT; glob_import_record_ask_button_pressed = DIALOG_SAID_IMPORT_QUIT;
gdk_window_get_size(main_window->window, &pw, &ph); pw = gdk_window_get_width(gtk_widget_get_window(main_window));
gdk_window_get_root_origin(main_window->window, &px, &py); ph = gdk_window_get_height(gtk_widget_get_window(main_window));
gdk_window_get_root_origin(gtk_widget_get_window(main_window), &px, &py);
pw = gtk_paned_get_position(GTK_PANED(pane)); pw = gtk_paned_get_position(GTK_PANED(pane));
px+=40; px+=40;
import_record_ask_window = gtk_widget_new(GTK_TYPE_WINDOW, import_record_ask_window = gtk_widget_new(GTK_TYPE_WINDOW,
"type", GTK_WINDOW_TOPLEVEL, "type", GTK_WINDOW_TOPLEVEL,
"title", _("Import"), "title", _("Import"),
NULL); NULL);
gtk_window_set_default_size(GTK_WINDOW(import_record_ask_window), pw, ph); gtk_window_set_default_size(GTK_WINDOW(import_record_ask_window), pw, ph);
gtk_widget_set_uposition(GTK_WIDGET(import_record_ask_window), px, py); //gtk_widget_set_uposition(GTK_WIDGET(import_record_ask_window), px, py);
gtk_container_set_border_width(GTK_CONTAINER(import_record_ask_window), 5); gtk_container_set_border_width(GTK_CONTAINER(import_record_ask_window), 5);
gtk_window_set_modal(GTK_WINDOW(import_record_ask_window), TRUE); gtk_window_set_modal(GTK_WINDOW(import_record_ask_window), TRUE);
gtk_window_set_transient_for(GTK_WINDOW(import_record_ask_window), GTK_WINDOW (main_window)); gtk_window_set_transient_for(GTK_WINDOW(import_record_ask_window), GTK_WINDOW (main_window));
gtk_signal_connect(GTK_OBJECT(import_record_ask_window), "destroy", g_signal_connect(G_OBJECT(import_record_ask_window), "destroy",
GTK_SIGNAL_FUNC(cb_import_record_ask_destroy), G_CALLBACK(cb_import_record_ask_destroy),
import_record_ask_window); import_record_ask_window);
vbox=gtk_vbox_new(FALSE, 0); vbox=gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add(GTK_CONTAINER(import_record_ask_window), vbox); gtk_container_add(GTK_CONTAINER(import_record_ask_window), vbox);
/* Private */ /* Private */
if (priv) { if (priv) {
g_snprintf(str, sizeof(str), _("Record was marked as private")); g_snprintf(str, sizeof(str), _("Record was marked as private"));
} else { } else {
g_snprintf(str, sizeof(str), _("Record was not marked as private")); g_snprintf(str, sizeof(str), _("Record was not marked as private"));
} }
label = gtk_label_new(str); label = gtk_label_new(str);
gtk_misc_set_alignment(GTK_MISC(label), 0, 0); gtk_widget_set_halign(GTK_WIDGET(label), GTK_ALIGN_START);
gtk_widget_set_valign(GTK_WIDGET(label), GTK_ALIGN_START);
gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
/* Category */ /* Category */
get_pref(PREF_CHAR_SET, &char_set, NULL); get_pref(PREF_CHAR_SET, &char_set, NULL);
l = charset_p2newj(old_cat_name, 16, char_set); l = charset_p2newj(old_cat_name, 16, char_set);
g_snprintf(str, sizeof(str), _("Category before import was: [%s]"), l); g_snprintf(str, sizeof(str), _("Category before import was: [%s]"), l);
g_free(l); g_free(l);
label = gtk_label_new(str); label = gtk_label_new(str);
gtk_misc_set_alignment(GTK_MISC(label), 0, 0); gtk_widget_set_halign(GTK_WIDGET(label), GTK_ALIGN_START);
gtk_widget_set_valign(GTK_WIDGET(label), GTK_ALIGN_START);
gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
l = charset_p2newj(cai->name[suggested_cat_num], 16, char_set); l = charset_p2newj(cai->name[suggested_cat_num], 16, char_set);
g_snprintf(str, sizeof(str), _("Record will be put in category [%s]"), l); g_snprintf(str, sizeof(str), _("Record will be put in category [%s]"), l);
g_free(l); g_free(l);
label = gtk_label_new(str); label = gtk_label_new(str);
gtk_misc_set_alignment(GTK_MISC(label), 0, 0); gtk_widget_set_halign(GTK_WIDGET(label), GTK_ALIGN_START);
gtk_widget_set_valign(GTK_WIDGET(label), GTK_ALIGN_START);
gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
/* Text window with scrollbar to display record */ /* Text window with scrollbar to display record */
temp_hbox = gtk_hbox_new(FALSE, 0); temp_hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
gtk_box_pack_start(GTK_BOX(vbox), temp_hbox, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox), temp_hbox, TRUE, TRUE, 0);
textw = gtk_text_view_new(); textw = gtk_text_view_new();
textw_buffer = G_OBJECT(gtk_text_view_get_buffer(GTK_TEXT_VIEW(textw))); textw_buffer = G_OBJECT(gtk_text_view_get_buffer(GTK_TEXT_VIEW(textw)));
gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW(textw), FALSE); gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW(textw), FALSE);
gtk_text_view_set_editable(GTK_TEXT_VIEW(textw), FALSE); gtk_text_view_set_editable(GTK_TEXT_VIEW(textw), FALSE);
gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(textw), GTK_WRAP_WORD); gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(textw), GTK_WRAP_WORD);
scrolled_window = gtk_scrolled_window_new(NULL, NULL); scrolled_window = gtk_scrolled_window_new(NULL, NULL);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window), gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window),
GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
gtk_container_set_border_width(GTK_CONTAINER(scrolled_window), 1); gtk_container_set_border_width(GTK_CONTAINER(scrolled_window), 1);
gtk_container_add(GTK_CONTAINER(scrolled_window), textw); gtk_container_add(GTK_CONTAINER(scrolled_window), textw);
gtk_box_pack_start_defaults(GTK_BOX(temp_hbox), scrolled_window); gtk_box_pack_start(GTK_BOX(temp_hbox), scrolled_window,TRUE,TRUE,0);
if (text) { if (text) {
gtk_text_buffer_set_text(GTK_TEXT_BUFFER(textw_buffer), text, -1); gtk_text_buffer_set_text(GTK_TEXT_BUFFER(textw_buffer), text, -1);
} }
temp_hbox = gtk_hbutton_box_new(); temp_hbox = gtk_button_box_new(GTK_ORIENTATION_HORIZONTAL);
gtk_button_box_set_spacing(GTK_BUTTON_BOX(temp_hbox), 6); gtk_box_set_spacing(GTK_BOX(temp_hbox), 6);
gtk_container_set_border_width(GTK_CONTAINER(temp_hbox), 6); gtk_container_set_border_width(GTK_CONTAINER(temp_hbox), 6);
gtk_box_pack_start(GTK_BOX(vbox), temp_hbox, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), temp_hbox, FALSE, FALSE, 0);
/* Import button */ /* Import button */
button = gtk_button_new_with_label(_("Import")); button = gtk_button_new_with_label(_("Import"));
gtk_box_pack_start(GTK_BOX(temp_hbox), button, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(temp_hbox), button, TRUE, TRUE, 0);
gtk_signal_connect(GTK_OBJECT(button), "clicked", g_signal_connect(G_OBJECT(button), "clicked",
GTK_SIGNAL_FUNC(cb_import_record_ask_quit), G_CALLBACK(cb_import_record_ask_quit),
GINT_TO_POINTER(DIALOG_SAID_IMPORT_YES)); GINT_TO_POINTER(DIALOG_SAID_IMPORT_YES));
/* Import All button */ /* Import All button */
button = gtk_button_new_with_label(_("Import All")); button = gtk_button_new_with_label(_("Import All"));
gtk_box_pack_start(GTK_BOX(temp_hbox), button, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(temp_hbox), button, TRUE, TRUE, 0);
gtk_signal_connect(GTK_OBJECT(button), "clicked", g_signal_connect(G_OBJECT(button), "clicked",
GTK_SIGNAL_FUNC(cb_import_record_ask_quit), G_CALLBACK(cb_import_record_ask_quit),
GINT_TO_POINTER(DIALOG_SAID_IMPORT_ALL)); GINT_TO_POINTER(DIALOG_SAID_IMPORT_ALL));
/* Skip button */ /* Skip button */
button = gtk_button_new_with_label(_("Skip")); button = gtk_button_new_with_label(_("Skip"));
gtk_box_pack_start(GTK_BOX(temp_hbox), button, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(temp_hbox), button, TRUE, TRUE, 0);
gtk_signal_connect(GTK_OBJECT(button), "clicked", g_signal_connect(G_OBJECT(button), "clicked",
GTK_SIGNAL_FUNC(cb_import_record_ask_quit), G_CALLBACK(cb_import_record_ask_quit),
GINT_TO_POINTER(DIALOG_SAID_IMPORT_SKIP)); GINT_TO_POINTER(DIALOG_SAID_IMPORT_SKIP));
/* Quit button */ /* Quit button */
button = gtk_button_new_from_stock(GTK_STOCK_CLOSE); button = gtk_button_new_with_label("Close");
gtk_box_pack_start(GTK_BOX(temp_hbox), button, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(temp_hbox), button, TRUE, TRUE, 0);
gtk_signal_connect(GTK_OBJECT(button), "clicked", g_signal_connect(G_OBJECT(button), "clicked",
GTK_SIGNAL_FUNC(cb_import_record_ask_quit), G_CALLBACK(cb_import_record_ask_quit),
GINT_TO_POINTER(DIALOG_SAID_IMPORT_QUIT)); GINT_TO_POINTER(DIALOG_SAID_IMPORT_QUIT));
gtk_widget_show_all(import_record_ask_window); gtk_widget_show_all(import_record_ask_window);
gtk_main(); gtk_main();
return glob_import_record_ask_button_pressed; return glob_import_record_ask_button_pressed;
} }
void import_gui(GtkWidget *main_window, GtkWidget *main_pane, void import_gui(GtkWidget *main_window, GtkWidget *main_pane,
char *type_desc[], int type_int[], char *type_desc[], int type_int[],
int (*import_callback)(GtkWidget *parent_window, int (*import_callback)(GtkWidget *parent_window,
const char *file_path, int type)) const char *file_path, int type)) {
{ GtkWidget *vbox, *hbox;
GtkWidget *button; GtkWidget *label;
GtkWidget *vbox, *hbox; char title[256];
GtkWidget *label; const char *svalue;
char title[256]; GSList *group;
const char *svalue; int res, i;
GSList *group; GtkWidget *fileChooserWidget;
int i;
int pw, ph, px, py; line_selected = -1;
if (filew) return; g_snprintf(title, sizeof(title), "%s %s", PN, _("Import"));
fileChooserWidget = gtk_file_chooser_dialog_new(_("Import"), GTK_WINDOW(main
line_selected = -1; _window), GTK_FILE_CHOOSER_ACTION_OPEN,
"Close", GTK_RESPONSE_CANCEL
gdk_window_get_size(main_window->window, &pw, &ph); , "Import", GTK_RESPONSE_ACCEPT,
gdk_window_get_root_origin(main_window->window, &px, &py); NULL);
pw = gtk_paned_get_position(GTK_PANED(main_pane)); gtk_file_chooser_set_show_hidden(GTK_FILE_CHOOSER(fileChooserWidget), TRUE);
px+=40; get_pref(PREF_MEMO_IMPORT_PATH, NULL, &svalue);
if (svalue && svalue[0]) {
g_snprintf(title, sizeof(title), "%s %s", PN, _("Import")); gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(fileChooserWidget),
svalue);
filew = gtk_widget_new(GTK_TYPE_FILE_SELECTION, }
"type", GTK_WINDOW_TOPLEVEL, GtkBox *extraWidget = GTK_BOX(gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0));
"title", title,
NULL); /* File Type radio buttons */
gtk_window_set_default_size(GTK_WINDOW(filew), pw, ph); vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
gtk_widget_set_uposition(filew, px, py); hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
gtk_window_set_modal(GTK_WINDOW(filew), TRUE); gtk_box_pack_start(extraWidget,
gtk_window_set_transient_for(GTK_WINDOW(filew), GTK_WINDOW(main_window)); vbox, TRUE, TRUE, 0);
gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 0);
get_pref(PREF_MEMO_IMPORT_PATH, NULL, &svalue); label = gtk_label_new(_("Import File Type"));
if (svalue && svalue[0]) { gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
gtk_file_selection_set_filename(GTK_FILE_SELECTION(filew), svalue); group = NULL;
} for (i = 0; i < MAX_IMPORT_TYPES; i++) {
if (type_desc[i] == NULL) break;
glob_import_callback=import_callback; radio_types[i] = gtk_radio_button_new_with_label(group, _(type_desc[i]))
;
/* Set the type to match the first button, which will be set */ radio_file_types[i] = type_int[i];
glob_type_selected=type_int[0]; group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(radio_types[i]));
gtk_box_pack_start(GTK_BOX(vbox), radio_types[i], TRUE, TRUE, 0);
gtk_widget_hide((GTK_FILE_SELECTION(filew)->cancel_button)); g_signal_connect(G_OBJECT(radio_types[i]), "clicked",
gtk_signal_connect(GTK_OBJECT(filew), "destroy", G_CALLBACK(cb_type), GINT_TO_POINTER(type_int[i]));
GTK_SIGNAL_FUNC(cb_destroy), filew); }
radio_types[i] = NULL;
/* Even though I hide the ok button I still want to connect its signal */ radio_file_types[i] = 0;
/* because a double click on the file name also calls this callback */ gtk_widget_show_all(vbox);
gtk_widget_hide(GTK_WIDGET(GTK_FILE_SELECTION(filew)->ok_button)); glob_import_callback = import_callback;
gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(filew)->ok_button),
"clicked", GTK_SIGNAL_FUNC(cb_import), filew); /* Set the type to match the first button, which will be set */
glob_type_selected = type_int[0];
label = gtk_label_new(_("To change to a hidden directory type it below and hi gtk_file_chooser_set_extra_widget(GTK_FILE_CHOOSER(fileChooserWidget), GTK_W
t TAB")); IDGET(extraWidget));
gtk_box_pack_start(GTK_BOX(GTK_FILE_SELECTION(filew)->main_vbox), g_signal_connect(G_OBJECT(fileChooserWidget), "destroy",
label, FALSE, FALSE, 0); G_CALLBACK(cb_destroy), fileChooserWidget);
gtk_widget_show(label);
res = gtk_dialog_run(GTK_DIALOG(fileChooserWidget));
/* Quit/Import buttons */ if (res == GTK_RESPONSE_ACCEPT) {
button = gtk_button_new_from_stock(GTK_STOCK_CLOSE); cb_import(fileChooserWidget, NULL);
gtk_box_pack_start(GTK_BOX(GTK_FILE_SELECTION(filew)->ok_button->parent), } else {
button, TRUE, TRUE, 0); cb_quit(fileChooserWidget, fileChooserWidget);
gtk_signal_connect(GTK_OBJECT(button), }
"clicked", GTK_SIGNAL_FUNC(cb_quit), filew);
gtk_widget_show(button);
button = gtk_button_new_with_label(_("Import"));
gtk_box_pack_start(GTK_BOX(GTK_FILE_SELECTION(filew)->ok_button->parent),
button, TRUE, TRUE, 0);
gtk_signal_connect(GTK_OBJECT(button),
"clicked", GTK_SIGNAL_FUNC(cb_import), filew);
gtk_widget_show(button);
/* File Type radio buttons */
vbox=gtk_vbox_new(FALSE, 0);
hbox=gtk_hbox_new(FALSE, 0);
gtk_box_pack_start(GTK_BOX(GTK_FILE_SELECTION(filew)->action_area),
vbox, TRUE, TRUE, 0);
gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 0);
label = gtk_label_new(_("Import File Type"));
gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
group = NULL;
for (i=0; i<MAX_IMPORT_TYPES; i++) {
if (type_desc[i]==NULL) break;
radio_types[i] = gtk_radio_button_new_with_label(group, _(type_desc[i]));
radio_file_types[i] = type_int[i];
group = gtk_radio_button_group(GTK_RADIO_BUTTON(radio_types[i]));
gtk_box_pack_start(GTK_BOX(vbox), radio_types[i], TRUE, TRUE, 0);
gtk_signal_connect(GTK_OBJECT(radio_types[i]), "clicked",
GTK_SIGNAL_FUNC(cb_type), GINT_TO_POINTER(type_int[i]))
;
}
radio_types[i]=NULL;
radio_file_types[i]=0;
/* This callback is for a file guess algorithm and to pre-push
* the type buttons */
gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(filew)->file_list),
"cursor_changed", GTK_SIGNAL_FUNC(cb_import_select_row), N
ULL);
gtk_widget_show_all(vbox);
gtk_widget_show(filew);
} }
 End of changes. 28 change blocks. 
172 lines changed or deleted 101 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)