diff options
author | Jeremias Stotter <jeremias@stotter.eu> | 2023-10-15 20:18:52 +0200 |
---|---|---|
committer | Jeremias Stotter <jeremias@stotter.eu> | 2023-10-15 20:18:52 +0200 |
commit | a8fe00b137dc473e7a707123828deaafc92b5e59 (patch) | |
tree | 54abe016b1f5b449d178a8b1922bbff7fa70a5aa | |
parent | 497e5a212012ab73cf80f1877af581d1a69a6849 (diff) | |
download | network-simulator-a8fe00b137dc473e7a707123828deaafc92b5e59.tar.gz network-simulator-a8fe00b137dc473e7a707123828deaafc92b5e59.tar.bz2 network-simulator-a8fe00b137dc473e7a707123828deaafc92b5e59.zip |
Use gtk 4.12
-rw-r--r-- | gui.c | 8 | ||||
-rw-r--r-- | readme.html | 2 | ||||
-rw-r--r-- | shared.h | 3 | ||||
-rw-r--r-- | template.c | 2 |
4 files changed, 8 insertions, 7 deletions
@@ -1614,9 +1614,9 @@ void activate_main_window(GtkApplication* app, gpointer user_data) { window = gtk_application_window_new(app); // Needed for gui_packet GtkCssProvider* css_prov = gtk_css_provider_new(); - gtk_css_provider_load_from_data(css_prov, ".frame_no_left { border-left-style: dotted; }\n\ + gtk_css_provider_load_from_string(css_prov, ".frame_no_left { border-left-style: dotted; }\n\ .frame_no_right { border-right-style: dotted; }\n\ -.data_frame { border-radius: 0px; border-width: 2px; margin: -1px; }", -1); +.data_frame { border-radius: 0px; border-width: 2px; margin: -1px; }"); gtk_style_context_add_provider_for_display(gdk_display_get_default(), GTK_STYLE_PROVIDER(css_prov), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); @@ -1755,7 +1755,7 @@ void activate_main_window(GtkApplication* app, gpointer user_data) { gtk_box_set_homogeneous(GTK_BOX(device_template_box), true); gtk_widget_set_valign(device_template_box, GTK_ALIGN_CENTER); - GtkWidget* device_template_icon = gtk_image_new_from_pixbuf(device_templates[i].icon); + GtkWidget* device_template_icon = gtk_image_new_from_file(device_templates[i].icon_path); gtk_image_set_pixel_size(GTK_IMAGE(device_template_icon), device_templates[i].icon_size); GtkWidget* device_template_label = gtk_label_new(device_templates[i].name); @@ -1797,7 +1797,7 @@ void activate_main_window(GtkApplication* app, gpointer user_data) { color = color << 8; } gdk_pixbuf_fill(connection_icon, color); - GtkWidget* connection_template_icon = gtk_image_new_from_pixbuf(connection_icon); + GtkWidget* connection_template_icon = gtk_image_new_from_paintable(GDK_PAINTABLE(gdk_texture_new_for_pixbuf(connection_icon))); GtkWidget* connection_template_label = gtk_label_new(connection_templates[i].name); gtk_box_append(GTK_BOX(connection_template_box), connection_template_icon); diff --git a/readme.html b/readme.html index 1159b1b..7f73367 100644 --- a/readme.html +++ b/readme.html @@ -11,7 +11,7 @@ <ul> <li>emacs with ede (releases will contain a Makefile)</li> <li>A C compiler</li> -<li>GTK4 and its dependecies</li> +<li>GTK 4.12 and its dependecies</li> <li>lua 5.4</li> <li>json-c</li> <li>pkg-config</li> @@ -86,7 +86,8 @@ struct dev_template { char** interfaces; // The code of the device loaded in memory const char* kernel; - // A pixbuf containing the icon of this template + // The path of the icon + char* icon_path; GdkPixbuf* icon; // The size of the icon in pixels int icon_size; @@ -193,7 +193,7 @@ int parse_templates(char* in_template_dir_name) { // Open the icon this_template->icon = gdk_pixbuf_new_from_file(icon_filename, NULL); - free(icon_filename); + this_template->icon_path = icon_filename; } else { fprintf(stderr, "Couldn't read icon field in device json %s\n", template_json_path); } |