summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Alan Fitton <ajf@eth0.org.uk>2012-01-23 11:27:13 +0000
committerGravatar Alan Fitton <ajf@eth0.org.uk>2012-01-23 11:27:13 +0000
commit4e23a6db9e8cdca8ba6a1c19f944f2b7c8ac9045 (patch)
tree1de7f76ab11235d1d1a62d65c785160dc53de50e
parentcdaff8ede183ae5d76b2d02d2cb72ce136e3592e (diff)
issue 158
-rw-r--r--src/requests.c10
-rw-r--r--src/trg-destination-combo.c5
-rw-r--r--src/trg-torrent-add-dialog.c6
3 files changed, 13 insertions, 8 deletions
diff --git a/src/requests.c b/src/requests.c
index c78ba65..3da3e9b 100644
--- a/src/requests.c
+++ b/src/requests.c
@@ -50,22 +50,22 @@ JsonNode *generic_request(gchar * method, JsonArray * ids)
JsonNode *session_stats(void)
{
- return generic_request(METHOD_SESSION_STATS, NULL);
+ return base_request(METHOD_SESSION_STATS);
}
JsonNode *blocklist_update(void)
{
- return generic_request(METHOD_BLOCKLIST_UPDATE, NULL);
+ return base_request(METHOD_BLOCKLIST_UPDATE);
}
JsonNode *port_test(void)
{
- return generic_request(METHOD_PORT_TEST, NULL);
+ return base_request(METHOD_PORT_TEST);
}
JsonNode *session_get(void)
{
- return generic_request(METHOD_SESSION_GET, NULL);
+ return base_request(METHOD_SESSION_GET);
}
JsonNode *torrent_set_location(JsonArray * array, gchar * location,
@@ -267,9 +267,11 @@ static JsonNode *base_request(gchar * method)
JsonNode *root = json_node_new(JSON_NODE_OBJECT);
JsonObject *object = json_object_new();
JsonObject *args = json_object_new();
+
json_object_set_string_member(object, PARAM_METHOD, method);
json_object_set_object_member(object, PARAM_ARGUMENTS, args);
json_node_take_object(root, object);
+
return root;
}
diff --git a/src/trg-destination-combo.c b/src/trg-destination-combo.c
index 07410a1..c7cf418 100644
--- a/src/trg-destination-combo.c
+++ b/src/trg-destination-combo.c
@@ -34,7 +34,7 @@ typedef struct _TrgDestinationComboPrivate TrgDestinationComboPrivate;
struct _TrgDestinationComboPrivate {
TrgClient *client;
- const gchar *last_selection;
+ gchar *last_selection;
GtkWidget *entry;
GtkCellRenderer *text_renderer;
};
@@ -55,7 +55,7 @@ static void trg_destination_combo_finalize(GObject * object)
{
TrgDestinationComboPrivate *priv =
TRG_DESTINATION_COMBO_GET_PRIVATE(object);
- g_free((gpointer) priv->last_selection);
+ g_free(priv->last_selection);
}
static void trg_destination_combo_get_property(GObject * object,
@@ -328,6 +328,7 @@ static GObject *trg_destination_combo_constructor(GType type,
NULL,
defaultDir,
DEST_DEFAULT, lastDestination);
+ gtk_combo_box_set_active(GTK_COMBO_BOX(object), 0);
if (savedDestinations) {
list = json_array_get_elements(savedDestinations);
diff --git a/src/trg-torrent-add-dialog.c b/src/trg-torrent-add-dialog.c
index 3345a80..1b0ce31 100644
--- a/src/trg-torrent-add-dialog.c
+++ b/src/trg-torrent-add-dialog.c
@@ -251,6 +251,8 @@ static void trg_torrent_add_response_cb(GtkDialog * dlg, gint res_id,
launch_add_thread(args);
}
+ trg_destination_combo_save_selection(TRG_DESTINATION_COMBO(priv->dest_combo));
+
g_free(dir);
} else {
g_str_slist_free(priv->filenames);
@@ -712,8 +714,8 @@ static GObject *trg_torrent_add_dialog_constructor(GType type,
0, 0, 0);
++col;
- priv->dest_combo = trg_destination_combo_new(priv->client, NULL);
- gtk_combo_box_set_active(GTK_COMBO_BOX(priv->dest_combo), 0);
+ priv->dest_combo = trg_destination_combo_new(priv->client, TRG_PREFS_KEY_LAST_ADD_DESTINATION);
+ //gtk_combo_box_set_active(GTK_COMBO_BOX(priv->dest_combo), 0);
gtk_table_attach(GTK_TABLE(t), priv->dest_combo, col, col + 1, row,
row + 1, ~0, 0, 0, 0);
gtk_label_set_mnemonic_widget(GTK_LABEL(l), priv->dest_combo);