]> git.lyx.org Git - lyx.git/blobdiff - 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
index 631d5f2c506e7dc0fc1bbb67764e5cec04c539cb..8b68b16bb706c1f36eccf17f46054a80c3cc9db4 100644 (file)
 #include "support/filetools.h"
 #include <glib.h>
 
-GnomeBase::GnomeBase(ControlBase & 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(ControlButton & c, 
+               string const & glade_file, string const & name)
+       : ViewBC<gnomeBC>(c)
+       , file_(glade_file), widget_name_(name), xml_(0)
+       , dialog_(0)
 {}
        
 GnomeBase::~GnomeBase()
 {
-     gtk_object_unref(GTK_OBJECT(xml_));
+       if (xml_)
+               gtk_object_unref(GTK_OBJECT(xml_));
 }
 
        
@@ -44,3 +50,31 @@ void GnomeBase::loadXML() const
        
        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_;
+}