mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Remove the XML file selection from the DC download dialog
Renamed "import_dialog" to "download_dialog" and also focused the download dialog strictly on dive computer functionality. Removed the file button and "filenames" checks from "download_dialog". Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
This commit is contained in:
parent
ff67ca92ed
commit
faab2981a9
2 changed files with 24 additions and 32 deletions
|
@ -56,7 +56,7 @@ extern visible_cols_t visible_cols;
|
||||||
extern const char *divelist_font;
|
extern const char *divelist_font;
|
||||||
extern void set_divelist_font(const char *);
|
extern void set_divelist_font(const char *);
|
||||||
|
|
||||||
extern void import_dialog(GtkWidget *, gpointer);
|
extern void download_dialog(GtkWidget *, gpointer);
|
||||||
extern void add_dive_cb(GtkWidget *, gpointer);
|
extern void add_dive_cb(GtkWidget *, gpointer);
|
||||||
extern void report_error(GError* error);
|
extern void report_error(GError* error);
|
||||||
extern int process_ui_events(void);
|
extern int process_ui_events(void);
|
||||||
|
|
18
gtk-gui.c
18
gtk-gui.c
|
@ -881,7 +881,7 @@ static GtkActionEntry menu_items[] = {
|
||||||
{ "CloseFile", GTK_STOCK_CLOSE, NULL, NULL, NULL, G_CALLBACK(file_close) },
|
{ "CloseFile", GTK_STOCK_CLOSE, NULL, NULL, NULL, G_CALLBACK(file_close) },
|
||||||
{ "Print", GTK_STOCK_PRINT, NULL, CTRLCHAR "P", NULL, G_CALLBACK(do_print) },
|
{ "Print", GTK_STOCK_PRINT, NULL, CTRLCHAR "P", NULL, G_CALLBACK(do_print) },
|
||||||
{ "ImportFile", GTK_STOCK_GO_BACK, "Import XML File", CTRLCHAR "I", NULL, NULL },
|
{ "ImportFile", GTK_STOCK_GO_BACK, "Import XML File", CTRLCHAR "I", NULL, NULL },
|
||||||
{ "DownloadLog", GTK_STOCK_GO_DOWN, "Download From Dive Computer", CTRLCHAR "D", NULL, NULL },
|
{ "DownloadLog", GTK_STOCK_GO_DOWN, "Download From Dive Computer", CTRLCHAR "D", NULL, G_CALLBACK(download_dialog) },
|
||||||
{ "AddDive", GTK_STOCK_ADD, "Add Dive", NULL, NULL, G_CALLBACK(add_dive_cb) },
|
{ "AddDive", GTK_STOCK_ADD, "Add Dive", NULL, NULL, G_CALLBACK(add_dive_cb) },
|
||||||
{ "Preferences", GTK_STOCK_PREFERENCES, "Preferences", PREFERENCE_ACCEL, NULL, G_CALLBACK(preferences_dialog) },
|
{ "Preferences", GTK_STOCK_PREFERENCES, "Preferences", PREFERENCE_ACCEL, NULL, G_CALLBACK(preferences_dialog) },
|
||||||
{ "Renumber", NULL, "Renumber", NULL, NULL, G_CALLBACK(renumber_dialog) },
|
{ "Renumber", NULL, "Renumber", NULL, NULL, G_CALLBACK(renumber_dialog) },
|
||||||
|
@ -1415,11 +1415,10 @@ static GtkWidget *import_dive_computer(device_data_t *data, GtkDialog *dialog)
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
void import_dialog(GtkWidget *w, gpointer data)
|
void download_dialog(GtkWidget *w, gpointer data)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
GtkWidget *dialog, *button, *hbox, *vbox, *label, *info = NULL;
|
GtkWidget *dialog, *button, *hbox, *vbox, *label, *info = NULL;
|
||||||
GSList *filenames = NULL;
|
|
||||||
GtkComboBox *computer;
|
GtkComboBox *computer;
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
GtkEntry *device;
|
GtkEntry *device;
|
||||||
|
@ -1427,7 +1426,7 @@ void import_dialog(GtkWidget *w, gpointer data)
|
||||||
.devname = NULL,
|
.devname = NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
dialog = gtk_dialog_new_with_buttons("Import",
|
dialog = gtk_dialog_new_with_buttons("Download From Dive Computer",
|
||||||
GTK_WINDOW(main_window),
|
GTK_WINDOW(main_window),
|
||||||
GTK_DIALOG_DESTROY_WITH_PARENT,
|
GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||||
GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
|
GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
|
||||||
|
@ -1435,9 +1434,8 @@ void import_dialog(GtkWidget *w, gpointer data)
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
vbox = gtk_dialog_get_content_area(GTK_DIALOG(dialog));
|
vbox = gtk_dialog_get_content_area(GTK_DIALOG(dialog));
|
||||||
label = gtk_label_new("Choose what to import:");
|
label = gtk_label_new(" Please select dive computer and device. ");
|
||||||
gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, TRUE, 3);
|
gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, TRUE, 3);
|
||||||
xml_file_selector(vbox, dialog, &filenames);
|
|
||||||
computer = dive_computer_selector(vbox);
|
computer = dive_computer_selector(vbox);
|
||||||
device = dive_computer_device(vbox);
|
device = dive_computer_device(vbox);
|
||||||
hbox = gtk_hbox_new(FALSE, 6);
|
hbox = gtk_hbox_new(FALSE, 6);
|
||||||
|
@ -1457,11 +1455,8 @@ repeat:
|
||||||
GtkTreeModel *model;
|
GtkTreeModel *model;
|
||||||
|
|
||||||
case GTK_RESPONSE_ACCEPT:
|
case GTK_RESPONSE_ACCEPT:
|
||||||
/* what happened - did the user pick a file? In that case
|
|
||||||
* we ignore whether a dive computer model was picked */
|
|
||||||
if (info)
|
if (info)
|
||||||
gtk_widget_destroy(info);
|
gtk_widget_destroy(info);
|
||||||
if (!filenames || g_slist_length(filenames) == 0) {
|
|
||||||
const char *vendor, *product;
|
const char *vendor, *product;
|
||||||
|
|
||||||
if (!gtk_combo_box_get_active_iter(computer, &iter))
|
if (!gtk_combo_box_get_active_iter(computer, &iter))
|
||||||
|
@ -1484,10 +1479,7 @@ repeat:
|
||||||
info = import_dive_computer(&devicedata, GTK_DIALOG(dialog));
|
info = import_dive_computer(&devicedata, GTK_DIALOG(dialog));
|
||||||
if (info)
|
if (info)
|
||||||
goto repeat;
|
goto repeat;
|
||||||
} else if (filenames) {
|
|
||||||
g_slist_foreach(filenames,do_import_file,NULL);
|
|
||||||
g_slist_free(filenames);
|
|
||||||
}
|
|
||||||
report_dives(TRUE);
|
report_dives(TRUE);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Add table
Reference in a new issue