diff options
author | Nik Soggia <[email protected]> | 2023-02-11 11:08:06 +0100 |
---|---|---|
committer | Luke from DC <[email protected]> | 2023-02-14 01:16:15 +0000 |
commit | e504576092e499bdc5ecb14fc8b99db74ee9382d (patch) | |
tree | a0e249c25185ebf1025614c5922f0431f868fe2f /applets/wncklet/window-list.c | |
parent | efa34110e4c40950650bf035152d7f94ec2ba89e (diff) | |
download | mate-panel-e504576092e499bdc5ecb14fc8b99db74ee9382d.tar.bz2 mate-panel-e504576092e499bdc5ecb14fc8b99db74ee9382d.tar.xz |
Update window-list.c
Fix for "no option to disable middle-click to close in window list"
https://github.com/mate-desktop/mate-panel/issues/962#issuecomment-1418934577
Diffstat (limited to 'applets/wncklet/window-list.c')
-rw-r--r-- | applets/wncklet/window-list.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/applets/wncklet/window-list.c b/applets/wncklet/window-list.c index 85c305d4..a87649b1 100644 --- a/applets/wncklet/window-list.c +++ b/applets/wncklet/window-list.c @@ -63,6 +63,7 @@ typedef struct { TasklistGroupingType grouping; gboolean move_unminimized_windows; gboolean scroll_enable; + gboolean middle_click_close; GtkOrientation orientation; int size; @@ -88,6 +89,7 @@ typedef struct { GtkWidget* always_group_radio; GtkWidget* move_minimized_radio; GtkWidget* mouse_scroll_check; + GtkWidget* middle_click_close_check; GtkWidget* change_workspace_radio; GtkWidget* minimized_windows_box; GtkWidget* window_grouping_box; @@ -138,6 +140,7 @@ static void tasklist_update(TasklistData* tasklist) wnck_tasklist_set_include_all_workspaces(WNCK_TASKLIST(tasklist->tasklist), tasklist->include_all_workspaces); wnck_tasklist_set_switch_workspace_on_unminimize(WNCK_TASKLIST(tasklist->tasklist), tasklist->move_unminimized_windows); wnck_tasklist_set_scroll_enabled (WNCK_TASKLIST(tasklist->tasklist), tasklist->scroll_enable); + wnck_tasklist_set_middle_click_close (WNCK_TASKLIST (tasklist->tasklist), tasklist->middle_click_close); } #endif /* HAVE_X11 */ @@ -700,6 +703,12 @@ static void scroll_enabled_changed (GSettings* settings, gchar* key, TasklistDat tasklist_update(tasklist); } +static void middle_click_close_changed (GSettings* settings, gchar* key, TasklistData* tasklist) +{ + tasklist->middle_click_close = g_settings_get_boolean (settings, key); + tasklist_update(tasklist); +} + static void setup_gsettings(TasklistData* tasklist) { tasklist->settings = mate_panel_applet_settings_new (MATE_PANEL_APPLET (tasklist->applet), WINDOW_LIST_SCHEMA); @@ -734,6 +743,10 @@ static void setup_gsettings(TasklistData* tasklist) "changed::scroll-enabled", G_CALLBACK (scroll_enabled_changed), tasklist); + g_signal_connect (tasklist->settings, + "changed::middle-click-close", + G_CALLBACK (middle_click_close_changed), + tasklist); } static void applet_size_allocate(GtkWidget *widget, GtkAllocation *allocation, TasklistData *tasklist) @@ -859,6 +872,8 @@ gboolean window_list_applet_fill(MatePanelApplet* applet) tasklist->scroll_enable = g_settings_get_boolean (tasklist->settings, "scroll-enabled"); + tasklist->middle_click_close = g_settings_get_boolean (tasklist->settings, "middle-click-close"); + tasklist->size = mate_panel_applet_get_size(applet); #if !defined(WNCKLET_INPROCESS) && !GTK_CHECK_VERSION (3, 23, 0) @@ -883,7 +898,6 @@ gboolean window_list_applet_fill(MatePanelApplet* applet) { tasklist->tasklist = wnck_tasklist_new(); - wnck_tasklist_set_middle_click_close (WNCK_TASKLIST (tasklist->tasklist), TRUE); wnck_tasklist_set_icon_loader(WNCK_TASKLIST(tasklist->tasklist), icon_loader_func, tasklist, NULL); #ifdef HAVE_WINDOW_PREVIEWS @@ -1153,6 +1167,7 @@ static void setup_dialog(GtkBuilder* builder, TasklistData* tasklist) tasklist->move_minimized_radio = WID("move_minimized_radio"); tasklist->change_workspace_radio = WID("change_workspace_radio"); tasklist->mouse_scroll_check = WID("mouse_scroll_check"); + tasklist->middle_click_close_check = WID("middle_click_close_check"); tasklist->minimized_windows_box = WID("minimized_windows_box"); tasklist->window_grouping_box = WID("window_grouping_box"); tasklist->window_list_content_box = WID("window_list_content_box"); @@ -1183,6 +1198,13 @@ static void setup_dialog(GtkBuilder* builder, TasklistData* tasklist) "active", G_SETTINGS_BIND_DEFAULT); + /* Middle mouse click to close window: */ + g_settings_bind (tasklist->settings, + "middle-click-close", + tasklist->middle_click_close_check, + "active", + G_SETTINGS_BIND_DEFAULT); + #ifdef HAVE_WINDOW_PREVIEWS /* change thumbnail size: */ tasklist_update_thumbnail_size_spin(tasklist); |