]> git.lyx.org Git - lyx.git/blob - src/frontends/gnome/GnomeBase.C
Remove unneeded files, we have switched to use the libglade and there is no
[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(ControlButton & 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 #warning Change this before declaring it production code! (be 20010325)
41         string const path("src/frontends/gnome/dialogs/;frontends/gnome/dialogs/;/home/baruch/prog/lyx/graphics/src/frontends/gnome/dialogs/");
42         string const file = FileOpenSearch(path, file_, "glade");
43
44         if (file.empty()) {
45                 lyxerr << "Cannot find glade file. Aborting." << std::endl;
46                 Assert(true);
47         }
48         
49         lyxerr[Debug::GUI] << "Glade file to open is " << file << '\n';
50         
51         xml_ = glade_xml_new(file.c_str(), widget_name_.c_str());
52 }
53
54
55 void GnomeBase::show()
56 {
57         if (!dialog_) {
58                 dialog_ = dialog();
59                 build();
60         }
61
62         update();
63         dialog_->show();
64 }
65
66
67 void GnomeBase::hide()
68 {
69         if (dialog_)
70                 dialog_->hide();
71 }
72
73
74 Gnome::Dialog * GnomeBase::dialog()
75 {
76         if (!dialog_) 
77                 dialog_ = getWidget<Gnome::Dialog>(widget_name_.c_str());
78                 
79         return dialog_;
80 }