[gtk/widgetfactory-async-load: 4/4] Move GtkLoader to gtk4-widget-factory
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/widgetfactory-async-load: 4/4] Move GtkLoader to gtk4-widget-factory
- Date: Wed, 22 Sep 2021 03:11:13 +0000 (UTC)
commit 7daa07f80b77fa5cd071d640fb90d671790d861e
Author: Matthias Clasen <mclasen redhat com>
Date: Tue Sep 21 23:04:33 2021 -0400
Move GtkLoader to gtk4-widget-factory
And use it to load the jpegs in the background.
demos/widget-factory/meson.build | 2 +-
demos/widget-factory/widget-factory.c | 2 ++
demos/widget-factory/widget-factory.ui | 18 +++++++++++++++---
3 files changed, 18 insertions(+), 4 deletions(-)
---
diff --git a/demos/widget-factory/meson.build b/demos/widget-factory/meson.build
index 1cebd4adc5..6b09db3e2b 100644
--- a/demos/widget-factory/meson.build
+++ b/demos/widget-factory/meson.build
@@ -6,7 +6,7 @@ widgetfactory_resources = gnome.compile_resources('widgetfactory_resources',
)
executable('gtk4-widget-factory',
- sources: ['widget-factory.c', widgetfactory_resources],
+ sources: ['widget-factory.c', 'gtkloader.c', widgetfactory_resources],
c_args: common_cflags,
dependencies: [ libgtk_dep, demo_conf_h ],
include_directories: confinc,
diff --git a/demos/widget-factory/widget-factory.c b/demos/widget-factory/widget-factory.c
index 0c4b21c81c..c18b502bcf 100644
--- a/demos/widget-factory/widget-factory.c
+++ b/demos/widget-factory/widget-factory.c
@@ -26,6 +26,7 @@
#include <gtk/gtk.h>
#include "demo_conf.h"
+#include "gtkloaderprivate.h"
static void
change_dark_state (GSimpleAction *action,
@@ -2054,6 +2055,7 @@ activate (GApplication *app)
GtkEventController *controller;
g_type_ensure (my_text_view_get_type ());
+ g_type_ensure (gtk_loader_get_type ());
provider = gtk_css_provider_new ();
gtk_css_provider_load_from_resource (provider, "/org/gtk/WidgetFactory4/widget-factory.css");
diff --git a/demos/widget-factory/widget-factory.ui b/demos/widget-factory/widget-factory.ui
index 1f2258d06d..b7a6ee442f 100644
--- a/demos/widget-factory/widget-factory.ui
+++ b/demos/widget-factory/widget-factory.ui
@@ -1251,7 +1251,11 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<object class="GtkNotebookPage">
<property name="child">
<object class="GtkPicture">
- <property
name="file">resource:///org/gtk/WidgetFactory4/sunset.jpg</property>
+ <property name="paintable">
+ <object class="GtkLoader">
+ <property
name="resource">/org/gtk/WidgetFactory4/sunset.jpg</property>
+ </object>
+ </property>
<child>
<object class="GtkDragSource">
<property name="actions">copy</property>
@@ -1278,7 +1282,11 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<object class="GtkNotebookPage">
<property name="child">
<object class="GtkPicture">
- <property
name="file">resource:///org/gtk/WidgetFactory4/nyc.jpg</property>
+ <property name="paintable">
+ <object class="GtkLoader">
+ <property name="resource">/org/gtk/WidgetFactory4/nyc.jpg</property>
+ </object>
+ </property>
<child>
<object class="GtkDragSource">
<property name="actions">copy</property>
@@ -1305,7 +1313,11 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<object class="GtkNotebookPage">
<property name="child">
<object class="GtkPicture">
- <property
name="file">resource:///org/gtk/WidgetFactory4/beach.jpg</property>
+ <property name="paintable">
+ <object class="GtkLoader">
+ <property
name="resource">/org/gtk/WidgetFactory4/beach.jpg</property>
+ </object>
+ </property>
<child>
<object class="GtkDragSource">
<property name="actions">copy</property>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]