[epiphany] ephy-web-app-utils: be more careful listing applications



commit 75e3424275e8d45268bdf8c48e9be9dc23b4f713
Author: Diego Escalante Urrelo <diegoe igalia com>
Date:   Fri Feb 10 15:55:06 2012 -0500

    ephy-web-app-utils: be more careful listing applications
    
    Check if the .desktop file exists to prevent false positives.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=669836

 embed/ephy-web-app-utils.c |   33 +++++++++++++++++----------------
 1 files changed, 17 insertions(+), 16 deletions(-)
---
diff --git a/embed/ephy-web-app-utils.c b/embed/ephy-web-app-utils.c
index b9447c3..6c3c4d3 100644
--- a/embed/ephy-web-app-utils.c
+++ b/embed/ephy-web-app-utils.c
@@ -384,7 +384,6 @@ ephy_web_application_get_application_list ()
       GDate *date;
       char *desktop_file, *desktop_file_path;
       char *contents;
-      GFile *file;
       GFileInfo *desktop_info;
 
       app = g_slice_new0 (EphyWebApplication);
@@ -399,6 +398,7 @@ ephy_web_application_get_application_list ()
         char **strings;
         GKeyFile *key;
         int i;
+        GFile *file;
 
         key = g_key_file_new ();
         g_key_file_load_from_data (key, contents, -1, 0, NULL);
@@ -412,27 +412,28 @@ ephy_web_application_get_application_list ()
         g_strfreev (strings);
         g_free (exec);
         g_key_file_free (key);
+
+        file = g_file_new_for_path (desktop_file_path);
+
+        /* FIXME: this should use TIME_CREATED but it does not seem to be working. */
+        desktop_info = g_file_query_info (file, G_FILE_ATTRIBUTE_TIME_MODIFIED, 0, NULL, NULL);
+        created = g_file_info_get_attribute_uint64 (desktop_info, G_FILE_ATTRIBUTE_TIME_MODIFIED);
+
+        date = g_date_new ();
+        g_date_set_time_t (date, (time_t)created);
+        g_date_strftime (app->install_date, 127, "%x", date);
+
+        g_date_free (date);
+        g_object_unref (file);
+        g_object_unref (desktop_info);
+
+        applications = g_list_append (applications, app);
       }
 
       g_free (contents);
       g_free (desktop_file);
       g_free (profile_dir);
-
-      file = g_file_new_for_path (desktop_file_path);
       g_free (desktop_file_path);
-
-      /* FIXME: this should use TIME_CREATED but it does not seem to be working. */
-      desktop_info = g_file_query_info (file, G_FILE_ATTRIBUTE_TIME_MODIFIED, 0, NULL, NULL);
-      created = g_file_info_get_attribute_uint64 (desktop_info, G_FILE_ATTRIBUTE_TIME_MODIFIED);
-      date = g_date_new ();
-      g_date_set_time_t (date, (time_t)created);
-      g_date_strftime (app->install_date, 127, "%x", date);
-      g_date_free (date);
-      g_object_unref (file);
-      g_object_unref (desktop_info);
-
-      applications = g_list_append (applications, app);
-
     }
 
     g_object_unref (info);



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