mirror of
https://github.com/transmission/transmission
synced 2024-12-25 09:13:06 +00:00
use a modified version of werehamster's improvements to the gtk gui at shutdown
This commit is contained in:
parent
6ded40d360
commit
0fa3fb0d67
1 changed files with 34 additions and 21 deletions
55
gtk/main.c
55
gtk/main.c
|
@ -443,13 +443,17 @@ deselectLabels( GtkWidget * w, gpointer unused UNUSED )
|
||||||
gtk_container_foreach( GTK_CONTAINER(w), deselectLabels, NULL );
|
gtk_container_foreach( GTK_CONTAINER(w), deselectLabels, NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
do_exit_cb( GtkWidget *w UNUSED, gpointer data UNUSED )
|
||||||
|
{
|
||||||
|
exit( 0 );
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
wannaquit( void * vdata )
|
wannaquit( void * vdata )
|
||||||
{
|
{
|
||||||
GtkWidget * w;
|
char * str;
|
||||||
#if GTK_CHECK_VERSION(2,10,0)
|
GtkWidget * r, * p, * b, * w, *c;
|
||||||
GtkWidget * i;
|
|
||||||
#endif
|
|
||||||
struct cbdata * cbdata = vdata;
|
struct cbdata * cbdata = vdata;
|
||||||
|
|
||||||
/* stop the update timer */
|
/* stop the update timer */
|
||||||
|
@ -458,26 +462,35 @@ wannaquit( void * vdata )
|
||||||
cbdata->timer = 0;
|
cbdata->timer = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
w = gtk_message_dialog_new( cbdata->wind,
|
c = GTK_WIDGET( cbdata->wind );
|
||||||
GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,
|
gtk_container_remove( GTK_CONTAINER( c ), gtk_bin_get_child( GTK_BIN( c ) ) );
|
||||||
GTK_MESSAGE_INFO,
|
|
||||||
GTK_BUTTONS_NONE,
|
r = gtk_alignment_new(0.5, 0.5, 0.01, 0.01);
|
||||||
_("Closing Connections" ) );
|
gtk_container_add(GTK_CONTAINER(c), r);
|
||||||
#if GTK_CHECK_VERSION(2,10,0)
|
|
||||||
i = gtk_image_new_from_stock( GTK_STOCK_NETWORK, GTK_ICON_SIZE_DIALOG );
|
p = gtk_table_new(2, 2, FALSE);
|
||||||
gtk_widget_show( i );
|
gtk_container_add(GTK_CONTAINER(r), p);
|
||||||
gtk_message_dialog_set_image( GTK_MESSAGE_DIALOG(w), i );
|
|
||||||
#endif
|
w = gtk_image_new_from_stock( GTK_STOCK_NETWORK, GTK_ICON_SIZE_DIALOG );
|
||||||
gtk_message_dialog_format_secondary_text( GTK_MESSAGE_DIALOG(w),
|
gtk_table_attach(GTK_TABLE(p), w, 0, 1, 0, 1, GTK_FILL, GTK_FILL, 2, 2);
|
||||||
_("Sending upload/download totals to tracker..." ) );
|
|
||||||
gtk_container_foreach( GTK_CONTAINER(GTK_DIALOG(w)->vbox), deselectLabels, NULL );
|
w = gtk_label_new("");
|
||||||
gtk_widget_show( w );
|
str = g_strdup_printf( "<b>%s</b>\n%s", _("Closing Connections"), _("Sending upload/download totals to tracker...") );
|
||||||
|
gtk_label_set_markup(GTK_LABEL(w), str );
|
||||||
|
gtk_table_attach(GTK_TABLE(p), w, 1, 2, 0, 1, GTK_FILL, GTK_FILL, 10, 0);
|
||||||
|
g_free( str );
|
||||||
|
|
||||||
|
b = gtk_alignment_new(0.0, 1.0, 0.01, 0.01);
|
||||||
|
w = gtk_button_new_with_label( _( "_Quit Immediately" ) );
|
||||||
|
gtk_button_set_image( GTK_BUTTON(w), gtk_image_new_from_stock( GTK_STOCK_QUIT, GTK_ICON_SIZE_BUTTON ) );
|
||||||
|
g_signal_connect(w, "clicked", G_CALLBACK(do_exit_cb), NULL);
|
||||||
|
gtk_container_add(GTK_CONTAINER(b), w);
|
||||||
|
gtk_table_attach(GTK_TABLE(p), b, 1, 2, 1, 2, GTK_FILL, GTK_FILL, 10, 0);
|
||||||
|
|
||||||
|
gtk_widget_show_all(r);
|
||||||
|
|
||||||
/* clear the UI */
|
/* clear the UI */
|
||||||
gtk_list_store_clear( GTK_LIST_STORE( tr_core_model( cbdata->core ) ) );
|
gtk_list_store_clear( GTK_LIST_STORE( tr_core_model( cbdata->core ) ) );
|
||||||
gtk_widget_set_sensitive( GTK_WIDGET( cbdata->wind ), FALSE );
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* shut down libT */
|
/* shut down libT */
|
||||||
g_thread_create( quitThreadFunc, vdata, TRUE, NULL );
|
g_thread_create( quitThreadFunc, vdata, TRUE, NULL );
|
||||||
|
|
Loading…
Reference in a new issue