From 26ebf5a3cb4e256d0d68addcf5faee7a4b0a4186 Mon Sep 17 00:00:00 2001 From: MeexReay Date: Wed, 16 Apr 2025 14:30:14 +0300 Subject: [PATCH] da --- Cargo.toml | 2 +- shell.nix | 18 ++++++++++++++++++ src/chat/gtk_gui.rs | 9 +++------ 3 files changed, 22 insertions(+), 7 deletions(-) create mode 100644 shell.nix diff --git a/Cargo.toml b/Cargo.toml index 199c9a4..558e582 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,7 +18,7 @@ gtk4 = { version = "0.9.6", optional = true } cfg-if = "1.0.0" [features] -default = ["ssl", "homedir", "pretty_tui"] +default = ["ssl", "homedir", "gtk_gui"] ssl = ["dep:native-tls"] pretty_tui = ["dep:crossterm"] gtk_gui = ["dep:gtk4"] diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..30a1dbe --- /dev/null +++ b/shell.nix @@ -0,0 +1,18 @@ +{ pkgs ? import {} }: + let + devDeps = with pkgs; [ + pkg-config + openssl + gtk4 + pango + ]; + in pkgs.mkShell { + shellHook = '' + export RUST_SRC_PATH=${pkgs.rustPlatform.rustLibSrc} + ''; + buildInputs = devDeps; + nativeBuildInputs = with pkgs; [ + rustc + cargo + ] ++ devDeps; + } \ No newline at end of file diff --git a/src/chat/gtk_gui.rs b/src/chat/gtk_gui.rs index f65d0f3..8d3d37e 100644 --- a/src/chat/gtk_gui.rs +++ b/src/chat/gtk_gui.rs @@ -4,10 +4,11 @@ use std::time::Duration; use colored::{Color, Colorize}; use gtk4::gdk::Display; use gtk4::gdk_pixbuf::PixbufLoader; +use gtk4::gio::MenuModel; use gtk4::glib::clone::Downgrade; use gtk4::glib::{idle_add_local, idle_add_local_once, ControlFlow, source::timeout_add_local_once}; use gtk4::{glib, glib::clone, Align, Box as GtkBox, Label, ScrolledWindow}; -use gtk4::{CssProvider, Entry, Orientation, Overlay, Picture}; +use gtk4::{CssProvider, Entry, Orientation, Overlay, Picture, PopoverMenuBar}; use gtk4::prelude::*; use gtk4::{Application, ApplicationWindow, Button}; use std::sync::mpsc::{channel, Sender, Receiver}; @@ -87,11 +88,6 @@ pub fn recv_tick(ctx: Arc) -> Result<(), Box> { fn build_ui(ctx: Arc, app: &Application) { let main_box = GtkBox::new(Orientation::Vertical, 5); - main_box.set_margin_bottom(5); - main_box.set_margin_end(5); - main_box.set_margin_start(5); - main_box.set_margin_top(5); - let chat_box = GtkBox::new(Orientation::Vertical, 2); let chat_scrolled = ScrolledWindow::builder() @@ -195,6 +191,7 @@ fn build_ui(ctx: Arc, app: &Application) { .default_height(500) .resizable(false) .decorated(true) + .show_menubar(true) .child(&overlay) .build();