merge newapi

Mon, 07 Oct 2024 23:26:52 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Mon, 07 Oct 2024 23:26:52 +0200
branch
newapi
changeset 329
08ce6680d1cf
parent 328
059cba080ab4 (current diff)
parent 327
216d8912714c (diff)
child 330
d615aa36c98e

merge

--- a/ui/gtk/image.c	Mon Oct 07 23:26:30 2024 +0200
+++ b/ui/gtk/image.c	Mon Oct 07 23:26:52 2024 +0200
@@ -117,7 +117,7 @@
 }
 
 UiIcon* ui_fileicon(size_t size) {
-    return ui_icon("application-x-generic", size);
+    return ui_icon("file", size);
 }
 
 UiIcon* ui_icon_unscaled(const char *name, int size) {
--- a/ui/gtk/list.c	Mon Oct 07 23:26:30 2024 +0200
+++ b/ui/gtk/list.c	Mon Oct 07 23:26:52 2024 +0200
@@ -114,20 +114,24 @@
                     case UI_ICON_TEXT_FREE: {
                         UiIcon *icon = data;
 #if GTK_MAJOR_VERSION >= 4
-                        GValue iconvalue = G_VALUE_INIT;
-                        g_value_init(&iconvalue, G_TYPE_OBJECT);
-                        g_value_set_object(&iconvalue, ui_icon_pixbuf(icon));
-                        gtk_list_store_set_value(store, &iter, c, &iconvalue);
+                        if(icon) {
+                            GValue iconvalue = G_VALUE_INIT;
+                            g_value_init(&iconvalue, G_TYPE_OBJECT);
+                            g_value_set_object(&iconvalue, ui_icon_pixbuf(icon));
+                            gtk_list_store_set_value(store, &iter, c, &iconvalue);
+                        }
 #else
                         GValue pixbufvalue = G_VALUE_INIT;
-                        if(!icon->pixbuf && icon->info) {
-                            GError *error = NULL;
-                            GdkPixbuf *pixbuf = gtk_icon_info_load_icon(icon->info, &error);
-                            icon->pixbuf = pixbuf;
+                        if(icon) {
+                            if(!icon->pixbuf && icon->info) {
+                                GError *error = NULL;
+                                GdkPixbuf *pixbuf = gtk_icon_info_load_icon(icon->info, &error);
+                                icon->pixbuf = pixbuf;
+                            }
+                            g_value_init(&pixbufvalue, G_TYPE_OBJECT);
+                            g_value_set_object(&pixbufvalue, icon->pixbuf);
+                            gtk_list_store_set_value(store, &iter, c, &pixbufvalue);
                         }
-                        g_value_init(&pixbufvalue, G_TYPE_OBJECT);
-                        g_value_set_object(&pixbufvalue, icon->pixbuf);
-                        gtk_list_store_set_value(store, &iter, c, &pixbufvalue);
 #endif
                         c++;
                         
--- a/ui/gtk/text.c	Mon Oct 07 23:26:30 2024 +0200
+++ b/ui/gtk/text.c	Mon Oct 07 23:26:52 2024 +0200
@@ -709,9 +709,9 @@
     UiPathTextField *pathtf = event->customdata1;
     for(int i=0;i<event->value1;i++) {
         if(i <= event->value0) {
-            gtk_widget_remove_css_class(pathtf->current_path_buttons[i], "pathbar-button-inactive");
+            WIDGET_REMOVE_CSS_CLASS(pathtf->current_path_buttons[i], "pathbar-button-inactive");
         } else {
-            gtk_widget_add_css_class(pathtf->current_path_buttons[i], "pathbar-button-inactive");
+            WIDGET_ADD_CSS_CLASS(pathtf->current_path_buttons[i], "pathbar-button-inactive");
         }
     }
     
--- a/ui/gtk/toolkit.h	Mon Oct 07 23:26:30 2024 +0200
+++ b/ui/gtk/toolkit.h	Mon Oct 07 23:26:52 2024 +0200
@@ -65,6 +65,7 @@
 #define SCROLLEDWINDOW_SET_CHILD(sw, child) gtk_scrolled_window_set_child(GTK_SCROLLED_WINDOW(sw), child)
 #define SCROLLEDWINDOW_GET_CHILD(sw) gtk_scrolled_window_get_child(GTK_SCROLLED_WINDOW(sw))
 #define WIDGET_ADD_CSS_CLASS(w, cssclass) gtk_widget_add_css_class(w, cssclass)
+#define WIDGET_REMOVE_CSS_CLASS(w, cssclass) gtk_widget_remove_css_class(w, cssclass)
 #else
 #define WINDOW_SHOW(window) gtk_widget_show_all(window)
 #define WINDOW_DESTROY(window) gtk_widget_destroy(window)
@@ -76,6 +77,7 @@
 #define SCROLLEDWINDOW_SET_CHILD(sw, child) gtk_container_add(GTK_CONTAINER(sw), child)
 #define SCROLLEDWINDOW_GET_CHILD(sw) gtk_bin_get_child(GTK_BIN(sw))
 #define WIDGET_ADD_CSS_CLASS(w, cssclass) gtk_style_context_add_class(gtk_widget_get_style_context(w), cssclass)
+#define WIDGET_REMOVE_CSS_CLASS(w, cssclass) gtk_style_context_remove_class(gtk_widget_get_style_context(w), cssclass)
 #endif
     
 #ifdef UI_GTK2

mercurial