37 questions
2
votes
2
answers
524
views
How Having trouble adding a sort function for multiple columns when using the GTK 4 Columnview list model. C coding, a Linux/GNOME enviroment
I'm testing the GTK4 columnview list model for displaying multiple columns. Coding in C. I have that code working (see code below). I am running into trouble adding the standard columnview sort ...
3
votes
1
answer
2k
views
example columnview with strings gtk4 C
I'm making an application on gtk4 and I have a need to display a table with 5 columns. I realized that now the best widget for this would be columnview, I found a small working example but only for ...
6
votes
1
answer
2k
views
How to use eventcontroller in gtk4
I would like to add onclick event handling to a GtkBox widget. I see that only GtkButton has clicked signal, so I feel like the only option is to attach a GtkEventController to my widget.
As per the ...
2
votes
3
answers
2k
views
How can I get user input from an entry? GTK 4 C
I'm trying to get what it's been typed in an entry and store it to afterwards use it elsewhere in my app, but I'm having a hard time trying to figure it out because functions like gtk_entry_get_text() ...
1
vote
2
answers
632
views
Populating dropdown with strings in GTK4
I have a GHashTable whose keys are strings.
GList *keylist = g_hash_table_get_keys (my_hash);
I want to populate a DropDown with the strings in keylist using a model.
In Gtk > DropDown I see ...
0
votes
1
answer
1k
views
GTK 4 drop down signal "activate" not working
I'm trying to setup a drop down button in my GTK application for my user to choose a day, i can create the widget, display it and connect a callback without any error, but the callback function is ...
3
votes
1
answer
546
views
GTK4 ColumnView - Update entire row when changes are made in one cell
How can I get a GTK4 ColumnView to update the entire row when one cell in the row is changed?
The following simple example creates a ColumnView with two columns for a String and the corresponding ...
2
votes
2
answers
381
views
Layout Manager GtkCustomLayout with GTK4 and C
I'm in the process of trying out the different layout managers of GTK4.
I was able to successfully test GtkBinLayout, GtkBoxLayout, GtkCenterLayout and GtkContstraintLayout (see script). However, I ...
2
votes
1
answer
552
views
Passing callback arguments through GTK's g_signal_connect() leads to unexpected values in C
I am working on one small project in C using GTK4 and Miniaudio. I need to pass some arguments through g_signal_connect() to several widgets. Since I am new to GTK, I tried to experiment on a basic ...
1
vote
1
answer
3k
views
GTK 4 Key Press Event Handler
I'm trying to handle a key press event using gtk 4 in c (arrow keys to be specific). Whenever I use some answers from places like here (stackoverflow) and here (stackoverflow) they seem not to work.
...
1
vote
1
answer
117
views
How to get the GtkWindow from G_DEFINE_TYPE declaration
I need to get the GtkWindow or toplevel widget from my G_DEFINE_TYPE:
MyAppWindow.c:
#include "MyAppWindow.h"
struct _MyAppWindow
{
GtkApplicationWindow parent;
};
G_DEFINE_TYPE (...
1
vote
2
answers
680
views
How to Apply CSS to GTK Application Elements Using CSS Selectors
I'm developing a C++ GTK application and I'm trying to implement a dark mode theme using CSS. I've created a style.css file with the necessary styles, but I'm having trouble applying these styles to ...
1
vote
3
answers
178
views
How to rotate cairo circle (volume button) on mouse motion event in gtk4?
I'm trying to create a Volume (Cairo circle) button in gtk4. which can be rotate by mouse motion event. By clicking anywhere on the button and rotating it, the value 1-100 will be output. Tried a lot, ...
1
vote
1
answer
167
views
How to set background color of selected text of GtkText widget with css?
I am facing issue to set background color of selected text in GtkText widget. I tried this way, but it didn't work!
can anybody check it ? --
static const char *css =
".one text.selection {"
...
0
votes
1
answer
905
views
How to show a Right click context menu on Gtk4?
I am trying to create a context menu, which will show in the Gtk4 window on mouse right click. In case of Gtk3 i used gtk_menu_popup_at_pointer(GTK_MENU(popup), event) function to show context menu, ...
0
votes
1
answer
786
views
How to correctly pass a struct to g_signal_connect in GTK4 in C?
I'm trying to pass the address of a struct to the gpointer data argument of g_signal_connect such that the callback function can print the int members of the struct when a button is clicked. I'm new ...
0
votes
1
answer
422
views
I would like to write a simple popup contextual menu with C langage using GTK4. I did that with GTK3 but I am lost with hje way to do with GTK4
Here is an extract of GTK3 code. I would like the translation with GTK4.
GtkWidget *menu, *item1, *item2, *item3;
menu = gtk_menu_new();
item1 = gtk_menu_item_new_with_label("Item 1");...
0
votes
2
answers
441
views
CSS Styles not applied in GTK4 C language
I am trying to add colors to the 2 buttons in gtk4 GUI written in c language. From the docs, I have found functions to load and set the css class name for 2 buttons. But for some reason the styles are ...
0
votes
1
answer
137
views
Why does gtk3 call the ClosureNotify function in the example code, but gkt4 doesn't?
When this example program
#include <gtk/gtk.h>
static void draw_func(
GtkDrawingArea* drawing_area,
cairo_t *cr,
#ifdef GTK3
#else
int width,
int height,
#endif
gpointer user_data
) {
...