~ubuntu-branches/ubuntu/utopic/gnome-chemistry-utils/utopic-proposed

« back to all changes in this revision

Viewing changes to programs/table/gchemtable-app.cc

  • Committer: Package Import Robot
  • Author(s): Jeremy Bicha
  • Date: 2013-05-10 21:30:51 UTC
  • mfrom: (1.1.15) (2.1.25 sid)
  • Revision ID: package-import@ubuntu.com-20130510213051-mswxsp3vitsgqspm
Tags: 0.14.2-1ubuntu1
* Sync with Debian. Remaining change:
  - Build-depend on firefox-dev instead of xulrunner-dev 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
// -*- C++ -*-
2
2
 
3
 
/* 
 
3
/*
4
4
 * Gnome Chemistry Utils
5
 
 * programs/gchemtable-app.cc 
6
 
 *
7
 
 * Copyright (C) 2005-2010 Jean Bréfort <jean.brefort@normalesup.org>
8
 
 *
9
 
 * This program is free software; you can redistribute it and/or 
10
 
 * modify it under the terms of the GNU General Public License as 
11
 
 * published by the Free Software Foundation; either version 2 of the
 
5
 * programs/gchemtable-app.cc
 
6
 *
 
7
 * Copyright (C) 2005-2011 Jean Bréfort <jean.brefort@normalesup.org>
 
8
 *
 
9
 * This program is free software; you can redistribute it and/or
 
10
 * modify it under the terms of the GNU General Public License as
 
11
 * published by the Free Software Foundation; either version 3 of the
12
12
 * License, or (at your option) any later version.
13
13
 *
14
14
 * This program is distributed in the hope that it will be useful,
27
27
#include "gchemtable-curve.h"
28
28
#include "gchemtable-data.h"
29
29
#include "gchemtable-elt.h"
 
30
#include <gcugtk/filechooser.h>
 
31
#include <gcugtk/message.h>
 
32
#include <gcugtk/ui-builder.h>
30
33
#include <gcu/chemistry.h>
31
34
#include <gcu/element.h>
32
 
#include <gcu/filechooser.h>
33
 
#include <gcu/ui-builder.h>
34
35
#include <glib.h>
35
36
#include <glib/gi18n.h>
36
 
#include <gtk/gtkaboutdialog.h>
37
 
#include <gtk/gtkmain.h>
38
 
#include <gtk/gtkstock.h>
39
 
#include <gtk/gtkuimanager.h>
40
 
#include <gtk/gtkwindow.h>
 
37
#include <gtk/gtk.h>
41
38
#include <gio/gio.h>
42
39
#include <cstdlib>
43
40
#include <cstring>
102
99
        App->SetColorScheme ("block");
103
100
}
104
101
 
105
 
static void on_about_activate_url (G_GNUC_UNUSED GtkAboutDialog *about, const gchar *url, gpointer data)
106
 
{
107
 
        reinterpret_cast <Application *> (data)->OnWeb (url);
108
 
}
109
 
 
110
102
static void on_help (G_GNUC_UNUSED GtkWidget *widget, GChemTableApp *app)
111
103
{
112
104
        app->OnHelp ();
113
105
}
114
106
 
115
 
static void on_web (G_GNUC_UNUSED GtkWidget *widget, GChemTableApp *app)
116
 
{
117
 
        app->OnWeb ();
118
 
}
119
 
 
120
 
static void on_mail (G_GNUC_UNUSED GtkWidget *widget, GChemTableApp *app)
121
 
{
122
 
        app->OnMail ();
123
 
}
124
 
 
125
 
static void on_live_assistance (G_GNUC_UNUSED GtkWidget *widget, GChemTableApp *app)
126
 
{
127
 
        app->OnLiveAssistance ();
128
 
}
129
 
 
130
 
static void on_bug (G_GNUC_UNUSED GtkWidget *widget, GChemTableApp *app)
131
 
{
132
 
        app->OnBug ();
 
107
static void on_web (GtkWidget *widget, GChemTableApp *app)
 
108
{
 
109
        app->OnWeb (gtk_widget_get_screen (widget));
 
110
}
 
111
 
 
112
static void on_mail (GtkWidget *widget, GChemTableApp *app)
 
113
{
 
114
        app->OnMail (gtk_widget_get_screen (widget));
 
115
}
 
116
 
 
117
static void on_live_assistance (GtkWidget *widget, GChemTableApp *app)
 
118
{
 
119
        app->OnLiveAssistance (gtk_widget_get_screen (widget));
 
120
}
 
121
 
 
122
static void on_bug (GtkWidget *widget, GChemTableApp *app)
 
123
{
 
124
        app->OnBug (gtk_widget_get_screen (widget));
133
125
}
134
126
 
135
127
static void on_about (G_GNUC_UNUSED GtkWidget *widget, GChemTableApp *app)
253
245
"  </menubar>"
254
246
"</ui>";
255
247
 
256
 
static void get_state_color (int Z, GdkColor *color, GChemTableApp *App)
 
248
static void get_state_color (int Z, GdkRGBA *rgba, GChemTableApp *App)
257
249
{
258
 
        App->GetStateColor (Z, color);
 
250
        App->GetStateColor (Z, rgba);
259
251
}
260
252
 
261
253
static void on_changed_temp (GtkRange *range, GChemTableApp *app)
268
260
        app->SetFamily (gtk_combo_box_get_active (box));
269
261
}
270
262
 
271
 
static void get_family_color (int Z, GdkColor *color, GChemTableApp *App)
272
 
{
273
 
        App->GetFamilyColor (Z, color);
274
 
}
275
 
 
276
 
static void get_acidity_color (int Z, GdkColor *color, GChemTableApp *App)
277
 
{
278
 
        App->GetAcidityColor (Z, color);
279
 
}
280
 
 
281
 
static void get_electroneg_color (int Z, GdkColor *color, GChemTableApp *App)
282
 
{
283
 
        App->GetElectronegColor (Z, color);
284
 
}
285
 
 
286
 
static void get_radius_color (int Z, GdkColor *color, GChemTableApp *App)
287
 
{
288
 
        App->GetRadiusColor (Z, color);
289
 
}
290
 
 
291
 
static void get_block_color (int Z, GdkColor *color, GChemTableApp *App)
292
 
{
293
 
        App->GetBlockColor (Z, color);
 
263
static void get_family_color (int Z, GdkRGBA *rgba, GChemTableApp *App)
 
264
{
 
265
        App->GetFamilyColor (Z, rgba);
 
266
}
 
267
 
 
268
static void get_acidity_color (int Z, GdkRGBA *rgba, GChemTableApp *App)
 
269
{
 
270
        App->GetAcidityColor (Z, rgba);
 
271
}
 
272
 
 
273
static void get_electroneg_color (int Z, GdkRGBA *rgba, GChemTableApp *App)
 
274
{
 
275
        App->GetElectronegColor (Z, rgba);
 
276
}
 
277
 
 
278
static void get_radius_color (int Z, GdkRGBA *rgba, GChemTableApp *App)
 
279
{
 
280
        App->GetRadiusColor (Z, rgba);
 
281
}
 
282
 
 
283
static void get_block_color (int Z, GdkRGBA *rgba, GChemTableApp *App)
 
284
{
 
285
        App->GetBlockColor (Z, rgba);
294
286
}
295
287
 
296
288
static void on_destroy (GChemTableApp *App)
299
291
        gtk_main_quit ();
300
292
}
301
293
 
302
 
GChemTableApp::GChemTableApp (): Application ("gchemtable")
 
294
GChemTableApp::GChemTableApp (): gcugtk::Application ("gchemtable")
303
295
{
304
 
        GtkVBox* vbox;
 
296
        GtkWidget *grid;
305
297
 
 
298
        gcu::Element::LoadAllData ();
306
299
        window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
307
300
        gtk_window_set_title (GTK_WINDOW (window), _("Periodic table of the elements"));
308
301
        gtk_window_set_icon_name (GTK_WINDOW (window), GetIconName ().c_str ());
310
303
                 G_CALLBACK (on_destroy),
311
304
                 this);
312
305
 
313
 
        g_object_set (G_OBJECT(window), "allow-shrink", FALSE, NULL);
314
 
        
315
 
        vbox = (GtkVBox*)gtk_vbox_new(FALSE, 0);
 
306
        grid = gtk_grid_new ();
 
307
        g_object_set (G_OBJECT (grid), "orientation", GTK_ORIENTATION_VERTICAL, NULL);
316
308
        // add menus
317
309
        GtkUIManager *ui_manager = gtk_ui_manager_new ();
318
310
        GtkActionGroup *action_group = gtk_action_group_new ("MenuActions");
328
320
                exit (EXIT_FAILURE);
329
321
        }
330
322
        GtkWidget *bar = gtk_ui_manager_get_widget (ui_manager, "/MainMenu");
331
 
        gtk_box_pack_start (GTK_BOX (vbox), bar, FALSE, FALSE, 0);
 
323
        gtk_container_add (GTK_CONTAINER (grid), bar);
332
324
        periodic = GCU_PERIODIC (gcu_periodic_new());
333
 
        g_object_set(G_OBJECT(periodic),
334
 
                        "color-style", GCU_PERIODIC_COLOR_DEFAULT,
335
 
                        "can_unselect", true,
336
 
                        NULL);
 
325
        g_object_set (G_OBJECT(periodic),
 
326
                                "margin", 6,
 
327
                                "color-style", GCU_PERIODIC_COLOR_DEFAULT,
 
328
                                "can_unselect", true,
 
329
                    "expand", true,
 
330
                                NULL);
337
331
        g_signal_connect(G_OBJECT(periodic), "element_changed", (GCallback)on_changed, this);
338
 
        gtk_box_pack_end (GTK_BOX(vbox), GTK_WIDGET(GCU_PERIODIC(periodic)), true, true, 0);
339
 
        gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(vbox));
 
332
        gtk_container_add (GTK_CONTAINER (grid), GTK_WIDGET (periodic));
 
333
        gtk_container_add (GTK_CONTAINER (window), GTK_WIDGET (grid));
340
334
        gtk_widget_show_all(window);
341
335
        g_object_unref (ui_manager);
342
336
        for (int i = 0; i < 118; i++)
343
337
                Pages[i] = NULL;
344
 
        
345
 
        gcu::Element::LoadAllData ();
 
338
 
 
339
        gcu_periodic_set_tips (periodic, GCU_PERIODIC_TIP_STANDARD);
346
340
        colorschemes["none"] = GCU_PERIODIC_COLOR_NONE;
347
341
        colorschemes["default"] = GCU_PERIODIC_COLOR_DEFAULT;
348
342
 
349
 
        UIBuilder *builder = new UIBuilder (UIDIR"/state-thermometer.ui", GETTEXT_PACKAGE);
 
343
        gcugtk::UIBuilder *builder = new gcugtk::UIBuilder (UIDIR"/state-thermometer.ui", GETTEXT_PACKAGE);
350
344
        GtkWidget *thermometer = builder->GetRefdWidget ("state-thermometer");
351
345
        colorschemes["state"] = gcu_periodic_add_color_scheme (periodic, (GcuPeriodicColorFunc) get_state_color, thermometer, this);
352
346
        gtk_widget_show_all (thermometer);
355
349
        temperature = gtk_range_get_value (GTK_RANGE (thermometer));
356
350
        delete builder;
357
351
 
358
 
        builder = new UIBuilder (UIDIR"/family.ui", GETTEXT_PACKAGE);
 
352
        builder = new gcugtk::UIBuilder (UIDIR"/family.ui", GETTEXT_PACKAGE);
359
353
        GtkWidget *familywidget = builder->GetRefdWidget ("family-legend");
360
 
        colorschemes["family"] = gcu_periodic_add_color_scheme (periodic, (GcuPeriodicColorFunc) get_family_color, familywidget, this); 
 
354
        colorschemes["family"] = gcu_periodic_add_color_scheme (periodic, (GcuPeriodicColorFunc) get_family_color, familywidget, this);
361
355
        gtk_widget_show_all (familywidget);
362
356
        familywidget = builder->GetWidget ("family-box");
363
357
        gtk_combo_box_set_active (GTK_COMBO_BOX(familywidget), 0);
365
359
        g_signal_connect (G_OBJECT (familywidget), "changed", G_CALLBACK (on_changed_family), this);
366
360
        delete builder;
367
361
 
368
 
        builder = new UIBuilder (UIDIR"/acidity.ui", GETTEXT_PACKAGE);
 
362
        builder = new gcugtk::UIBuilder (UIDIR"/acidity.ui", GETTEXT_PACKAGE);
369
363
        GtkWidget *aciditylegend = builder->GetRefdWidget ("acidity-legend");
370
364
        colorschemes["acidity"] = gcu_periodic_add_color_scheme (periodic, (GcuPeriodicColorFunc) get_acidity_color, aciditylegend, this);
371
365
        gtk_widget_show_all (aciditylegend);
375
369
 
376
370
        colorschemes["radius"] = gcu_periodic_add_color_scheme (periodic, (GcuPeriodicColorFunc) get_radius_color, NULL, this);
377
371
 
378
 
        builder = new UIBuilder (UIDIR"/block.ui", GETTEXT_PACKAGE);
 
372
        builder = new gcugtk::UIBuilder (UIDIR"/block.ui", GETTEXT_PACKAGE);
379
373
        GtkWidget *blocklegend = builder->GetRefdWidget ("block-legend");
380
374
        colorschemes["block"] = gcu_periodic_add_color_scheme (periodic, (GcuPeriodicColorFunc) get_block_color, blocklegend, this);
381
375
        gtk_widget_show_all (blocklegend);
402
396
        const gchar * license =
403
397
                "This program is free software; you can redistribute it and/or\n"
404
398
                "modify it under the terms of the GNU General Public License as\n"
405
 
                "published by the Free Software Foundation; either version 2 of the\n"
 
399
                "published by the Free Software Foundation; either version 3 of the\n"
406
400
                "License, or (at your option) any later version.\n\n"
407
401
                "This program is distributed in the hope that it will be useful,\n"
408
402
                "but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
412
406
                "along with this program; if not, write to the Free Software\n"
413
407
                "Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301\n"
414
408
                "USA";
415
 
        
416
 
        gtk_about_dialog_set_url_hook (on_about_activate_url, this, NULL);
417
409
 
418
410
        /* Note to translators: replace the following string with the appropriate credits for you lang */
419
411
        const gchar * translator_credits = _("translator_credits");
436
428
                return;
437
429
        int t = Z - 1;
438
430
        if (Pages[t] != NULL)
439
 
                gtk_window_present (Pages[t]->GetWindow ());
 
431
                Pages[t]->Present ();
440
432
        else
441
433
                Pages[t] = new GChemTableElt (this, Z);
442
434
}
475
467
        gcu_periodic_set_colors (periodic);
476
468
}
477
469
 
478
 
void GChemTableApp::GetStateColor (int Z, GdkColor *color)
 
470
void GChemTableApp::GetStateColor (int Z, GdkRGBA *rgba)
479
471
{
480
 
        color->red= color->green = color->blue = 0;
 
472
        rgba->red= rgba->green = rgba->blue = 0.;
481
473
        Element *elt = Element::GetElement (Z);
482
474
        Value const *value = elt->GetProperty ("meltingpoint");
483
475
        if (!value)
484
476
                return;
485
477
        double t = value->GetAsDouble ();
486
478
        if (t > temperature) {
487
 
                color->blue = 0xffff;
 
479
                rgba->blue = 1.;
488
480
                return;
489
481
        }
490
482
        value = elt->GetProperty ("boilingpoint");
492
484
                return;
493
485
        t = value->GetAsDouble ();
494
486
        if (t > temperature) {
495
 
                color->green = 0xffff;
 
487
                rgba->green = 1.;
496
488
                return;
497
489
        }
498
 
        color->red = 0xffff;
 
490
        rgba->red = 1.;
499
491
}
500
492
 
501
 
void GChemTableApp::GetFamilyColor (int Z, GdkColor *color)
 
493
void GChemTableApp::GetFamilyColor (int Z, GdkRGBA *rgba)
502
494
{
503
 
        color->red= color->green = color->blue = 0;
 
495
        rgba->red= rgba->green = rgba->blue = 0;
504
496
        Element *elt = Element::GetElement (Z);
505
497
        std::string &value = elt->GetStringProperty ("family");
506
498
        if (!value.length())
517
509
        Noblegas
518
510
        Rare_Earth
519
511
*/
520
 
        
 
512
 
521
513
        if (value == "Alkali_Earth") {
522
514
                if (family & 1)
523
 
                        color->blue = 0x8eff;
 
515
                        rgba->blue = 0.558;
524
516
                return;
525
517
        }
526
518
 
527
519
        if (value == "Alkaline_Earth") {
528
520
                if (family & 2)
529
 
                        color->blue = 0xffff;
 
521
                        rgba->blue = 1.;
530
522
                return;
531
523
        }
532
524
 
533
525
        if (value == "Non-Metal") {
534
526
                if (family & 0x20)
535
 
                        color->green = 0xffff;
 
527
                        rgba->green = 1.;
536
528
                return;
537
529
        }
538
530
 
539
531
        if (value == "Metalloids") {
540
532
                if (family & 8)
541
 
                        color->green = 0x8eff;
 
533
                        rgba->green = 0.558;
542
534
                return;
543
535
        }
544
536
 
545
537
        if (value == "Transition") {
546
538
                if (family & 0x80) {
547
 
                        color->red = 0xffff;
548
 
                        color->green = 0xffff;
 
539
                        rgba->red = 1.;
 
540
                        rgba->green = 1.;
549
541
                }
550
542
                return;
551
543
        }
552
544
 
553
545
        if (value == "Other_Metal") {
554
546
                if (family & 0x100) {
555
 
                        color->red = 0xffff;
556
 
                        color->green = 0x8eff;
 
547
                        rgba->red = 1.;
 
548
                        rgba->green = 0.558;
557
549
                }
558
550
                return;
559
551
        }
560
552
 
561
553
        if (value == "Halogene") {
562
554
                if (family & 4)
563
 
                        color->red = 0xffff;
 
555
                        rgba->red = 1.;
564
556
                return;
565
557
        }
566
558
 
567
559
        if (value == "Noblegas") {
568
560
                if (family & 0x10)
569
 
                        color->red = 0x8eff; 
 
561
                        rgba->red = 0.558;
570
562
                return;
571
563
        }
572
564
 
573
565
        if (value == "Rare_Earth") {
574
566
                if (family & 0x40) {
575
 
                        color->red = 0xffff;
576
 
                        color->blue = 0xffff;
 
567
                        rgba->red = 1.;
 
568
                        rgba->blue = 1.;
577
569
                }
578
570
                return;
579
571
        }
580
572
}
581
573
 
582
 
void GChemTableApp::GetAcidityColor (int Z, GdkColor *color)
 
574
void GChemTableApp::GetAcidityColor (int Z, GdkRGBA *rgba)
583
575
{
584
 
        color->red= color->green = color->blue = 0;
 
576
        rgba->red= rgba->green = rgba->blue = 0.;
585
577
        Element *elt = Element::GetElement (Z);
586
578
        int value = elt->GetIntegerProperty ("acidicbehaviour");
587
579
        if (value == GCU_ERROR)
596
588
 
597
589
        switch (value) {
598
590
        case 0:
599
 
                color->red = 0xffff;
 
591
                rgba->red = 1.;
600
592
                return;
601
593
 
602
594
        case 1:
603
 
                color->blue = 0xffff;
 
595
                rgba->blue = 1.;
604
596
                return;
605
597
 
606
598
        case 2:
607
 
                color->green = 0xffff;
 
599
                rgba->green = 1.;
608
600
                return;
609
601
 
610
602
        case 3:
611
 
                color->red = 0xffff;
612
 
                color->blue = 0xffff;
 
603
                rgba->red = 1.;
 
604
                rgba->blue =1.;
613
605
                return;
614
606
        }
615
607
}
616
608
 
617
 
void GChemTableApp::GetElectronegColor (int Z, GdkColor *color)
 
609
void GChemTableApp::GetElectronegColor (int Z, GdkRGBA *rgba)
618
610
{
619
611
        double max=3.98;
620
612
        double min=0.7;
621
613
        double limit;
622
614
 
623
 
        color->red= color->green = color->blue = 0;
 
615
        rgba->red= rgba->green = rgba->blue = 0;
624
616
        Element *elt = Element::GetElement (Z);
625
617
        Value const *value = elt->GetProperty ("electronegativityPauling");
626
618
        if (!value)
631
623
        limit = 0.5 * (max - min);
632
624
 
633
625
        if (en < limit) {
634
 
                color->red = 0xffff;
635
 
                color->blue = static_cast<guint16> ((en - min) * 0xffff / (limit - min));
 
626
                rgba->red = 1.;
 
627
                rgba->blue = (en - min) / (limit - min);
636
628
        } else {
637
 
                color->blue = 0xffff;
638
 
                color->red= static_cast<guint16> ((en - max) * 0xffff / (limit - max));
 
629
                rgba->blue = 1.;
 
630
                rgba->red= (en - max) / (limit - max);
639
631
        }
640
632
 
641
633
}
642
634
 
643
 
void GChemTableApp::GetRadiusColor (int Z, GdkColor *color)
 
635
void GChemTableApp::GetRadiusColor (int Z, GdkRGBA *rgba)
644
636
{
645
637
        double max=2.25;
646
638
        double min=0.32;
647
639
        double limit;
648
640
 
649
 
        color->red = color->green = color->blue = 0;
 
641
        rgba->red = rgba->green = rgba->blue = 0.;
650
642
        Element *elt = Element::GetElement (Z);
651
643
        Value const *value = elt->GetProperty ("radiusCovalent");
652
644
        if (!value)
657
649
        limit = 0.5 * (max - min);
658
650
 
659
651
        if (radius < limit) {
660
 
                color->red = 0xffff;
661
 
                color->blue = static_cast<guint16> ((radius - min) * 0xffff / (limit - min));
 
652
                rgba->red = 1.;
 
653
                rgba->blue = (radius - min) / (limit - min);
662
654
        } else {
663
 
                color->blue = 0xffff;
664
 
                color->red= static_cast<guint16> ((radius - max) * 0xffff / (limit - max));
 
655
                rgba->blue = 1.;
 
656
                rgba->red= (radius - max) / (limit - max);
665
657
        }
666
658
 
667
659
}
668
660
 
669
 
void GChemTableApp::GetBlockColor (int Z, GdkColor *color)
 
661
void GChemTableApp::GetBlockColor (int Z, GdkRGBA *rgba)
670
662
{
671
 
        color->red= color->green = color->blue = 0;
 
663
        rgba->red= rgba->green = rgba->blue = 0.;
672
664
        Element *elt = Element::GetElement (Z);
673
665
        std::string &value = elt->GetStringProperty ("periodTableBlock");
674
666
        if (!value.length())
675
667
                return;
676
668
 
677
669
        if (value == "s") {
678
 
                color->blue = 0x8eff;
 
670
                rgba->blue = 0.558;
679
671
                return;
680
672
        }
681
673
 
682
674
        if (value == "p") {
683
 
                color->red = 0x8eff;
 
675
                rgba->red = 0.558;
684
676
                return;
685
677
        }
686
678
 
687
679
        if (value == "d") {
688
 
                color->green = 0x8eff;
 
680
                rgba->green = 0.558;
689
681
                return;
690
682
        }
691
683
 
692
684
        if (value == "f") {
693
 
                color->blue = 0x8eff;
694
 
                color->red = 0x8eff;
 
685
                rgba->blue = 0.558;
 
686
                rgba->red = 0.558;
695
687
                return;
696
688
        }
697
689
}
722
714
        l.push_front ("application/postscript");
723
715
        l.push_front ("application/pdf");
724
716
        l.push_front ("image/svg+xml");
725
 
        FileChooser (this, true, l, reinterpret_cast <Document *> (curve), _("Save as image"), GetImageSizeWidget ());
 
717
        gcugtk::FileChooser (this, true, l, reinterpret_cast <Document *> (curve), _("Save as image"), GetImageSizeWidget ());
726
718
}
727
719
 
728
720
bool GChemTableApp::FileProcess (const gchar* filename, const gchar* mime_type, bool bSave, G_GNUC_UNUSED GtkWindow *window, Document *Doc)
736
728
                        char *unescaped = g_uri_unescape_string (filename, NULL);
737
729
                        gchar * message = g_strdup_printf (_("File %s\nexists, overwrite?"), unescaped);
738
730
                        g_free (unescaped);
739
 
                        GtkDialog* Box = GTK_DIALOG (gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO, "%s", message));
740
 
                        gtk_window_set_icon_name (GTK_WINDOW (Box), "gspectrum");
741
 
                        result = gtk_dialog_run (Box);
742
 
                        gtk_widget_destroy (GTK_WIDGET (Box));
 
731
                        gcugtk::Message *box = new gcugtk::Message (this, message, GTK_MESSAGE_QUESTION,
 
732
                                                                    GTK_BUTTONS_YES_NO, window);
 
733
                        result = box->Run ();
743
734
                        g_free (message);
744
735
                }
745
736
                if (result == GTK_RESPONSE_YES) {