Changeset 4169


Ignore:
Timestamp:
Dec 14, 2007, 6:36:19 PM (14 years ago)
Author:
charles
Message:

use a modified version of werehamster's improvements to the gtk gui at shutdown

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gtk/main.c

    r4014 r4169  
    445445
    446446static void
     447do_exit_cb( GtkWidget *w UNUSED, gpointer data UNUSED )
     448{
     449    exit( 0 );
     450}
     451
     452static void
    447453wannaquit( void * vdata )
    448454{
    449     GtkWidget * w;
    450 #if GTK_CHECK_VERSION(2,10,0)
    451     GtkWidget * i;
    452 #endif
     455    char * str;
     456    GtkWidget * r, * p, * b, * w, *c;
    453457    struct cbdata * cbdata = vdata;
    454458
     
    459463    }
    460464
    461     w = gtk_message_dialog_new( cbdata->wind,
    462                                 GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,
    463                                 GTK_MESSAGE_INFO,
    464                                 GTK_BUTTONS_NONE,
    465                                 _("Closing Connections" ) );
    466 #if GTK_CHECK_VERSION(2,10,0)
    467     i = gtk_image_new_from_stock( GTK_STOCK_NETWORK, GTK_ICON_SIZE_DIALOG );
    468     gtk_widget_show( i );
    469     gtk_message_dialog_set_image( GTK_MESSAGE_DIALOG(w), i );
    470 #endif
    471     gtk_message_dialog_format_secondary_text( GTK_MESSAGE_DIALOG(w),
    472                                               _("Sending upload/download totals to tracker..." ) );
    473     gtk_container_foreach( GTK_CONTAINER(GTK_DIALOG(w)->vbox), deselectLabels, NULL );
    474     gtk_widget_show( w );
     465    c = GTK_WIDGET( cbdata->wind );
     466    gtk_container_remove( GTK_CONTAINER( c ), gtk_bin_get_child( GTK_BIN( c ) ) );
     467
     468    r = gtk_alignment_new(0.5, 0.5, 0.01, 0.01);
     469    gtk_container_add(GTK_CONTAINER(c), r);
     470
     471    p = gtk_table_new(2, 2, FALSE);
     472    gtk_container_add(GTK_CONTAINER(r), p);
     473
     474    w = gtk_image_new_from_stock( GTK_STOCK_NETWORK, GTK_ICON_SIZE_DIALOG );
     475    gtk_table_attach(GTK_TABLE(p), w, 0, 1, 0, 1, GTK_FILL, GTK_FILL, 2, 2);
     476
     477    w = gtk_label_new("");
     478    str = g_strdup_printf( "<b>%s</b>\n%s", _("Closing Connections"), _("Sending upload/download totals to tracker...") );
     479    gtk_label_set_markup(GTK_LABEL(w), str );
     480    gtk_table_attach(GTK_TABLE(p), w, 1, 2, 0, 1, GTK_FILL, GTK_FILL, 10, 0);
     481    g_free( str );
     482
     483    b = gtk_alignment_new(0.0, 1.0, 0.01, 0.01);
     484    w = gtk_button_new_with_label( _( "_Quit Immediately" ) );
     485    gtk_button_set_image( GTK_BUTTON(w), gtk_image_new_from_stock( GTK_STOCK_QUIT, GTK_ICON_SIZE_BUTTON ) );
     486    g_signal_connect(w, "clicked", G_CALLBACK(do_exit_cb), NULL);
     487    gtk_container_add(GTK_CONTAINER(b), w);
     488    gtk_table_attach(GTK_TABLE(p), b, 1, 2, 1, 2, GTK_FILL, GTK_FILL, 10, 0);
     489
     490    gtk_widget_show_all(r);
    475491
    476492    /* clear the UI */
    477493    gtk_list_store_clear( GTK_LIST_STORE( tr_core_model( cbdata->core ) ) );
    478     gtk_widget_set_sensitive( GTK_WIDGET( cbdata->wind ), FALSE );
    479 
    480    
    481494
    482495    /* shut down libT */
Note: See TracChangeset for help on using the changeset viewer.