Questions tagged [gtk4]
194 questions
6
votes
0 answers
Create a menubar for GTK 2.24 and GTK 3 and GTK 4
GTK 4 will remove GtkMenu, GtkMenuBar and GtkMenuItem. Why not, but, is there a common way to create a classic menubar for GTK 2.24 and GTK 3 and GTK 4 in C?
An example:

luigifab
- 384
- 3
- 19
5
votes
1 answer
How to build a tree in GTK4 (>= 4.10)
As the document said, TreeView in GTK4 has been deprecated since 4.10. The recommended replacement for it is ColumnView. However, I can't find clear documentation or example about how to build a treeView-like widget in GTK4 by ColumnView.
I found…

Dorbmon
- 115
- 1
- 5
4
votes
1 answer
How do I use mouse button events with gtk4-rs?
I'm trying to capture up a right click event on a TreeView I have in my application using Rust and gtk4-rs. I don't see a specific EventController for mouse buttons events. I do see EventControllers for things like keyboard presses and motion…

Aaron Cirillo
- 55
- 1
- 6
4
votes
1 answer
GTK4 Image Which Fills Parent
I am trying to create an image which fills its parent widget in both dimensions while keeping the aspect ratio. In gtk4-rs I did
let picture_widget = gtk::Picture::builder()
.hexpand(true)
.vexpand(true)
.halign(gtk::Align::Fill)
…

LiterallyCode
- 135
- 7
4
votes
1 answer
Creating a simple menubar, menu and menu item in C using GTK4
I created a simple C application using GTK4 that has a window, a menubar, a menu, and a menu item. I would like the menu to read "File" and the menu item underneath File to read "Connect". How can I code the menus and menubar so that I have a menu…

ktm5124
- 11,861
- 21
- 74
- 119
4
votes
0 answers
How to get X Window belonging to a GtkDrawingArea in gtk4?
I was trying to port GUI integration tutorial of gstreamer(https://gstreamer.freedesktop.org/documentation/tutorials/basic/toolkit-integration.html?gi-language=c) from gtk3 to gtk4. I am hitting an issue with getting the X window belonging to…

tpnsharma
- 81
- 6
3
votes
1 answer
How to display chart generated in pbPlots library inside a GTK Image widget?
I want to display chart inside my GTK4 application. I'm mixing C GTK with C++ library pbPlots and rest of the code. Unfortunately I get some garbage image.
Vast majority of chart generation example codes is not compatible with GTK4. Writing image…

Radosław Ziomber
- 41
- 3
3
votes
0 answers
GTK3: how to subscribe to touchpad events?
I have tried to subscribe to touch events as:
g_signal_connect (G_OBJECT(hw), "touch-event", G_CALLBACK (gw_touch_event), pview);
but my gw_touch_event callback function is never called. Is it only for touch screens?
Question: how to receive…

c-smile
- 26,734
- 7
- 59
- 86
3
votes
0 answers
Unable to Get Application Icons to Display with GTK4 under Ubuntu
Recent articles about GTK4 detail the changes required for displaying application icons. This article in particular is very helpful in explaining how to deploy desktop files and icons.
I am seeing an issue where the application icons display…

CSquared
- 31
- 2
3
votes
0 answers
How to implement a custom gtk::TreeModel in rust?
I am creating a gtk4 + rust based application that will show a TreeView widget to display parent/child relationships. I have used the TreeStore to populate the TreeView but have not been able to find examples of using a custom TreeModel to populate…

ferd tomale
- 845
- 7
- 20
3
votes
1 answer
How to bind a key press to a speccific action in GTK4?
This is an example from here:
import gi
gi.require_version("Gtk", "4.0")
from gi.repository import Gtk
def on_activate(app):
win = Gtk.ApplicationWindow(application=app)
btn = Gtk.Button(label="Hello, World!")
btn.connect('clicked',…

caveman
- 422
- 3
- 17
3
votes
1 answer
ERROR: Current directory is not a meson build directory
I have been trying to install gtk4 on Windows 10, following the instructions from this site: https://www.collabora.com/news-and-blog/blog/2021/03/18/build-and-run-gtk-4-applications-with-visual-studio/.
After setting up the meson build with the…

Dzenita Dzafic
- 31
- 2
3
votes
1 answer
How to attach a gtk4 PopoverMenu to a parent widget?
This should be a no-brainer but I just can't seem to figure it out. If I build a Gtk.PopoverMenu:
menu = Gio.Menu.new()
test = Gio.MenuItem.new(label='test', detailed_action='win.test')
menu.append_item(test)
popup =…

Andrej Prsa
- 551
- 3
- 14
3
votes
1 answer
Trouble getting gtkmm-4.0 to work on macOS Monterey
I'm having trouble getting gtkmm-4.0 to work on Mac OS Monterey.
Here is a simple C++ application that uses gtkmm4.
// helloworld.cpp
#include
class MyWindow : public Gtk::Window
{
public:
MyWindow();
};
MyWindow::MyWindow()
{
…

ktm5124
- 11,861
- 21
- 74
- 119
3
votes
0 answers
.pack_start() not working with gtk-rs Box
In the following code using gtk-rs I continuously get the error "method cannot be called on gtk4::Box due to unsatisfied trait bounds" for "hbox.pack_start". I have seen this method working in other gtk-rs applications and in the documentation, so…

Ricky Kresslein
- 372
- 1
- 13