From 76b53dc2984db2f99a8b77fb8aa5eb6ce7a15c34 Mon Sep 17 00:00:00 2001 From: Dino Date: Sun, 14 Sep 2025 16:47:49 -0400 Subject: [PATCH] #1630 gtk3.22: add Game menu items Volume Up '>' & Volume Down '<' --- client/gui-gtk-3.22/menu.c | 30 ++++++++++++++++++++++++++++++ data/gtk3.22_menus.xml | 12 ++++++++++++ 2 files changed, 42 insertions(+) diff --git a/client/gui-gtk-3.22/menu.c b/client/gui-gtk-3.22/menu.c index 2fb9ff2dd0..5313caf470 100644 --- a/client/gui-gtk-3.22/menu.c +++ b/client/gui-gtk-3.22/menu.c @@ -118,6 +118,8 @@ static void find_city_callback(GtkMenuItem *item, gpointer data); static void worklists_callback(GtkMenuItem *item, gpointer data); static void client_lua_script_callback(GtkMenuItem *item, gpointer data); static void leave_callback(GtkMenuItem *item, gpointer data); +static void volume_up_callback(GtkMenuItem *item, gpointer data); +static void volume_down_callback(GtkMenuItem *item, gpointer data); static void quit_callback(GtkMenuItem *item, gpointer data); static void map_view_callback(GtkMenuItem *item, gpointer data); static void report_units_callback(GtkMenuItem *item, gpointer data); @@ -301,6 +303,10 @@ static struct menu_entry_info menu_entries[] = { "MAPIMG_SAVE_AS", N_("Save _Map Image As..."), 0, 0, G_CALLBACK(save_mapimg_as_callback), MGROUP_SAFE }, { "LEAVE", N_("_Leave"), 0, 0, G_CALLBACK(leave_callback), MGROUP_SAFE }, + { "VOLUME_UP", N_("_Volume Up"), GDK_KEY_greater, 0, + G_CALLBACK(volume_up_callback), MGROUP_SAFE }, + { "VOLUME_DOWN", N_("_Volume Down"), GDK_KEY_less, 0, + G_CALLBACK(volume_down_callback), MGROUP_SAFE }, { "QUIT", N_("_Quit"), GDK_KEY_q, ACCL_MOD_KEY, G_CALLBACK(quit_callback), MGROUP_SAFE }, { "FIND_CITY", N_("_Find City"), GDK_KEY_f, ACCL_MOD_KEY, @@ -743,6 +749,30 @@ static void leave_callback(GtkMenuItem *item, gpointer data) } } +/************************************************************************//** + Item "VOLUME_UP" callback. +****************************************************************************/ +static void volume_up_callback(GtkMenuItem *item, gpointer data) +{ + struct option *poption = optset_option_by_name(client_optset, "sound_effects_volume"); + + gui_options.sound_effects_volume += 10; + gui_options.sound_effects_volume = CLIP(0, gui_options.sound_effects_volume, 100); + option_changed(poption); +} + +/************************************************************************//** + Item "VOLUME_DOWN" callback. +****************************************************************************/ +static void volume_down_callback(GtkMenuItem *item, gpointer data) +{ + struct option *poption = optset_option_by_name(client_optset, "sound_effects_volume"); + + gui_options.sound_effects_volume -= 10; + gui_options.sound_effects_volume = CLIP(0, gui_options.sound_effects_volume, 100); + option_changed(poption); +} + /************************************************************************//** Item "QUIT" callback. ****************************************************************************/ diff --git a/data/gtk3.22_menus.xml b/data/gtk3.22_menus.xml index 6f53bc91f6..97b271be46 100644 --- a/data/gtk3.22_menus.xml +++ b/data/gtk3.22_menus.xml @@ -57,6 +57,18 @@ + + + + + + + + + + + + -- 2.31.0