Replace deprecated g_dirname

This patch replaces the deprecated glib function g_dirname with g_path_get_dirname.