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 {
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
}
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));
}
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) {