From eabfcb71be1bbe061a6657307b2ed46b836a9703 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Sat, 29 Aug 2020 12:39:03 +0200 Subject: [PATCH] GTK: Replace deprecated GtkVBox/GtkHBox with GtkBox --- desmume/src/frontend/posix/gtk/cheatsGTK.cpp | 26 +++++++++---------- desmume/src/frontend/posix/gtk/main.cpp | 16 ++++++------ .../frontend/posix/gtk/tools/ioregsView.cpp | 24 ++++++++--------- 3 files changed, 33 insertions(+), 33 deletions(-) diff --git a/desmume/src/frontend/posix/gtk/cheatsGTK.cpp b/desmume/src/frontend/posix/gtk/cheatsGTK.cpp index 6045bdfdb..6b82ce6bf 100644 --- a/desmume/src/frontend/posix/gtk/cheatsGTK.cpp +++ b/desmume/src/frontend/posix/gtk/cheatsGTK.cpp @@ -305,13 +305,13 @@ static GtkWidget *cheat_list_create_ui() { GtkListStore *store = cheat_list_populate(); GtkWidget *tree = gtk_tree_view_new_with_model (GTK_TREE_MODEL (store)); - GtkWidget *vbox = gtk_vbox_new(FALSE, 1); + GtkWidget *box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 1); GtkWidget *hbbox = gtk_hbutton_box_new(); GtkWidget *button; - gtk_container_add(GTK_CONTAINER(vbox), GTK_WIDGET(tree)); - gtk_container_add(GTK_CONTAINER(vbox), GTK_WIDGET(hbbox)); - gtk_container_add(GTK_CONTAINER(win), GTK_WIDGET(vbox)); + gtk_container_add(GTK_CONTAINER(box), GTK_WIDGET(tree)); + gtk_container_add(GTK_CONTAINER(box), GTK_WIDGET(hbbox)); + gtk_container_add(GTK_CONTAINER(win), GTK_WIDGET(box)); button = gtk_button_new_with_label("add cheat"); g_signal_connect (button, "clicked", G_CALLBACK (cheat_list_add_cheat), store); @@ -352,15 +352,15 @@ void CheatList () static void cheat_search_create_ui() { GtkWidget *button; - GtkWidget *vbox = gtk_vbox_new(FALSE, 1); + GtkWidget *box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 1); GtkWidget *hbbox = gtk_hbutton_box_new(); GtkWidget *b; - gtk_container_add(GTK_CONTAINER(win), GTK_WIDGET(vbox)); + gtk_container_add(GTK_CONTAINER(win), GTK_WIDGET(box)); { - b = gtk_hbox_new(FALSE, 1); - gtk_container_add(GTK_CONTAINER(vbox), GTK_WIDGET(b)); + b = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 1); + gtk_container_add(GTK_CONTAINER(box), GTK_WIDGET(b)); { GtkTreeModel * size_model; @@ -381,8 +381,8 @@ static void cheat_search_create_ui() gtk_container_add(GTK_CONTAINER(b), w); } - b = gtk_hbox_new(FALSE, 1); - gtk_container_add(GTK_CONTAINER(vbox), GTK_WIDGET(b)); + b = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 1); + gtk_container_add(GTK_CONTAINER(box), GTK_WIDGET(b)); { GtkWidget *w; @@ -407,7 +407,7 @@ static void cheat_search_create_ui() // BUTTONS: - gtk_container_add(GTK_CONTAINER(vbox), GTK_WIDGET(hbbox)); + gtk_container_add(GTK_CONTAINER(box), GTK_WIDGET(hbbox)); button = gtk_button_new_with_label("add cheats"); // g_signal_connect (button, "clicked", g_callback (cheat_list_add_cheat), store); @@ -417,8 +417,8 @@ static void cheat_search_create_ui() // g_signal_connect (button, "clicked", g_callback (cheat_list_add_cheat), store); gtk_container_add(GTK_CONTAINER(hbbox),button); -// GtkWidget *vbox = gtk_vbox_new(FALSE, 1); -// gtk_container_add(GTK_CONTAINER(win), GTK_WIDGET(vbox)); +// GtkWidget *box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 1); +// gtk_container_add(GTK_CONTAINER(win), GTK_WIDGET(box)); } static void cheatSearchEnd() diff --git a/desmume/src/frontend/posix/gtk/main.cpp b/desmume/src/frontend/posix/gtk/main.cpp index e68ba72b2..d1c3fec09 100644 --- a/desmume/src/frontend/posix/gtk/main.cpp +++ b/desmume/src/frontend/posix/gtk/main.cpp @@ -3119,7 +3119,7 @@ common_gtk_main( class configured_features *my_config) SDL_TimerID limiter_timer = NULL; GtkAccelGroup * accel_group; - GtkWidget *pVBox; + GtkWidget *pBox; GtkWidget *pMenuBar; GtkWidget *pToolBar; @@ -3270,9 +3270,9 @@ common_gtk_main( class configured_features *my_config) g_signal_connect(G_OBJECT(pWindow), "key_press_event", G_CALLBACK(Key_Press), NULL); g_signal_connect(G_OBJECT(pWindow), "key_release_event", G_CALLBACK(Key_Release), NULL); - /* Create the GtkVBox */ - pVBox = gtk_vbox_new(FALSE, 0); - gtk_container_add(GTK_CONTAINER(pWindow), pVBox); + /* Create the GtkBox */ + pBox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); + gtk_container_add(GTK_CONTAINER(pWindow), pBox); ui_manager = gtk_ui_manager_new (); accel_group = gtk_accel_group_new(); @@ -3401,9 +3401,9 @@ common_gtk_main( class configured_features *my_config) desmume_try_adding_ui(ui_manager, ui_description); pMenuBar = gtk_ui_manager_get_widget (ui_manager, "/MainMenu"); - gtk_box_pack_start (GTK_BOX (pVBox), pMenuBar, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX(pBox), pMenuBar, FALSE, FALSE, 0); pToolBar = gtk_ui_manager_get_widget (ui_manager, "/ToolBar"); - gtk_box_pack_start (GTK_BOX(pVBox), pToolBar, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX(pBox), pToolBar, FALSE, FALSE, 0); { GtkWidget * recentMenu = gtk_ui_manager_get_widget (ui_manager, "/MainMenu/FileMenu/RecentMenu"); @@ -3421,7 +3421,7 @@ common_gtk_main( class configured_features *my_config) /* This toggle action must not be set active before the pDrawingArea initialization to avoid a GTK warning */ gtk_toggle_action_set_active((GtkToggleAction*)gtk_action_group_get_action(action_group, "gap"), config.view_gap); - gtk_container_add (GTK_CONTAINER (pVBox), pDrawingArea); + gtk_container_add (GTK_CONTAINER(pBox), pDrawingArea); gtk_widget_set_events(pDrawingArea, GDK_EXPOSURE_MASK | GDK_LEAVE_NOTIFY_MASK | @@ -3442,7 +3442,7 @@ common_gtk_main( class configured_features *my_config) /* Status bar */ pStatusBar = gtk_statusbar_new(); UpdateStatusBar(EMU_DESMUME_NAME_AND_VERSION()); - gtk_box_pack_end(GTK_BOX(pVBox), pStatusBar, FALSE, FALSE, 0); + gtk_box_pack_end(GTK_BOX(pBox), pStatusBar, FALSE, FALSE, 0); gtk_widget_show_all(pWindow); diff --git a/desmume/src/frontend/posix/gtk/tools/ioregsView.cpp b/desmume/src/frontend/posix/gtk/tools/ioregsView.cpp index c338470c4..f54249aa5 100644 --- a/desmume/src/frontend/posix/gtk/tools/ioregsView.cpp +++ b/desmume/src/frontend/posix/gtk/tools/ioregsView.cpp @@ -41,7 +41,7 @@ BOOL CPUS [2] = {TRUE, TRUE}; static GtkWidget *mWin[2]; -static GtkWidget *mVbox0[2]; +static GtkWidget *mBox0[2]; static GtkWidget *mIoRegCombo[2]; static GtkWidget *mRegInfos[2]; @@ -68,11 +68,11 @@ static reg_t *current_reg[2] = {NULL, NULL}; char _bit_check_buf[64]; \ snprintf(_bit_check_buf, ARRAY_SIZE(_bit_check_buf), "Bit %d: %s", n,s); \ _wl_[w] = gtk_check_button_new_with_label(_bit_check_buf ); \ - gtk_box_pack_start(GTK_BOX(mVbox0[c]), _wl_[w], FALSE, FALSE, 0); } + gtk_box_pack_start(GTK_BOX(mBox0[c]), _wl_[w], FALSE, FALSE, 0); } #define BIT_COMBO(w,n,s) { \ - _wl_[w] = gtk_hbox_new(FALSE, 0); \ - gtk_box_pack_start(GTK_BOX(mVbox0[c]), _wl_[w], FALSE, FALSE, 0); } \ + _wl_[w] = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); \ + gtk_box_pack_start(GTK_BOX(mBox0[c]), _wl_[w], FALSE, FALSE, 0); } \ char _bit_combo_buf[64]; \ snprintf(_bit_combo_buf, ARRAY_SIZE(_bit_combo_buf), "Bits %s: %s", n,s); \ GtkWidget *__combo_lbl_tmp = gtk_label_new(_bit_combo_buf); \ @@ -380,11 +380,11 @@ static void selected_reg(GtkWidget* widget, gpointer data) guint active = gtk_combo_box_get_active(GTK_COMBO_BOX(widget)); if(current_reg[c]) current_reg[c]->destroy(c); - gtk_container_foreach(GTK_CONTAINER(mVbox0[c]), _clearContainer, (gpointer)mVbox0[c]); + gtk_container_foreach(GTK_CONTAINER(mBox0[c]), _clearContainer, (gpointer)mBox0[c]); current_reg[c] = (reg_t*)&(GET_REG_LIST(c)[active]); -// gtk_box_pack_start(GTK_BOX(mVbox0[c]), mIoRegCombo[c], FALSE, FALSE, 0); +// gtk_box_pack_start(GTK_BOX(mBox0[c]), mIoRegCombo[c], FALSE, FALSE, 0); switch (current_reg[c]->size) { case BITS_8: @@ -396,7 +396,7 @@ static void selected_reg(GtkWidget* widget, gpointer data) default: regInfosBuffer = g_strdup_printf("0x%08X", current_reg[c]->value(c)); } -// gtk_box_pack_start(GTK_BOX(mVbox0[c]), mRegInfos[c], FALSE, FALSE, 0); +// gtk_box_pack_start(GTK_BOX(mBox0[c]), mRegInfos[c], FALSE, FALSE, 0); gtk_label_set_label(GTK_LABEL(mRegInfos[c]), regInfosBuffer); g_free(regInfosBuffer); @@ -424,7 +424,7 @@ static void _closeOne(GtkWidget *widget, gpointer data) gtk_widget_destroy(mRegInfos[c]); gtk_widget_destroy(mIoRegCombo[c]); - gtk_widget_destroy(mVbox0[c]); + gtk_widget_destroy(mBox0[c]); // gtk_widget_destroy(mWin[c]); } @@ -454,8 +454,8 @@ static void open(int ID) else gtk_window_set_title(GTK_WINDOW(mWin[c]), TOOL_NAME " : ARM7"); g_signal_connect(G_OBJECT(mWin[c]), "destroy", G_CALLBACK(&_closeOne), GINT_TO_POINTER(c)); - mVbox0[c] = gtk_vbox_new(FALSE, 0); - gtk_container_add(GTK_CONTAINER(mWin[c]), mVbox0[c]); + mBox0[c] = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); + gtk_container_add(GTK_CONTAINER(mWin[c]), mBox0[c]); mIoRegCombo[c] = gtk_combo_box_text_new(); mRegInfos[c] = gtk_label_new(""); @@ -471,8 +471,8 @@ static void open(int ID) gtk_combo_box_set_active(GTK_COMBO_BOX(mIoRegCombo[c]), 0); g_signal_connect(G_OBJECT(mIoRegCombo[c]), "changed", G_CALLBACK(selected_reg), GINT_TO_POINTER(c)); - gtk_box_pack_start(GTK_BOX(mVbox0[c]), mIoRegCombo[c], FALSE, FALSE, 0); - gtk_box_pack_start(GTK_BOX(mVbox0[c]), mRegInfos[c], FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(mBox0[c]), mIoRegCombo[c], FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(mBox0[c]), mRegInfos[c], FALSE, FALSE, 0); selected_reg(mIoRegCombo[c], GINT_TO_POINTER(c)); gtk_widget_show_all(mWin[c]);