Fix header bar
This commit is contained in:
parent
c0d9da7947
commit
ed63ac8e78
7 changed files with 96 additions and 84 deletions
|
@ -64,7 +64,7 @@ class JnotesApplication(Adw.Application):
|
|||
else:
|
||||
win.sidebar.set_calendars(self.calendar_set)
|
||||
|
||||
Sync.set_spinner(win.sidebar.spinner)
|
||||
Sync.set_spinner(win.spinner)
|
||||
Sync.get_calendar_set(callback)
|
||||
|
||||
def on_about_action(self, widget, _):
|
||||
|
|
|
@ -35,5 +35,16 @@ class NoteEdit(Gtk.ScrolledWindow):
|
|||
self.summary.get_buffer().set_text(self.note.summary)
|
||||
self.description.get_buffer().set_text(self.note.description)
|
||||
|
||||
def on_save_button_pressed(self, widget):
|
||||
print("save button pressed")
|
||||
@Gtk.Template.Callback()
|
||||
def on_summary_changed(self, s):
|
||||
pass
|
||||
summary = s.get_text(s.get_start_iter(), s.get_end_iter(), False)
|
||||
if self.note.summary != summary:
|
||||
self.note.set_property("summary", summary)
|
||||
|
||||
@Gtk.Template.Callback()
|
||||
def on_description_changed(self, d):
|
||||
pass
|
||||
description = d.get_text(d.get_start_iter(), d.get_end_iter(), False)
|
||||
if self.note.description != description:
|
||||
self.note.description = description
|
||||
|
|
|
@ -21,11 +21,10 @@ from gi.repository import Adw
|
|||
from gi.repository import Gtk
|
||||
|
||||
@Gtk.Template(resource_path='/net/jeena/jnotes/ui/sidebar.ui')
|
||||
class Sidebar(Adw.NavigationPage):
|
||||
class Sidebar(Gtk.ScrolledWindow):
|
||||
__gtype_name__ = 'Sidebar'
|
||||
|
||||
calendar_set = Gtk.Template.Child()
|
||||
spinner = Gtk.Template.Child()
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super().__init__(**kwargs)
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<object class="GtkBox">
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">24</property>
|
||||
<property name="margin-top">12</property>
|
||||
<property name="margin-top">-12</property>
|
||||
<property name="margin-bottom">12</property>
|
||||
<property name="margin-start">12</property>
|
||||
<property name="margin-end">12</property>
|
||||
|
@ -21,6 +21,7 @@
|
|||
<property name="right-margin">12</property>
|
||||
<property name="wrap-mode">3</property>
|
||||
<property name="css-classes">card</property>
|
||||
<signal name="preedit-changed" handler="on_summary_changed" swapped="no" />
|
||||
</object>"
|
||||
</child>
|
||||
</object>
|
||||
|
@ -37,6 +38,7 @@
|
|||
<property name="right-margin">12</property>
|
||||
<property name="wrap-mode">3</property>
|
||||
<property name="css-classes">card</property>
|
||||
<signal name="preedit-changed" handler="on_description_changed" swapped="no" />
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
|
|
@ -1,28 +1,12 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<requires lib="gtk" version="4.0"/>
|
||||
<template class="Sidebar" parent="AdwNavigationPage">
|
||||
<property name="title">Notes</property>
|
||||
<template class="Sidebar" parent="GtkScrolledWindow">
|
||||
<property name="child">
|
||||
<object class="AdwToolbarView">
|
||||
<child type="top">
|
||||
<object class="AdwHeaderBar">
|
||||
<child type="end">
|
||||
<object class="GtkSpinner" id="spinner"></object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<property name="content">
|
||||
<object class="GtkScrolledWindow">
|
||||
<property name="child">
|
||||
<object class="GtkListBox" id="calendar_set">
|
||||
<style>
|
||||
<class name="navigation-sidebar"/>
|
||||
</style>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</property>
|
||||
<object class="GtkListBox" id="calendar_set">
|
||||
<style>
|
||||
<class name="navigation-sidebar"/>
|
||||
</style>
|
||||
</object>
|
||||
</property>
|
||||
</template>
|
||||
|
|
129
src/ui/window.ui
129
src/ui/window.ui
|
@ -1,6 +1,77 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<menu id="main-menu">
|
||||
<requires lib="gtk" version="4.0"/>
|
||||
<requires lib="Adw" version="1.0"/>
|
||||
<template class="JnotesWindow" parent="AdwApplicationWindow">
|
||||
<property name="default-width">800</property>
|
||||
<property name="default-height">800</property>
|
||||
<property name="content">
|
||||
<object class="AdwNavigationSplitView" id="split_view">
|
||||
<property name="sidebar">
|
||||
<object class="AdwNavigationPage">
|
||||
<property name="title" translatable="yes">JNotes</property>
|
||||
<property name="child">
|
||||
<object class="AdwToolbarView">
|
||||
<child type="top">
|
||||
<object class="AdwHeaderBar" id="header_bar">
|
||||
<child type="end">
|
||||
<object class="GtkMenuButton">
|
||||
<property name="primary">True</property>
|
||||
<property name="icon-name">open-menu-symbolic</property>
|
||||
<property name="tooltip-text" translatable="yes">Menu</property>
|
||||
<property name="menu-model">primary_menu</property>
|
||||
</object>
|
||||
</child>
|
||||
<child type="end">
|
||||
<object class="GtkSpinner" id="spinner"></object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<property name="content">
|
||||
<object class="Sidebar" id="sidebar"></object>
|
||||
</property>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</property>
|
||||
<property name="content">
|
||||
<object class="AdwNavigationPage">
|
||||
<property name="title" translatable="yes">Note</property>
|
||||
<property name="child">
|
||||
<object class="AdwOverlaySplitView" id="split_view2">
|
||||
<property name="sidebar-position">1</property>
|
||||
<property name="content">
|
||||
<object class="AdwToolbarView">
|
||||
<child type="top">
|
||||
<object class="AdwHeaderBar" id="header_bar3">
|
||||
<property name="show-title">False</property>
|
||||
</object>
|
||||
</child>
|
||||
<property name="content">
|
||||
<object class="NotesList" id="notes_list"></object>
|
||||
</property>
|
||||
</object>
|
||||
</property>
|
||||
<property name="sidebar">
|
||||
<object class="AdwToolbarView">
|
||||
<child type="top">
|
||||
<object class="AdwHeaderBar" id="header_bar2">
|
||||
<property name="show-title">False</property>
|
||||
</object>
|
||||
</child>
|
||||
<property name="content">
|
||||
<object class="NoteEdit" id="note_edit"></object>
|
||||
</property>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</property>
|
||||
</template>
|
||||
<menu id="primary_menu">
|
||||
<section>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_Preferences</attribute>
|
||||
|
@ -22,60 +93,4 @@
|
|||
</item>
|
||||
</section>
|
||||
</menu>
|
||||
<template class="JnotesWindow" parent="AdwApplicationWindow">
|
||||
<property name="title" translatable="yes">Notes</property>
|
||||
<property name="width-request">800</property>
|
||||
<property name="height-request">800</property>
|
||||
<child>
|
||||
<object class="AdwBreakpoint">
|
||||
<condition>max-width: 500sp</condition>
|
||||
<setter object="split_view" property="collapsed">True</setter>
|
||||
</object>
|
||||
</child>
|
||||
<property name="content">
|
||||
<object class="AdwNavigationSplitView" id="split_view">
|
||||
<property name="min-sidebar-width">200</property>
|
||||
<property name="sidebar">
|
||||
<object class="Sidebar" id="sidebar"></object>
|
||||
</property>
|
||||
<property name="content">
|
||||
<object class="AdwNavigationPage">
|
||||
<property name="title" translatable="yes">Note</property>
|
||||
<property name="child">
|
||||
<object class="AdwToolbarView">
|
||||
<child type="top">
|
||||
<object class="AdwHeaderBar">
|
||||
<property name="show-title">False</property>
|
||||
<child type="end">
|
||||
<object class="GtkMenuButton">
|
||||
<property name="icon-name">open-menu-symbolic</property>
|
||||
<property name="menu-model">main-menu</property>
|
||||
<property name="tooltip-text" translatable="yes">Main Menu</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<property name="content">
|
||||
<object class="AdwOverlaySplitView" id="content_split_view">
|
||||
<property name="min-sidebar-width">200</property>
|
||||
<property name="max-sidebar-width">400</property>
|
||||
<property name="sidebar-width-fraction">0.40</property>
|
||||
<property name="sidebar-position">1</property>
|
||||
<property name="content">
|
||||
<object class="NotesList" id="notes_list"></object>
|
||||
</property>
|
||||
<property name="sidebar">
|
||||
<object class="NoteEdit" id="note_edit"></object>
|
||||
</property>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</property>
|
||||
</template>
|
||||
</interface>
|
||||
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@ class JnotesWindow(Adw.ApplicationWindow):
|
|||
sidebar = Gtk.Template.Child()
|
||||
notes_list = Gtk.Template.Child()
|
||||
note_edit = Gtk.Template.Child()
|
||||
spinner = Gtk.Template.Child()
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super().__init__(**kwargs)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue