Use constants for icon size

This commit is contained in:
daa84 2017-03-09 11:44:22 +03:00
parent c3d30177b1
commit 2fe5b0a249
4 changed files with 9 additions and 2 deletions

1
Cargo.lock generated
View File

@ -9,6 +9,7 @@ dependencies = [
"glib 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"glib-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"gtk 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"gtk-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"neovim-lib 0.2.0 (git+https://github.com/daa84/neovim-lib)",
"pango 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"pangocairo 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",

View File

@ -26,3 +26,7 @@ phf_codegen = "0.7"
version = "0.1"
features = ["v3_10"]
[dependencies.gtk-sys]
version = "0.3"
features = ["v3_10"]

View File

@ -1,4 +1,5 @@
extern crate gtk;
extern crate gtk_sys;
extern crate gio;
extern crate gdk;
extern crate gdk_sys;

View File

@ -10,6 +10,7 @@ use pango::FontDescription;
use gtk;
use gtk::prelude::*;
use gtk::{ApplicationWindow, HeaderBar, DrawingArea, ToolButton, Image};
use gtk_sys;
use gdk::{ModifierType, Event, EventKey, EventConfigure, EventButton, EventMotion, EventType};
use gdk_sys;
use glib;
@ -95,12 +96,12 @@ impl Ui {
pub fn init(&mut self, app: &gtk::Application) {
self.header_bar.set_show_close_button(true);
let save_image = Image::new_from_icon_name("document-save", 50);
let save_image = Image::new_from_icon_name("document-save", gtk_sys::GTK_ICON_SIZE_SMALL_TOOLBAR as i32);
let save_btn = ToolButton::new(Some(&save_image), None);
save_btn.connect_clicked(|_| edit_save_all());
self.header_bar.pack_start(&save_btn);
let paste_image = Image::new_from_icon_name("edit-paste", 50);
let paste_image = Image::new_from_icon_name("edit-paste", gtk_sys::GTK_ICON_SIZE_SMALL_TOOLBAR as i32);
let paste_btn = ToolButton::new(Some(&paste_image), None);
paste_btn.connect_clicked(|_| edit_paste());
self.header_bar.pack_start(&paste_btn);