Provides Rust bindings for GTK libraries

Overview

gtk3-rs CI

The gtk-rs organization aims to provide safe Rust binding over GObject-based libraries. You can find more about it on https://gtk-rs.org.

This repository contains all the "core" crates of the gtk-rs organization. For more information about each crate, please refer to their README.md file in their directory.

Minimum supported Rust version

Currently, the minimum supported Rust version is 1.51.0.

Documentation

You can see the all the released crates' documentation in one place.

Ecosystem

The gtk3-rs repository contains Rust crates for GTK 3. However there is a large ecosystem of GObject libraries and many of these libraries have Rust bindings based on the tooling included in gtk-rs. Of particular note:

  • gtk-rs-core - bindings for some of the core libraries such as glib, gio, pango, graphene
  • gstreamer-rs - bindings for the GStreamer media framework

Additionally, Rust bindings for various libraries are hosted on GNOME's GitLab instance and can be found at https://gitlab.gnome.org/World/Rust.

When using crates that are not part of the gtk-rs repository, you will need to be careful and ensure that they do not pull in incompatible versions of core crates like glib-rs.

Regenerating

To regenerate crates using gir, please use the generator.py file as follows:

$ python3 generator.py

Development

This repository is mostly split into two branches: master and crate. master contains the not yet released code and is where new developments are happening. crate contains the last release source code and isn't supposed to be updated.

This repository is structured as follows:

- crate/
   |
   |-- README.md
   |-- Gir.toml
   |-- Cargo.toml
   |-- src/
   |-- sys/

The crate is a "top" directory (so "atk" or "gdk" in here for example). Each crate contains:

  • README.md: explanations about the crate itself and eventually some details.
  • Cargo.toml: descriptor of the crate, used by cargo and Rust.
  • Gir.toml: configuration used by gir to generate most of the crates' code.
  • src: the source code of the crate.
  • sys: the 1:1 bindings of the C API.

The gir and gir-files top folders are not crates, but are git submodules which respectively contain the gir tool and the gir files used by the generator.

When running generator.py the tool will automatically update these git submodules and run the gir tool on the gir files to regenerate the code.

During development, it is useful to execute the generator with a different version of the gir tool or of the gir files, for instance to test if the code generation is successful before submitting a pull request to update one of the submodules. This can be done by specifying arguments to the generator script, for instance, to run the generator on a local copy of the gir files:

$ python3 generator.py --gir-files-directory ../gir-files/

See python3 generator.py --help for more details.

Comments
  • All Context functions should return a Result instead of calling expect()

    All Context functions should return a Result instead of calling expect()

    Things have gotten to a point in librsvg where most of the incoming bugs that make the library panic are due to cairo-rs calling expect() on an Err inside the Context methods. (That is, rather than panicking in librsvg itself, something in the drawing calls causes the cr to enter an error state.)

    For example, all of the line_to / move_to / etc. can set the cr to an out-of-memory state if they can't allocate the new command. In theory, they could also set an error state if they detected coordinates outside Cairo's supported range (I intend to look into that soon - Cairo crashes really easily if given coordinates outside ±2^23, and it doesn't do range checking for coordinates).

    I'd like to propose that either all the Context functions return a Result, or that we remove the expect()s and make Context.status() public again.

    One thing librsvg would like to do, for example, is to feed a path to cairo with the move_to, line_to, etc. and just check at the end if there was an error. It would also be fine to catch a result with ? and return as early as possible if there is an error in one of the individual commands.

    Cairo contexts and surfaces have the same "lenient" error checking - they can go into an error state and ignore further API calls, but this is just to help C programs avoid having if (cairo_something(...) != OK) everywhere. We have better language facilities in Rust :smiley:

    Summary:

    • I think just returning a Result instead of calling expect() would let the calling program make the correct choice of what to do upon errors.

    • I think we still want a public way to get the Context's status. One thing librsvg does is to get a *mut cairo_t from the C world, then wraps it in a Context and checks to see if the context is in error - it will g_warning() and return if so, to avoid panicking inside librsvg/cairo-rs.

    opened by federicomenaquintero 32
  • generator: Convert to pathlib, fix wrong path passed to various executables

    generator: Convert to pathlib, fix wrong path passed to various executables

    def_check_submodule was always passing 'gir' even when called with gir-files, and the depth used to derive whether Gir.toml resides in a sys crate is inaccurate when specifying eg. **/sys on the command line (as that'd be level 0).

    In addition, convert path handling to pathlib whose paths are constructed and checked during argument parsing.

    Please double-check if I overlooked a path anywhere that's still a string instead of Path.

    EDIT: With pathlib we might also replace the depth-first search in regen_crates with path.glob or path.rglob on **/Gir*.toml?

    opened by MarijnS95 28
  • ToGlib should take Self

    ToGlib should take Self

    Fixes #410

    Requires https://github.com/gtk-rs/gir/pull/1093

    • [x] gtk4-rs https://github.com/gtk-rs/gtk4-rs/pull/331
    • [x] gstreamer-rs https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/758
    • [x] gst-plugins-rs https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/507
    opened by bilelmoussaoui 23
  • Improve glib::Value usage by merging FromValue/FromValueOptional traits

    Improve glib::Value usage by merging FromValue/FromValueOptional traits

    Currently we have

    pub trait FromValueOptional<'a>: StaticType + Sized {
        unsafe fn from_value_optional(_: &'a Value) -> Option<Self>;
    }
    
    pub trait FromValue<'a>: FromValueOptional<'a> {
        unsafe fn from_value(_: &'a Value) -> Self;
    }
    

    This has the effect that we have

    let v: Option<i32> = value.get::<i32>().unwrap();
    

    while v can never ever be None here. There's get_some() which only exists for FromValue types.

    I would suggest to instead have the following instead of the two traits

    pub trait FromValue<'a> {
        type Target;
        unsafe fn from_value(_: &'a Value) -> Self::Target;
    }
    
    impl<'a> FromValue<'a> for i32 {
        type Target = i32;
    
        unsafe fn from_value(_: &'a Value) -> i32 { ... }
    }
    
    impl<'a> FromValue<'a> for String {
        type Target = Option<String>;
    
        unsafe fn from_value(_: &'a Value) -> Option<String> { ... }
    }
    
    etc.
    

    This would allow this confusion to disappear, get::<i32>() would return i32 and get::<String>() would return Option<String>.

    SetValue and SetValueOptional would stay the same as there this problem doesn't really exist.

    @GuillaumeGomez @EPashkin Opinions?

    opened by sdroege 23
  • Migration

    Migration

    1. find out how to keep each history

      git filter-branch for creating a new branch of each repo where the files are moved into a subdirectory

    2. how the final repository should look like (folder wise) (both folders and repositories:) sys/..., gir-files, atk, cairo, gdk, gdk-pixbuf, gdkx11, gio, glib, graphene, gtk, examples, pango, pangocairo
    3. migrating the CI to github-actions
    4. checking how to keep the "release branches" from the other repositories

      by renaming: glib-0.10, et

    5. update release script
    6. update the crate versions
    7. what about the repositories' issues?

      very likely using a python script to migrate them all

    8. update the crates' git repositories URL
    9. archive old repositories and add a link to the new repository
    10. Add a python script (like the one in gstreamer-rs) to handle regenerations
    opened by GuillaumeGomez 19
  • Split gtk3 crates out of gtk-rs

    Split gtk3 crates out of gtk-rs

    This is a proposal to split the following crates out of the main mono repo and move them to a gtk3-rs repository, similar to the gtk4-rs one.

    • gtk/gtk-sys
    • gdk/gdk-sys
    • gdk-x11/gdkx11-sys
    • gtk3-macros
    • atk/atk-sys
    • maybe in the future through manual bindings: gdk-wayland/gdk-wayland-sys
    • gtk specific examples

    The reasoning behind is that they end up very confusing to the end-user, especially for crates that links to the glib/gio docs and now the user is on a completely different docs source and might get confused of why they can't find something anymore.

    There are various things to think of before doing such change:

    • It would require work splitting the crates and pushing them to a different repository: I sign up for doing the work if there's a consensus reached on whether it makes sense to do so or not

    • What should this repository be renamed to if that ever happens?

    The result post proposal:

    • gtk3-rs contains GTK 3 bindings
    • gtk4-rs contains GTK 4 bindings
    • gobject-rs/whatever-new-name-rs? contains bindings of the base crates used in various GObject based libraries
    question 
    opened by bilelmoussaoui 18
  • Fix gio file constructors names

    Fix gio file constructors names

    WARNING: don't merge as is. Need to update the gir commit.

    Fixes https://github.com/gtk-rs/gtk-rs/issues/502

    Depends on https://github.com/gtk-rs/gir/pull/1126.

    opened by fengalin 17
  • The function Pixbuf::new_from_vec

    The function Pixbuf::new_from_vec

    Trying to use that function, I had a really hard time using and understanding it. What are the meaning of the arguments ? There is no documentation.

    colorspace

    What is it ? For new it is Color space for image. I interpreted it as being the number of colour (red, green, blue) but this is supposed to be n_channels. So I don't have a clue what it truly is.

    I found this on the gdk documentation website :

    The colorspace in which the samples are interpreted.
    Flags: Read / Write / Construct Only
    Default value: GDK_COLORSPACE_RGB
    

    If I understand its value have to be GDK_COLORSPACE_RGB, is it useful to have this as argument ? If it is useful, why not create a Colorspace enum ?

    bits_per_sample

    Since there is this line in the code :

    assert!(bits_per_sample == 8);
    

    There is only one correct value for bits_per_sample. Why not remove it from the argument of the list ?

    row_stride

    I had to go on the gdk documentation to understand what this argument is :

    Distance in bytes between row starts
    

    Should be in the doc !

    Conclusion

    I'd agree to contribute but I don't know how the documentation of this crate is generated. Does regular doc comments works ?

    opened by gbersac 17
  • glib/translate: take advantage of Rust Option & Result types

    glib/translate: take advantage of Rust Option & Result types

    This is the continuation of https://github.com/gtk-rs/glib/pull/718.

    Requires:

    • [x] https://github.com/gtk-rs/gir/pull/977
    • [x] Update gir submodule + Regenerate atk, pango and gtk.
    • [x] https://github.com/gdesmott/system-deps/pull/14
    • [x] Remove patch section.
    opened by fengalin 17
  • Improve null pointer handling

    Improve null pointer handling

    Many parts of this crate's API as well as some of the related ones return Option to handle when a pointer returned from an FFI call is null. Unless the C API documentation says why a returned pointer might be null, it is probably safe to assume that a null pointer means something bad happened and the program shouldn't continue (e.g. allocation failure/OOM). Overuse of Option for little good reason when they would usually prefer to unwrap it anyways pollutes client code and reduces ergonomics.

    gdk 
    opened by abonander 16
  • glib: Can SignalHandlerId implement the Copy trait?

    glib: Can SignalHandlerId implement the Copy trait?

    The relevant bits

    /// The id of a signal that is returned by `connect`.
    #[derive(Debug, Eq, PartialEq)]
    pub struct SignalHandlerId(NonZeroU64);
    
    impl ToGlib for SignalHandlerId {
        type GlibType = c_ulong;
    
        #[inline]
        fn to_glib(&self) -> c_ulong {
            self.0.get() as c_ulong
        }
    }
    
    impl FromGlib<c_ulong> for SignalHandlerId {
        #[inline]
        fn from_glib(val: c_ulong) -> SignalHandlerId {
            assert_ne!(val, 0);
            SignalHandlerId(unsafe { NonZeroU64::new_unchecked(val as u64) })
        }
    }
    

    Since to me seems that SignalHandler is a glorified u64, it could easily implement Copy or at least Clone. Is there any reason it can't implement them, or for more conveniennce to be a u64 directly? Granted, it makes no sense to add or multiply handlers ids, but it would be convenient.

    Context: I just had an issue where I needed to use a RefCell / OnceCell to store this info on a non mutable struc, but later I was not able to run self.disconnect(handler_id) since the type i got from those was &SignalHandlerId and I found no way of getting back the SignalHandlerId from it without calling both from_glib and to_glib to store the internal c_ulong as a u64.

    cc @bilelmoussaoui .

    opened by A6GibKm 15
  • [BUG] Wrong return turn (u32 vs gint) for GtkNotebook append_page

    [BUG] Wrong return turn (u32 vs gint) for GtkNotebook append_page

    Bug description

    Please provide a code sample as small as possible which reproduces the bug.

    Upstream gtk_notebook_append_page returns a gint. In gtk3-rs NotebookExtManual.append_page returns a u32. The documentation says the function will return -1 on error, which is impossible in the rust code.

    bug 
    opened by dvogel 3
  • [BUG] tests/check_gir.rs fails to build

    [BUG] tests/check_gir.rs fails to build

    Bug description Attempting to build also the tests results in error as the trait std::fmt::Display is not impleented.

    Backtrace

    Compiling gtk v0.15.5 (/tmp/guix-build-rust-gtk-0.15.5.drv-0/gtk-0.15.5)
    error[E0277]: `Errors` doesn't implement `std::fmt::Display`
     --> tests/check_gir.rs:6:20
      |
    6 |     println!("{}", res);
      |                    ^^^ `Errors` cannot be formatted with the default formatter
      |
      = help: the trait `std::fmt::Display` is not implemented for `Errors`
      = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
      = note: this error originates in the macro `$crate::format_args_nl` (in Nightly builds, run with -Z macro-backtrace for more info)
    
    For more information about this error, try `rustc --explain E0277`.
    
    bug 
    opened by phodina 0
  • [HELP] Gtk-rs + Windows 10

    [HELP] Gtk-rs + Windows 10

    Hello!

    I try to use gtk-rs on Windows 10 system but have some trouble.

    First - I need to install gtk and follow instructions https://gtk-rs.org/gtk4-rs/stable/latest/book/installation_windows.html

    1. install msys2
    2. pacman -S mingw-w64-x86_64-gtk4 mingw-w64-x86_64-pkgconf mingw-w64-x86_64-gcc
    3. updated environment vars
    C:\msys64\mingw64\include
    C:\msys64\mingw64\bin
    C:\msys64\mingw64\lib
    
    rustup toolchain install stable-gnu
    rustup default stable-gnu
    

    Second - I try gtk example cargo run --bin basics and get access error

    C:\temp\gtk3-rs\examples>cargo run --bin basics
       Compiling glib-sys v0.16.0 (https://github.com/gtk-rs/gtk-rs-core#3a0325e0)
       Compiling gobject-sys v0.16.0 (https://github.com/gtk-rs/gtk-rs-core#3a0325e0)
       Compiling gio-sys v0.16.0 (https://github.com/gtk-rs/gtk-rs-core#3a0325e0)
       Compiling gdk-pixbuf-sys v0.16.0 (https://github.com/gtk-rs/gtk-rs-core#3a0325e0)
       Compiling cairo-sys-rs v0.16.0 (https://github.com/gtk-rs/gtk-rs-core#3a0325e0)
       Compiling atk-sys v0.16.0 (C:\temp\gtk3-rs\atk\sys)
       Compiling pango-sys v0.16.0 (https://github.com/gtk-rs/gtk-rs-core#3a0325e0)
       Compiling gdk-sys v0.16.0 (C:\temp\gtk3-rs\gdk\sys)
    The following warnings were emitted during compilation:
    
    warning: Failed to run command `"C:\\pkg-config-lite-0.28-1\\bin" "--libs" "--cflags" "glib-2.0" "glib-2.0 >= 2.56"`, because: Отказано в доступе. (os error 5)
    
    error: failed to run custom build command for `glib-sys v0.16.0 (https://github.com/gtk-rs/gtk-rs-core#3a0325e0)`
    
    Caused by:
      process didn't exit successfully: `C:\temp\gtk3-rs\target\debug\build\glib-sys-8ba52df866badbdf\build-script-build` (exit code: 1)
      --- stdout
      cargo:rerun-if-env-changed=GLIB_2.0_NO_PKG_CONFIG
      cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-pc-windows-gnu
      cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_pc_windows_gnu
      cargo:rerun-if-env-changed=HOST_PKG_CONFIG
      cargo:rerun-if-env-changed=PKG_CONFIG
      cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-pc-windows-gnu
      cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_pc_windows_gnu
      cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
      cargo:rerun-if-env-changed=PKG_CONFIG_PATH
      cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-pc-windows-gnu
      cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_pc_windows_gnu
      cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
      cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
      cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-pc-windows-gnu
      cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_pc_windows_gnu
      cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
      cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
      cargo:warning=Failed to run command `"C:\\pkg-config-lite-0.28-1\\bin" "--libs" "--cflags" "glib-2.0" "glib-2.0 >= 2.56"`, because: Отказано в доступе. (os error 5)
    warning: build failed, waiting for other jobs to finish...
    The following warnings were emitted during compilation:
    
    warning: Failed to run command `"C:\\pkg-config-lite-0.28-1\\bin" "--libs" "--cflags" "gio-2.0" "gio-2.0 >= 2.56"`, because: Отказано в доступе. (os error 5)
    
    error: failed to run custom build command for `gio-sys v0.16.0 (https://github.com/gtk-rs/gtk-rs-core#3a0325e0)`
    
    Caused by:
      process didn't exit successfully: `C:\temp\gtk3-rs\target\debug\build\gio-sys-8719c2af73cc49c1\build-script-build` (exit code: 1)
      --- stdout
      cargo:rerun-if-env-changed=GIO_2.0_NO_PKG_CONFIG
      cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-pc-windows-gnu
      cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_pc_windows_gnu
      cargo:rerun-if-env-changed=HOST_PKG_CONFIG
      cargo:rerun-if-env-changed=PKG_CONFIG
      cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-pc-windows-gnu
      cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_pc_windows_gnu
      cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
      cargo:rerun-if-env-changed=PKG_CONFIG_PATH
      cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-pc-windows-gnu
      cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_pc_windows_gnu
      cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
      cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
      cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-pc-windows-gnu
      cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_pc_windows_gnu
      cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
      cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
      cargo:warning=Failed to run command `"C:\\pkg-config-lite-0.28-1\\bin" "--libs" "--cflags" "gio-2.0" "gio-2.0 >= 2.56"`, because: Отказано в доступе. (os error 5)
    The following warnings were emitted during compilation:
    
    warning: Failed to run command `"C:\\pkg-config-lite-0.28-1\\bin" "--libs" "--cflags" "gobject-2.0" "gobject-2.0 >= 2.56"`, because: Отказано в доступе. (os error 5)
    
    error: failed to run custom build command for `gobject-sys v0.16.0 (https://github.com/gtk-rs/gtk-rs-core#3a0325e0)`
    
    Caused by:
      process didn't exit successfully: `C:\temp\gtk3-rs\target\debug\build\gobject-sys-418f85813dba6fdd\build-script-build` (exit code: 1)
      --- stdout
      cargo:rerun-if-env-changed=GOBJECT_2.0_NO_PKG_CONFIG
      cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-pc-windows-gnu
      cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_pc_windows_gnu
      cargo:rerun-if-env-changed=HOST_PKG_CONFIG
      cargo:rerun-if-env-changed=PKG_CONFIG
      cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-pc-windows-gnu
      cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_pc_windows_gnu
      cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
      cargo:rerun-if-env-changed=PKG_CONFIG_PATH
      cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-pc-windows-gnu
      cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_pc_windows_gnu
      cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
      cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
      cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-pc-windows-gnu
      cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_pc_windows_gnu
      cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
      cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
      cargo:warning=Failed to run command `"C:\\pkg-config-lite-0.28-1\\bin" "--libs" "--cflags" "gobject-2.0" "gobject-2.0 >= 2.56"`, because: Отказано в доступе. (os error 5)
    The following warnings were emitted during compilation:
    
    warning: Failed to run command `"C:\\pkg-config-lite-0.28-1\\bin" "--libs" "--cflags" "gdk-pixbuf-2.0" "gdk-pixbuf-2.0 >= 2.36.8"`, because: Отказано в доступе. (os error 5)
    
    error: failed to run custom build command for `gdk-pixbuf-sys v0.16.0 (https://github.com/gtk-rs/gtk-rs-core#3a0325e0)`
    
    Caused by:
      process didn't exit successfully: `C:\temp\gtk3-rs\target\debug\build\gdk-pixbuf-sys-e2bccb46f620561d\build-script-build` (exit code: 1)
      --- stdout
      cargo:rerun-if-env-changed=GDK_PIXBUF_2.0_NO_PKG_CONFIG
      cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-pc-windows-gnu
      cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_pc_windows_gnu
      cargo:rerun-if-env-changed=HOST_PKG_CONFIG
      cargo:rerun-if-env-changed=PKG_CONFIG
      cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-pc-windows-gnu
      cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_pc_windows_gnu
      cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
      cargo:rerun-if-env-changed=PKG_CONFIG_PATH
      cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-pc-windows-gnu
      cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_pc_windows_gnu
      cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
      cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
      cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-pc-windows-gnu
      cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_pc_windows_gnu
      cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
      cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
      cargo:warning=Failed to run command `"C:\\pkg-config-lite-0.28-1\\bin" "--libs" "--cflags" "gdk-pixbuf-2.0" "gdk-pixbuf-2.0 >= 2.36.8"`, because: Отказано в доступе. (os error 5)
    The following warnings were emitted during compilation:
    
    warning: Failed to run command `"C:\\pkg-config-lite-0.28-1\\bin" "--libs" "--cflags" "cairo" "cairo >= 1.14"`, because: Отказано в доступе. (os error 5)
    
    error: failed to run custom build command for `cairo-sys-rs v0.16.0 (https://github.com/gtk-rs/gtk-rs-core#3a0325e0)`
    
    Caused by:
      process didn't exit successfully: `C:\temp\gtk3-rs\target\debug\build\cairo-sys-rs-4ef883fd26592a7c\build-script-build` (exit code: 1)
      --- stdout
      cargo:rerun-if-env-changed=CAIRO_NO_PKG_CONFIG
      cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-pc-windows-gnu
      cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_pc_windows_gnu
      cargo:rerun-if-env-changed=HOST_PKG_CONFIG
      cargo:rerun-if-env-changed=PKG_CONFIG
      cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-pc-windows-gnu
      cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_pc_windows_gnu
      cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
      cargo:rerun-if-env-changed=PKG_CONFIG_PATH
      cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-pc-windows-gnu
      cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_pc_windows_gnu
      cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
      cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
      cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-pc-windows-gnu
      cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_pc_windows_gnu
      cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
      cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
      cargo:warning=Failed to run command `"C:\\pkg-config-lite-0.28-1\\bin" "--libs" "--cflags" "cairo" "cairo >= 1.14"`, because: Отказано в доступе. (os error 5)
    error: failed to run custom build command for `gdk-sys v0.16.0 (C:\temp\gtk3-rs\gdk\sys)`
    
    Caused by:
      process didn't exit successfully: `C:\temp\gtk3-rs\target\debug\build\gdk-sys-c402108360d26da8\build-script-build` (exit code: 1)
      --- stdout
      cargo:rerun-if-env-changed=GDK_3.0_NO_PKG_CONFIG
      cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-pc-windows-gnu
      cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_pc_windows_gnu
      cargo:rerun-if-env-changed=HOST_PKG_CONFIG
      cargo:rerun-if-env-changed=PKG_CONFIG
      cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-pc-windows-gnu
      cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_pc_windows_gnu
      cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
      cargo:rerun-if-env-changed=PKG_CONFIG_PATH
      cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-pc-windows-gnu
      cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_pc_windows_gnu
      cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
      cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
      cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-pc-windows-gnu
      cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_pc_windows_gnu
      cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
      cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
    
      --- stderr
      Failed to run command `"C:\\pkg-config-lite-0.28-1\\bin" "--libs" "--cflags" "gdk-3.0" "gdk-3.0 >= 3.22"`, because: Отказано в доступе. (os error 5)
    The following warnings were emitted during compilation:
    
    warning: Failed to run command `"C:\\pkg-config-lite-0.28-1\\bin" "--libs" "--cflags" "atk" "atk >= 2.28"`, because: Отказано в доступе. (os error 5)
    
    error: failed to run custom build command for `atk-sys v0.16.0 (C:\temp\gtk3-rs\atk\sys)`
    
    Caused by:
      process didn't exit successfully: `C:\temp\gtk3-rs\target\debug\build\atk-sys-707da6843218133e\build-script-build` (exit code: 1)
      --- stdout
      cargo:rerun-if-env-changed=ATK_NO_PKG_CONFIG
      cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-pc-windows-gnu
      cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_pc_windows_gnu
      cargo:rerun-if-env-changed=HOST_PKG_CONFIG
      cargo:rerun-if-env-changed=PKG_CONFIG
      cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-pc-windows-gnu
      cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_pc_windows_gnu
      cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
      cargo:rerun-if-env-changed=PKG_CONFIG_PATH
      cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-pc-windows-gnu
      cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_pc_windows_gnu
      cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
      cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
      cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-pc-windows-gnu
      cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_pc_windows_gnu
      cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
      cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
      cargo:warning=Failed to run command `"C:\\pkg-config-lite-0.28-1\\bin" "--libs" "--cflags" "atk" "atk >= 2.28"`, because: Отказано в доступе. (os error 5)
    The following warnings were emitted during compilation:
    
    warning: Failed to run command `"C:\\pkg-config-lite-0.28-1\\bin" "--libs" "--cflags" "pango" "pango >= 1.40"`, because: Отказано в доступе. (os error 5)
    
    error: failed to run custom build command for `pango-sys v0.16.0 (https://github.com/gtk-rs/gtk-rs-core#3a0325e0)`
    
    Caused by:
      process didn't exit successfully: `C:\temp\gtk3-rs\target\debug\build\pango-sys-266559505eef27ed\build-script-build` (exit code: 1)
      --- stdout
      cargo:rerun-if-env-changed=PANGO_NO_PKG_CONFIG
      cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-pc-windows-gnu
      cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_pc_windows_gnu
      cargo:rerun-if-env-changed=HOST_PKG_CONFIG
      cargo:rerun-if-env-changed=PKG_CONFIG
      cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-pc-windows-gnu
      cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_pc_windows_gnu
      cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
      cargo:rerun-if-env-changed=PKG_CONFIG_PATH
      cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-pc-windows-gnu
      cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_pc_windows_gnu
      cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
      cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
      cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-pc-windows-gnu
      cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_pc_windows_gnu
      cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
      cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
      cargo:warning=Failed to run command `"C:\\pkg-config-lite-0.28-1\\bin" "--libs" "--cflags" "pango" "pango >= 1.40"`, because: Отказано в доступе. (os error 5)
    

    and I install pkg-config-lite-0.28-1 in dir C:\pkg-config-lite-0.28-1\bin and the error is repeated.

    What am I doing wrong? What are the correct instructions for installing gtk-rs?

    opened by zvladimir 2
  • FileChooser interface is not implementable

    FileChooser interface is not implementable

    I'm trying to build my own widget and have it implement the GtkFileChooser interface. To my ObjectSubclass impl, I've added:

    type Interfaces = (gtk::FileChooser,);
    

    However, I get the following error:

    error[E0277]: the trait bound `gtk::FileChooser: IsImplementable<file_chooser_widget::imp::BetterFileChooserWidget>` is not satisfied
       --> widget/src/file_chooser_widget.rs:110:27
        |
    110 |         type Interfaces = (gtk::FileChooser,);
        |                           ^^^^^^^^^^^^^^^^^^^ the trait `IsImplementable<file_chooser_widget::imp::BetterFileChooserWidget>` is not implemented for `gtk::FileChooser`
        |
        = note: required because of the requirements on the impl of `InterfaceList<file_chooser_widget::imp::BetterFileChooserWidget>` for `(gtk::FileChooser,)`
    note: required by a bound in `gtk::subclass::prelude::ObjectSubclass::Interfaces`
       --> /home/brian/.cargo/registry/src/github.com-1ecc6299db9ec823/glib-0.15.11/src/subclass/types.rs:549:22
        |
    549 |     type Interfaces: InterfaceList<Self>;
        |                      ^^^^^^^^^^^^^^^^^^^ required by this bound in `gtk::subclass::prelude::ObjectSubclass::Interfaces`
    

    This seems to be correct; I don't see an IsImplementable implementation for FileChooser. There also isn't a FileChooserImpl trait to implement like I'd expect (though there is FileChooserExt, but my -- perhaps incorrect -- understanding is that is for consumers, not subclassers). Am I missing something here, or is this feature not implemented?

    opened by kelnos 6
Releases(0.16.0)
  • 0.15.5(Apr 26, 2022)

    Guillaume Gomez (1):
          Fix windows CI
    
    Paolo Borelli (3):
          subclass support for GtkEntry
          Update gir to the latest 0.15 branch revision
          Regenerate
    
    Sebastian Dröge (5):
          Add rustfmt.toml to allow some editors to auto-format the code on save
          gdkwayland: Fix new clippy warning
          gtk: Fix new clippy warning
          Update versions to 0.15.5
    
    Source code(tar.gz)
    Source code(zip)
  • 0.15.4(Feb 20, 2022)

    Jason Francis (1):
          gtk3-macros: Add doc links to glib/gtk items
    
    Sebastian Dröge (6):
          Handle empty slices correctly
          Update gir-files
          gtk: Remove unnecessary overrides
          Regenerate
          Update versions to 0.15.4
    
    Source code(tar.gz)
    Source code(zip)
  • 0.15.3(Jan 31, 2022)

    Sebastian Dröge (10):
          Update gir
          Regenerate with latest gir
          Update versions to 0.15.3
          Add various 3.24 version overrides
          Add missing version features to Cargo.toml
          Regenerate
          gtk: Add `Atk.Role` to `manual` to generate some more bindings
          gtk: Depend on glib 0.15.3 for `ThreadGuard` API
    
    Source code(tar.gz)
    Source code(zip)
Owner
Bindings and wrappers for gnome libraries
null
Simple GTK Rust Fuzzer which aims to test all available classes and functions in GTK.

Gtk Rust Fuzzer Simple GTK Rust Fuzzer which aims to test all available classes and functions in GTK. It finds bugs inside GTK functions, GTK exported

Rafał Mikrut 8 Nov 19, 2022
Provides Rust bindings for Gnome libraries

gtk-rs-core The gtk-rs organization aims to provide safe Rust binding over GObject-based libraries. You can find more about it on https://gtk-rs.org.

null 174 Dec 26, 2022
Rust bindings and wrappers for GLib, GDK 3, GTK+ 3 and Cairo.

THIS REPOSITORY IS DEPRECATED SEE: https://github.com/rust-gnome rgtk Rust bindings and wrappers for GLib, GDK 3, GTK+ 3 and Cairo. Building rgtk expe

Jeremy Letang 124 Jul 10, 2022
Rust bindings to Core Foundation and other low level libraries on Mac OS X and iOS

core-foundation-rs Compatibility Targets macOS 10.7 by default. To enable features added in macOS 10.8, set Cargo feature mac_os_10_8_features. To hav

Servo 685 Jan 2, 2023
Idiomatic, GTK+-based, GUI library, inspired by Elm, written in Rust

Relm Asynchronous, GTK+-based, GUI library, inspired by Elm, written in Rust. This library is in beta stage: it has not been thoroughly tested and its

null 2.2k Dec 31, 2022
Highly customizable finder with high performance. Written in Rust and uses GTK

Findex Highly customizable finder with high performance. Written in Rust and uses GTK Installation Automatic Binary Clone from https://aur.archlinux.o

MD Gaziur Rahman Noor 442 Jan 1, 2023
A GUI for NordVPN on Linux that maintains feature parity with the official clients, written with Rust and GTK.

Viking for NordVPN This project aims to provide a fully usable and feature-complete graphical interface for NordVPN on Linux. While it attempts to clo

Jacob Birkett 2 Oct 23, 2022
Graphical font editor (GTK + Rust)

gerb *gerb ʰ-: reconstructed Proto-Indo-European root, meaning to carve gerb: a WIP font editor in gtk3 and rust Introduction gerb is an experimental,

Manos Pitsidianakis 40 Jan 1, 2023
A Rust library to parse Blueprint files and convert them into GTK UI files

?? gtk-ui-builder A Rust library to parse Blueprint files and convert them into GTK UI files Inspired by the Blueprint project Example 1 - blueprints

Observer KRypt0n_ 5 Oct 22, 2022
A powerful color picker and formatter, built with GTK and Rust

Eyedropper A powerful color picker and formatter. More screenshots Features Pick a Color Enter a color in Hex-Format Parse RGBA/ARGB Hex-Colors View c

Jonathan 108 Dec 24, 2022
GTK 4 front-end to ChatGPT completions written in Rust

ChatGPT GUI Building git clone [email protected]:teunissenstefan/chatgpt-gui.git cd chatgpt-gui cargo build --release Todo Connect insert_text to only al

Stefan Teunissen 6 Mar 12, 2023
Reactive components in rust, designed to make GTK more manageable

gflux gflux is a tiny experimental reactive component system for rust, designed to make GTK more manageable. gflux: is about 300 lines of code contain

Brian Vincent 3 Aug 20, 2023
An example of searching iBeacon using gtk-rs and btleplug.

Beacon Searcher Screenshot Compile & Run Install GTK 3 dev packages: macOS: $ brew install gtk+3 $ brew install gnome-icon-theme Debian / Ubuntu: $ s

Ling, Wei-Cheng 0 Dec 21, 2021
Test bed for gtk-rs-core experiments

Rust GObject Experiments class macro #[gobject::class(final)] mod obj { #[derive(Default)] pub struct MyObj { #[property(get, set)]

Jason Francis 2 May 28, 2022
Use C++ libraries from Rust

ritual ritual allows to use C++ libraries from Rust. It analyzes the C++ API of a library and generates a fully-featured crate that provides convenien

Rust-Qt 1.1k Jan 5, 2023
Termbox is a library that provides minimalistic API which allows the programmer to write text-based user interfaces.

Termbox is a library that provides minimalistic API which allows the programmer to write text-based user interfaces.

null 1.9k Dec 22, 2022
A tongue-in-cheek GUI that provides similar functionality to GNU cat

catboy a tongue-in-cheek GUI that provides similar functionality to GNU cat information: Attribute Value Development Status: Active Neglect Price: I h

toasterrepairman 2 Feb 9, 2022
Provides core language-agnostic functionality for LiveView Native across platforms

LiveView Native Core This repository contains an implementation of the LiveView Native core library, which is intended to handle all the details which

LiveView Native 35 Dec 27, 2022
Provides event handling for egui in SDL2 window applications.

egui-sdl2-event Provides event handling for egui when SDL2 is used as the windowing system. This crate does not perform any rendering, but it can be c

Valtteri Vallius 8 Feb 15, 2023