diff options
author | Cosimo Cecchi <cosimo@endlessm.com> | 2015-05-12 19:43:32 -0700 |
---|---|---|
committer | Cosimo Cecchi <cosimoc@gnome.org> | 2016-04-03 12:23:21 -0700 |
commit | f45ec47be1244fd16be339dd5be37af3506e05ca (patch) | |
tree | 06e146f3c2f05e2364e707b57642fdb19700b015 | |
parent | d09c219696512d5f365e0920c106b58c0d70bd19 (diff) | |
download | glib-f45ec47be1244fd16be339dd5be37af3506e05ca.tar.gz |
tests: always remove app.desktop
https://bugzilla.gnome.org/show_bug.cgi?id=749606
-rw-r--r-- | gio/tests/appmonitor.c | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/gio/tests/appmonitor.c b/gio/tests/appmonitor.c index 9ce6ff0e3..e0068e176 100644 --- a/gio/tests/appmonitor.c +++ b/gio/tests/appmonitor.c @@ -5,7 +5,6 @@ static gboolean create_app (gpointer data) { const gchar *path = data; - gchar *file; GError *error = NULL; const gchar *contents = "[Desktop Entry]\n" @@ -14,13 +13,9 @@ create_app (gpointer data) "Type=Application\n" "Exec=true\n"; - file = g_build_filename (path, "app.desktop", NULL); - - g_file_set_contents (file, contents, -1, &error); + g_file_set_contents (path, contents, -1, &error); g_assert_no_error (error); - g_free (file); - return G_SOURCE_REMOVE; } @@ -28,13 +23,8 @@ static void delete_app (gpointer data) { const gchar *path = data; - gchar *file; - - file = g_build_filename (path, "app.desktop", NULL); - g_remove (file); - - g_free (file); + g_remove (path); } static gboolean changed_fired; @@ -60,13 +50,15 @@ quit_loop (gpointer data) static void test_app_monitor (void) { - gchar *path; + gchar *path, *app_path; GAppInfoMonitor *monitor; GMainLoop *loop; path = g_build_filename (g_get_user_data_dir (), "applications", NULL); g_mkdir (path, 0755); + app_path = g_build_filename (path, "app.desktop", NULL); + /* FIXME: this shouldn't be required */ g_list_free_full (g_app_info_get_all (), g_object_unref); @@ -75,7 +67,7 @@ test_app_monitor (void) g_signal_connect (monitor, "changed", G_CALLBACK (changed_cb), loop); - g_idle_add (create_app, path); + g_idle_add (create_app, app_path); g_timeout_add_seconds (3, quit_loop, loop); g_main_loop_run (loop); @@ -94,10 +86,12 @@ test_app_monitor (void) g_assert (changed_fired); g_main_loop_unref (loop); + g_remove (app_path); g_object_unref (monitor); g_free (path); + g_free (app_path); } int |