From 1c696b75425887ef1963b3e11e08d3a82056abda Mon Sep 17 00:00:00 2001 From: Yousuf Philips Date: Fri, 6 Mar 2020 23:05:31 +0400 Subject: [PATCH] Xfconf setting whether to change the window icon (bug #16501) By default the window icon wont change and if this default behaviour is not wanted then it can be changed with thunar's misc-change-window-icon xfconf setting --- thunar/thunar-list-model.c | 13 +++++++++++++ thunar/thunar-preferences.c | 13 +++++++++++++ thunar/thunar-window.c | 6 +++++- 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/thunar/thunar-list-model.c b/thunar/thunar-list-model.c index 5017f276..ff21e335 100644 --- a/thunar/thunar-list-model.c +++ b/thunar/thunar-list-model.c @@ -52,6 +52,7 @@ enum PROP_NUM_FILES, PROP_SHOW_HIDDEN, PROP_FILE_SIZE_BINARY, + PROP_WINDOW_ICON, N_PROPERTIES }; @@ -363,6 +364,18 @@ thunar_list_model_class_init (ThunarListModelClass *klass) TRUE, EXO_PARAM_READWRITE); + /** + * ThunarListModel::misc-file-size-binary: + * + * Tells whether to format file size in binary. + **/ + list_model_props[PROP_WINDOW_ICON] = + g_param_spec_boolean ("window-icon", + "window-icon", + "window-icon", + TRUE, + EXO_PARAM_READWRITE); + /* install properties */ g_object_class_install_properties (gobject_class, N_PROPERTIES, list_model_props); diff --git a/thunar/thunar-preferences.c b/thunar/thunar-preferences.c index ba1efd45..78c99695 100644 --- a/thunar/thunar-preferences.c +++ b/thunar/thunar-preferences.c @@ -97,6 +97,7 @@ enum PROP_MISC_THUMBNAIL_DRAW_FRAMES, PROP_MISC_FILE_SIZE_BINARY, PROP_MISC_CONFIRM_CLOSE_MULTIPLE_TABS, + PROP_MISC_WINDOW_ICON, PROP_SHORTCUTS_ICON_EMBLEMS, PROP_SHORTCUTS_ICON_SIZE, PROP_TREE_ICON_EMBLEMS, @@ -763,6 +764,18 @@ thunar_preferences_class_init (ThunarPreferencesClass *klass) TRUE, EXO_PARAM_READWRITE); + /** + * ThunarPreferences:misc-change-window-icon: + * + * Whether to change the window icon to the folder's icon. + **/ + preferences_props[PROP_MISC_WINDOW_ICON] = + g_param_spec_boolean ("misc-change-window-icon", + "MiscChangeWindowIcon", + NULL, + FALSE, + EXO_PARAM_READWRITE); + /** * ThunarPreferences:misc-confirm-close-multiple-tabs: * diff --git a/thunar/thunar-window.c b/thunar/thunar-window.c index 11e2be97..f42df36b 100644 --- a/thunar/thunar-window.c +++ b/thunar/thunar-window.c @@ -3426,6 +3426,7 @@ thunar_window_current_directory_changed (ThunarFile *current_directory, const gchar *icon_name; gchar *title; gboolean show_full_path; + gboolean change_window_icon; gchar *parse_name = NULL; const gchar *name; @@ -3458,7 +3459,10 @@ G_GNUC_END_IGNORE_DEPRECATIONS icon_name = thunar_file_get_icon_name (current_directory, THUNAR_FILE_ICON_STATE_DEFAULT, icon_theme); - gtk_window_set_icon_name (GTK_WINDOW (window), icon_name); + + g_object_get (G_OBJECT (window->preferences), "misc-change-window-icon", &change_window_icon, NULL); + if (G_UNLIKELY (change_window_icon)) + gtk_window_set_icon_name (GTK_WINDOW (window), icon_name); } -- 2.20.1