GTK: made gvbam installable again

git-svn-id: https://svn.code.sf.net/p/vbam/code/trunk@790 a31d4220-a93d-0410-bf67-fe4944624d44
This commit is contained in:
bgk 2008-10-28 09:44:04 +00:00
parent 1404e6406a
commit 85f29da764
6 changed files with 19 additions and 10 deletions

View File

@ -88,13 +88,7 @@ int main(int argc, char * argv[])
Gtk::Window::set_default_icon_name("vbam");
// Use the glade file from the source folder if it exists
// to make gvbam runnable without installation
std::string sGladeFile = "src/gtk/vba.glade";
if (!Glib::file_test(sGladeFile, Glib::FILE_TEST_EXISTS))
{
sGladeFile = PKGDATADIR "/vba.glade";
}
std::string sGladeFile = VBA::Window::sGetUiFilePath("vbam.glade");
Glib::RefPtr<Xml> poXml;
try

View File

@ -43,7 +43,7 @@
</row>
</data>
</object>
<object class="GtkDialog" id="dialog1">
<object class="GtkDialog" id="DisplayConfigDialog">
<property name="border_width">5</property>
<property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>

View File

@ -1503,4 +1503,17 @@ void Window::vSDLPollEvents()
}
}
std::string Window::sGetUiFilePath(const std::string &_sFileName)
{
// Use the ui file from the source folder if it exists
// to make gvbam runnable without installation
std::string sUiFile = "src/gtk/ui/" + _sFileName;
if (!Glib::file_test(sUiFile, Glib::FILE_TEST_EXISTS))
{
sUiFile = PKGDATADIR "/ui/" + _sFileName;
}
return sUiFile;
}
} // VBA namespace

View File

@ -45,6 +45,7 @@ public:
virtual ~Window();
inline static Window * poGetInstance() { return m_poInstance; }
static std::string sGetUiFilePath(const std::string &_sFileName);
enum ECartridge
{

View File

@ -554,10 +554,11 @@ void Window::vOnJoypadConfigure()
void Window::vOnDisplayConfigure()
{
Glib::RefPtr<Gtk::Builder> poBuilder = Gtk::Builder::create_from_file("src/gtk/ui/display.ui");
std::string sUiFile = sGetUiFilePath("display.ui");
Glib::RefPtr<Gtk::Builder> poBuilder = Gtk::Builder::create_from_file(sUiFile);
DisplayConfigDialog * poDialog = 0;
poBuilder->get_widget_derived("dialog1", poDialog);
poBuilder->get_widget_derived("DisplayConfigDialog", poDialog);
poDialog->vSetConfig(m_poDisplayConfig, this);
poDialog->set_transient_for(*this);
poDialog->run();