[gedit] Explicitly check for resource existence if not required



commit d50e7e9a6c93bb1654057e701aeddd93b68b1d2a
Author: Jesse van den Kieboom <jessevdk gnome org>
Date:   Tue Aug 26 19:07:08 2014 +0200

    Explicitly check for resource existence if not required

 gedit/gedit-app.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/gedit/gedit-app.c b/gedit/gedit-app.c
index 743c5b9..a1950c5 100644
--- a/gedit/gedit-app.c
+++ b/gedit/gedit-app.c
@@ -490,6 +490,11 @@ load_css_from_resource (const gchar *filename,
        css_file = g_file_new_for_uri (resource_name);
        g_free (resource_name);
 
+       if (!required && !g_file_query_exists (css_file, NULL))
+       {
+               return;
+       }
+
        provider = gtk_css_provider_new ();
 
        if (gtk_css_provider_load_from_file (provider, css_file, &error))
@@ -501,11 +506,7 @@ load_css_from_resource (const gchar *filename,
        }
        else
        {
-               if (required || error->domain == GTK_CSS_PROVIDER_ERROR)
-               {
-                       g_warning ("Could not load css provider: %s", error->message);
-               }
-
+               g_warning ("Could not load css provider: %s", error->message);
                g_error_free (error);
        }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]