mirror of
https://github.com/transmission/transmission
synced 2025-01-30 19:03:04 +00:00
GTK: behavior improvements of the torrent details window (#892)
* gtk: torrent details file-list default sort * gtk: save torrent details window size * gtk: torrent details window size & sort, code style * gtk: torrent details window, conf.c dict fix Co-authored-by: Charles Kerr <ckerr@github.com>
This commit is contained in:
parent
6bb8b2e78a
commit
a6482b0061
5 changed files with 25 additions and 1 deletions
|
@ -74,7 +74,7 @@ static void tr_prefs_init_defaults(tr_variant* d)
|
|||
dir = tr_getDefaultDownloadDir();
|
||||
}
|
||||
|
||||
tr_variantDictReserve(d, 29);
|
||||
tr_variantDictReserve(d, 31);
|
||||
tr_variantDictAddStr(d, TR_KEY_watch_dir, dir);
|
||||
tr_variantDictAddBool(d, TR_KEY_watch_dir_enabled, FALSE);
|
||||
tr_variantDictAddBool(d, TR_KEY_user_has_given_informed_consent, FALSE);
|
||||
|
@ -101,6 +101,8 @@ static void tr_prefs_init_defaults(tr_variant* d)
|
|||
tr_variantDictAddInt(d, TR_KEY_main_window_width, 300);
|
||||
tr_variantDictAddInt(d, TR_KEY_main_window_x, 50);
|
||||
tr_variantDictAddInt(d, TR_KEY_main_window_y, 50);
|
||||
tr_variantDictAddInt(d, TR_KEY_details_window_height, 500);
|
||||
tr_variantDictAddInt(d, TR_KEY_details_window_width, 700);
|
||||
tr_variantDictAddStr(d, TR_KEY_download_dir, dir);
|
||||
tr_variantDictAddStr(d, TR_KEY_sort_mode, "sort-by-name");
|
||||
tr_variantDictAddBool(d, TR_KEY_sort_reversed, FALSE);
|
||||
|
|
|
@ -2897,6 +2897,15 @@ static gboolean periodic_refresh(gpointer data)
|
|||
return G_SOURCE_CONTINUE;
|
||||
}
|
||||
|
||||
static void on_details_window_size_allocated(GtkWidget* gtk_window, GtkAllocation* alloc UNUSED, gpointer gdata UNUSED)
|
||||
{
|
||||
GdkWindow* gdk_window = gtk_widget_get_window(gtk_window);
|
||||
int w, h;
|
||||
gtk_window_get_size(GTK_WINDOW(gtk_window), &w, &h);
|
||||
gtr_pref_int_set(TR_KEY_details_window_width, w);
|
||||
gtr_pref_int_set(TR_KEY_details_window_height, h);
|
||||
}
|
||||
|
||||
static void details_free(gpointer gdata)
|
||||
{
|
||||
struct DetailsImpl* data = gdata;
|
||||
|
@ -2934,6 +2943,11 @@ GtkWidget* gtr_torrent_details_dialog_new(GtkWindow* parent, TrCore* core)
|
|||
d = gtk_dialog_new_with_buttons(NULL, parent, 0, GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, NULL);
|
||||
di->dialog = d;
|
||||
gtk_window_set_role(GTK_WINDOW(d), "tr-info");
|
||||
|
||||
/* return saved window size */
|
||||
gtk_window_resize(d, gtr_pref_int_get(TR_KEY_details_window_width), gtr_pref_int_get(TR_KEY_details_window_height));
|
||||
g_signal_connect(d, "size-allocate", G_CALLBACK(on_details_window_size_allocated), NULL);
|
||||
|
||||
g_signal_connect_swapped(d, "response", G_CALLBACK(gtk_widget_destroy), d);
|
||||
gtk_container_set_border_width(GTK_CONTAINER(d), GUI_PAD);
|
||||
g_object_set_qdata_full(G_OBJECT(d), DETAILS_KEY, di, details_free);
|
||||
|
|
|
@ -591,6 +591,10 @@ void gtr_file_list_set_torrent(GtkWidget* w, int torrentId)
|
|||
}
|
||||
|
||||
gtk_tree_view_set_model(GTK_TREE_VIEW(data->view), data->model);
|
||||
|
||||
/* set default sort by label */
|
||||
gtk_tree_sortable_set_sort_column_id(data->model, FC_LABEL, GTK_SORT_ASCENDING);
|
||||
|
||||
gtk_tree_view_expand_all(GTK_TREE_VIEW(data->view));
|
||||
g_object_unref(data->model);
|
||||
}
|
||||
|
|
|
@ -82,6 +82,8 @@ static struct tr_key_struct const my_static[] =
|
|||
Q("delete-local-data"),
|
||||
Q("desiredAvailable"),
|
||||
Q("destination"),
|
||||
Q("details-window-height"),
|
||||
Q("details-window-width"),
|
||||
Q("dht-enabled"),
|
||||
Q("display-name"),
|
||||
Q("dnd"),
|
||||
|
|
|
@ -82,6 +82,8 @@ enum
|
|||
TR_KEY_delete_local_data,
|
||||
TR_KEY_desiredAvailable,
|
||||
TR_KEY_destination,
|
||||
TR_KEY_details_window_height,
|
||||
TR_KEY_details_window_width,
|
||||
TR_KEY_dht_enabled,
|
||||
TR_KEY_display_name,
|
||||
TR_KEY_dnd,
|
||||
|
|
Loading…
Reference in a new issue