|
@@ -38,6 +38,7 @@ struct _IridiumWindow
|
|
|
GtkSearchEntry *search_entry;
|
|
GtkSearchEntry *search_entry;
|
|
|
|
|
|
|
|
GBinding *title_binding;
|
|
GBinding *title_binding;
|
|
|
|
|
+ GBinding *content_binding;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
G_DEFINE_TYPE (IridiumWindow, iridium_window, GTK_TYPE_APPLICATION_WINDOW)
|
|
G_DEFINE_TYPE (IridiumWindow, iridium_window, GTK_TYPE_APPLICATION_WINDOW)
|
|
@@ -58,17 +59,23 @@ static void
|
|
|
iridium_window_note_selected (GtkListBox *box, IridiumNoteRow *row, IridiumWindow *self)
|
|
iridium_window_note_selected (GtkListBox *box, IridiumNoteRow *row, IridiumWindow *self)
|
|
|
{
|
|
{
|
|
|
IridiumNote *note;
|
|
IridiumNote *note;
|
|
|
|
|
+ GtkTextBuffer *buffer;
|
|
|
GBindingFlags flags;
|
|
GBindingFlags flags;
|
|
|
|
|
|
|
|
if (self->title_binding != NULL)
|
|
if (self->title_binding != NULL)
|
|
|
g_clear_object (&self->title_binding);
|
|
g_clear_object (&self->title_binding);
|
|
|
|
|
|
|
|
|
|
+ if (self->content_binding != NULL)
|
|
|
|
|
+ g_clear_object (&self->content_binding);
|
|
|
|
|
+
|
|
|
if (row == NULL)
|
|
if (row == NULL)
|
|
|
return;
|
|
return;
|
|
|
|
|
|
|
|
note = iridium_note_row_get_note (row);
|
|
note = iridium_note_row_get_note (row);
|
|
|
flags = G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE;
|
|
flags = G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE;
|
|
|
|
|
+ buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (self->source_view));
|
|
|
self->title_binding = g_object_bind_property (note, "title", self->title_entry, "text", flags);
|
|
self->title_binding = g_object_bind_property (note, "title", self->title_entry, "text", flags);
|
|
|
|
|
+ self->content_binding = g_object_bind_property (note, "content", buffer, "text", flags);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
static void
|
|
@@ -109,6 +116,7 @@ iridium_window_dispose (GObject *object)
|
|
|
|
|
|
|
|
self = IRIDIUM_WINDOW (object);
|
|
self = IRIDIUM_WINDOW (object);
|
|
|
g_clear_object (&self->title_binding);
|
|
g_clear_object (&self->title_binding);
|
|
|
|
|
+ g_clear_object (&self->content_binding);
|
|
|
G_OBJECT_CLASS (iridium_window_parent_class)->dispose (object);
|
|
G_OBJECT_CLASS (iridium_window_parent_class)->dispose (object);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -147,6 +155,7 @@ iridium_window_init (IridiumWindow *self)
|
|
|
gtk_widget_init_template (GTK_WIDGET (self));
|
|
gtk_widget_init_template (GTK_WIDGET (self));
|
|
|
|
|
|
|
|
self->title_binding = NULL;
|
|
self->title_binding = NULL;
|
|
|
|
|
+ self->content_binding = NULL;
|
|
|
|
|
|
|
|
action = g_simple_action_new ("search", NULL);
|
|
action = g_simple_action_new ("search", NULL);
|
|
|
g_action_map_add_action (G_ACTION_MAP (self), G_ACTION (action));
|
|
g_action_map_add_action (G_ACTION_MAP (self), G_ACTION (action));
|
|
@@ -180,9 +189,12 @@ iridium_window_init (IridiumWindow *self)
|
|
|
gtk_list_box_insert (self->tag_list, iridium_tag_row_new (tags[0]), -1);
|
|
gtk_list_box_insert (self->tag_list, iridium_tag_row_new (tags[0]), -1);
|
|
|
gtk_list_box_insert (self->tag_list, iridium_tag_row_new (tags[1]), -1);
|
|
gtk_list_box_insert (self->tag_list, iridium_tag_row_new (tags[1]), -1);
|
|
|
|
|
|
|
|
- g_signal_connect (self->tag_list, "row-selected", G_CALLBACK (iridium_window_tag_selected), self);
|
|
|
|
|
- g_signal_connect (self->note_list, "row-selected", G_CALLBACK (iridium_window_note_selected), self);
|
|
|
|
|
- g_signal_connect (self->search_entry, "search-changed", G_CALLBACK (iridium_window_search_changed), self);
|
|
|
|
|
|
|
+ g_signal_connect (self->tag_list, "row-selected",
|
|
|
|
|
+ G_CALLBACK (iridium_window_tag_selected), self);
|
|
|
|
|
+ g_signal_connect (self->note_list, "row-selected",
|
|
|
|
|
+ G_CALLBACK (iridium_window_note_selected), self);
|
|
|
|
|
+ g_signal_connect (self->search_entry, "search-changed",
|
|
|
|
|
+ G_CALLBACK (iridium_window_search_changed), self);
|
|
|
|
|
|
|
|
gtk_list_box_set_filter_func (self->note_list, (GtkListBoxFilterFunc) iridium_window_note_visible, self, NULL);
|
|
gtk_list_box_set_filter_func (self->note_list, (GtkListBoxFilterFunc) iridium_window_note_visible, self, NULL);
|
|
|
|
|
|