]> uap-core.de Git - note.git/commitdiff
standardise default note title
authorOlaf Wintermann <olaf.wintermann@gmail.com>
Tue, 9 Jun 2026 17:01:46 +0000 (19:01 +0200)
committerOlaf Wintermann <olaf.wintermann@gmail.com>
Tue, 9 Jun 2026 17:01:46 +0000 (19:01 +0200)
application/src/note.rs
application/src/notebook.rs
ui/cocoa/AppDelegate.h [moved from ui/cocoa/appdelegate.h with 100% similarity]
ui/cocoa/AppDelegate.m [moved from ui/cocoa/appdelegate.m with 100% similarity]
ui/gtk/button.c
ui/gtk/text.c

index e168ec7124b9cf0e6c6ca5fc590928371aebdd2a..9065c7d1122a9b1ce3aeebc2cbf8e04782b94a42 100644 (file)
@@ -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 {
index b49fadd7cf94ea927fc0151920c838635cf15456..6792e3663499ac5fd37418484497ed3fa8552ec5 100644 (file)
@@ -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
     }
index b8c08676977f96e4c665bae427933c7f1a6c392e..5bcc71cc8c0fdee1c459a82b9d3d4444034f3bcd 100644 (file)
@@ -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));
index 35b14a6779099fb26aa09a90e8701056ec2e4811..c9f83c0b340e8017b5c90c741d0f06447947dc3d 100644 (file)
@@ -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) {