Skip to content

Commit

Permalink
Some UI changes to usability improve
Browse files Browse the repository at this point in the history
  • Loading branch information
lainsce committed Oct 1, 2023
1 parent 4c3eeb1 commit 20023bf
Show file tree
Hide file tree
Showing 3 changed files with 95 additions and 71 deletions.
140 changes: 71 additions & 69 deletions data/ui/contentview.ui
Original file line number Diff line number Diff line change
@@ -1,38 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk" version="4.0"/>
<menu id="menu">
<section>
<item>
<attribute name="label" translatable="true">Settings…</attribute>
<attribute name="action">win.action_prefs</attribute>
</item>
<item>
<attribute name="label" translatable="true">About Enigma</attribute>
<attribute name="action">win.action_about</attribute>
</item>
</section>
</menu>
<template class="EnigmaContentView" parent="HeBin">
<property name="hexpand">true</property>
<child>
<object class="GtkBox" id="main_box">
<property name="orientation">vertical</property>
<child>
<object class="HeAppBar" id="title">
<property name="show-buttons">true</property>
<property name="show-buttons">false</property>
<property name="show-back">false</property>
<child>
<object class="GtkMenuButton" id="menu_button">
<property name="icon-name">open-menu-symbolic</property>
<property name="menu-model">menu</property>
</object>
</child>
<child>
<object class="GtkToggleButton" id="search_button">
<property name="icon-name">system-search-symbolic</property>
</object>
</child>
</object>
</child>
<child>
Expand All @@ -44,57 +21,82 @@
<property name="margin-top">6</property>
<property name="margin-bottom">6</property>
<signal name="search-changed" handler="on_search_activate"/>
<style>
<class name="text-field" />
<class name="search" />
<class name="outline" />
</style>
</object>
</child>
<child>
<object class="GtkScrolledWindow">
<child>
<object class="GtkSourceView" id="textbox">
<property name="vexpand">true</property>
<property name="hexpand">true</property>
<property name="wrap-mode">word</property>
<property name="left-margin">18</property>
<property name="right-margin">18</property>
<property name="top-margin">18</property>
<property name="bottom-margin">18</property>
<property name="pixels-above-lines">3</property>
<property name="pixels-inside-wrap">3</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkBox" id="vim_status_bar">
<property name="margin-start">6</property>
<property name="margin-end">6</property>
<property name="spacing">6</property>
<property name="visible">0</property>
<property name="css-classes">vim-status-bar</property>
<child>
<object class="GtkLabel" id="command_bar">
<property name="halign">start</property>
</object>
</child>
<object class="GtkOverlay">
<child>
<object class="GtkLabel" id="command_text">
<property name="halign">end</property>
<property name="hexpand">1</property>
<property name="ellipsize">end</property>
<object class="GtkBox">
<property name="orientation">vertical</property>
<child>
<object class="GtkScrolledWindow">
<child>
<object class="GtkSourceView" id="textbox">
<property name="vexpand">true</property>
<property name="hexpand">true</property>
<property name="wrap-mode">word</property>
<property name="left-margin">18</property>
<property name="right-margin">18</property>
<property name="top-margin">18</property>
<property name="bottom-margin">18</property>
<property name="pixels-above-lines">3</property>
<property name="pixels-inside-wrap">3</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkBox" id="vim_status_bar">
<property name="margin-start">6</property>
<property name="margin-end">6</property>
<property name="spacing">6</property>
<property name="visible">0</property>
<property name="css-classes">vim-status-bar</property>
<child>
<object class="GtkLabel" id="command_bar">
<property name="halign">start</property>
</object>
</child>
<child>
<object class="GtkLabel" id="command_text">
<property name="halign">end</property>
<property name="hexpand">1</property>
<property name="ellipsize">end</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="HeBottomBar">
<property name="collapse_actions">0</property>
<child>
<object class="HeIconicButton" id="open_button">
<property name="icon-name">document-open-symbolic</property>
</object>
</child>
<child>
<object class="HeIconicButton" id="save_as_button">
<property name="icon">document-save-as-symbolic</property>
<child type="overlay">
<object class="HeBottomBar">
<property name="collapse_actions">0</property>
<property name="valign">end</property>
<child type="left">
<object class="HeIconicButton" id="open_button">
<property name="icon-name">document-open-symbolic</property>
</object>
</child>
<child type="left">
<object class="HeIconicButton" id="save_as_button">
<property name="icon">document-save-as-symbolic</property>
</object>
</child>
<child type="right">
<object class="GtkToggleButton" id="search_button">
<property name="icon-name">system-search-symbolic</property>
<property name="valign">center</property>
<style>
<class name="flat" />
<class name="iconic-button" />
</style>
</object>
</child>
</object>
</child>
</object>
Expand Down
22 changes: 20 additions & 2 deletions data/ui/main_window.ui
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk" version="4.0"/>
<menu id="menu">
<section>
<item>
<attribute name="label" translatable="true">Settings…</attribute>
<attribute name="action">win.action_prefs</attribute>
</item>
<item>
<attribute name="label" translatable="true">About Enigma</attribute>
<attribute name="action">win.action_about</attribute>
</item>
</section>
</menu>
<object class="GtkSingleSelection" id="selection_model">
<property name="autoselect">no</property>
<property name="can-unselect">yes</property>
Expand Down Expand Up @@ -39,8 +51,14 @@
</property>
<property name="has-margins">0</property>
<property name="show-back">0</property>
<property name="show-buttons">0</property>
<property name="width-request">250</property>
<property name="show-buttons">1</property>
<property name="width-request">213</property>
<child type="titlebar-button">
<object class="GtkMenuButton" id="menu_button">
<property name="icon-name">open-menu-symbolic</property>
<property name="menu-model">menu</property>
</object>
</child>
<child>
<object class="HeOverlayButton" id="new_button">
<property name="tooltip-text" translatable="yes">New File</property>
Expand Down
4 changes: 4 additions & 0 deletions src/MainWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ namespace Enigma {
public unowned Sidebar sidebar;
[GtkChild]
public unowned ContentView doccontent;
[GtkChild]
public unowned Gtk.MenuButton menu_button;

public SimpleActionGroup actions { get; construct; }
public const string ACTION_PREFIX = "win.";
Expand Down Expand Up @@ -80,6 +82,8 @@ namespace Enigma {
this.set_size_request (360, 360);
this.show ();
this.mw = (MainWindow) app.get_active_window ();

menu_button.get_popover ().has_arrow = false;
}

[GtkCallback]
Expand Down

0 comments on commit 20023bf

Please sign in to comment.