mirror of
https://github.com/transmission/transmission
synced 2024-12-25 09:13:06 +00:00
(trunk gtk) #2707 "add confirmation dialog when resetting statistics" -- implemented
This commit is contained in:
parent
ae6bdbae6e
commit
736d39d34e
1 changed files with 21 additions and 2 deletions
23
gtk/stats.c
23
gtk/stats.c
|
@ -103,8 +103,27 @@ dialogResponse( GtkDialog * dialog,
|
||||||
|
|
||||||
if( response == TR_RESPONSE_RESET )
|
if( response == TR_RESPONSE_RESET )
|
||||||
{
|
{
|
||||||
tr_sessionClearStats( tr_core_session( ui->core ) );
|
const char * primary = _( "Reset your statistics?" );
|
||||||
updateStats( ui );
|
const char * secondary = _( "These statistics are for your information only. "
|
||||||
|
"Resetting them doesn't affect the statistics logged by your BitTorrent trackers." );
|
||||||
|
const int flags = GTK_DIALOG_DESTROY_WITH_PARENT
|
||||||
|
| GTK_DIALOG_MODAL;
|
||||||
|
GtkWidget * w = gtk_message_dialog_new( GTK_WINDOW( dialog ),
|
||||||
|
flags,
|
||||||
|
GTK_MESSAGE_QUESTION,
|
||||||
|
GTK_BUTTONS_NONE,
|
||||||
|
"%s", primary );
|
||||||
|
gtk_dialog_add_buttons( GTK_DIALOG( w ),
|
||||||
|
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
||||||
|
_( "_Reset" ), TR_RESPONSE_RESET,
|
||||||
|
NULL );
|
||||||
|
gtk_message_dialog_format_secondary_text( GTK_MESSAGE_DIALOG( w ), "%s", secondary );
|
||||||
|
if( gtk_dialog_run( GTK_DIALOG( w ) ) == TR_RESPONSE_RESET )
|
||||||
|
{
|
||||||
|
tr_sessionClearStats( tr_core_session( ui->core ) );
|
||||||
|
updateStats( ui );
|
||||||
|
}
|
||||||
|
gtk_widget_destroy( w );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( response == GTK_RESPONSE_CLOSE )
|
if( response == GTK_RESPONSE_CLOSE )
|
||||||
|
|
Loading…
Reference in a new issue