mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Store/Retrieve last entered webservice UID to/from config.
We use subsurface_set_conf() subsurface_get_conf() to store and recall the prefered UID for the download. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
100c400809
commit
9acb52b9ee
1 changed files with 9 additions and 3 deletions
12
webservice.c
12
webservice.c
|
@ -32,6 +32,7 @@ struct download_dialog_state {
|
||||||
GtkWidget *status;
|
GtkWidget *status;
|
||||||
GtkWidget *apply;
|
GtkWidget *apply;
|
||||||
gchar *xmldata;
|
gchar *xmldata;
|
||||||
|
guint xmldata_len;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* this method uses libsoup as a backend. if there are some portability,
|
/* this method uses libsoup as a backend. if there are some portability,
|
||||||
|
@ -125,6 +126,7 @@ static void download_dialog_connect_cb(GtkWidget *w, gpointer data)
|
||||||
gtk_label_set_text(GTK_LABEL(state->status), err);
|
gtk_label_set_text(GTK_LABEL(state->status), err);
|
||||||
}
|
}
|
||||||
state->xmldata = xmldata;
|
state->xmldata = xmldata;
|
||||||
|
state->xmldata_len = len;
|
||||||
gtk_widget_set_sensitive(state->apply, ret);
|
gtk_widget_set_sensitive(state->apply, ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,12 +146,15 @@ void webservice_download_dialog(void)
|
||||||
{
|
{
|
||||||
const guint pad = 6;
|
const guint pad = 6;
|
||||||
/* user entered value should be stored in the config */
|
/* user entered value should be stored in the config */
|
||||||
const gchar *current_uid = "41TFEC8ZMVD5DBE0JPBBU5JDDA2Y6T";
|
const gchar *current_uid = subsurface_get_conf("webservice_uid");
|
||||||
GtkWidget *dialog, *vbox, *status, *info, *uid;
|
GtkWidget *dialog, *vbox, *status, *info, *uid;
|
||||||
GtkWidget *frame_uid, *frame_status, *download, *image, *apply;
|
GtkWidget *frame_uid, *frame_status, *download, *image, *apply;
|
||||||
struct download_dialog_state state = {NULL};
|
struct download_dialog_state state = {NULL};
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
|
if (!current_uid)
|
||||||
|
current_uid = "";
|
||||||
|
|
||||||
dialog = gtk_dialog_new_with_buttons(_("Download From Web Service"),
|
dialog = gtk_dialog_new_with_buttons(_("Download From Web Service"),
|
||||||
GTK_WINDOW(main_window),
|
GTK_WINDOW(main_window),
|
||||||
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
|
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||||
|
@ -198,9 +203,10 @@ void webservice_download_dialog(void)
|
||||||
result = gtk_dialog_run(GTK_DIALOG(dialog));
|
result = gtk_dialog_run(GTK_DIALOG(dialog));
|
||||||
if (result == GTK_RESPONSE_ACCEPT) {
|
if (result == GTK_RESPONSE_ACCEPT) {
|
||||||
/* apply download */
|
/* apply download */
|
||||||
/* g_message("\napply download should happen here: \n\n %s", state.xmldata); */
|
parse_xml_buffer(_("Webservice"), state.xmldata, state.xmldata_len, NULL);
|
||||||
parse_xml_buffer(_("Webservice"), state.xmldata, strlen(state.xmldata), NULL);
|
|
||||||
report_dives(TRUE, FALSE);
|
report_dives(TRUE, FALSE);
|
||||||
|
/* store last entered uid in config */
|
||||||
|
subsurface_set_conf("webservice_uid", gtk_entry_get_text(GTK_ENTRY(uid)));
|
||||||
}
|
}
|
||||||
download_dialog_release_xml(&state);
|
download_dialog_release_xml(&state);
|
||||||
gtk_widget_destroy(dialog);
|
gtk_widget_destroy(dialog);
|
||||||
|
|
Loading…
Add table
Reference in a new issue