From 2684d415ef0bf97ae6e465c7d496966b34a465b9 Mon Sep 17 00:00:00 2001 From: Olaf Wintermann Date: Tue, 9 Jun 2026 19:01:46 +0200 Subject: [PATCH] standardise default note title --- application/src/note.rs | 2 +- application/src/notebook.rs | 2 ++ ui/cocoa/{appdelegate.h => AppDelegate.h} | 0 ui/cocoa/{appdelegate.m => AppDelegate.m} | 0 ui/gtk/button.c | 1 + ui/gtk/text.c | 7 ++++++- 6 files changed, 10 insertions(+), 2 deletions(-) rename ui/cocoa/{appdelegate.h => AppDelegate.h} (100%) rename ui/cocoa/{appdelegate.m => AppDelegate.m} (100%) diff --git a/application/src/note.rs b/application/src/note.rs index e168ec7..9065c7d 100644 --- a/application/src/note.rs +++ b/application/src/note.rs @@ -141,7 +141,7 @@ impl Note { let content = self.text.get(); let title = match generate_title(content.as_str()) { Some(title) => title.0.to_string(), - None => "Note".to_string() + None => "New Note".to_string() }; let (note_id, created) = match &self.id { diff --git a/application/src/notebook.rs b/application/src/notebook.rs index b49fadd..6792e36 100644 --- a/application/src/notebook.rs +++ b/application/src/notebook.rs @@ -321,6 +321,8 @@ impl NoteItem { data: entity::note::Model::new(), model: None }; + // TODO: currently this string "New Note" is used twice (also in note.rs) + // the default title for notes should be centralized item.data.title = "New Note".to_owned(); item } diff --git a/ui/cocoa/appdelegate.h b/ui/cocoa/AppDelegate.h similarity index 100% rename from ui/cocoa/appdelegate.h rename to ui/cocoa/AppDelegate.h diff --git a/ui/cocoa/appdelegate.m b/ui/cocoa/AppDelegate.m similarity index 100% rename from ui/cocoa/appdelegate.m rename to ui/cocoa/AppDelegate.m diff --git a/ui/gtk/button.c b/ui/gtk/button.c index b8c0867..5bcc71c 100644 --- a/ui/gtk/button.c +++ b/ui/gtk/button.c @@ -1009,6 +1009,7 @@ void ui_linkbutton_set(UiString *s, const char *str) { if(s->value.free) { s->value.free(s->value.ptr); } + s->value.ptr = NULL; #if GTK_MAJOR_VERSION == 3 UiLinkButton *data = s->obj; GtkWidget *child = gtk_bin_get_child(GTK_BIN(data->widget)); diff --git a/ui/gtk/text.c b/ui/gtk/text.c index 35b14a6..c9f83c0 100644 --- a/ui/gtk/text.c +++ b/ui/gtk/text.c @@ -247,7 +247,12 @@ void ui_textarea_scroll_to(UIWIDGET textarea, int pos) { } void ui_textarea_focus(UIWIDGET textarea) { - gtk_widget_grab_focus(textarea); + GtkWidget *widget = ui_textarea_gettextwidget(textarea); + if(!widget) { + fprintf(stderr, "Error: ui_textarea_focus: widget is not a textarea\n"); + return; + } + gtk_widget_grab_focus(widget); } void ui_textarea_set_selection(UIWIDGET textarea, int begin, int end) { -- 2.52.0