Replace half a dozen nearly identical functions with one in the Linux code.

git-svn-id: http://pcsx2-playground.googlecode.com/svn/trunk@308 a6443dda-0b58-4228-96e9-037be469359c
This commit is contained in:
arcum42 2008-11-06 14:10:19 +00:00 committed by Gregory Hainaut
parent 22fa366df2
commit 6ba744dea2
5 changed files with 33 additions and 150 deletions

View File

@ -203,13 +203,6 @@ void OnConfConf_Ok(GtkButton *button, gpointer user_data) {
applychanges = TRUE;
}
void OnConfConf_Cancel(GtkButton *button, gpointer user_data) {
gtk_widget_destroy(ConfDlg);
if (MainWindow) gtk_widget_set_sensitive(MainWindow, TRUE);
gtk_main_quit();
applychanges = FALSE;
}
void OnConfConf_GsConf(GtkButton *button, gpointer user_data) {
ConfPlugin(GSConfS, Config.GS, "GSconfigure");
}

View File

@ -17,6 +17,11 @@
*/
#include "GtkGui.h"
void On_Dialog_Cancelled(GtkButton* button, gpointer user_data) {
gtk_widget_destroy((GtkWidget*)gtk_widget_get_toplevel ((GtkWidget*)button));
gtk_widget_set_sensitive(MainWindow, TRUE);
gtk_main_quit();
}
void StartGui() {
GtkWidget *Menu;
@ -387,12 +392,6 @@ void OnArguments_Ok(GtkButton *button, gpointer user_data) {
gtk_main_quit();
}
void OnArguments_Cancel(GtkButton* button, gpointer user_data) {
gtk_widget_destroy(CmdLine);
gtk_widget_set_sensitive(MainWindow, TRUE);
gtk_main_quit();
}
void OnEmu_Arguments(GtkMenuItem *menuitem, gpointer user_data) {
GtkWidget *widgetCmdLine;
@ -455,12 +454,6 @@ void OnCpu_Ok(GtkButton *button, gpointer user_data) {
gtk_main_quit();
}
void OnCpu_Cancel(GtkButton *button, gpointer user_data) {
gtk_widget_destroy(CpuDlg);
if (MainWindow) gtk_widget_set_sensitive(MainWindow, TRUE);
gtk_main_quit();
}
void OnConf_Cpu(GtkMenuItem *menuitem, gpointer user_data)
{
char str[512];
@ -539,12 +532,6 @@ void OnLogging_Ok(GtkButton *button, gpointer user_data) {
gtk_main_quit();
}
void OnLogging_Cancel(GtkButton *button, gpointer user_data) {
gtk_widget_destroy(LogDlg);
gtk_widget_set_sensitive(MainWindow, TRUE);
gtk_main_quit();
}
void OnDebug_Logging(GtkMenuItem *menuitem, gpointer user_data) {
GtkWidget *Btn;
char str[32];
@ -637,12 +624,7 @@ void on_Game_Fixes(GtkMenuItem *menuitem, gpointer user_data)
gtk_widget_set_sensitive(MainWindow, FALSE);
gtk_main();
}
void on_Game_Fix_Cancel(GtkButton *button, gpointer user_data)
{
gtk_widget_destroy(GameFixDlg);
gtk_widget_set_sensitive(MainWindow, TRUE);
gtk_main_quit();
}
void on_Game_Fix_OK(GtkButton *button, gpointer user_data)
{
@ -719,12 +701,7 @@ void on_Speed_Hack_Speed(GtkButton *button, gpointer user_data)
set_checked(SpeedHacksDlg, "check_Disable_FPU_Flags", TRUE);
}
void on_Speed_Hack_Cancel(GtkButton *button, gpointer user_data)
{
gtk_widget_destroy(SpeedHacksDlg);
gtk_widget_set_sensitive(MainWindow, TRUE);
gtk_main_quit();
}
void on_Speed_Hack_OK(GtkButton *button, gpointer user_data)
{
Config.Hacks = 0;
@ -828,12 +805,7 @@ void on_Advanced_Defaults(GtkButton *button, gpointer user_data)
setAdvancedOptions();
}
void on_Advanced_Cancel(GtkButton *button, gpointer user_data)
{
gtk_widget_destroy(AdvDlg);
gtk_widget_set_sensitive(MainWindow, TRUE);
gtk_main_quit();
}
void on_Advanced_OK(GtkButton *button, gpointer user_data)
{
Config.sseMXCSR &= 0x1fbf;

View File

@ -10,7 +10,7 @@ on_Advanced_OK (GtkButton *button,
gpointer user_data);
void
on_Advanced_Cancel (GtkButton *button,
On_Dialog_Cancelled (GtkButton *button,
gpointer user_data);
void
@ -25,66 +25,34 @@ void
on_Speed_Hack_OK (GtkButton *button,
gpointer user_data);
void
on_Speed_Hack_Cancel (GtkButton *button,
gpointer user_data);
void
on_Game_Fix_OK (GtkButton *button,
gpointer user_data);
void
on_Game_Fix_Cancel (GtkButton *button,
gpointer user_data);
void
OnMemWrite32_Ok (GtkButton *button,
gpointer user_data);
void
OnMemWrite32_Cancel (GtkButton *button,
gpointer user_data);
void
OnArguments_Ok (GtkButton *button,
gpointer user_data);
void
OnArguments_Cancel (GtkButton *button,
gpointer user_data);
void
OnLogging_Ok (GtkButton *button,
gpointer user_data);
void
OnLogging_Cancel (GtkButton *button,
gpointer user_data);
void
OnDumpR_Ok (GtkButton *button,
gpointer user_data);
void
OnDumpR_Cancel (GtkButton *button,
gpointer user_data);
void
OnDumpC_Ok (GtkButton *button,
gpointer user_data);
void
OnDumpC_Cancel (GtkButton *button,
gpointer user_data);
void
OnSetBPC_Ok (GtkButton *button,
gpointer user_data);
void
OnSetBPC_Cancel (GtkButton *button,
gpointer user_data);
void
OnSetBPA_Ok (GtkButton *button,
gpointer user_data);
@ -97,10 +65,6 @@ void
OnSetPC_Ok (GtkButton *button,
gpointer user_data);
void
OnSetPC_Cancel (GtkButton *button,
gpointer user_data);
void
OnDebug_EEMode (GtkToggleButton *togglebutton,
gpointer user_data);
@ -161,10 +125,6 @@ void
OnCpu_Ok (GtkButton *button,
gpointer user_data);
void
OnCpu_Cancel (GtkButton *button,
gpointer user_data);
void
OnConfConf_FWConf (GtkButton *button,
gpointer user_data);
@ -273,10 +233,6 @@ void
OnConfConf_Ok (GtkButton *button,
gpointer user_data);
void
OnConfConf_Cancel (GtkButton *button,
gpointer user_data);
void
OnHelpAbout_Ok (GtkButton *button,
gpointer user_data);

View File

@ -244,7 +244,7 @@ create_AdvDlg (void)
G_CALLBACK (on_Advanced_OK),
NULL);
g_signal_connect ((gpointer) button80, "clicked",
G_CALLBACK (on_Advanced_Cancel),
G_CALLBACK (On_Dialog_Cancelled),
NULL);
/* Store pointers to all widgets, for use by lookup_widget(). */
@ -523,7 +523,7 @@ create_SpeedHacksDlg (void)
G_CALLBACK (on_Speed_Hack_OK),
NULL);
g_signal_connect ((gpointer) button76, "clicked",
G_CALLBACK (on_Speed_Hack_Cancel),
G_CALLBACK (On_Dialog_Cancelled),
NULL);
/* Store pointers to all widgets, for use by lookup_widget(). */
@ -648,7 +648,7 @@ create_GameFixDlg (void)
G_CALLBACK (on_Game_Fix_OK),
NULL);
g_signal_connect ((gpointer) button83, "clicked",
G_CALLBACK (on_Game_Fix_Cancel),
G_CALLBACK (On_Dialog_Cancelled),
NULL);
/* Store pointers to all widgets, for use by lookup_widget(). */
@ -754,7 +754,7 @@ create_MemWrite32 (void)
G_CALLBACK (OnMemWrite32_Ok),
NULL);
g_signal_connect ((gpointer) button72, "clicked",
G_CALLBACK (OnMemWrite32_Cancel),
G_CALLBACK (On_Dialog_Cancelled),
NULL);
/* Store pointers to all widgets, for use by lookup_widget(). */
@ -842,7 +842,7 @@ create_CmdLine (void)
G_CALLBACK (OnArguments_Ok),
NULL);
g_signal_connect ((gpointer) GtkButton_Cancel2, "clicked",
G_CALLBACK (OnArguments_Cancel),
G_CALLBACK (On_Dialog_Cancelled),
NULL);
/* Store pointers to all widgets, for use by lookup_widget(). */
@ -1144,7 +1144,7 @@ create_Logging (void)
G_CALLBACK (OnLogging_Ok),
NULL);
g_signal_connect ((gpointer) button67, "clicked",
G_CALLBACK (OnLogging_Cancel),
G_CALLBACK (On_Dialog_Cancelled),
NULL);
/* Store pointers to all widgets, for use by lookup_widget(). */
@ -1279,7 +1279,7 @@ create_DumpRDlg (void)
G_CALLBACK (OnDumpR_Ok),
NULL);
g_signal_connect ((gpointer) button51, "clicked",
G_CALLBACK (OnDumpR_Cancel),
G_CALLBACK (On_Dialog_Cancelled),
NULL);
/* Store pointers to all widgets, for use by lookup_widget(). */
@ -1386,7 +1386,7 @@ create_DumpCDlg (void)
G_CALLBACK (OnDumpC_Ok),
NULL);
g_signal_connect ((gpointer) button49, "clicked",
G_CALLBACK (OnDumpC_Cancel),
G_CALLBACK (On_Dialog_Cancelled),
NULL);
/* Store pointers to all widgets, for use by lookup_widget(). */
@ -1469,7 +1469,7 @@ create_SetBPCDlg (void)
G_CALLBACK (OnSetBPC_Ok),
NULL);
g_signal_connect ((gpointer) button47, "clicked",
G_CALLBACK (OnSetBPC_Cancel),
G_CALLBACK (On_Dialog_Cancelled),
NULL);
/* Store pointers to all widgets, for use by lookup_widget(). */
@ -1627,7 +1627,7 @@ create_SetPCDlg (void)
G_CALLBACK (OnSetPC_Ok),
NULL);
g_signal_connect ((gpointer) button43, "clicked",
G_CALLBACK (OnSetPC_Cancel),
G_CALLBACK (On_Dialog_Cancelled),
NULL);
/* Store pointers to all widgets, for use by lookup_widget(). */
@ -1676,8 +1676,6 @@ create_DebugWnd (void)
GtkWidget *button41;
GtkWidget *vbuttonbox4;
GtkWidget *button68;
GtkWidget *button69;
GtkWidget *button70;
DebugWnd = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_container_set_border_width (GTK_CONTAINER (DebugWnd), 5);
@ -1814,16 +1812,6 @@ create_DebugWnd (void)
gtk_container_add (GTK_CONTAINER (vbuttonbox4), button68);
GTK_WIDGET_SET_FLAGS (button68, GTK_CAN_DEFAULT);
button69 = gtk_button_new_with_mnemonic (_("button69"));
gtk_widget_show (button69);
gtk_container_add (GTK_CONTAINER (vbuttonbox4), button69);
GTK_WIDGET_SET_FLAGS (button69, GTK_CAN_DEFAULT);
button70 = gtk_button_new_with_mnemonic (_("button70"));
gtk_widget_show (button70);
gtk_container_add (GTK_CONTAINER (vbuttonbox4), button70);
GTK_WIDGET_SET_FLAGS (button70, GTK_CAN_DEFAULT);
g_signal_connect ((gpointer) GtkRadioButton_EE, "toggled",
G_CALLBACK (OnDebug_EEMode),
NULL);
@ -1896,8 +1884,6 @@ create_DebugWnd (void)
GLADE_HOOKUP_OBJECT (DebugWnd, button41, "button41");
GLADE_HOOKUP_OBJECT (DebugWnd, vbuttonbox4, "vbuttonbox4");
GLADE_HOOKUP_OBJECT (DebugWnd, button68, "button68");
GLADE_HOOKUP_OBJECT (DebugWnd, button69, "button69");
GLADE_HOOKUP_OBJECT (DebugWnd, button70, "button70");
return DebugWnd;
}
@ -2093,7 +2079,7 @@ create_CpuDlg (void)
G_CALLBACK (OnCpu_Ok),
NULL);
g_signal_connect ((gpointer) GtkButton_Cancel1, "clicked",
G_CALLBACK (OnCpu_Cancel),
G_CALLBACK (On_Dialog_Cancelled),
NULL);
/* Store pointers to all widgets, for use by lookup_widget(). */
@ -2622,7 +2608,7 @@ create_ConfDlg (void)
G_CALLBACK (OnConfConf_Ok),
NULL);
g_signal_connect ((gpointer) GtkButton_Cancel, "clicked",
G_CALLBACK (OnConfConf_Cancel),
G_CALLBACK (On_Dialog_Cancelled),
NULL);
/* Store pointers to all widgets, for use by lookup_widget(). */

View File

@ -69,7 +69,7 @@
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">-6</property>
<signal name="clicked" handler="on_Advanced_Cancel"/>
<signal name="clicked" handler="On_Dialog_Cancelled" last_modification_time="Thu, 06 Nov 2008 13:39:26 GMT"/>
</widget>
</child>
</widget>
@ -647,7 +647,7 @@
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">-6</property>
<signal name="clicked" handler="on_Speed_Hack_Cancel"/>
<signal name="clicked" handler="On_Dialog_Cancelled" last_modification_time="Thu, 06 Nov 2008 13:39:35 GMT"/>
</widget>
</child>
</widget>
@ -1268,7 +1268,7 @@ Enabled (Helps SPS, Slow)</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">-6</property>
<signal name="clicked" handler="on_Game_Fix_Cancel"/>
<signal name="clicked" handler="On_Dialog_Cancelled" last_modification_time="Thu, 06 Nov 2008 13:39:44 GMT"/>
</widget>
</child>
</widget>
@ -1637,7 +1637,7 @@ Configure them here.&lt;/b&gt;</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<signal name="clicked" handler="OnMemWrite32_Cancel"/>
<signal name="clicked" handler="On_Dialog_Cancelled" last_modification_time="Thu, 06 Nov 2008 13:39:59 GMT"/>
</widget>
</child>
</widget>
@ -1787,7 +1787,7 @@ Configure them here.&lt;/b&gt;</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<signal name="clicked" handler="OnArguments_Cancel"/>
<signal name="clicked" handler="On_Dialog_Cancelled" last_modification_time="Thu, 06 Nov 2008 13:40:09 GMT"/>
</widget>
</child>
</widget>
@ -2605,7 +2605,7 @@ Configure them here.&lt;/b&gt;</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<signal name="clicked" handler="OnLogging_Cancel"/>
<signal name="clicked" handler="On_Dialog_Cancelled" last_modification_time="Thu, 06 Nov 2008 13:40:22 GMT"/>
</widget>
</child>
</widget>
@ -2837,7 +2837,7 @@ Configure them here.&lt;/b&gt;</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<signal name="clicked" handler="OnDumpR_Cancel"/>
<signal name="clicked" handler="On_Dialog_Cancelled" last_modification_time="Thu, 06 Nov 2008 13:40:34 GMT"/>
</widget>
</child>
</widget>
@ -3069,7 +3069,7 @@ Configure them here.&lt;/b&gt;</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<signal name="clicked" handler="OnDumpC_Cancel"/>
<signal name="clicked" handler="On_Dialog_Cancelled" last_modification_time="Thu, 06 Nov 2008 13:40:48 GMT"/>
</widget>
</child>
</widget>
@ -3218,7 +3218,7 @@ Configure them here.&lt;/b&gt;</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<signal name="clicked" handler="OnSetBPC_Cancel"/>
<signal name="clicked" handler="On_Dialog_Cancelled" last_modification_time="Thu, 06 Nov 2008 13:41:07 GMT"/>
</widget>
</child>
</widget>
@ -3516,7 +3516,7 @@ Configure them here.&lt;/b&gt;</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<signal name="clicked" handler="OnSetPC_Cancel"/>
<signal name="clicked" handler="On_Dialog_Cancelled" last_modification_time="Thu, 06 Nov 2008 13:41:00 GMT"/>
</widget>
</child>
</widget>
@ -3890,30 +3890,6 @@ Configure them here.&lt;/b&gt;</property>
<signal name="clicked" handler="OnDebug_memWrite32"/>
</widget>
</child>
<child>
<widget class="GtkButton" id="button69">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">button69</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
</widget>
</child>
<child>
<widget class="GtkButton" id="button70">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">button70</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
@ -4480,7 +4456,7 @@ Configure them here.&lt;/b&gt;</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<signal name="clicked" handler="OnCpu_Cancel"/>
<signal name="clicked" handler="On_Dialog_Cancelled" last_modification_time="Thu, 06 Nov 2008 13:41:37 GMT"/>
</widget>
</child>
</widget>
@ -5430,7 +5406,7 @@ Configure them here.&lt;/b&gt;</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<signal name="clicked" handler="OnConfConf_Cancel"/>
<signal name="clicked" handler="On_Dialog_Cancelled" last_modification_time="Thu, 06 Nov 2008 13:41:53 GMT"/>
</widget>
</child>
</widget>