From: TimePath Date: Sun, 6 Aug 2017 07:27:10 +0000 (+1000) Subject: Fix prtview about dialog regression X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=ebc9833e47bcf4177521a2465b5f6d864ead8de4;p=xonotic%2Fnetradiant.git Fix prtview about dialog regression --- diff --git a/contrib/prtview/AboutDialog.cpp b/contrib/prtview/AboutDialog.cpp index 70067e0c..64073032 100644 --- a/contrib/prtview/AboutDialog.cpp +++ b/contrib/prtview/AboutDialog.cpp @@ -50,51 +50,48 @@ static gint dialog_delete_callback( GtkWidget *widget, GdkEvent* event, gpointer } void DoAboutDlg(){ - GtkWidget *vbox, *label; int loop = 1, ret = IDCANCEL; - auto dlg = ui::Window( ui::window_type::TOP ); - gtk_window_set_title( GTK_WINDOW( dlg ), "About Portal Viewer" ); - dlg.connect( "delete_event", - G_CALLBACK( dialog_delete_callback ), NULL ); - dlg.connect( "destroy", - G_CALLBACK( gtk_widget_destroy ), NULL ); - g_object_set_data( G_OBJECT( dlg ), "loop", &loop ); - g_object_set_data( G_OBJECT( dlg ), "ret", &ret ); + auto dlg = ui::Window(ui::window_type::TOP); + gtk_window_set_title(dlg, "About Portal Viewer"); + dlg.connect("delete_event", G_CALLBACK(dialog_delete_callback), NULL); + dlg.connect("destroy", G_CALLBACK(gtk_widget_destroy), NULL); + g_object_set_data(G_OBJECT(dlg), "loop", &loop); + g_object_set_data(G_OBJECT(dlg), "ret", &ret); - auto hbox = ui::HBox( FALSE, 10 ); + auto hbox = ui::HBox(FALSE, 10); hbox.show(); dlg.add(hbox); - gtk_container_set_border_width( GTK_CONTAINER( hbox ), 10 ); + gtk_container_set_border_width(GTK_CONTAINER(hbox), 10); char const *label_text = "Version 1.000\n\n" - "Gtk port by Leonardo Zide\nleo@lokigames.com\n\n" - "Written by Geoffrey DeWan\ngdewan@prairienet.org\n\n" - "Built against NetRadiant " RADIANT_VERSION "\n" - __DATE__; - gtk_widget_show( label ); - gtk_box_pack_start( GTK_BOX( hbox ), label, TRUE, TRUE, 0 ); - gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); - - vbox = ui::VBox( FALSE, 0 ); - gtk_widget_show( vbox ); - gtk_box_pack_start( GTK_BOX( hbox ), vbox, FALSE, FALSE, 0 ); - - auto button = ui::Button( "OK" ); - gtk_widget_show( button ); - gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 ); - button.connect( "clicked", - G_CALLBACK( dialog_button_callback ), GINT_TO_POINTER( IDOK ) ); - gtk_widget_set_size_request( button, 60, -1 ); - - gtk_grab_add( dlg ); - gtk_widget_show( dlg ); - - while ( loop ) + "Gtk port by Leonardo Zide\nleo@lokigames.com\n\n" + "Written by Geoffrey DeWan\ngdewan@prairienet.org\n\n" + "Built against NetRadiant " RADIANT_VERSION "\n" + __DATE__; + auto label = ui::Label(label_text); + label.show(); + gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, TRUE, 0); + gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT); + + auto vbox = ui::VBox(FALSE, 0); + vbox.show(); + gtk_box_pack_start(GTK_BOX(hbox), vbox, FALSE, FALSE, 0); + + auto button = ui::Button("OK"); + button.show(); + gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 0); + button.connect("clicked", G_CALLBACK(dialog_button_callback), GINT_TO_POINTER(IDOK)); + button.dimensions(60, -1); + + gtk_grab_add(dlg); + dlg.show(); + + while (loop) gtk_main_iteration(); - gtk_grab_remove( dlg ); - gtk_widget_destroy( dlg ); + gtk_grab_remove(dlg); + gtk_widget_destroy(dlg); }