summaryrefslogtreecommitdiff
path: root/thunar
diff options
context:
space:
mode:
authorAlexander Schwinn <alexxcons@xfce.org>2021-11-09 23:07:19 +0100
committerAlexander Schwinn <alexxcons@xfce.org>2021-11-09 23:07:19 +0100
commit4cae394d621a03e955f08dc3269369ec6df96b74 (patch)
tree5c7f610bf02818af6950dfa8e4584a7ebc794856 /thunar
parent8b9f665c66d068b9ceeb02c74a9467175625c1db (diff)
downloadthunar-4cae394d621a03e955f08dc3269369ec6df96b74.tar.gz
'New file' dialog: Dont highlight extension for templates (Issue #676)
Diffstat (limited to 'thunar')
-rw-r--r--thunar/thunar-dialogs.c33
1 files changed, 16 insertions, 17 deletions
diff --git a/thunar/thunar-dialogs.c b/thunar/thunar-dialogs.c
index ce39a44d..cbc73715 100644
--- a/thunar/thunar-dialogs.c
+++ b/thunar/thunar-dialogs.c
@@ -46,8 +46,7 @@
-static void thunar_dialogs_select_filename (GtkWidget *entry,
- ThunarFile *file);
+static void thunar_dialogs_select_filename (GtkWidget *entry);
@@ -152,6 +151,9 @@ thunar_dialogs_show_create (gpointer parent,
/* ensure that the sensitivity of the Create button is set correctly */
xfce_filename_input_check (filename_input);
+ /* select the filename without the extension */
+ thunar_dialogs_select_filename (GTK_WIDGET (xfce_filename_input_get_entry (filename_input)));
+
if (screen != NULL)
gtk_window_set_screen (GTK_WINDOW (dialog), screen);
@@ -295,8 +297,11 @@ thunar_dialogs_show_rename_file (gpointer parent,
/* ensure that the sensitivity of the Create button is set correctly */
xfce_filename_input_check (filename_input);
- /* select the filename without the extension */
- thunar_dialogs_select_filename (GTK_WIDGET (xfce_filename_input_get_entry (filename_input)), file);
+ /* If it is no directory, select the filename without the extension */
+ if (thunar_file_is_directory (file))
+ gtk_editable_select_region (GTK_EDITABLE (xfce_filename_input_get_entry (filename_input)), 0, -1);
+ else
+ thunar_dialogs_select_filename (GTK_WIDGET (xfce_filename_input_get_entry (filename_input)));
/* get the size the entry requires to render the full text */
layout = gtk_entry_get_layout (xfce_filename_input_get_entry (filename_input));
@@ -1119,21 +1124,15 @@ thunar_dialogs_show_insecure_program (gpointer parent,
-static void thunar_dialogs_select_filename (GtkWidget *entry,
- ThunarFile *file)
+static void thunar_dialogs_select_filename (GtkWidget *entry)
{
- const gchar *filename;
- const gchar *ext;
- glong offset;
+ const gchar *filename;
+ const gchar *ext;
+ glong offset;
+ GtkEntryBuffer* buffer;
- /* check if we have a directory here */
- if (thunar_file_is_directory (file))
- {
- gtk_editable_select_region (GTK_EDITABLE (entry), 0, -1);
- return;
- }
-
- filename = thunar_file_get_display_name (file);
+ buffer = gtk_entry_get_buffer (GTK_ENTRY (entry));
+ filename = gtk_entry_buffer_get_text (buffer);
/* check if the filename contains an extension */
ext = thunar_util_str_get_extension (filename);