Improve year-view code, removing hardcoded values. year-view have hardcoded values for grid cell sizes (width and height). Those values need to be recalculated every time a change in font or any other style are changed. Sidebar width was also hardcoded instead of getting its value directly from the ui file. That would prevent it from drawing the content accordingly when ui file is changed. This patch fixes those two issues by retrieving those values from CSS or ui files. This patch also adds code to resize and redraw the window when show-week-numbers property is changed. Popover mode was also changed and now sidebar will always be shown when show-week-numbers is set or when there is space for only 3 or less columns. https://bugzilla.gnome.org/show_bug.cgi?id=753533
130 lines
5.3 KiB
XML
130 lines
5.3 KiB
XML
<?xml version="1.0"?>
|
|
<interface>
|
|
<!-- interface-requires gtk+ 3.10 -->
|
|
<template class="GcalYearView" parent="GtkBox">
|
|
<style>
|
|
<class name="year-view"/>
|
|
</style>
|
|
<child>
|
|
<object class="GtkScrolledWindow">
|
|
<property name="visible">True</property>
|
|
<property name="shadow_type">none</property>
|
|
<property name="vexpand">True</property>
|
|
<child>
|
|
<object class="GtkViewport">
|
|
<property name="visible">True</property>
|
|
<property name="shadow_type">none</property>
|
|
<property name="vexpand">True</property>
|
|
<child>
|
|
<object class="GtkDrawingArea" id="navigator">
|
|
<property name="visible">True</property>
|
|
<property name="hexpand">True</property>
|
|
<property name="events">GDK_POINTER_MOTION_MASK|GDK_BUTTON_MOTION_MASK|GDK_BUTTON_PRESS_MASK|GDK_BUTTON_RELEASE_MASK|GDK_STRUCTURE_MASK</property>
|
|
<signal name="draw" handler="draw_navigator" object="GcalYearView" swapped="yes"/>
|
|
<signal name="button-press-event" handler="navigator_button_press_cb" object="GcalYearView" swapped="yes"/>
|
|
<signal name="button-release-event" handler="navigator_button_release_cb" object="GcalYearView" swapped="yes"/>
|
|
<signal name="motion-notify-event" handler="navigator_motion_notify_cb" object="GcalYearView" swapped="yes"/>
|
|
<style>
|
|
<class name="year-navigator"/>
|
|
</style>
|
|
</object>
|
|
</child>
|
|
</object>
|
|
</child>
|
|
</object>
|
|
<packing>
|
|
<property name="position">0</property>
|
|
<property name="pack_type">start</property>
|
|
</packing>
|
|
</child>
|
|
<child>
|
|
<object class="GtkBox" id="sidebar">
|
|
<property name="visible">True</property>
|
|
<property name="width_request">200</property>
|
|
<property name="orientation">vertical</property>
|
|
<child>
|
|
<object class="GtkStack" id="navigator_stack">
|
|
<property name="visible">True</property>
|
|
<child>
|
|
<object class="GtkScrolledWindow" id="navigator_sidebar">
|
|
<property name="visible">True</property>
|
|
<property name="shadow_type">out</property>
|
|
<property name="vexpand">True</property>
|
|
<child>
|
|
<object class="GtkListBox" id="events_sidebar">
|
|
<property name="visible">True</property>
|
|
<property name="selection-mode">none</property>
|
|
<style>
|
|
<class name="sidebar"/>
|
|
</style>
|
|
</object>
|
|
</child>
|
|
</object>
|
|
<packing>
|
|
<property name="name">events-list</property>
|
|
</packing>
|
|
</child>
|
|
<child>
|
|
<object class="GtkBox">
|
|
<property name="visible">True</property>
|
|
<property name="orientation">vertical</property>
|
|
<style>
|
|
<class name="sidebar"/>
|
|
</style>
|
|
<child>
|
|
<object class="GtkLabel" id="no_events_title">
|
|
<property name="visible">True</property>
|
|
<property name="halign">start</property>
|
|
<property name="margin">6</property>
|
|
<property name="label" translatable="yes">Today</property>
|
|
<style>
|
|
<class name="sidebar-header"/>
|
|
</style>
|
|
</object>
|
|
</child>
|
|
<child>
|
|
<object class="GtkLabel">
|
|
<property name="visible">True</property>
|
|
<property name="halign">start</property>
|
|
<property name="margin_start">6</property>
|
|
<property name="label" translatable="yes">No events</property>
|
|
<style>
|
|
<class name="dim-label"/>
|
|
<class name="italic-label"/>
|
|
</style>
|
|
</object>
|
|
<packing>
|
|
<property name="position">1</property>
|
|
</packing>
|
|
</child>
|
|
</object>
|
|
<packing>
|
|
<property name="position">1</property>
|
|
<property name="name">no-events</property>
|
|
</packing>
|
|
</child>
|
|
</object>
|
|
</child>
|
|
<child>
|
|
<object class="GtkButton">
|
|
<property name="visible">True</property>
|
|
<property name="valign">end</property>
|
|
<property name="label" translatable="yes">Add Event…</property>
|
|
<signal name="clicked" handler="add_event_clicked_cb" object="GcalYearView" swapped="yes"/>
|
|
</object>
|
|
<packing>
|
|
<property name="position">1</property>
|
|
</packing>
|
|
</child>
|
|
</object>
|
|
</child>
|
|
</template>
|
|
<object class="GtkPopover" id="popover">
|
|
<property name="relative_to">navigator</property>
|
|
<style>
|
|
<class name="events"/>
|
|
</style>
|
|
<signal name="closed" handler="popover_closed_cb" object="GcalYearView" swapped="yes"/>
|
|
</object>
|
|
</interface>
|