diff options
author | Alexander Mikhaylenko <alexm@gnome.org> | 2023-03-06 21:43:43 +0400 |
---|---|---|
committer | Alexander Mikhaylenko <alexm@gnome.org> | 2023-03-06 21:47:55 +0400 |
commit | 7fe7e04fd90205ae2550e16d1dfec3c91c366151 (patch) | |
tree | 987df1e0b19b0b06f2b5a3f3fe8f28d05e8fed04 | |
parent | e6de502bd054ed5a23743d96a98af6c8d18a03d2 (diff) | |
download | gnome-logs-7fe7e04fd90205ae2550e16d1dfec3c91c366151.tar.gz |
application: Port to AdwApplication
We'll need to override style for HC and it's much easier to do with
autoloading.
Don't install css files - they are use from gresource anyway.
-rw-r--r-- | data/meson.build | 9 | ||||
-rw-r--r-- | data/org.gnome.Logs.gresource.xml | 2 | ||||
-rw-r--r-- | data/style.css (renamed from data/gl-style.css) | 0 | ||||
-rw-r--r-- | src/gl-application.c | 12 | ||||
-rw-r--r-- | src/gl-application.h | 4 | ||||
-rw-r--r-- | src/gl-window.c | 12 |
6 files changed, 5 insertions, 34 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..f95f190 100644 --- a/data/org.gnome.Logs.gresource.xml +++ b/data/org.gnome.Logs.gresource.xml @@ -6,8 +6,8 @@ <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 preprocess='xml-stripblanks'>gl-window.ui</file> + <file>style.css</file> </gresource> <gresource prefix='/org/gnome/Logs/gtk'> <file preprocess='xml-stripblanks'>help-overlay.ui</file> diff --git a/data/gl-style.css b/data/style.css index dfea215..dfea215 100644 --- a/data/gl-style.css +++ b/data/style.css diff --git a/src/gl-application.c b/src/gl-application.c index 2067239..815871b 100644 --- a/src/gl-application.c +++ b/src/gl-application.c @@ -20,7 +20,6 @@ #include "gl-application.h" #include <glib/gi18n.h> -#include <libadwaita-1/adwaita.h> #include "gl-categorylist.h" #include "gl-eventtoolbar.h" @@ -33,7 +32,7 @@ struct _GlApplication { /*< private >*/ - GtkApplication parent_instance; + AdwApplication parent_instance; }; typedef struct @@ -44,7 +43,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"; @@ -193,16 +192,9 @@ gl_application_startup (GApplication *application) /* Calls gtk_init() with no arguments. */ G_APPLICATION_CLASS (gl_application_parent_class)->startup (application); - /* Initialize libadwaita widgets and styling */ - adw_init (); - /* gtk_init() calls setlocale(), so gettext must be called after that. */ g_set_application_name (_(PACKAGE_NAME)); gtk_window_set_default_icon_name (PACKAGE_TARNAME); - - /* Opt-in to color scheme user preference. */ - adw_style_manager_set_color_scheme (adw_style_manager_get_default (), - ADW_COLOR_SCHEME_PREFER_LIGHT); } static void diff --git a/src/gl-application.h b/src/gl-application.h index b254113..801de04 100644 --- a/src/gl-application.h +++ b/src/gl-application.h @@ -19,7 +19,7 @@ #ifndef GL_APPLICATION_H_ #define GL_APPLICATION_H_ -#include <gtk/gtk.h> +#include <adwaita.h> G_BEGIN_DECLS @@ -31,7 +31,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..0265a28 100644 --- a/src/gl-window.c +++ b/src/gl-window.c @@ -407,7 +407,6 @@ gl_window_load_journal (GlWindow *window, static void gl_window_init (GlWindow *window) { - GtkCssProvider *provider; GdkDisplay *display; GlWindowPrivate *priv; GlEventViewList *event_list; @@ -443,21 +442,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 +493,6 @@ gl_window_init (GlWindow *window) g_assert_not_reached (); } - g_object_unref (provider); g_object_unref (settings); } |