summaryrefslogtreecommitdiff
path: root/src/trg-torrent-props-dialog.c
diff options
context:
space:
mode:
authorGravatar Alan Fitton <ajf@eth0.org.uk>2012-09-15 10:04:51 +0100
committerGravatar Alan Fitton <ajf@eth0.org.uk>2012-09-15 10:04:51 +0100
commit443b30ab07f545127df4c1012fcd6534241a2fe1 (patch)
treec3972fa357ce62220dd8aa03cbf554fd68711ef0 /src/trg-torrent-props-dialog.c
parentf09a932a7c36d3fe80551153b12f677d3a44a398 (diff)
save the torrent dialog (transmission style) tree view layout even if cancel is clicked
Diffstat (limited to 'src/trg-torrent-props-dialog.c')
-rw-r--r--src/trg-torrent-props-dialog.c53
1 files changed, 22 insertions, 31 deletions
diff --git a/src/trg-torrent-props-dialog.c b/src/trg-torrent-props-dialog.c
index da93279..2060b6b 100644
--- a/src/trg-torrent-props-dialog.c
+++ b/src/trg-torrent-props-dialog.c
@@ -136,53 +136,44 @@ static void trg_torrent_props_response_cb(GtkDialog * dialog, gint res_id,
gpointer data G_GNUC_UNUSED)
{
TrgTorrentPropsDialogPrivate *priv = GET_PRIVATE(dialog);
- JsonNode *request;
- JsonObject *args;
- if (priv->peersTv)
+ if (priv->show_details) {
+ TrgPrefs *prefs = trg_client_get_prefs(priv->client);
+ gint width, height;
+ gtk_window_get_size(GTK_WINDOW(dialog), &width, &height);
+ trg_prefs_set_int(prefs, "dialog-width", width, TRG_PREFS_GLOBAL);
+ trg_prefs_set_int(prefs, "dialog-height", height,
+ TRG_PREFS_GLOBAL);
+
trg_tree_view_persist(TRG_TREE_VIEW(priv->peersTv),
TRG_TREE_VIEW_PERSIST_SORT |
TRG_TREE_VIEW_PERSIST_LAYOUT);
- if (priv->filesTv)
trg_tree_view_persist(TRG_TREE_VIEW(priv->filesTv),
TRG_TREE_VIEW_PERSIST_SORT |
TRG_TREE_VIEW_PERSIST_LAYOUT);
-
- if (priv->trackersTv)
trg_tree_view_persist(TRG_TREE_VIEW(priv->trackersTv),
TRG_TREE_VIEW_PERSIST_SORT |
TRG_TREE_VIEW_PERSIST_LAYOUT);
+ }
if (res_id != GTK_RESPONSE_OK) {
- gtk_widget_destroy(GTK_WIDGET(dialog));
json_array_unref(priv->targetIds);
- return;
- }
-
- request = torrent_set(priv->targetIds);
- args = node_get_arguments(request);
-
- json_object_set_int_member(args, FIELD_SEED_RATIO_MODE,
- gtk_combo_box_get_active(GTK_COMBO_BOX
- (priv->seedRatioMode)));
- json_object_set_int_member(args, FIELD_BANDWIDTH_PRIORITY,
- gtk_combo_box_get_active(GTK_COMBO_BOX
- (priv->bandwidthPriorityCombo))
- - 1);
+ } else {
+ JsonNode *request = torrent_set(priv->targetIds);
+ JsonObject *args = node_get_arguments(request);
- trg_json_widgets_save(priv->widgets, args);
- trg_json_widget_desc_list_free(priv->widgets);
+ json_object_set_int_member(args, FIELD_SEED_RATIO_MODE,
+ gtk_combo_box_get_active(GTK_COMBO_BOX
+ (priv->seedRatioMode) ));
+ json_object_set_int_member(args, FIELD_BANDWIDTH_PRIORITY,
+ gtk_combo_box_get_active(GTK_COMBO_BOX
+ (priv->bandwidthPriorityCombo) ) - 1);
- dispatch_async(priv->client, request, on_generic_interactive_action,
- priv->parent);
+ trg_json_widgets_save(priv->widgets, args);
+ trg_json_widget_desc_list_free(priv->widgets);
- if (priv->show_details) {
- TrgPrefs *prefs = trg_client_get_prefs(priv->client);
- gint width, height;
- gtk_window_get_size(GTK_WINDOW(dialog), &width, &height);
- trg_prefs_set_int(prefs, "dialog-width", width, TRG_PREFS_GLOBAL);
- trg_prefs_set_int(prefs, "dialog-height", height,
- TRG_PREFS_GLOBAL);
+ dispatch_async(priv->client, request, on_generic_interactive_action,
+ priv->parent);
}
gtk_widget_destroy(GTK_WIDGET(dialog));