Changed gmdb2 output filenames to textentries

GtkFileChooserButton was cripled by gtk developers so that it now only support
selecting an existing file for overwrite.
https://bugzilla.gnome.org/show_bug.cgi?id=157384

TextEntries is really not user friendly, but it's better than forced overwrite.
This commit is contained in:
Nirgal Vourgère 2013-07-14 19:06:59 +02:00
parent 088493d499
commit 5312060544
4 changed files with 31 additions and 32 deletions

View File

@ -90,16 +90,6 @@
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkFileChooserButton" id="filechooserbutton1">
<property name="visible">True</property>
<property name="action">save</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
</packing>
</child>
<child>
<widget class="GtkComboBox" id="term_combo">
<property name="visible">True</property>
@ -202,6 +192,18 @@
<property name="bottom_attach">5</property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="filename_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">&#x25CF;</property>
<property name="text" translatable="yes">table.csv</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
</packing>
</child>
</widget>
<packing>
<property name="position">2</property>

View File

@ -207,17 +207,6 @@
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkFileChooserButton" id="filechooserbutton1">
<property name="visible">True</property>
<property name="action">save</property>
<property name="do_overwrite_confirmation">True</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
</packing>
</child>
<child>
<widget class="GtkComboBox" id="table_combo">
<property name="visible">True</property>
@ -249,6 +238,18 @@ SQLite</property>
<property name="bottom_attach">3</property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="filename_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">&#x25CF;</property>
<property name="text" translatable="yes">export.sql</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
</packing>
</child>
<child>
<placeholder/>
</child>

View File

@ -53,7 +53,7 @@ FILE *outfile;
GtkWidget *dlg;
printf("file path %s\n",file_path);
//printf("file path %s\n",file_path);
if ((outfile=fopen(file_path, "w"))==NULL) {
GtkWidget* dlg = gtk_message_dialog_new (NULL,
GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_WARNING, GTK_BUTTONS_CLOSE,
@ -78,14 +78,14 @@ gmdb_schema_export_cb(GtkWidget *w, gpointer data)
{
GtkWidget *schemawin, *checkbox, *chooser;
GtkComboBox *combobox;
gchar *file_path;
const gchar *file_path;
gchar *tmp;
int i;
schemawin = glade_xml_get_widget (schemawin_xml, "schema_dialog");
chooser = glade_xml_get_widget (schemawin_xml, "filechooserbutton1");
file_path = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (chooser));
chooser = glade_xml_get_widget (schemawin_xml, "filename_entry");
file_path = gtk_entry_get_text(GTK_ENTRY(chooser));
combobox = GTK_COMBO_BOX(glade_xml_get_widget(schemawin_xml, "table_combo"));
tmp = gtk_combo_box_get_active_text(combobox);
@ -124,8 +124,8 @@ int i;
}
//printf("%s %s %02X\n",tabname,backend,export_options);
gtk_widget_destroy(schemawin);
gmdb_schema_export(file_path);
gtk_widget_destroy(schemawin);
}
static void
check_default_options() {
@ -190,7 +190,6 @@ void
gmdb_schema_new_cb(GtkWidget *w, gpointer data)
{
GtkComboBox *combobox;
GtkFileChooser *filechooser;
MdbCatalogEntry *entry;
int i;
@ -216,9 +215,6 @@ gmdb_schema_new_cb(GtkWidget *w, gpointer data)
} /* for */
gtk_combo_box_set_active(combobox, 0);
filechooser = GTK_FILE_CHOOSER(glade_xml_get_widget(schemawin_xml, "filechooserbutton1"));
gtk_file_chooser_set_action(filechooser, GTK_FILE_CHOOSER_ACTION_SAVE);
check_default_options();
refresh_available_options();
}

View File

@ -156,8 +156,8 @@ gmdb_export_get_filepath(GladeXML *xml)
{
GtkWidget *fchoose;
fchoose = glade_xml_get_widget(xml, "filechooserbutton1");
return (gchar *) gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (fchoose));
fchoose = glade_xml_get_widget(xml, "filename_entry");
return (gchar *) gtk_entry_get_text (GTK_ENTRY (fchoose));
}
void