summaryrefslogtreecommitdiffstats
path: root/webservice.c
diff options
context:
space:
mode:
authorGravatar Lubomir I. Ivanov <neolit123@gmail.com>2013-01-23 23:52:57 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-01-24 12:07:45 -0800
commit9acb52b9ee01e4f10bfab1462f2cf65505f9e054 (patch)
treef8f95a3b5c153ea265db0266bc38bd8fe4ec3792 /webservice.c
parent100c4008099615b3db492a5da793c4d21641d1cb (diff)
downloadsubsurface-9acb52b9ee01e4f10bfab1462f2cf65505f9e054.tar.gz
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>
Diffstat (limited to 'webservice.c')
-rw-r--r--webservice.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/webservice.c b/webservice.c
index 1f7b32f2e..88aea2743 100644
--- a/webservice.c
+++ b/webservice.c
@@ -32,6 +32,7 @@ struct download_dialog_state {
GtkWidget *status;
GtkWidget *apply;
gchar *xmldata;
+ guint xmldata_len;
};
/* 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);
}
state->xmldata = xmldata;
+ state->xmldata_len = len;
gtk_widget_set_sensitive(state->apply, ret);
}
@@ -144,12 +146,15 @@ void webservice_download_dialog(void)
{
const guint pad = 6;
/* 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 *frame_uid, *frame_status, *download, *image, *apply;
struct download_dialog_state state = {NULL};
int result;
+ if (!current_uid)
+ current_uid = "";
+
dialog = gtk_dialog_new_with_buttons(_("Download From Web Service"),
GTK_WINDOW(main_window),
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
@@ -198,9 +203,10 @@ void webservice_download_dialog(void)
result = gtk_dialog_run(GTK_DIALOG(dialog));
if (result == GTK_RESPONSE_ACCEPT) {
/* apply download */
- /* g_message("\napply download should happen here: \n\n %s", state.xmldata); */
- parse_xml_buffer(_("Webservice"), state.xmldata, strlen(state.xmldata), NULL);
+ parse_xml_buffer(_("Webservice"), state.xmldata, state.xmldata_len, NULL);
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);
gtk_widget_destroy(dialog);