]> de.git.xonotic.org Git - xonotic/netradiant.git/commitdiff
Fix prtview about dialog regression
authorTimePath <andrew.hardaker1995@gmail.com>
Sun, 6 Aug 2017 07:27:10 +0000 (17:27 +1000)
committerTimePath <andrew.hardaker1995@gmail.com>
Sun, 6 Aug 2017 07:27:10 +0000 (17:27 +1000)
contrib/prtview/AboutDialog.cpp

index 70067e0c5608cbf0eaabdf86328a3944ce601adc..640730320455c56baa7fcafe22b543581e41f895 100644 (file)
@@ -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);
 }