diff --git a/thunar/thunar-preferences-dialog.c b/thunar/thunar-preferences-dialog.c index dc12bec776b5012fd5ac6d25dbd5cab1217649c8..a87d10dfc03fd07c984372c650ecfc2d1779f734 100644 --- a/thunar/thunar-preferences-dialog.c +++ b/thunar/thunar-preferences-dialog.c @@ -678,19 +678,42 @@ thunar_preferences_dialog_init (ThunarPreferencesDialog *dialog) grid = gtk_grid_new (); gtk_grid_set_column_spacing (GTK_GRID (grid), 12); - gtk_grid_set_row_spacing (GTK_GRID (grid), 2); - gtk_container_set_border_width (GTK_CONTAINER (grid), 12); + gtk_grid_set_row_spacing (GTK_GRID (grid), 6); + gtk_widget_set_margin_top (GTK_WIDGET (grid), 6); + gtk_widget_set_margin_start (GTK_WIDGET (grid), 12); gtk_container_add (GTK_CONTAINER (frame), grid); gtk_widget_show (grid); button = gtk_check_button_new_with_mnemonic (_("Show action to permanently delete files and folders")); exo_mutual_binding_new (G_OBJECT (dialog->preferences), "misc-show-delete-action", G_OBJECT (button), "active"); gtk_widget_set_tooltip_text (button, _("Select this option to show the 'Delete' action in the context menu")); - gtk_widget_set_hexpand (button, TRUE); gtk_grid_attach (GTK_GRID (grid), button, 0, 0, 1, 1); gtk_widget_show (button); } + frame = g_object_new (GTK_TYPE_FRAME, "border-width", 0, "shadow-type", GTK_SHADOW_NONE, NULL); + gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, TRUE, 0); + gtk_widget_show (frame); + + label = gtk_label_new (_("Window icon")); + gtk_label_set_attributes (GTK_LABEL (label), thunar_pango_attr_list_bold ()); + gtk_frame_set_label_widget (GTK_FRAME (frame), label); + gtk_widget_show (label); + + grid = gtk_grid_new (); + gtk_grid_set_column_spacing (GTK_GRID (grid), 12); + gtk_grid_set_row_spacing (GTK_GRID (grid), 6); + gtk_widget_set_margin_top (GTK_WIDGET (grid), 6); + gtk_widget_set_margin_start (GTK_WIDGET (grid), 12); + gtk_container_add (GTK_CONTAINER (frame), grid); + gtk_widget_show (grid); + + button = gtk_check_button_new_with_mnemonic (_("Use current folder icon")); + exo_mutual_binding_new (G_OBJECT (dialog->preferences), "misc-change-window-icon", G_OBJECT (button), "active"); + gtk_widget_set_tooltip_text (button, _("Select this option to use the current folder icon as window icon")); + gtk_grid_attach (GTK_GRID (grid), button, 0, 0, 1, 1); + gtk_widget_show (button); + /* Advanced */ diff --git a/thunar/thunar-preferences.c b/thunar/thunar-preferences.c index 78c996956b524b9227ace6bdeaf078ba120e065e..732d9a2d63a0efc094635b3137133af4cf534c90 100644 --- a/thunar/thunar-preferences.c +++ b/thunar/thunar-preferences.c @@ -773,7 +773,7 @@ thunar_preferences_class_init (ThunarPreferencesClass *klass) g_param_spec_boolean ("misc-change-window-icon", "MiscChangeWindowIcon", NULL, - FALSE, + TRUE, EXO_PARAM_READWRITE); /** diff --git a/thunar/thunar-window.c b/thunar/thunar-window.c index 0c46c38130711cf602b3a3f32ff1f42cb7a08e8d..71ffae01fb9cabc5704ddbc3c56356ab14e603ed 100644 --- a/thunar/thunar-window.c +++ b/thunar/thunar-window.c @@ -255,6 +255,7 @@ static gboolean thunar_window_save_geometry_timer (gpointer static void thunar_window_save_geometry_timer_destroy (gpointer user_data); static void thunar_window_set_zoom_level (ThunarWindow *window, ThunarZoomLevel zoom_level); +static void thunar_window_update_window_icon (ThunarWindow *window); @@ -962,6 +963,9 @@ G_GNUC_END_IGNORE_DEPRECATIONS g_signal_connect_object (G_OBJECT (window->preferences), "notify::last-location-bar", G_CALLBACK (thunar_window_update_location_bar_visible), window, G_CONNECT_SWAPPED); thunar_window_update_location_bar_visible (window); + /* update window icon whenever preferences change */ + g_signal_connect_object (G_OBJECT (window->preferences), "notify::misc-change-window-icon", G_CALLBACK (thunar_window_update_window_icon), window, G_CONNECT_SWAPPED); + /* determine the selected side pane (FIXME: Should probably be last-shortcuts-visible and last-tree-visible preferences) */ if (exo_str_is_equal (last_side_pane, g_type_name (THUNAR_TYPE_SHORTCUTS_PANE))) type = THUNAR_TYPE_SHORTCUTS_PANE; @@ -2009,6 +2013,28 @@ thunar_window_update_location_bar_visible (ThunarWindow *window) +static void +thunar_window_update_window_icon (ThunarWindow *window) +{ + gboolean change_window_icon; + GtkIconTheme *icon_theme; + const gchar *icon_name = "folder"; + + g_object_get (window->preferences, "misc-change-window-icon", &change_window_icon, NULL); + + if (change_window_icon) + { + icon_theme = gtk_icon_theme_get_for_screen (gtk_window_get_screen (GTK_WINDOW (window))); + icon_name = thunar_file_get_icon_name (window->current_directory, + THUNAR_FILE_ICON_STATE_DEFAULT, + icon_theme); + } + + gtk_window_set_icon_name (GTK_WINDOW (window), icon_name); +} + + + static void thunar_window_handle_reload_request (ThunarWindow *window) { @@ -3421,12 +3447,9 @@ static void thunar_window_current_directory_changed (ThunarFile *current_directory, ThunarWindow *window) { - GtkIconTheme *icon_theme; GtkAction *action; - const gchar *icon_name; gchar *title; gboolean show_full_path; - gboolean change_window_icon; gchar *parse_name = NULL; const gchar *name; @@ -3455,14 +3478,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS g_free (parse_name); /* set window icon */ - icon_theme = gtk_icon_theme_get_for_screen (gtk_window_get_screen (GTK_WINDOW (window))); - icon_name = thunar_file_get_icon_name (current_directory, - THUNAR_FILE_ICON_STATE_DEFAULT, - icon_theme); - - 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); + thunar_window_update_window_icon (window); }