[gnome-logs/wip/cdavis/adwapplication] application: Subclass AdwApplication
- From: Christopher Davis <christopherdavis src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-logs/wip/cdavis/adwapplication] application: Subclass AdwApplication
- Date: Sat, 16 Jul 2022 09:42:29 +0000 (UTC)
commit c670140eadba7d2d736624afede5956e8048ed08
Author: Christopher Davis <christopherdavis gnome org>
Date: Sat Jul 16 05:40:06 2022 -0400
application: Subclass AdwApplication
AdwApplication automatically loads CSS from our resource
path, allowing us to cut out our own code for it.
This requires renaming the CSS file. In addition, we
previously had the CSS file in a `web_files ()` object
that we never used, so that was removed too.
data/meson.build | 9 ---------
data/org.gnome.Logs.gresource.xml | 2 +-
data/{gl-style.css => style.css} | 0
src/gl-application.c | 2 +-
src/gl-application.h | 3 ++-
src/gl-window.c | 13 -------------
6 files changed, 4 insertions(+), 25 deletions(-)
---
diff --git a/data/meson.build b/data/meson.build
index 67df7fe..ddfbf47 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -46,15 +46,6 @@ resource_data = files(
gresource = files('org.gnome.Logs.gresource.xml')
-web_files = files(
- 'gl-style.css'
-)
-
-install_data(
- web_files,
- install_dir: gl_pkgdatadir
-)
-
# GSettings schemas
# https://github.com/mesonbuild/meson/issues/1687
custom_target('gsettings-enums',
diff --git a/data/org.gnome.Logs.gresource.xml b/data/org.gnome.Logs.gresource.xml
index fcaf443..6b6686a 100644
--- a/data/org.gnome.Logs.gresource.xml
+++ b/data/org.gnome.Logs.gresource.xml
@@ -6,7 +6,7 @@
<file preprocess='xml-stripblanks'>gl-eventtoolbar.ui</file>
<file preprocess='xml-stripblanks'>gl-eventviewdetail.ui</file>
<file preprocess='xml-stripblanks'>gl-searchpopover.ui</file>
- <file>gl-style.css</file>
+ <file>style.css</file>
<file preprocess='xml-stripblanks'>gl-window.ui</file>
</gresource>
<gresource prefix='/org/gnome/Logs/gtk'>
diff --git a/data/gl-style.css b/data/style.css
similarity index 100%
rename from data/gl-style.css
rename to data/style.css
diff --git a/src/gl-application.c b/src/gl-application.c
index 57c5092..7bc364e 100644
--- a/src/gl-application.c
+++ b/src/gl-application.c
@@ -44,7 +44,7 @@ typedef struct
gchar *monospace_font;
} GlApplicationPrivate;
-G_DEFINE_TYPE_WITH_PRIVATE (GlApplication, gl_application, GTK_TYPE_APPLICATION)
+G_DEFINE_TYPE_WITH_PRIVATE (GlApplication, gl_application, ADW_TYPE_APPLICATION)
static const gchar DESKTOP_SCHEMA[] = "org.gnome.desktop.interface";
static const gchar SETTINGS_SCHEMA[] = "org.gnome.Logs";
diff --git a/src/gl-application.h b/src/gl-application.h
index b254113..f183f46 100644
--- a/src/gl-application.h
+++ b/src/gl-application.h
@@ -20,6 +20,7 @@
#define GL_APPLICATION_H_
#include <gtk/gtk.h>
+#include <libadwaita-1/adwaita.h>
G_BEGIN_DECLS
@@ -31,7 +32,7 @@ typedef enum
} GlSortOrder;
#define GL_TYPE_APPLICATION (gl_application_get_type ())
-G_DECLARE_FINAL_TYPE (GlApplication, gl_application, GL, APPLICATION, GtkApplication)
+G_DECLARE_FINAL_TYPE (GlApplication, gl_application, GL, APPLICATION, AdwApplication)
GtkApplication * gl_application_new (void);
diff --git a/src/gl-window.c b/src/gl-window.c
index 6dd4363..973dd48 100644
--- a/src/gl-window.c
+++ b/src/gl-window.c
@@ -407,8 +407,6 @@ gl_window_load_journal (GlWindow *window,
static void
gl_window_init (GlWindow *window)
{
- GtkCssProvider *provider;
- GdkDisplay *display;
GlWindowPrivate *priv;
GlEventViewList *event_list;
GtkWidget *categories;
@@ -443,21 +441,11 @@ gl_window_init (GlWindow *window)
g_signal_connect_swapped (model, "enable_export",
G_CALLBACK (enable_export), window);
- provider = gtk_css_provider_new ();
- gtk_css_provider_load_from_resource (provider,
- "/org/gnome/Logs/gl-style.css");
-
- display = gdk_display_get_default ();
- gtk_style_context_add_provider_for_display (display,
- GTK_STYLE_PROVIDER (provider),
- GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
-
settings = g_settings_new (SETTINGS_SCHEMA);
ignore = g_settings_get_boolean (settings, IGNORE_WARNING);
/* Don't show info_bar again if users have ever ignored the warning. */
if (ignore)
{
- g_object_unref (provider);
g_object_unref (settings);
return;
}
@@ -504,7 +492,6 @@ gl_window_init (GlWindow *window)
g_assert_not_reached ();
}
- g_object_unref (provider);
g_object_unref (settings);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]