]> git.lyx.org Git - lyx.git/blob - src/frontends/gnome/GnomeBase.C
fix doxygen operation ; stop #warning causing errors on Sun CC 6.0
[lyx.git] / src / frontends / gnome / GnomeBase.C
1 // -*- C++ -*-
2 /* This file is part of
3  * =================================================
4  * 
5  *          LyX, The Document Processor
6  *          Copyright 1995 Matthias Ettrich.
7  *          Copyright 1995-2000 The LyX Team.
8  *
9  * ================================================= */
10
11 #ifdef __GNUG__
12 #pragma implementation
13 #endif
14
15 #include <config.h>
16 #include "GnomeBase.h"
17 #include "support/LAssert.h"
18 #include "debug.h"
19 #include "support/filetools.h"
20 #include <glib.h>
21
22 #include <gnome--/dialog.h>
23
24 GnomeBase::GnomeBase(ControlButtons & c, 
25                 string const & glade_file, string const & name)
26         : ViewBC<gnomeBC>(c)
27         , file_(glade_file), widget_name_(name), xml_(0)
28         , dialog_(0)
29 {}
30         
31 GnomeBase::~GnomeBase()
32 {
33         if (xml_)
34                 gtk_object_unref(GTK_OBJECT(xml_));
35 }
36
37         
38 void GnomeBase::loadXML() const
39 {
40 #ifdef WITH_WARNINGS
41 #warning Change this before declaring it production code! (be 20010325)
42 #endif
43         string const path("src/frontends/gnome/dialogs/;frontends/gnome/dialogs/;/home/baruch/prog/lyx/graphics/src/frontends/gnome/dialogs/");
44         string const file = FileOpenSearch(path, file_, "glade");
45
46         if (file.empty()) {
47                 lyxerr << "Cannot find glade file. Aborting." << std::endl;
48                 Assert(true);
49         }
50         
51         lyxerr[Debug::GUI] << "Glade file to open is " << file << '\n';
52         
53         xml_ = glade_xml_new(file.c_str(), widget_name_.c_str());
54 }
55
56
57 void GnomeBase::show()
58 {
59         if (!dialog_) {
60                 dialog_ = dialog();
61                 build();
62         }
63
64         update();
65         dialog_->show();
66 }
67
68
69 void GnomeBase::hide()
70 {
71         if (dialog_)
72                 dialog_->hide();
73 }
74
75
76 Gnome::Dialog * GnomeBase::dialog()
77 {
78         if (!dialog_) 
79                 dialog_ = getWidget<Gnome::Dialog>(widget_name_.c_str());
80                 
81         return dialog_;
82 }