Skip to content

Commit

Permalink
3.0.4 - Fixes all around for the leaflet
Browse files Browse the repository at this point in the history
  • Loading branch information
Lains committed Apr 27, 2021
1 parent 0ba6bec commit ef17072
Show file tree
Hide file tree
Showing 9 changed files with 55 additions and 14 deletions.
4 changes: 4 additions & 0 deletions data/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ headerbar.flat {
transition: 100ms ease-in-out;
}

.notejot-empty-title {
border-bottom: 1px solid transparent;
}

button.flat-button {
background-color: @theme_base_color;
background-image: none;
Expand Down
2 changes: 2 additions & 0 deletions data/ui/main_window.ui
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
<requires lib="libadwaita" version="1.0"/>
<template class="NotejotMainWindow" parent="AdwApplicationWindow">
<property name="visible">1</property>
<property name="default-width">830</property>
<property name="default-height">600</property>
<child>
<object class="GtkBox" id="main_box">
<property name="orientation">vertical</property>
Expand Down
1 change: 1 addition & 0 deletions data/ui/note_menu.ui
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<requires lib="gtk" version="4.0"/>
<requires lib="libhandy" version="1.0"/>
<template class="NotejotWidgetsNoteMenuPopover" parent="GtkPopover">
<property name="visible">0</property>
<property name="child">
<object class="GtkBox" id="box">
<property name="can-focus">0</property>
Expand Down
9 changes: 8 additions & 1 deletion src/MainWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,10 @@ namespace Notejot {
tm = new TaskManager (this);

sm = new Widgets.SettingMenu(this);
settingmenu.popover = sm.popover;
settingmenu.popover = sm.nmpopover;
settingmenu.visible = false;

titlebar.get_style_context ().add_class ("notejot-empty-title");

back_button.visible = false;
back_button.clicked.connect (() => {
Expand Down Expand Up @@ -447,6 +450,7 @@ namespace Notejot {
public void action_move_to () {
var move_to_dialog = new Widgets.MoveToDialog (this);
move_to_dialog.show ();
sm.nmpopover.close ();
}

public void action_delete_note () {
Expand All @@ -467,13 +471,16 @@ namespace Notejot {
trashstore.append (tlog);

main_stack.set_visible_child (empty_state);
leaflet.set_visible_child (sgrid);
var rowd = main_stack.get_child_by_name ("textfield-%d".printf(((Widgets.Note)row).uid));
main_stack.remove (rowd);

uint pos;
notestore.find (((Widgets.Note)row).log, out pos);
notestore.remove (pos);
sm.nmpopover.close ();
settingmenu.visible = false;
titlebar.get_style_context ().add_class ("notejot-empty-title");
}

public void action_edit_notebooks () {
Expand Down
3 changes: 2 additions & 1 deletion src/Views/ListView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ namespace Notejot {
} else {
win.titlebar.get_style_context ().remove_class (@"notejot-action-dark-$last_uid");
}
win.titlebar.get_style_context ().remove_class ("notejot-empty-title");
} else {
win.titlebar.get_style_context ().remove_class (@"notejot-action-$last_uid");

Expand All @@ -47,6 +48,7 @@ namespace Notejot {
} else {
win.titlebar.get_style_context ().remove_class (@"notejot-action-dark-$last_uid");
}
win.titlebar.get_style_context ().add_class ("notejot-empty-title");
}
});

Expand Down Expand Up @@ -77,7 +79,6 @@ namespace Notejot {
popover.set_pointing_to (allocation);
popover.set_offset (0, 40); // Needed so that the popover doesn't show above the list widget
popover.popup ();
popover.set_autohide (true);
this.y = (int)y;

press.set_state (Gtk.EventSequenceState.CLAIMED);
Expand Down
14 changes: 13 additions & 1 deletion src/Widgets/Note.vala
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ namespace Notejot {
win: win);
this.uid = uid_counter++;
this.hexpand = false;
this.set_title_lines (1);
this.set_subtitle_lines (1);

// Icon intentionally null so it becomes a badge instead.
var icon = new Gtk.Image.from_icon_name ("");
Expand All @@ -66,6 +68,8 @@ namespace Notejot {
win.main_stack.add_named (note_grid, "textfield-%d".printf(uid));
note_grid.get_style_context ().add_class ("notejot-stack-%d".printf(uid));

win.listview.select_row (this);

set_notebook ();
sync_subtitles ();
update_theme (log.color);
Expand Down Expand Up @@ -293,34 +297,42 @@ namespace Notejot {
public void popover_listener (Widgets.NoteMenuPopover? popover) {
popover.color_button_red.clicked.connect (() => {
update_theme("#c01c28");
popover.close ();
});

popover.color_button_orange.clicked.connect (() => {
update_theme("#e66100");
popover.close ();
});

popover.color_button_yellow.clicked.connect (() => {
update_theme("#f5c211");
popover.close ();
});

popover.color_button_green.clicked.connect (() => {
update_theme("#2ec27e");
popover.close ();
});

popover.color_button_blue.clicked.connect (() => {
update_theme("#1c71d8");
popover.close ();
});

popover.color_button_purple.clicked.connect (() => {
update_theme("#813d9c");
popover.close ();
});

popover.color_button_brown.clicked.connect (() => {
update_theme("#865e3c");
popover.close ();
});

popover.color_button_reset.clicked.connect (() => {
update_theme("");
update_theme("#FFFFFF");
popover.close ();
});
}
}
Expand Down
4 changes: 4 additions & 0 deletions src/Widgets/NoteMenuPopover.vala
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,9 @@ namespace Notejot {
public unowned Gtk.Button color_button_brown;
[GtkChild]
public unowned Gtk.Button color_button_reset;

public void close () {
this.hide();
}
}
}
28 changes: 18 additions & 10 deletions src/Widgets/SettingMenu.vala
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,50 @@ namespace Notejot {
public class Widgets.SettingMenu : Object {
private MainWindow win;
public Widgets.Note controller;
public Widgets.NoteMenuPopover popover;
public Widgets.NoteMenuPopover nmpopover;

public SettingMenu (MainWindow win) {
this.win = win;
popover = new Widgets.NoteMenuPopover ();
nmpopover = new Widgets.NoteMenuPopover ();

popover.color_button_red.clicked.connect (() => {
nmpopover.color_button_red.clicked.connect (() => {
controller.update_theme("#c01c28");
nmpopover.close ();
});

popover.color_button_orange.clicked.connect (() => {
nmpopover.color_button_orange.clicked.connect (() => {
controller.update_theme("#e66100");
nmpopover.close ();
});

popover.color_button_yellow.clicked.connect (() => {
nmpopover.color_button_yellow.clicked.connect (() => {
controller.update_theme("#f5c211");
nmpopover.close ();
});

popover.color_button_green.clicked.connect (() => {
nmpopover.color_button_green.clicked.connect (() => {
controller.update_theme("#2ec27e");
nmpopover.close ();
});

popover.color_button_blue.clicked.connect (() => {
nmpopover.color_button_blue.clicked.connect (() => {
controller.update_theme("#1c71d8");
nmpopover.close ();
});

popover.color_button_purple.clicked.connect (() => {
nmpopover.color_button_purple.clicked.connect (() => {
controller.update_theme("#813d9c");
nmpopover.close ();
});

popover.color_button_brown.clicked.connect (() => {
nmpopover.color_button_brown.clicked.connect (() => {
controller.update_theme("#865e3c");
nmpopover.close ();
});

popover.color_button_reset.clicked.connect (() => {
nmpopover.color_button_reset.clicked.connect (() => {
controller.update_theme("#ffffff");
nmpopover.close ();
});
}
}
Expand Down
4 changes: 3 additions & 1 deletion src/Widgets/TextField.vala
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ namespace Notejot {
this.editable = true;
this.set_can_focus (true);
this.opacity = 0.7;
this.right_margin = this.bottom_margin = this.top_margin = this.left_margin = 20;
this.left_margin = this.top_margin = 20;
this.wrap_mode = Gtk.WrapMode.WORD_CHAR;


var buffer = new Gtk.TextBuffer (null);
this.buffer = buffer;
Expand Down

0 comments on commit ef17072

Please sign in to comment.