Introduce sidebar layout

parent feb334c5
......@@ -126,3 +126,16 @@ tasklistview.light emptylistwidget label,
tasklistview.light emptylistwidget image {
color: black;
}
/* Add a subtle shadow to the task list color circle */
sidebar row image.color-circle-icon { -gtk-icon-shadow: 0 1px alpha(black, 0.18); }
/*
* Hack: Move separator by 1px so that it aligns with the sidebar
*
* Stolen from https://gitlab.gnome.org/GNOME/polari/blob/master/data/resources/application.css
*/
.titlebar > separator:dir(ltr) { margin-left: -1px; }
.titlebar > headerbar:first-child:dir(ltr) { margin-right: 1px; }
.titlebar > separator:dir(rtl) { margin-right: -1px; }
.titlebar > headerbar:first-child:dir(rtl) { margin-left: 1px; }
......@@ -6,10 +6,11 @@
<file compressed="true" preprocess="xml-stripblanks">ui/edit-pane.ui</file>
<file compressed="true" preprocess="xml-stripblanks">ui/empty-list.ui</file>
<file compressed="true" preprocess="xml-stripblanks">ui/initial-setup.ui</file>
<file compressed="true" preprocess="xml-stripblanks">ui/list-selector-grid-item.ui</file>
<file compressed="true" preprocess="xml-stripblanks">ui/list-selector-list-item.ui</file>
<file compressed="true" preprocess="xml-stripblanks">ui/list-selector-panel.ui</file>
<file compressed="true" preprocess="xml-stripblanks">ui/list-view.ui</file>
<file compressed="true" preprocess="xml-stripblanks">ui/sidebar.ui</file>
<file compressed="true" preprocess="xml-stripblanks">ui/sidebar-list-row.ui</file>
<file compressed="true" preprocess="xml-stripblanks">ui/sidebar-panel-row.ui</file>
<file compressed="true" preprocess="xml-stripblanks">ui/sidebar-provider-row.ui</file>
<file compressed="true" preprocess="xml-stripblanks">ui/new-task-row.ui</file>
<file compressed="true" preprocess="xml-stripblanks">ui/notification.ui</file>
<file compressed="true" preprocess="xml-stripblanks">ui/plugin-dialog.ui</file>
......@@ -17,6 +18,7 @@
<file compressed="true" preprocess="xml-stripblanks">ui/provider-popover.ui</file>
<file compressed="true" preprocess="xml-stripblanks">ui/provider-row.ui</file>
<file compressed="true" preprocess="xml-stripblanks">ui/provider-selector.ui</file>
<file compressed="true" preprocess="xml-stripblanks">ui/task-list-panel.ui</file>
<file compressed="true" preprocess="xml-stripblanks">ui/task-row.ui</file>
<file compressed="true" preprocess="xml-stripblanks">ui/window.ui</file>
<file compressed="true">theme/Adwaita.css</file>
......
......@@ -225,7 +225,7 @@
</template>
<object class="GtkTextBuffer" id="text_buffer">
<signal name="changed" handler="on_text_buffer_changed_cb" object="GtdEditPane" swapped="no" />
<signal name="notify::text" handler="on_text_buffer_changed_cb" object="GtdEditPane" swapped="no" />
</object>
<object class="GtkPopover" id="date_popover">
......
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk+" version="3.20"/>
<template class="GtdSidebarListRow" parent="GtkListBoxRow">
<property name="visible">True</property>
<property name="can_focus">True</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_start">12</property>
<property name="margin_end">12</property>
<property name="margin_top">6</property>
<property name="margin_bottom">6</property>
<property name="spacing">6</property>
<child>
<object class="GtkImage" id="color_icon">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-missing-image</property>
<style>
<class name="color-circle-icon" />
</style>
</object>
</child>
<child>
<object class="GtkLabel" id="name_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="xalign">0</property>
</object>
</child>
<child>
<object class="GtkLabel" id="tasks_counter_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<attributes>
<attribute name="scale" value="0.88"/>
</attributes>
<style>
<class name="dim-label"/>
</style>
</object>
</child>
</object>
</child>
</template>
</interface>
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk+" version="3.20"/>
<template class="GtdSidebarPanelRow" parent="GtkListBoxRow">
<property name="can_focus">True</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">12</property>
<property name="margin_right">12</property>
<property name="margin_top">6</property>
<property name="margin_bottom">6</property>
<property name="spacing">6</property>
<child>
<object class="GtkImage" id="panel_icon">
<property name="visible">True</property>
<property name="can_focus">False</property>
<style>
<class name="dim-label"/>
</style>
</object>
</child>
<child>
<object class="GtkLabel" id="title_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="xalign">0</property>
</object>
</child>
<child>
<object class="GtkLabel" id="subtitle_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">1.0</property>
<attributes>
<attribute name="scale" value="0.88"/>
</attributes>
<style>
<class name="dim-label"/>
</style>
</object>
</child>
</object>
</child>
</template>
</interface>
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk+" version="3.20"/>
<template class="GtdSidebarProviderRow" parent="GtkListBoxRow">
<property name="can_focus">True</property>
<property name="selectable">False</property>
<property name="activatable">False</property>
<property name="margin_top">6</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_start">6</property>
<property name="margin_end">6</property>
<property name="margin_top">6</property>
<property name="spacing">3</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_start">6</property>
<property name="margin_end">6</property>
<property name="spacing">12</property>
<!-- Main label -->
<child>
<object class="GtkLabel" id="provider_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="xalign">0.0</property>
<attributes>
<attribute name="weight" value="bold"/>
<attribute name="scale" value="0.88"/>
</attributes>
<style>
<class name="dim-label"/>
</style>
</object>
</child>
<!-- Stack with the loading spinner & pan-down arrow -->
<child>
<object class="GtkStack" id="stack">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="homogeneous">True</property>
<property name="transition-type">crossfade</property>
<!-- Loading spinner -->
<child>
<object class="GtkSpinner">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="active">True</property>
</object>
<packing>
<property name="name">spinner</property>
</packing>
</child>
<!-- Drop down icon -->
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">pan-down-symbolic</property>
<style>
<class name="dim-label"/>
</style>
</object>
<packing>
<property name="name">icon</property>
</packing>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkSeparator">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
</child>
<!-- Loading label -->
<child>
<object class="GtkLabel" id="loading_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin-start">6</property>
<property name="margin-end">6</property>
<property name="margin-top">6</property>
<property name="margin-bottom">12</property>
<property name="xalign">0.0</property>
<property name="label" translatable="yes">Loading…</property>
<attributes>
<attribute name="scale" value="0.88"/>
</attributes>
<style>
<class name="dim-label"/>
</style>
</object>
</child>
</object>
</child>
</template>
</interface>
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template class="GtdSidebar" parent="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">False</property>
<child>
<object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="min-content-width">300</property>
<property name="hscrollbar-policy">never</property>
<property name="vscrollbar-policy">automatic</property>
<!-- Listbox -->
<child>
<object class="GtkListBox" id="listbox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="expand">True</property>
<property name="selection_mode">browse</property>
<signal name="row-activated" handler="on_listbox_row_activated_cb" object="GtdSidebar" swapped="no" />
<style>
<class name="sidebar"/>
</style>
</object>
</child>
</object>
</child>
</template>
</interface>
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template class="GtdTaskListPanel" parent="GtkBox">
<property name="visible">true</property>
<property name="can-focus">false</property>
<!-- Main task list view -->
<child>
<object class="GtdTaskListView" id="task_list_view">
<property name="visible">true</property>
</object>
</child>
</template>
<!-- Color button -->
<object class="GtkColorButton" id="color_button">
<property name="visible">true</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="halign">end</property>
<signal name="color-set" handler="on_color_button_color_set_cb" object="GtdTaskListPanel" swapped="no" />
</object>
</interface>
......@@ -22,99 +22,172 @@
</object>
</child>
<child>
<object class="GtkStack" id="stack">
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="transition_duration">250</property>
<property name="transition_type">crossfade</property>
<signal name="notify::visible-child" handler="on_stack_visible_child_cb" object="GtdWindow" swapped="yes" />
<style>
<class name="background" />
</style>
<!-- Sidebar -->
<child>
<object class="GtdSidebar" id="sidebar">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="vexpand">True</property>
</object>
</child>
<!-- Main list -->
<child>
<object class="GtkStack" id="stack">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="expand">True</property>
<property name="homogeneous">False</property>
<property name="transition_duration">250</property>
<property name="transition_type">crossfade</property>
<signal name="notify::visible-child" handler="on_stack_visible_child_cb" object="GtdWindow" swapped="yes" />
<style>
<class name="background" />
</style>
</object>
</child>
</object>
</child>
</object>
</child>
<child type="titlebar">
<object class="GtkHeaderBar" id="headerbar">
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="show_close_button">True</property>
<child>
<object class="GtkBox" id="panel_box_start">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
</object>
<packing>
<property name="pack_type">start</property>
</packing>
</child>
<!-- First headerbar -->
<child>
<object class="GtkBox" id="extension_box_start">
<object class="GtkHeaderBar" id="start_headerbar">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
</object>
<packing>
<property name="pack_type">start</property>
</packing>
</child>
<child>
<object class="GtkButton" id="cancel_selection_button">
<property name="label" translatable="yes">_Cancel</property>
<property name="use_underline">True</property>
<property name="visible">False</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<signal name="clicked" handler="on_cancel_selection_button_clicked" object="GtdWindow" swapped="no" />
</object>
<packing>
<property name="pack_type">end</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkMenuButton" id="gear_menu_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<style>
<class name="image-button" />
</style>
<child>
<object class="GtkImage">
<object class="GtkMenuButton">
<property name="visible">True</property>
<property name="icon_name">open-menu-symbolic</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="popover">new_list_popover</property>
<property name="halign">start</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">_New List</property>
<property name="use_underline">True</property>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="pack_type">end</property>
</packing>
</child>
<child>
<object class="GtkBox" id="panel_box_end">
<object class="GtkSeparator">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
<property name="orientation">vertical</property>
</object>
<packing>
<property name="pack_type">end</property>
</packing>
</child>
<!-- Second headerbar -->
<child>
<object class="GtkBox" id="extension_box_end">
<object class="GtkHeaderBar" id="headerbar">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
<property name="hexpand">True</property>
<property name="show_close_button">True</property>
<child>
<object class="GtkBox" id="panel_box_start">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
</object>
<packing>
<property name="pack_type">start</property>
</packing>
</child>
<child>
<object class="GtkBox" id="extension_box_start">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
</object>
<packing>
<property name="pack_type">start</property>
</packing>
</child>
<child>
<object class="GtkButton" id="cancel_selection_button">
<property name="label" translatable="yes">_Cancel</property>
<property name="use_underline">True</property>
<property name="visible">False</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<signal name="clicked" handler="on_cancel_selection_button_clicked" object="GtdWindow" swapped="no" />
</object>
<packing>
<property name="pack_type">end</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkMenuButton" id="gear_menu_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<style>
<class name="image-button" />
</style>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="icon_name">open-menu-symbolic</property>
</object>
</child>
</object>
<packing>
<property name="pack_type">end</property>
</packing>
</child>
<child>
<object class="GtkBox" id="panel_box_end">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
</object>
<packing>
<property name="pack_type">end</property>
</packing>
</child>
<child>
<object class="GtkBox" id="extension_box_end">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
</object>
<packing>
<property name="pack_type">end</property>
</packing>
</child>
</object>
<packing>
<property name="pack_type">end</property>
</packing>
</child>
</object>
</child>
</template>
<!-- New List popover -->
<object class="GtdProviderPopover" id="new_list_popover">
<property name="can_focus">False</property>
<property name="position">bottom</property>
</object>
<!-- Sizegroup to keep sidebar & headerbar aligned -->
<object class="GtkSizeGroup">
<property name="mode">horizontal</property>
<widgets>
<widget name="sidebar" />
<widget name="start_headerbar" />
</widgets>
</object>
</interface>
......@@ -29,6 +29,7 @@
#include "gtd-plugin-dialog.h"
#include "gtd-vcs-identifier.h"
#include "gtd-window.h"
#include "gtd-window-private.h"
#include <glib.h>
#include <glib-object.h>
......@@ -292,6 +293,13 @@ gtd_application_startup (GApplication *application)
/* Load the plugins */
gtd_manager_load_plugins (gtd_manager_get_default ());
/*
* This will select select the first panel of the sidebar, since
* at this point the panels are already loaded and the sidebar has
* all the rows set up.
*/
_gtd_window_finish_startup (GTD_WINDOW (self->window));
GTD_EXIT;
}
......
......@@ -43,6 +43,7 @@ static void on_text_buffer_weak_notified_cb (gpointer
GObject *where_the_object_was);
static void on_text_changed_cb (GtkTextBuffer *buffer,
GParamSpec *pspec,
GtdMarkdownRenderer *self);
......@@ -252,7 +253,7 @@ populate_tag_table (GtdMarkdownRenderer *self,
/* Add to the map of populated buffers */
g_hash_table_add (self->populated_buffers, buffer);
g_signal_connect (buffer, "changed", G_CALLBACK (on_text_changed_cb), self);
g_signal_connect (buffer, "notify::text", G_CALLBACK (on_text_changed_cb), self);
g_debug ("Added buffer %p to markdown renderer", buffer);
}
......@@ -267,6 +268,8 @@ render_markdown (GtdMarkdownRenderer *self,
GTD_ENTRY;
/* TODO: render in idle */
/* Wipe out the previous tags */
gtk_text_buffer_get_start_iter (buffer, &start);
gtk_text_buffer_get_end_iter (buffer, &end);
......@@ -313,6 +316,7 @@ on_text_buffer_weak_notified_cb (gpointer data,
static void
on_text_changed_cb (GtkTextBuffer *buffer,
GParamSpec *pspec,
GtdMarkdownRenderer *self)
{
render_markdown (self, buffer);
......
/* gtd-task-list-panel.c
*
* Copyright 2018 Georges Basile Stavracas Neto <georges.stavracas@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#include "gtd-panel.h"
#include "gtd-provider.h"
#include "gtd-task-list.h"
<