Use leaflets in the UI

There is no way to navigate into the app, but it's a start.

v2: replace expand with child vexpand
This commit is contained in:
Adrien Plazas 2019-10-24 14:36:04 +02:00 committed by Julian Sparber
parent edfb1a2cf3
commit 12a7101ba5
6 changed files with 81 additions and 32 deletions

View file

@ -317,9 +317,9 @@ public class Application.MainWindow :
[GtkChild]
private Gtk.Box main_layout;
[GtkChild]
private Gtk.Paned folder_paned;
private Hdy.Leaflet main_leaflet;
[GtkChild]
private Gtk.Paned conversations_paned;
private Hdy.Leaflet conversations_leaflet;
[GtkChild]
private Gtk.Box folder_box;
[GtkChild]
@ -520,7 +520,6 @@ public class Application.MainWindow :
});
setup_layout(application.config);
this.folder_paned.orientation = Gtk.Orientation.HORIZONTAL;
this.folder_box.pack_start(status_bar, false, false);
update_command_actions();
@ -1249,8 +1248,9 @@ public class Application.MainWindow :
on_conversation_view_added
);
this.conversations_paned.pack2(this.conversation_viewer, true, false);
this.conversation_viewer.hexpand = true;
this.conversation_size_group.add_widget(this.conversation_viewer);
this.main_leaflet.add_with_properties(this.conversation_viewer, "name", "conversation", null);
// Main toolbar
this.main_toolbar = new MainToolbar(config);

View file

@ -6,7 +6,7 @@
// Draws the main toolbar.
[GtkTemplate (ui = "/org/gnome/Geary/main-toolbar.ui")]
public class MainToolbar : Gtk.Box {
public class MainToolbar : Hdy.Leaflet {
// How wide the left pane should be. Auto-synced with our settings
public int left_pane_width { get; set; }
// Used to form the title of the folder header
@ -97,7 +97,8 @@ public class MainToolbar : Gtk.Box {
public void set_conversation_header(Gtk.HeaderBar header) {
conversation_header.hide();
this.header_group.add_gtk_header_bar(header);
pack_start(header, true, true);
header.hexpand = true;
add(header);
}
public void remove_conversation_header(Gtk.HeaderBar header) {

View file

@ -68,6 +68,10 @@ public class ConversationViewer : Gtk.Stack, Geary.BaseInterface {
public signal void conversation_removed(ConversationListBox list);
static construct {
set_css_name("geary-conversation-viewer");
}
/**
* Constructs a new conversation view instance.
*/

View file

@ -24,13 +24,18 @@
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkPaned" id="conversations_paned">
<object class="HdyLeaflet" id="main_leaflet">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_swipe_back">True</property>
<property name="transition_type">over</property>
<child>
<object class="GtkPaned" id="folder_paned">
<object class="HdyLeaflet" id="conversations_leaflet">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand_set">True</property>
<property name="can_swipe_back">True</property>
<property name="transition_type">over</property>
<child>
<object class="GtkBox" id="folder_box">
<property name="visible">True</property>
@ -40,6 +45,7 @@
<object class="GtkFrame" id="folder_frame">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="vexpand">True</property>
<property name="label_xalign">0</property>
<property name="shadow_type">in</property>
<child>
@ -55,15 +61,26 @@
</style>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
</object>
<packing>
<property name="resize">False</property>
<property name="shrink">False</property>
<property name="name">folder</property>
</packing>
</child>
<child>
<object class="GtkSeparator" id="folder_separator">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<style>
<class name="sidebar"/>
</style>
</object>
<packing>
<property name="navigatable">False</property>
</packing>
</child>
<child>
@ -97,22 +114,27 @@
</child>
</object>
<packing>
<property name="resize">True</property>
<property name="shrink">False</property>
<property name="name">conversations</property>
</packing>
</child>
</object>
<packing>
<property name="name">conversations</property>
</packing>
</child>
<child>
<object class="GtkSeparator" id="conversations_separator">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<style>
<class name="geary-sidebar-pane-separator"/>
</style>
</object>
<packing>
<property name="resize">False</property>
<property name="shrink">False</property>
<property name="navigatable">False</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">True</property>
@ -146,6 +168,9 @@
</object>
<object class="GtkSizeGroup" id="folder_separator_size_group">
<property name="mode">horizontal</property>
<widgets>
<widget name="folder_separator"/>
</widgets>
</object>
<object class="GtkSizeGroup" id="conversations_size_group">
<property name="mode">horizontal</property>
@ -155,6 +180,9 @@
</object>
<object class="GtkSizeGroup" id="conversations_separator_size_group">
<property name="mode">horizontal</property>
<widgets>
<widget name="conversations_separator"/>
</widgets>
</object>
<object class="GtkSizeGroup" id="conversation_size_group">
<property name="mode">horizontal</property>

View file

@ -12,12 +12,23 @@
border-left-width: 0;
border-top-width: 0;
border-right-width: 0;
min-width: 300px;
}
.geary-conversation-frame > border {
border-left-width: 0;
border-top-width: 0;
border-right-width: 0;
min-width: 360px;
}
treeview.sidebar {
border: none;
}
geary-conversation-viewer {
min-width: 360px;
}
/* For 3-pane mode only */
.geary-sidebar-pane-separator.vertical .conversation-frame > border {
border-bottom-width: 0;

View file

@ -7,13 +7,18 @@
<property name="can_focus">False</property>
<property name="icon_name">mail-archive-symbolic</property>
</object>
<template class="MainToolbar" parent="GtkBox">
<template class="MainToolbar" parent="HdyLeaflet">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can_swipe_back">True</property>
<property name="transition_type">over</property>
<child>
<object class="GtkBox">
<object class="HdyLeaflet" id="conversations_leaflet">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can_swipe_back">True</property>
<property name="transition_type">over</property>
<property name="hexpand_set">True</property>
<child>
<object class="GtkHeaderBar" id="folder_header">
<property name="visible">True</property>
@ -41,6 +46,9 @@
</packing>
</child>
</object>
<packing>
<property name="name">folder</property>
</packing>
</child>
<child>
<object class="GtkSeparator" id="folder_separator">
@ -52,15 +60,14 @@
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
<property name="navigatable">False</property>
</packing>
</child>
<child>
<object class="GtkHeaderBar" id="conversations_header">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="show_close_button" bind-source="MainToolbar" bind-property="show_close_button" bind-flags="sync-create"/>
<child>
<object class="GtkButton" id="compose_new_message_button">
@ -102,12 +109,13 @@
</packing>
</child>
</object>
<packing>
<property name="name">conversations</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
<property name="name">conversations</property>
</packing>
</child>
<child>
@ -120,15 +128,14 @@
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
<property name="navigatable">False</property>
</packing>
</child>
<child>
<object class="GtkHeaderBar" id="conversation_header">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="show_close_button" bind-source="MainToolbar" bind-property="show_close_button" bind-flags="sync-create"/>
<child>
<object class="GtkBox" id="reply_forward_buttons">
@ -362,9 +369,7 @@
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
<property name="name">conversation</property>
</packing>
</child>
</template>