From 6ba744dea2fdb49f5ed729f0e4a28a09f16ec8bd Mon Sep 17 00:00:00 2001 From: arcum42 Date: Thu, 6 Nov 2008 14:10:19 +0000 Subject: [PATCH] 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 --- pcsx2/Linux/ConfigDlg.cpp | 7 ------ pcsx2/Linux/GtkGui.cpp | 44 +++++++---------------------------- pcsx2/Linux/callbacks.h | 46 +------------------------------------ pcsx2/Linux/interface.c | 38 ++++++++++--------------------- pcsx2/Linux/pcsx2.glade | 48 ++++++++++----------------------------- 5 files changed, 33 insertions(+), 150 deletions(-) diff --git a/pcsx2/Linux/ConfigDlg.cpp b/pcsx2/Linux/ConfigDlg.cpp index 9e1e4466c6..e6a57b8d39 100644 --- a/pcsx2/Linux/ConfigDlg.cpp +++ b/pcsx2/Linux/ConfigDlg.cpp @@ -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"); } diff --git a/pcsx2/Linux/GtkGui.cpp b/pcsx2/Linux/GtkGui.cpp index 700705c53c..c716772a98 100644 --- a/pcsx2/Linux/GtkGui.cpp +++ b/pcsx2/Linux/GtkGui.cpp @@ -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; diff --git a/pcsx2/Linux/callbacks.h b/pcsx2/Linux/callbacks.h index 690406fe31..5d44c235b1 100644 --- a/pcsx2/Linux/callbacks.h +++ b/pcsx2/Linux/callbacks.h @@ -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); diff --git a/pcsx2/Linux/interface.c b/pcsx2/Linux/interface.c index 1ce5592c13..c7ce4c9e5e 100644 --- a/pcsx2/Linux/interface.c +++ b/pcsx2/Linux/interface.c @@ -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(). */ diff --git a/pcsx2/Linux/pcsx2.glade b/pcsx2/Linux/pcsx2.glade index 9b71272d9d..cc52a82532 100644 --- a/pcsx2/Linux/pcsx2.glade +++ b/pcsx2/Linux/pcsx2.glade @@ -69,7 +69,7 @@ GTK_RELIEF_NORMAL True -6 - + @@ -647,7 +647,7 @@ GTK_RELIEF_NORMAL True -6 - + @@ -1268,7 +1268,7 @@ Enabled (Helps SPS, Slow) GTK_RELIEF_NORMAL True -6 - + @@ -1637,7 +1637,7 @@ Configure them here.</b> True GTK_RELIEF_NORMAL True - + @@ -1787,7 +1787,7 @@ Configure them here.</b> True GTK_RELIEF_NORMAL True - + @@ -2605,7 +2605,7 @@ Configure them here.</b> True GTK_RELIEF_NORMAL True - + @@ -2837,7 +2837,7 @@ Configure them here.</b> True GTK_RELIEF_NORMAL True - + @@ -3069,7 +3069,7 @@ Configure them here.</b> True GTK_RELIEF_NORMAL True - + @@ -3218,7 +3218,7 @@ Configure them here.</b> True GTK_RELIEF_NORMAL True - + @@ -3516,7 +3516,7 @@ Configure them here.</b> True GTK_RELIEF_NORMAL True - + @@ -3890,30 +3890,6 @@ Configure them here.</b> - - - - True - True - True - button69 - True - GTK_RELIEF_NORMAL - True - - - - - - True - True - True - button70 - True - GTK_RELIEF_NORMAL - True - - 0 @@ -4480,7 +4456,7 @@ Configure them here.</b> True GTK_RELIEF_NORMAL True - + @@ -5430,7 +5406,7 @@ Configure them here.</b> True GTK_RELIEF_NORMAL True - +