[Github-comments] [geany/geany] Context menu update (#2550)

Matthew Brush notifications at xxxxx
Sat Jul 18 03:53:12 UTC 2020


@codebrainz commented on this pull request.



> @@ -455,6 +455,34 @@ static void on_close_documents_right_activate(GtkMenuItem *menuitem, GeanyDocume
 }
 
 
+static void on_copy_basename_to_clipboard_activate(GtkMenuItem *menuitem, GeanyDocument *doc)
+{
+	g_return_if_fail(doc->is_valid);
+	
+	gchar *bname = g_path_get_basename(doc->real_path);
+	gtk_clipboard_set_text(gtk_clipboard_get(GDK_NONE), bname, -1);

I take @elextr's +1/thumbs-up that I may be correct.

I think it should be like this:
```diff
diff --git a/src/notebook.c b/src/notebook.c
index cef5375f9..fb47ec29d 100644
--- a/src/notebook.c
+++ b/src/notebook.c
@@ -460,8 +460,10 @@ static void on_copy_basename_to_clipboard_activate(GtkMenuItem *menuitem, GeanyD
 	g_return_if_fail(doc->is_valid);
 	
 	gchar *bname = g_path_get_basename(doc->real_path);
-	gtk_clipboard_set_text(gtk_clipboard_get(GDK_NONE), bname, -1);
+	gchar *utf8_bname = utils_get_utf8_from_locale(bname);
 	g_free(bname);
+	gtk_clipboard_set_text(gtk_clipboard_get(GDK_NONE), utf8_bname, -1);
+	g_free(utf8_bname);
 }
 
 
@@ -469,7 +471,9 @@ static void on_copy_full_path_to_clipboard_activate(GtkMenuItem *menuitem, Geany
 {
 	g_return_if_fail(doc->is_valid);
 	
-	gtk_clipboard_set_text(gtk_clipboard_get(GDK_NONE), doc->real_path, -1);
+	gchar *utf8_fname = utils_get_utf8_from_locale(doc->real_path);
+	gtk_clipboard_set_text(gtk_clipboard_get(GDK_NONE), utf8_fname, -1);
+	g_free(utf8_fname);
 }
 
 
@@ -478,8 +482,10 @@ static void on_copy_dir_path_to_clipboard_activate(GtkMenuItem *menuitem, GeanyD
 	g_return_if_fail(doc->is_valid);
 
 	gchar *dirpath = g_path_get_dirname(doc->real_path);
-	gtk_clipboard_set_text(gtk_clipboard_get(GDK_NONE), dirpath, -1);
+	gchar *utf8_dirpath = utils_get_utf8_from_locale(dirpath);
 	g_free(dirpath);
+	gtk_clipboard_set_text(gtk_clipboard_get(GDK_NONE), utf8_dirpath, -1);
+	g_free(utf8_dirpath);
 }
 
 
```

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/pull/2550#discussion_r456744687
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20200717/e4a5867d/attachment.htm>


More information about the Github-comments mailing list