]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/gnome/GnomeBase.C
Clean-up of the button controller.
[lyx.git] / src / frontends / gnome / GnomeBase.C
index 36c93f92286566420487a8ec5709e641d9cc8be3..cb56013590aed57c5c43cc5df64a1dad1986f9f4 100644 (file)
@@ -1,4 +1,3 @@
-// -*- C++ -*-
 /* This file is part of
  * =================================================
  * 
 #include "support/filetools.h"
 #include <glib.h>
 
-GnomeBase::GnomeBase(ControlButton & c, string const & glade_file, string const & name)
-       : ViewBC<gnomeBC>(c), file_(glade_file), widget_name_(name), xml_(0)
+#include <gnome--/dialog.h>
+
+GnomeBase::GnomeBase(ControlButtons & c, 
+               string const & glade_file, string const & name)
+       : ViewBC<gnomeBC>(c)
+       , file_(glade_file), widget_name_(name), xml_(0)
+       , dialog_(0)
 {}
        
 GnomeBase::~GnomeBase()
@@ -32,16 +36,46 @@ GnomeBase::~GnomeBase()
        
 void GnomeBase::loadXML() const
 {
+#ifdef WITH_WARNINGS
 #warning Change this before declaring it production code! (be 20010325)
+#endif
        string const path("src/frontends/gnome/dialogs/;frontends/gnome/dialogs/;/home/baruch/prog/lyx/graphics/src/frontends/gnome/dialogs/");
        string const file = FileOpenSearch(path, file_, "glade");
 
        if (file.empty()) {
                lyxerr << "Cannot find glade file. Aborting." << std::endl;
-               Assert(true);
+               lyx::Assert(true);
        }
        
        lyxerr[Debug::GUI] << "Glade file to open is " << file << '\n';
        
        xml_ = glade_xml_new(file.c_str(), widget_name_.c_str());
 }
+
+
+void GnomeBase::show()
+{
+       if (!dialog_) {
+               dialog_ = dialog();
+               build();
+       }
+
+       update();
+       dialog_->show();
+}
+
+
+void GnomeBase::hide()
+{
+       if (dialog_)
+               dialog_->hide();
+}
+
+
+Gnome::Dialog * GnomeBase::dialog()
+{
+       if (!dialog_) 
+               dialog_ = getWidget<Gnome::Dialog>(widget_name_.c_str());
+               
+       return dialog_;
+}