application: load css file from resources
This commit is contained in:
@@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
#include <glib/gi18n.h>
|
#include <glib/gi18n.h>
|
||||||
|
|
||||||
#define CSS_FILE UI_DATA_DIR "/gtk-styles.css"
|
#define CSS_FILE "resource:///org/gnome/calendar/gtk-styles.css"
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
@@ -158,6 +158,7 @@ static void
|
|||||||
gcal_application_startup (GApplication *app)
|
gcal_application_startup (GApplication *app)
|
||||||
{
|
{
|
||||||
GcalApplicationPrivate *priv;
|
GcalApplicationPrivate *priv;
|
||||||
|
GFile* css_file;
|
||||||
GError *error;
|
GError *error;
|
||||||
|
|
||||||
priv = gcal_application_get_instance_private (GCAL_APPLICATION (app));
|
priv = gcal_application_get_instance_private (GCAL_APPLICATION (app));
|
||||||
@@ -173,7 +174,8 @@ gcal_application_startup (GApplication *app)
|
|||||||
G_MAXUINT);
|
G_MAXUINT);
|
||||||
|
|
||||||
error = NULL;
|
error = NULL;
|
||||||
gtk_css_provider_load_from_path (priv->provider, CSS_FILE, &error);
|
css_file = g_file_new_for_uri (CSS_FILE);
|
||||||
|
gtk_css_provider_load_from_file (priv->provider, css_file, &error);
|
||||||
if (error != NULL)
|
if (error != NULL)
|
||||||
{
|
{
|
||||||
g_warning ("Error loading stylesheet from file %s. %s",
|
g_warning ("Error loading stylesheet from file %s. %s",
|
||||||
@@ -184,6 +186,8 @@ gcal_application_startup (GApplication *app)
|
|||||||
g_object_set (gtk_settings_get_default (),
|
g_object_set (gtk_settings_get_default (),
|
||||||
"gtk-application-prefer-dark-theme", FALSE,
|
"gtk-application-prefer-dark-theme", FALSE,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
|
g_object_unref (css_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
priv->manager = gcal_manager_new ();
|
priv->manager = gcal_manager_new ();
|
||||||
|
|||||||
Reference in New Issue
Block a user