GTK GUI:
- Modified the directories dialog so that it uses GtkFileChooserButtons instead of just txt fields - The emulator won't try to write in the rom folder anymore by default, since it has no reason to be writable - Fixed the quicksave menu
This commit is contained in:
parent
4f88520566
commit
b72cabd80e
|
@ -1661,7 +1661,7 @@
|
|||
<widget class="GtkTable" id="table1">
|
||||
<property name="visible">True</property>
|
||||
<property name="n_rows">5</property>
|
||||
<property name="n_columns">4</property>
|
||||
<property name="n_columns">2</property>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label6">
|
||||
<property name="visible">True</property>
|
||||
|
@ -1674,10 +1674,9 @@
|
|||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkEntry" id="GBARomsDirEntry">
|
||||
<widget class="GtkFileChooserButton" id="GBARomsDirEntry">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="invisible_char">*</property>
|
||||
<property name="action">GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
|
@ -1685,46 +1684,6 @@
|
|||
<property name="y_options">GTK_EXPAND</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkButton" id="GBARomsDirResetButton">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="relief">GTK_RELIEF_NONE</property>
|
||||
<property name="response_id">0</property>
|
||||
<child>
|
||||
<widget class="GtkImage" id="image83">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-cancel</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">2</property>
|
||||
<property name="right_attach">3</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options">GTK_EXPAND</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkButton" id="GBARomsDirSelectButton">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="relief">GTK_RELIEF_NONE</property>
|
||||
<property name="response_id">0</property>
|
||||
<child>
|
||||
<widget class="GtkImage" id="image84">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-open</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">3</property>
|
||||
<property name="right_attach">4</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options">GTK_EXPAND</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label7">
|
||||
<property name="visible">True</property>
|
||||
|
@ -1738,28 +1697,6 @@
|
|||
<property name="y_options">GTK_EXPAND</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkButton" id="GBRomsDirSelectButton">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="relief">GTK_RELIEF_NONE</property>
|
||||
<property name="response_id">0</property>
|
||||
<child>
|
||||
<widget class="GtkImage" id="image94">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-open</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">3</property>
|
||||
<property name="right_attach">4</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options">GTK_EXPAND</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label8">
|
||||
<property name="visible">True</property>
|
||||
|
@ -1774,10 +1711,9 @@
|
|||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkEntry" id="BatteriesDirEntry">
|
||||
<widget class="GtkFileChooserButton" id="BatteriesDirEntry">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="invisible_char">*</property>
|
||||
<property name="action">GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
|
@ -1787,50 +1723,6 @@
|
|||
<property name="y_options">GTK_EXPAND</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkButton" id="BatteriesDirSelectButton">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="relief">GTK_RELIEF_NONE</property>
|
||||
<property name="response_id">0</property>
|
||||
<child>
|
||||
<widget class="GtkImage" id="image98">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-open</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">3</property>
|
||||
<property name="right_attach">4</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="bottom_attach">3</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options">GTK_EXPAND</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkButton" id="BatteriesDirResetButton">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="relief">GTK_RELIEF_NONE</property>
|
||||
<property name="response_id">0</property>
|
||||
<child>
|
||||
<widget class="GtkImage" id="image95">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-cancel</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">2</property>
|
||||
<property name="right_attach">3</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="bottom_attach">3</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options">GTK_EXPAND</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label9">
|
||||
<property name="visible">True</property>
|
||||
|
@ -1845,10 +1737,9 @@
|
|||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkEntry" id="SavesDirEntry">
|
||||
<widget class="GtkFileChooserButton" id="SavesDirEntry">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="invisible_char">*</property>
|
||||
<property name="action">GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
|
@ -1858,50 +1749,6 @@
|
|||
<property name="y_options">GTK_EXPAND</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkButton" id="SavesDirResetButton">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="relief">GTK_RELIEF_NONE</property>
|
||||
<property name="response_id">0</property>
|
||||
<child>
|
||||
<widget class="GtkImage" id="image96">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-cancel</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">2</property>
|
||||
<property name="right_attach">3</property>
|
||||
<property name="top_attach">3</property>
|
||||
<property name="bottom_attach">4</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options">GTK_EXPAND</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkButton" id="SavesDirSelectButton">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="relief">GTK_RELIEF_NONE</property>
|
||||
<property name="response_id">0</property>
|
||||
<child>
|
||||
<widget class="GtkImage" id="image99">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-open</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">3</property>
|
||||
<property name="right_attach">4</property>
|
||||
<property name="top_attach">3</property>
|
||||
<property name="bottom_attach">4</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options">GTK_EXPAND</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label10">
|
||||
<property name="visible">True</property>
|
||||
|
@ -1916,10 +1763,9 @@
|
|||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkEntry" id="CapturesDirEntry">
|
||||
<widget class="GtkFileChooserButton" id="CapturesDirEntry">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="invisible_char">*</property>
|
||||
<property name="action">GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
|
@ -1930,54 +1776,9 @@
|
|||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkButton" id="CapturesDirResetButton">
|
||||
<widget class="GtkFileChooserButton" id="GBRomsDirEntry">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="relief">GTK_RELIEF_NONE</property>
|
||||
<property name="response_id">0</property>
|
||||
<child>
|
||||
<widget class="GtkImage" id="image97">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-cancel</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">2</property>
|
||||
<property name="right_attach">3</property>
|
||||
<property name="top_attach">4</property>
|
||||
<property name="bottom_attach">5</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options">GTK_EXPAND</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkButton" id="CapturesDirSelectButton">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="relief">GTK_RELIEF_NONE</property>
|
||||
<property name="response_id">0</property>
|
||||
<child>
|
||||
<widget class="GtkImage" id="image100">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-open</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">3</property>
|
||||
<property name="right_attach">4</property>
|
||||
<property name="top_attach">4</property>
|
||||
<property name="bottom_attach">5</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options">GTK_EXPAND</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkEntry" id="GBRomsDirEntry">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="invisible_char">*</property>
|
||||
<property name="action">GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
|
@ -1987,28 +1788,6 @@
|
|||
<property name="y_options">GTK_EXPAND</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkButton" id="GBRomsDirResetButton">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="relief">GTK_RELIEF_NONE</property>
|
||||
<property name="response_id">0</property>
|
||||
<child>
|
||||
<widget class="GtkImage" id="image101">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-cancel</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">2</property>
|
||||
<property name="right_attach">3</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options">GTK_EXPAND</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">2</property>
|
||||
|
@ -2019,21 +1798,11 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="layout_style">GTK_BUTTONBOX_END</property>
|
||||
<child>
|
||||
<widget class="GtkButton" id="cancelbutton2">
|
||||
<widget class="GtkButton" id="closebutton2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="label">gtk-cancel</property>
|
||||
<property name="use_stock">True</property>
|
||||
<property name="response_id">-6</property>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkButton" id="okbutton2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="label">gtk-ok</property>
|
||||
<property name="label">gtk-close</property>
|
||||
<property name="use_stock">True</property>
|
||||
<property name="response_id">-5</property>
|
||||
</widget>
|
||||
|
|
|
@ -107,11 +107,11 @@ Window::Window(GtkWindow * _pstWindow, const Glib::RefPtr<Xml> & _poXml) :
|
|||
|
||||
// Get config
|
||||
//
|
||||
vInitConfig();
|
||||
|
||||
m_sUserDataDir = Glib::get_home_dir() + "/.gvba";
|
||||
m_sConfigFile = m_sUserDataDir + "/config";
|
||||
|
||||
vInitConfig();
|
||||
|
||||
if (! Glib::file_test(m_sUserDataDir, Glib::FILE_TEST_EXISTS))
|
||||
{
|
||||
mkdir(m_sUserDataDir.c_str(), 0777);
|
||||
|
@ -180,7 +180,7 @@ Window::Window(GtkWindow * _pstWindow, const Glib::RefPtr<Xml> & _poXml) :
|
|||
char csName[20];
|
||||
snprintf(csName, 20, "LoadGameSlot%d", i + 1);
|
||||
m_apoLoadGameItem[i] = dynamic_cast<Gtk::MenuItem *>(_poXml->get_widget(csName));
|
||||
snprintf(csName, 20, "LoadGameSlot%d", i + 1);
|
||||
snprintf(csName, 20, "SaveGameSlot%d", i + 1);
|
||||
m_apoSaveGameItem[i] = dynamic_cast<Gtk::MenuItem *>(_poXml->get_widget(csName));
|
||||
|
||||
m_apoLoadGameItem[i]->signal_activate().connect(sigc::bind(
|
||||
|
@ -968,11 +968,11 @@ void Window::vInitConfig()
|
|||
// Directories section
|
||||
//
|
||||
m_poDirConfig = m_oConfig.poAddSection("Directories");
|
||||
m_poDirConfig->vSetKey("gb_roms", "" );
|
||||
m_poDirConfig->vSetKey("gba_roms", "" );
|
||||
m_poDirConfig->vSetKey("batteries", "" );
|
||||
m_poDirConfig->vSetKey("saves", "" );
|
||||
m_poDirConfig->vSetKey("captures", "" );
|
||||
m_poDirConfig->vSetKey("gb_roms", Glib::get_home_dir());
|
||||
m_poDirConfig->vSetKey("gba_roms", Glib::get_home_dir());
|
||||
m_poDirConfig->vSetKey("batteries", m_sUserDataDir);
|
||||
m_poDirConfig->vSetKey("saves", m_sUserDataDir);
|
||||
m_poDirConfig->vSetKey("captures", m_sUserDataDir);
|
||||
|
||||
// Core section
|
||||
//
|
||||
|
@ -1068,27 +1068,27 @@ void Window::vCheckConfig()
|
|||
sValue = m_poDirConfig->sGetKey("gb_roms");
|
||||
if (sValue != "" && ! Glib::file_test(sValue, Glib::FILE_TEST_IS_DIR))
|
||||
{
|
||||
m_poDirConfig->vSetKey("gb_roms", "");
|
||||
m_poDirConfig->vSetKey("gb_roms", Glib::get_home_dir());
|
||||
}
|
||||
sValue = m_poDirConfig->sGetKey("gba_roms");
|
||||
if (sValue != "" && ! Glib::file_test(sValue, Glib::FILE_TEST_IS_DIR))
|
||||
{
|
||||
m_poDirConfig->vSetKey("gba_roms", "");
|
||||
m_poDirConfig->vSetKey("gba_roms", Glib::get_home_dir());
|
||||
}
|
||||
sValue = m_poDirConfig->sGetKey("batteries");
|
||||
if (sValue != "" && ! Glib::file_test(sValue, Glib::FILE_TEST_IS_DIR))
|
||||
{
|
||||
m_poDirConfig->vSetKey("batteries", "");
|
||||
m_poDirConfig->vSetKey("batteries", m_sUserDataDir);
|
||||
}
|
||||
sValue = m_poDirConfig->sGetKey("saves");
|
||||
if (sValue != "" && ! Glib::file_test(sValue, Glib::FILE_TEST_IS_DIR))
|
||||
{
|
||||
m_poDirConfig->vSetKey("saves", "");
|
||||
m_poDirConfig->vSetKey("saves", m_sUserDataDir);
|
||||
}
|
||||
sValue = m_poDirConfig->sGetKey("captures");
|
||||
if (sValue != "" && ! Glib::file_test(sValue, Glib::FILE_TEST_IS_DIR))
|
||||
{
|
||||
m_poDirConfig->vSetKey("captures", "");
|
||||
m_poDirConfig->vSetKey("captures", m_sUserDataDir);
|
||||
}
|
||||
|
||||
// Core section
|
||||
|
@ -1575,16 +1575,15 @@ void Window::vComputeFrameskip(int _iRate)
|
|||
void Window::vCaptureScreen(int _iNum)
|
||||
{
|
||||
std::string sBaseName;
|
||||
std::string sCaptureDir = m_poDirConfig->sGetKey("captures");
|
||||
if (sCaptureDir == "")
|
||||
std::string sDir = m_poDirConfig->sGetKey("captures");
|
||||
if (sDir == "")
|
||||
{
|
||||
sBaseName = sCutSuffix(m_sRomFile);
|
||||
}
|
||||
else
|
||||
{
|
||||
sBaseName = sCaptureDir + "/" + sCutSuffix(Glib::path_get_basename(m_sRomFile));
|
||||
sDir = m_sUserDataDir;
|
||||
}
|
||||
|
||||
sBaseName = sDir + "/" + sCutSuffix(Glib::path_get_basename(m_sRomFile));
|
||||
|
||||
|
||||
char * csFile = g_strdup_printf("%s_%02d.png",
|
||||
sBaseName.c_str(),
|
||||
_iNum);
|
||||
|
@ -1625,16 +1624,23 @@ void Window::vCreateFileOpenDialog()
|
|||
poDialog->add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
|
||||
poDialog->add_button(Gtk::Stock::OPEN, Gtk::RESPONSE_OK);
|
||||
|
||||
if (sGBDir != "")
|
||||
try
|
||||
{
|
||||
poDialog->add_shortcut_folder(sGBDir);
|
||||
poDialog->set_current_folder(sGBDir);
|
||||
}
|
||||
if (sGBDir != "")
|
||||
{
|
||||
poDialog->add_shortcut_folder(sGBDir);
|
||||
poDialog->set_current_folder(sGBDir);
|
||||
}
|
||||
|
||||
if (sGBADir != "" && sGBADir != sGBDir)
|
||||
if (sGBADir != "" && sGBADir != sGBDir)
|
||||
{
|
||||
poDialog->add_shortcut_folder(sGBADir);
|
||||
poDialog->set_current_folder(sGBADir);
|
||||
}
|
||||
}
|
||||
catch (const Gtk::FileChooserError& e)
|
||||
{
|
||||
poDialog->add_shortcut_folder(sGBADir);
|
||||
poDialog->set_current_folder(sGBADir);
|
||||
// Most likely the shortcut already exists, so do nothing
|
||||
}
|
||||
|
||||
const char * acsPattern[] =
|
||||
|
@ -1681,13 +1687,11 @@ void Window::vLoadBattery()
|
|||
std::string sDir = m_poDirConfig->sGetKey("batteries");
|
||||
if (sDir == "")
|
||||
{
|
||||
sBattery = sCutSuffix(m_sRomFile) + ".sav";
|
||||
}
|
||||
else
|
||||
{
|
||||
sBattery = sDir + "/" + sCutSuffix(Glib::path_get_basename(m_sRomFile)) + ".sav";
|
||||
sDir = m_sUserDataDir;
|
||||
}
|
||||
|
||||
sBattery = sDir + "/" + sCutSuffix(Glib::path_get_basename(m_sRomFile)) + ".sav";
|
||||
|
||||
if (m_stEmulator.emuReadBattery(sBattery.c_str()))
|
||||
{
|
||||
systemScreenMessage(_("Loaded battery"));
|
||||
|
@ -1700,13 +1704,11 @@ void Window::vSaveBattery()
|
|||
std::string sDir = m_poDirConfig->sGetKey("batteries");
|
||||
if (sDir == "")
|
||||
{
|
||||
sBattery = sCutSuffix(m_sRomFile) + ".sav";
|
||||
}
|
||||
else
|
||||
{
|
||||
sBattery = sDir + "/" + sCutSuffix(Glib::path_get_basename(m_sRomFile)) + ".sav";
|
||||
sDir = m_sUserDataDir;
|
||||
}
|
||||
|
||||
sBattery = sDir + "/" + sCutSuffix(Glib::path_get_basename(m_sRomFile)) + ".sav";
|
||||
|
||||
if (m_stEmulator.emuWriteBattery(sBattery.c_str()))
|
||||
{
|
||||
systemScreenMessage(_("Saved battery"));
|
||||
|
@ -1792,13 +1794,11 @@ void Window::vUpdateGameSlots()
|
|||
std::string sDir = m_poDirConfig->sGetKey("saves");
|
||||
if (sDir == "")
|
||||
{
|
||||
sFileBase = sCutSuffix(m_sRomFile);
|
||||
}
|
||||
else
|
||||
{
|
||||
sFileBase = sDir + "/" + sCutSuffix(Glib::path_get_basename(m_sRomFile));
|
||||
sDir = m_sUserDataDir;
|
||||
}
|
||||
|
||||
sFileBase = sDir + "/" + sCutSuffix(Glib::path_get_basename(m_sRomFile));
|
||||
|
||||
const char * csDateFormat = _("%Y/%m/%d %H:%M:%S");
|
||||
|
||||
for (int i = 0; i < 10; i++)
|
||||
|
|
|
@ -162,8 +162,6 @@ protected:
|
|||
virtual void vOnVideoScaleToggled(Gtk::CheckMenuItem * _poCMI, int _iScale);
|
||||
virtual void vOnLayerToggled(Gtk::CheckMenuItem * _poCMI, int _iLayer);
|
||||
virtual void vOnDirectories();
|
||||
virtual void vOnDirectoryReset(Gtk::Entry * _poEntry);
|
||||
virtual void vOnDirectorySelect(Gtk::Entry * _poEntry);
|
||||
virtual void vOnPauseWhenInactiveToggled(Gtk::CheckMenuItem * _poCMI);
|
||||
virtual void vOnSelectBios();
|
||||
virtual void vOnUseBiosToggled(Gtk::CheckMenuItem * _poCMI);
|
||||
|
|
|
@ -618,82 +618,42 @@ void Window::vOnDirectories()
|
|||
struct
|
||||
{
|
||||
const char * m_csKey;
|
||||
const char * m_csEntry;
|
||||
const char * m_csResetButton;
|
||||
const char * m_csSelectButton;
|
||||
const char * m_csFileChooserButton;
|
||||
}
|
||||
astRow[] =
|
||||
{
|
||||
{ "gba_roms", "GBARomsDirEntry", "GBARomsDirResetButton", "GBARomsDirSelectButton" },
|
||||
{ "gb_roms", "GBRomsDirEntry", "GBRomsDirResetButton", "GBRomsDirSelectButton" },
|
||||
{ "batteries", "BatteriesDirEntry", "BatteriesDirResetButton", "BatteriesDirSelectButton" },
|
||||
{ "saves", "SavesDirEntry", "SavesDirResetButton", "SavesDirSelectButton" },
|
||||
{ "captures", "CapturesDirEntry", "CapturesDirResetButton", "CapturesDirSelectButton" }
|
||||
{ "gba_roms", "GBARomsDirEntry" },
|
||||
{ "gb_roms", "GBRomsDirEntry" },
|
||||
{ "batteries", "BatteriesDirEntry" },
|
||||
{ "saves", "SavesDirEntry" },
|
||||
{ "captures", "CapturesDirEntry" }
|
||||
};
|
||||
|
||||
for (guint i = 0; i < G_N_ELEMENTS(astRow); i++)
|
||||
{
|
||||
Gtk::Entry * poEntry = dynamic_cast<Gtk::Entry *>(poXml->get_widget(astRow[i].m_csEntry));
|
||||
Gtk::Button * poReset = dynamic_cast<Gtk::Button *>(poXml->get_widget(astRow[i].m_csResetButton));
|
||||
Gtk::Button * poSelect = dynamic_cast<Gtk::Button *>(poXml->get_widget(astRow[i].m_csSelectButton));
|
||||
Gtk::FileChooserButton * poFileChooserButton = dynamic_cast<Gtk::FileChooserButton *>(poXml->get_widget(astRow[i].m_csFileChooserButton));
|
||||
|
||||
poEntry->set_text(m_poDirConfig->sGetKey(astRow[i].m_csKey));
|
||||
|
||||
poReset->signal_clicked().connect(sigc::bind(
|
||||
sigc::mem_fun(*this, &Window::vOnDirectoryReset),
|
||||
poEntry));
|
||||
poSelect->signal_clicked().connect(sigc::bind(
|
||||
sigc::mem_fun(*this, &Window::vOnDirectorySelect),
|
||||
poEntry));
|
||||
poFileChooserButton->set_current_folder(m_poDirConfig->sGetKey(astRow[i].m_csKey));
|
||||
}
|
||||
|
||||
Gtk::Dialog * poDialog = dynamic_cast<Gtk::Dialog *>(poXml->get_widget("DirectoriesDialog"));
|
||||
poDialog->set_transient_for(*this);
|
||||
poDialog->run();
|
||||
|
||||
if (poDialog->run() == Gtk::RESPONSE_OK)
|
||||
for (guint i = 0; i < G_N_ELEMENTS(astRow); i++)
|
||||
{
|
||||
for (guint i = 0; i < G_N_ELEMENTS(astRow); i++)
|
||||
{
|
||||
Gtk::Entry * poEntry = dynamic_cast<Gtk::Entry *>(poXml->get_widget(astRow[i].m_csEntry));
|
||||
Glib::ustring sDir = poEntry->get_text();
|
||||
if (! Glib::file_test(sDir, Glib::FILE_TEST_IS_DIR))
|
||||
{
|
||||
sDir = "";
|
||||
}
|
||||
m_poDirConfig->vSetKey(astRow[i].m_csKey, sDir);
|
||||
}
|
||||
Gtk::FileChooserButton * poFileChooserButton = dynamic_cast<Gtk::FileChooserButton *>(poXml->get_widget(astRow[i].m_csFileChooserButton));
|
||||
Glib::ustring sDir = poFileChooserButton->get_current_folder();
|
||||
|
||||
// Needed if saves dir changed
|
||||
vUpdateGameSlots();
|
||||
m_poDirConfig->vSetKey(astRow[i].m_csKey, sDir);
|
||||
}
|
||||
|
||||
// Needed if saves dir changed
|
||||
vUpdateGameSlots();
|
||||
|
||||
delete poDialog;
|
||||
}
|
||||
|
||||
void Window::vOnDirectoryReset(Gtk::Entry * _poEntry)
|
||||
{
|
||||
_poEntry->set_text("");
|
||||
}
|
||||
|
||||
void Window::vOnDirectorySelect(Gtk::Entry * _poEntry)
|
||||
{
|
||||
Gtk::FileChooserDialog oDialog(*this, _("Select directory"),
|
||||
Gtk::FILE_CHOOSER_ACTION_SELECT_FOLDER);
|
||||
oDialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
|
||||
oDialog.add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK);
|
||||
|
||||
if (_poEntry->get_text() != "")
|
||||
{
|
||||
oDialog.add_shortcut_folder(_poEntry->get_text());
|
||||
oDialog.set_current_folder(_poEntry->get_text());
|
||||
}
|
||||
|
||||
if (oDialog.run() == Gtk::RESPONSE_OK)
|
||||
{
|
||||
_poEntry->set_text(oDialog.get_filename());
|
||||
}
|
||||
}
|
||||
|
||||
void Window::vOnPauseWhenInactiveToggled(Gtk::CheckMenuItem * _poCMI)
|
||||
{
|
||||
m_poDisplayConfig->vSetKey("pause_when_inactive", _poCMI->get_active());
|
||||
|
|
Loading…
Reference in New Issue